@vrplatform/email 1.0.2-454 → 1.0.2-46615499325

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.
Files changed (186) hide show
  1. package/build/main/components/ActionEmailTemplate.d.ts +3 -1
  2. package/build/main/components/ActionEmailTemplate.js +9 -13
  3. package/build/main/components/ActionEmailTemplate.js.map +1 -1
  4. package/build/main/components/Button.js.map +1 -1
  5. package/build/main/components/EmailContainer.d.ts +4 -1
  6. package/build/main/components/EmailContainer.js +4 -3
  7. package/build/main/components/EmailContainer.js.map +1 -1
  8. package/build/main/components/EmailHeading.d.ts +8 -0
  9. package/build/main/components/EmailHeading.js +21 -0
  10. package/build/main/components/EmailHeading.js.map +1 -0
  11. package/build/main/components/index.d.ts +1 -0
  12. package/build/main/components/index.js +1 -0
  13. package/build/main/components/index.js.map +1 -1
  14. package/build/main/components/utils/parse-email-html.js +13 -4
  15. package/build/main/components/utils/parse-email-html.js.map +1 -1
  16. package/build/main/const.d.ts +4 -4
  17. package/build/main/index.d.ts +1 -1
  18. package/build/main/index.js +2 -3
  19. package/build/main/index.js.map +1 -1
  20. package/build/main/render.d.ts +2 -0
  21. package/build/main/render.js +24 -0
  22. package/build/main/render.js.map +1 -0
  23. package/build/main/templates/BankAccountChangedEmailTemplate.d.ts +12 -0
  24. package/build/main/templates/BankAccountChangedEmailTemplate.js +12 -0
  25. package/build/main/templates/BankAccountChangedEmailTemplate.js.map +1 -0
  26. package/build/main/templates/BankAccountChangedTeamAdminEmailTemplate.d.ts +17 -0
  27. package/build/main/templates/BankAccountChangedTeamAdminEmailTemplate.js +12 -0
  28. package/build/main/templates/BankAccountChangedTeamAdminEmailTemplate.js.map +1 -0
  29. package/build/main/templates/BankDetailsRequestEmailTemplate.d.ts +17 -0
  30. package/build/main/templates/BankDetailsRequestEmailTemplate.js +15 -0
  31. package/build/main/templates/BankDetailsRequestEmailTemplate.js.map +1 -0
  32. package/build/main/templates/InviteOwnerEmailTemplate.d.ts +2 -2
  33. package/build/main/templates/InviteOwnerEmailTemplate.js +1 -1
  34. package/build/main/templates/InviteOwnerEmailTemplate.js.map +1 -1
  35. package/build/main/templates/InvitePmEmailTemplate.d.ts +2 -1
  36. package/build/main/templates/InvitePmEmailTemplate.js +4 -7
  37. package/build/main/templates/InvitePmEmailTemplate.js.map +1 -1
  38. package/build/main/templates/OwnerStatementEmailTemplate.d.ts +41 -3
  39. package/build/main/templates/OwnerStatementEmailTemplate.js +147 -10
  40. package/build/main/templates/OwnerStatementEmailTemplate.js.map +1 -1
  41. package/build/main/templates/SecondFactorResetEmailTemplate.d.ts +11 -0
  42. package/build/main/templates/SecondFactorResetEmailTemplate.js +19 -0
  43. package/build/main/templates/SecondFactorResetEmailTemplate.js.map +1 -0
  44. package/build/main/templates/Tax1099ConsentWithdrawnEmailTemplate.d.ts +9 -0
  45. package/build/main/templates/Tax1099ConsentWithdrawnEmailTemplate.js +22 -0
  46. package/build/main/templates/Tax1099ConsentWithdrawnEmailTemplate.js.map +1 -0
  47. package/build/main/templates/Tax1099EmailTemplate.d.ts +15 -0
  48. package/build/main/templates/Tax1099EmailTemplate.js +64 -0
  49. package/build/main/templates/Tax1099EmailTemplate.js.map +1 -0
  50. package/build/main/templates/TeamApiTokenCreatedEmailTemplate.d.ts +10 -0
  51. package/build/main/templates/TeamApiTokenCreatedEmailTemplate.js +12 -0
  52. package/build/main/templates/TeamApiTokenCreatedEmailTemplate.js.map +1 -0
  53. package/build/main/templates/TeamInviteOutsideDomainEmailTemplate.d.ts +11 -0
  54. package/build/main/templates/TeamInviteOutsideDomainEmailTemplate.js +12 -0
  55. package/build/main/templates/TeamInviteOutsideDomainEmailTemplate.js.map +1 -0
  56. package/build/main/templates/TeamRoleGrantedEmailTemplate.d.ts +12 -0
  57. package/build/main/templates/TeamRoleGrantedEmailTemplate.js +12 -0
  58. package/build/main/templates/TeamRoleGrantedEmailTemplate.js.map +1 -0
  59. package/build/main/templates/TenantDeletionEmailTemplate.js +2 -6
  60. package/build/main/templates/TenantDeletionEmailTemplate.js.map +1 -1
  61. package/build/main/templates/TenantSuspensionEmailTemplate.js +2 -6
  62. package/build/main/templates/TenantSuspensionEmailTemplate.js.map +1 -1
  63. package/build/main/templates/YearEndStatementEmailTemplate.d.ts +23 -0
  64. package/build/main/templates/YearEndStatementEmailTemplate.js +37 -0
  65. package/build/main/templates/YearEndStatementEmailTemplate.js.map +1 -0
  66. package/build/main/templates/index.d.ts +10 -0
  67. package/build/main/templates/index.js +12 -0
  68. package/build/main/templates/index.js.map +1 -1
  69. package/build/main/theme.js.map +1 -1
  70. package/build/main/types.d.ts +3 -0
  71. package/build/main/types.js.map +1 -1
  72. package/build/main/utils/find-postmark-email.d.ts +8 -0
  73. package/build/main/utils/find-postmark-email.js +88 -0
  74. package/build/main/utils/find-postmark-email.js.map +1 -0
  75. package/build/main/utils/index.d.ts +1 -0
  76. package/build/main/utils/index.js +1 -0
  77. package/build/main/utils/index.js.map +1 -1
  78. package/build/main/utils/send-email.d.ts +28 -3
  79. package/build/main/utils/send-email.js +142 -22
  80. package/build/main/utils/send-email.js.map +1 -1
  81. package/build/module/components/ActionEmailTemplate.d.ts +3 -1
  82. package/build/module/components/ActionEmailTemplate.js +9 -13
  83. package/build/module/components/ActionEmailTemplate.js.map +1 -1
  84. package/build/module/components/EmailContainer.d.ts +4 -1
  85. package/build/module/components/EmailContainer.js +5 -4
  86. package/build/module/components/EmailContainer.js.map +1 -1
  87. package/build/module/components/EmailHeading.d.ts +8 -0
  88. package/build/module/components/EmailHeading.js +17 -0
  89. package/build/module/components/EmailHeading.js.map +1 -0
  90. package/build/module/components/index.d.ts +1 -0
  91. package/build/module/components/index.js +1 -0
  92. package/build/module/components/index.js.map +1 -1
  93. package/build/module/components/utils/parse-email-html.js +13 -4
  94. package/build/module/components/utils/parse-email-html.js.map +1 -1
  95. package/build/module/const.d.ts +4 -4
  96. package/build/module/index.d.ts +1 -1
  97. package/build/module/index.js +1 -1
  98. package/build/module/index.js.map +1 -1
  99. package/build/module/render.d.ts +2 -0
  100. package/build/module/render.js +20 -0
  101. package/build/module/render.js.map +1 -0
  102. package/build/module/templates/BankAccountChangedEmailTemplate.d.ts +12 -0
  103. package/build/module/templates/BankAccountChangedEmailTemplate.js +8 -0
  104. package/build/module/templates/BankAccountChangedEmailTemplate.js.map +1 -0
  105. package/build/module/templates/BankAccountChangedTeamAdminEmailTemplate.d.ts +17 -0
  106. package/build/module/templates/BankAccountChangedTeamAdminEmailTemplate.js +8 -0
  107. package/build/module/templates/BankAccountChangedTeamAdminEmailTemplate.js.map +1 -0
  108. package/build/module/templates/BankDetailsRequestEmailTemplate.d.ts +17 -0
  109. package/build/module/templates/BankDetailsRequestEmailTemplate.js +11 -0
  110. package/build/module/templates/BankDetailsRequestEmailTemplate.js.map +1 -0
  111. package/build/module/templates/InviteOwnerEmailTemplate.d.ts +2 -2
  112. package/build/module/templates/InviteOwnerEmailTemplate.js +1 -1
  113. package/build/module/templates/InviteOwnerEmailTemplate.js.map +1 -1
  114. package/build/module/templates/InvitePmEmailTemplate.d.ts +2 -1
  115. package/build/module/templates/InvitePmEmailTemplate.js +4 -7
  116. package/build/module/templates/InvitePmEmailTemplate.js.map +1 -1
  117. package/build/module/templates/OwnerStatementEmailTemplate.d.ts +41 -3
  118. package/build/module/templates/OwnerStatementEmailTemplate.js +146 -10
  119. package/build/module/templates/OwnerStatementEmailTemplate.js.map +1 -1
  120. package/build/module/templates/SecondFactorResetEmailTemplate.d.ts +11 -0
  121. package/build/module/templates/SecondFactorResetEmailTemplate.js +15 -0
  122. package/build/module/templates/SecondFactorResetEmailTemplate.js.map +1 -0
  123. package/build/module/templates/Tax1099ConsentWithdrawnEmailTemplate.d.ts +9 -0
  124. package/build/module/templates/Tax1099ConsentWithdrawnEmailTemplate.js +18 -0
  125. package/build/module/templates/Tax1099ConsentWithdrawnEmailTemplate.js.map +1 -0
  126. package/build/module/templates/Tax1099EmailTemplate.d.ts +15 -0
  127. package/build/module/templates/Tax1099EmailTemplate.js +59 -0
  128. package/build/module/templates/Tax1099EmailTemplate.js.map +1 -0
  129. package/build/module/templates/TeamApiTokenCreatedEmailTemplate.d.ts +10 -0
  130. package/build/module/templates/TeamApiTokenCreatedEmailTemplate.js +8 -0
  131. package/build/module/templates/TeamApiTokenCreatedEmailTemplate.js.map +1 -0
  132. package/build/module/templates/TeamInviteOutsideDomainEmailTemplate.d.ts +11 -0
  133. package/build/module/templates/TeamInviteOutsideDomainEmailTemplate.js +8 -0
  134. package/build/module/templates/TeamInviteOutsideDomainEmailTemplate.js.map +1 -0
  135. package/build/module/templates/TeamRoleGrantedEmailTemplate.d.ts +12 -0
  136. package/build/module/templates/TeamRoleGrantedEmailTemplate.js +8 -0
  137. package/build/module/templates/TeamRoleGrantedEmailTemplate.js.map +1 -0
  138. package/build/module/templates/TenantDeletionEmailTemplate.js +3 -7
  139. package/build/module/templates/TenantDeletionEmailTemplate.js.map +1 -1
  140. package/build/module/templates/TenantSuspensionEmailTemplate.js +3 -7
  141. package/build/module/templates/TenantSuspensionEmailTemplate.js.map +1 -1
  142. package/build/module/templates/YearEndStatementEmailTemplate.d.ts +23 -0
  143. package/build/module/templates/YearEndStatementEmailTemplate.js +32 -0
  144. package/build/module/templates/YearEndStatementEmailTemplate.js.map +1 -0
  145. package/build/module/templates/index.d.ts +10 -0
  146. package/build/module/templates/index.js +12 -0
  147. package/build/module/templates/index.js.map +1 -1
  148. package/build/module/types.d.ts +3 -0
  149. package/build/module/types.js.map +1 -1
  150. package/build/module/utils/find-postmark-email.d.ts +8 -0
  151. package/build/module/utils/find-postmark-email.js +52 -0
  152. package/build/module/utils/find-postmark-email.js.map +1 -0
  153. package/build/module/utils/index.d.ts +1 -0
  154. package/build/module/utils/index.js +1 -0
  155. package/build/module/utils/index.js.map +1 -1
  156. package/build/module/utils/send-email.d.ts +28 -3
  157. package/build/module/utils/send-email.js +108 -22
  158. package/build/module/utils/send-email.js.map +1 -1
  159. package/package.json +8 -7
  160. package/src/components/ActionEmailTemplate.tsx +14 -16
  161. package/src/components/EmailContainer.tsx +20 -4
  162. package/src/components/EmailHeading.tsx +36 -0
  163. package/src/components/index.ts +1 -0
  164. package/src/components/utils/parse-email-html.ts +20 -6
  165. package/src/index.ts +1 -1
  166. package/src/render.ts +24 -0
  167. package/src/templates/BankAccountChangedEmailTemplate.tsx +53 -0
  168. package/src/templates/BankAccountChangedTeamAdminEmailTemplate.tsx +55 -0
  169. package/src/templates/BankDetailsRequestEmailTemplate.tsx +63 -0
  170. package/src/templates/InviteOwnerEmailTemplate.tsx +1 -0
  171. package/src/templates/InvitePmEmailTemplate.tsx +5 -7
  172. package/src/templates/OwnerStatementEmailTemplate.tsx +336 -14
  173. package/src/templates/SecondFactorResetEmailTemplate.tsx +71 -0
  174. package/src/templates/Tax1099ConsentWithdrawnEmailTemplate.tsx +57 -0
  175. package/src/templates/Tax1099EmailTemplate.tsx +106 -0
  176. package/src/templates/TeamApiTokenCreatedEmailTemplate.tsx +50 -0
  177. package/src/templates/TeamInviteOutsideDomainEmailTemplate.tsx +52 -0
  178. package/src/templates/TeamRoleGrantedEmailTemplate.tsx +54 -0
  179. package/src/templates/TenantDeletionEmailTemplate.tsx +9 -10
  180. package/src/templates/TenantSuspensionEmailTemplate.tsx +9 -10
  181. package/src/templates/YearEndStatementEmailTemplate.tsx +66 -0
  182. package/src/templates/index.ts +14 -0
  183. package/src/types.ts +3 -0
  184. package/src/utils/find-postmark-email.ts +80 -0
  185. package/src/utils/index.ts +1 -0
  186. package/src/utils/send-email.ts +184 -28
@@ -35,6 +35,7 @@ export const InviteOwnerEmailTemplate = ({
35
35
  return (
36
36
  <ActionEmailTemplate
37
37
  {...props}
38
+ eyebrow="Owner Portal invitation"
38
39
  data={{
39
40
  ...props.data,
40
41
  // Add guidance at render time so saved custom templates receive it too.
@@ -10,6 +10,7 @@ export const getDefaultInvitePropertyManagerEmailData = (
10
10
  args: {
11
11
  appName: string;
12
12
  signInLink: string;
13
+ teamName: string;
13
14
  }
14
15
  ): ActionEmailData => {
15
16
  const signInLink =
@@ -18,13 +19,13 @@ export const getDefaultInvitePropertyManagerEmailData = (
18
19
  : `<a href='${args.signInLink}' target='_blank'>${args.signInLink}</a>`;
19
20
 
20
21
  return {
21
- bodyOne: `<p>You are invited to join us on ${args.appName}.</p><p>Accept the invitation below to set up your team access.</p>`,
22
+ bodyOne: `<p>You are invited to join ${args.teamName} on ${args.appName}.</p><p>Accept the invitation below to set up your team access.</p>`,
22
23
  bodyTwo: `<p>If you have any trouble with the button, you can use the following link below: ${signInLink}</p>`,
23
24
  buttonText: 'Accept Invitation',
24
25
  header: 'Welcome to the team!',
25
- shortDescription: `Accept your invitation to join your team on ${args.appName}.`,
26
+ shortDescription: `Accept your invitation to join ${args.teamName} on ${args.appName}.`,
26
27
  href: args.signInLink,
27
- subject: `You are invited to join your team on ${args.appName}`,
28
+ subject: `You are invited to join ${args.teamName} on ${args.appName}`,
28
29
  };
29
30
  };
30
31
 
@@ -32,15 +33,12 @@ export const InvitePmEmailTemplate = (props: ActionEmailTemplateProps) => {
32
33
  return (
33
34
  <ActionEmailTemplate
34
35
  {...props}
36
+ eyebrow="Team invitation"
35
37
  data={{
36
38
  ...props.data,
37
39
  // Add guidance at render time so saved custom templates receive it too.
38
40
  bodyTwo: `${props.data.bodyTwo}<hr style="width:100%;border:none;border-top:1px solid #eaeaea;margin:24px 0" /><p>This invitation link is for one-time setup of your team access and expires after 7 days. Sign up using the exact email address this invitation was sent to.</p><p>If your invitation expires before setup is complete, contact your team administrator for a new invitation.</p><p>For questions about team access, contact your team administrator.</p>`,
39
41
  }}
40
- tenant={{
41
- logo: undefined,
42
- name: props.tenant.name,
43
- }}
44
42
  />
45
43
  );
46
44
  };
@@ -1,14 +1,18 @@
1
+ import { Text } from '@react-email/text';
1
2
  import {
2
3
  EMAIL_ACTION_LINK_COMPONENT,
3
4
  EMAIL_DATE_COMPONENT,
4
5
  EMAIL_LISTING_COMPONENT,
5
6
  EMAIL_USER_NAME_COMPONENT,
6
7
  } from '../extensions';
7
- import {
8
- type ActionEmailData,
9
- ActionEmailTemplate,
10
- type ActionEmailTemplateProps,
8
+ import type {
9
+ ActionEmailData,
10
+ ActionEmailTemplateProps,
11
11
  } from '../components/ActionEmailTemplate';
12
+ import { Button } from '../components/Button';
13
+ import { EmailContainer } from '../components/EmailContainer';
14
+ import { EmailHeading } from '../components/EmailHeading';
15
+ import { parseEmailHtml } from '../components/utils';
12
16
 
13
17
  export const getDefaultOwnerStatementEmailData = (
14
18
  mode: 'tag' | 'text',
@@ -28,19 +32,337 @@ export const getDefaultOwnerStatementEmailData = (
28
32
  const month = mode === 'tag' ? EMAIL_DATE_COMPONENT : args.month;
29
33
  const userName = mode === 'tag' ? EMAIL_USER_NAME_COMPONENT : args.userName;
30
34
 
35
+ // Owners open the statement by link without a login and viewers log in to
36
+ // the owner portal, so the text names neither. Subject and preview text are
37
+ // plain text without tokens, so a saved template must not keep the editor's
38
+ // sample month and listing.
31
39
  return {
32
- subject: 'Owner statement was published',
33
- shortDescription: `An owner statement is ready for you. Log in to ${args.appName} now to view it.`,
34
- header: 'Owner statement was published',
35
- bodyOne: `<p>Hi ${userName},<p>Your ${month} owner statement for property ${listingName} is ready for your review on ${args.appName}.</p><p>To access your statement, please click the button below:</p>`,
36
- buttonText: 'View Owner statement',
37
- bodyTwo: `<p>If you have any trouble with the button, you can copy and paste the link below into your browser: ${ownerStatementHref}</p>`,
40
+ subject:
41
+ mode === 'tag'
42
+ ? 'Your owner statement is ready'
43
+ : `Your ${args.month} owner statement for ${args.listingName}`,
44
+ shortDescription:
45
+ mode === 'tag'
46
+ ? 'Your owner statement is ready to view.'
47
+ : `Your ${args.month} statement for ${args.listingName} is ready to view.`,
48
+ header: 'Your owner statement is ready',
49
+ bodyOne: `<p>Hi ${userName},</p><p>${args.appName} published your ${month} owner statement for ${listingName}. Open it with the button below.</p>`,
50
+ buttonText: 'View statement',
51
+ bodyTwo: `<p style="color:#737373;font-size:13px">If the button doesn't work, copy this link into your browser: ${ownerStatementHref}</p>`,
38
52
  href: args.ownerStatementHref,
39
53
  };
40
54
  };
41
55
 
42
- export const OwnerStatementEmailTemplate = (
43
- props: ActionEmailTemplateProps
44
- ) => {
45
- return <ActionEmailTemplate {...props} />;
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
+
89
+ const mutedColor = '#737373';
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
+ };
97
+
98
+ export const OwnerStatementEmailTemplate = ({
99
+ data,
100
+ tenant,
101
+ themeColors,
102
+ mode,
103
+ user,
104
+ listing,
105
+ month,
106
+ unsubscribeHref,
107
+ renewHref,
108
+ payment,
109
+ yearEnd,
110
+ }: ActionEmailTemplateProps & {
111
+ /** Requests a new no-login link once the emailed one has expired. */
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
+ };
134
+ }) => {
135
+ const parse = (html: string) =>
136
+ parseEmailHtml(html, {
137
+ href: data.href,
138
+ userName: user.firstName || '',
139
+ date: month || '',
140
+ listingName: listing || '',
141
+ });
142
+
143
+ return (
144
+ <EmailContainer
145
+ title={data.subject}
146
+ shortDescription={data.shortDescription}
147
+ tenant={tenant}
148
+ mode={mode}
149
+ unsubscribeHref={unsubscribeHref}
150
+ >
151
+ <EmailHeading
152
+ eyebrow={yearEnd ? 'Year-end statement' : 'Owner statement'}
153
+ themeColors={themeColors}
154
+ >
155
+ {data.header?.trim() || 'Your owner statement is ready'}
156
+ </EmailHeading>
157
+
158
+ {data.banner?.trim() && (
159
+ <Text
160
+ style={{
161
+ padding: '16px 20px',
162
+ backgroundColor: '#f8f9fa',
163
+ borderLeft: `3px solid ${themeColors[8]}`,
164
+ borderRadius: '4px',
165
+ margin: '0 0 32px',
166
+ whiteSpace: 'pre-line',
167
+ }}
168
+ >
169
+ {data.banner.trim()}
170
+ </Text>
171
+ )}
172
+
173
+ <div
174
+ // biome-ignore lint/security/noDangerouslySetInnerHtml: values are escaped by parseEmailHtml
175
+ dangerouslySetInnerHTML={{ __html: parse(data.bodyOne) }}
176
+ />
177
+
178
+ {(listing || month || yearEnd?.listings) && (
179
+ <table
180
+ role="presentation"
181
+ cellPadding={0}
182
+ cellSpacing={0}
183
+ width="100%"
184
+ style={{
185
+ border: `1px solid ${borderColor}`,
186
+ borderRadius: '8px',
187
+ borderCollapse: 'separate',
188
+ margin: '24px 0 0',
189
+ }}
190
+ >
191
+ <tbody>
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) =>
202
+ value ? (
203
+ <tr key={label}>
204
+ <td
205
+ style={{
206
+ padding: '14px 20px',
207
+ color: mutedColor,
208
+ fontSize: 14,
209
+ borderTop: index ? `1px solid ${borderColor}` : 'none',
210
+ }}
211
+ >
212
+ {label}
213
+ </td>
214
+ <td
215
+ style={{
216
+ padding: '14px 20px',
217
+ fontSize: 14,
218
+ fontWeight: 600,
219
+ textAlign: 'right',
220
+ borderTop: index ? `1px solid ${borderColor}` : 'none',
221
+ }}
222
+ >
223
+ {value}
224
+ </td>
225
+ </tr>
226
+ ) : null
227
+ )}
228
+ </tbody>
229
+ </table>
230
+ )}
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
+
311
+ <Button
312
+ href={data.href}
313
+ mode={mode}
314
+ data-testid="view-owner-statement-button"
315
+ label={data.buttonText?.trim() || 'View statement'}
316
+ themeColors={themeColors}
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
+ }}
326
+ />
327
+
328
+ {renewHref && (
329
+ <div
330
+ style={{
331
+ padding: '20px',
332
+ backgroundColor: '#f8f9fa',
333
+ borderRadius: '8px',
334
+ marginBottom: '32px',
335
+ }}
336
+ >
337
+ <Text style={{ fontWeight: 600, margin: '0 0 4px' }}>
338
+ Link expired?
339
+ </Text>
340
+ <Text style={{ color: mutedColor, fontSize: 14, margin: 0 }}>
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.
344
+ </Text>
345
+ <Button
346
+ href={renewHref}
347
+ mode={mode}
348
+ data-testid="renew-owner-statement-link-button"
349
+ label="Send me a new link"
350
+ themeColors={themeColors}
351
+ style={{
352
+ background: '#ffffff',
353
+ border: `1px solid ${themeColors[8]}`,
354
+ color: themeColors[8],
355
+ marginTop: '16px',
356
+ marginBottom: 0,
357
+ }}
358
+ />
359
+ </div>
360
+ )}
361
+
362
+ <div
363
+ // biome-ignore lint/security/noDangerouslySetInnerHtml: values are escaped by parseEmailHtml
364
+ dangerouslySetInnerHTML={{ __html: parse(data.bodyTwo) }}
365
+ />
366
+ </EmailContainer>
367
+ );
46
368
  };
@@ -0,0 +1,71 @@
1
+ import { Heading } from '@react-email/heading';
2
+ import { Text } from '@react-email/text';
3
+ import { EmailContainer } from '../components/EmailContainer';
4
+ import type { EmailBaseProps } from '../types';
5
+
6
+ export type SecondFactorResetEmailTemplateProps = {
7
+ mode: EmailBaseProps['mode'];
8
+ tenant: EmailBaseProps['tenant'];
9
+ audience: 'admin' | 'user';
10
+ user: string;
11
+ initiator: 'support' | 'teamAdmin';
12
+ approvedBy: string | null;
13
+ resetAt: string;
14
+ };
15
+
16
+ export const SecondFactorResetEmailTemplate = ({
17
+ mode,
18
+ tenant,
19
+ audience,
20
+ user,
21
+ initiator,
22
+ approvedBy,
23
+ resetAt,
24
+ }: SecondFactorResetEmailTemplateProps) => {
25
+ const by =
26
+ initiator === 'support'
27
+ ? `VRPlatform support${approvedBy ? `, approved by ${approvedBy}` : ''}`
28
+ : (approvedBy ?? 'a team admin');
29
+ return (
30
+ <EmailContainer
31
+ title={
32
+ audience === 'admin'
33
+ ? `Two-step verification reset for ${user}`
34
+ : 'Your two-step verification was reset'
35
+ }
36
+ shortDescription={`Two-step verification was reset on ${tenant.name}.`}
37
+ tenant={tenant}
38
+ mode={mode}
39
+ >
40
+ <Heading style={{ fontSize: 28, fontWeight: 600, marginBottom: '50px' }}>
41
+ {audience === 'admin'
42
+ ? `Two-step verification reset for ${user}`
43
+ : 'Your two-step verification was reset'}
44
+ </Heading>
45
+ {audience === 'admin' ? (
46
+ <>
47
+ <Text>
48
+ The authenticator app and the backup codes of <b>{user}</b> were
49
+ removed on {resetAt} by {by}. {user} is signed out everywhere and
50
+ sets up two-step verification again at the next sign-in.
51
+ </Text>
52
+ <Text>
53
+ If you did not expect this reset, contact VRPlatform support right
54
+ away.
55
+ </Text>
56
+ </>
57
+ ) : (
58
+ <>
59
+ <Text>
60
+ Your authenticator app and your backup codes for {tenant.name} were
61
+ removed on {resetAt} by {by}. You are signed out everywhere.
62
+ </Text>
63
+ <Text>
64
+ Sign in again and set up two-step verification. If you did not ask
65
+ for this reset, contact VRPlatform support right away.
66
+ </Text>
67
+ </>
68
+ )}
69
+ </EmailContainer>
70
+ );
71
+ };
@@ -0,0 +1,57 @@
1
+ import { Heading } from '@react-email/heading';
2
+ import { Text } from '@react-email/text';
3
+ import { EmailContainer } from '../components';
4
+ import type { EmailBaseProps } from '../types';
5
+
6
+ // PRO-20639: the written confirmation the IRS requires when an owner
7
+ // withdraws consent to get 1099s by email. Fixed text; teams can't edit it.
8
+ export const Tax1099ConsentWithdrawnEmailTemplate = ({
9
+ mode,
10
+ user,
11
+ tenant,
12
+ withdrawnAt,
13
+ address,
14
+ }: {
15
+ mode: EmailBaseProps['mode'];
16
+ user: EmailBaseProps['user'];
17
+ tenant: EmailBaseProps['tenant'];
18
+ /** When the owner withdrew; the withdrawal takes effect that day. */
19
+ withdrawnAt: string;
20
+ address: string | null;
21
+ }) => {
22
+ // The team stores no time zone. Pacific time keeps an evening withdrawal
23
+ // anywhere in the mainland US on the day the owner made it.
24
+ const effectiveOn = new Intl.DateTimeFormat('en-US', {
25
+ timeZone: 'America/Los_Angeles',
26
+ month: 'long',
27
+ day: 'numeric',
28
+ year: 'numeric',
29
+ }).format(new Date(withdrawnAt));
30
+ return (
31
+ <EmailContainer
32
+ title="You withdrew your consent to get 1099s by email"
33
+ shortDescription={`From ${effectiveOn}, ${tenant.name} mails your 1099s.`}
34
+ tenant={tenant}
35
+ mode={mode}
36
+ >
37
+ <Heading style={{ fontSize: 28, fontWeight: 600, marginBottom: '50px' }}>
38
+ {user.firstName ? `Hi ${user.firstName},` : 'Hi there,'}
39
+ </Heading>
40
+ <Text>
41
+ You withdrew your consent to get your 1099s from <b>{tenant.name}</b> by
42
+ email only. The withdrawal takes effect on <b>{effectiveOn}</b>.
43
+ </Text>
44
+ <Text>
45
+ From that date, {tenant.name} mails your 1099s to{' '}
46
+ {address || 'the address on Tax info in your owner portal'}, with a copy
47
+ by email. Each 1099 also stays on the 1099s tab of Statements in your
48
+ owner portal.
49
+ </Text>
50
+ <Text>
51
+ To get your 1099s by email only again, give your consent on Tax info in
52
+ your owner portal. If you did not make this change, contact{' '}
53
+ {tenant.name} right away.
54
+ </Text>
55
+ </EmailContainer>
56
+ );
57
+ };
@@ -0,0 +1,106 @@
1
+ import {
2
+ EMAIL_ACTION_LINK_COMPONENT,
3
+ EMAIL_DATE_COMPONENT,
4
+ EMAIL_USER_NAME_COMPONENT,
5
+ } from '../extensions';
6
+ import {
7
+ type ActionEmailData,
8
+ ActionEmailTemplate,
9
+ type ActionEmailTemplateProps,
10
+ } from '../components';
11
+
12
+ /** The owner portal page of the 1099s tab, which 1099 Ready and Corrected 1099 open. */
13
+ export const OWNER_PORTAL_1099S_PATH = '/statements/1099s';
14
+
15
+ type Tax1099EmailType =
16
+ | 'taxInfoRequest'
17
+ | 'emailDeliveryRequest'
18
+ | 'tax1099Ready'
19
+ | 'tax1099Corrected';
20
+
21
+ // PRO-20621: the 1099 owner emails teams edit in Settings > Emails. The date
22
+ // token renders the tax year. 1099s live on the owner portal's 1099s tab of
23
+ // Statements (PRO-20629), not in Tax Statements (PRO-21278). Subject and preview text are plain text without
24
+ // tokens, so they name no year.
25
+ export const getDefaultTax1099EmailData = (
26
+ type: Tax1099EmailType,
27
+ mode: 'tag' | 'text',
28
+ args: {
29
+ teamName: string;
30
+ href: string;
31
+ userName: string;
32
+ taxYear: string;
33
+ }
34
+ ): ActionEmailData => {
35
+ const href = mode === 'tag' ? EMAIL_ACTION_LINK_COMPONENT : args.href;
36
+ const userName = mode === 'tag' ? EMAIL_USER_NAME_COMPONENT : args.userName;
37
+ const taxYear = mode === 'tag' ? EMAIL_DATE_COMPONENT : args.taxYear;
38
+ const team = args.teamName;
39
+ const linkLine = `<p style="color:#737373;font-size:13px">If the button doesn't work, copy this link into your browser: ${href}</p>`;
40
+
41
+ if (type === 'taxInfoRequest')
42
+ return {
43
+ subject: `${team} needs your tax info`,
44
+ shortDescription: `Add your tax ID in your owner portal so ${team} can send your 1099.`,
45
+ header: 'Complete your tax info',
46
+ bodyOne: `<p>Hi ${userName},</p><p>${team} needs your tax ID to send your ${taxYear} 1099. Add it on Tax info in your owner portal.</p>`,
47
+ buttonText: 'Complete tax info',
48
+ bodyTwo: `<p>Never send your tax ID by email. If you did not expect this request, contact ${team} before you enter it.</p>${linkLine}`,
49
+ href: args.href,
50
+ };
51
+
52
+ if (type === 'emailDeliveryRequest')
53
+ return {
54
+ subject: `Get your 1099s from ${team} by email`,
55
+ shortDescription:
56
+ 'Confirm in your owner portal that you want your 1099s by email only.',
57
+ header: 'Get your 1099s by email',
58
+ bodyOne: `<p>Hi ${userName},</p><p>${team} asks whether you want your 1099s by email only, without a paper copy by mail. You then get an email when your 1099 is ready, and it stays on the 1099s tab of Statements in your owner portal.</p><p>Nothing changes until you confirm on Tax info.</p>`,
59
+ buttonText: 'Choose 1099 delivery',
60
+ bodyTwo: linkLine,
61
+ href: args.href,
62
+ };
63
+
64
+ if (type === 'tax1099Ready')
65
+ return {
66
+ subject: `Your 1099 from ${team} is ready`,
67
+ shortDescription:
68
+ 'Open it on the 1099s tab of Statements in your owner portal.',
69
+ header: 'Your 1099 is ready',
70
+ bodyOne: `<p>Hi ${userName},</p><p>Your ${taxYear} 1099 from ${team} is on the 1099s tab of Statements in your owner portal. You can download and print it there.</p>`,
71
+ buttonText: 'Open 1099s',
72
+ bodyTwo: `<p>If you get your 1099 by mail too, the paper copy is on its way.</p>${linkLine}`,
73
+ href: args.href,
74
+ };
75
+
76
+ return {
77
+ subject: `Your corrected 1099 from ${team}`,
78
+ shortDescription:
79
+ 'Open it on the 1099s tab of Statements in your owner portal.',
80
+ header: 'Your 1099 was corrected',
81
+ bodyOne: `<p>Hi ${userName},</p><p>${team} filed a corrected ${taxYear} 1099 for you. It replaces the earlier one and is on the 1099s tab of Statements in your owner portal.</p>`,
82
+ buttonText: 'Open 1099s',
83
+ bodyTwo: `<p>If you get your 1099 by mail too, the corrected paper copy is on its way.</p>${linkLine}`,
84
+ href: args.href,
85
+ };
86
+ };
87
+
88
+ export const Tax1099EmailTemplate = ({
89
+ type,
90
+ taxYear,
91
+ ...props
92
+ }: Omit<ActionEmailTemplateProps, 'listing' | 'month'> & {
93
+ type: Tax1099EmailType;
94
+ taxYear: string;
95
+ }) => (
96
+ <ActionEmailTemplate
97
+ {...props}
98
+ listing={undefined}
99
+ month={taxYear}
100
+ eyebrow={
101
+ type === 'taxInfoRequest' || type === 'emailDeliveryRequest'
102
+ ? 'Tax info'
103
+ : '1099s'
104
+ }
105
+ />
106
+ );