From 17d386d905f6fa2bedd6686998d3589009c11d5a Mon Sep 17 00:00:00 2001 From: Luke Vella Date: Wed, 12 Feb 2025 11:42:39 +0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=8C=90=20=20Make=20discount=20value=20a?= =?UTF-8?q?=20parameter=20(#1557)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/web/src/app/api/stripe/webhook/route.ts | 2 ++ packages/emails/locales/en/emails.json | 4 ++-- .../emails/src/previews/abandoned-checkout.tsx | 2 ++ .../emails/src/templates/abandoned-checkout.tsx | 14 ++++++++++---- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/apps/web/src/app/api/stripe/webhook/route.ts b/apps/web/src/app/api/stripe/webhook/route.ts index 5b742a393..07afbbeab 100644 --- a/apps/web/src/app/api/stripe/webhook/route.ts +++ b/apps/web/src/app/api/stripe/webhook/route.ts @@ -266,6 +266,8 @@ export async function POST(request: NextRequest) { }, props: { name: session.customer_details?.name ?? undefined, + discount: 20, + couponCode: "GETPRO1Y20", recoveryUrl, }, }, diff --git a/packages/emails/locales/en/emails.json b/packages/emails/locales/en/emails.json index 0fae12eea..9200e1404 100644 --- a/packages/emails/locales/en/emails.json +++ b/packages/emails/locales/en/emails.json @@ -60,7 +60,7 @@ "abandoned_checkout_offer": "To help you get started, you can get {{discount}}% off your first year. Just use the code below when you check out:", "abandoned_checkout_button": "Upgrade to Rallly Pro", "abandoned_checkout_support": "If you have any questions about Rallly Pro or need help with anything at all, just reply to this email. I'm here to help!", - "abandoned_checkout_preview": "Exclusive offer: Get 20% off your first year of Rallly Pro!", - "abandoned_checkout_subject": "Get 20% off your first year of Rallly Pro", + "abandoned_checkout_preview": "Exclusive offer: Get {{discount}}% off your first year of Rallly Pro!", + "abandoned_checkout_subject": "Get {{discount}}% off your first year of Rallly Pro", "abandoned_checkout_signoff": "Best regards," } diff --git a/packages/emails/src/previews/abandoned-checkout.tsx b/packages/emails/src/previews/abandoned-checkout.tsx index fcb64cc26..bc4315c6b 100644 --- a/packages/emails/src/previews/abandoned-checkout.tsx +++ b/packages/emails/src/previews/abandoned-checkout.tsx @@ -5,6 +5,8 @@ export default function AbandonedCheckoutEmailPreview() { return ( diff --git a/packages/emails/src/templates/abandoned-checkout.tsx b/packages/emails/src/templates/abandoned-checkout.tsx index 147ca745a..01c3252c1 100644 --- a/packages/emails/src/templates/abandoned-checkout.tsx +++ b/packages/emails/src/templates/abandoned-checkout.tsx @@ -7,12 +7,16 @@ import type { EmailContext } from "../types"; interface AbandonedCheckoutEmailProps { recoveryUrl: string; + discount: number; + couponCode: string; name?: string; ctx: EmailContext; } export const AbandonedCheckoutEmail = ({ recoveryUrl, + discount, + couponCode, name, ctx, }: AbandonedCheckoutEmailProps) => { @@ -22,7 +26,8 @@ export const AbandonedCheckoutEmail = ({ poweredBy={false} preview={ctx.t("abandoned_checkout_preview", { defaultValue: - "Exclusive offer: Get 20% off your first year of Rallly Pro!", + "Exclusive offer: Get {{discount}}% off your first year of Rallly Pro!", + discount, ns: "emails", })} > @@ -68,7 +73,7 @@ export const AbandonedCheckoutEmail = ({ defaults="To help you get started, I'd like to offer you {{discount}}% off your first year with Rallly Pro. Simply use this code during checkout:" ns="emails" values={{ - discount: 20, + discount, }} components={{ b: , @@ -84,7 +89,7 @@ export const AbandonedCheckoutEmail = ({ fontWeight: "bold", }} > - GETPRO1Y20 + {couponCode}