@vrplatform/email 1.0.2-6561 → 1.0.2-736

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 (51) hide show
  1. package/build/main/components/ActionEmailTemplate.js +1 -3
  2. package/build/main/components/ActionEmailTemplate.js.map +1 -1
  3. package/build/main/components/EmailContainer.d.ts +3 -1
  4. package/build/main/components/EmailContainer.js +4 -4
  5. package/build/main/components/EmailContainer.js.map +1 -1
  6. package/build/main/templates/InviteOwnerEmailTemplate.d.ts +3 -1
  7. package/build/main/templates/InviteOwnerEmailTemplate.js +10 -6
  8. package/build/main/templates/InviteOwnerEmailTemplate.js.map +1 -1
  9. package/build/main/templates/InvitePmEmailTemplate.js +7 -3
  10. package/build/main/templates/InvitePmEmailTemplate.js.map +1 -1
  11. package/build/main/types.d.ts +1 -0
  12. package/build/main/types.js.map +1 -1
  13. package/build/main/utils/find-postmark-email.d.ts +8 -0
  14. package/build/main/utils/find-postmark-email.js +55 -0
  15. package/build/main/utils/find-postmark-email.js.map +1 -0
  16. package/build/main/utils/index.d.ts +1 -0
  17. package/build/main/utils/index.js +1 -0
  18. package/build/main/utils/index.js.map +1 -1
  19. package/build/main/utils/send-email.d.ts +27 -3
  20. package/build/main/utils/send-email.js +103 -22
  21. package/build/main/utils/send-email.js.map +1 -1
  22. package/build/module/components/ActionEmailTemplate.js +1 -3
  23. package/build/module/components/ActionEmailTemplate.js.map +1 -1
  24. package/build/module/components/EmailContainer.d.ts +3 -1
  25. package/build/module/components/EmailContainer.js +4 -4
  26. package/build/module/components/EmailContainer.js.map +1 -1
  27. package/build/module/templates/InviteOwnerEmailTemplate.d.ts +3 -1
  28. package/build/module/templates/InviteOwnerEmailTemplate.js +10 -6
  29. package/build/module/templates/InviteOwnerEmailTemplate.js.map +1 -1
  30. package/build/module/templates/InvitePmEmailTemplate.js +7 -3
  31. package/build/module/templates/InvitePmEmailTemplate.js.map +1 -1
  32. package/build/module/types.d.ts +1 -0
  33. package/build/module/types.js.map +1 -1
  34. package/build/module/utils/find-postmark-email.d.ts +8 -0
  35. package/build/module/utils/find-postmark-email.js +52 -0
  36. package/build/module/utils/find-postmark-email.js.map +1 -0
  37. package/build/module/utils/index.d.ts +1 -0
  38. package/build/module/utils/index.js +1 -0
  39. package/build/module/utils/index.js.map +1 -1
  40. package/build/module/utils/send-email.d.ts +27 -3
  41. package/build/module/utils/send-email.js +102 -22
  42. package/build/module/utils/send-email.js.map +1 -1
  43. package/package.json +3 -2
  44. package/src/components/ActionEmailTemplate.tsx +1 -3
  45. package/src/components/EmailContainer.tsx +10 -4
  46. package/src/templates/InviteOwnerEmailTemplate.tsx +20 -7
  47. package/src/templates/InvitePmEmailTemplate.tsx +7 -3
  48. package/src/types.ts +1 -0
  49. package/src/utils/find-postmark-email.ts +80 -0
  50. package/src/utils/index.ts +1 -0
  51. package/src/utils/send-email.ts +177 -28
@@ -8,9 +8,7 @@ const EmailContainer_1 = require("./EmailContainer");
8
8
  const utils_1 = require("./utils");
9
9
  const Button_1 = require("./Button");
10
10
  const ActionEmailTemplate = ({ data, tenant, themeColors, mode, user, listing, month, }) => {
11
- return ((0, jsx_runtime_1.jsxs)(EmailContainer_1.EmailContainer, { title: data.subject, shortDescription: data.shortDescription, tenant: {
12
- logo: tenant.logo,
13
- }, mode: mode, children: [(0, jsx_runtime_1.jsx)(heading_1.Heading, { style: {
11
+ return ((0, jsx_runtime_1.jsxs)(EmailContainer_1.EmailContainer, { title: data.subject, shortDescription: data.shortDescription, tenant: tenant, mode: mode, children: [(0, jsx_runtime_1.jsx)(heading_1.Heading, { style: {
14
12
  fontSize: 28,
15
13
  fontWeight: 600,
16
14
  marginBottom: '50px',
@@ -1 +1 @@
1
- {"version":3,"file":"ActionEmailTemplate.js","sourceRoot":"src/","sources":["components/ActionEmailTemplate.tsx"],"names":[],"mappings":";;;;AAAA,kDAA+C;AAC/C,4CAAyC;AACzC,qDAAkD;AAElD,mCAAyC;AACzC,qCAAkC;AAiB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E,WAAW,GACxB,EAEF;gBACE,sEAAsE;gBACtE,uBAAuB,EAAE;oBACvB,MAAM,EAAE,IAAA,sBAAc,EAAC,IAAI,CAAC,OAAO,EAAE;wBACnC,IAAI,EAAE,IAAI,CAAC,IAAI;wBACf,QAAQ,EAAE,IAAI,CAAC,SAAS,IAAI,EAAE;wBAC9B,IAAI,EAAE,KAAK,IAAI,EAAE;wBACjB,WAAW,EAAE,OAAO,IAAI,EAAE;qBAC3B,CAAC;iBACH,GACD,IACa,CAClB,CAAC;AACJ,CAAC,CAAC;AA1EW,QAAA,mBAAmB,uBA0E9B","sourcesContent":["import { Heading } from '@react-email/heading';\nimport { Text } from '@react-email/text';\nimport { EmailContainer } from './EmailContainer';\nimport type { EmailBaseProps } from '../types';\nimport { parseEmailHtml } from './utils';\nimport { Button } from './Button';\n\nexport type ActionEmailData = {\n subject: string;\n shortDescription: string;\n banner?: string;\n header: string;\n bodyOne: string;\n bodyTwo: string;\n href: string;\n buttonText: string;\n};\n\nexport interface ActionEmailTemplateProps extends EmailBaseProps {\n data: ActionEmailData;\n}\n\nexport const ActionEmailTemplate = ({\n data,\n tenant,\n themeColors,\n mode,\n user,\n listing,\n month,\n}: ActionEmailTemplateProps) => {\n return (\n <EmailContainer\n title={data.subject}\n shortDescription={data.shortDescription}\n tenant={{\n logo: tenant.logo,\n }}\n mode={mode}\n >\n <Heading\n style={{\n fontSize: 28,\n fontWeight: 600,\n marginBottom: '50px',\n }}\n >\n {data.header?.trim() || `Welcome to ${tenant.name}!`}\n </Heading>\n\n {data.banner?.trim() && (\n <Text\n style={{\n padding: '24px',\n backgroundColor: '#f2f3f3',\n borderRadius: '4px',\n marginBottom: '40px',\n }}\n >\n {data.banner.trim()}\n </Text>\n )}\n\n <div\n // biome-ignore lint/security/noDangerouslySetInnerHtml: <explanation>\n dangerouslySetInnerHTML={{\n __html: parseEmailHtml(data.bodyOne, {\n href: data.href,\n userName: user.firstName || '',\n date: month || '',\n listingName: listing || '',\n }),\n }}\n />\n\n <Button\n href={data.href}\n mode={mode}\n data-testid=\"accept-invite-button\"\n label={data.buttonText?.trim() || 'Accept Invitation'}\n themeColors={themeColors}\n />\n\n <div\n // biome-ignore lint/security/noDangerouslySetInnerHtml: <explanation>\n dangerouslySetInnerHTML={{\n __html: parseEmailHtml(data.bodyTwo, {\n href: data.href,\n userName: user.firstName || '',\n date: month || '',\n listingName: listing || '',\n }),\n }}\n />\n </EmailContainer>\n );\n};\n"]}
1
+ {"version":3,"file":"ActionEmailTemplate.js","sourceRoot":"src/","sources":["components/ActionEmailTemplate.tsx"],"names":[],"mappings":";;;;AAAA,kDAA+C;AAC/C,4CAAyC;AACzC,qDAAkD;AAElD,mCAAyC;AACzC,qCAAkC;AAiB3B,MAAM,mBAAmB,GAAG,CAAC,EAClC,IAAI,EACJ,MAAM,EACN,WAAW,EACX,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,KAAK,GACoB,EAAE,EAAE;IAC7B,OAAO,CACL,wBAAC,+BAAc,IACb,KAAK,EAAE,IAAI,CAAC,OAAO,EACnB,gBAAgB,EAAE,IAAI,CAAC,gBAAgB,EACvC,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,IAAI,aAEV,uBAAC,iBAAO,IACN,KAAK,EAAE;oBACL,QAAQ,EAAE,EAAE;oBACZ,UAAU,EAAE,GAAG;oBACf,YAAY,EAAE,MAAM;iBACrB,YAEA,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,cAAc,MAAM,CAAC,IAAI,GAAG,GAC5C,EAET,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CACtB,uBAAC,WAAI,IACH,KAAK,EAAE;oBACL,OAAO,EAAE,MAAM;oBACf,eAAe,EAAE,SAAS;oBAC1B,YAAY,EAAE,KAAK;oBACnB,YAAY,EAAE,MAAM;iBACrB,YAEA,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,GACd,CACR,EAED;gBACE,sEAAsE;gBACtE,uBAAuB,EAAE;oBACvB,MAAM,EAAE,IAAA,sBAAc,EAAC,IAAI,CAAC,OAAO,EAAE;wBACnC,IAAI,EAAE,IAAI,CAAC,IAAI;wBACf,QAAQ,EAAE,IAAI,CAAC,SAAS,IAAI,EAAE;wBAC9B,IAAI,EAAE,KAAK,IAAI,EAAE;wBACjB,WAAW,EAAE,OAAO,IAAI,EAAE;qBAC3B,CAAC;iBACH,GACD,EAEF,uBAAC,eAAM,IACL,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,IAAI,EAAE,IAAI,iBACE,sBAAsB,EAClC,KAAK,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,EAAE,IAAI,mBAAmB,EACrD,WAAW,EAAE,WAAW,GACxB,EAEF;gBACE,sEAAsE;gBACtE,uBAAuB,EAAE;oBACvB,MAAM,EAAE,IAAA,sBAAc,EAAC,IAAI,CAAC,OAAO,EAAE;wBACnC,IAAI,EAAE,IAAI,CAAC,IAAI;wBACf,QAAQ,EAAE,IAAI,CAAC,SAAS,IAAI,EAAE;wBAC9B,IAAI,EAAE,KAAK,IAAI,EAAE;wBACjB,WAAW,EAAE,OAAO,IAAI,EAAE;qBAC3B,CAAC;iBACH,GACD,IACa,CAClB,CAAC;AACJ,CAAC,CAAC;AAxEW,QAAA,mBAAmB,uBAwE9B","sourcesContent":["import { Heading } from '@react-email/heading';\nimport { Text } from '@react-email/text';\nimport { EmailContainer } from './EmailContainer';\nimport type { EmailBaseProps } from '../types';\nimport { parseEmailHtml } from './utils';\nimport { Button } from './Button';\n\nexport type ActionEmailData = {\n subject: string;\n shortDescription: string;\n banner?: string;\n header: string;\n bodyOne: string;\n bodyTwo: string;\n href: string;\n buttonText: string;\n};\n\nexport interface ActionEmailTemplateProps extends EmailBaseProps {\n data: ActionEmailData;\n}\n\nexport const ActionEmailTemplate = ({\n data,\n tenant,\n themeColors,\n mode,\n user,\n listing,\n month,\n}: ActionEmailTemplateProps) => {\n return (\n <EmailContainer\n title={data.subject}\n shortDescription={data.shortDescription}\n tenant={tenant}\n mode={mode}\n >\n <Heading\n style={{\n fontSize: 28,\n fontWeight: 600,\n marginBottom: '50px',\n }}\n >\n {data.header?.trim() || `Welcome to ${tenant.name}!`}\n </Heading>\n\n {data.banner?.trim() && (\n <Text\n style={{\n padding: '24px',\n backgroundColor: '#f2f3f3',\n borderRadius: '4px',\n marginBottom: '40px',\n }}\n >\n {data.banner.trim()}\n </Text>\n )}\n\n <div\n // biome-ignore lint/security/noDangerouslySetInnerHtml: <explanation>\n dangerouslySetInnerHTML={{\n __html: parseEmailHtml(data.bodyOne, {\n href: data.href,\n userName: user.firstName || '',\n date: month || '',\n listingName: listing || '',\n }),\n }}\n />\n\n <Button\n href={data.href}\n mode={mode}\n data-testid=\"accept-invite-button\"\n label={data.buttonText?.trim() || 'Accept Invitation'}\n themeColors={themeColors}\n />\n\n <div\n // biome-ignore lint/security/noDangerouslySetInnerHtml: <explanation>\n dangerouslySetInnerHTML={{\n __html: parseEmailHtml(data.bodyTwo, {\n href: data.href,\n userName: user.firstName || '',\n date: month || '',\n listingName: listing || '',\n }),\n }}\n />\n </EmailContainer>\n );\n};\n"]}
@@ -2,7 +2,9 @@ import type { EmailBaseProps } from '../types';
2
2
  type Props = {
3
3
  children: React.ReactNode;
4
4
  title: string;
5
- tenant: Omit<EmailBaseProps['tenant'], 'name'>;
5
+ tenant: Omit<EmailBaseProps['tenant'], 'name'> & {
6
+ name?: string;
7
+ };
6
8
  mode: EmailBaseProps['mode'];
7
9
  shortDescription?: string;
8
10
  };
@@ -31,7 +31,7 @@ const EmailContainer = (props) => {
31
31
  }, fontWeight: 600, fontStyle: "normal" })] }), shortDescription && (0, jsx_runtime_1.jsx)(preview_1.Preview, { children: shortDescription }), (0, jsx_runtime_1.jsx)(body_1.Body, { style: contentWrapperStyle, children: (0, jsx_runtime_1.jsx)(Content, { ...props, children: children }) })] }));
32
32
  };
33
33
  exports.EmailContainer = EmailContainer;
34
- const Content = ({ children, tenant: { logo: tenantLogo }, mode }) => {
34
+ const Content = ({ children, tenant: { logo: tenantLogo, name, showPlatformBranding = true }, mode, }) => {
35
35
  return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [tenantLogo ? ((0, jsx_runtime_1.jsx)("div", { style: {
36
36
  marginBottom: '60px',
37
37
  padding: '5px',
@@ -41,16 +41,16 @@ const Content = ({ children, tenant: { logo: tenantLogo }, mode }) => {
41
41
  display: 'flex',
42
42
  justifyContent: 'center',
43
43
  alignItems: 'center',
44
- }, children: (0, jsx_runtime_1.jsx)(img_1.Img, { src: tenantLogo, alt: 'Logo', width: 70 }) })) : mode === 'send' ? ((0, jsx_runtime_1.jsx)(img_1.Img, { src: 'https://staging.portal.vrplatform.app/logo.png', alt: 'Logo', width: 70, style: { marginBottom: '60px' } })) : ((0, jsx_runtime_1.jsx)("div", { style: {
44
+ }, children: (0, jsx_runtime_1.jsx)(img_1.Img, { src: tenantLogo, alt: 'Logo', width: 70 }) })) : !showPlatformBranding ? ((0, jsx_runtime_1.jsx)(text_1.Text, { children: name })) : mode === 'send' ? ((0, jsx_runtime_1.jsx)(img_1.Img, { src: 'https://staging.portal.vrplatform.app/logo.png', alt: 'Logo', width: 70, style: { marginBottom: '60px' } })) : ((0, jsx_runtime_1.jsx)("div", { style: {
45
45
  width: '60px',
46
- }, children: (0, jsx_runtime_1.jsx)(VrpLogo, {}) })), children, (0, jsx_runtime_1.jsx)(Footer, {})] }));
46
+ }, children: (0, jsx_runtime_1.jsx)(VrpLogo, {}) })), children, showPlatformBranding ? (0, jsx_runtime_1.jsx)(Footer, {}) : (0, jsx_runtime_1.jsx)(text_1.Text, { children: name })] }));
47
47
  };
48
48
  const Footer = () => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(hr_1.Hr, { style: {
49
49
  marginTop: '30px',
50
50
  marginBottom: '50px',
51
51
  } }), (0, jsx_runtime_1.jsxs)(text_1.Text, { style: {
52
52
  color: '#737373',
53
- }, children: ["\u00A9 ", (0, utils_1.day)().year(), " VRPlatform Ventures Ltd. All rights reserved."] }), (0, jsx_runtime_1.jsx)(text_1.Text, { style: {
53
+ }, children: ["\u00A9 ", (0, utils_1.day)().year(), " VR Technologies. All rights reserved."] }), (0, jsx_runtime_1.jsx)(text_1.Text, { style: {
54
54
  color: '#737373',
55
55
  }, children: "VR Technologies, LLC, a company incorporated and registered in the United States of America with company number 20201965158" })] }));
56
56
  const VrpLogo = () => ((0, jsx_runtime_1.jsxs)("svg", { width: "100%", height: "100%", viewBox: "0 0 28 29", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [(0, jsx_runtime_1.jsx)("path", { 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", fill: "#172554" }), (0, jsx_runtime_1.jsx)("path", { 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", fill: "#172554", fillOpacity: "0.8" }), (0, jsx_runtime_1.jsx)("path", { 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", fill: "#172554" })] }));
@@ -1 +1 @@
1
- {"version":3,"file":"EmailContainer.js","sourceRo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AAC,IAAI,EAAE,sDACV,EACP,uBAAC,WAAI,IACH,KAAK,EAAE;gBACL,KAAK,EAAE,SAAS;aACjB,4IAII,IACN,CACJ,CAAC;AAEF,MAAM,OAAO,GAAG,GAAG,EAAE,CAAC,CACpB,iCACE,KAAK,EAAC,MAAM,EACZ,MAAM,EAAC,MAAM,EACb,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EACX,KAAK,EAAC,4BAA4B,aAElC,iCACE,CAAC,EAAC,mNAAmN,EACrN,IAAI,EAAC,SAAS,GACd,EACF,iCACE,CAAC,EAAC,gUAAgU,EAClU,IAAI,EAAC,SAAS,EACd,WAAW,EAAC,KAAK,GACjB,EACF,iCACE,CAAC,EAAC,4WAA4W,EAC9W,IAAI,EAAC,SAAS,GACd,IACE,CACP,CAAC","sourcesContent":["import { Body } from '@react-email/body';\nimport { Font } from '@react-email/font';\nimport { Head } from '@react-email/head';\nimport { Hr } from '@react-email/hr';\nimport { Html } from '@react-email/html';\nimport { Img } from '@react-email/img';\nimport { Preview } from '@react-email/preview';\nimport { Text } from '@react-email/text';\nimport { day } from '@vrplatform/utils';\nimport type { EmailBaseProps } from '../types';\n\ntype Props = {\n children: React.ReactNode;\n title: string;\n tenant: Omit<EmailBaseProps['tenant'], 'name'>;\n mode: EmailBaseProps['mode'];\n shortDescription?: string;\n};\n\nexport const EmailContainer = (props: Props) => {\n const { children, shortDescription, title } = props;\n\n const contentWrapperStyle = {\n paddingInline: '20px',\n paddingBlock: '10px',\n maxWidth: '500px',\n margin: '0 auto',\n };\n\n if (props.mode !== 'send') {\n return (\n <div style={contentWrapperStyle}>\n <Content {...props}>{children}</Content>\n </div>\n );\n }\n\n return (\n <Html lang=\"en\">\n <Head>\n <title>{title}</title>\n <Font\n fontFamily=\"Inter\"\n fallbackFontFamily=\"Verdana\"\n webFont={{\n url: 'https://fonts.gstatic.com/s/inter/v13/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa1ZL7W0Q5nw.woff2',\n format: 'woff2',\n }}\n fontWeight={400}\n fontStyle=\"normal\"\n />\n <Font\n fontFamily=\"Inter\"\n fallbackFontFamily=\"Verdana\"\n webFont={{\n url: 'https://fonts.gstatic.com/s/inter/v13/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa1ZL7W0Q5nw.woff2',\n format: 'woff2',\n }}\n fontWeight={600}\n fontStyle=\"normal\"\n />\n </Head>\n {shortDescription && <Preview>{shortDescription}</Preview>}\n <Body style={contentWrapperStyle}>\n <Content {...props}>{children}</Content>\n </Body>\n </Html>\n );\n};\n\nconst Content = ({ children, tenant: { logo: tenantLogo }, mode }: Props) => {\n return (\n <>\n {tenantLogo ? (\n <div\n style={{\n marginBottom: '60px',\n padding: '5px',\n // border: '1px solid rgb(233,236,239)',\n borderRadius: '5px',\n width: '80px',\n display: 'flex',\n justifyContent: 'center',\n alignItems: 'center',\n }}\n >\n <Img src={tenantLogo} alt={'Logo'} width={70} />\n </div>\n ) : mode === 'send' ? (\n <Img\n src={'https://staging.portal.vrplatform.app/logo.png'}\n alt={'Logo'}\n width={70}\n style={{ marginBottom: '60px' }}\n />\n ) : (\n <div\n style={{\n width: '60px',\n }}\n >\n <VrpLogo />\n </div>\n )}\n\n {children}\n\n <Footer />\n </>\n );\n};\n\nconst Footer = () => (\n <>\n <Hr\n style={{\n marginTop: '30px',\n marginBottom: '50px',\n }}\n />\n\n <Text\n style={{\n color: '#737373',\n }}\n >\n © {day().year()} VRPlatform Ventures Ltd. All rights reserved.\n </Text>\n <Text\n style={{\n color: '#737373',\n }}\n >\n VR Technologies, LLC, a company incorporated and registered in the United\n States of America with company number 20201965158\n </Text>\n </>\n);\n\nconst VrpLogo = () => (\n <svg\n width=\"100%\"\n height=\"100%\"\n viewBox=\"0 0 28 29\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n 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\"\n fill=\"#172554\"\n />\n <path\n 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\"\n fill=\"#172554\"\n fillOpacity=\"0.8\"\n />\n <path\n 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\"\n fill=\"#172554\"\n />\n </svg>\n);\n"]}
1
+ {"version":3,"file":"EmailContainer.js","sourceRoot":"src/","sources":["components/EmailContainer.tsx"],"names":[],"mappings":";;;;AAAA,4CAAyC;AACzC,4CAAyC;AACzC,4CAAyC;AACzC,wCAAqC;AACrC,4CAAyC;AACzC,0CAAuC;AACvC,kDAA+C;AAC/C,4CAAyC;AACzC,6CAAwC;AAWjC,MAAM,cAAc,GAAG,CAAC,KAAY,EAAE,EAAE;IAC7C,MAAM,EAAE,QAAQ,EAAE,gBAAgB,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC;IAEpD,MAAM,mBAAmB,GAAG;QAC1B,aAAa,EAAE,MAAM;QACrB,YAAY,EAAE,MAAM;QACpB,QAAQ,EAAE,OAAO;QACjB,MAAM,EAAE,QAAQ;KACjB,CAAC;IAEF,IAAI,KAAK,CAAC,IAAI,KAAK,MAAM,EAAE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ElC,iCACE,CAAC,EAAC,mNAAmN,EACrN,IAAI,EAAC,SAAS,GACd,EACF,iCACE,CAAC,EAAC,gUAAgU,EAClU,IAAI,EAAC,SAAS,EACd,WAAW,EAAC,KAAK,GACjB,EACF,iCACE,CAAC,EAAC,4WAA4W,EAC9W,IAAI,EAAC,SAAS,GACd,IACE,CACP,CAAC","sourcesContent":["import { Body } from '@react-email/body';\nimport { Font } from '@react-email/font';\nimport { Head } from '@react-email/head';\nimport { Hr } from '@react-email/hr';\nimport { Html } from '@react-email/html';\nimport { Img } from '@react-email/img';\nimport { Preview } from '@react-email/preview';\nimport { Text } from '@react-email/text';\nimport { day } from '@vrplatform/utils';\nimport type { EmailBaseProps } from '../types';\n\ntype Props = {\n children: React.ReactNode;\n title: string;\n tenant: Omit<EmailBaseProps['tenant'], 'name'> & { name?: string };\n mode: EmailBaseProps['mode'];\n shortDescription?: string;\n};\n\nexport const EmailContainer = (props: Props) => {\n const { children, shortDescription, title } = props;\n\n const contentWrapperStyle = {\n paddingInline: '20px',\n paddingBlock: '10px',\n maxWidth: '500px',\n margin: '0 auto',\n };\n\n if (props.mode !== 'send') {\n return (\n <div style={contentWrapperStyle}>\n <Content {...props}>{children}</Content>\n </div>\n );\n }\n\n return (\n <Html lang=\"en\">\n <Head>\n <title>{title}</title>\n <Font\n fontFamily=\"Inter\"\n fallbackFontFamily=\"Verdana\"\n webFont={{\n url: 'https://fonts.gstatic.com/s/inter/v13/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa1ZL7W0Q5nw.woff2',\n format: 'woff2',\n }}\n fontWeight={400}\n fontStyle=\"normal\"\n />\n <Font\n fontFamily=\"Inter\"\n fallbackFontFamily=\"Verdana\"\n webFont={{\n url: 'https://fonts.gstatic.com/s/inter/v13/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa1ZL7W0Q5nw.woff2',\n format: 'woff2',\n }}\n fontWeight={600}\n fontStyle=\"normal\"\n />\n </Head>\n {shortDescription && <Preview>{shortDescription}</Preview>}\n <Body style={contentWrapperStyle}>\n <Content {...props}>{children}</Content>\n </Body>\n </Html>\n );\n};\n\nconst Content = ({\n children,\n tenant: { logo: tenantLogo, name, showPlatformBranding = true },\n mode,\n}: Props) => {\n return (\n <>\n {tenantLogo ? (\n <div\n style={{\n marginBottom: '60px',\n padding: '5px',\n // border: '1px solid rgb(233,236,239)',\n borderRadius: '5px',\n width: '80px',\n display: 'flex',\n justifyContent: 'center',\n alignItems: 'center',\n }}\n >\n <Img src={tenantLogo} alt={'Logo'} width={70} />\n </div>\n ) : !showPlatformBranding ? (\n <Text>{name}</Text>\n ) : mode === 'send' ? (\n <Img\n src={'https://staging.portal.vrplatform.app/logo.png'}\n alt={'Logo'}\n width={70}\n style={{ marginBottom: '60px' }}\n />\n ) : (\n <div\n style={{\n width: '60px',\n }}\n >\n <VrpLogo />\n </div>\n )}\n\n {children}\n\n {showPlatformBranding ? <Footer /> : <Text>{name}</Text>}\n </>\n );\n};\n\nconst Footer = () => (\n <>\n <Hr\n style={{\n marginTop: '30px',\n marginBottom: '50px',\n }}\n />\n\n <Text\n style={{\n color: '#737373',\n }}\n >\n © {day().year()} VR Technologies. All rights reserved.\n </Text>\n <Text\n style={{\n color: '#737373',\n }}\n >\n VR Technologies, LLC, a company incorporated and registered in the United\n States of America with company number 20201965158\n </Text>\n </>\n);\n\nconst VrpLogo = () => (\n <svg\n width=\"100%\"\n height=\"100%\"\n viewBox=\"0 0 28 29\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n 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\"\n fill=\"#172554\"\n />\n <path\n 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\"\n fill=\"#172554\"\n fillOpacity=\"0.8\"\n />\n <path\n 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\"\n fill=\"#172554\"\n />\n </svg>\n);\n"]}
@@ -3,4 +3,6 @@ export declare const getDefaultInviteOwnerEmailData: (mode: "tag" | "text", args
3
3
  appName: string;
4
4
  signInLink: string;
5
5
  }) => ActionEmailData;
6
- export declare const InviteOwnerEmailTemplate: (props: ActionEmailTemplateProps) => import("react").JSX.Element;
6
+ export declare const InviteOwnerEmailTemplate: ({ ownerAccessRole, ...props }: ActionEmailTemplateProps & {
7
+ ownerAccessRole?: "admin" | "viewer";
8
+ }) => import("react").JSX.Element;
@@ -7,18 +7,22 @@ const components_1 = require("../components");
7
7
  const getDefaultInviteOwnerEmailData = (mode, args) => {
8
8
  const signInLink = mode === 'tag' ? extensions_1.EMAIL_ACTION_LINK_COMPONENT : args.signInLink;
9
9
  return {
10
- 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>`,
10
+ bodyOne: `<p>You are invited to access your Owner Portal on ${args.appName}.</p><p>Accept the invitation below to set up your access.</p>`,
11
11
  bodyTwo: `<p>If you have any trouble with the button, you can copy and paste the link below into your browser: ${signInLink}</p>`,
12
12
  buttonText: 'Accept Invitation',
13
- header: 'Welcome to the team!',
14
- shortDescription: 'You have been invited to join the team. To start using VRPlatform, verify your email address at link below.',
13
+ header: 'Welcome to your Owner Portal!',
14
+ shortDescription: 'Set up your Owner Portal access using your invitation.',
15
15
  href: args.signInLink,
16
- subject: `You are invited to join your team on ${args.appName}`,
16
+ subject: `Your invitation to the ${args.appName} Owner Portal`,
17
17
  };
18
18
  };
19
19
  exports.getDefaultInviteOwnerEmailData = getDefaultInviteOwnerEmailData;
20
- const InviteOwnerEmailTemplate = (props) => {
21
- return (0, jsx_runtime_1.jsx)(components_1.ActionEmailTemplate, { ...props });
20
+ const InviteOwnerEmailTemplate = ({ ownerAccessRole = 'admin', ...props }) => {
21
+ return ((0, jsx_runtime_1.jsx)(components_1.ActionEmailTemplate, { ...props, data: {
22
+ ...props.data,
23
+ // Add guidance at render time so saved custom templates receive it too.
24
+ 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 Owner Portal 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 property manager for a new invitation.</p><p>For questions about ${ownerAccessRole === 'viewer' ? 'portal access' : 'your statements or portal access'}, contact your property manager.</p>`,
25
+ } }));
22
26
  };
23
27
  exports.InviteOwnerEmailTemplate = InviteOwnerEmailTemplate;
24
28
  //# sourceMappingURL=InviteOwnerEmailTemplate.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"InviteOwnerEmailTemplate.js","sourceRoot":"src/","sources":["templates/InviteOwnerEmailTemplate.tsx"],"names":[],"mappings":";;;;AAAA,8CAA4D;AAC5D,8CAIuB;AAEhB,MAAM,8BAA8B,GAAG,CAC5C,IAAoB,EACpB,IAGC,EACgB,EAAE;IACnB,MAAM,UAAU,GACd,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,wCAA2B,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC;IAEjE,OAAO;QACL,OAAO,EAAE,oCAAoC,IAAI,CAAC,OAAO,0BAA0B,IAAI,CAAC,OAAO,4DAA4D;QAC3J,OAAO,EAAE,wGAAwG,UAAU,MAAM;QACjI,UAAU,EAAE,mBAAmB;QAC/B,MAAM,EAAE,sBAAsB;QAC9B,gBAAgB,EACd,6GAA6G;QAC/G,IAAI,EAAE,IAAI,CAAC,UAAU;QACrB,OAAO,EAAE,wCAAwC,IAAI,CAAC,OAAO,EAAE;KAChE,CAAC;AACJ,CAAC,CAAC;AApBW,QAAA,8BAA8B,kCAoBzC;AAEK,MAAM,wBAAwB,GAAG,CAAC,KAA+B,EAAE,EAAE;IAC1E,OAAO,uBAAC,gCAAmB,OAAK,KAAK,GAAI,CAAC;AAC5C,CAAC,CAAC;AAFW,QAAA,wBAAwB,4BAEnC","sourcesContent":["import { EMAIL_ACTION_LINK_COMPONENT } from '../extensions';\nimport {\n type ActionEmailData,\n ActionEmailTemplate,\n type ActionEmailTemplateProps,\n} from '../components';\n\nexport const getDefaultInviteOwnerEmailData = (\n mode: 'tag' | 'text',\n args: {\n appName: string;\n signInLink: string;\n }\n): ActionEmailData => {\n const signInLink =\n mode === 'tag' ? EMAIL_ACTION_LINK_COMPONENT : args.signInLink;\n\n return {\n 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>`,\n bodyTwo: `<p>If you have any trouble with the button, you can copy and paste the link below into your browser: ${signInLink}</p>`,\n buttonText: 'Accept Invitation',\n header: 'Welcome to the team!',\n shortDescription:\n 'You have been invited to join the team. To start using VRPlatform, verify your email address at link below.',\n href: args.signInLink,\n subject: `You are invited to join your team on ${args.appName}`,\n };\n};\n\nexport const InviteOwnerEmailTemplate = (props: ActionEmailTemplateProps) => {\n return <ActionEmailTemplate {...props} />;\n};\n"]}
1
+ {"version":3,"file":"InviteOwnerEmailTemplate.js","sourceRoot":"src/","sources":["templates/InviteOwnerEmailTemplate.tsx"],"names":[],"mappings":";;;;AAAA,8CAA4D;AAC5D,8CAIuB;AAEhB,MAAM,8BAA8B,GAAG,CAC5C,IAAoB,EACpB,IAGC,EACgB,EAAE;IACnB,MAAM,UAAU,GACd,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,wCAA2B,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC;IAEjE,OAAO;QACL,OAAO,EAAE,qDAAqD,IAAI,CAAC,OAAO,gEAAgE;QAC1I,OAAO,EAAE,wGAAwG,UAAU,MAAM;QACjI,UAAU,EAAE,mBAAmB;QAC/B,MAAM,EAAE,+BAA+B;QACvC,gBAAgB,EAAE,wDAAwD;QAC1E,IAAI,EAAE,IAAI,CAAC,UAAU;QACrB,OAAO,EAAE,0BAA0B,IAAI,CAAC,OAAO,eAAe;KAC/D,CAAC;AACJ,CAAC,CAAC;AAnBW,QAAA,8BAA8B,kCAmBzC;AAEK,MAAM,wBAAwB,GAAG,CAAC,EACvC,eAAe,GAAG,OAAO,EACzB,GAAG,KAAK,EAGT,EAAE,EAAE;IACH,OAAO,CACL,uBAAC,gCAAmB,OACd,KAAK,EACT,IAAI,EAAE;YACJ,GAAG,KAAK,CAAC,IAAI;YACb,wEAAwE;YACxE,OAAO,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC,OAAO,mYAAmY,eAAe,KAAK,QAAQ,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,kCAAkC,sCAAsC;SAC3hB,GACD,CACH,CAAC;AACJ,CAAC,CAAC;AAhBW,QAAA,wBAAwB,4BAgBnC","sourcesContent":["import { EMAIL_ACTION_LINK_COMPONENT } from '../extensions';\nimport {\n type ActionEmailData,\n ActionEmailTemplate,\n type ActionEmailTemplateProps,\n} from '../components';\n\nexport const getDefaultInviteOwnerEmailData = (\n mode: 'tag' | 'text',\n args: {\n appName: string;\n signInLink: string;\n }\n): ActionEmailData => {\n const signInLink =\n mode === 'tag' ? EMAIL_ACTION_LINK_COMPONENT : args.signInLink;\n\n return {\n bodyOne: `<p>You are invited to access your Owner Portal on ${args.appName}.</p><p>Accept the invitation below to set up your access.</p>`,\n bodyTwo: `<p>If you have any trouble with the button, you can copy and paste the link below into your browser: ${signInLink}</p>`,\n buttonText: 'Accept Invitation',\n header: 'Welcome to your Owner Portal!',\n shortDescription: 'Set up your Owner Portal access using your invitation.',\n href: args.signInLink,\n subject: `Your invitation to the ${args.appName} Owner Portal`,\n };\n};\n\nexport const InviteOwnerEmailTemplate = ({\n ownerAccessRole = 'admin',\n ...props\n}: ActionEmailTemplateProps & {\n ownerAccessRole?: 'admin' | 'viewer';\n}) => {\n return (\n <ActionEmailTemplate\n {...props}\n data={{\n ...props.data,\n // Add guidance at render time so saved custom templates receive it too.\n 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 Owner Portal 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 property manager for a new invitation.</p><p>For questions about ${ownerAccessRole === 'viewer' ? 'portal access' : 'your statements or portal access'}, contact your property manager.</p>`,\n }}\n />\n );\n};\n"]}
@@ -9,18 +9,22 @@ const getDefaultInvitePropertyManagerEmailData = (mode, args) => {
9
9
  ? extensions_1.EMAIL_ACTION_LINK_COMPONENT
10
10
  : `<a href='${args.signInLink}' target='_blank'>${args.signInLink}</a>`;
11
11
  return {
12
- 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>`,
12
+ bodyOne: `<p>You are invited to join us on ${args.appName}.</p><p>Accept the invitation below to set up your team access.</p>`,
13
13
  bodyTwo: `<p>If you have any trouble with the button, you can use the following link below: ${signInLink}</p>`,
14
14
  buttonText: 'Accept Invitation',
15
15
  header: 'Welcome to the team!',
16
- shortDescription: 'You have been invited to join the team. To start using VRPlatform, verify your email address at link below.',
16
+ shortDescription: `Accept your invitation to join your team on ${args.appName}.`,
17
17
  href: args.signInLink,
18
18
  subject: `You are invited to join your team on ${args.appName}`,
19
19
  };
20
20
  };
21
21
  exports.getDefaultInvitePropertyManagerEmailData = getDefaultInvitePropertyManagerEmailData;
22
22
  const InvitePmEmailTemplate = (props) => {
23
- return ((0, jsx_runtime_1.jsx)(components_1.ActionEmailTemplate, { ...props, tenant: {
23
+ return ((0, jsx_runtime_1.jsx)(components_1.ActionEmailTemplate, { ...props, data: {
24
+ ...props.data,
25
+ // Add guidance at render time so saved custom templates receive it too.
26
+ 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>`,
27
+ }, tenant: {
24
28
  logo: undefined,
25
29
  name: props.tenant.name,
26
30
  } }));
@@ -1 +1 @@
1
- {"version":3,"file":"InvitePmEmailTemplate.js","sourceRoot":"src/","sources":["templates/InvitePmEmailTemplate.tsx"],"names":[],"mappings":";;;;AAAA,8CAA4D;AAC5D,8CAIuB;AAEhB,MAAM,wCAAwC,GAAG,CACtD,IAAoB,EACpB,IAGC,EACgB,EAAE;IACnB,MAAM,UAAU,GACd,IAAI,KAAK,KAAK;QACZ,CAAC,CAAC,wCAA2B;QAC7B,CAAC,CAAC,YAAY,IAAI,CAAC,UAAU,qBAAqB,IAAI,CAAC,UAAU,MAAM,CAAC;IAE5E,OAAO;QACL,OAAO,EAAE,oCAAoC,IAAI,CAAC,OAAO,0BAA0B,IAAI,CAAC,OAAO,4DAA4D;QAC3J,OAAO,EAAE,qFAAqF,UAAU,MAAM;QAC9G,UAAU,EAAE,mBAAmB;QAC/B,MAAM,EAAE,sBAAsB;QAC9B,gBAAgB,EACd,6GAA6G;QAC/G,IAAI,EAAE,IAAI,CAAC,UAAU;QACrB,OAAO,EAAE,wCAAwC,IAAI,CAAC,OAAO,EAAE;KAChE,CAAC;AACJ,CAAC,CAAC;AAtBW,QAAA,wCAAwC,4CAsBnD;AAEK,MAAM,qBAAqB,GAAG,CAAC,KAA+B,EAAE,EAAE;IACvE,OAAO,CACL,uBAAC,gCAAmB,OACd,KAAK,EACT,MAAM,EAAE;YACN,IAAI,EAAE,SAAS;YACf,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,IAAI;SACxB,GACD,CACH,CAAC;AACJ,CAAC,CAAC;AAVW,QAAA,qBAAqB,yBAUhC","sourcesContent":["import { EMAIL_ACTION_LINK_COMPONENT } from '../extensions';\nimport {\n type ActionEmailData,\n ActionEmailTemplate,\n type ActionEmailTemplateProps,\n} from '../components';\n\nexport const getDefaultInvitePropertyManagerEmailData = (\n mode: 'tag' | 'text',\n args: {\n appName: string;\n signInLink: string;\n }\n): ActionEmailData => {\n const signInLink =\n mode === 'tag'\n ? EMAIL_ACTION_LINK_COMPONENT\n : `<a href='${args.signInLink}' target='_blank'>${args.signInLink}</a>`;\n\n return {\n 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>`,\n bodyTwo: `<p>If you have any trouble with the button, you can use the following link below: ${signInLink}</p>`,\n buttonText: 'Accept Invitation',\n header: 'Welcome to the team!',\n shortDescription:\n 'You have been invited to join the team. To start using VRPlatform, verify your email address at link below.',\n href: args.signInLink,\n subject: `You are invited to join your team on ${args.appName}`,\n };\n};\n\nexport const InvitePmEmailTemplate = (props: ActionEmailTemplateProps) => {\n return (\n <ActionEmailTemplate\n {...props}\n tenant={{\n logo: undefined,\n name: props.tenant.name,\n }}\n />\n );\n};\n"]}
1
+ {"version":3,"file":"InvitePmEmailTemplate.js","sourceRoot":"src/","sources":["templates/InvitePmEmailTemplate.tsx"],"names":[],"mappings":";;;;AAAA,8CAA4D;AAC5D,8CAIuB;AAEhB,MAAM,wCAAwC,GAAG,CACtD,IAAoB,EACpB,IAGC,EACgB,EAAE;IACnB,MAAM,UAAU,GACd,IAAI,KAAK,KAAK;QACZ,CAAC,CAAC,wCAA2B;QAC7B,CAAC,CAAC,YAAY,IAAI,CAAC,UAAU,qBAAqB,IAAI,CAAC,UAAU,MAAM,CAAC;IAE5E,OAAO;QACL,OAAO,EAAE,oCAAoC,IAAI,CAAC,OAAO,qEAAqE;QAC9H,OAAO,EAAE,qFAAqF,UAAU,MAAM;QAC9G,UAAU,EAAE,mBAAmB;QAC/B,MAAM,EAAE,sBAAsB;QAC9B,gBAAgB,EAAE,+CAA+C,IAAI,CAAC,OAAO,GAAG;QAChF,IAAI,EAAE,IAAI,CAAC,UAAU;QACrB,OAAO,EAAE,wCAAwC,IAAI,CAAC,OAAO,EAAE;KAChE,CAAC;AACJ,CAAC,CAAC;AArBW,QAAA,wCAAwC,4CAqBnD;AAEK,MAAM,qBAAqB,GAAG,CAAC,KAA+B,EAAE,EAAE;IACvE,OAAO,CACL,uBAAC,gCAAmB,OACd,KAAK,EACT,IAAI,EAAE;YACJ,GAAG,KAAK,CAAC,IAAI;YACb,wEAAwE;YACxE,OAAO,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC,OAAO,6aAA6a;SAC5c,EACD,MAAM,EAAE;YACN,IAAI,EAAE,SAAS;YACf,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,IAAI;SACxB,GACD,CACH,CAAC;AACJ,CAAC,CAAC;AAfW,QAAA,qBAAqB,yBAehC","sourcesContent":["import { EMAIL_ACTION_LINK_COMPONENT } from '../extensions';\nimport {\n type ActionEmailData,\n ActionEmailTemplate,\n type ActionEmailTemplateProps,\n} from '../components';\n\nexport const getDefaultInvitePropertyManagerEmailData = (\n mode: 'tag' | 'text',\n args: {\n appName: string;\n signInLink: string;\n }\n): ActionEmailData => {\n const signInLink =\n mode === 'tag'\n ? EMAIL_ACTION_LINK_COMPONENT\n : `<a href='${args.signInLink}' target='_blank'>${args.signInLink}</a>`;\n\n return {\n bodyOne: `<p>You are invited to join us on ${args.appName}.</p><p>Accept the invitation below to set up your team access.</p>`,\n bodyTwo: `<p>If you have any trouble with the button, you can use the following link below: ${signInLink}</p>`,\n buttonText: 'Accept Invitation',\n header: 'Welcome to the team!',\n shortDescription: `Accept your invitation to join your team on ${args.appName}.`,\n href: args.signInLink,\n subject: `You are invited to join your team on ${args.appName}`,\n };\n};\n\nexport const InvitePmEmailTemplate = (props: ActionEmailTemplateProps) => {\n return (\n <ActionEmailTemplate\n {...props}\n data={{\n ...props.data,\n // Add guidance at render time so saved custom templates receive it too.\n 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>`,\n }}\n tenant={{\n logo: undefined,\n name: props.tenant.name,\n }}\n />\n );\n};\n"]}
@@ -2,6 +2,7 @@ export type EmailBaseProps = {
2
2
  mode: 'edit' | 'preview' | 'send';
3
3
  tenant: {
4
4
  name: string;
5
+ showPlatformBranding?: boolean;
5
6
  logo: string | undefined | null;
6
7
  };
7
8
  listing: string | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"src/","sources":["types.ts"],"names":[],"mappings":"","sourcesContent":["export type EmailBaseProps = {\n mode: 'edit' | 'preview' | 'send';\n tenant: {\n name: string;\n logo: string | undefined | null;\n };\n listing: string | undefined;\n month: string | undefined;\n user: {\n firstName: string | undefined;\n };\n themeColors: readonly [\n string,\n string,\n string,\n string,\n string,\n string,\n string,\n string,\n string,\n string,\n ...string[],\n ];\n};\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"src/","sources":["types.ts"],"names":[],"mappings":"","sourcesContent":["export type EmailBaseProps = {\n mode: 'edit' | 'preview' | 'send';\n tenant: {\n name: string;\n showPlatformBranding?: boolean;\n logo: string | undefined | null;\n };\n listing: string | undefined;\n month: string | undefined;\n user: {\n firstName: string | undefined;\n };\n themeColors: readonly [\n string,\n string,\n string,\n string,\n string,\n string,\n string,\n string,\n string,\n string,\n ...string[],\n ];\n};\n"]}
@@ -0,0 +1,8 @@
1
+ export declare function findPostmarkEmail(deliveryId: string, options: {
2
+ fetch?: (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
3
+ postmarkToken?: string;
4
+ }): Promise<{
5
+ httpStatus: number;
6
+ messageId: string;
7
+ submittedAt: string;
8
+ } | undefined>;
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.findPostmarkEmail = findPostmarkEmail;
4
+ const utils_1 = require("@vrplatform/utils");
5
+ const zod_1 = require("zod");
6
+ const send_email_1 = require("./send-email");
7
+ const postmarkMessagesResponseSchema = zod_1.z.object({
8
+ TotalCount: zod_1.z.number().int().nonnegative(),
9
+ Messages: zod_1.z.array(zod_1.z.object({
10
+ MessageID: zod_1.z.string().min(1),
11
+ ReceivedAt: zod_1.z.string().refine((value) => (0, utils_1.day)(value).isValid()),
12
+ Metadata: zod_1.z.object({ deliveryId: zod_1.z.string() }).passthrough(),
13
+ })),
14
+ });
15
+ async function findPostmarkEmail(deliveryId, options) {
16
+ if (!options.postmarkToken) {
17
+ throw new send_email_1.EmailDeliveryError('Postmark is not configured', undefined, false, false);
18
+ }
19
+ const url = new URL('https://api.postmarkapp.com/messages/outbound');
20
+ url.searchParams.set('count', '1');
21
+ url.searchParams.set('offset', '0');
22
+ url.searchParams.set('messagestream', 'outbound');
23
+ url.searchParams.set('metadata_deliveryId', deliveryId);
24
+ const response = await (options.fetch ?? fetch)(url, {
25
+ method: 'GET',
26
+ headers: {
27
+ Accept: 'application/json',
28
+ 'X-Postmark-Server-Token': options.postmarkToken,
29
+ },
30
+ });
31
+ const providerResponse = await response.json().catch(() => ({}));
32
+ if (!response.ok) {
33
+ throw new send_email_1.EmailDeliveryError('Postmark message lookup failed', {
34
+ provider: 'postmark',
35
+ providerCategory: 'rejected',
36
+ httpStatus: response.status,
37
+ }, false, response.status === 429 || response.status >= 500);
38
+ }
39
+ const result = postmarkMessagesResponseSchema.safeParse(providerResponse);
40
+ if (!result.success) {
41
+ throw new send_email_1.EmailDeliveryError('Postmark returned an invalid response');
42
+ }
43
+ if (result.data.TotalCount === 0)
44
+ return undefined;
45
+ const message = result.data.Messages.find(({ Metadata }) => Metadata.deliveryId === deliveryId);
46
+ if (!message) {
47
+ throw new send_email_1.EmailDeliveryError('Postmark returned an invalid response');
48
+ }
49
+ return {
50
+ httpStatus: response.status,
51
+ messageId: message.MessageID,
52
+ submittedAt: message.ReceivedAt,
53
+ };
54
+ }
55
+ //# sourceMappingURL=find-postmark-email.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"find-postmark-email.js","sourceRoot":"src/","sources":["utils/find-postmark-email.ts"],"names":[],"mappings":";;AAeA,8CAgEC;AA/ED,6CAAwC;AACxC,6BAAwB;AACxB,6CAAkD;AAElD,MAAM,8BAA8B,GAAG,OAAC,CAAC,MAAM,CAAC;IAC9C,UAAU,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE;IAC1C,QAAQ,EAAE,OAAC,CAAC,KAAK,CACf,OAAC,CAAC,MAAM,CAAC;QACP,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;QAC5B,UAAU,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,IAAA,WAAG,EAAC,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC;QAC9D,QAAQ,EAAE,OAAC,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,OAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,WAAW,EAAE;KAC7D,CAAC,CACH;CACF,CAAC,CAAC;AAEI,KAAK,UAAU,iBAAiB,CACrC,UAAkB,EAClB,OAMC;IAED,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC;QAC3B,MAAM,IAAI,+BAAkB,CAC1B,4BAA4B,EAC5B,SAAS,EACT,KAAK,EACL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AAC,IAAI,CAAC,UAAU,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IAEnD,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CACvC,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,QAAQ,CAAC,UAAU,KAAK,UAAU,CACrD,CAAC;IACF,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,+BAAkB,CAAC,uCAAuC,CAAC,CAAC;IACxE,CAAC;IAED,OAAO;QACL,UAAU,EAAE,QAAQ,CAAC,MAAM;QAC3B,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,WAAW,EAAE,OAAO,CAAC,UAAU;KAChC,CAAC;AACJ,CAAC","sourcesContent":["import { day } from '@vrplatform/utils';\nimport { z } from 'zod';\nimport { EmailDeliveryError } from './send-email';\n\nconst postmarkMessagesResponseSchema = z.object({\n TotalCount: z.number().int().nonnegative(),\n Messages: z.array(\n z.object({\n MessageID: z.string().min(1),\n ReceivedAt: z.string().refine((value) => day(value).isValid()),\n Metadata: z.object({ deliveryId: z.string() }).passthrough(),\n })\n ),\n});\n\nexport async function findPostmarkEmail(\n deliveryId: string,\n options: {\n fetch?: (\n input: string | URL | Request,\n init?: RequestInit\n ) => Promise<Response>;\n postmarkToken?: string;\n }\n) {\n if (!options.postmarkToken) {\n throw new EmailDeliveryError(\n 'Postmark is not configured',\n undefined,\n false,\n false\n );\n }\n\n const url = new URL('https://api.postmarkapp.com/messages/outbound');\n url.searchParams.set('count', '1');\n url.searchParams.set('offset', '0');\n url.searchParams.set('messagestream', 'outbound');\n url.searchParams.set('metadata_deliveryId', deliveryId);\n const response = await (options.fetch ?? fetch)(url, {\n method: 'GET',\n headers: {\n Accept: 'application/json',\n 'X-Postmark-Server-Token': options.postmarkToken,\n },\n });\n const providerResponse: unknown = await response.json().catch(() => ({}));\n\n if (!response.ok) {\n throw new EmailDeliveryError(\n 'Postmark message lookup failed',\n {\n provider: 'postmark',\n providerCategory: 'rejected',\n httpStatus: response.status,\n },\n false,\n response.status === 429 || response.status >= 500\n );\n }\n\n const result = postmarkMessagesResponseSchema.safeParse(providerResponse);\n if (!result.success) {\n throw new EmailDeliveryError('Postmark returned an invalid response');\n }\n if (result.data.TotalCount === 0) return undefined;\n\n const message = result.data.Messages.find(\n ({ Metadata }) => Metadata.deliveryId === deliveryId\n );\n if (!message) {\n throw new EmailDeliveryError('Postmark returned an invalid response');\n }\n\n return {\n httpStatus: response.status,\n messageId: message.MessageID,\n submittedAt: message.ReceivedAt,\n };\n}\n"]}
@@ -1 +1,2 @@
1
+ export * from './find-postmark-email';
1
2
  export * from './send-email';
@@ -14,5 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./find-postmark-email"), exports);
17
18
  __exportStar(require("./send-email"), exports);
18
19
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"src/","sources":["utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B","sourcesContent":["export * from './send-email';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"src/","sources":["utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wDAAsC;AACtC,+CAA6B","sourcesContent":["export * from './find-postmark-email';\nexport * from './send-email';\n"]}
@@ -1,17 +1,41 @@
1
+ type EmailDeliveryFailureDetails = {
2
+ httpStatus: number;
3
+ postmarkErrorCode?: number;
4
+ provider: 'postmark';
5
+ providerCategory: 'inactiveRecipient' | 'rejected';
6
+ };
7
+ type EmailDeliveryErrorDetails = EmailDeliveryFailureDetails | {
8
+ failureCount: number;
9
+ failures: EmailDeliveryFailureDetails[];
10
+ };
1
11
  export declare class EmailDeliveryError extends Error {
2
- readonly details?: Record<string, unknown> | undefined;
12
+ readonly details?: EmailDeliveryErrorDetails | undefined;
3
13
  readonly expected: boolean;
4
- constructor(message: string, details?: Record<string, unknown> | undefined, expected?: boolean);
14
+ readonly retryable: boolean;
15
+ constructor(message: string, details?: EmailDeliveryErrorDetails | undefined, expected?: boolean, retryable?: boolean);
5
16
  }
17
+ /**
18
+ * Formats a verified sender address with a display name for the From header.
19
+ * Registrations store bare addresses; recipients should still see the company
20
+ * name the way they see `VRPlatform <notifications@vrplatform.app>`.
21
+ */
22
+ export declare function formatSenderIdentity(name: string | null | undefined, address: string): string;
6
23
  export declare function sendEmail(data: {
7
24
  to: string;
8
25
  subject: string;
9
26
  text: string;
10
27
  html: string;
11
28
  replyTo?: string;
29
+ tag?: string;
30
+ metadata?: Record<string, string>;
31
+ from?: string;
12
32
  }, options: {
13
33
  fetch?: (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
14
34
  postmarkToken?: string;
15
35
  }): Promise<{
16
- status: number;
36
+ httpStatus: number;
37
+ messageId: string;
38
+ submittedAt: string;
17
39
  }>;
40
+ export declare function settleEmailDeliveries(deliveries: Promise<unknown>[]): Promise<void>;
41
+ export {};
@@ -1,19 +1,52 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.EmailDeliveryError = void 0;
4
+ exports.formatSenderIdentity = formatSenderIdentity;
4
5
  exports.sendEmail = sendEmail;
6
+ exports.settleEmailDeliveries = settleEmailDeliveries;
7
+ const utils_1 = require("@vrplatform/utils");
8
+ const zod_1 = require("zod");
9
+ const postmarkErrorCodeSchema = zod_1.z.number().int().nonnegative();
10
+ const postmarkResponseErrorCodeSchema = zod_1.z
11
+ .object({ ErrorCode: postmarkErrorCodeSchema })
12
+ .transform(({ ErrorCode }) => ErrorCode);
13
+ const postmarkHeaderErrorCodeSchema = zod_1.z
14
+ .string()
15
+ .regex(/^\d+$/)
16
+ .transform(Number)
17
+ .pipe(postmarkErrorCodeSchema);
18
+ const postmarkSuccessResponseSchema = zod_1.z.object({
19
+ ErrorCode: zod_1.z.literal(0),
20
+ MessageID: zod_1.z.string().min(1),
21
+ SubmittedAt: zod_1.z.string().refine((value) => (0, utils_1.day)(value).isValid()),
22
+ });
23
+ function parseOptional(schema, value) {
24
+ const result = schema.safeParse(value);
25
+ if (result.success)
26
+ return result.data;
27
+ }
5
28
  class EmailDeliveryError extends Error {
6
- constructor(message, details, expected = false) {
29
+ constructor(message, details, expected = false, retryable = true) {
7
30
  super(message);
8
31
  this.details = details;
9
32
  this.expected = expected;
33
+ this.retryable = retryable;
10
34
  this.name = 'EmailDeliveryError';
11
35
  }
12
36
  }
13
37
  exports.EmailDeliveryError = EmailDeliveryError;
38
+ /**
39
+ * Formats a verified sender address with a display name for the From header.
40
+ * Registrations store bare addresses; recipients should still see the company
41
+ * name the way they see `VRPlatform <notifications@vrplatform.app>`.
42
+ */
43
+ function formatSenderIdentity(name, address) {
44
+ const display = (name ?? '').replace(/[\r\n"<>]/g, '').trim();
45
+ return display ? `"${display}" <${address}>` : address;
46
+ }
14
47
  async function sendEmail(data, options) {
15
48
  if (!options.postmarkToken) {
16
- throw new EmailDeliveryError('Postmark is not configured');
49
+ throw new EmailDeliveryError('Postmark is not configured', undefined, false, false);
17
50
  }
18
51
  const response = await (options.fetch ?? fetch)('https://api.postmarkapp.com/email', {
19
52
  method: 'POST',
@@ -23,37 +56,85 @@ async function sendEmail(data, options) {
23
56
  'X-Postmark-Server-Token': options.postmarkToken,
24
57
  },
25
58
  body: JSON.stringify({
26
- From: 'VRPlatform <notifications@vrplatform.app>',
59
+ From: data.from ?? 'VRPlatform <notifications@vrplatform.app>',
27
60
  To: data.to,
28
61
  Subject: data.subject,
29
62
  ReplyTo: data.replyTo,
30
63
  TextBody: data.text,
31
64
  HtmlBody: data.html,
32
65
  MessageStream: 'outbound',
66
+ Tag: data.tag,
67
+ Metadata: data.metadata,
33
68
  }),
34
69
  });
35
70
  const providerResponse = await response.json().catch(() => ({}));
36
- const providerMessage = providerResponse !== null &&
37
- typeof providerResponse === 'object' &&
38
- 'Message' in providerResponse &&
39
- typeof providerResponse.Message === 'string'
40
- ? providerResponse.Message
41
- : undefined;
42
- if (!response.ok) {
43
- if (response.status === 422 &&
44
- providerMessage?.includes('marked as inactive')) {
45
- throw new EmailDeliveryError('Postmark recipient is inactive', {
46
- providerMessage,
47
- status: response.status,
48
- statusText: response.statusText,
49
- }, true);
71
+ const postmarkErrorCode = parseOptional(postmarkResponseErrorCodeSchema, providerResponse) ??
72
+ parseOptional(postmarkHeaderErrorCodeSchema, response.headers.get('X-PM-ApiErrorCode'));
73
+ if (!response.ok ||
74
+ (postmarkErrorCode !== undefined && postmarkErrorCode !== 0)) {
75
+ const inactiveRecipient = response.status === 422 && postmarkErrorCode === 406;
76
+ const details = {
77
+ provider: 'postmark',
78
+ providerCategory: inactiveRecipient ? 'inactiveRecipient' : 'rejected',
79
+ httpStatus: response.status,
80
+ ...(postmarkErrorCode !== undefined ? { postmarkErrorCode } : {}),
81
+ };
82
+ if (inactiveRecipient) {
83
+ throw new EmailDeliveryError('Postmark recipient is inactive', details, true, false);
50
84
  }
51
- throw new EmailDeliveryError('Postmark rejected the email', {
52
- providerResponse,
53
- status: response.status,
54
- statusText: response.statusText,
85
+ throw new EmailDeliveryError('Postmark rejected the email', details, false, response.status === 429 || response.status >= 500);
86
+ }
87
+ const result = postmarkSuccessResponseSchema.safeParse(providerResponse);
88
+ if (!result.success) {
89
+ throw new EmailDeliveryError('Postmark returned an invalid response', {
90
+ provider: 'postmark',
91
+ providerCategory: 'rejected',
92
+ httpStatus: response.status,
93
+ ...(postmarkErrorCode !== undefined ? { postmarkErrorCode } : {}),
55
94
  });
56
95
  }
57
- return { status: response.status };
96
+ return {
97
+ httpStatus: response.status,
98
+ messageId: result.data.MessageID,
99
+ submittedAt: result.data.SubmittedAt,
100
+ };
101
+ }
102
+ async function settleEmailDeliveries(deliveries) {
103
+ const failures = (await Promise.allSettled(deliveries)).filter((result) => result.status === 'rejected');
104
+ if (failures.length === 0)
105
+ return;
106
+ const unexpectedDeliveryError = failures.find((failure) => failure.reason instanceof EmailDeliveryError && !failure.reason.expected)?.reason;
107
+ const allExpected = failures.every((failure) => failure.reason instanceof EmailDeliveryError && failure.reason.expected);
108
+ const firstDeliveryError = failures.find((failure) => failure.reason instanceof EmailDeliveryError)?.reason;
109
+ const failureDetails = failures.flatMap((failure) => {
110
+ if (!(failure.reason instanceof EmailDeliveryError) ||
111
+ !failure.reason.details ||
112
+ !('provider' in failure.reason.details)) {
113
+ return [];
114
+ }
115
+ const { httpStatus, postmarkErrorCode, provider, providerCategory } = failure.reason.details;
116
+ return [
117
+ {
118
+ httpStatus,
119
+ provider,
120
+ providerCategory,
121
+ ...(postmarkErrorCode !== undefined ? { postmarkErrorCode } : {}),
122
+ },
123
+ ];
124
+ });
125
+ const details = {
126
+ failureCount: failures.length,
127
+ failures: failureDetails,
128
+ };
129
+ if (unexpectedDeliveryError instanceof EmailDeliveryError) {
130
+ if (unexpectedDeliveryError.message === 'Postmark is not configured') {
131
+ throw new EmailDeliveryError('Postmark is not configured', details, false, false);
132
+ }
133
+ throw new EmailDeliveryError('Postmark rejected the email', details, false, unexpectedDeliveryError.retryable);
134
+ }
135
+ if (allExpected && firstDeliveryError instanceof EmailDeliveryError) {
136
+ throw new EmailDeliveryError('Postmark recipient is inactive', details, true, false);
137
+ }
138
+ throw new EmailDeliveryError('Email delivery failed', details);
58
139
  }
59
140
  //# sourceMappingURL=send-email.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"send-email.js","sourceRoot":"src/","sources":["utils/send-email.ts"],"names":[],"mappings":";;;AAWA,8BA0EC;AArFD,MAAa,kBAAmB,SAAQ,KAAK;IAC3C,YACE,OAAe,EACC,OAAiC,EACjC,WAAW,KAAK;QAEhC,KAAK,CAAC,OAAO,CAAC,CAAC;QAHC,YAAO,GAAP,OAAO,CAA0B;QACjC,aAAQ,GAAR,QAAQ,CAAQ;QAGhC,IAAI,CAAC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AAC,EAC/C,CAAC;YACD,MAAM,IAAI,kBAAkB,CAC1B,gCAAgC,EAChC;gBACE,eAAe;gBACf,MAAM,EAAE,QAAQ,CAAC,MAAM;gBACvB,UAAU,EAAE,QAAQ,CAAC,UAAU;aAChC,EACD,IAAI,CACL,CAAC;QACJ,CAAC;QAED,MAAM,IAAI,kBAAkB,CAAC,6BAA6B,EAAE;YAC1D,gBAAgB;YAChB,MAAM,EAAE,QAAQ,CAAC,MAAM;YACvB,UAAU,EAAE,QAAQ,CAAC,UAAU;SAChC,CAAC,CAAC;IACL,CAAC;IAED,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;AACrC,CAAC","sourcesContent":["export class EmailDeliveryError extends Error {\n constructor(\n message: string,\n public readonly details?: Record<string, unknown>,\n public readonly expected = false\n ) {\n super(message);\n this.name = 'EmailDeliveryError';\n }\n}\n\nexport async function sendEmail(\n data: {\n to: string;\n subject: string;\n text: string;\n html: string;\n replyTo?: string;\n },\n options: {\n fetch?: (\n input: string | URL | Request,\n init?: RequestInit\n ) => Promise<Response>;\n postmarkToken?: string;\n }\n) {\n if (!options.postmarkToken) {\n throw new EmailDeliveryError('Postmark is not configured');\n }\n\n const response = await (options.fetch ?? fetch)(\n 'https://api.postmarkapp.com/email',\n {\n method: 'POST',\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n 'X-Postmark-Server-Token': options.postmarkToken,\n },\n body: JSON.stringify({\n From: 'VRPlatform <notifications@vrplatform.app>',\n To: data.to,\n Subject: data.subject,\n ReplyTo: data.replyTo,\n TextBody: data.text,\n HtmlBody: data.html,\n MessageStream: 'outbound',\n }),\n }\n );\n\n const providerResponse: unknown = await response.json().catch(() => ({}));\n const providerMessage =\n providerResponse !== null &&\n typeof providerResponse === 'object' &&\n 'Message' in providerResponse &&\n typeof providerResponse.Message === 'string'\n ? providerResponse.Message\n : undefined;\n\n if (!response.ok) {\n if (\n response.status === 422 &&\n providerMessage?.includes('marked as inactive')\n ) {\n throw new EmailDeliveryError(\n 'Postmark recipient is inactive',\n {\n providerMessage,\n status: response.status,\n statusText: response.statusText,\n },\n true\n );\n }\n\n throw new EmailDeliveryError('Postmark rejected the email', {\n providerResponse,\n status: response.status,\n statusText: response.statusText,\n });\n }\n\n return { status: response.status };\n}\n"]}
1
+ {"version":3,"file":"send-email.js","sourceRoot":"src/","sources":["utils/send-email.ts"],"names":[],"mappings":";;;AAsDA,oDAMC;AAED,8BAwGC;AAED,sDAkEC;AA1OD,6CAAwC;AACxC,6BAAwB;AAExB,MAAM,uBAAuB,GAAG,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC;AAC/D,MAAM,+BAA+B,GAAG,OAAC;KACtC,MAAM,CAAC,EAAE,SAAS,EAAE,uBAAuB,EAAE,CAAC;KAC9C,SAAS,CAAC,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,SAAS,CAAC,CAAC;AAC3C,MAAM,6BAA6B,GAAG,OAAC;KACpC,MAAM,EAAE;KACR,KAAK,CAAC,OAAO,CAAC;KACd,SAAS,CAAC,MAAM,CAAC;KACjB,IAAI,CAAC,uBAAuB,CAAC,CAAC;AACjC,MAAM,6BAA6B,GAAG,OAAC,CAAC,MAAM,CAAC;IAC7C,SAAS,EAAE,OAAC,CAAC,OAAO,CAAC,CAAC,CAAC;IACvB,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC5B,WAAW,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,IAAA,WAAG,EAAC,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC;CAChE,CAAC,CAAC;AAEH,SAAS,aAAa,CAAI,MAAoB,EAAE,KAAc;IAC5D,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IACvC,IAAI,MAAM,CAAC,OAAO;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AAkB,EAAE,CAAC;QACpE,MAAM,IAAI,kBAAkB,CAC1B,gCAAgC,EAChC,OAAO,EACP,IAAI,EACJ,KAAK,CACN,CAAC;IACJ,CAAC;IACD,MAAM,IAAI,kBAAkB,CAAC,uBAAuB,EAAE,OAAO,CAAC,CAAC;AACjE,CAAC","sourcesContent":["import { day } from '@vrplatform/utils';\nimport { z } from 'zod';\n\nconst postmarkErrorCodeSchema = z.number().int().nonnegative();\nconst postmarkResponseErrorCodeSchema = z\n .object({ ErrorCode: postmarkErrorCodeSchema })\n .transform(({ ErrorCode }) => ErrorCode);\nconst postmarkHeaderErrorCodeSchema = z\n .string()\n .regex(/^\\d+$/)\n .transform(Number)\n .pipe(postmarkErrorCodeSchema);\nconst postmarkSuccessResponseSchema = z.object({\n ErrorCode: z.literal(0),\n MessageID: z.string().min(1),\n SubmittedAt: z.string().refine((value) => day(value).isValid()),\n});\n\nfunction parseOptional<T>(schema: z.ZodType<T>, value: unknown) {\n const result = schema.safeParse(value);\n if (result.success) return result.data;\n}\n\ntype EmailDeliveryFailureDetails = {\n httpStatus: number;\n postmarkErrorCode?: number;\n provider: 'postmark';\n providerCategory: 'inactiveRecipient' | 'rejected';\n};\n\ntype EmailDeliveryErrorDetails =\n | EmailDeliveryFailureDetails\n | {\n failureCount: number;\n failures: EmailDeliveryFailureDetails[];\n };\n\nexport class EmailDeliveryError extends Error {\n constructor(\n message: string,\n public readonly details?: EmailDeliveryErrorDetails,\n public readonly expected = false,\n public readonly retryable = true\n ) {\n super(message);\n this.name = 'EmailDeliveryError';\n }\n}\n\n/**\n * Formats a verified sender address with a display name for the From header.\n * Registrations store bare addresses; recipients should still see the company\n * name the way they see `VRPlatform <notifications@vrplatform.app>`.\n */\nexport function formatSenderIdentity(\n name: string | null | undefined,\n address: string\n) {\n const display = (name ?? '').replace(/[\\r\\n\"<>]/g, '').trim();\n return display ? `\"${display}\" <${address}>` : address;\n}\n\nexport async function sendEmail(\n data: {\n to: string;\n subject: string;\n text: string;\n html: string;\n replyTo?: string;\n tag?: string;\n metadata?: Record<string, string>;\n from?: string;\n },\n options: {\n fetch?: (\n input: string | URL | Request,\n init?: RequestInit\n ) => Promise<Response>;\n postmarkToken?: string;\n }\n) {\n if (!options.postmarkToken) {\n throw new EmailDeliveryError(\n 'Postmark is not configured',\n undefined,\n false,\n false\n );\n }\n\n const response = await (options.fetch ?? fetch)(\n 'https://api.postmarkapp.com/email',\n {\n method: 'POST',\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n 'X-Postmark-Server-Token': options.postmarkToken,\n },\n body: JSON.stringify({\n From: data.from ?? 'VRPlatform <notifications@vrplatform.app>',\n To: data.to,\n Subject: data.subject,\n ReplyTo: data.replyTo,\n TextBody: data.text,\n HtmlBody: data.html,\n MessageStream: 'outbound',\n Tag: data.tag,\n Metadata: data.metadata,\n }),\n }\n );\n\n const providerResponse: unknown = await response.json().catch(() => ({}));\n const postmarkErrorCode =\n parseOptional(postmarkResponseErrorCodeSchema, providerResponse) ??\n parseOptional(\n postmarkHeaderErrorCodeSchema,\n response.headers.get('X-PM-ApiErrorCode')\n );\n\n if (\n !response.ok ||\n (postmarkErrorCode !== undefined && postmarkErrorCode !== 0)\n ) {\n const inactiveRecipient =\n response.status === 422 && postmarkErrorCode === 406;\n const details: EmailDeliveryFailureDetails = {\n provider: 'postmark',\n providerCategory: inactiveRecipient ? 'inactiveRecipient' : 'rejected',\n httpStatus: response.status,\n ...(postmarkErrorCode !== undefined ? { postmarkErrorCode } : {}),\n };\n\n if (inactiveRecipient) {\n throw new EmailDeliveryError(\n 'Postmark recipient is inactive',\n details,\n true,\n false\n );\n }\n\n throw new EmailDeliveryError(\n 'Postmark rejected the email',\n details,\n false,\n response.status === 429 || response.status >= 500\n );\n }\n\n const result = postmarkSuccessResponseSchema.safeParse(providerResponse);\n if (!result.success) {\n throw new EmailDeliveryError('Postmark returned an invalid response', {\n provider: 'postmark',\n providerCategory: 'rejected',\n httpStatus: response.status,\n ...(postmarkErrorCode !== undefined ? { postmarkErrorCode } : {}),\n });\n }\n\n return {\n httpStatus: response.status,\n messageId: result.data.MessageID,\n submittedAt: result.data.SubmittedAt,\n };\n}\n\nexport async function settleEmailDeliveries(deliveries: Promise<unknown>[]) {\n const failures = (await Promise.allSettled(deliveries)).filter(\n (result) => result.status === 'rejected'\n );\n if (failures.length === 0) return;\n\n const unexpectedDeliveryError = failures.find(\n (failure) =>\n failure.reason instanceof EmailDeliveryError && !failure.reason.expected\n )?.reason;\n const allExpected = failures.every(\n (failure) =>\n failure.reason instanceof EmailDeliveryError && failure.reason.expected\n );\n const firstDeliveryError = failures.find(\n (failure) => failure.reason instanceof EmailDeliveryError\n )?.reason;\n const failureDetails = failures.flatMap((failure) => {\n if (\n !(failure.reason instanceof EmailDeliveryError) ||\n !failure.reason.details ||\n !('provider' in failure.reason.details)\n ) {\n return [];\n }\n const { httpStatus, postmarkErrorCode, provider, providerCategory } =\n failure.reason.details;\n return [\n {\n httpStatus,\n provider,\n providerCategory,\n ...(postmarkErrorCode !== undefined ? { postmarkErrorCode } : {}),\n },\n ];\n });\n\n const details: EmailDeliveryErrorDetails = {\n failureCount: failures.length,\n failures: failureDetails,\n };\n if (unexpectedDeliveryError instanceof EmailDeliveryError) {\n if (unexpectedDeliveryError.message === 'Postmark is not configured') {\n throw new EmailDeliveryError(\n 'Postmark is not configured',\n details,\n false,\n false\n );\n }\n throw new EmailDeliveryError(\n 'Postmark rejected the email',\n details,\n false,\n unexpectedDeliveryError.retryable\n );\n }\n if (allExpected && firstDeliveryError instanceof EmailDeliveryError) {\n throw new EmailDeliveryError(\n 'Postmark recipient is inactive',\n details,\n true,\n false\n );\n }\n throw new EmailDeliveryError('Email delivery failed', details);\n}\n"]}
@@ -5,9 +5,7 @@ import { EmailContainer } from './EmailContainer';
5
5
  import { parseEmailHtml } from './utils';
6
6
  import { Button } from './Button';
7
7
  export const ActionEmailTemplate = ({ data, tenant, themeColors, mode, user, listing, month, }) => {
8
- return (_jsxs(EmailContainer, { title: data.subject, shortDescription: data.shortDescription, tenant: {
9
- logo: tenant.logo,
10
- }, mode: mode, children: [_jsx(Heading, { style: {
8
+ return (_jsxs(EmailContainer, { title: data.subject, shortDescription: data.shortDescription, tenant: tenant, mode: mode, children: [_jsx(Heading, { style: {
11
9
  fontSize: 28,
12
10
  fontWeight: 600,
13
11
  marginBottom: '50px',