@vrplatform/email 1.0.0 → 1.0.2-stage.6229

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 (122) hide show
  1. package/build/main/components/ActionEmailTemplate.d.ts +1 -1
  2. package/build/main/components/ActionEmailTemplate.js +18 -14
  3. package/build/main/components/ActionEmailTemplate.js.map +1 -1
  4. package/build/main/components/Button.d.ts +1 -1
  5. package/build/main/components/Button.js +7 -3
  6. package/build/main/components/Button.js.map +1 -1
  7. package/build/main/components/EmailContainer.d.ts +1 -1
  8. package/build/main/components/EmailContainer.js +26 -21
  9. package/build/main/components/EmailContainer.js.map +1 -1
  10. package/build/main/components/index.js +18 -2
  11. package/build/main/components/index.js.map +1 -1
  12. package/build/main/components/utils/index.js +17 -1
  13. package/build/main/components/utils/index.js.map +1 -1
  14. package/build/main/components/utils/parse-email-html.js +9 -5
  15. package/build/main/components/utils/parse-email-html.js.map +1 -1
  16. package/build/main/const.js +4 -1
  17. package/build/main/const.js.map +1 -1
  18. package/build/main/extensions.js +7 -4
  19. package/build/main/extensions.js.map +1 -1
  20. package/build/main/index.js +25 -6
  21. package/build/main/index.js.map +1 -1
  22. package/build/main/templates/InviteOwnerEmailTemplate.d.ts +1 -3
  23. package/build/main/templates/InviteOwnerEmailTemplate.js +12 -29
  24. package/build/main/templates/InviteOwnerEmailTemplate.js.map +1 -1
  25. package/build/main/templates/InvitePmEmailTemplate.d.ts +1 -3
  26. package/build/main/templates/InvitePmEmailTemplate.js +12 -34
  27. package/build/main/templates/InvitePmEmailTemplate.js.map +1 -1
  28. package/build/main/templates/OwnerStatementEmailTemplate.d.ts +1 -3
  29. package/build/main/templates/OwnerStatementEmailTemplate.js +15 -43
  30. package/build/main/templates/OwnerStatementEmailTemplate.js.map +1 -1
  31. package/build/main/templates/TenantDeletionEmailTemplate.d.ts +2 -4
  32. package/build/main/templates/TenantDeletionEmailTemplate.js +15 -19
  33. package/build/main/templates/TenantDeletionEmailTemplate.js.map +1 -1
  34. package/build/main/templates/TenantSuspensionEmailTemplate.d.ts +1 -3
  35. package/build/main/templates/TenantSuspensionEmailTemplate.js +13 -17
  36. package/build/main/templates/TenantSuspensionEmailTemplate.js.map +1 -1
  37. package/build/main/templates/index.d.ts +0 -2
  38. package/build/main/templates/index.js +21 -8
  39. package/build/main/templates/index.js.map +1 -1
  40. package/build/main/theme.d.ts +1 -1
  41. package/build/main/theme.js +7 -3
  42. package/build/main/theme.js.map +1 -1
  43. package/build/main/types.js +2 -1
  44. package/build/main/types.js.map +1 -1
  45. package/build/main/utils/index.js +17 -1
  46. package/build/main/utils/index.js.map +1 -1
  47. package/build/main/utils/send-email.d.ts +17 -10
  48. package/build/main/utils/send-email.js +41 -6
  49. package/build/main/utils/send-email.js.map +1 -1
  50. package/build/module/components/ActionEmailTemplate.d.ts +1 -1
  51. package/build/module/components/ActionEmailTemplate.js.map +1 -1
  52. package/build/module/components/Button.d.ts +1 -1
  53. package/build/module/components/Button.js.map +1 -1
  54. package/build/module/components/EmailContainer.d.ts +1 -1
  55. package/build/module/components/EmailContainer.js +2 -1
  56. package/build/module/components/EmailContainer.js.map +1 -1
  57. package/build/module/components/index.js.map +1 -1
  58. package/build/module/components/utils/index.js.map +1 -1
  59. package/build/module/components/utils/parse-email-html.js +4 -4
  60. package/build/module/components/utils/parse-email-html.js.map +1 -1
  61. package/build/module/const.js.map +1 -1
  62. package/build/module/extensions.js.map +1 -1
  63. package/build/module/index.js.map +1 -1
  64. package/build/module/templates/InviteOwnerEmailTemplate.d.ts +1 -3
  65. package/build/module/templates/InviteOwnerEmailTemplate.js +0 -22
  66. package/build/module/templates/InviteOwnerEmailTemplate.js.map +1 -1
  67. package/build/module/templates/InvitePmEmailTemplate.d.ts +1 -3
  68. package/build/module/templates/InvitePmEmailTemplate.js +0 -27
  69. package/build/module/templates/InvitePmEmailTemplate.js.map +1 -1
  70. package/build/module/templates/OwnerStatementEmailTemplate.d.ts +1 -3
  71. package/build/module/templates/OwnerStatementEmailTemplate.js +0 -33
  72. package/build/module/templates/OwnerStatementEmailTemplate.js.map +1 -1
  73. package/build/module/templates/TenantDeletionEmailTemplate.d.ts +2 -4
  74. package/build/module/templates/TenantDeletionEmailTemplate.js +0 -9
  75. package/build/module/templates/TenantDeletionEmailTemplate.js.map +1 -1
  76. package/build/module/templates/TenantSuspensionEmailTemplate.d.ts +1 -3
  77. package/build/module/templates/TenantSuspensionEmailTemplate.js +0 -8
  78. package/build/module/templates/TenantSuspensionEmailTemplate.js.map +1 -1
  79. package/build/module/templates/index.d.ts +0 -2
  80. package/build/module/templates/index.js +0 -3
  81. package/build/module/templates/index.js.map +1 -1
  82. package/build/module/theme.d.ts +1 -1
  83. package/build/module/theme.js.map +1 -1
  84. package/build/module/types.js.map +1 -1
  85. package/build/module/utils/index.js.map +1 -1
  86. package/build/module/utils/send-email.d.ts +17 -10
  87. package/build/module/utils/send-email.js +38 -6
  88. package/build/module/utils/send-email.js.map +1 -1
  89. package/package.json +31 -31
  90. package/src/components/EmailContainer.tsx +2 -1
  91. package/src/components/utils/parse-email-html.ts +4 -7
  92. package/src/templates/InviteOwnerEmailTemplate.tsx +0 -34
  93. package/src/templates/InvitePmEmailTemplate.tsx +0 -41
  94. package/src/templates/OwnerStatementEmailTemplate.tsx +0 -47
  95. package/src/templates/TenantDeletionEmailTemplate.tsx +0 -17
  96. package/src/templates/TenantSuspensionEmailTemplate.tsx +0 -16
  97. package/src/templates/index.ts +0 -4
  98. package/src/theme.ts +1 -1
  99. package/src/utils/send-email.ts +76 -27
  100. package/build/main/components/utils/parse-email-html.test.d.ts +0 -1
  101. package/build/main/components/utils/parse-email-html.test.js +0 -59
  102. package/build/main/components/utils/parse-email-html.test.js.map +0 -1
  103. package/build/main/templates/OwnerStatementSummaryEmailTemplate.d.ts +0 -9
  104. package/build/main/templates/OwnerStatementSummaryEmailTemplate.js +0 -46
  105. package/build/main/templates/OwnerStatementSummaryEmailTemplate.js.map +0 -1
  106. package/build/main/templates/OwnerTaxStatementEmailTemplate.d.ts +0 -10
  107. package/build/main/templates/OwnerTaxStatementEmailTemplate.js +0 -47
  108. package/build/main/templates/OwnerTaxStatementEmailTemplate.js.map +0 -1
  109. package/build/main/tsconfig.main.tsbuildinfo +0 -1
  110. package/build/module/components/utils/parse-email-html.test.d.ts +0 -1
  111. package/build/module/components/utils/parse-email-html.test.js +0 -59
  112. package/build/module/components/utils/parse-email-html.test.js.map +0 -1
  113. package/build/module/templates/OwnerStatementSummaryEmailTemplate.d.ts +0 -9
  114. package/build/module/templates/OwnerStatementSummaryEmailTemplate.js +0 -46
  115. package/build/module/templates/OwnerStatementSummaryEmailTemplate.js.map +0 -1
  116. package/build/module/templates/OwnerTaxStatementEmailTemplate.d.ts +0 -10
  117. package/build/module/templates/OwnerTaxStatementEmailTemplate.js +0 -47
  118. package/build/module/templates/OwnerTaxStatementEmailTemplate.js.map +0 -1
  119. package/build/module/tsconfig.esm.tsbuildinfo +0 -1
  120. package/src/components/utils/parse-email-html.test.ts +0 -65
  121. package/src/templates/OwnerStatementSummaryEmailTemplate.tsx +0 -78
  122. package/src/templates/OwnerTaxStatementEmailTemplate.tsx +0 -80
@@ -6,6 +6,7 @@ import { Html } from '@react-email/html';
6
6
  import { Img } from '@react-email/img';
7
7
  import { Preview } from '@react-email/preview';
8
8
  import { Text } from '@react-email/text';
9
+ import { day } from '@vrplatform/utils';
9
10
  import type { EmailBaseProps } from '../types';
10
11
 
11
12
  type Props = {
@@ -123,7 +124,7 @@ const Footer = () => (
123
124
  color: '#737373',
124
125
  }}
125
126
  >
126
- © {new Date().getFullYear()} VRPlatform Ventures Ltd. All rights reserved.
127
+ © {day().year()} VRPlatform Ventures Ltd. All rights reserved.
127
128
  </Text>
128
129
  <Text
129
130
  style={{
@@ -13,16 +13,13 @@ export const parseEmailHtml = (
13
13
 
14
14
  return html
15
15
  .replaceAll(
16
- /<action\-link\-component><\/action\-link\-component>/g,
16
+ /<action-link-component><\/action-link-component>/g,
17
17
  `<a href="${args.href}" target="_blank">${args.href}</a>`
18
18
  )
19
+ .replaceAll(/<user-name-component><\/user-name-component>/g, args.userName)
19
20
  .replaceAll(
20
- /<user\-name\-component><\/user\-name\-component>/g,
21
- args.userName
22
- )
23
- .replaceAll(
24
- /<listing\-name\-component><\/listing\-name\-component>/g,
21
+ /<listing-name-component><\/listing-name-component>/g,
25
22
  args.listingName
26
23
  )
27
- .replaceAll(/<date\-component><\/date\-component>/g, args.date);
24
+ .replaceAll(/<date-component><\/date-component>/g, args.date);
28
25
  };
@@ -30,37 +30,3 @@ export const getDefaultInviteOwnerEmailData = (
30
30
  export const InviteOwnerEmailTemplate = (props: ActionEmailTemplateProps) => {
31
31
  return <ActionEmailTemplate {...props} />;
32
32
  };
33
-
34
- const Preview = () => (
35
- <ActionEmailTemplate
36
- mode="send"
37
- tenant={{
38
- name: 'Pineapple Mountain',
39
- logo: 'https://imagedelivery.net/Ftdv9WftbW1DctaiLSVfFA/fbd8c31f-478f-4eb0-74ac-c8eeb47b5000/256x256',
40
- }}
41
- data={getDefaultInviteOwnerEmailData('text', {
42
- appName: 'VRPlatform',
43
- signInLink: 'https://example.com',
44
- })}
45
- user={{
46
- firstName: 'John',
47
- }}
48
- listing={undefined}
49
- month={undefined}
50
- themeColors={[
51
- // portal.brown
52
- '#9E9390',
53
- '#8D7C78',
54
- '#7C6964',
55
- '#6E5954',
56
- '#614B46',
57
- '#573F39',
58
- '#4E342E',
59
- '#3F2D29',
60
- '#332725',
61
- '#2A2220',
62
- ]}
63
- />
64
- );
65
-
66
- export default Preview;
@@ -40,44 +40,3 @@ export const InvitePmEmailTemplate = (props: ActionEmailTemplateProps) => {
40
40
  />
41
41
  );
42
42
  };
43
-
44
- const Preview = () => (
45
- <ActionEmailTemplate
46
- mode="send"
47
- tenant={{
48
- name: 'Pineapple Mountain',
49
- logo: 'https://imagedelivery.net/Ftdv9WftbW1DctaiLSVfFA/fbd8c31f-478f-4eb0-74ac-c8eeb47b5000/256x256',
50
- }}
51
- data={{
52
- bodyOne:
53
- 'Hello, <br /> <br /> You have been invited to join Pineapple Mountain. <br /> <br />',
54
- bodyTwo:
55
- 'Please click the button below to accept the invitation. <br /> <br />',
56
- buttonText: 'Accept Invitation',
57
- header: 'Welcome to Pineapple Mountain!',
58
- shortDescription: 'You have been invited to join Pineapple Mountain.',
59
- href: 'https://example.com',
60
- subject: 'You are invited to join Pineapple Mountain',
61
- }}
62
- user={{
63
- firstName: 'John',
64
- }}
65
- listing={undefined}
66
- month={undefined}
67
- themeColors={[
68
- // baseColor: vrp primary palette
69
- '#E6F1FF',
70
- '#B8D9FE',
71
- '#8BC0FE',
72
- '#5DA8FD',
73
- '#308FFD',
74
- '#0377FC',
75
- '#025FCA',
76
- '#024797',
77
- '#012F65',
78
- '#011832',
79
- ]}
80
- />
81
- );
82
-
83
- export default Preview;
@@ -44,50 +44,3 @@ export const OwnerStatementEmailTemplate = (
44
44
  ) => {
45
45
  return <ActionEmailTemplate {...props} />;
46
46
  };
47
-
48
- const Preview = () => {
49
- const defaultListing = '1502 Amelia Way';
50
- const defaultMonth = `May ${new Date().getFullYear()}`;
51
- const defaultName = 'John';
52
-
53
- return (
54
- <ActionEmailTemplate
55
- mode="send"
56
- tenant={{
57
- name: 'Pineapple Mountain',
58
- logo: 'https://imagedelivery.net/Ftdv9WftbW1DctaiLSVfFA/fbd8c31f-478f-4eb0-74ac-c8eeb47b5000/256x256',
59
- }}
60
- data={{
61
- banner:
62
- 'This month there was a $1000 charge for the property. That charge was split between the two owners.',
63
- ...getDefaultOwnerStatementEmailData('text', {
64
- appName: 'VRPlatform',
65
- ownerStatementHref: 'https://example.com',
66
- listingName: defaultListing,
67
- month: defaultMonth,
68
- userName: defaultName,
69
- }),
70
- }}
71
- user={{
72
- firstName: 'John',
73
- }}
74
- listing={defaultListing}
75
- month={defaultMonth}
76
- themeColors={[
77
- // portal.brown
78
- '#9E9390',
79
- '#8D7C78',
80
- '#7C6964',
81
- '#6E5954',
82
- '#614B46',
83
- '#573F39',
84
- '#4E342E',
85
- '#3F2D29',
86
- '#332725',
87
- '#2A2220',
88
- ]}
89
- />
90
- );
91
- };
92
-
93
- export default Preview;
@@ -100,20 +100,3 @@ export const TenantDeletionEmail = (
100
100
  ) => {
101
101
  return <TenantDeletionEmailTemplate {...props} />;
102
102
  };
103
-
104
- const Preview = () => {
105
- return (
106
- <TenantDeletionEmailTemplate
107
- mode="send"
108
- tenant={{
109
- name: 'Pineapple Mountain',
110
- logo: undefined,
111
- }}
112
- user={{
113
- firstName: 'John',
114
- }}
115
- />
116
- );
117
- };
118
-
119
- export default Preview;
@@ -84,19 +84,3 @@ export const TenantSuspensionEmailTemplate = ({
84
84
  </EmailContainer>
85
85
  );
86
86
  };
87
-
88
- const Preview = () => {
89
- return (
90
- <TenantSuspensionEmailTemplate
91
- mode="send"
92
- user={{
93
- firstName: 'John',
94
- }}
95
- tenant={{
96
- name: 'Demo Test Console',
97
- }}
98
- />
99
- );
100
- };
101
-
102
- export default Preview;
@@ -3,12 +3,8 @@ export * from './TenantSuspensionEmailTemplate';
3
3
  export * from './TenantDeletionEmailTemplate';
4
4
 
5
5
  // Owner Statements
6
- export * from './OwnerStatementSummaryEmailTemplate';
7
6
  export * from './OwnerStatementEmailTemplate';
8
7
 
9
- // Owner Tax Statements
10
- export * from './OwnerTaxStatementEmailTemplate';
11
-
12
8
  // Invitations
13
9
  export * from './InviteOwnerEmailTemplate';
14
10
  export * from './InvitePmEmailTemplate';
package/src/theme.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { Maybe } from '@finalytic/utils';
1
+ import type { Maybe } from '@vrplatform/utils';
2
2
 
3
3
  export const getOwnerPortalColor = (color: Maybe<string>) => {
4
4
  if (!color) return undefined;
@@ -1,37 +1,86 @@
1
- export const sendEmail = async ({
2
- POSTMARK_TOKEN,
3
- data,
4
- }: {
5
- POSTMARK_TOKEN: string;
1
+ export class EmailDeliveryError extends Error {
2
+ constructor(
3
+ message: string,
4
+ public readonly details?: Record<string, unknown>,
5
+ public readonly expected = false
6
+ ) {
7
+ super(message);
8
+ this.name = 'EmailDeliveryError';
9
+ }
10
+ }
11
+
12
+ export async function sendEmail(
6
13
  data: {
7
14
  to: string;
8
15
  subject: string;
9
16
  text: string;
10
17
  html: string;
11
18
  replyTo?: string;
12
- };
13
- }) => {
14
- const response = await fetch('https://api.postmarkapp.com/email', {
15
- method: 'POST',
16
- headers: {
17
- Accept: 'application/json',
18
- 'Content-Type': 'application/json',
19
- 'X-Postmark-Server-Token': POSTMARK_TOKEN,
20
- },
21
- body: JSON.stringify({
22
- From: 'VRPlatform <notifications@vrplatform.app>',
23
- To: data.to,
24
- Subject: data.subject,
25
- ReplyTo: data.replyTo,
26
- TextBody: data.text,
27
- HtmlBody: data.html,
28
- MessageStream: 'outbound',
29
- }),
30
- });
19
+ },
20
+ options: {
21
+ fetch?: (
22
+ input: string | URL | Request,
23
+ init?: RequestInit
24
+ ) => Promise<Response>;
25
+ postmarkToken?: string;
26
+ }
27
+ ) {
28
+ if (!options.postmarkToken) {
29
+ throw new EmailDeliveryError('Postmark is not configured');
30
+ }
31
+
32
+ const response = await (options.fetch ?? fetch)(
33
+ 'https://api.postmarkapp.com/email',
34
+ {
35
+ method: 'POST',
36
+ headers: {
37
+ Accept: 'application/json',
38
+ 'Content-Type': 'application/json',
39
+ 'X-Postmark-Server-Token': options.postmarkToken,
40
+ },
41
+ body: JSON.stringify({
42
+ From: 'VRPlatform <notifications@vrplatform.app>',
43
+ To: data.to,
44
+ Subject: data.subject,
45
+ ReplyTo: data.replyTo,
46
+ TextBody: data.text,
47
+ HtmlBody: data.html,
48
+ MessageStream: 'outbound',
49
+ }),
50
+ }
51
+ );
52
+
53
+ const providerResponse: unknown = await response.json().catch(() => ({}));
54
+ const providerMessage =
55
+ providerResponse !== null &&
56
+ typeof providerResponse === 'object' &&
57
+ 'Message' in providerResponse &&
58
+ typeof providerResponse.Message === 'string'
59
+ ? providerResponse.Message
60
+ : undefined;
31
61
 
32
62
  if (!response.ok) {
33
- throw new Error(`Failed to send email: ${response.statusText}`);
63
+ if (
64
+ response.status === 422 &&
65
+ providerMessage?.includes('marked as inactive')
66
+ ) {
67
+ throw new EmailDeliveryError(
68
+ 'Postmark recipient is inactive',
69
+ {
70
+ providerMessage,
71
+ status: response.status,
72
+ statusText: response.statusText,
73
+ },
74
+ true
75
+ );
76
+ }
77
+
78
+ throw new EmailDeliveryError('Postmark rejected the email', {
79
+ providerResponse,
80
+ status: response.status,
81
+ statusText: response.statusText,
82
+ });
34
83
  }
35
84
 
36
- return response;
37
- };
85
+ return { status: response.status };
86
+ }
@@ -1,59 +0,0 @@
1
- import { describe, expect, it } from 'bun:test';
2
- import { parseEmailHtml } from './parse-email-html';
3
- describe('parseEmailHtml', () => {
4
- it('should replace <action-link-component></action-link-component> with the sign-in link anchor tag', () => {
5
- const html = '<div><action-link-component></action-link-component></div>';
6
- const args = {
7
- href: 'https://example.com/signin',
8
- userName: 'John Doe',
9
- date: '2023-01-01',
10
- listingName: '123 Main St',
11
- };
12
- const result = parseEmailHtml(html, args);
13
- expect(result).toBe('<div><a href="https://example.com/signin" target="_blank">https://example.com/signin</a></div>');
14
- });
15
- it('should replace <user-name-component></user-name-component> with the user name', () => {
16
- const html = '<div>Hello <user-name-component></user-name-component>!</div>';
17
- const args = {
18
- href: 'https://example.com/signin',
19
- userName: 'John Doe',
20
- date: '2023-01-01',
21
- listingName: '123 Main St',
22
- };
23
- const result = parseEmailHtml(html, args);
24
- expect(result).toBe('<div>Hello John Doe!</div>');
25
- });
26
- it('should replace both <action-link-component> and <user-name-component> appropriately', () => {
27
- const html = `
28
- <div>
29
- <action-link-component></action-link-component>
30
- <user-name-component></user-name-component>
31
- </div>
32
- `;
33
- const args = {
34
- href: 'https://example.com/signin',
35
- userName: 'Jane Doe',
36
- date: '2023-01-01',
37
- listingName: '123 Main St',
38
- };
39
- const result = parseEmailHtml(html, args);
40
- expect(result).toBe(`
41
- <div>
42
- <a href="https://example.com/signin" target="_blank">https://example.com/signin</a>
43
- Jane Doe
44
- </div>
45
- `);
46
- });
47
- it('should return the input HTML unchanged if there are no components to replace', () => {
48
- const html = '<div>No components to replace here</div>';
49
- const args = {
50
- href: 'https://example.com/signin',
51
- userName: 'John Doe',
52
- date: '2023-01-01',
53
- listingName: '123 Main St',
54
- };
55
- const result = parseEmailHtml(html, args);
56
- expect(result).toBe('<div>No components to replace here</div>');
57
- });
58
- });
59
- //# sourceMappingURL=parse-email-html.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"parse-email-html.test.js","sourceRoot":"src/","sources":["components/utils/parse-email-html.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC9B,EAAE,CAAC,iGAAiG,EAAE,GAAG,EAAE;QACzG,MAAM,IAAI,GAAG,4DAA4D,CAAC;QAC1E,MAAM,IAAI,GAAyC;YACjD,IAAI,EAAE,4BAA4B;YAClC,QAAQ,EAAE,UAAU;YACpB,IAAI,EAAE,YAAY;YAClB,WAAW,EAAE,aAAa;SAC3B,CAAC;QACF,MAAM,MAAM,GAAG,cAAc,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAC1C,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CACjB,gGAAgG,CACjG,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,+EAA+E,EAAE,GAAG,EAAE;QACvF,MAAM,IAAI,GACR,+DAA+D,CAAC;QAClE,MAAM,IAAI,GAAyC;YACjD,IAAI,EAAE,4BAA4B;YAClC,QAAQ,EAAE,UAAU;YACpB,IAAI,EAAE,YAAY;YAClB,WAAW,EAAE,aAAa;SAC3B,CAAC;QACF,MAAM,MAAM,GAAG,cAAc,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAC1C,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAC;IACpD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,qFAAqF,EAAE,GAAG,EAAE;QAC7F,MAAM,IAAI,GAAG;;;;;KAKZ,CAAC;QACF,MAAM,IAAI,GAAyC;YACjD,IAAI,EAAE,4BAA4B;YAClC,QAAQ,EAAE,UAAU;YACpB,IAAI,EAAE,YAAY;YAClB,WAAW,EAAE,aAAa;SAC3B,CAAC;QACF,MAAM,MAAM,GAAG,cAAc,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAC1C,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC;;;;;KAKnB,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,8EAA8E,EAAE,GAAG,EAAE;QACtF,MAAM,IAAI,GAAG,0CAA0C,CAAC;QACxD,MAAM,IAAI,GAAyC;YACjD,IAAI,EAAE,4BAA4B;YAClC,QAAQ,EAAE,UAAU;YACpB,IAAI,EAAE,YAAY;YAClB,WAAW,EAAE,aAAa;SAC3B,CAAC;QACF,MAAM,MAAM,GAAG,cAAc,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAC1C,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,0CAA0C,CAAC,CAAC;IAClE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,9 +0,0 @@
1
- import { type ActionEmailData, type ActionEmailTemplateProps } from '../components';
2
- export declare const getDefaultOwnerStatementSummaryEmailData: (mode: "tag" | "text", args: {
3
- appName: string;
4
- ownerStatementHref: string;
5
- userName: string;
6
- }) => ActionEmailData;
7
- export declare const OwnerStatementSummaryEmailTemplate: (props: ActionEmailTemplateProps) => import("react/jsx-runtime").JSX.Element;
8
- declare const Preview: () => import("react/jsx-runtime").JSX.Element;
9
- export default Preview;
@@ -1,46 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { ActionEmailTemplate, } from '../components';
3
- import { EMAIL_ACTION_LINK_COMPONENT, EMAIL_USER_NAME_COMPONENT, } from '../extensions';
4
- export const getDefaultOwnerStatementSummaryEmailData = (mode, args) => {
5
- const ownerStatementHref = mode === 'tag' ? EMAIL_ACTION_LINK_COMPONENT : args.ownerStatementHref;
6
- const userName = mode === 'tag' ? EMAIL_USER_NAME_COMPONENT : args.userName;
7
- return {
8
- subject: 'Summary statement is ready',
9
- shortDescription: `An summary statement is ready for you. Log in to ${args.appName} to view it.`,
10
- header: 'Summary is ready to view',
11
- bodyOne: `<p>Hi ${userName},<p>A summary statement is ready for your review on ${args.appName}.</p><p>To access your statement, please click the button below:</p>`,
12
- buttonText: 'View statement',
13
- bodyTwo: `<p>If you have any trouble with the button, you can copy and paste the link below into your browser: ${ownerStatementHref}</p>`,
14
- href: args.ownerStatementHref,
15
- };
16
- };
17
- export const OwnerStatementSummaryEmailTemplate = (props) => {
18
- return _jsx(ActionEmailTemplate, { ...props });
19
- };
20
- const Preview = () => {
21
- const defaultName = 'John';
22
- return (_jsx(ActionEmailTemplate, { mode: "send", tenant: {
23
- name: 'Pineapple Mountain',
24
- logo: 'https://imagedelivery.net/Ftdv9WftbW1DctaiLSVfFA/fbd8c31f-478f-4eb0-74ac-c8eeb47b5000/256x256',
25
- }, data: getDefaultOwnerStatementSummaryEmailData('text', {
26
- appName: 'VRPlatform',
27
- ownerStatementHref: 'https://example.com',
28
- userName: defaultName,
29
- }), user: {
30
- firstName: 'John',
31
- }, listing: undefined, month: undefined, themeColors: [
32
- // portal.brown
33
- '#9E9390',
34
- '#8D7C78',
35
- '#7C6964',
36
- '#6E5954',
37
- '#614B46',
38
- '#573F39',
39
- '#4E342E',
40
- '#3F2D29',
41
- '#332725',
42
- '#2A2220',
43
- ] }));
44
- };
45
- export default Preview;
46
- //# sourceMappingURL=OwnerStatementSummaryEmailTemplate.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"OwnerStatementSummaryEmailTemplate.js","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AAE,qBAAqB;YACzC,QAAQ,EAAE,WAAW;SACtB,CAAC,EACF,IAAI,EAAE;YACJ,SAAS,EAAE,MAAM;SAClB,EACD,OAAO,EAAE,SAAS,EAClB,KAAK,EAAE,SAAS,EAChB,WAAW,EAAE;YACX,eAAe;YACf,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;SACV,GACD,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,OAAO,CAAC"}
@@ -1,10 +0,0 @@
1
- import { type ActionEmailData, type ActionEmailTemplateProps } from '../components';
2
- export declare const getDefaultOwnerTaxStatementEmailData: (mode: "tag" | "text", args: {
3
- appName: string;
4
- href: string;
5
- firstName: string | undefined | null;
6
- year: number;
7
- }) => ActionEmailData;
8
- export declare const OwnerTaxStatementEmailTemplate: (props: ActionEmailTemplateProps) => import("react/jsx-runtime").JSX.Element;
9
- declare const Preview: () => import("react/jsx-runtime").JSX.Element;
10
- export default Preview;
@@ -1,47 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { EMAIL_ACTION_LINK_COMPONENT, EMAIL_USER_NAME_COMPONENT, } from '../extensions';
3
- import { ActionEmailTemplate, } from '../components';
4
- export const getDefaultOwnerTaxStatementEmailData = (mode, args) => {
5
- const href = mode === 'tag' ? EMAIL_ACTION_LINK_COMPONENT : args.href;
6
- const firstName = mode === 'tag' ? EMAIL_USER_NAME_COMPONENT : args.firstName || 'there';
7
- return {
8
- subject: 'Your 1099 Tax Statement is ready',
9
- shortDescription: `Your 1099 Tax Statement is ready for you. Log in to ${args.appName} to view it.`,
10
- header: '1099 Tax Statement is ready',
11
- bodyOne: `<p>Hi ${firstName},<p>Your 1099 tax statement for ${args.year} is now available for you to review on ${args.appName}.</p><p>Click below to see your tax statement before we send it to the IRS.</p><p>To update your tax statement details, log into your ${args.appName} account and navigate to Settings>Statement Details.</p><p>To view your annual summary statement, navigate to the Summary page from within your ${args.appName} account.</p><p>Simply reply to this email if you have any questions.</p>`,
12
- buttonText: 'View tax statement',
13
- bodyTwo: `<p>If you have any trouble with the button, you can copy and paste the link below into your browser: ${href}</p>`,
14
- href: args.href,
15
- };
16
- };
17
- export const OwnerTaxStatementEmailTemplate = (props) => {
18
- return _jsx(ActionEmailTemplate, { ...props });
19
- };
20
- const Preview = () => {
21
- const defaultName = 'John';
22
- return (_jsx(ActionEmailTemplate, { mode: "send", tenant: {
23
- name: 'Pineapple Mountain',
24
- logo: 'https://imagedelivery.net/Ftdv9WftbW1DctaiLSVfFA/fbd8c31f-478f-4eb0-74ac-c8eeb47b5000/256x256',
25
- }, data: getDefaultOwnerTaxStatementEmailData('text', {
26
- appName: 'VRPlatform',
27
- href: 'https://example.com',
28
- firstName: defaultName,
29
- year: new Date().getFullYear(),
30
- }), user: {
31
- firstName: 'John',
32
- }, listing: undefined, month: undefined, themeColors: [
33
- // portal.brown
34
- '#9E9390',
35
- '#8D7C78',
36
- '#7C6964',
37
- '#6E5954',
38
- '#614B46',
39
- '#573F39',
40
- '#4E342E',
41
- '#3F2D29',
42
- '#332725',
43
- '#2A2220',
44
- ] }));
45
- };
46
- export default Preview;
47
- //# sourceMappingURL=OwnerTaxStatementEmailTemplate.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"OwnerTaxStatementEmailTemplate.js","sourceRoot":"src/","sources":["templates/OwnerTaxStatementEmailTemplate.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,2BAA2B,EAC3B,yBAAyB,GAC1B,MAAM,eAAe,CAAC;AACvB,OAAO,EAEL,mBAAmB,GAEpB,MAAM,eAAe,CAAC;AAEvB,MAAM,CAAC,MAAM,oCAAoC,GAAG,CAClD,IAAoB,EACpB,IAKC,EACgB,EAAE;IACnB,MAAM,IAAI,GAAG,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,2BAA2B,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;IAEtE,MAA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S;YACT,SAAS;YACT,SAAS;YACT,SAAS;SACV,GACD,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,OAAO,CAAC"}
@@ -1 +0,0 @@
1
- {"root":["../../src/const.ts","../../src/extensions.ts","../../src/index.ts","../../src/theme.ts","../../src/types.ts","../../src/components/actionemailtemplate.tsx","../../src/components/button.tsx","../../src/components/emailcontainer.tsx","../../src/components/index.ts","../../src/components/utils/index.ts","../../src/components/utils/parse-email-html.test.ts","../../src/components/utils/parse-email-html.ts","../../src/templates/inviteowneremailtemplate.tsx","../../src/templates/invitepmemailtemplate.tsx","../../src/templates/ownerstatementemailtemplate.tsx","../../src/templates/ownerstatementsummaryemailtemplate.tsx","../../src/templates/ownertaxstatementemailtemplate.tsx","../../src/templates/tenantdeletionemailtemplate.tsx","../../src/templates/tenantsuspensionemailtemplate.tsx","../../src/templates/index.ts","../../src/utils/index.ts","../../src/utils/send-email.ts"],"version":"5.8.3"}
@@ -1,59 +0,0 @@
1
- import { describe, expect, it } from 'bun:test';
2
- import { parseEmailHtml } from './parse-email-html';
3
- describe('parseEmailHtml', () => {
4
- it('should replace <action-link-component></action-link-component> with the sign-in link anchor tag', () => {
5
- const html = '<div><action-link-component></action-link-component></div>';
6
- const args = {
7
- href: 'https://example.com/signin',
8
- userName: 'John Doe',
9
- date: '2023-01-01',
10
- listingName: '123 Main St',
11
- };
12
- const result = parseEmailHtml(html, args);
13
- expect(result).toBe('<div><a href="https://example.com/signin" target="_blank">https://example.com/signin</a></div>');
14
- });
15
- it('should replace <user-name-component></user-name-component> with the user name', () => {
16
- const html = '<div>Hello <user-name-component></user-name-component>!</div>';
17
- const args = {
18
- href: 'https://example.com/signin',
19
- userName: 'John Doe',
20
- date: '2023-01-01',
21
- listingName: '123 Main St',
22
- };
23
- const result = parseEmailHtml(html, args);
24
- expect(result).toBe('<div>Hello John Doe!</div>');
25
- });
26
- it('should replace both <action-link-component> and <user-name-component> appropriately', () => {
27
- const html = `
28
- <div>
29
- <action-link-component></action-link-component>
30
- <user-name-component></user-name-component>
31
- </div>
32
- `;
33
- const args = {
34
- href: 'https://example.com/signin',
35
- userName: 'Jane Doe',
36
- date: '2023-01-01',
37
- listingName: '123 Main St',
38
- };
39
- const result = parseEmailHtml(html, args);
40
- expect(result).toBe(`
41
- <div>
42
- <a href="https://example.com/signin" target="_blank">https://example.com/signin</a>
43
- Jane Doe
44
- </div>
45
- `);
46
- });
47
- it('should return the input HTML unchanged if there are no components to replace', () => {
48
- const html = '<div>No components to replace here</div>';
49
- const args = {
50
- href: 'https://example.com/signin',
51
- userName: 'John Doe',
52
- date: '2023-01-01',
53
- listingName: '123 Main St',
54
- };
55
- const result = parseEmailHtml(html, args);
56
- expect(result).toBe('<div>No components to replace here</div>');
57
- });
58
- });
59
- //# sourceMappingURL=parse-email-html.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"parse-email-html.test.js","sourceRoot":"src/","sources":["components/utils/parse-email-html.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC9B,EAAE,CAAC,iGAAiG,EAAE,GAAG,EAAE;QACzG,MAAM,IAAI,GAAG,4DAA4D,CAAC;QAC1E,MAAM,IAAI,GAAyC;YACjD,IAAI,EAAE,4BAA4B;YAClC,QAAQ,EAAE,UAAU;YACpB,IAAI,EAAE,YAAY;YAClB,WAAW,EAAE,aAAa;SAC3B,CAAC;QACF,MAAM,MAAM,GAAG,cAAc,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAC1C,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CACjB,gGAAgG,CACjG,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,+EAA+E,EAAE,GAAG,EAAE;QACvF,MAAM,IAAI,GACR,+DAA+D,CAAC;QAClE,MAAM,IAAI,GAAyC;YACjD,IAAI,EAAE,4BAA4B;YAClC,QAAQ,EAAE,UAAU;YACpB,IAAI,EAAE,YAAY;YAClB,WAAW,EAAE,aAAa;SAC3B,CAAC;QACF,MAAM,MAAM,GAAG,cAAc,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAC1C,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAC;IACpD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,qFAAqF,EAAE,GAAG,EAAE;QAC7F,MAAM,IAAI,GAAG;;;;;KAKZ,CAAC;QACF,MAAM,IAAI,GAAyC;YACjD,IAAI,EAAE,4BAA4B;YAClC,QAAQ,EAAE,UAAU;YACpB,IAAI,EAAE,YAAY;YAClB,WAAW,EAAE,aAAa;SAC3B,CAAC;QACF,MAAM,MAAM,GAAG,cAAc,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAC1C,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC;;;;;KAKnB,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,8EAA8E,EAAE,GAAG,EAAE;QACtF,MAAM,IAAI,GAAG,0CAA0C,CAAC;QACxD,MAAM,IAAI,GAAyC;YACjD,IAAI,EAAE,4BAA4B;YAClC,QAAQ,EAAE,UAAU;YACpB,IAAI,EAAE,YAAY;YAClB,WAAW,EAAE,aAAa;SAC3B,CAAC;QACF,MAAM,MAAM,GAAG,cAAc,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAC1C,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,0CAA0C,CAAC,CAAC;IAClE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,9 +0,0 @@
1
- import { type ActionEmailData, type ActionEmailTemplateProps } from '../components';
2
- export declare const getDefaultOwnerStatementSummaryEmailData: (mode: "tag" | "text", args: {
3
- appName: string;
4
- ownerStatementHref: string;
5
- userName: string;
6
- }) => ActionEmailData;
7
- export declare const OwnerStatementSummaryEmailTemplate: (props: ActionEmailTemplateProps) => import("react/jsx-runtime").JSX.Element;
8
- declare const Preview: () => import("react/jsx-runtime").JSX.Element;
9
- export default Preview;