@vrplatform/email 1.0.2-44604174374 → 1.0.2-45363534056
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/main/templates/OwnerStatementEmailTemplate.d.ts +36 -1
- package/build/main/templates/OwnerStatementEmailTemplate.js +86 -10
- package/build/main/templates/OwnerStatementEmailTemplate.js.map +1 -1
- package/build/main/templates/YearEndStatementEmailTemplate.d.ts +23 -0
- package/build/main/templates/YearEndStatementEmailTemplate.js +37 -0
- package/build/main/templates/YearEndStatementEmailTemplate.js.map +1 -0
- package/build/main/templates/index.d.ts +1 -0
- package/build/main/templates/index.js +1 -0
- package/build/main/templates/index.js.map +1 -1
- package/build/module/templates/OwnerStatementEmailTemplate.d.ts +36 -1
- package/build/module/templates/OwnerStatementEmailTemplate.js +85 -10
- package/build/module/templates/OwnerStatementEmailTemplate.js.map +1 -1
- package/build/module/templates/YearEndStatementEmailTemplate.d.ts +23 -0
- package/build/module/templates/YearEndStatementEmailTemplate.js +32 -0
- package/build/module/templates/YearEndStatementEmailTemplate.js.map +1 -0
- package/build/module/templates/index.d.ts +1 -0
- package/build/module/templates/index.js +1 -0
- package/build/module/templates/index.js.map +1 -1
- package/package.json +1 -1
- package/src/templates/OwnerStatementEmailTemplate.tsx +168 -10
- package/src/templates/YearEndStatementEmailTemplate.tsx +66 -0
- package/src/templates/index.ts +1 -0
|
@@ -6,7 +6,42 @@ export declare const getDefaultOwnerStatementEmailData: (mode: 'tag' | 'text', a
|
|
|
6
6
|
userName: string;
|
|
7
7
|
month: string;
|
|
8
8
|
}) => ActionEmailData;
|
|
9
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Subject and text of the emails about an owner payment, which a team's saved
|
|
11
|
+
* statement template does not change: the receipt once Stripe has the money,
|
|
12
|
+
* and the failed-payment email.
|
|
13
|
+
*/
|
|
14
|
+
export declare const getOwnerPaymentEmailData: (kind: 'received' | 'failed', args: {
|
|
15
|
+
appName: string;
|
|
16
|
+
ownerStatementHref: string;
|
|
17
|
+
listingName: string;
|
|
18
|
+
userName: string;
|
|
19
|
+
month: string;
|
|
20
|
+
}) => ActionEmailData;
|
|
21
|
+
export declare const OwnerStatementEmailTemplate: ({ data, tenant, themeColors, mode, user, listing, month, unsubscribeHref, renewHref, payment, yearEnd, }: ActionEmailTemplateProps & {
|
|
10
22
|
/** Requests a new no-login link once the emailed one has expired. */
|
|
11
23
|
renewHref?: string;
|
|
24
|
+
/**
|
|
25
|
+
* A year-end statement: its eyebrow, the Fiscal year (`month`) and Listings
|
|
26
|
+
* rows, and the link opening only the year-end statement.
|
|
27
|
+
*/
|
|
28
|
+
yearEnd?: {
|
|
29
|
+
listings?: string;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* The owner payment block: what is due with the pay button, a reserve
|
|
33
|
+
* top-up due when the balance end is not negative, a payment received, or a
|
|
34
|
+
* payment that failed.
|
|
35
|
+
*/
|
|
36
|
+
payment?: {
|
|
37
|
+
kind: 'due' | 'reserveTopUp' | 'received' | 'failed';
|
|
38
|
+
/** Formatted amount, such as `$1,284.50`. */
|
|
39
|
+
amount: string;
|
|
40
|
+
/** Short lines under the amount, such as `Please pay by Oct 16, 2026`. */
|
|
41
|
+
details: string[];
|
|
42
|
+
/** Opens the payment page. */
|
|
43
|
+
payHref?: string;
|
|
44
|
+
/** How the owner can pay on the payment page. */
|
|
45
|
+
methods?: ('ach' | 'card')[];
|
|
46
|
+
};
|
|
12
47
|
}) => import("react").JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.OwnerStatementEmailTemplate = exports.getDefaultOwnerStatementEmailData = void 0;
|
|
3
|
+
exports.OwnerStatementEmailTemplate = exports.getOwnerPaymentEmailData = exports.getDefaultOwnerStatementEmailData = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const text_1 = require("@react-email/text");
|
|
6
6
|
const extensions_1 = require("../extensions");
|
|
@@ -32,16 +32,43 @@ const getDefaultOwnerStatementEmailData = (mode, args) => {
|
|
|
32
32
|
};
|
|
33
33
|
};
|
|
34
34
|
exports.getDefaultOwnerStatementEmailData = getDefaultOwnerStatementEmailData;
|
|
35
|
+
/**
|
|
36
|
+
* Subject and text of the emails about an owner payment, which a team's saved
|
|
37
|
+
* statement template does not change: the receipt once Stripe has the money,
|
|
38
|
+
* and the failed-payment email.
|
|
39
|
+
*/
|
|
40
|
+
const getOwnerPaymentEmailData = (kind, args) => ({
|
|
41
|
+
subject: kind === 'received'
|
|
42
|
+
? `Payment received for your ${args.month} statement for ${args.listingName}`
|
|
43
|
+
: `Your payment for the ${args.month} statement for ${args.listingName} failed`,
|
|
44
|
+
shortDescription: kind === 'received'
|
|
45
|
+
? `${args.appName} received your payment.`
|
|
46
|
+
: 'Your bank did not complete your payment.',
|
|
47
|
+
header: kind === 'received' ? 'Payment received' : 'Your payment failed',
|
|
48
|
+
bodyOne: kind === 'received'
|
|
49
|
+
? `<p>Hi ${args.userName},</p><p>${args.appName} received your payment for your ${args.month} owner statement for ${args.listingName}. Thank you.</p>`
|
|
50
|
+
: `<p>Hi ${args.userName},</p><p>Your bank did not complete your payment for your ${args.month} owner statement for ${args.listingName}. Pay again with the button below.</p>`,
|
|
51
|
+
buttonText: 'View statement',
|
|
52
|
+
bodyTwo: `<p style="color:#737373;font-size:13px">If the button doesn't work, copy this link into your browser: ${args.ownerStatementHref}</p>`,
|
|
53
|
+
href: args.ownerStatementHref,
|
|
54
|
+
});
|
|
55
|
+
exports.getOwnerPaymentEmailData = getOwnerPaymentEmailData;
|
|
35
56
|
const mutedColor = '#737373';
|
|
36
57
|
const borderColor = '#e5e7eb';
|
|
37
|
-
const
|
|
58
|
+
const paymentColors = {
|
|
59
|
+
due: { background: '#fef2f2', border: '#fecaca', text: '#991b1b' },
|
|
60
|
+
reserveTopUp: { background: '#eff6ff', border: '#bfdbfe', text: '#1e40af' },
|
|
61
|
+
failed: { background: '#fef2f2', border: '#fecaca', text: '#991b1b' },
|
|
62
|
+
received: { background: '#f0fdf4', border: '#bbf7d0', text: '#166534' },
|
|
63
|
+
};
|
|
64
|
+
const OwnerStatementEmailTemplate = ({ data, tenant, themeColors, mode, user, listing, month, unsubscribeHref, renewHref, payment, yearEnd, }) => {
|
|
38
65
|
const parse = (html) => (0, utils_1.parseEmailHtml)(html, {
|
|
39
66
|
href: data.href,
|
|
40
67
|
userName: user.firstName || '',
|
|
41
68
|
date: month || '',
|
|
42
69
|
listingName: listing || '',
|
|
43
70
|
});
|
|
44
|
-
return ((0, jsx_runtime_1.jsxs)(EmailContainer_1.EmailContainer, { title: data.subject, shortDescription: data.shortDescription, tenant: tenant, mode: mode, unsubscribeHref: unsubscribeHref, children: [(0, jsx_runtime_1.jsx)(EmailHeading_1.EmailHeading, { eyebrow:
|
|
71
|
+
return ((0, jsx_runtime_1.jsxs)(EmailContainer_1.EmailContainer, { title: data.subject, shortDescription: data.shortDescription, tenant: tenant, mode: mode, unsubscribeHref: unsubscribeHref, children: [(0, jsx_runtime_1.jsx)(EmailHeading_1.EmailHeading, { eyebrow: yearEnd ? 'Year-end statement' : 'Owner statement', themeColors: themeColors, children: data.header?.trim() || 'Your owner statement is ready' }), data.banner?.trim() && ((0, jsx_runtime_1.jsx)(text_1.Text, { style: {
|
|
45
72
|
padding: '16px 20px',
|
|
46
73
|
backgroundColor: '#f8f9fa',
|
|
47
74
|
borderLeft: `3px solid ${themeColors[8]}`,
|
|
@@ -50,15 +77,20 @@ const OwnerStatementEmailTemplate = ({ data, tenant, themeColors, mode, user, li
|
|
|
50
77
|
whiteSpace: 'pre-line',
|
|
51
78
|
}, children: data.banner.trim() })), (0, jsx_runtime_1.jsx)("div", {
|
|
52
79
|
// biome-ignore lint/security/noDangerouslySetInnerHtml: values are escaped by parseEmailHtml
|
|
53
|
-
dangerouslySetInnerHTML: { __html: parse(data.bodyOne) } }), (listing || month) && ((0, jsx_runtime_1.jsx)("table", { role: "presentation", cellPadding: 0, cellSpacing: 0, width: "100%", style: {
|
|
80
|
+
dangerouslySetInnerHTML: { __html: parse(data.bodyOne) } }), (listing || month || yearEnd?.listings) && ((0, jsx_runtime_1.jsx)("table", { role: "presentation", cellPadding: 0, cellSpacing: 0, width: "100%", style: {
|
|
54
81
|
border: `1px solid ${borderColor}`,
|
|
55
82
|
borderRadius: '8px',
|
|
56
83
|
borderCollapse: 'separate',
|
|
57
84
|
margin: '24px 0 0',
|
|
58
|
-
}, children: (0, jsx_runtime_1.jsx)("tbody", { children:
|
|
59
|
-
[
|
|
60
|
-
|
|
61
|
-
|
|
85
|
+
}, children: (0, jsx_runtime_1.jsx)("tbody", { children: (yearEnd
|
|
86
|
+
? [
|
|
87
|
+
['Fiscal year', month],
|
|
88
|
+
['Listings', yearEnd.listings],
|
|
89
|
+
]
|
|
90
|
+
: [
|
|
91
|
+
['Property', listing],
|
|
92
|
+
['Statement', month],
|
|
93
|
+
]).map(([label, value], index) => value ? ((0, jsx_runtime_1.jsxs)("tr", { children: [(0, jsx_runtime_1.jsx)("td", { style: {
|
|
62
94
|
padding: '14px 20px',
|
|
63
95
|
color: mutedColor,
|
|
64
96
|
fontSize: 14,
|
|
@@ -69,12 +101,56 @@ const OwnerStatementEmailTemplate = ({ data, tenant, themeColors, mode, user, li
|
|
|
69
101
|
fontWeight: 600,
|
|
70
102
|
textAlign: 'right',
|
|
71
103
|
borderTop: index ? `1px solid ${borderColor}` : 'none',
|
|
72
|
-
}, children: value })] }, label)) : null) }) })), (0, jsx_runtime_1.
|
|
104
|
+
}, children: value })] }, label)) : null) }) })), payment && ((0, jsx_runtime_1.jsxs)("div", { "data-testid": "owner-payment-block", style: {
|
|
105
|
+
padding: '24px 20px',
|
|
106
|
+
backgroundColor: paymentColors[payment.kind].background,
|
|
107
|
+
border: `1px solid ${paymentColors[payment.kind].border}`,
|
|
108
|
+
borderRadius: '8px',
|
|
109
|
+
margin: '24px 0 0',
|
|
110
|
+
textAlign: 'center',
|
|
111
|
+
}, children: [(0, jsx_runtime_1.jsx)(text_1.Text, { style: {
|
|
112
|
+
color: paymentColors[payment.kind].text,
|
|
113
|
+
fontSize: 14,
|
|
114
|
+
fontWeight: 600,
|
|
115
|
+
margin: 0,
|
|
116
|
+
}, children: payment.kind === 'due'
|
|
117
|
+
? 'Balance due'
|
|
118
|
+
: payment.kind === 'reserveTopUp'
|
|
119
|
+
? 'Reserve top-up due'
|
|
120
|
+
: payment.kind === 'received'
|
|
121
|
+
? 'Payment received'
|
|
122
|
+
: 'Payment failed' }), (0, jsx_runtime_1.jsx)(text_1.Text, { style: {
|
|
123
|
+
color: paymentColors[payment.kind].text,
|
|
124
|
+
fontSize: 32,
|
|
125
|
+
fontWeight: 700,
|
|
126
|
+
lineHeight: '40px',
|
|
127
|
+
margin: '8px 0',
|
|
128
|
+
}, children: payment.amount }), payment.details.map((detail) => ((0, jsx_runtime_1.jsx)(text_1.Text, { style: {
|
|
129
|
+
color: paymentColors[payment.kind].text,
|
|
130
|
+
fontSize: 14,
|
|
131
|
+
margin: '4px 0 0',
|
|
132
|
+
}, children: detail }, detail))), payment.payHref && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Button_1.Button, { href: payment.payHref, mode: mode, "data-testid": "pay-owner-balance-button", label: payment.kind === 'failed'
|
|
133
|
+
? 'Pay again'
|
|
134
|
+
: payment.kind === 'reserveTopUp'
|
|
135
|
+
? 'Pay balance'
|
|
136
|
+
: 'Pay Deficit Balance', themeColors: themeColors, style: { marginTop: '20px', marginBottom: '12px' } }), (0, jsx_runtime_1.jsx)(text_1.Text, { style: { color: mutedColor, fontSize: 12, margin: 0 }, children: !payment.methods?.includes('card')
|
|
137
|
+
? 'Bank transfer (ACH), secured by Stripe'
|
|
138
|
+
: payment.methods.includes('ach')
|
|
139
|
+
? 'Bank transfer (ACH) or card, secured by Stripe'
|
|
140
|
+
: 'Card, secured by Stripe' })] }))] })), (0, jsx_runtime_1.jsx)(Button_1.Button, { href: data.href, mode: mode, "data-testid": "view-owner-statement-button", label: data.buttonText?.trim() || 'View statement', themeColors: themeColors, style: {
|
|
141
|
+
marginTop: '24px',
|
|
142
|
+
marginBottom: '32px',
|
|
143
|
+
...(payment?.payHref && {
|
|
144
|
+
background: '#ffffff',
|
|
145
|
+
border: `1px solid ${themeColors[8]}`,
|
|
146
|
+
color: themeColors[8],
|
|
147
|
+
}),
|
|
148
|
+
} }), renewHref && ((0, jsx_runtime_1.jsxs)("div", { style: {
|
|
73
149
|
padding: '20px',
|
|
74
150
|
backgroundColor: '#f8f9fa',
|
|
75
151
|
borderRadius: '8px',
|
|
76
152
|
marginBottom: '32px',
|
|
77
|
-
}, children: [(0, jsx_runtime_1.jsx)(text_1.Text, { style: { fontWeight: 600, margin: '0 0 4px' }, children: "Link expired?" }), (0, jsx_runtime_1.
|
|
153
|
+
}, children: [(0, jsx_runtime_1.jsx)(text_1.Text, { style: { fontWeight: 600, margin: '0 0 4px' }, children: "Link expired?" }), (0, jsx_runtime_1.jsxs)(text_1.Text, { style: { color: mutedColor, fontSize: 14, margin: 0 }, children: ["For your security, this link opens only this", ' ', yearEnd ? 'year-end statement' : 'statement', " and works for 7 days. After that, request a new one and we'll email it to this address."] }), (0, jsx_runtime_1.jsx)(Button_1.Button, { href: renewHref, mode: mode, "data-testid": "renew-owner-statement-link-button", label: "Send me a new link", themeColors: themeColors, style: {
|
|
78
154
|
background: '#ffffff',
|
|
79
155
|
border: `1px solid ${themeColors[8]}`,
|
|
80
156
|
color: themeColors[8],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OwnerStatementEmailTemplate.js","sourceRoot":"src/","sources":["templates/OwnerStatementEmailTemplate.tsx"],"names":[],"mappings":";;;;AAAA,4CAAyC;AACzC,8CAKuB;AAKvB,iDAA8C;AAC9C,iEAA8D;AAC9D,6DAA0D;AAC1D,+CAAqD;AAE9C,MAAM,iCA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BACL,OAAO,EAAE,MAAM;oBACf,eAAe,EAAE,SAAS;oBAC1B,YAAY,EAAE,KAAK;oBACnB,YAAY,EAAE,MAAM;iBACrB,aAED,uBAAC,WAAI,IAAC,KAAK,EAAE,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,8BAE5C,EACP,uBAAC,WAAI,IAAC,KAAK,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,+JAIpD,EACP,uBAAC,eAAM,IACL,IAAI,EAAE,SAAS,EACf,IAAI,EAAE,IAAI,iBACE,mCAAmC,EAC/C,KAAK,EAAC,oBAAoB,EAC1B,WAAW,EAAE,WAAW,EACxB,KAAK,EAAE;4BACL,UAAU,EAAE,SAAS;4BACrB,MAAM,EAAE,aAAa,WAAW,CAAC,CAAC,CAAC,EAAE;4BACrC,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC;4BACrB,SAAS,EAAE,MAAM;4BACjB,YAAY,EAAE,CAAC;yBAChB,GACD,IACE,CACP,EAED;gBACE,6FAA6F;gBAC7F,uBAAuB,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,GACxD,IACa,CAClB,CAAC;AACJ,CAAC,CAAC;AAvJW,QAAA,2BAA2B,GAA3B,2BAA2B,CAuJtC","sourcesContent":["import { Text } from '@react-email/text';\nimport {\n EMAIL_ACTION_LINK_COMPONENT,\n EMAIL_DATE_COMPONENT,\n EMAIL_LISTING_COMPONENT,\n EMAIL_USER_NAME_COMPONENT,\n} from '../extensions';\nimport type {\n ActionEmailData,\n ActionEmailTemplateProps,\n} from '../components/ActionEmailTemplate';\nimport { Button } from '../components/Button';\nimport { EmailContainer } from '../components/EmailContainer';\nimport { EmailHeading } from '../components/EmailHeading';\nimport { parseEmailHtml } from '../components/utils';\n\nexport const getDefaultOwnerStatementEmailData = (\n mode: 'tag' | 'text',\n args: {\n appName: string;\n ownerStatementHref: string;\n listingName: string;\n userName: string;\n month: string;\n }\n): ActionEmailData => {\n const ownerStatementHref =\n mode === 'tag' ? EMAIL_ACTION_LINK_COMPONENT : args.ownerStatementHref;\n\n const listingName =\n mode === 'tag' ? EMAIL_LISTING_COMPONENT : args.listingName;\n const month = mode === 'tag' ? EMAIL_DATE_COMPONENT : args.month;\n const userName = mode === 'tag' ? EMAIL_USER_NAME_COMPONENT : args.userName;\n\n // Owners open the statement by link without a login and viewers log in to\n // the owner portal, so the text names neither. Subject and preview text are\n // plain text without tokens, so a saved template must not keep the editor's\n // sample month and listing.\n return {\n subject:\n mode === 'tag'\n ? 'Your owner statement is ready'\n : `Your ${args.month} owner statement for ${args.listingName}`,\n shortDescription:\n mode === 'tag'\n ? 'Your owner statement is ready to view.'\n : `Your ${args.month} statement for ${args.listingName} is ready to view.`,\n header: 'Your owner statement is ready',\n bodyOne: `<p>Hi ${userName},</p><p>${args.appName} published your ${month} owner statement for ${listingName}. Open it with the button below.</p>`,\n buttonText: 'View statement',\n bodyTwo: `<p style=\"color:#737373;font-size:13px\">If the button doesn't work, copy this link into your browser: ${ownerStatementHref}</p>`,\n href: args.ownerStatementHref,\n };\n};\n\nconst mutedColor = '#737373';\nconst borderColor = '#e5e7eb';\n\nexport const OwnerStatementEmailTemplate = ({\n data,\n tenant,\n themeColors,\n mode,\n user,\n listing,\n month,\n unsubscribeHref,\n renewHref,\n}: ActionEmailTemplateProps & {\n /** Requests a new no-login link once the emailed one has expired. */\n renewHref?: string;\n}) => {\n const parse = (html: string) =>\n parseEmailHtml(html, {\n href: data.href,\n userName: user.firstName || '',\n date: month || '',\n listingName: listing || '',\n });\n\n return (\n <EmailContainer\n title={data.subject}\n shortDescription={data.shortDescription}\n tenant={tenant}\n mode={mode}\n unsubscribeHref={unsubscribeHref}\n >\n <EmailHeading eyebrow=\"Owner statement\" themeColors={themeColors}>\n {data.header?.trim() || 'Your owner statement is ready'}\n </EmailHeading>\n\n {data.banner?.trim() && (\n <Text\n style={{\n padding: '16px 20px',\n backgroundColor: '#f8f9fa',\n borderLeft: `3px solid ${themeColors[8]}`,\n borderRadius: '4px',\n margin: '0 0 32px',\n whiteSpace: 'pre-line',\n }}\n >\n {data.banner.trim()}\n </Text>\n )}\n\n <div\n // biome-ignore lint/security/noDangerouslySetInnerHtml: values are escaped by parseEmailHtml\n dangerouslySetInnerHTML={{ __html: parse(data.bodyOne) }}\n />\n\n {(listing || month) && (\n <table\n role=\"presentation\"\n cellPadding={0}\n cellSpacing={0}\n width=\"100%\"\n style={{\n border: `1px solid ${borderColor}`,\n borderRadius: '8px',\n borderCollapse: 'separate',\n margin: '24px 0 0',\n }}\n >\n <tbody>\n {[\n ['Property', listing],\n ['Statement', month],\n ].map(([label, value], index) =>\n value ? (\n <tr key={label}>\n <td\n style={{\n padding: '14px 20px',\n color: mutedColor,\n fontSize: 14,\n borderTop: index ? `1px solid ${borderColor}` : 'none',\n }}\n >\n {label}\n </td>\n <td\n style={{\n padding: '14px 20px',\n fontSize: 14,\n fontWeight: 600,\n textAlign: 'right',\n borderTop: index ? `1px solid ${borderColor}` : 'none',\n }}\n >\n {value}\n </td>\n </tr>\n ) : null\n )}\n </tbody>\n </table>\n )}\n\n <Button\n href={data.href}\n mode={mode}\n data-testid=\"view-owner-statement-button\"\n label={data.buttonText?.trim() || 'View statement'}\n themeColors={themeColors}\n style={{ marginTop: '24px', marginBottom: '32px' }}\n />\n\n {renewHref && (\n <div\n style={{\n padding: '20px',\n backgroundColor: '#f8f9fa',\n borderRadius: '8px',\n marginBottom: '32px',\n }}\n >\n <Text style={{ fontWeight: 600, margin: '0 0 4px' }}>\n Link expired?\n </Text>\n <Text style={{ color: mutedColor, fontSize: 14, margin: 0 }}>\n For your security, this link opens only this statement and works for\n 7 days. After that, request a new one and we'll email it to this\n address.\n </Text>\n <Button\n href={renewHref}\n mode={mode}\n data-testid=\"renew-owner-statement-link-button\"\n label=\"Send me a new link\"\n themeColors={themeColors}\n style={{\n background: '#ffffff',\n border: `1px solid ${themeColors[8]}`,\n color: themeColors[8],\n marginTop: '16px',\n marginBottom: 0,\n }}\n />\n </div>\n )}\n\n <div\n // biome-ignore lint/security/noDangerouslySetInnerHtml: values are escaped by parseEmailHtml\n dangerouslySetInnerHTML={{ __html: parse(data.bodyTwo) }}\n />\n </EmailContainer>\n );\n};\n"]}
|
|
1
|
+
{"version":3,"file":"OwnerStatementEmailTemplate.js","sourceRoot":"src/","sources":["templates/OwnerStatementEmailTemplate.tsx"],"names":[],"mappings":";;;;AAAA,4CAAyC;AACzC,8CAKuB;AAKvB,iDAA8C;AAC9C,iEAA8D;AAC9D,6DAA0D;AAC1D,+CAAqD;AAE9C,MAAM,iCAAiC,GAAG,CAC/C,IAAoB,EACpB,IAMC,EACgB,EAAE;IACnB,MAAM,kBAAkB,GACtB,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,wCAA2B,CAAC,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC;IAEzE,MAAM,WAAW,GACf,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,oCAAuB,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC;IAC9D,MAAM,KAAK,GAAG,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,iCAAoB,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;IACjE,MAAM,QAAQ,GAAG,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,sCAAyB,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC;IAE5E,0EAA0E;IAC1E,4EAA4E;IAC5E,4EAA4E;IAC5E,4BAA4B;IAC5B,OAAO;QACL,OAAO,EACL,IAAI,KAAK,KAAK;YACZ,CAAC,CAAC,+BAA+B;YACjC,CAAC,CAAC,QAAQ,IAAI,CAAC,KAAK,wBAAwB,IAAI,CAAC,WAAW,EAAE;QAClE,gBAAgB,EACd,IAAI,KAAK,KAAK;YACZ,CAAC,CAAC,wCAAwC;YAC1C,CAAC,CAAC,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4BACrB,SAAS,EAAE,MAAM;4BACjB,YAAY,EAAE,CAAC;yBAChB,GACD,IACE,CACP,EAED;gBACE,6FAA6F;gBAC7F,uBAAuB,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,GACxD,IACa,CAClB,CAAC;AACJ,CAAC,CAAC;AA9QW,QAAA,2BAA2B,GAA3B,2BAA2B,CA8QtC","sourcesContent":["import { Text } from '@react-email/text';\nimport {\n EMAIL_ACTION_LINK_COMPONENT,\n EMAIL_DATE_COMPONENT,\n EMAIL_LISTING_COMPONENT,\n EMAIL_USER_NAME_COMPONENT,\n} from '../extensions';\nimport type {\n ActionEmailData,\n ActionEmailTemplateProps,\n} from '../components/ActionEmailTemplate';\nimport { Button } from '../components/Button';\nimport { EmailContainer } from '../components/EmailContainer';\nimport { EmailHeading } from '../components/EmailHeading';\nimport { parseEmailHtml } from '../components/utils';\n\nexport const getDefaultOwnerStatementEmailData = (\n mode: 'tag' | 'text',\n args: {\n appName: string;\n ownerStatementHref: string;\n listingName: string;\n userName: string;\n month: string;\n }\n): ActionEmailData => {\n const ownerStatementHref =\n mode === 'tag' ? EMAIL_ACTION_LINK_COMPONENT : args.ownerStatementHref;\n\n const listingName =\n mode === 'tag' ? EMAIL_LISTING_COMPONENT : args.listingName;\n const month = mode === 'tag' ? EMAIL_DATE_COMPONENT : args.month;\n const userName = mode === 'tag' ? EMAIL_USER_NAME_COMPONENT : args.userName;\n\n // Owners open the statement by link without a login and viewers log in to\n // the owner portal, so the text names neither. Subject and preview text are\n // plain text without tokens, so a saved template must not keep the editor's\n // sample month and listing.\n return {\n subject:\n mode === 'tag'\n ? 'Your owner statement is ready'\n : `Your ${args.month} owner statement for ${args.listingName}`,\n shortDescription:\n mode === 'tag'\n ? 'Your owner statement is ready to view.'\n : `Your ${args.month} statement for ${args.listingName} is ready to view.`,\n header: 'Your owner statement is ready',\n bodyOne: `<p>Hi ${userName},</p><p>${args.appName} published your ${month} owner statement for ${listingName}. Open it with the button below.</p>`,\n buttonText: 'View statement',\n bodyTwo: `<p style=\"color:#737373;font-size:13px\">If the button doesn't work, copy this link into your browser: ${ownerStatementHref}</p>`,\n href: args.ownerStatementHref,\n };\n};\n\n/**\n * Subject and text of the emails about an owner payment, which a team's saved\n * statement template does not change: the receipt once Stripe has the money,\n * and the failed-payment email.\n */\nexport const getOwnerPaymentEmailData = (\n kind: 'received' | 'failed',\n args: {\n appName: string;\n ownerStatementHref: string;\n listingName: string;\n userName: string;\n month: string;\n }\n): ActionEmailData => ({\n subject:\n kind === 'received'\n ? `Payment received for your ${args.month} statement for ${args.listingName}`\n : `Your payment for the ${args.month} statement for ${args.listingName} failed`,\n shortDescription:\n kind === 'received'\n ? `${args.appName} received your payment.`\n : 'Your bank did not complete your payment.',\n header: kind === 'received' ? 'Payment received' : 'Your payment failed',\n bodyOne:\n kind === 'received'\n ? `<p>Hi ${args.userName},</p><p>${args.appName} received your payment for your ${args.month} owner statement for ${args.listingName}. Thank you.</p>`\n : `<p>Hi ${args.userName},</p><p>Your bank did not complete your payment for your ${args.month} owner statement for ${args.listingName}. Pay again with the button below.</p>`,\n buttonText: 'View statement',\n bodyTwo: `<p style=\"color:#737373;font-size:13px\">If the button doesn't work, copy this link into your browser: ${args.ownerStatementHref}</p>`,\n href: args.ownerStatementHref,\n});\n\nconst mutedColor = '#737373';\nconst borderColor = '#e5e7eb';\nconst paymentColors = {\n due: { background: '#fef2f2', border: '#fecaca', text: '#991b1b' },\n reserveTopUp: { background: '#eff6ff', border: '#bfdbfe', text: '#1e40af' },\n failed: { background: '#fef2f2', border: '#fecaca', text: '#991b1b' },\n received: { background: '#f0fdf4', border: '#bbf7d0', text: '#166534' },\n};\n\nexport const OwnerStatementEmailTemplate = ({\n data,\n tenant,\n themeColors,\n mode,\n user,\n listing,\n month,\n unsubscribeHref,\n renewHref,\n payment,\n yearEnd,\n}: ActionEmailTemplateProps & {\n /** Requests a new no-login link once the emailed one has expired. */\n renewHref?: string;\n /**\n * A year-end statement: its eyebrow, the Fiscal year (`month`) and Listings\n * rows, and the link opening only the year-end statement.\n */\n yearEnd?: { listings?: string };\n /**\n * The owner payment block: what is due with the pay button, a reserve\n * top-up due when the balance end is not negative, a payment received, or a\n * payment that failed.\n */\n payment?: {\n kind: 'due' | 'reserveTopUp' | 'received' | 'failed';\n /** Formatted amount, such as `$1,284.50`. */\n amount: string;\n /** Short lines under the amount, such as `Please pay by Oct 16, 2026`. */\n details: string[];\n /** Opens the payment page. */\n payHref?: string;\n /** How the owner can pay on the payment page. */\n methods?: ('ach' | 'card')[];\n };\n}) => {\n const parse = (html: string) =>\n parseEmailHtml(html, {\n href: data.href,\n userName: user.firstName || '',\n date: month || '',\n listingName: listing || '',\n });\n\n return (\n <EmailContainer\n title={data.subject}\n shortDescription={data.shortDescription}\n tenant={tenant}\n mode={mode}\n unsubscribeHref={unsubscribeHref}\n >\n <EmailHeading\n eyebrow={yearEnd ? 'Year-end statement' : 'Owner statement'}\n themeColors={themeColors}\n >\n {data.header?.trim() || 'Your owner statement is ready'}\n </EmailHeading>\n\n {data.banner?.trim() && (\n <Text\n style={{\n padding: '16px 20px',\n backgroundColor: '#f8f9fa',\n borderLeft: `3px solid ${themeColors[8]}`,\n borderRadius: '4px',\n margin: '0 0 32px',\n whiteSpace: 'pre-line',\n }}\n >\n {data.banner.trim()}\n </Text>\n )}\n\n <div\n // biome-ignore lint/security/noDangerouslySetInnerHtml: values are escaped by parseEmailHtml\n dangerouslySetInnerHTML={{ __html: parse(data.bodyOne) }}\n />\n\n {(listing || month || yearEnd?.listings) && (\n <table\n role=\"presentation\"\n cellPadding={0}\n cellSpacing={0}\n width=\"100%\"\n style={{\n border: `1px solid ${borderColor}`,\n borderRadius: '8px',\n borderCollapse: 'separate',\n margin: '24px 0 0',\n }}\n >\n <tbody>\n {(yearEnd\n ? [\n ['Fiscal year', month],\n ['Listings', yearEnd.listings],\n ]\n : [\n ['Property', listing],\n ['Statement', month],\n ]\n ).map(([label, value], index) =>\n value ? (\n <tr key={label}>\n <td\n style={{\n padding: '14px 20px',\n color: mutedColor,\n fontSize: 14,\n borderTop: index ? `1px solid ${borderColor}` : 'none',\n }}\n >\n {label}\n </td>\n <td\n style={{\n padding: '14px 20px',\n fontSize: 14,\n fontWeight: 600,\n textAlign: 'right',\n borderTop: index ? `1px solid ${borderColor}` : 'none',\n }}\n >\n {value}\n </td>\n </tr>\n ) : null\n )}\n </tbody>\n </table>\n )}\n\n {payment && (\n <div\n data-testid=\"owner-payment-block\"\n style={{\n padding: '24px 20px',\n backgroundColor: paymentColors[payment.kind].background,\n border: `1px solid ${paymentColors[payment.kind].border}`,\n borderRadius: '8px',\n margin: '24px 0 0',\n textAlign: 'center',\n }}\n >\n <Text\n style={{\n color: paymentColors[payment.kind].text,\n fontSize: 14,\n fontWeight: 600,\n margin: 0,\n }}\n >\n {payment.kind === 'due'\n ? 'Balance due'\n : payment.kind === 'reserveTopUp'\n ? 'Reserve top-up due'\n : payment.kind === 'received'\n ? 'Payment received'\n : 'Payment failed'}\n </Text>\n <Text\n style={{\n color: paymentColors[payment.kind].text,\n fontSize: 32,\n fontWeight: 700,\n lineHeight: '40px',\n margin: '8px 0',\n }}\n >\n {payment.amount}\n </Text>\n {payment.details.map((detail) => (\n <Text\n key={detail}\n style={{\n color: paymentColors[payment.kind].text,\n fontSize: 14,\n margin: '4px 0 0',\n }}\n >\n {detail}\n </Text>\n ))}\n {payment.payHref && (\n <>\n <Button\n href={payment.payHref}\n mode={mode}\n data-testid=\"pay-owner-balance-button\"\n label={\n payment.kind === 'failed'\n ? 'Pay again'\n : payment.kind === 'reserveTopUp'\n ? 'Pay balance'\n : 'Pay Deficit Balance'\n }\n themeColors={themeColors}\n style={{ marginTop: '20px', marginBottom: '12px' }}\n />\n <Text style={{ color: mutedColor, fontSize: 12, margin: 0 }}>\n {!payment.methods?.includes('card')\n ? 'Bank transfer (ACH), secured by Stripe'\n : payment.methods.includes('ach')\n ? 'Bank transfer (ACH) or card, secured by Stripe'\n : 'Card, secured by Stripe'}\n </Text>\n </>\n )}\n </div>\n )}\n\n <Button\n href={data.href}\n mode={mode}\n data-testid=\"view-owner-statement-button\"\n label={data.buttonText?.trim() || 'View statement'}\n themeColors={themeColors}\n style={{\n marginTop: '24px',\n marginBottom: '32px',\n ...(payment?.payHref && {\n background: '#ffffff',\n border: `1px solid ${themeColors[8]}`,\n color: themeColors[8],\n }),\n }}\n />\n\n {renewHref && (\n <div\n style={{\n padding: '20px',\n backgroundColor: '#f8f9fa',\n borderRadius: '8px',\n marginBottom: '32px',\n }}\n >\n <Text style={{ fontWeight: 600, margin: '0 0 4px' }}>\n Link expired?\n </Text>\n <Text style={{ color: mutedColor, fontSize: 14, margin: 0 }}>\n For your security, this link opens only this{' '}\n {yearEnd ? 'year-end statement' : 'statement'} and works for 7 days.\n After that, request a new one and we'll email it to this address.\n </Text>\n <Button\n href={renewHref}\n mode={mode}\n data-testid=\"renew-owner-statement-link-button\"\n label=\"Send me a new link\"\n themeColors={themeColors}\n style={{\n background: '#ffffff',\n border: `1px solid ${themeColors[8]}`,\n color: themeColors[8],\n marginTop: '16px',\n marginBottom: 0,\n }}\n />\n </div>\n )}\n\n <div\n // biome-ignore lint/security/noDangerouslySetInnerHtml: values are escaped by parseEmailHtml\n dangerouslySetInnerHTML={{ __html: parse(data.bodyTwo) }}\n />\n </EmailContainer>\n );\n};\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ActionEmailData, ActionEmailTemplateProps } from '../components/ActionEmailTemplate';
|
|
2
|
+
/**
|
|
3
|
+
* Default text of the `yearEndStatement` email: an owner's year-end statement
|
|
4
|
+
* of a fiscal year is published. Owners open it by a no-login link, viewers
|
|
5
|
+
* in the owner portal. Settings > Emails shows it; its text is fixed.
|
|
6
|
+
*/
|
|
7
|
+
export declare const getDefaultYearEndStatementEmailData: (mode: 'tag' | 'text', args: {
|
|
8
|
+
appName: string;
|
|
9
|
+
href: string;
|
|
10
|
+
userName: string;
|
|
11
|
+
/** The fiscal year, such as `2025`. */
|
|
12
|
+
year: string;
|
|
13
|
+
/** The months it covers, such as `Jan 2025 - Dec 2025`. */
|
|
14
|
+
period: string;
|
|
15
|
+
}) => ActionEmailData;
|
|
16
|
+
export declare const YearEndStatementEmailTemplate: ({ period, listings, ...props }: Omit<ActionEmailTemplateProps, 'listing' | 'month'> & {
|
|
17
|
+
/** The months the statement covers, such as `Jan 2025 - Dec 2025`. */
|
|
18
|
+
period: string;
|
|
19
|
+
/** The owner's listings in the year, such as `Lake House, Casita`. */
|
|
20
|
+
listings?: string;
|
|
21
|
+
/** Requests a new no-login link once the emailed one has expired. */
|
|
22
|
+
renewHref?: string;
|
|
23
|
+
}) => import("react").JSX.Element;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.YearEndStatementEmailTemplate = exports.getDefaultYearEndStatementEmailData = void 0;
|
|
4
|
+
const extensions_1 = require("../extensions");
|
|
5
|
+
const OwnerStatementEmailTemplate_1 = require("./OwnerStatementEmailTemplate");
|
|
6
|
+
/**
|
|
7
|
+
* Default text of the `yearEndStatement` email: an owner's year-end statement
|
|
8
|
+
* of a fiscal year is published. Owners open it by a no-login link, viewers
|
|
9
|
+
* in the owner portal. Settings > Emails shows it; its text is fixed.
|
|
10
|
+
*/
|
|
11
|
+
const getDefaultYearEndStatementEmailData = (mode, args) => {
|
|
12
|
+
const href = mode === 'tag' ? extensions_1.EMAIL_ACTION_LINK_COMPONENT : args.href;
|
|
13
|
+
const period = mode === 'tag' ? extensions_1.EMAIL_DATE_COMPONENT : args.period;
|
|
14
|
+
const userName = mode === 'tag' ? extensions_1.EMAIL_USER_NAME_COMPONENT : args.userName;
|
|
15
|
+
return {
|
|
16
|
+
subject: mode === 'tag'
|
|
17
|
+
? 'Your year-end statement is ready'
|
|
18
|
+
: `Your ${args.year} year-end statement`,
|
|
19
|
+
shortDescription: mode === 'tag'
|
|
20
|
+
? 'Your year-end statement is ready to view.'
|
|
21
|
+
: `Your ${args.year} year-end statement is ready to view.`,
|
|
22
|
+
header: 'Your year-end statement is ready',
|
|
23
|
+
bodyOne: `<p>Hi ${userName},</p><p>${args.appName} published your year-end statement for ${period}. It sums up your owner statements of the year. Open it with the button below.</p>`,
|
|
24
|
+
buttonText: 'View year-end statement',
|
|
25
|
+
bodyTwo: `<p style="color:#737373;font-size:13px">If the button doesn't work, copy this link into your browser: ${href}</p>`,
|
|
26
|
+
href: args.href,
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
exports.getDefaultYearEndStatementEmailData = getDefaultYearEndStatementEmailData;
|
|
30
|
+
const YearEndStatementEmailTemplate = ({ period, listings, ...props }) => (0, OwnerStatementEmailTemplate_1.OwnerStatementEmailTemplate)({
|
|
31
|
+
...props,
|
|
32
|
+
listing: undefined,
|
|
33
|
+
month: period,
|
|
34
|
+
yearEnd: { listings },
|
|
35
|
+
});
|
|
36
|
+
exports.YearEndStatementEmailTemplate = YearEndStatementEmailTemplate;
|
|
37
|
+
//# sourceMappingURL=YearEndStatementEmailTemplate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"YearEndStatementEmailTemplate.js","sourceRoot":"src/","sources":["templates/YearEndStatementEmailTemplate.tsx"],"names":[],"mappings":";;;AAAA,8CAIuB;AAKvB,+EAA4E;AAE5E;;;;GAIG;AACI,MAAM,mCAAmC,GAAG,CACjD,IAAoB,EACpB,IAQC,EACgB,EAAE;IACnB,MAAM,IAAI,GAAG,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,wCAA2B,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;IACtE,MAAM,MAAM,GAAG,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,iCAAoB,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC;IACnE,MAAM,QAAQ,GAAG,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,sCAAyB,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC;IAC5E,OAAO;QACL,OAAO,EACL,IAAI,KAAK,KAAK;YACZ,CAAC,CAAC,kCAAkC;YACpC,CAAC,CAAC,QAAQ,IAAI,CAAC,IAAI,qBAAqB;QAC5C,gBAAgB,EACd,IAAI,KAAK,KAAK;YACZ,CAAC,CAAC,2CAA2C;YAC7C,CAAC,CAAC,QAAQ,IAAI,CAAC,IAAI,uCAAuC;QAC9D,MAAM,EAAE,kCAAkC;QAC1C,OAAO,EAAE,SAAS,QAAQ,WAAW,IAAI,CAAC,OAAO,0CAA0C,MAAM,oFAAoF;QACrL,UAAU,EAAE,yBAAyB;QACrC,OAAO,EAAE,yGAAyG,IAAI,MAAM;QAC5H,IAAI,EAAE,IAAI,CAAC,IAAI;KAChB,CAAC;AACJ,CAAC,CAAC;AA9BW,QAAA,mCAAmC,GAAnC,mCAAmC,CA8B9C;AAEK,MAAM,6BAA6B,GAAG,CAAC,EAC5C,MAAM,EACN,QAAQ,EACR,GAAG,KAAK,EAQT,EAAE,EAAE,CACH,IAAA,yDAA2B,EAAC;IAC1B,GAAG,KAAK;IACR,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,MAAM;IACb,OAAO,EAAE,EAAE,QAAQ,EAAE;CACtB,CAAC,CAAC;AAjBQ,QAAA,6BAA6B,GAA7B,6BAA6B,CAiBrC","sourcesContent":["import {\n EMAIL_ACTION_LINK_COMPONENT,\n EMAIL_DATE_COMPONENT,\n EMAIL_USER_NAME_COMPONENT,\n} from '../extensions';\nimport type {\n ActionEmailData,\n ActionEmailTemplateProps,\n} from '../components/ActionEmailTemplate';\nimport { OwnerStatementEmailTemplate } from './OwnerStatementEmailTemplate';\n\n/**\n * Default text of the `yearEndStatement` email: an owner's year-end statement\n * of a fiscal year is published. Owners open it by a no-login link, viewers\n * in the owner portal. Settings > Emails shows it; its text is fixed.\n */\nexport const getDefaultYearEndStatementEmailData = (\n mode: 'tag' | 'text',\n args: {\n appName: string;\n href: string;\n userName: string;\n /** The fiscal year, such as `2025`. */\n year: string;\n /** The months it covers, such as `Jan 2025 - Dec 2025`. */\n period: string;\n }\n): ActionEmailData => {\n const href = mode === 'tag' ? EMAIL_ACTION_LINK_COMPONENT : args.href;\n const period = mode === 'tag' ? EMAIL_DATE_COMPONENT : args.period;\n const userName = mode === 'tag' ? EMAIL_USER_NAME_COMPONENT : args.userName;\n return {\n subject:\n mode === 'tag'\n ? 'Your year-end statement is ready'\n : `Your ${args.year} year-end statement`,\n shortDescription:\n mode === 'tag'\n ? 'Your year-end statement is ready to view.'\n : `Your ${args.year} year-end statement is ready to view.`,\n header: 'Your year-end statement is ready',\n bodyOne: `<p>Hi ${userName},</p><p>${args.appName} published your year-end statement for ${period}. It sums up your owner statements of the year. Open it with the button below.</p>`,\n buttonText: 'View year-end statement',\n bodyTwo: `<p style=\"color:#737373;font-size:13px\">If the button doesn't work, copy this link into your browser: ${href}</p>`,\n href: args.href,\n };\n};\n\nexport const YearEndStatementEmailTemplate = ({\n period,\n listings,\n ...props\n}: Omit<ActionEmailTemplateProps, 'listing' | 'month'> & {\n /** The months the statement covers, such as `Jan 2025 - Dec 2025`. */\n period: string;\n /** The owner's listings in the year, such as `Lake House, Casita`. */\n listings?: string;\n /** Requests a new no-login link once the emailed one has expired. */\n renewHref?: string;\n}) =>\n OwnerStatementEmailTemplate({\n ...props,\n listing: undefined,\n month: period,\n yearEnd: { listings },\n });\n"]}
|
|
@@ -5,6 +5,7 @@ export * from './TeamRoleGrantedEmailTemplate';
|
|
|
5
5
|
export * from './TenantSuspensionEmailTemplate';
|
|
6
6
|
export * from './TenantDeletionEmailTemplate';
|
|
7
7
|
export * from './OwnerStatementEmailTemplate';
|
|
8
|
+
export * from './YearEndStatementEmailTemplate';
|
|
8
9
|
export * from './BankAccountChangedEmailTemplate';
|
|
9
10
|
export * from './BankAccountChangedTeamAdminEmailTemplate';
|
|
10
11
|
export * from './BankDetailsRequestEmailTemplate';
|
|
@@ -23,6 +23,7 @@ __exportStar(require("./TenantSuspensionEmailTemplate"), exports);
|
|
|
23
23
|
__exportStar(require("./TenantDeletionEmailTemplate"), exports);
|
|
24
24
|
// Owner Statements
|
|
25
25
|
__exportStar(require("./OwnerStatementEmailTemplate"), exports);
|
|
26
|
+
__exportStar(require("./YearEndStatementEmailTemplate"), exports);
|
|
26
27
|
// Payment setup
|
|
27
28
|
__exportStar(require("./BankAccountChangedEmailTemplate"), exports);
|
|
28
29
|
__exportStar(require("./BankAccountChangedTeamAdminEmailTemplate"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"src/","sources":["templates/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,QAAQ;AACR,mEAAiD;AACjD,qEAAmD;AACnD,yEAAuD;AACvD,iEAA+C;AAC/C,kEAAgD;AAChD,gEAA8C;AAE9C,mBAAmB;AACnB,gEAA8C;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"src/","sources":["templates/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,QAAQ;AACR,mEAAiD;AACjD,qEAAmD;AACnD,yEAAuD;AACvD,iEAA+C;AAC/C,kEAAgD;AAChD,gEAA8C;AAE9C,mBAAmB;AACnB,gEAA8C;AAC9C,kEAAgD;AAEhD,gBAAgB;AAChB,oEAAkD;AAClD,6EAA2D;AAC3D,oEAAkD;AAElD,QAAQ;AACR,yEAAuD;AACvD,yDAAuC;AAEvC,cAAc;AACd,6DAA2C;AAC3C,0DAAwC","sourcesContent":["// Teams\nexport * from './SecondFactorResetEmailTemplate';\nexport * from './TeamApiTokenCreatedEmailTemplate';\nexport * from './TeamInviteOutsideDomainEmailTemplate';\nexport * from './TeamRoleGrantedEmailTemplate';\nexport * from './TenantSuspensionEmailTemplate';\nexport * from './TenantDeletionEmailTemplate';\n\n// Owner Statements\nexport * from './OwnerStatementEmailTemplate';\nexport * from './YearEndStatementEmailTemplate';\n\n// Payment setup\nexport * from './BankAccountChangedEmailTemplate';\nexport * from './BankAccountChangedTeamAdminEmailTemplate';\nexport * from './BankDetailsRequestEmailTemplate';\n\n// 1099s\nexport * from './Tax1099ConsentWithdrawnEmailTemplate';\nexport * from './Tax1099EmailTemplate';\n\n// Invitations\nexport * from './InviteOwnerEmailTemplate';\nexport * from './InvitePmEmailTemplate';\n"]}
|
|
@@ -6,7 +6,42 @@ export declare const getDefaultOwnerStatementEmailData: (mode: 'tag' | 'text', a
|
|
|
6
6
|
userName: string;
|
|
7
7
|
month: string;
|
|
8
8
|
}) => ActionEmailData;
|
|
9
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Subject and text of the emails about an owner payment, which a team's saved
|
|
11
|
+
* statement template does not change: the receipt once Stripe has the money,
|
|
12
|
+
* and the failed-payment email.
|
|
13
|
+
*/
|
|
14
|
+
export declare const getOwnerPaymentEmailData: (kind: 'received' | 'failed', args: {
|
|
15
|
+
appName: string;
|
|
16
|
+
ownerStatementHref: string;
|
|
17
|
+
listingName: string;
|
|
18
|
+
userName: string;
|
|
19
|
+
month: string;
|
|
20
|
+
}) => ActionEmailData;
|
|
21
|
+
export declare const OwnerStatementEmailTemplate: ({ data, tenant, themeColors, mode, user, listing, month, unsubscribeHref, renewHref, payment, yearEnd, }: ActionEmailTemplateProps & {
|
|
10
22
|
/** Requests a new no-login link once the emailed one has expired. */
|
|
11
23
|
renewHref?: string;
|
|
24
|
+
/**
|
|
25
|
+
* A year-end statement: its eyebrow, the Fiscal year (`month`) and Listings
|
|
26
|
+
* rows, and the link opening only the year-end statement.
|
|
27
|
+
*/
|
|
28
|
+
yearEnd?: {
|
|
29
|
+
listings?: string;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* The owner payment block: what is due with the pay button, a reserve
|
|
33
|
+
* top-up due when the balance end is not negative, a payment received, or a
|
|
34
|
+
* payment that failed.
|
|
35
|
+
*/
|
|
36
|
+
payment?: {
|
|
37
|
+
kind: 'due' | 'reserveTopUp' | 'received' | 'failed';
|
|
38
|
+
/** Formatted amount, such as `$1,284.50`. */
|
|
39
|
+
amount: string;
|
|
40
|
+
/** Short lines under the amount, such as `Please pay by Oct 16, 2026`. */
|
|
41
|
+
details: string[];
|
|
42
|
+
/** Opens the payment page. */
|
|
43
|
+
payHref?: string;
|
|
44
|
+
/** How the owner can pay on the payment page. */
|
|
45
|
+
methods?: ('ach' | 'card')[];
|
|
46
|
+
};
|
|
12
47
|
}) => import("react").JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Text } from '@react-email/text';
|
|
3
3
|
import { EMAIL_ACTION_LINK_COMPONENT, EMAIL_DATE_COMPONENT, EMAIL_LISTING_COMPONENT, EMAIL_USER_NAME_COMPONENT, } from '../extensions';
|
|
4
4
|
import { Button } from '../components/Button';
|
|
@@ -28,16 +28,42 @@ export const getDefaultOwnerStatementEmailData = (mode, args) => {
|
|
|
28
28
|
href: args.ownerStatementHref,
|
|
29
29
|
};
|
|
30
30
|
};
|
|
31
|
+
/**
|
|
32
|
+
* Subject and text of the emails about an owner payment, which a team's saved
|
|
33
|
+
* statement template does not change: the receipt once Stripe has the money,
|
|
34
|
+
* and the failed-payment email.
|
|
35
|
+
*/
|
|
36
|
+
export const getOwnerPaymentEmailData = (kind, args) => ({
|
|
37
|
+
subject: kind === 'received'
|
|
38
|
+
? `Payment received for your ${args.month} statement for ${args.listingName}`
|
|
39
|
+
: `Your payment for the ${args.month} statement for ${args.listingName} failed`,
|
|
40
|
+
shortDescription: kind === 'received'
|
|
41
|
+
? `${args.appName} received your payment.`
|
|
42
|
+
: 'Your bank did not complete your payment.',
|
|
43
|
+
header: kind === 'received' ? 'Payment received' : 'Your payment failed',
|
|
44
|
+
bodyOne: kind === 'received'
|
|
45
|
+
? `<p>Hi ${args.userName},</p><p>${args.appName} received your payment for your ${args.month} owner statement for ${args.listingName}. Thank you.</p>`
|
|
46
|
+
: `<p>Hi ${args.userName},</p><p>Your bank did not complete your payment for your ${args.month} owner statement for ${args.listingName}. Pay again with the button below.</p>`,
|
|
47
|
+
buttonText: 'View statement',
|
|
48
|
+
bodyTwo: `<p style="color:#737373;font-size:13px">If the button doesn't work, copy this link into your browser: ${args.ownerStatementHref}</p>`,
|
|
49
|
+
href: args.ownerStatementHref,
|
|
50
|
+
});
|
|
31
51
|
const mutedColor = '#737373';
|
|
32
52
|
const borderColor = '#e5e7eb';
|
|
33
|
-
|
|
53
|
+
const paymentColors = {
|
|
54
|
+
due: { background: '#fef2f2', border: '#fecaca', text: '#991b1b' },
|
|
55
|
+
reserveTopUp: { background: '#eff6ff', border: '#bfdbfe', text: '#1e40af' },
|
|
56
|
+
failed: { background: '#fef2f2', border: '#fecaca', text: '#991b1b' },
|
|
57
|
+
received: { background: '#f0fdf4', border: '#bbf7d0', text: '#166534' },
|
|
58
|
+
};
|
|
59
|
+
export const OwnerStatementEmailTemplate = ({ data, tenant, themeColors, mode, user, listing, month, unsubscribeHref, renewHref, payment, yearEnd, }) => {
|
|
34
60
|
const parse = (html) => parseEmailHtml(html, {
|
|
35
61
|
href: data.href,
|
|
36
62
|
userName: user.firstName || '',
|
|
37
63
|
date: month || '',
|
|
38
64
|
listingName: listing || '',
|
|
39
65
|
});
|
|
40
|
-
return (_jsxs(EmailContainer, { title: data.subject, shortDescription: data.shortDescription, tenant: tenant, mode: mode, unsubscribeHref: unsubscribeHref, children: [_jsx(EmailHeading, { eyebrow:
|
|
66
|
+
return (_jsxs(EmailContainer, { title: data.subject, shortDescription: data.shortDescription, tenant: tenant, mode: mode, unsubscribeHref: unsubscribeHref, children: [_jsx(EmailHeading, { eyebrow: yearEnd ? 'Year-end statement' : 'Owner statement', themeColors: themeColors, children: data.header?.trim() || 'Your owner statement is ready' }), data.banner?.trim() && (_jsx(Text, { style: {
|
|
41
67
|
padding: '16px 20px',
|
|
42
68
|
backgroundColor: '#f8f9fa',
|
|
43
69
|
borderLeft: `3px solid ${themeColors[8]}`,
|
|
@@ -46,15 +72,20 @@ export const OwnerStatementEmailTemplate = ({ data, tenant, themeColors, mode, u
|
|
|
46
72
|
whiteSpace: 'pre-line',
|
|
47
73
|
}, children: data.banner.trim() })), _jsx("div", {
|
|
48
74
|
// biome-ignore lint/security/noDangerouslySetInnerHtml: values are escaped by parseEmailHtml
|
|
49
|
-
dangerouslySetInnerHTML: { __html: parse(data.bodyOne) } }), (listing || month) && (_jsx("table", { role: "presentation", cellPadding: 0, cellSpacing: 0, width: "100%", style: {
|
|
75
|
+
dangerouslySetInnerHTML: { __html: parse(data.bodyOne) } }), (listing || month || yearEnd?.listings) && (_jsx("table", { role: "presentation", cellPadding: 0, cellSpacing: 0, width: "100%", style: {
|
|
50
76
|
border: `1px solid ${borderColor}`,
|
|
51
77
|
borderRadius: '8px',
|
|
52
78
|
borderCollapse: 'separate',
|
|
53
79
|
margin: '24px 0 0',
|
|
54
|
-
}, children: _jsx("tbody", { children:
|
|
55
|
-
[
|
|
56
|
-
|
|
57
|
-
|
|
80
|
+
}, children: _jsx("tbody", { children: (yearEnd
|
|
81
|
+
? [
|
|
82
|
+
['Fiscal year', month],
|
|
83
|
+
['Listings', yearEnd.listings],
|
|
84
|
+
]
|
|
85
|
+
: [
|
|
86
|
+
['Property', listing],
|
|
87
|
+
['Statement', month],
|
|
88
|
+
]).map(([label, value], index) => value ? (_jsxs("tr", { children: [_jsx("td", { style: {
|
|
58
89
|
padding: '14px 20px',
|
|
59
90
|
color: mutedColor,
|
|
60
91
|
fontSize: 14,
|
|
@@ -65,12 +96,56 @@ export const OwnerStatementEmailTemplate = ({ data, tenant, themeColors, mode, u
|
|
|
65
96
|
fontWeight: 600,
|
|
66
97
|
textAlign: 'right',
|
|
67
98
|
borderTop: index ? `1px solid ${borderColor}` : 'none',
|
|
68
|
-
}, children: value })] }, label)) : null) }) })),
|
|
99
|
+
}, children: value })] }, label)) : null) }) })), payment && (_jsxs("div", { "data-testid": "owner-payment-block", style: {
|
|
100
|
+
padding: '24px 20px',
|
|
101
|
+
backgroundColor: paymentColors[payment.kind].background,
|
|
102
|
+
border: `1px solid ${paymentColors[payment.kind].border}`,
|
|
103
|
+
borderRadius: '8px',
|
|
104
|
+
margin: '24px 0 0',
|
|
105
|
+
textAlign: 'center',
|
|
106
|
+
}, children: [_jsx(Text, { style: {
|
|
107
|
+
color: paymentColors[payment.kind].text,
|
|
108
|
+
fontSize: 14,
|
|
109
|
+
fontWeight: 600,
|
|
110
|
+
margin: 0,
|
|
111
|
+
}, children: payment.kind === 'due'
|
|
112
|
+
? 'Balance due'
|
|
113
|
+
: payment.kind === 'reserveTopUp'
|
|
114
|
+
? 'Reserve top-up due'
|
|
115
|
+
: payment.kind === 'received'
|
|
116
|
+
? 'Payment received'
|
|
117
|
+
: 'Payment failed' }), _jsx(Text, { style: {
|
|
118
|
+
color: paymentColors[payment.kind].text,
|
|
119
|
+
fontSize: 32,
|
|
120
|
+
fontWeight: 700,
|
|
121
|
+
lineHeight: '40px',
|
|
122
|
+
margin: '8px 0',
|
|
123
|
+
}, children: payment.amount }), payment.details.map((detail) => (_jsx(Text, { style: {
|
|
124
|
+
color: paymentColors[payment.kind].text,
|
|
125
|
+
fontSize: 14,
|
|
126
|
+
margin: '4px 0 0',
|
|
127
|
+
}, children: detail }, detail))), payment.payHref && (_jsxs(_Fragment, { children: [_jsx(Button, { href: payment.payHref, mode: mode, "data-testid": "pay-owner-balance-button", label: payment.kind === 'failed'
|
|
128
|
+
? 'Pay again'
|
|
129
|
+
: payment.kind === 'reserveTopUp'
|
|
130
|
+
? 'Pay balance'
|
|
131
|
+
: 'Pay Deficit Balance', themeColors: themeColors, style: { marginTop: '20px', marginBottom: '12px' } }), _jsx(Text, { style: { color: mutedColor, fontSize: 12, margin: 0 }, children: !payment.methods?.includes('card')
|
|
132
|
+
? 'Bank transfer (ACH), secured by Stripe'
|
|
133
|
+
: payment.methods.includes('ach')
|
|
134
|
+
? 'Bank transfer (ACH) or card, secured by Stripe'
|
|
135
|
+
: 'Card, secured by Stripe' })] }))] })), _jsx(Button, { href: data.href, mode: mode, "data-testid": "view-owner-statement-button", label: data.buttonText?.trim() || 'View statement', themeColors: themeColors, style: {
|
|
136
|
+
marginTop: '24px',
|
|
137
|
+
marginBottom: '32px',
|
|
138
|
+
...(payment?.payHref && {
|
|
139
|
+
background: '#ffffff',
|
|
140
|
+
border: `1px solid ${themeColors[8]}`,
|
|
141
|
+
color: themeColors[8],
|
|
142
|
+
}),
|
|
143
|
+
} }), renewHref && (_jsxs("div", { style: {
|
|
69
144
|
padding: '20px',
|
|
70
145
|
backgroundColor: '#f8f9fa',
|
|
71
146
|
borderRadius: '8px',
|
|
72
147
|
marginBottom: '32px',
|
|
73
|
-
}, children: [_jsx(Text, { style: { fontWeight: 600, margin: '0 0 4px' }, children: "Link expired?" }),
|
|
148
|
+
}, children: [_jsx(Text, { style: { fontWeight: 600, margin: '0 0 4px' }, children: "Link expired?" }), _jsxs(Text, { style: { color: mutedColor, fontSize: 14, margin: 0 }, children: ["For your security, this link opens only this", ' ', yearEnd ? 'year-end statement' : 'statement', " and works for 7 days. After that, request a new one and we'll email it to this address."] }), _jsx(Button, { href: renewHref, mode: mode, "data-testid": "renew-owner-statement-link-button", label: "Send me a new link", themeColors: themeColors, style: {
|
|
74
149
|
background: '#ffffff',
|
|
75
150
|
border: `1px solid ${themeColors[8]}`,
|
|
76
151
|
color: themeColors[8],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OwnerStatementEmailTemplate.js","sourceRoot":"src/","sources":["templates/OwnerStatementEmailTemplate.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EACL,2BAA2B,EAC3B,oBAAoB,EACpB,uBAAuB,EACvB,yBAAyB,GAC1B,MAAM,eAAe,CAAC;AAKvB,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,EAAE,IAAI,EAAE,IAAI,gBAAgB,EAClD,WAAW,EAAE,WAAW,EACxB,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,GAClD,EAED,SAAS,IAAI,CACZ,eACE,KAAK,EAAE;oBACL,OAAO,EAAE,MAAM;oBACf,eAAe,EAAE,SAAS;oBAC1B,YAAY,EAAE,KAAK;oBACnB,YAAY,EAAE,MAAM;iBACrB,aAED,KAAC,IAAI,IAAC,KAAK,EAAE,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,8BAE5C,EACP,KAAC,IAAI,IAAC,KAAK,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,+JAIpD,EACP,KAAC,MAAM,IACL,IAAI,EAAE,SAAS,EACf,IAAI,EAAE,IAAI,iBACE,mCAAmC,EAC/C,KAAK,EAAC,oBAAoB,EAC1B,WAAW,EAAE,WAAW,EACxB,KAAK,EAAE;4BACL,UAAU,EAAE,SAAS;4BACrB,MAAM,EAAE,aAAa,WAAW,CAAC,CAAC,CAAC,EAAE;4BACrC,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC;4BACrB,SAAS,EAAE,MAAM;4BACjB,YAAY,EAAE,CAAC;yBAChB,GACD,IACE,CACP,EAED;gBACE,6FAA6F;gBAC7F,uBAAuB,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,GACxD,IACa,CAClB,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { Text } from '@react-email/text';\nimport {\n EMAIL_ACTION_LINK_COMPONENT,\n EMAIL_DATE_COMPONENT,\n EMAIL_LISTING_COMPONENT,\n EMAIL_USER_NAME_COMPONENT,\n} from '../extensions';\nimport type {\n ActionEmailData,\n ActionEmailTemplateProps,\n} from '../components/ActionEmailTemplate';\nimport { Button } from '../components/Button';\nimport { EmailContainer } from '../components/EmailContainer';\nimport { EmailHeading } from '../components/EmailHeading';\nimport { parseEmailHtml } from '../components/utils';\n\nexport const getDefaultOwnerStatementEmailData = (\n mode: 'tag' | 'text',\n args: {\n appName: string;\n ownerStatementHref: string;\n listingName: string;\n userName: string;\n month: string;\n }\n): ActionEmailData => {\n const ownerStatementHref =\n mode === 'tag' ? EMAIL_ACTION_LINK_COMPONENT : args.ownerStatementHref;\n\n const listingName =\n mode === 'tag' ? EMAIL_LISTING_COMPONENT : args.listingName;\n const month = mode === 'tag' ? EMAIL_DATE_COMPONENT : args.month;\n const userName = mode === 'tag' ? EMAIL_USER_NAME_COMPONENT : args.userName;\n\n // Owners open the statement by link without a login and viewers log in to\n // the owner portal, so the text names neither. Subject and preview text are\n // plain text without tokens, so a saved template must not keep the editor's\n // sample month and listing.\n return {\n subject:\n mode === 'tag'\n ? 'Your owner statement is ready'\n : `Your ${args.month} owner statement for ${args.listingName}`,\n shortDescription:\n mode === 'tag'\n ? 'Your owner statement is ready to view.'\n : `Your ${args.month} statement for ${args.listingName} is ready to view.`,\n header: 'Your owner statement is ready',\n bodyOne: `<p>Hi ${userName},</p><p>${args.appName} published your ${month} owner statement for ${listingName}. Open it with the button below.</p>`,\n buttonText: 'View statement',\n bodyTwo: `<p style=\"color:#737373;font-size:13px\">If the button doesn't work, copy this link into your browser: ${ownerStatementHref}</p>`,\n href: args.ownerStatementHref,\n };\n};\n\nconst mutedColor = '#737373';\nconst borderColor = '#e5e7eb';\n\nexport const OwnerStatementEmailTemplate = ({\n data,\n tenant,\n themeColors,\n mode,\n user,\n listing,\n month,\n unsubscribeHref,\n renewHref,\n}: ActionEmailTemplateProps & {\n /** Requests a new no-login link once the emailed one has expired. */\n renewHref?: string;\n}) => {\n const parse = (html: string) =>\n parseEmailHtml(html, {\n href: data.href,\n userName: user.firstName || '',\n date: month || '',\n listingName: listing || '',\n });\n\n return (\n <EmailContainer\n title={data.subject}\n shortDescription={data.shortDescription}\n tenant={tenant}\n mode={mode}\n unsubscribeHref={unsubscribeHref}\n >\n <EmailHeading eyebrow=\"Owner statement\" themeColors={themeColors}>\n {data.header?.trim() || 'Your owner statement is ready'}\n </EmailHeading>\n\n {data.banner?.trim() && (\n <Text\n style={{\n padding: '16px 20px',\n backgroundColor: '#f8f9fa',\n borderLeft: `3px solid ${themeColors[8]}`,\n borderRadius: '4px',\n margin: '0 0 32px',\n whiteSpace: 'pre-line',\n }}\n >\n {data.banner.trim()}\n </Text>\n )}\n\n <div\n // biome-ignore lint/security/noDangerouslySetInnerHtml: values are escaped by parseEmailHtml\n dangerouslySetInnerHTML={{ __html: parse(data.bodyOne) }}\n />\n\n {(listing || month) && (\n <table\n role=\"presentation\"\n cellPadding={0}\n cellSpacing={0}\n width=\"100%\"\n style={{\n border: `1px solid ${borderColor}`,\n borderRadius: '8px',\n borderCollapse: 'separate',\n margin: '24px 0 0',\n }}\n >\n <tbody>\n {[\n ['Property', listing],\n ['Statement', month],\n ].map(([label, value], index) =>\n value ? (\n <tr key={label}>\n <td\n style={{\n padding: '14px 20px',\n color: mutedColor,\n fontSize: 14,\n borderTop: index ? `1px solid ${borderColor}` : 'none',\n }}\n >\n {label}\n </td>\n <td\n style={{\n padding: '14px 20px',\n fontSize: 14,\n fontWeight: 600,\n textAlign: 'right',\n borderTop: index ? `1px solid ${borderColor}` : 'none',\n }}\n >\n {value}\n </td>\n </tr>\n ) : null\n )}\n </tbody>\n </table>\n )}\n\n <Button\n href={data.href}\n mode={mode}\n data-testid=\"view-owner-statement-button\"\n label={data.buttonText?.trim() || 'View statement'}\n themeColors={themeColors}\n style={{ marginTop: '24px', marginBottom: '32px' }}\n />\n\n {renewHref && (\n <div\n style={{\n padding: '20px',\n backgroundColor: '#f8f9fa',\n borderRadius: '8px',\n marginBottom: '32px',\n }}\n >\n <Text style={{ fontWeight: 600, margin: '0 0 4px' }}>\n Link expired?\n </Text>\n <Text style={{ color: mutedColor, fontSize: 14, margin: 0 }}>\n For your security, this link opens only this statement and works for\n 7 days. After that, request a new one and we'll email it to this\n address.\n </Text>\n <Button\n href={renewHref}\n mode={mode}\n data-testid=\"renew-owner-statement-link-button\"\n label=\"Send me a new link\"\n themeColors={themeColors}\n style={{\n background: '#ffffff',\n border: `1px solid ${themeColors[8]}`,\n color: themeColors[8],\n marginTop: '16px',\n marginBottom: 0,\n }}\n />\n </div>\n )}\n\n <div\n // biome-ignore lint/security/noDangerouslySetInnerHtml: values are escaped by parseEmailHtml\n dangerouslySetInnerHTML={{ __html: parse(data.bodyTwo) }}\n />\n </EmailContainer>\n );\n};\n"]}
|
|
1
|
+
{"version":3,"file":"OwnerStatementEmailTemplate.js","sourceRoot":"src/","sources":["templates/OwnerStatementEmailTemplate.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EACL,2BAA2B,EAC3B,oBAAoB,EACpB,uBAAuB,EACvB,yBAAyB,GAC1B,MAAM,eAAe,CAAC;AAKvB,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,MAAM,CAAC,MAAM,iCAAiC,GAAG,CAC/C,IAAoB,EACpB,IAMC,EACgB,EAAE;IACnB,MAAM,kBAAkB,GACtB,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,2BAA2B,CAAC,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC;IAEzE,MAAM,WAAW,GACf,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC;IAC9D,MAAM,KAAK,GAAG,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;IACjE,MAAM,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CAAC,CAAC,CAAC,WAAW,gGAExC,EACP,KAAC,MAAM,IACL,IAAI,EAAE,SAAS,EACf,IAAI,EAAE,IAAI,iBACE,mCAAmC,EAC/C,KAAK,EAAC,oBAAoB,EAC1B,WAAW,EAAE,WAAW,EACxB,KAAK,EAAE;4BACL,UAAU,EAAE,SAAS;4BACrB,MAAM,EAAE,aAAa,WAAW,CAAC,CAAC,CAAC,EAAE;4BACrC,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC;4BACrB,SAAS,EAAE,MAAM;4BACjB,YAAY,EAAE,CAAC;yBAChB,GACD,IACE,CACP,EAED;gBACE,6FAA6F;gBAC7F,uBAAuB,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,GACxD,IACa,CAClB,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { Text } from '@react-email/text';\nimport {\n EMAIL_ACTION_LINK_COMPONENT,\n EMAIL_DATE_COMPONENT,\n EMAIL_LISTING_COMPONENT,\n EMAIL_USER_NAME_COMPONENT,\n} from '../extensions';\nimport type {\n ActionEmailData,\n ActionEmailTemplateProps,\n} from '../components/ActionEmailTemplate';\nimport { Button } from '../components/Button';\nimport { EmailContainer } from '../components/EmailContainer';\nimport { EmailHeading } from '../components/EmailHeading';\nimport { parseEmailHtml } from '../components/utils';\n\nexport const getDefaultOwnerStatementEmailData = (\n mode: 'tag' | 'text',\n args: {\n appName: string;\n ownerStatementHref: string;\n listingName: string;\n userName: string;\n month: string;\n }\n): ActionEmailData => {\n const ownerStatementHref =\n mode === 'tag' ? EMAIL_ACTION_LINK_COMPONENT : args.ownerStatementHref;\n\n const listingName =\n mode === 'tag' ? EMAIL_LISTING_COMPONENT : args.listingName;\n const month = mode === 'tag' ? EMAIL_DATE_COMPONENT : args.month;\n const userName = mode === 'tag' ? EMAIL_USER_NAME_COMPONENT : args.userName;\n\n // Owners open the statement by link without a login and viewers log in to\n // the owner portal, so the text names neither. Subject and preview text are\n // plain text without tokens, so a saved template must not keep the editor's\n // sample month and listing.\n return {\n subject:\n mode === 'tag'\n ? 'Your owner statement is ready'\n : `Your ${args.month} owner statement for ${args.listingName}`,\n shortDescription:\n mode === 'tag'\n ? 'Your owner statement is ready to view.'\n : `Your ${args.month} statement for ${args.listingName} is ready to view.`,\n header: 'Your owner statement is ready',\n bodyOne: `<p>Hi ${userName},</p><p>${args.appName} published your ${month} owner statement for ${listingName}. Open it with the button below.</p>`,\n buttonText: 'View statement',\n bodyTwo: `<p style=\"color:#737373;font-size:13px\">If the button doesn't work, copy this link into your browser: ${ownerStatementHref}</p>`,\n href: args.ownerStatementHref,\n };\n};\n\n/**\n * Subject and text of the emails about an owner payment, which a team's saved\n * statement template does not change: the receipt once Stripe has the money,\n * and the failed-payment email.\n */\nexport const getOwnerPaymentEmailData = (\n kind: 'received' | 'failed',\n args: {\n appName: string;\n ownerStatementHref: string;\n listingName: string;\n userName: string;\n month: string;\n }\n): ActionEmailData => ({\n subject:\n kind === 'received'\n ? `Payment received for your ${args.month} statement for ${args.listingName}`\n : `Your payment for the ${args.month} statement for ${args.listingName} failed`,\n shortDescription:\n kind === 'received'\n ? `${args.appName} received your payment.`\n : 'Your bank did not complete your payment.',\n header: kind === 'received' ? 'Payment received' : 'Your payment failed',\n bodyOne:\n kind === 'received'\n ? `<p>Hi ${args.userName},</p><p>${args.appName} received your payment for your ${args.month} owner statement for ${args.listingName}. Thank you.</p>`\n : `<p>Hi ${args.userName},</p><p>Your bank did not complete your payment for your ${args.month} owner statement for ${args.listingName}. Pay again with the button below.</p>`,\n buttonText: 'View statement',\n bodyTwo: `<p style=\"color:#737373;font-size:13px\">If the button doesn't work, copy this link into your browser: ${args.ownerStatementHref}</p>`,\n href: args.ownerStatementHref,\n});\n\nconst mutedColor = '#737373';\nconst borderColor = '#e5e7eb';\nconst paymentColors = {\n due: { background: '#fef2f2', border: '#fecaca', text: '#991b1b' },\n reserveTopUp: { background: '#eff6ff', border: '#bfdbfe', text: '#1e40af' },\n failed: { background: '#fef2f2', border: '#fecaca', text: '#991b1b' },\n received: { background: '#f0fdf4', border: '#bbf7d0', text: '#166534' },\n};\n\nexport const OwnerStatementEmailTemplate = ({\n data,\n tenant,\n themeColors,\n mode,\n user,\n listing,\n month,\n unsubscribeHref,\n renewHref,\n payment,\n yearEnd,\n}: ActionEmailTemplateProps & {\n /** Requests a new no-login link once the emailed one has expired. */\n renewHref?: string;\n /**\n * A year-end statement: its eyebrow, the Fiscal year (`month`) and Listings\n * rows, and the link opening only the year-end statement.\n */\n yearEnd?: { listings?: string };\n /**\n * The owner payment block: what is due with the pay button, a reserve\n * top-up due when the balance end is not negative, a payment received, or a\n * payment that failed.\n */\n payment?: {\n kind: 'due' | 'reserveTopUp' | 'received' | 'failed';\n /** Formatted amount, such as `$1,284.50`. */\n amount: string;\n /** Short lines under the amount, such as `Please pay by Oct 16, 2026`. */\n details: string[];\n /** Opens the payment page. */\n payHref?: string;\n /** How the owner can pay on the payment page. */\n methods?: ('ach' | 'card')[];\n };\n}) => {\n const parse = (html: string) =>\n parseEmailHtml(html, {\n href: data.href,\n userName: user.firstName || '',\n date: month || '',\n listingName: listing || '',\n });\n\n return (\n <EmailContainer\n title={data.subject}\n shortDescription={data.shortDescription}\n tenant={tenant}\n mode={mode}\n unsubscribeHref={unsubscribeHref}\n >\n <EmailHeading\n eyebrow={yearEnd ? 'Year-end statement' : 'Owner statement'}\n themeColors={themeColors}\n >\n {data.header?.trim() || 'Your owner statement is ready'}\n </EmailHeading>\n\n {data.banner?.trim() && (\n <Text\n style={{\n padding: '16px 20px',\n backgroundColor: '#f8f9fa',\n borderLeft: `3px solid ${themeColors[8]}`,\n borderRadius: '4px',\n margin: '0 0 32px',\n whiteSpace: 'pre-line',\n }}\n >\n {data.banner.trim()}\n </Text>\n )}\n\n <div\n // biome-ignore lint/security/noDangerouslySetInnerHtml: values are escaped by parseEmailHtml\n dangerouslySetInnerHTML={{ __html: parse(data.bodyOne) }}\n />\n\n {(listing || month || yearEnd?.listings) && (\n <table\n role=\"presentation\"\n cellPadding={0}\n cellSpacing={0}\n width=\"100%\"\n style={{\n border: `1px solid ${borderColor}`,\n borderRadius: '8px',\n borderCollapse: 'separate',\n margin: '24px 0 0',\n }}\n >\n <tbody>\n {(yearEnd\n ? [\n ['Fiscal year', month],\n ['Listings', yearEnd.listings],\n ]\n : [\n ['Property', listing],\n ['Statement', month],\n ]\n ).map(([label, value], index) =>\n value ? (\n <tr key={label}>\n <td\n style={{\n padding: '14px 20px',\n color: mutedColor,\n fontSize: 14,\n borderTop: index ? `1px solid ${borderColor}` : 'none',\n }}\n >\n {label}\n </td>\n <td\n style={{\n padding: '14px 20px',\n fontSize: 14,\n fontWeight: 600,\n textAlign: 'right',\n borderTop: index ? `1px solid ${borderColor}` : 'none',\n }}\n >\n {value}\n </td>\n </tr>\n ) : null\n )}\n </tbody>\n </table>\n )}\n\n {payment && (\n <div\n data-testid=\"owner-payment-block\"\n style={{\n padding: '24px 20px',\n backgroundColor: paymentColors[payment.kind].background,\n border: `1px solid ${paymentColors[payment.kind].border}`,\n borderRadius: '8px',\n margin: '24px 0 0',\n textAlign: 'center',\n }}\n >\n <Text\n style={{\n color: paymentColors[payment.kind].text,\n fontSize: 14,\n fontWeight: 600,\n margin: 0,\n }}\n >\n {payment.kind === 'due'\n ? 'Balance due'\n : payment.kind === 'reserveTopUp'\n ? 'Reserve top-up due'\n : payment.kind === 'received'\n ? 'Payment received'\n : 'Payment failed'}\n </Text>\n <Text\n style={{\n color: paymentColors[payment.kind].text,\n fontSize: 32,\n fontWeight: 700,\n lineHeight: '40px',\n margin: '8px 0',\n }}\n >\n {payment.amount}\n </Text>\n {payment.details.map((detail) => (\n <Text\n key={detail}\n style={{\n color: paymentColors[payment.kind].text,\n fontSize: 14,\n margin: '4px 0 0',\n }}\n >\n {detail}\n </Text>\n ))}\n {payment.payHref && (\n <>\n <Button\n href={payment.payHref}\n mode={mode}\n data-testid=\"pay-owner-balance-button\"\n label={\n payment.kind === 'failed'\n ? 'Pay again'\n : payment.kind === 'reserveTopUp'\n ? 'Pay balance'\n : 'Pay Deficit Balance'\n }\n themeColors={themeColors}\n style={{ marginTop: '20px', marginBottom: '12px' }}\n />\n <Text style={{ color: mutedColor, fontSize: 12, margin: 0 }}>\n {!payment.methods?.includes('card')\n ? 'Bank transfer (ACH), secured by Stripe'\n : payment.methods.includes('ach')\n ? 'Bank transfer (ACH) or card, secured by Stripe'\n : 'Card, secured by Stripe'}\n </Text>\n </>\n )}\n </div>\n )}\n\n <Button\n href={data.href}\n mode={mode}\n data-testid=\"view-owner-statement-button\"\n label={data.buttonText?.trim() || 'View statement'}\n themeColors={themeColors}\n style={{\n marginTop: '24px',\n marginBottom: '32px',\n ...(payment?.payHref && {\n background: '#ffffff',\n border: `1px solid ${themeColors[8]}`,\n color: themeColors[8],\n }),\n }}\n />\n\n {renewHref && (\n <div\n style={{\n padding: '20px',\n backgroundColor: '#f8f9fa',\n borderRadius: '8px',\n marginBottom: '32px',\n }}\n >\n <Text style={{ fontWeight: 600, margin: '0 0 4px' }}>\n Link expired?\n </Text>\n <Text style={{ color: mutedColor, fontSize: 14, margin: 0 }}>\n For your security, this link opens only this{' '}\n {yearEnd ? 'year-end statement' : 'statement'} and works for 7 days.\n After that, request a new one and we'll email it to this address.\n </Text>\n <Button\n href={renewHref}\n mode={mode}\n data-testid=\"renew-owner-statement-link-button\"\n label=\"Send me a new link\"\n themeColors={themeColors}\n style={{\n background: '#ffffff',\n border: `1px solid ${themeColors[8]}`,\n color: themeColors[8],\n marginTop: '16px',\n marginBottom: 0,\n }}\n />\n </div>\n )}\n\n <div\n // biome-ignore lint/security/noDangerouslySetInnerHtml: values are escaped by parseEmailHtml\n dangerouslySetInnerHTML={{ __html: parse(data.bodyTwo) }}\n />\n </EmailContainer>\n );\n};\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ActionEmailData, ActionEmailTemplateProps } from '../components/ActionEmailTemplate';
|
|
2
|
+
/**
|
|
3
|
+
* Default text of the `yearEndStatement` email: an owner's year-end statement
|
|
4
|
+
* of a fiscal year is published. Owners open it by a no-login link, viewers
|
|
5
|
+
* in the owner portal. Settings > Emails shows it; its text is fixed.
|
|
6
|
+
*/
|
|
7
|
+
export declare const getDefaultYearEndStatementEmailData: (mode: 'tag' | 'text', args: {
|
|
8
|
+
appName: string;
|
|
9
|
+
href: string;
|
|
10
|
+
userName: string;
|
|
11
|
+
/** The fiscal year, such as `2025`. */
|
|
12
|
+
year: string;
|
|
13
|
+
/** The months it covers, such as `Jan 2025 - Dec 2025`. */
|
|
14
|
+
period: string;
|
|
15
|
+
}) => ActionEmailData;
|
|
16
|
+
export declare const YearEndStatementEmailTemplate: ({ period, listings, ...props }: Omit<ActionEmailTemplateProps, 'listing' | 'month'> & {
|
|
17
|
+
/** The months the statement covers, such as `Jan 2025 - Dec 2025`. */
|
|
18
|
+
period: string;
|
|
19
|
+
/** The owner's listings in the year, such as `Lake House, Casita`. */
|
|
20
|
+
listings?: string;
|
|
21
|
+
/** Requests a new no-login link once the emailed one has expired. */
|
|
22
|
+
renewHref?: string;
|
|
23
|
+
}) => import("react").JSX.Element;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { EMAIL_ACTION_LINK_COMPONENT, EMAIL_DATE_COMPONENT, EMAIL_USER_NAME_COMPONENT, } from '../extensions';
|
|
2
|
+
import { OwnerStatementEmailTemplate } from './OwnerStatementEmailTemplate';
|
|
3
|
+
/**
|
|
4
|
+
* Default text of the `yearEndStatement` email: an owner's year-end statement
|
|
5
|
+
* of a fiscal year is published. Owners open it by a no-login link, viewers
|
|
6
|
+
* in the owner portal. Settings > Emails shows it; its text is fixed.
|
|
7
|
+
*/
|
|
8
|
+
export const getDefaultYearEndStatementEmailData = (mode, args) => {
|
|
9
|
+
const href = mode === 'tag' ? EMAIL_ACTION_LINK_COMPONENT : args.href;
|
|
10
|
+
const period = mode === 'tag' ? EMAIL_DATE_COMPONENT : args.period;
|
|
11
|
+
const userName = mode === 'tag' ? EMAIL_USER_NAME_COMPONENT : args.userName;
|
|
12
|
+
return {
|
|
13
|
+
subject: mode === 'tag'
|
|
14
|
+
? 'Your year-end statement is ready'
|
|
15
|
+
: `Your ${args.year} year-end statement`,
|
|
16
|
+
shortDescription: mode === 'tag'
|
|
17
|
+
? 'Your year-end statement is ready to view.'
|
|
18
|
+
: `Your ${args.year} year-end statement is ready to view.`,
|
|
19
|
+
header: 'Your year-end statement is ready',
|
|
20
|
+
bodyOne: `<p>Hi ${userName},</p><p>${args.appName} published your year-end statement for ${period}. It sums up your owner statements of the year. Open it with the button below.</p>`,
|
|
21
|
+
buttonText: 'View year-end statement',
|
|
22
|
+
bodyTwo: `<p style="color:#737373;font-size:13px">If the button doesn't work, copy this link into your browser: ${href}</p>`,
|
|
23
|
+
href: args.href,
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
export const YearEndStatementEmailTemplate = ({ period, listings, ...props }) => OwnerStatementEmailTemplate({
|
|
27
|
+
...props,
|
|
28
|
+
listing: undefined,
|
|
29
|
+
month: period,
|
|
30
|
+
yearEnd: { listings },
|
|
31
|
+
});
|
|
32
|
+
//# sourceMappingURL=YearEndStatementEmailTemplate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"YearEndStatementEmailTemplate.js","sourceRoot":"src/","sources":["templates/YearEndStatementEmailTemplate.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,2BAA2B,EAC3B,oBAAoB,EACpB,yBAAyB,GAC1B,MAAM,eAAe,CAAC;AAKvB,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAE5E;;;;GAIG;AACH,MAAM,CAAC,MAAM,mCAAmC,GAAG,CACjD,IAAoB,EACpB,IAQC,EACgB,EAAE;IACnB,MAAM,IAAI,GAAG,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,2BAA2B,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;IACtE,MAAM,MAAM,GAAG,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC;IACnE,MAAM,QAAQ,GAAG,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,yBAAyB,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC;IAC5E,OAAO;QACL,OAAO,EACL,IAAI,KAAK,KAAK;YACZ,CAAC,CAAC,kCAAkC;YACpC,CAAC,CAAC,QAAQ,IAAI,CAAC,IAAI,qBAAqB;QAC5C,gBAAgB,EACd,IAAI,KAAK,KAAK;YACZ,CAAC,CAAC,2CAA2C;YAC7C,CAAC,CAAC,QAAQ,IAAI,CAAC,IAAI,uCAAuC;QAC9D,MAAM,EAAE,kCAAkC;QAC1C,OAAO,EAAE,SAAS,QAAQ,WAAW,IAAI,CAAC,OAAO,0CAA0C,MAAM,oFAAoF;QACrL,UAAU,EAAE,yBAAyB;QACrC,OAAO,EAAE,yGAAyG,IAAI,MAAM;QAC5H,IAAI,EAAE,IAAI,CAAC,IAAI;KAChB,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,EAC5C,MAAM,EACN,QAAQ,EACR,GAAG,KAAK,EAQT,EAAE,EAAE,CACH,2BAA2B,CAAC;IAC1B,GAAG,KAAK;IACR,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,MAAM;IACb,OAAO,EAAE,EAAE,QAAQ,EAAE;CACtB,CAAC,CAAC","sourcesContent":["import {\n EMAIL_ACTION_LINK_COMPONENT,\n EMAIL_DATE_COMPONENT,\n EMAIL_USER_NAME_COMPONENT,\n} from '../extensions';\nimport type {\n ActionEmailData,\n ActionEmailTemplateProps,\n} from '../components/ActionEmailTemplate';\nimport { OwnerStatementEmailTemplate } from './OwnerStatementEmailTemplate';\n\n/**\n * Default text of the `yearEndStatement` email: an owner's year-end statement\n * of a fiscal year is published. Owners open it by a no-login link, viewers\n * in the owner portal. Settings > Emails shows it; its text is fixed.\n */\nexport const getDefaultYearEndStatementEmailData = (\n mode: 'tag' | 'text',\n args: {\n appName: string;\n href: string;\n userName: string;\n /** The fiscal year, such as `2025`. */\n year: string;\n /** The months it covers, such as `Jan 2025 - Dec 2025`. */\n period: string;\n }\n): ActionEmailData => {\n const href = mode === 'tag' ? EMAIL_ACTION_LINK_COMPONENT : args.href;\n const period = mode === 'tag' ? EMAIL_DATE_COMPONENT : args.period;\n const userName = mode === 'tag' ? EMAIL_USER_NAME_COMPONENT : args.userName;\n return {\n subject:\n mode === 'tag'\n ? 'Your year-end statement is ready'\n : `Your ${args.year} year-end statement`,\n shortDescription:\n mode === 'tag'\n ? 'Your year-end statement is ready to view.'\n : `Your ${args.year} year-end statement is ready to view.`,\n header: 'Your year-end statement is ready',\n bodyOne: `<p>Hi ${userName},</p><p>${args.appName} published your year-end statement for ${period}. It sums up your owner statements of the year. Open it with the button below.</p>`,\n buttonText: 'View year-end statement',\n bodyTwo: `<p style=\"color:#737373;font-size:13px\">If the button doesn't work, copy this link into your browser: ${href}</p>`,\n href: args.href,\n };\n};\n\nexport const YearEndStatementEmailTemplate = ({\n period,\n listings,\n ...props\n}: Omit<ActionEmailTemplateProps, 'listing' | 'month'> & {\n /** The months the statement covers, such as `Jan 2025 - Dec 2025`. */\n period: string;\n /** The owner's listings in the year, such as `Lake House, Casita`. */\n listings?: string;\n /** Requests a new no-login link once the emailed one has expired. */\n renewHref?: string;\n}) =>\n OwnerStatementEmailTemplate({\n ...props,\n listing: undefined,\n month: period,\n yearEnd: { listings },\n });\n"]}
|
|
@@ -5,6 +5,7 @@ export * from './TeamRoleGrantedEmailTemplate';
|
|
|
5
5
|
export * from './TenantSuspensionEmailTemplate';
|
|
6
6
|
export * from './TenantDeletionEmailTemplate';
|
|
7
7
|
export * from './OwnerStatementEmailTemplate';
|
|
8
|
+
export * from './YearEndStatementEmailTemplate';
|
|
8
9
|
export * from './BankAccountChangedEmailTemplate';
|
|
9
10
|
export * from './BankAccountChangedTeamAdminEmailTemplate';
|
|
10
11
|
export * from './BankDetailsRequestEmailTemplate';
|
|
@@ -7,6 +7,7 @@ export * from './TenantSuspensionEmailTemplate';
|
|
|
7
7
|
export * from './TenantDeletionEmailTemplate';
|
|
8
8
|
// Owner Statements
|
|
9
9
|
export * from './OwnerStatementEmailTemplate';
|
|
10
|
+
export * from './YearEndStatementEmailTemplate';
|
|
10
11
|
// Payment setup
|
|
11
12
|
export * from './BankAccountChangedEmailTemplate';
|
|
12
13
|
export * from './BankAccountChangedTeamAdminEmailTemplate';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"src/","sources":["templates/index.ts"],"names":[],"mappings":"AAAA,QAAQ;AACR,cAAc,kCAAkC,CAAC;AACjD,cAAc,oCAAoC,CAAC;AACnD,cAAc,wCAAwC,CAAC;AACvD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,iCAAiC,CAAC;AAChD,cAAc,+BAA+B,CAAC;AAE9C,mBAAmB;AACnB,cAAc,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"src/","sources":["templates/index.ts"],"names":[],"mappings":"AAAA,QAAQ;AACR,cAAc,kCAAkC,CAAC;AACjD,cAAc,oCAAoC,CAAC;AACnD,cAAc,wCAAwC,CAAC;AACvD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,iCAAiC,CAAC;AAChD,cAAc,+BAA+B,CAAC;AAE9C,mBAAmB;AACnB,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iCAAiC,CAAC;AAEhD,gBAAgB;AAChB,cAAc,mCAAmC,CAAC;AAClD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,mCAAmC,CAAC;AAElD,QAAQ;AACR,cAAc,wCAAwC,CAAC;AACvD,cAAc,wBAAwB,CAAC;AAEvC,cAAc;AACd,cAAc,4BAA4B,CAAC;AAC3C,cAAc,yBAAyB,CAAC","sourcesContent":["// Teams\nexport * from './SecondFactorResetEmailTemplate';\nexport * from './TeamApiTokenCreatedEmailTemplate';\nexport * from './TeamInviteOutsideDomainEmailTemplate';\nexport * from './TeamRoleGrantedEmailTemplate';\nexport * from './TenantSuspensionEmailTemplate';\nexport * from './TenantDeletionEmailTemplate';\n\n// Owner Statements\nexport * from './OwnerStatementEmailTemplate';\nexport * from './YearEndStatementEmailTemplate';\n\n// Payment setup\nexport * from './BankAccountChangedEmailTemplate';\nexport * from './BankAccountChangedTeamAdminEmailTemplate';\nexport * from './BankDetailsRequestEmailTemplate';\n\n// 1099s\nexport * from './Tax1099ConsentWithdrawnEmailTemplate';\nexport * from './Tax1099EmailTemplate';\n\n// Invitations\nexport * from './InviteOwnerEmailTemplate';\nexport * from './InvitePmEmailTemplate';\n"]}
|
package/package.json
CHANGED
|
@@ -53,8 +53,47 @@ export const getDefaultOwnerStatementEmailData = (
|
|
|
53
53
|
};
|
|
54
54
|
};
|
|
55
55
|
|
|
56
|
+
/**
|
|
57
|
+
* Subject and text of the emails about an owner payment, which a team's saved
|
|
58
|
+
* statement template does not change: the receipt once Stripe has the money,
|
|
59
|
+
* and the failed-payment email.
|
|
60
|
+
*/
|
|
61
|
+
export const getOwnerPaymentEmailData = (
|
|
62
|
+
kind: 'received' | 'failed',
|
|
63
|
+
args: {
|
|
64
|
+
appName: string;
|
|
65
|
+
ownerStatementHref: string;
|
|
66
|
+
listingName: string;
|
|
67
|
+
userName: string;
|
|
68
|
+
month: string;
|
|
69
|
+
}
|
|
70
|
+
): ActionEmailData => ({
|
|
71
|
+
subject:
|
|
72
|
+
kind === 'received'
|
|
73
|
+
? `Payment received for your ${args.month} statement for ${args.listingName}`
|
|
74
|
+
: `Your payment for the ${args.month} statement for ${args.listingName} failed`,
|
|
75
|
+
shortDescription:
|
|
76
|
+
kind === 'received'
|
|
77
|
+
? `${args.appName} received your payment.`
|
|
78
|
+
: 'Your bank did not complete your payment.',
|
|
79
|
+
header: kind === 'received' ? 'Payment received' : 'Your payment failed',
|
|
80
|
+
bodyOne:
|
|
81
|
+
kind === 'received'
|
|
82
|
+
? `<p>Hi ${args.userName},</p><p>${args.appName} received your payment for your ${args.month} owner statement for ${args.listingName}. Thank you.</p>`
|
|
83
|
+
: `<p>Hi ${args.userName},</p><p>Your bank did not complete your payment for your ${args.month} owner statement for ${args.listingName}. Pay again with the button below.</p>`,
|
|
84
|
+
buttonText: 'View statement',
|
|
85
|
+
bodyTwo: `<p style="color:#737373;font-size:13px">If the button doesn't work, copy this link into your browser: ${args.ownerStatementHref}</p>`,
|
|
86
|
+
href: args.ownerStatementHref,
|
|
87
|
+
});
|
|
88
|
+
|
|
56
89
|
const mutedColor = '#737373';
|
|
57
90
|
const borderColor = '#e5e7eb';
|
|
91
|
+
const paymentColors = {
|
|
92
|
+
due: { background: '#fef2f2', border: '#fecaca', text: '#991b1b' },
|
|
93
|
+
reserveTopUp: { background: '#eff6ff', border: '#bfdbfe', text: '#1e40af' },
|
|
94
|
+
failed: { background: '#fef2f2', border: '#fecaca', text: '#991b1b' },
|
|
95
|
+
received: { background: '#f0fdf4', border: '#bbf7d0', text: '#166534' },
|
|
96
|
+
};
|
|
58
97
|
|
|
59
98
|
export const OwnerStatementEmailTemplate = ({
|
|
60
99
|
data,
|
|
@@ -66,9 +105,32 @@ export const OwnerStatementEmailTemplate = ({
|
|
|
66
105
|
month,
|
|
67
106
|
unsubscribeHref,
|
|
68
107
|
renewHref,
|
|
108
|
+
payment,
|
|
109
|
+
yearEnd,
|
|
69
110
|
}: ActionEmailTemplateProps & {
|
|
70
111
|
/** Requests a new no-login link once the emailed one has expired. */
|
|
71
112
|
renewHref?: string;
|
|
113
|
+
/**
|
|
114
|
+
* A year-end statement: its eyebrow, the Fiscal year (`month`) and Listings
|
|
115
|
+
* rows, and the link opening only the year-end statement.
|
|
116
|
+
*/
|
|
117
|
+
yearEnd?: { listings?: string };
|
|
118
|
+
/**
|
|
119
|
+
* The owner payment block: what is due with the pay button, a reserve
|
|
120
|
+
* top-up due when the balance end is not negative, a payment received, or a
|
|
121
|
+
* payment that failed.
|
|
122
|
+
*/
|
|
123
|
+
payment?: {
|
|
124
|
+
kind: 'due' | 'reserveTopUp' | 'received' | 'failed';
|
|
125
|
+
/** Formatted amount, such as `$1,284.50`. */
|
|
126
|
+
amount: string;
|
|
127
|
+
/** Short lines under the amount, such as `Please pay by Oct 16, 2026`. */
|
|
128
|
+
details: string[];
|
|
129
|
+
/** Opens the payment page. */
|
|
130
|
+
payHref?: string;
|
|
131
|
+
/** How the owner can pay on the payment page. */
|
|
132
|
+
methods?: ('ach' | 'card')[];
|
|
133
|
+
};
|
|
72
134
|
}) => {
|
|
73
135
|
const parse = (html: string) =>
|
|
74
136
|
parseEmailHtml(html, {
|
|
@@ -86,7 +148,10 @@ export const OwnerStatementEmailTemplate = ({
|
|
|
86
148
|
mode={mode}
|
|
87
149
|
unsubscribeHref={unsubscribeHref}
|
|
88
150
|
>
|
|
89
|
-
<EmailHeading
|
|
151
|
+
<EmailHeading
|
|
152
|
+
eyebrow={yearEnd ? 'Year-end statement' : 'Owner statement'}
|
|
153
|
+
themeColors={themeColors}
|
|
154
|
+
>
|
|
90
155
|
{data.header?.trim() || 'Your owner statement is ready'}
|
|
91
156
|
</EmailHeading>
|
|
92
157
|
|
|
@@ -110,7 +175,7 @@ export const OwnerStatementEmailTemplate = ({
|
|
|
110
175
|
dangerouslySetInnerHTML={{ __html: parse(data.bodyOne) }}
|
|
111
176
|
/>
|
|
112
177
|
|
|
113
|
-
{(listing || month) && (
|
|
178
|
+
{(listing || month || yearEnd?.listings) && (
|
|
114
179
|
<table
|
|
115
180
|
role="presentation"
|
|
116
181
|
cellPadding={0}
|
|
@@ -124,10 +189,16 @@ export const OwnerStatementEmailTemplate = ({
|
|
|
124
189
|
}}
|
|
125
190
|
>
|
|
126
191
|
<tbody>
|
|
127
|
-
{
|
|
128
|
-
[
|
|
129
|
-
|
|
130
|
-
|
|
192
|
+
{(yearEnd
|
|
193
|
+
? [
|
|
194
|
+
['Fiscal year', month],
|
|
195
|
+
['Listings', yearEnd.listings],
|
|
196
|
+
]
|
|
197
|
+
: [
|
|
198
|
+
['Property', listing],
|
|
199
|
+
['Statement', month],
|
|
200
|
+
]
|
|
201
|
+
).map(([label, value], index) =>
|
|
131
202
|
value ? (
|
|
132
203
|
<tr key={label}>
|
|
133
204
|
<td
|
|
@@ -158,13 +229,100 @@ export const OwnerStatementEmailTemplate = ({
|
|
|
158
229
|
</table>
|
|
159
230
|
)}
|
|
160
231
|
|
|
232
|
+
{payment && (
|
|
233
|
+
<div
|
|
234
|
+
data-testid="owner-payment-block"
|
|
235
|
+
style={{
|
|
236
|
+
padding: '24px 20px',
|
|
237
|
+
backgroundColor: paymentColors[payment.kind].background,
|
|
238
|
+
border: `1px solid ${paymentColors[payment.kind].border}`,
|
|
239
|
+
borderRadius: '8px',
|
|
240
|
+
margin: '24px 0 0',
|
|
241
|
+
textAlign: 'center',
|
|
242
|
+
}}
|
|
243
|
+
>
|
|
244
|
+
<Text
|
|
245
|
+
style={{
|
|
246
|
+
color: paymentColors[payment.kind].text,
|
|
247
|
+
fontSize: 14,
|
|
248
|
+
fontWeight: 600,
|
|
249
|
+
margin: 0,
|
|
250
|
+
}}
|
|
251
|
+
>
|
|
252
|
+
{payment.kind === 'due'
|
|
253
|
+
? 'Balance due'
|
|
254
|
+
: payment.kind === 'reserveTopUp'
|
|
255
|
+
? 'Reserve top-up due'
|
|
256
|
+
: payment.kind === 'received'
|
|
257
|
+
? 'Payment received'
|
|
258
|
+
: 'Payment failed'}
|
|
259
|
+
</Text>
|
|
260
|
+
<Text
|
|
261
|
+
style={{
|
|
262
|
+
color: paymentColors[payment.kind].text,
|
|
263
|
+
fontSize: 32,
|
|
264
|
+
fontWeight: 700,
|
|
265
|
+
lineHeight: '40px',
|
|
266
|
+
margin: '8px 0',
|
|
267
|
+
}}
|
|
268
|
+
>
|
|
269
|
+
{payment.amount}
|
|
270
|
+
</Text>
|
|
271
|
+
{payment.details.map((detail) => (
|
|
272
|
+
<Text
|
|
273
|
+
key={detail}
|
|
274
|
+
style={{
|
|
275
|
+
color: paymentColors[payment.kind].text,
|
|
276
|
+
fontSize: 14,
|
|
277
|
+
margin: '4px 0 0',
|
|
278
|
+
}}
|
|
279
|
+
>
|
|
280
|
+
{detail}
|
|
281
|
+
</Text>
|
|
282
|
+
))}
|
|
283
|
+
{payment.payHref && (
|
|
284
|
+
<>
|
|
285
|
+
<Button
|
|
286
|
+
href={payment.payHref}
|
|
287
|
+
mode={mode}
|
|
288
|
+
data-testid="pay-owner-balance-button"
|
|
289
|
+
label={
|
|
290
|
+
payment.kind === 'failed'
|
|
291
|
+
? 'Pay again'
|
|
292
|
+
: payment.kind === 'reserveTopUp'
|
|
293
|
+
? 'Pay balance'
|
|
294
|
+
: 'Pay Deficit Balance'
|
|
295
|
+
}
|
|
296
|
+
themeColors={themeColors}
|
|
297
|
+
style={{ marginTop: '20px', marginBottom: '12px' }}
|
|
298
|
+
/>
|
|
299
|
+
<Text style={{ color: mutedColor, fontSize: 12, margin: 0 }}>
|
|
300
|
+
{!payment.methods?.includes('card')
|
|
301
|
+
? 'Bank transfer (ACH), secured by Stripe'
|
|
302
|
+
: payment.methods.includes('ach')
|
|
303
|
+
? 'Bank transfer (ACH) or card, secured by Stripe'
|
|
304
|
+
: 'Card, secured by Stripe'}
|
|
305
|
+
</Text>
|
|
306
|
+
</>
|
|
307
|
+
)}
|
|
308
|
+
</div>
|
|
309
|
+
)}
|
|
310
|
+
|
|
161
311
|
<Button
|
|
162
312
|
href={data.href}
|
|
163
313
|
mode={mode}
|
|
164
314
|
data-testid="view-owner-statement-button"
|
|
165
315
|
label={data.buttonText?.trim() || 'View statement'}
|
|
166
316
|
themeColors={themeColors}
|
|
167
|
-
style={{
|
|
317
|
+
style={{
|
|
318
|
+
marginTop: '24px',
|
|
319
|
+
marginBottom: '32px',
|
|
320
|
+
...(payment?.payHref && {
|
|
321
|
+
background: '#ffffff',
|
|
322
|
+
border: `1px solid ${themeColors[8]}`,
|
|
323
|
+
color: themeColors[8],
|
|
324
|
+
}),
|
|
325
|
+
}}
|
|
168
326
|
/>
|
|
169
327
|
|
|
170
328
|
{renewHref && (
|
|
@@ -180,9 +338,9 @@ export const OwnerStatementEmailTemplate = ({
|
|
|
180
338
|
Link expired?
|
|
181
339
|
</Text>
|
|
182
340
|
<Text style={{ color: mutedColor, fontSize: 14, margin: 0 }}>
|
|
183
|
-
For your security, this link opens only this
|
|
184
|
-
|
|
185
|
-
address.
|
|
341
|
+
For your security, this link opens only this{' '}
|
|
342
|
+
{yearEnd ? 'year-end statement' : 'statement'} and works for 7 days.
|
|
343
|
+
After that, request a new one and we'll email it to this address.
|
|
186
344
|
</Text>
|
|
187
345
|
<Button
|
|
188
346
|
href={renewHref}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import {
|
|
2
|
+
EMAIL_ACTION_LINK_COMPONENT,
|
|
3
|
+
EMAIL_DATE_COMPONENT,
|
|
4
|
+
EMAIL_USER_NAME_COMPONENT,
|
|
5
|
+
} from '../extensions';
|
|
6
|
+
import type {
|
|
7
|
+
ActionEmailData,
|
|
8
|
+
ActionEmailTemplateProps,
|
|
9
|
+
} from '../components/ActionEmailTemplate';
|
|
10
|
+
import { OwnerStatementEmailTemplate } from './OwnerStatementEmailTemplate';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Default text of the `yearEndStatement` email: an owner's year-end statement
|
|
14
|
+
* of a fiscal year is published. Owners open it by a no-login link, viewers
|
|
15
|
+
* in the owner portal. Settings > Emails shows it; its text is fixed.
|
|
16
|
+
*/
|
|
17
|
+
export const getDefaultYearEndStatementEmailData = (
|
|
18
|
+
mode: 'tag' | 'text',
|
|
19
|
+
args: {
|
|
20
|
+
appName: string;
|
|
21
|
+
href: string;
|
|
22
|
+
userName: string;
|
|
23
|
+
/** The fiscal year, such as `2025`. */
|
|
24
|
+
year: string;
|
|
25
|
+
/** The months it covers, such as `Jan 2025 - Dec 2025`. */
|
|
26
|
+
period: string;
|
|
27
|
+
}
|
|
28
|
+
): ActionEmailData => {
|
|
29
|
+
const href = mode === 'tag' ? EMAIL_ACTION_LINK_COMPONENT : args.href;
|
|
30
|
+
const period = mode === 'tag' ? EMAIL_DATE_COMPONENT : args.period;
|
|
31
|
+
const userName = mode === 'tag' ? EMAIL_USER_NAME_COMPONENT : args.userName;
|
|
32
|
+
return {
|
|
33
|
+
subject:
|
|
34
|
+
mode === 'tag'
|
|
35
|
+
? 'Your year-end statement is ready'
|
|
36
|
+
: `Your ${args.year} year-end statement`,
|
|
37
|
+
shortDescription:
|
|
38
|
+
mode === 'tag'
|
|
39
|
+
? 'Your year-end statement is ready to view.'
|
|
40
|
+
: `Your ${args.year} year-end statement is ready to view.`,
|
|
41
|
+
header: 'Your year-end statement is ready',
|
|
42
|
+
bodyOne: `<p>Hi ${userName},</p><p>${args.appName} published your year-end statement for ${period}. It sums up your owner statements of the year. Open it with the button below.</p>`,
|
|
43
|
+
buttonText: 'View year-end statement',
|
|
44
|
+
bodyTwo: `<p style="color:#737373;font-size:13px">If the button doesn't work, copy this link into your browser: ${href}</p>`,
|
|
45
|
+
href: args.href,
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export const YearEndStatementEmailTemplate = ({
|
|
50
|
+
period,
|
|
51
|
+
listings,
|
|
52
|
+
...props
|
|
53
|
+
}: Omit<ActionEmailTemplateProps, 'listing' | 'month'> & {
|
|
54
|
+
/** The months the statement covers, such as `Jan 2025 - Dec 2025`. */
|
|
55
|
+
period: string;
|
|
56
|
+
/** The owner's listings in the year, such as `Lake House, Casita`. */
|
|
57
|
+
listings?: string;
|
|
58
|
+
/** Requests a new no-login link once the emailed one has expired. */
|
|
59
|
+
renewHref?: string;
|
|
60
|
+
}) =>
|
|
61
|
+
OwnerStatementEmailTemplate({
|
|
62
|
+
...props,
|
|
63
|
+
listing: undefined,
|
|
64
|
+
month: period,
|
|
65
|
+
yearEnd: { listings },
|
|
66
|
+
});
|
package/src/templates/index.ts
CHANGED