@vrplatform/email 1.0.0

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 (158) hide show
  1. package/LICENSE +3 -0
  2. package/build/main/components/ActionEmailTemplate.d.ts +15 -0
  3. package/build/main/components/ActionEmailTemplate.js +39 -0
  4. package/build/main/components/ActionEmailTemplate.js.map +1 -0
  5. package/build/main/components/Button.d.ts +11 -0
  6. package/build/main/components/Button.js +15 -0
  7. package/build/main/components/Button.js.map +1 -0
  8. package/build/main/components/EmailContainer.d.ts +10 -0
  9. package/build/main/components/EmailContainer.js +52 -0
  10. package/build/main/components/EmailContainer.js.map +1 -0
  11. package/build/main/components/index.d.ts +2 -0
  12. package/build/main/components/index.js +3 -0
  13. package/build/main/components/index.js.map +1 -0
  14. package/build/main/components/utils/index.d.ts +1 -0
  15. package/build/main/components/utils/index.js +2 -0
  16. package/build/main/components/utils/index.js.map +1 -0
  17. package/build/main/components/utils/parse-email-html.d.ts +6 -0
  18. package/build/main/components/utils/parse-email-html.js +11 -0
  19. package/build/main/components/utils/parse-email-html.js.map +1 -0
  20. package/build/main/components/utils/parse-email-html.test.d.ts +1 -0
  21. package/build/main/components/utils/parse-email-html.test.js +59 -0
  22. package/build/main/components/utils/parse-email-html.test.js.map +1 -0
  23. package/build/main/const.d.ts +6 -0
  24. package/build/main/const.js +7 -0
  25. package/build/main/const.js.map +1 -0
  26. package/build/main/extensions.d.ts +4 -0
  27. package/build/main/extensions.js +5 -0
  28. package/build/main/extensions.js.map +1 -0
  29. package/build/main/index.d.ts +7 -0
  30. package/build/main/index.js +7 -0
  31. package/build/main/index.js.map +1 -0
  32. package/build/main/templates/InviteOwnerEmailTemplate.d.ts +8 -0
  33. package/build/main/templates/InviteOwnerEmailTemplate.js +41 -0
  34. package/build/main/templates/InviteOwnerEmailTemplate.js.map +1 -0
  35. package/build/main/templates/InvitePmEmailTemplate.d.ts +8 -0
  36. package/build/main/templates/InvitePmEmailTemplate.js +51 -0
  37. package/build/main/templates/InvitePmEmailTemplate.js.map +1 -0
  38. package/build/main/templates/OwnerStatementEmailTemplate.d.ts +11 -0
  39. package/build/main/templates/OwnerStatementEmailTemplate.js +55 -0
  40. package/build/main/templates/OwnerStatementEmailTemplate.js.map +1 -0
  41. package/build/main/templates/OwnerStatementSummaryEmailTemplate.d.ts +9 -0
  42. package/build/main/templates/OwnerStatementSummaryEmailTemplate.js +46 -0
  43. package/build/main/templates/OwnerStatementSummaryEmailTemplate.js.map +1 -0
  44. package/build/main/templates/OwnerTaxStatementEmailTemplate.d.ts +10 -0
  45. package/build/main/templates/OwnerTaxStatementEmailTemplate.js +47 -0
  46. package/build/main/templates/OwnerTaxStatementEmailTemplate.js.map +1 -0
  47. package/build/main/templates/TenantDeletionEmailTemplate.d.ts +10 -0
  48. package/build/main/templates/TenantDeletionEmailTemplate.js +26 -0
  49. package/build/main/templates/TenantDeletionEmailTemplate.js.map +1 -0
  50. package/build/main/templates/TenantSuspensionEmailTemplate.d.ts +9 -0
  51. package/build/main/templates/TenantSuspensionEmailTemplate.js +24 -0
  52. package/build/main/templates/TenantSuspensionEmailTemplate.js.map +1 -0
  53. package/build/main/templates/index.d.ts +7 -0
  54. package/build/main/templates/index.js +12 -0
  55. package/build/main/templates/index.js.map +1 -0
  56. package/build/main/theme.d.ts +29 -0
  57. package/build/main/theme.js +283 -0
  58. package/build/main/theme.js.map +1 -0
  59. package/build/main/tsconfig.main.tsbuildinfo +1 -0
  60. package/build/main/types.d.ts +25 -0
  61. package/build/main/types.js +2 -0
  62. package/build/main/types.js.map +1 -0
  63. package/build/main/utils/index.d.ts +1 -0
  64. package/build/main/utils/index.js +2 -0
  65. package/build/main/utils/index.js.map +1 -0
  66. package/build/main/utils/send-email.d.ts +10 -0
  67. package/build/main/utils/send-email.js +24 -0
  68. package/build/main/utils/send-email.js.map +1 -0
  69. package/build/module/components/ActionEmailTemplate.d.ts +15 -0
  70. package/build/module/components/ActionEmailTemplate.js +39 -0
  71. package/build/module/components/ActionEmailTemplate.js.map +1 -0
  72. package/build/module/components/Button.d.ts +11 -0
  73. package/build/module/components/Button.js +15 -0
  74. package/build/module/components/Button.js.map +1 -0
  75. package/build/module/components/EmailContainer.d.ts +10 -0
  76. package/build/module/components/EmailContainer.js +52 -0
  77. package/build/module/components/EmailContainer.js.map +1 -0
  78. package/build/module/components/index.d.ts +2 -0
  79. package/build/module/components/index.js +3 -0
  80. package/build/module/components/index.js.map +1 -0
  81. package/build/module/components/utils/index.d.ts +1 -0
  82. package/build/module/components/utils/index.js +2 -0
  83. package/build/module/components/utils/index.js.map +1 -0
  84. package/build/module/components/utils/parse-email-html.d.ts +6 -0
  85. package/build/module/components/utils/parse-email-html.js +11 -0
  86. package/build/module/components/utils/parse-email-html.js.map +1 -0
  87. package/build/module/components/utils/parse-email-html.test.d.ts +1 -0
  88. package/build/module/components/utils/parse-email-html.test.js +59 -0
  89. package/build/module/components/utils/parse-email-html.test.js.map +1 -0
  90. package/build/module/const.d.ts +6 -0
  91. package/build/module/const.js +7 -0
  92. package/build/module/const.js.map +1 -0
  93. package/build/module/extensions.d.ts +4 -0
  94. package/build/module/extensions.js +5 -0
  95. package/build/module/extensions.js.map +1 -0
  96. package/build/module/index.d.ts +7 -0
  97. package/build/module/index.js +7 -0
  98. package/build/module/index.js.map +1 -0
  99. package/build/module/templates/InviteOwnerEmailTemplate.d.ts +8 -0
  100. package/build/module/templates/InviteOwnerEmailTemplate.js +41 -0
  101. package/build/module/templates/InviteOwnerEmailTemplate.js.map +1 -0
  102. package/build/module/templates/InvitePmEmailTemplate.d.ts +8 -0
  103. package/build/module/templates/InvitePmEmailTemplate.js +51 -0
  104. package/build/module/templates/InvitePmEmailTemplate.js.map +1 -0
  105. package/build/module/templates/OwnerStatementEmailTemplate.d.ts +11 -0
  106. package/build/module/templates/OwnerStatementEmailTemplate.js +55 -0
  107. package/build/module/templates/OwnerStatementEmailTemplate.js.map +1 -0
  108. package/build/module/templates/OwnerStatementSummaryEmailTemplate.d.ts +9 -0
  109. package/build/module/templates/OwnerStatementSummaryEmailTemplate.js +46 -0
  110. package/build/module/templates/OwnerStatementSummaryEmailTemplate.js.map +1 -0
  111. package/build/module/templates/OwnerTaxStatementEmailTemplate.d.ts +10 -0
  112. package/build/module/templates/OwnerTaxStatementEmailTemplate.js +47 -0
  113. package/build/module/templates/OwnerTaxStatementEmailTemplate.js.map +1 -0
  114. package/build/module/templates/TenantDeletionEmailTemplate.d.ts +10 -0
  115. package/build/module/templates/TenantDeletionEmailTemplate.js +26 -0
  116. package/build/module/templates/TenantDeletionEmailTemplate.js.map +1 -0
  117. package/build/module/templates/TenantSuspensionEmailTemplate.d.ts +9 -0
  118. package/build/module/templates/TenantSuspensionEmailTemplate.js +24 -0
  119. package/build/module/templates/TenantSuspensionEmailTemplate.js.map +1 -0
  120. package/build/module/templates/index.d.ts +7 -0
  121. package/build/module/templates/index.js +12 -0
  122. package/build/module/templates/index.js.map +1 -0
  123. package/build/module/theme.d.ts +29 -0
  124. package/build/module/theme.js +283 -0
  125. package/build/module/theme.js.map +1 -0
  126. package/build/module/tsconfig.esm.tsbuildinfo +1 -0
  127. package/build/module/types.d.ts +25 -0
  128. package/build/module/types.js +2 -0
  129. package/build/module/types.js.map +1 -0
  130. package/build/module/utils/index.d.ts +1 -0
  131. package/build/module/utils/index.js +2 -0
  132. package/build/module/utils/index.js.map +1 -0
  133. package/build/module/utils/send-email.d.ts +10 -0
  134. package/build/module/utils/send-email.js +24 -0
  135. package/build/module/utils/send-email.js.map +1 -0
  136. package/package.json +53 -0
  137. package/src/components/ActionEmailTemplate.tsx +97 -0
  138. package/src/components/Button.tsx +40 -0
  139. package/src/components/EmailContainer.tsx +161 -0
  140. package/src/components/index.ts +2 -0
  141. package/src/components/utils/index.ts +1 -0
  142. package/src/components/utils/parse-email-html.test.ts +65 -0
  143. package/src/components/utils/parse-email-html.ts +28 -0
  144. package/src/const.ts +6 -0
  145. package/src/extensions.ts +7 -0
  146. package/src/index.ts +8 -0
  147. package/src/templates/InviteOwnerEmailTemplate.tsx +66 -0
  148. package/src/templates/InvitePmEmailTemplate.tsx +83 -0
  149. package/src/templates/OwnerStatementEmailTemplate.tsx +93 -0
  150. package/src/templates/OwnerStatementSummaryEmailTemplate.tsx +78 -0
  151. package/src/templates/OwnerTaxStatementEmailTemplate.tsx +80 -0
  152. package/src/templates/TenantDeletionEmailTemplate.tsx +119 -0
  153. package/src/templates/TenantSuspensionEmailTemplate.tsx +102 -0
  154. package/src/templates/index.ts +14 -0
  155. package/src/theme.ts +307 -0
  156. package/src/types.ts +25 -0
  157. package/src/utils/index.ts +1 -0
  158. package/src/utils/send-email.ts +37 -0
@@ -0,0 +1,97 @@
1
+ import { Heading } from '@react-email/heading';
2
+ import { Text } from '@react-email/text';
3
+ import { EmailContainer } from './EmailContainer';
4
+ import type { EmailBaseProps } from '../types';
5
+ import { parseEmailHtml } from './utils';
6
+ import { Button } from './Button';
7
+
8
+ export type ActionEmailData = {
9
+ subject: string;
10
+ shortDescription: string;
11
+ banner?: string;
12
+ header: string;
13
+ bodyOne: string;
14
+ bodyTwo: string;
15
+ href: string;
16
+ buttonText: string;
17
+ };
18
+
19
+ export interface ActionEmailTemplateProps extends EmailBaseProps {
20
+ data: ActionEmailData;
21
+ }
22
+
23
+ export const ActionEmailTemplate = ({
24
+ data,
25
+ tenant,
26
+ themeColors,
27
+ mode,
28
+ user,
29
+ listing,
30
+ month,
31
+ }: ActionEmailTemplateProps) => {
32
+ return (
33
+ <EmailContainer
34
+ title={data.subject}
35
+ shortDescription={data.shortDescription}
36
+ tenant={{
37
+ logo: tenant.logo,
38
+ }}
39
+ mode={mode}
40
+ >
41
+ <Heading
42
+ style={{
43
+ fontSize: 28,
44
+ fontWeight: 600,
45
+ marginBottom: '50px',
46
+ }}
47
+ >
48
+ {data.header?.trim() || `Welcome to ${tenant.name}!`}
49
+ </Heading>
50
+
51
+ {data.banner?.trim() && (
52
+ <Text
53
+ style={{
54
+ padding: '24px',
55
+ backgroundColor: '#f2f3f3',
56
+ borderRadius: '4px',
57
+ marginBottom: '40px',
58
+ }}
59
+ >
60
+ {data.banner.trim()}
61
+ </Text>
62
+ )}
63
+
64
+ <div
65
+ // biome-ignore lint/security/noDangerouslySetInnerHtml: <explanation>
66
+ dangerouslySetInnerHTML={{
67
+ __html: parseEmailHtml(data.bodyOne, {
68
+ href: data.href,
69
+ userName: user.firstName || '',
70
+ date: month || '',
71
+ listingName: listing || '',
72
+ }),
73
+ }}
74
+ />
75
+
76
+ <Button
77
+ href={data.href}
78
+ mode={mode}
79
+ data-testid="accept-invite-button"
80
+ label={data.buttonText?.trim() || 'Accept Invitation'}
81
+ themeColors={themeColors}
82
+ />
83
+
84
+ <div
85
+ // biome-ignore lint/security/noDangerouslySetInnerHtml: <explanation>
86
+ dangerouslySetInnerHTML={{
87
+ __html: parseEmailHtml(data.bodyTwo, {
88
+ href: data.href,
89
+ userName: user.firstName || '',
90
+ date: month || '',
91
+ listingName: listing || '',
92
+ }),
93
+ }}
94
+ />
95
+ </EmailContainer>
96
+ );
97
+ };
@@ -0,0 +1,40 @@
1
+ import { Button as ReactEmailButton } from '@react-email/button';
2
+ import type { ComponentProps } from 'react';
3
+ import type { EmailBaseProps } from '../types';
4
+
5
+ type Props = {
6
+ mode: EmailBaseProps['mode'];
7
+ href: string;
8
+ themeColors: EmailBaseProps['themeColors'];
9
+ label: string;
10
+ } & ComponentProps<typeof ReactEmailButton>;
11
+
12
+ export const Button = ({
13
+ href,
14
+ mode,
15
+ label,
16
+ themeColors,
17
+ style,
18
+ ...props
19
+ }: Props) => (
20
+ <ReactEmailButton
21
+ href={mode === 'send' ? href : undefined}
22
+ style={{
23
+ width: '100%',
24
+ textAlign: 'center',
25
+ display: 'block',
26
+ padding: '13px 0',
27
+ background: `linear-gradient(180deg, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0.00) 100%), ${
28
+ themeColors[8]
29
+ }`,
30
+ color: '#fff',
31
+ borderRadius: '8px',
32
+ marginTop: '30px',
33
+ marginBottom: '60px',
34
+ ...style,
35
+ }}
36
+ {...props}
37
+ >
38
+ {label.trim()}
39
+ </ReactEmailButton>
40
+ );
@@ -0,0 +1,161 @@
1
+ import { Body } from '@react-email/body';
2
+ import { Font } from '@react-email/font';
3
+ import { Head } from '@react-email/head';
4
+ import { Hr } from '@react-email/hr';
5
+ import { Html } from '@react-email/html';
6
+ import { Img } from '@react-email/img';
7
+ import { Preview } from '@react-email/preview';
8
+ import { Text } from '@react-email/text';
9
+ import type { EmailBaseProps } from '../types';
10
+
11
+ type Props = {
12
+ children: React.ReactNode;
13
+ title: string;
14
+ tenant: Omit<EmailBaseProps['tenant'], 'name'>;
15
+ mode: EmailBaseProps['mode'];
16
+ shortDescription?: string;
17
+ };
18
+
19
+ export const EmailContainer = (props: Props) => {
20
+ const { children, shortDescription, title } = props;
21
+
22
+ const contentWrapperStyle = {
23
+ paddingInline: '20px',
24
+ paddingBlock: '10px',
25
+ maxWidth: '500px',
26
+ margin: '0 auto',
27
+ };
28
+
29
+ if (props.mode !== 'send') {
30
+ return (
31
+ <div style={contentWrapperStyle}>
32
+ <Content {...props}>{children}</Content>
33
+ </div>
34
+ );
35
+ }
36
+
37
+ return (
38
+ <Html lang="en">
39
+ <Head>
40
+ <title>{title}</title>
41
+ <Font
42
+ fontFamily="Inter"
43
+ fallbackFontFamily="Verdana"
44
+ webFont={{
45
+ url: 'https://fonts.gstatic.com/s/inter/v13/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa1ZL7W0Q5nw.woff2',
46
+ format: 'woff2',
47
+ }}
48
+ fontWeight={400}
49
+ fontStyle="normal"
50
+ />
51
+ <Font
52
+ fontFamily="Inter"
53
+ fallbackFontFamily="Verdana"
54
+ webFont={{
55
+ url: 'https://fonts.gstatic.com/s/inter/v13/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa1ZL7W0Q5nw.woff2',
56
+ format: 'woff2',
57
+ }}
58
+ fontWeight={600}
59
+ fontStyle="normal"
60
+ />
61
+ </Head>
62
+ {shortDescription && <Preview>{shortDescription}</Preview>}
63
+ <Body style={contentWrapperStyle}>
64
+ <Content {...props}>{children}</Content>
65
+ </Body>
66
+ </Html>
67
+ );
68
+ };
69
+
70
+ const Content = ({ children, tenant: { logo: tenantLogo }, mode }: Props) => {
71
+ return (
72
+ <>
73
+ {tenantLogo ? (
74
+ <div
75
+ style={{
76
+ marginBottom: '60px',
77
+ padding: '5px',
78
+ // border: '1px solid rgb(233,236,239)',
79
+ borderRadius: '5px',
80
+ width: '80px',
81
+ display: 'flex',
82
+ justifyContent: 'center',
83
+ alignItems: 'center',
84
+ }}
85
+ >
86
+ <Img src={tenantLogo} alt={'Logo'} width={70} />
87
+ </div>
88
+ ) : mode === 'send' ? (
89
+ <Img
90
+ src={'https://staging.portal.vrplatform.app/logo.png'}
91
+ alt={'Logo'}
92
+ width={70}
93
+ style={{ marginBottom: '60px' }}
94
+ />
95
+ ) : (
96
+ <div
97
+ style={{
98
+ width: '60px',
99
+ }}
100
+ >
101
+ <VrpLogo />
102
+ </div>
103
+ )}
104
+
105
+ {children}
106
+
107
+ <Footer />
108
+ </>
109
+ );
110
+ };
111
+
112
+ const Footer = () => (
113
+ <>
114
+ <Hr
115
+ style={{
116
+ marginTop: '30px',
117
+ marginBottom: '50px',
118
+ }}
119
+ />
120
+
121
+ <Text
122
+ style={{
123
+ color: '#737373',
124
+ }}
125
+ >
126
+ © {new Date().getFullYear()} VRPlatform Ventures Ltd. All rights reserved.
127
+ </Text>
128
+ <Text
129
+ style={{
130
+ color: '#737373',
131
+ }}
132
+ >
133
+ VR Technologies, LLC, a company incorporated and registered in the United
134
+ States of America with company number 20201965158
135
+ </Text>
136
+ </>
137
+ );
138
+
139
+ const VrpLogo = () => (
140
+ <svg
141
+ width="100%"
142
+ height="100%"
143
+ viewBox="0 0 28 29"
144
+ fill="none"
145
+ xmlns="http://www.w3.org/2000/svg"
146
+ >
147
+ <path
148
+ d="M18.2549 8.25161C18.2549 5.89704 20.1636 3.98828 22.5182 3.98828C24.8728 3.98828 26.7815 5.89704 26.7815 8.25161C26.7815 10.6062 24.8728 12.5149 22.5182 12.5149C20.1636 12.5149 18.2549 10.6062 18.2549 8.25161Z"
149
+ fill="#172554"
150
+ />
151
+ <path
152
+ d="M7.02441 8.46593C7.02441 6.01867 9.20858 3.99805 11.6558 3.99805C14.1031 3.99805 15.0558 5.59785 16.5612 7.52728C17.1957 8.34054 20.7921 13.3413 20.7921 13.3413C20.7921 13.3413 21.566 14.6863 21.566 15.7894C21.566 18.5287 17.1993 22.8381 17.1993 22.8381L7.66841 10.6799C7.66841 10.6799 7.02441 10.0502 7.02441 8.46593Z"
153
+ fill="#172554"
154
+ fillOpacity="0.8"
155
+ />
156
+ <path
157
+ d="M1.24707 8.42687C1.24707 5.97961 3.43123 3.95898 5.8785 3.95898C8.32576 3.95898 9.27845 5.55879 10.7839 7.48824C11.4184 8.30147 14.6041 12.4888 16.8247 15.5727C18.3585 17.703 18.474 17.705 18.474 20.3439C18.474 22.9827 15.1592 24.1379 14.1483 24.1914C12.0203 24.304 10.5418 22.4681 10.5418 22.4681L1.89106 10.6408C1.89106 10.6408 1.24707 10.0111 1.24707 8.42687Z"
158
+ fill="#172554"
159
+ />
160
+ </svg>
161
+ );
@@ -0,0 +1,2 @@
1
+ export * from './EmailContainer';
2
+ export * from './ActionEmailTemplate';
@@ -0,0 +1 @@
1
+ export * from './parse-email-html';
@@ -0,0 +1,65 @@
1
+ import { describe, expect, it } from 'bun:test';
2
+ import { parseEmailHtml } from './parse-email-html';
3
+
4
+ describe('parseEmailHtml', () => {
5
+ it('should replace <action-link-component></action-link-component> with the sign-in link anchor tag', () => {
6
+ const html = '<div><action-link-component></action-link-component></div>';
7
+ const args: Parameters<typeof parseEmailHtml>[1] = {
8
+ href: 'https://example.com/signin',
9
+ userName: 'John Doe',
10
+ date: '2023-01-01',
11
+ listingName: '123 Main St',
12
+ };
13
+ const result = parseEmailHtml(html, args);
14
+ expect(result).toBe(
15
+ '<div><a href="https://example.com/signin" target="_blank">https://example.com/signin</a></div>'
16
+ );
17
+ });
18
+
19
+ it('should replace <user-name-component></user-name-component> with the user name', () => {
20
+ const html =
21
+ '<div>Hello <user-name-component></user-name-component>!</div>';
22
+ const args: Parameters<typeof parseEmailHtml>[1] = {
23
+ href: 'https://example.com/signin',
24
+ userName: 'John Doe',
25
+ date: '2023-01-01',
26
+ listingName: '123 Main St',
27
+ };
28
+ const result = parseEmailHtml(html, args);
29
+ expect(result).toBe('<div>Hello John Doe!</div>');
30
+ });
31
+
32
+ it('should replace both <action-link-component> and <user-name-component> appropriately', () => {
33
+ const html = `
34
+ <div>
35
+ <action-link-component></action-link-component>
36
+ <user-name-component></user-name-component>
37
+ </div>
38
+ `;
39
+ const args: Parameters<typeof parseEmailHtml>[1] = {
40
+ href: 'https://example.com/signin',
41
+ userName: 'Jane Doe',
42
+ date: '2023-01-01',
43
+ listingName: '123 Main St',
44
+ };
45
+ const result = parseEmailHtml(html, args);
46
+ expect(result).toBe(`
47
+ <div>
48
+ <a href="https://example.com/signin" target="_blank">https://example.com/signin</a>
49
+ Jane Doe
50
+ </div>
51
+ `);
52
+ });
53
+
54
+ it('should return the input HTML unchanged if there are no components to replace', () => {
55
+ const html = '<div>No components to replace here</div>';
56
+ const args: Parameters<typeof parseEmailHtml>[1] = {
57
+ href: 'https://example.com/signin',
58
+ userName: 'John Doe',
59
+ date: '2023-01-01',
60
+ listingName: '123 Main St',
61
+ };
62
+ const result = parseEmailHtml(html, args);
63
+ expect(result).toBe('<div>No components to replace here</div>');
64
+ });
65
+ });
@@ -0,0 +1,28 @@
1
+ export const parseEmailHtml = (
2
+ html: string,
3
+ args: {
4
+ href: string;
5
+ userName: string;
6
+ listingName: string;
7
+ date: string;
8
+ }
9
+ ) => {
10
+ // parse out any html scripts of type : <team-name-component></team-name-component> or <user-name-component></user-name-component>
11
+ // and replace them with the appropriate component
12
+ // return the parsed html
13
+
14
+ return html
15
+ .replaceAll(
16
+ /<action\-link\-component><\/action\-link\-component>/g,
17
+ `<a href="${args.href}" target="_blank">${args.href}</a>`
18
+ )
19
+ .replaceAll(
20
+ /<user\-name\-component><\/user\-name\-component>/g,
21
+ args.userName
22
+ )
23
+ .replaceAll(
24
+ /<listing\-name\-component><\/listing\-name\-component>/g,
25
+ args.listingName
26
+ )
27
+ .replaceAll(/<date\-component><\/date\-component>/g, args.date);
28
+ };
package/src/const.ts ADDED
@@ -0,0 +1,6 @@
1
+ export const VRP_PLATFORM = {
2
+ name: 'VRPlatform',
3
+ from: 'notifications@vrplatform.app',
4
+ portal: 'https://portal.vrplatform.app',
5
+ logo: 'https://images.clerk.dev/uploaded/img_2HU8qby65rUiwkf3k2bC0XnUxVz.png',
6
+ } as const;
@@ -0,0 +1,7 @@
1
+ export const EMAIL_USER_NAME_COMPONENT =
2
+ '<user-name-component></user-name-component>';
3
+ export const EMAIL_ACTION_LINK_COMPONENT =
4
+ '<action-link-component></action-link-component>';
5
+ export const EMAIL_LISTING_COMPONENT =
6
+ '<listing-name-component></listing-name-component>';
7
+ export const EMAIL_DATE_COMPONENT = '<date-component></date-component>';
package/src/index.ts ADDED
@@ -0,0 +1,8 @@
1
+ export * from './templates';
2
+ export * from './utils'; // send email utils
3
+ export * from './theme';
4
+ export * from './extensions';
5
+ export { VRP_PLATFORM } from './const';
6
+ export type { ActionEmailData } from './components';
7
+
8
+ export { render } from '@react-email/render';
@@ -0,0 +1,66 @@
1
+ import { EMAIL_ACTION_LINK_COMPONENT } from '../extensions';
2
+ import {
3
+ type ActionEmailData,
4
+ ActionEmailTemplate,
5
+ type ActionEmailTemplateProps,
6
+ } from '../components';
7
+
8
+ export const getDefaultInviteOwnerEmailData = (
9
+ mode: 'tag' | 'text',
10
+ args: {
11
+ appName: string;
12
+ signInLink: string;
13
+ }
14
+ ): ActionEmailData => {
15
+ const signInLink =
16
+ mode === 'tag' ? EMAIL_ACTION_LINK_COMPONENT : args.signInLink;
17
+
18
+ return {
19
+ bodyOne: `<p>You are invited to join us on ${args.appName}.</p><p>To start using ${args.appName}, accept the invitation and verify your email address.</p>`,
20
+ bodyTwo: `<p>If you have any trouble with the button, you can copy and paste the link below into your browser: ${signInLink}</p>`,
21
+ buttonText: 'Accept Invitation',
22
+ header: 'Welcome to the team!',
23
+ shortDescription:
24
+ 'You have been invited to join the team. To start using VRPlatform, verify your email address at link below.',
25
+ href: args.signInLink,
26
+ subject: `You are invited to join your team on ${args.appName}`,
27
+ };
28
+ };
29
+
30
+ export const InviteOwnerEmailTemplate = (props: ActionEmailTemplateProps) => {
31
+ return <ActionEmailTemplate {...props} />;
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;
@@ -0,0 +1,83 @@
1
+ import { EMAIL_ACTION_LINK_COMPONENT } from '../extensions';
2
+ import {
3
+ type ActionEmailData,
4
+ ActionEmailTemplate,
5
+ type ActionEmailTemplateProps,
6
+ } from '../components';
7
+
8
+ export const getDefaultInvitePropertyManagerEmailData = (
9
+ mode: 'tag' | 'text',
10
+ args: {
11
+ appName: string;
12
+ signInLink: string;
13
+ }
14
+ ): ActionEmailData => {
15
+ const signInLink =
16
+ mode === 'tag'
17
+ ? EMAIL_ACTION_LINK_COMPONENT
18
+ : `<a href='${args.signInLink}' target='_blank'>${args.signInLink}</a>`;
19
+
20
+ return {
21
+ bodyOne: `<p>You are invited to join us on ${args.appName}.</p><p>To start using ${args.appName}, accept the invitation and verify your email address.</p>`,
22
+ bodyTwo: `<p>If you have any trouble with the button, you can use the following link below: ${signInLink}</p>`,
23
+ buttonText: 'Accept Invitation',
24
+ header: 'Welcome to the team!',
25
+ shortDescription:
26
+ 'You have been invited to join the team. To start using VRPlatform, verify your email address at link below.',
27
+ href: args.signInLink,
28
+ subject: `You are invited to join your team on ${args.appName}`,
29
+ };
30
+ };
31
+
32
+ export const InvitePmEmailTemplate = (props: ActionEmailTemplateProps) => {
33
+ return (
34
+ <ActionEmailTemplate
35
+ {...props}
36
+ tenant={{
37
+ logo: undefined,
38
+ name: props.tenant.name,
39
+ }}
40
+ />
41
+ );
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;
@@ -0,0 +1,93 @@
1
+ import {
2
+ EMAIL_ACTION_LINK_COMPONENT,
3
+ EMAIL_DATE_COMPONENT,
4
+ EMAIL_LISTING_COMPONENT,
5
+ EMAIL_USER_NAME_COMPONENT,
6
+ } from '../extensions';
7
+ import {
8
+ type ActionEmailData,
9
+ ActionEmailTemplate,
10
+ type ActionEmailTemplateProps,
11
+ } from '../components/ActionEmailTemplate';
12
+
13
+ export const getDefaultOwnerStatementEmailData = (
14
+ mode: 'tag' | 'text',
15
+ args: {
16
+ appName: string;
17
+ ownerStatementHref: string;
18
+ listingName: string;
19
+ userName: string;
20
+ month: string;
21
+ }
22
+ ): ActionEmailData => {
23
+ const ownerStatementHref =
24
+ mode === 'tag' ? EMAIL_ACTION_LINK_COMPONENT : args.ownerStatementHref;
25
+
26
+ const listingName =
27
+ mode === 'tag' ? EMAIL_LISTING_COMPONENT : args.listingName;
28
+ const month = mode === 'tag' ? EMAIL_DATE_COMPONENT : args.month;
29
+ const userName = mode === 'tag' ? EMAIL_USER_NAME_COMPONENT : args.userName;
30
+
31
+ 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>`,
38
+ href: args.ownerStatementHref,
39
+ };
40
+ };
41
+
42
+ export const OwnerStatementEmailTemplate = (
43
+ props: ActionEmailTemplateProps
44
+ ) => {
45
+ return <ActionEmailTemplate {...props} />;
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;