@vrplatform/email 1.0.2-stage.435 → 1.0.2-stage.43647680287

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 (172) 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 +6 -3
  39. package/build/main/templates/OwnerStatementEmailTemplate.js +70 -9
  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/Tax1099EmailTemplate.d.ts +13 -0
  45. package/build/main/templates/Tax1099EmailTemplate.js +61 -0
  46. package/build/main/templates/Tax1099EmailTemplate.js.map +1 -0
  47. package/build/main/templates/TeamApiTokenCreatedEmailTemplate.d.ts +10 -0
  48. package/build/main/templates/TeamApiTokenCreatedEmailTemplate.js +12 -0
  49. package/build/main/templates/TeamApiTokenCreatedEmailTemplate.js.map +1 -0
  50. package/build/main/templates/TeamInviteOutsideDomainEmailTemplate.d.ts +11 -0
  51. package/build/main/templates/TeamInviteOutsideDomainEmailTemplate.js +12 -0
  52. package/build/main/templates/TeamInviteOutsideDomainEmailTemplate.js.map +1 -0
  53. package/build/main/templates/TeamRoleGrantedEmailTemplate.d.ts +12 -0
  54. package/build/main/templates/TeamRoleGrantedEmailTemplate.js +12 -0
  55. package/build/main/templates/TeamRoleGrantedEmailTemplate.js.map +1 -0
  56. package/build/main/templates/TenantDeletionEmailTemplate.js +2 -6
  57. package/build/main/templates/TenantDeletionEmailTemplate.js.map +1 -1
  58. package/build/main/templates/TenantSuspensionEmailTemplate.js +2 -6
  59. package/build/main/templates/TenantSuspensionEmailTemplate.js.map +1 -1
  60. package/build/main/templates/index.d.ts +8 -0
  61. package/build/main/templates/index.js +10 -0
  62. package/build/main/templates/index.js.map +1 -1
  63. package/build/main/theme.js.map +1 -1
  64. package/build/main/types.d.ts +3 -0
  65. package/build/main/types.js.map +1 -1
  66. package/build/main/utils/find-postmark-email.d.ts +8 -0
  67. package/build/main/utils/find-postmark-email.js +88 -0
  68. package/build/main/utils/find-postmark-email.js.map +1 -0
  69. package/build/main/utils/index.d.ts +1 -0
  70. package/build/main/utils/index.js +1 -0
  71. package/build/main/utils/index.js.map +1 -1
  72. package/build/main/utils/send-email.d.ts +28 -3
  73. package/build/main/utils/send-email.js +142 -22
  74. package/build/main/utils/send-email.js.map +1 -1
  75. package/build/module/components/ActionEmailTemplate.d.ts +3 -1
  76. package/build/module/components/ActionEmailTemplate.js +9 -13
  77. package/build/module/components/ActionEmailTemplate.js.map +1 -1
  78. package/build/module/components/EmailContainer.d.ts +4 -1
  79. package/build/module/components/EmailContainer.js +5 -4
  80. package/build/module/components/EmailContainer.js.map +1 -1
  81. package/build/module/components/EmailHeading.d.ts +8 -0
  82. package/build/module/components/EmailHeading.js +17 -0
  83. package/build/module/components/EmailHeading.js.map +1 -0
  84. package/build/module/components/index.d.ts +1 -0
  85. package/build/module/components/index.js +1 -0
  86. package/build/module/components/index.js.map +1 -1
  87. package/build/module/components/utils/parse-email-html.js +13 -4
  88. package/build/module/components/utils/parse-email-html.js.map +1 -1
  89. package/build/module/const.d.ts +4 -4
  90. package/build/module/index.d.ts +1 -1
  91. package/build/module/index.js +1 -1
  92. package/build/module/index.js.map +1 -1
  93. package/build/module/render.d.ts +2 -0
  94. package/build/module/render.js +20 -0
  95. package/build/module/render.js.map +1 -0
  96. package/build/module/templates/BankAccountChangedEmailTemplate.d.ts +12 -0
  97. package/build/module/templates/BankAccountChangedEmailTemplate.js +8 -0
  98. package/build/module/templates/BankAccountChangedEmailTemplate.js.map +1 -0
  99. package/build/module/templates/BankAccountChangedTeamAdminEmailTemplate.d.ts +17 -0
  100. package/build/module/templates/BankAccountChangedTeamAdminEmailTemplate.js +8 -0
  101. package/build/module/templates/BankAccountChangedTeamAdminEmailTemplate.js.map +1 -0
  102. package/build/module/templates/BankDetailsRequestEmailTemplate.d.ts +17 -0
  103. package/build/module/templates/BankDetailsRequestEmailTemplate.js +11 -0
  104. package/build/module/templates/BankDetailsRequestEmailTemplate.js.map +1 -0
  105. package/build/module/templates/InviteOwnerEmailTemplate.d.ts +2 -2
  106. package/build/module/templates/InviteOwnerEmailTemplate.js +1 -1
  107. package/build/module/templates/InviteOwnerEmailTemplate.js.map +1 -1
  108. package/build/module/templates/InvitePmEmailTemplate.d.ts +2 -1
  109. package/build/module/templates/InvitePmEmailTemplate.js +4 -7
  110. package/build/module/templates/InvitePmEmailTemplate.js.map +1 -1
  111. package/build/module/templates/OwnerStatementEmailTemplate.d.ts +6 -3
  112. package/build/module/templates/OwnerStatementEmailTemplate.js +71 -10
  113. package/build/module/templates/OwnerStatementEmailTemplate.js.map +1 -1
  114. package/build/module/templates/SecondFactorResetEmailTemplate.d.ts +11 -0
  115. package/build/module/templates/SecondFactorResetEmailTemplate.js +15 -0
  116. package/build/module/templates/SecondFactorResetEmailTemplate.js.map +1 -0
  117. package/build/module/templates/Tax1099EmailTemplate.d.ts +13 -0
  118. package/build/module/templates/Tax1099EmailTemplate.js +56 -0
  119. package/build/module/templates/Tax1099EmailTemplate.js.map +1 -0
  120. package/build/module/templates/TeamApiTokenCreatedEmailTemplate.d.ts +10 -0
  121. package/build/module/templates/TeamApiTokenCreatedEmailTemplate.js +8 -0
  122. package/build/module/templates/TeamApiTokenCreatedEmailTemplate.js.map +1 -0
  123. package/build/module/templates/TeamInviteOutsideDomainEmailTemplate.d.ts +11 -0
  124. package/build/module/templates/TeamInviteOutsideDomainEmailTemplate.js +8 -0
  125. package/build/module/templates/TeamInviteOutsideDomainEmailTemplate.js.map +1 -0
  126. package/build/module/templates/TeamRoleGrantedEmailTemplate.d.ts +12 -0
  127. package/build/module/templates/TeamRoleGrantedEmailTemplate.js +8 -0
  128. package/build/module/templates/TeamRoleGrantedEmailTemplate.js.map +1 -0
  129. package/build/module/templates/TenantDeletionEmailTemplate.js +3 -7
  130. package/build/module/templates/TenantDeletionEmailTemplate.js.map +1 -1
  131. package/build/module/templates/TenantSuspensionEmailTemplate.js +3 -7
  132. package/build/module/templates/TenantSuspensionEmailTemplate.js.map +1 -1
  133. package/build/module/templates/index.d.ts +8 -0
  134. package/build/module/templates/index.js +10 -0
  135. package/build/module/templates/index.js.map +1 -1
  136. package/build/module/types.d.ts +3 -0
  137. package/build/module/types.js.map +1 -1
  138. package/build/module/utils/find-postmark-email.d.ts +8 -0
  139. package/build/module/utils/find-postmark-email.js +52 -0
  140. package/build/module/utils/find-postmark-email.js.map +1 -0
  141. package/build/module/utils/index.d.ts +1 -0
  142. package/build/module/utils/index.js +1 -0
  143. package/build/module/utils/index.js.map +1 -1
  144. package/build/module/utils/send-email.d.ts +28 -3
  145. package/build/module/utils/send-email.js +108 -22
  146. package/build/module/utils/send-email.js.map +1 -1
  147. package/package.json +8 -7
  148. package/src/components/ActionEmailTemplate.tsx +14 -16
  149. package/src/components/EmailContainer.tsx +20 -4
  150. package/src/components/EmailHeading.tsx +36 -0
  151. package/src/components/index.ts +1 -0
  152. package/src/components/utils/parse-email-html.ts +20 -6
  153. package/src/index.ts +1 -1
  154. package/src/render.ts +24 -0
  155. package/src/templates/BankAccountChangedEmailTemplate.tsx +53 -0
  156. package/src/templates/BankAccountChangedTeamAdminEmailTemplate.tsx +55 -0
  157. package/src/templates/BankDetailsRequestEmailTemplate.tsx +63 -0
  158. package/src/templates/InviteOwnerEmailTemplate.tsx +1 -0
  159. package/src/templates/InvitePmEmailTemplate.tsx +5 -7
  160. package/src/templates/OwnerStatementEmailTemplate.tsx +178 -14
  161. package/src/templates/SecondFactorResetEmailTemplate.tsx +71 -0
  162. package/src/templates/Tax1099EmailTemplate.tsx +100 -0
  163. package/src/templates/TeamApiTokenCreatedEmailTemplate.tsx +50 -0
  164. package/src/templates/TeamInviteOutsideDomainEmailTemplate.tsx +52 -0
  165. package/src/templates/TeamRoleGrantedEmailTemplate.tsx +54 -0
  166. package/src/templates/TenantDeletionEmailTemplate.tsx +9 -10
  167. package/src/templates/TenantSuspensionEmailTemplate.tsx +9 -10
  168. package/src/templates/index.ts +12 -0
  169. package/src/types.ts +3 -0
  170. package/src/utils/find-postmark-email.ts +80 -0
  171. package/src/utils/index.ts +1 -0
  172. 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,179 @@ 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
+ const mutedColor = '#737373';
57
+ const borderColor = '#e5e7eb';
58
+
59
+ export const OwnerStatementEmailTemplate = ({
60
+ data,
61
+ tenant,
62
+ themeColors,
63
+ mode,
64
+ user,
65
+ listing,
66
+ month,
67
+ unsubscribeHref,
68
+ renewHref,
69
+ }: ActionEmailTemplateProps & {
70
+ /** Requests a new no-login link once the emailed one has expired. */
71
+ renewHref?: string;
72
+ }) => {
73
+ const parse = (html: string) =>
74
+ parseEmailHtml(html, {
75
+ href: data.href,
76
+ userName: user.firstName || '',
77
+ date: month || '',
78
+ listingName: listing || '',
79
+ });
80
+
81
+ return (
82
+ <EmailContainer
83
+ title={data.subject}
84
+ shortDescription={data.shortDescription}
85
+ tenant={tenant}
86
+ mode={mode}
87
+ unsubscribeHref={unsubscribeHref}
88
+ >
89
+ <EmailHeading eyebrow="Owner statement" themeColors={themeColors}>
90
+ {data.header?.trim() || 'Your owner statement is ready'}
91
+ </EmailHeading>
92
+
93
+ {data.banner?.trim() && (
94
+ <Text
95
+ style={{
96
+ padding: '16px 20px',
97
+ backgroundColor: '#f8f9fa',
98
+ borderLeft: `3px solid ${themeColors[8]}`,
99
+ borderRadius: '4px',
100
+ margin: '0 0 32px',
101
+ whiteSpace: 'pre-line',
102
+ }}
103
+ >
104
+ {data.banner.trim()}
105
+ </Text>
106
+ )}
107
+
108
+ <div
109
+ // biome-ignore lint/security/noDangerouslySetInnerHtml: values are escaped by parseEmailHtml
110
+ dangerouslySetInnerHTML={{ __html: parse(data.bodyOne) }}
111
+ />
112
+
113
+ {(listing || month) && (
114
+ <table
115
+ role="presentation"
116
+ cellPadding={0}
117
+ cellSpacing={0}
118
+ width="100%"
119
+ style={{
120
+ border: `1px solid ${borderColor}`,
121
+ borderRadius: '8px',
122
+ borderCollapse: 'separate',
123
+ margin: '24px 0 0',
124
+ }}
125
+ >
126
+ <tbody>
127
+ {[
128
+ ['Property', listing],
129
+ ['Statement', month],
130
+ ].map(([label, value], index) =>
131
+ value ? (
132
+ <tr key={label}>
133
+ <td
134
+ style={{
135
+ padding: '14px 20px',
136
+ color: mutedColor,
137
+ fontSize: 14,
138
+ borderTop: index ? `1px solid ${borderColor}` : 'none',
139
+ }}
140
+ >
141
+ {label}
142
+ </td>
143
+ <td
144
+ style={{
145
+ padding: '14px 20px',
146
+ fontSize: 14,
147
+ fontWeight: 600,
148
+ textAlign: 'right',
149
+ borderTop: index ? `1px solid ${borderColor}` : 'none',
150
+ }}
151
+ >
152
+ {value}
153
+ </td>
154
+ </tr>
155
+ ) : null
156
+ )}
157
+ </tbody>
158
+ </table>
159
+ )}
160
+
161
+ <Button
162
+ href={data.href}
163
+ mode={mode}
164
+ data-testid="view-owner-statement-button"
165
+ label={data.buttonText?.trim() || 'View statement'}
166
+ themeColors={themeColors}
167
+ style={{ marginTop: '24px', marginBottom: '32px' }}
168
+ />
169
+
170
+ {renewHref && (
171
+ <div
172
+ style={{
173
+ padding: '20px',
174
+ backgroundColor: '#f8f9fa',
175
+ borderRadius: '8px',
176
+ marginBottom: '32px',
177
+ }}
178
+ >
179
+ <Text style={{ fontWeight: 600, margin: '0 0 4px' }}>
180
+ Link expired?
181
+ </Text>
182
+ <Text style={{ color: mutedColor, fontSize: 14, margin: 0 }}>
183
+ For your security, this link opens only this statement and works for
184
+ 7 days. After that, request a new one and we'll email it to this
185
+ address.
186
+ </Text>
187
+ <Button
188
+ href={renewHref}
189
+ mode={mode}
190
+ data-testid="renew-owner-statement-link-button"
191
+ label="Send me a new link"
192
+ themeColors={themeColors}
193
+ style={{
194
+ background: '#ffffff',
195
+ border: `1px solid ${themeColors[8]}`,
196
+ color: themeColors[8],
197
+ marginTop: '16px',
198
+ marginBottom: 0,
199
+ }}
200
+ />
201
+ </div>
202
+ )}
203
+
204
+ <div
205
+ // biome-ignore lint/security/noDangerouslySetInnerHtml: values are escaped by parseEmailHtml
206
+ dangerouslySetInnerHTML={{ __html: parse(data.bodyTwo) }}
207
+ />
208
+ </EmailContainer>
209
+ );
46
210
  };
@@ -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,100 @@
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
+ type Tax1099EmailType =
13
+ | 'taxInfoRequest'
14
+ | 'emailDeliveryRequest'
15
+ | 'tax1099Ready'
16
+ | 'tax1099Corrected';
17
+
18
+ // PRO-20621: the 1099 owner emails teams edit in Settings > Emails. The date
19
+ // token renders the tax year. Subject and preview text are plain text without
20
+ // tokens, so they name no year.
21
+ export const getDefaultTax1099EmailData = (
22
+ type: Tax1099EmailType,
23
+ mode: 'tag' | 'text',
24
+ args: {
25
+ teamName: string;
26
+ href: string;
27
+ userName: string;
28
+ taxYear: string;
29
+ }
30
+ ): ActionEmailData => {
31
+ const href = mode === 'tag' ? EMAIL_ACTION_LINK_COMPONENT : args.href;
32
+ const userName = mode === 'tag' ? EMAIL_USER_NAME_COMPONENT : args.userName;
33
+ const taxYear = mode === 'tag' ? EMAIL_DATE_COMPONENT : args.taxYear;
34
+ const team = args.teamName;
35
+ const linkLine = `<p style="color:#737373;font-size:13px">If the button doesn't work, copy this link into your browser: ${href}</p>`;
36
+
37
+ if (type === 'taxInfoRequest')
38
+ return {
39
+ subject: `${team} needs your tax info`,
40
+ shortDescription: `Add your tax ID in your owner portal so ${team} can send your 1099.`,
41
+ header: 'Complete your tax info',
42
+ 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>`,
43
+ buttonText: 'Complete tax info',
44
+ bodyTwo: `<p>Never send your tax ID by email. If you did not expect this request, contact ${team} before you enter it.</p>${linkLine}`,
45
+ href: args.href,
46
+ };
47
+
48
+ if (type === 'emailDeliveryRequest')
49
+ return {
50
+ subject: `Get your 1099s from ${team} by email`,
51
+ shortDescription:
52
+ 'Confirm in your owner portal that you want your 1099s by email only.',
53
+ header: 'Get your 1099s by email',
54
+ 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 in Tax Statements in your owner portal.</p><p>Nothing changes until you confirm on Tax info.</p>`,
55
+ buttonText: 'Choose 1099 delivery',
56
+ bodyTwo: linkLine,
57
+ href: args.href,
58
+ };
59
+
60
+ if (type === 'tax1099Ready')
61
+ return {
62
+ subject: `Your 1099 from ${team} is ready`,
63
+ shortDescription: 'Open it in Tax Statements in your owner portal.',
64
+ header: 'Your 1099 is ready',
65
+ bodyOne: `<p>Hi ${userName},</p><p>Your ${taxYear} 1099 from ${team} is in Tax Statements in your owner portal. You can download and print it there.</p>`,
66
+ buttonText: 'Open Tax Statements',
67
+ bodyTwo: `<p>If you get your 1099 by mail too, the paper copy is on its way.</p>${linkLine}`,
68
+ href: args.href,
69
+ };
70
+
71
+ return {
72
+ subject: `Your corrected 1099 from ${team}`,
73
+ shortDescription: 'Open it in Tax Statements in your owner portal.',
74
+ header: 'Your 1099 was corrected',
75
+ bodyOne: `<p>Hi ${userName},</p><p>${team} filed a corrected ${taxYear} 1099 for you. It replaces the earlier one and is in Tax Statements in your owner portal.</p>`,
76
+ buttonText: 'Open Tax Statements',
77
+ bodyTwo: `<p>If you get your 1099 by mail too, the corrected paper copy is on its way.</p>${linkLine}`,
78
+ href: args.href,
79
+ };
80
+ };
81
+
82
+ export const Tax1099EmailTemplate = ({
83
+ type,
84
+ taxYear,
85
+ ...props
86
+ }: Omit<ActionEmailTemplateProps, 'listing' | 'month'> & {
87
+ type: Tax1099EmailType;
88
+ taxYear: string;
89
+ }) => (
90
+ <ActionEmailTemplate
91
+ {...props}
92
+ listing={undefined}
93
+ month={taxYear}
94
+ eyebrow={
95
+ type === 'taxInfoRequest' || type === 'emailDeliveryRequest'
96
+ ? 'Tax info'
97
+ : 'Tax statements'
98
+ }
99
+ />
100
+ );
@@ -0,0 +1,50 @@
1
+ import { Heading } from '@react-email/heading';
2
+ import { Text } from '@react-email/text';
3
+ import { Button } from '../components/Button';
4
+ import { EmailContainer } from '../components/EmailContainer';
5
+ import { THEME_COLORS } from '../theme';
6
+ import type { EmailBaseProps } from '../types';
7
+
8
+ export type TeamApiTokenCreatedEmailTemplateProps = {
9
+ mode: EmailBaseProps['mode'];
10
+ tenant: EmailBaseProps['tenant'];
11
+ hint: string;
12
+ createdAt: string;
13
+ createdBy: string | null;
14
+ href: string;
15
+ };
16
+
17
+ export const TeamApiTokenCreatedEmailTemplate = ({
18
+ mode,
19
+ tenant,
20
+ hint,
21
+ createdAt,
22
+ createdBy,
23
+ href,
24
+ }: TeamApiTokenCreatedEmailTemplateProps) => (
25
+ <EmailContainer
26
+ title={`New API key on ${tenant.name}`}
27
+ shortDescription={`An API key ending in ${hint} was created on ${tenant.name}.`}
28
+ tenant={tenant}
29
+ mode={mode}
30
+ >
31
+ <Heading style={{ fontSize: 28, fontWeight: 600, marginBottom: '50px' }}>
32
+ New API key on your team
33
+ </Heading>
34
+ <Text>
35
+ An API key ending in <b>{hint}</b> was created on {tenant.name} on{' '}
36
+ {createdAt}
37
+ {createdBy ? ` by ${createdBy}` : ''}. Anyone holding it can read and
38
+ change your team's data.
39
+ </Text>
40
+ <Text>
41
+ If you did not expect this key, revoke it and review the team members.
42
+ </Text>
43
+ <Button
44
+ href={href}
45
+ mode={mode}
46
+ label="Review API keys"
47
+ themeColors={THEME_COLORS.vrplatform!}
48
+ />
49
+ </EmailContainer>
50
+ );
@@ -0,0 +1,52 @@
1
+ import { Heading } from '@react-email/heading';
2
+ import { Text } from '@react-email/text';
3
+ import { Button } from '../components/Button';
4
+ import { EmailContainer } from '../components/EmailContainer';
5
+ import { THEME_COLORS } from '../theme';
6
+ import type { EmailBaseProps } from '../types';
7
+
8
+ export type TeamInviteOutsideDomainEmailTemplateProps = {
9
+ mode: EmailBaseProps['mode'];
10
+ tenant: EmailBaseProps['tenant'];
11
+ invitedEmail: string;
12
+ invitedBy: string | null;
13
+ invitedAt: string;
14
+ roles: string;
15
+ href: string;
16
+ };
17
+
18
+ export const TeamInviteOutsideDomainEmailTemplate = ({
19
+ mode,
20
+ tenant,
21
+ invitedEmail,
22
+ invitedBy,
23
+ invitedAt,
24
+ roles,
25
+ href,
26
+ }: TeamInviteOutsideDomainEmailTemplateProps) => (
27
+ <EmailContainer
28
+ title={`${invitedEmail} was invited to ${tenant.name}`}
29
+ shortDescription={`${invitedEmail} was invited to ${tenant.name} with an outside email address.`}
30
+ tenant={tenant}
31
+ mode={mode}
32
+ >
33
+ <Heading style={{ fontSize: 28, fontWeight: 600, marginBottom: '50px' }}>
34
+ A new member was invited
35
+ </Heading>
36
+ <Text>
37
+ {invitedBy ?? 'An API key'} invited <b>{invitedEmail}</b> to {tenant.name}{' '}
38
+ as <b>{roles}</b> on {invitedAt}. The address is outside the email domains
39
+ of your team and your accounting partner, or it is a free-mail address.
40
+ </Text>
41
+ <Text>
42
+ If you do not know this person, remove the member and check who invited
43
+ them.
44
+ </Text>
45
+ <Button
46
+ href={href}
47
+ mode={mode}
48
+ label="Review team members"
49
+ themeColors={THEME_COLORS.vrplatform!}
50
+ />
51
+ </EmailContainer>
52
+ );
@@ -0,0 +1,54 @@
1
+ import { Heading } from '@react-email/heading';
2
+ import { Text } from '@react-email/text';
3
+ import { Button } from '../components/Button';
4
+ import { EmailContainer } from '../components/EmailContainer';
5
+ import { THEME_COLORS } from '../theme';
6
+ import type { EmailBaseProps } from '../types';
7
+
8
+ export type TeamRoleGrantedEmailTemplateProps = {
9
+ mode: EmailBaseProps['mode'];
10
+ tenant: EmailBaseProps['tenant'];
11
+ member: string;
12
+ roles: string;
13
+ grantedAt: string;
14
+ grantedBy: string | null;
15
+ partnerName: string | null;
16
+ href: string;
17
+ };
18
+
19
+ export const TeamRoleGrantedEmailTemplate = ({
20
+ mode,
21
+ tenant,
22
+ member,
23
+ roles,
24
+ grantedAt,
25
+ grantedBy,
26
+ partnerName,
27
+ href,
28
+ }: TeamRoleGrantedEmailTemplateProps) => (
29
+ <EmailContainer
30
+ title={`${member} received ${roles}`}
31
+ shortDescription={`${member} received ${roles} on ${tenant.name}.`}
32
+ tenant={tenant}
33
+ mode={mode}
34
+ >
35
+ <Heading style={{ fontSize: 28, fontWeight: 600, marginBottom: '50px' }}>
36
+ New {roles} on your team
37
+ </Heading>
38
+ <Text>
39
+ <b>{member}</b> received <b>{roles}</b> on {tenant.name} on {grantedAt}
40
+ {grantedBy ? ` from ${grantedBy}` : ''}
41
+ {partnerName ? `, acting through your partner ${partnerName}` : ''}.
42
+ </Text>
43
+ <Text>
44
+ If you did not expect this change, review the team members and remove the
45
+ role.
46
+ </Text>
47
+ <Button
48
+ href={href}
49
+ mode={mode}
50
+ label="Review team members"
51
+ themeColors={THEME_COLORS.vrplatform!}
52
+ />
53
+ </EmailContainer>
54
+ );
@@ -1,6 +1,6 @@
1
- import { Heading } from '@react-email/heading';
2
1
  import { Text } from '@react-email/text';
3
- import { EmailContainer } from '../components';
2
+ import { EmailContainer, EmailHeading } from '../components';
3
+ import { THEME_COLORS } from '../theme';
4
4
  import type { EmailBaseProps } from '../types';
5
5
 
6
6
  export type TenantDeletionEmailTemplateProps = {
@@ -25,15 +25,14 @@ export const TenantDeletionEmailTemplate = ({
25
25
  }}
26
26
  mode={mode}
27
27
  >
28
- <Heading
29
- style={{
30
- fontSize: 28,
31
- fontWeight: 600,
32
- marginBottom: '50px',
33
- }}
28
+ <EmailHeading
29
+ eyebrow="Team deleted"
30
+ themeColors={THEME_COLORS.vrplatform}
34
31
  >
35
- {user.firstName ? `Dear ${user.firstName},` : 'Hi there,'}
36
- </Heading>
32
+ Your team was deleted
33
+ </EmailHeading>
34
+
35
+ <Text>{user.firstName ? `Dear ${user.firstName},` : 'Hi there,'}</Text>
37
36
 
38
37
  <Text>
39
38
  We wanted to inform you that the team account "{tenant.name}" has been
@@ -1,6 +1,6 @@
1
- import { Heading } from '@react-email/heading';
2
1
  import { Text } from '@react-email/text';
3
- import { EmailContainer } from '../components';
2
+ import { EmailContainer, EmailHeading } from '../components';
3
+ import { THEME_COLORS } from '../theme';
4
4
  import type { EmailBaseProps } from '../types';
5
5
 
6
6
  export type TenantSuspensionEmailTemplateProps = {
@@ -25,15 +25,14 @@ export const TenantSuspensionEmailTemplate = ({
25
25
  }}
26
26
  mode={mode}
27
27
  >
28
- <Heading
29
- style={{
30
- fontSize: 28,
31
- fontWeight: 600,
32
- marginBottom: '50px',
33
- }}
28
+ <EmailHeading
29
+ eyebrow="Team suspended"
30
+ themeColors={THEME_COLORS.vrplatform}
34
31
  >
35
- {user.firstName ? `Dear ${user.firstName},` : 'Hi there,'}
36
- </Heading>
32
+ Your team access is suspended
33
+ </EmailHeading>
34
+
35
+ <Text>{user.firstName ? `Dear ${user.firstName},` : 'Hi there,'}</Text>
37
36
 
38
37
  <Text>
39
38
  We're reaching out to inform you that as of today, access to your team{' '}
@@ -1,10 +1,22 @@
1
1
  // Teams
2
+ export * from './SecondFactorResetEmailTemplate';
3
+ export * from './TeamApiTokenCreatedEmailTemplate';
4
+ export * from './TeamInviteOutsideDomainEmailTemplate';
5
+ export * from './TeamRoleGrantedEmailTemplate';
2
6
  export * from './TenantSuspensionEmailTemplate';
3
7
  export * from './TenantDeletionEmailTemplate';
4
8
 
5
9
  // Owner Statements
6
10
  export * from './OwnerStatementEmailTemplate';
7
11
 
12
+ // Payment setup
13
+ export * from './BankAccountChangedEmailTemplate';
14
+ export * from './BankAccountChangedTeamAdminEmailTemplate';
15
+ export * from './BankDetailsRequestEmailTemplate';
16
+
17
+ // 1099s
18
+ export * from './Tax1099EmailTemplate';
19
+
8
20
  // Invitations
9
21
  export * from './InviteOwnerEmailTemplate';
10
22
  export * from './InvitePmEmailTemplate';