11import { Link , Text } from "@react-email/components" ;
22
33import { Template } from "../templates/btrix.js" ;
4- import { formatDate , offsetDays } from "../lib/date.js" ;
4+ import {
5+ differenceInDays ,
6+ formatDate ,
7+ formatRelativeDateToParts ,
8+ offsetDays ,
9+ } from "../lib/date.js" ;
510import { Warning } from "../components/warning.js" ;
611import { Card } from "../components/card.js" ;
712
@@ -28,14 +33,16 @@ export const SubscriptionCancelEmail = ({
2833 support_email,
2934} : SubscriptionCancelEmailProps ) => {
3035 const date = formatDate ( cancel_date ) ;
36+ const daysLeft = differenceInDays ( new Date ( cancel_date ) ) ;
37+ const relativeParts = formatRelativeDateToParts ( daysLeft , "days" ) ;
3138 return (
3239 < Template
33- preview = { "Your Browsertrix subscription is cancelling " }
40+ preview = { "You’ve cancelled your Browsertrix subscription " }
3441 title = {
3542 < >
3643 Your < strong className = "text-stone-900" > Browsertrix</ strong > { " " }
37- subscription will be
38- < br /> cancelled on < strong className = "text-stone-900" > { date } </ strong >
44+ subscription will
45+ < br /> end on < strong className = "text-stone-900" > { date } </ strong >
3946 </ >
4047 }
4148 disclaimer = {
@@ -71,9 +78,19 @@ export const SubscriptionCancelEmail = ({
7178 < Text className = "text-base text-stone-700" > Hello { user_name } ,</ Text >
7279
7380 < Text className = "text-base text-stone-700" >
74- The Browsertrix subscription for your organization “
75- < strong className = "text-stone-900" > { org_name } </ strong > ” is scheduled to
76- be cancelled at the end of this subscription period.
81+ This is confirming that you’ve cancelled your Browsertrix subscription
82+ for your “< strong className = "text-stone-900" > { org_name } </ strong > ”
83+ organization. Your subscription ends{ " " }
84+ { relativeParts . map ( ( part , index ) =>
85+ part . value !== "in " ? (
86+ < strong key = { part . value + index } className = "text-stone-900" >
87+ { part . value }
88+ </ strong >
89+ ) : (
90+ part . value
91+ ) ,
92+ ) }
93+ , and will not be renewed.
7794 </ Text >
7895
7996 < Warning >
@@ -99,7 +116,7 @@ export const SubscriptionCancelEmail = ({
99116 >
100117 billing settings
101118 </ Link > { " " }
102- at any time before < strong className = "text-stone-900" > { date } </ strong > .
119+ at any time before then .
103120 </ Text >
104121
105122 < Text className = "text-base text-stone-700" >
0 commit comments