refactor: abstract site URL across email templates

- Add NEXT_PUBLIC_SITE_URL to .env.local
- Update email templates to accept siteUrl prop
- Update webhook handler to pass siteUrl from env var
- Update create-webhooks.graphql with placeholder URL
This commit is contained in:
Unchained
2026-03-25 10:33:03 +02:00
parent b8b3a57e6f
commit 4fcd4b3ba8
7 changed files with 36 additions and 13 deletions
+4 -2
View File
@@ -17,6 +17,7 @@ interface OrderConfirmationProps {
items: OrderItem[];
total: string;
shippingAddress?: string;
siteUrl: string;
}
const translations: Record<
@@ -101,11 +102,12 @@ export function OrderConfirmation({
items,
total,
shippingAddress,
siteUrl,
}: OrderConfirmationProps) {
const t = translations[language] || translations.en;
return (
<BaseLayout previewText={t.preview} language={language}>
<BaseLayout previewText={t.preview} language={language} siteUrl={siteUrl}>
<Text style={styles.title}>{t.title}</Text>
<Text style={styles.greeting}>{t.greeting.replace("{name}", customerName)}</Text>
<Text style={styles.text}>{t.orderReceived}</Text>
@@ -142,7 +144,7 @@ export function OrderConfirmation({
)}
<Section style={styles.buttonSection}>
<Button href="https://manoonoils.com" style={styles.button}>
<Button href={siteUrl} style={styles.button}>
{language === "sr"
? "Pogledajte narudžbinu"
: language === "de"