payload-plugin-newsletter 0.1.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.
- package/CHANGELOG.md +35 -0
- package/CLAUDE.md +110 -0
- package/FEEDBACK.md +148 -0
- package/LICENSE +21 -0
- package/README-DEVELOPMENT.md +80 -0
- package/README.md +430 -0
- package/dist/.tsbuildinfo +1 -0
- package/dist/collections/Subscribers.d.ts +4 -0
- package/dist/collections/Subscribers.d.ts.map +1 -0
- package/dist/components/MagicLinkVerify.d.ts +27 -0
- package/dist/components/MagicLinkVerify.d.ts.map +1 -0
- package/dist/components/NewsletterForm.d.ts +5 -0
- package/dist/components/NewsletterForm.d.ts.map +1 -0
- package/dist/components/PreferencesForm.d.ts +5 -0
- package/dist/components/PreferencesForm.d.ts.map +1 -0
- package/dist/components/index.d.ts +5 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/endpoints/index.d.ts +4 -0
- package/dist/endpoints/index.d.ts.map +1 -0
- package/dist/endpoints/preferences.d.ts +5 -0
- package/dist/endpoints/preferences.d.ts.map +1 -0
- package/dist/endpoints/subscribe.d.ts +4 -0
- package/dist/endpoints/subscribe.d.ts.map +1 -0
- package/dist/endpoints/unsubscribe.d.ts +4 -0
- package/dist/endpoints/unsubscribe.d.ts.map +1 -0
- package/dist/endpoints/verify-magic-link.d.ts +4 -0
- package/dist/endpoints/verify-magic-link.d.ts.map +1 -0
- package/dist/exports/client.d.ts +6 -0
- package/dist/exports/client.d.ts.map +1 -0
- package/dist/exports/components.d.ts +2 -0
- package/dist/exports/components.d.ts.map +1 -0
- package/dist/exports/types.d.ts +2 -0
- package/dist/exports/types.d.ts.map +1 -0
- package/dist/fields/newsletterScheduling.d.ts +4 -0
- package/dist/fields/newsletterScheduling.d.ts.map +1 -0
- package/dist/globals/EmailSettings.d.ts +4 -0
- package/dist/globals/EmailSettings.d.ts.map +1 -0
- package/dist/hooks/useNewsletterAuth.d.ts +16 -0
- package/dist/hooks/useNewsletterAuth.d.ts.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/providers/broadcast.d.ts +19 -0
- package/dist/providers/broadcast.d.ts.map +1 -0
- package/dist/providers/index.d.ts +23 -0
- package/dist/providers/index.d.ts.map +1 -0
- package/dist/providers/resend.d.ts +20 -0
- package/dist/providers/resend.d.ts.map +1 -0
- package/dist/providers/types.d.ts +46 -0
- package/dist/providers/types.d.ts.map +1 -0
- package/dist/src/collections/Subscribers.js +344 -0
- package/dist/src/collections/Subscribers.js.map +1 -0
- package/dist/src/components/MagicLinkVerify.js +180 -0
- package/dist/src/components/MagicLinkVerify.js.map +1 -0
- package/dist/src/components/NewsletterForm.js +326 -0
- package/dist/src/components/NewsletterForm.js.map +1 -0
- package/dist/src/components/PreferencesForm.js +524 -0
- package/dist/src/components/PreferencesForm.js.map +1 -0
- package/dist/src/components/index.js +5 -0
- package/dist/src/components/index.js.map +1 -0
- package/dist/src/endpoints/index.js +17 -0
- package/dist/src/endpoints/index.js.map +1 -0
- package/dist/src/endpoints/preferences.js +124 -0
- package/dist/src/endpoints/preferences.js.map +1 -0
- package/dist/src/endpoints/subscribe.js +140 -0
- package/dist/src/endpoints/subscribe.js.map +1 -0
- package/dist/src/endpoints/unsubscribe.js +97 -0
- package/dist/src/endpoints/unsubscribe.js.map +1 -0
- package/dist/src/endpoints/verify-magic-link.js +93 -0
- package/dist/src/endpoints/verify-magic-link.js.map +1 -0
- package/dist/src/exports/client.js +7 -0
- package/dist/src/exports/client.js.map +1 -0
- package/dist/src/exports/components.js +6 -0
- package/dist/src/exports/components.js.map +1 -0
- package/dist/src/exports/types.js +3 -0
- package/dist/src/exports/types.js.map +1 -0
- package/dist/src/fields/newsletterScheduling.js +195 -0
- package/dist/src/fields/newsletterScheduling.js.map +1 -0
- package/dist/src/globals/EmailSettings.js +252 -0
- package/dist/src/globals/EmailSettings.js.map +1 -0
- package/dist/src/hooks/useNewsletterAuth.js +112 -0
- package/dist/src/hooks/useNewsletterAuth.js.map +1 -0
- package/dist/src/index.js +124 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/providers/broadcast.js +158 -0
- package/dist/src/providers/broadcast.js.map +1 -0
- package/dist/src/providers/index.js +63 -0
- package/dist/src/providers/index.js.map +1 -0
- package/dist/src/providers/resend.js +122 -0
- package/dist/src/providers/resend.js.map +1 -0
- package/dist/src/providers/types.js +12 -0
- package/dist/src/providers/types.js.map +1 -0
- package/dist/src/templates/BaseTemplate.js +105 -0
- package/dist/src/templates/BaseTemplate.js.map +1 -0
- package/dist/src/templates/MagicLinkTemplate.js +178 -0
- package/dist/src/templates/MagicLinkTemplate.js.map +1 -0
- package/dist/src/templates/NewsletterTemplate.js +150 -0
- package/dist/src/templates/NewsletterTemplate.js.map +1 -0
- package/dist/src/templates/WelcomeTemplate.js +192 -0
- package/dist/src/templates/WelcomeTemplate.js.map +1 -0
- package/dist/src/templates/index.js +6 -0
- package/dist/src/templates/index.js.map +1 -0
- package/dist/src/types/index.js +3 -0
- package/dist/src/types/index.js.map +1 -0
- package/dist/src/utils/jwt.js +91 -0
- package/dist/src/utils/jwt.js.map +1 -0
- package/dist/src/utils/validation.js +66 -0
- package/dist/src/utils/validation.js.map +1 -0
- package/dist/templates/BaseTemplate.d.ts +45 -0
- package/dist/templates/BaseTemplate.d.ts.map +1 -0
- package/dist/templates/MagicLinkTemplate.d.ts +67 -0
- package/dist/templates/MagicLinkTemplate.d.ts.map +1 -0
- package/dist/templates/NewsletterTemplate.d.ts +112 -0
- package/dist/templates/NewsletterTemplate.d.ts.map +1 -0
- package/dist/templates/WelcomeTemplate.d.ts +55 -0
- package/dist/templates/WelcomeTemplate.d.ts.map +1 -0
- package/dist/templates/index.d.ts +7 -0
- package/dist/templates/index.d.ts.map +1 -0
- package/dist/types/index.d.ts +332 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/utils/jwt.d.ts +32 -0
- package/dist/utils/jwt.d.ts.map +1 -0
- package/dist/utils/validation.d.ts +25 -0
- package/dist/utils/validation.d.ts.map +1 -0
- package/package.json +128 -0
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Body, Container, Head, Html, Preview, Section, Text, Link, Hr } from '@react-email/components';
|
|
4
|
+
export const baseStyles = {
|
|
5
|
+
main: {
|
|
6
|
+
backgroundColor: '#ffffff',
|
|
7
|
+
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif'
|
|
8
|
+
},
|
|
9
|
+
container: {
|
|
10
|
+
margin: '0 auto',
|
|
11
|
+
padding: '20px 0 48px',
|
|
12
|
+
maxWidth: '600px'
|
|
13
|
+
},
|
|
14
|
+
content: {
|
|
15
|
+
padding: '0 20px'
|
|
16
|
+
},
|
|
17
|
+
footer: {
|
|
18
|
+
padding: '32px 20px',
|
|
19
|
+
textAlign: 'center'
|
|
20
|
+
},
|
|
21
|
+
footerText: {
|
|
22
|
+
color: '#8898aa',
|
|
23
|
+
fontSize: '12px',
|
|
24
|
+
lineHeight: '16px',
|
|
25
|
+
margin: '0'
|
|
26
|
+
},
|
|
27
|
+
footerLink: {
|
|
28
|
+
color: '#8898aa',
|
|
29
|
+
textDecoration: 'underline'
|
|
30
|
+
},
|
|
31
|
+
hr: {
|
|
32
|
+
borderColor: '#e6ebf1',
|
|
33
|
+
margin: '32px 0'
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
export const BaseTemplate = ({ preview, children, footer })=>{
|
|
37
|
+
return /*#__PURE__*/ _jsxs(Html, {
|
|
38
|
+
children: [
|
|
39
|
+
/*#__PURE__*/ _jsx(Head, {}),
|
|
40
|
+
preview && /*#__PURE__*/ _jsx(Preview, {
|
|
41
|
+
children: preview
|
|
42
|
+
}),
|
|
43
|
+
/*#__PURE__*/ _jsx(Body, {
|
|
44
|
+
style: baseStyles.main,
|
|
45
|
+
children: /*#__PURE__*/ _jsxs(Container, {
|
|
46
|
+
style: baseStyles.container,
|
|
47
|
+
children: [
|
|
48
|
+
/*#__PURE__*/ _jsx(Section, {
|
|
49
|
+
style: baseStyles.content,
|
|
50
|
+
children: children
|
|
51
|
+
}),
|
|
52
|
+
footer && /*#__PURE__*/ _jsxs(_Fragment, {
|
|
53
|
+
children: [
|
|
54
|
+
/*#__PURE__*/ _jsx(Hr, {
|
|
55
|
+
style: baseStyles.hr
|
|
56
|
+
}),
|
|
57
|
+
/*#__PURE__*/ _jsxs(Section, {
|
|
58
|
+
style: baseStyles.footer,
|
|
59
|
+
children: [
|
|
60
|
+
(footer.unsubscribeUrl || footer.preferencesUrl) && /*#__PURE__*/ _jsxs(Text, {
|
|
61
|
+
style: baseStyles.footerText,
|
|
62
|
+
children: [
|
|
63
|
+
footer.preferencesUrl && /*#__PURE__*/ _jsxs(_Fragment, {
|
|
64
|
+
children: [
|
|
65
|
+
/*#__PURE__*/ _jsx(Link, {
|
|
66
|
+
href: footer.preferencesUrl,
|
|
67
|
+
style: baseStyles.footerLink,
|
|
68
|
+
children: "Manage preferences"
|
|
69
|
+
}),
|
|
70
|
+
footer.unsubscribeUrl && ' • '
|
|
71
|
+
]
|
|
72
|
+
}),
|
|
73
|
+
footer.unsubscribeUrl && /*#__PURE__*/ _jsx(Link, {
|
|
74
|
+
href: footer.unsubscribeUrl,
|
|
75
|
+
style: baseStyles.footerLink,
|
|
76
|
+
children: "Unsubscribe"
|
|
77
|
+
})
|
|
78
|
+
]
|
|
79
|
+
}),
|
|
80
|
+
footer.address && /*#__PURE__*/ _jsx(Text, {
|
|
81
|
+
style: {
|
|
82
|
+
...baseStyles.footerText,
|
|
83
|
+
marginTop: '16px'
|
|
84
|
+
},
|
|
85
|
+
children: footer.address
|
|
86
|
+
}),
|
|
87
|
+
footer.copyright && /*#__PURE__*/ _jsx(Text, {
|
|
88
|
+
style: {
|
|
89
|
+
...baseStyles.footerText,
|
|
90
|
+
marginTop: '8px'
|
|
91
|
+
},
|
|
92
|
+
children: footer.copyright
|
|
93
|
+
})
|
|
94
|
+
]
|
|
95
|
+
})
|
|
96
|
+
]
|
|
97
|
+
})
|
|
98
|
+
]
|
|
99
|
+
})
|
|
100
|
+
})
|
|
101
|
+
]
|
|
102
|
+
});
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
//# sourceMappingURL=BaseTemplate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/templates/BaseTemplate.tsx"],"sourcesContent":["import React from 'react'\nimport {\n Body,\n Container,\n Head,\n Html,\n Preview,\n Section,\n Text,\n Link,\n Hr,\n} from '@react-email/components'\n\nexport interface BaseTemplateProps {\n preview?: string\n children: React.ReactNode\n footer?: {\n unsubscribeUrl?: string\n preferencesUrl?: string\n address?: string\n copyright?: string\n }\n}\n\nexport const baseStyles = {\n main: {\n backgroundColor: '#ffffff',\n fontFamily:\n '-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif',\n },\n container: {\n margin: '0 auto',\n padding: '20px 0 48px',\n maxWidth: '600px',\n },\n content: {\n padding: '0 20px',\n },\n footer: {\n padding: '32px 20px',\n textAlign: 'center' as const,\n },\n footerText: {\n color: '#8898aa',\n fontSize: '12px',\n lineHeight: '16px',\n margin: '0',\n },\n footerLink: {\n color: '#8898aa',\n textDecoration: 'underline',\n },\n hr: {\n borderColor: '#e6ebf1',\n margin: '32px 0',\n },\n}\n\nexport const BaseTemplate: React.FC<BaseTemplateProps> = ({\n preview,\n children,\n footer,\n}) => {\n return (\n <Html>\n <Head />\n {preview && <Preview>{preview}</Preview>}\n <Body style={baseStyles.main}>\n <Container style={baseStyles.container}>\n <Section style={baseStyles.content}>\n {children}\n </Section>\n \n {footer && (\n <>\n <Hr style={baseStyles.hr} />\n <Section style={baseStyles.footer}>\n {(footer.unsubscribeUrl || footer.preferencesUrl) && (\n <Text style={baseStyles.footerText}>\n {footer.preferencesUrl && (\n <>\n <Link\n href={footer.preferencesUrl}\n style={baseStyles.footerLink}\n >\n Manage preferences\n </Link>\n {footer.unsubscribeUrl && ' • '}\n </>\n )}\n {footer.unsubscribeUrl && (\n <Link\n href={footer.unsubscribeUrl}\n style={baseStyles.footerLink}\n >\n Unsubscribe\n </Link>\n )}\n </Text>\n )}\n \n {footer.address && (\n <Text style={{ ...baseStyles.footerText, marginTop: '16px' }}>\n {footer.address}\n </Text>\n )}\n \n {footer.copyright && (\n <Text style={{ ...baseStyles.footerText, marginTop: '8px' }}>\n {footer.copyright}\n </Text>\n )}\n </Section>\n </>\n )}\n </Container>\n </Body>\n </Html>\n )\n}"],"names":["React","Body","Container","Head","Html","Preview","Section","Text","Link","Hr","baseStyles","main","backgroundColor","fontFamily","container","margin","padding","maxWidth","content","footer","textAlign","footerText","color","fontSize","lineHeight","footerLink","textDecoration","hr","borderColor","BaseTemplate","preview","children","style","unsubscribeUrl","preferencesUrl","href","address","marginTop","copyright"],"mappings":";AAAA,OAAOA,WAAW,QAAO;AACzB,SACEC,IAAI,EACJC,SAAS,EACTC,IAAI,EACJC,IAAI,EACJC,OAAO,EACPC,OAAO,EACPC,IAAI,EACJC,IAAI,EACJC,EAAE,QACG,0BAAyB;AAahC,OAAO,MAAMC,aAAa;IACxBC,MAAM;QACJC,iBAAiB;QACjBC,YACE;IACJ;IACAC,WAAW;QACTC,QAAQ;QACRC,SAAS;QACTC,UAAU;IACZ;IACAC,SAAS;QACPF,SAAS;IACX;IACAG,QAAQ;QACNH,SAAS;QACTI,WAAW;IACb;IACAC,YAAY;QACVC,OAAO;QACPC,UAAU;QACVC,YAAY;QACZT,QAAQ;IACV;IACAU,YAAY;QACVH,OAAO;QACPI,gBAAgB;IAClB;IACAC,IAAI;QACFC,aAAa;QACbb,QAAQ;IACV;AACF,EAAC;AAED,OAAO,MAAMc,eAA4C,CAAC,EACxDC,OAAO,EACPC,QAAQ,EACRZ,MAAM,EACP;IACC,qBACE,MAACf;;0BACC,KAACD;YACA2B,yBAAW,KAACzB;0BAASyB;;0BACtB,KAAC7B;gBAAK+B,OAAOtB,WAAWC,IAAI;0BAC1B,cAAA,MAACT;oBAAU8B,OAAOtB,WAAWI,SAAS;;sCACpC,KAACR;4BAAQ0B,OAAOtB,WAAWQ,OAAO;sCAC/Ba;;wBAGFZ,wBACC;;8CACE,KAACV;oCAAGuB,OAAOtB,WAAWiB,EAAE;;8CACxB,MAACrB;oCAAQ0B,OAAOtB,WAAWS,MAAM;;wCAC7BA,CAAAA,OAAOc,cAAc,IAAId,OAAOe,cAAc,AAAD,mBAC7C,MAAC3B;4CAAKyB,OAAOtB,WAAWW,UAAU;;gDAC/BF,OAAOe,cAAc,kBACpB;;sEACE,KAAC1B;4DACC2B,MAAMhB,OAAOe,cAAc;4DAC3BF,OAAOtB,WAAWe,UAAU;sEAC7B;;wDAGAN,OAAOc,cAAc,IAAI;;;gDAG7Bd,OAAOc,cAAc,kBACpB,KAACzB;oDACC2B,MAAMhB,OAAOc,cAAc;oDAC3BD,OAAOtB,WAAWe,UAAU;8DAC7B;;;;wCAONN,OAAOiB,OAAO,kBACb,KAAC7B;4CAAKyB,OAAO;gDAAE,GAAGtB,WAAWW,UAAU;gDAAEgB,WAAW;4CAAO;sDACxDlB,OAAOiB,OAAO;;wCAIlBjB,OAAOmB,SAAS,kBACf,KAAC/B;4CAAKyB,OAAO;gDAAE,GAAGtB,WAAWW,UAAU;gDAAEgB,WAAW;4CAAM;sDACvDlB,OAAOmB,SAAS;;;;;;;;;;;AAUrC,EAAC"}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Heading, Text, Button, Section } from '@react-email/components';
|
|
4
|
+
import { BaseTemplate } from './BaseTemplate';
|
|
5
|
+
const magicLinkStyles = {
|
|
6
|
+
heading: {
|
|
7
|
+
fontSize: '28px',
|
|
8
|
+
fontWeight: '700',
|
|
9
|
+
color: '#1a1a1a',
|
|
10
|
+
margin: '0 0 16px 0'
|
|
11
|
+
},
|
|
12
|
+
text: {
|
|
13
|
+
fontSize: '16px',
|
|
14
|
+
lineHeight: '24px',
|
|
15
|
+
color: '#4a4a4a',
|
|
16
|
+
margin: '0 0 16px 0'
|
|
17
|
+
},
|
|
18
|
+
button: {
|
|
19
|
+
backgroundColor: '#0066cc',
|
|
20
|
+
borderRadius: '6px',
|
|
21
|
+
color: '#ffffff',
|
|
22
|
+
fontSize: '16px',
|
|
23
|
+
fontWeight: '600',
|
|
24
|
+
textDecoration: 'none',
|
|
25
|
+
textAlign: 'center',
|
|
26
|
+
display: 'block',
|
|
27
|
+
width: '100%',
|
|
28
|
+
padding: '16px 24px',
|
|
29
|
+
margin: '32px 0'
|
|
30
|
+
},
|
|
31
|
+
codeSection: {
|
|
32
|
+
backgroundColor: '#f6f8fa',
|
|
33
|
+
borderRadius: '6px',
|
|
34
|
+
padding: '24px',
|
|
35
|
+
margin: '24px 0',
|
|
36
|
+
textAlign: 'center'
|
|
37
|
+
},
|
|
38
|
+
code: {
|
|
39
|
+
fontSize: '24px',
|
|
40
|
+
fontWeight: '700',
|
|
41
|
+
color: '#1a1a1a',
|
|
42
|
+
letterSpacing: '2px',
|
|
43
|
+
fontFamily: 'monospace'
|
|
44
|
+
},
|
|
45
|
+
warning: {
|
|
46
|
+
fontSize: '14px',
|
|
47
|
+
color: '#dc3545',
|
|
48
|
+
margin: '16px 0',
|
|
49
|
+
padding: '12px',
|
|
50
|
+
backgroundColor: '#f8d7da',
|
|
51
|
+
borderRadius: '4px'
|
|
52
|
+
},
|
|
53
|
+
expire: {
|
|
54
|
+
fontSize: '14px',
|
|
55
|
+
color: '#6c757d',
|
|
56
|
+
fontStyle: 'italic'
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
export const MagicLinkTemplate = ({ magicLinkUrl, subscriber })=>{
|
|
60
|
+
// Extract a verification code from the URL for fallback
|
|
61
|
+
const urlParams = new URL(magicLinkUrl).searchParams;
|
|
62
|
+
const token = urlParams.get('token');
|
|
63
|
+
const verificationCode = token ? token.slice(-6).toUpperCase() : 'XXXXXX';
|
|
64
|
+
return /*#__PURE__*/ _jsxs(BaseTemplate, {
|
|
65
|
+
preview: "Sign in to manage your newsletter preferences",
|
|
66
|
+
children: [
|
|
67
|
+
/*#__PURE__*/ _jsx(Heading, {
|
|
68
|
+
style: magicLinkStyles.heading,
|
|
69
|
+
children: "Sign in to your account"
|
|
70
|
+
}),
|
|
71
|
+
/*#__PURE__*/ _jsxs(Text, {
|
|
72
|
+
style: magicLinkStyles.text,
|
|
73
|
+
children: [
|
|
74
|
+
"Hi",
|
|
75
|
+
subscriber.name ? ` ${subscriber.name}` : '',
|
|
76
|
+
","
|
|
77
|
+
]
|
|
78
|
+
}),
|
|
79
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
80
|
+
style: magicLinkStyles.text,
|
|
81
|
+
children: "You requested a sign-in link for your newsletter account. Click the button below to access your preferences:"
|
|
82
|
+
}),
|
|
83
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
84
|
+
href: magicLinkUrl,
|
|
85
|
+
style: magicLinkStyles.button,
|
|
86
|
+
children: "Sign In to Your Account"
|
|
87
|
+
}),
|
|
88
|
+
/*#__PURE__*/ _jsxs(Section, {
|
|
89
|
+
style: magicLinkStyles.codeSection,
|
|
90
|
+
children: [
|
|
91
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
92
|
+
style: {
|
|
93
|
+
...magicLinkStyles.text,
|
|
94
|
+
margin: '0 0 8px 0'
|
|
95
|
+
},
|
|
96
|
+
children: "Or use this verification code:"
|
|
97
|
+
}),
|
|
98
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
99
|
+
style: magicLinkStyles.code,
|
|
100
|
+
children: verificationCode
|
|
101
|
+
})
|
|
102
|
+
]
|
|
103
|
+
}),
|
|
104
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
105
|
+
style: magicLinkStyles.warning,
|
|
106
|
+
children: "If you didn't request this email, you can safely ignore it."
|
|
107
|
+
}),
|
|
108
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
109
|
+
style: magicLinkStyles.expire,
|
|
110
|
+
children: "This link will expire in 7 days for your security."
|
|
111
|
+
})
|
|
112
|
+
]
|
|
113
|
+
});
|
|
114
|
+
};
|
|
115
|
+
// Export a function that creates a custom magic link template
|
|
116
|
+
export function createMagicLinkTemplate(customContent, customStyles) {
|
|
117
|
+
const mergedStyles = {
|
|
118
|
+
...magicLinkStyles,
|
|
119
|
+
...customStyles
|
|
120
|
+
};
|
|
121
|
+
return (props)=>{
|
|
122
|
+
const urlParams = new URL(props.magicLinkUrl).searchParams;
|
|
123
|
+
const token = urlParams.get('token');
|
|
124
|
+
const verificationCode = token ? token.slice(-6).toUpperCase() : 'XXXXXX';
|
|
125
|
+
return /*#__PURE__*/ _jsxs(BaseTemplate, {
|
|
126
|
+
preview: customContent?.heading || "Sign in to manage your newsletter preferences",
|
|
127
|
+
children: [
|
|
128
|
+
/*#__PURE__*/ _jsx(Heading, {
|
|
129
|
+
style: mergedStyles.heading,
|
|
130
|
+
children: customContent?.heading || 'Sign in to your account'
|
|
131
|
+
}),
|
|
132
|
+
/*#__PURE__*/ _jsxs(Text, {
|
|
133
|
+
style: mergedStyles.text,
|
|
134
|
+
children: [
|
|
135
|
+
"Hi",
|
|
136
|
+
props.subscriber.name ? ` ${props.subscriber.name}` : '',
|
|
137
|
+
","
|
|
138
|
+
]
|
|
139
|
+
}),
|
|
140
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
141
|
+
style: mergedStyles.text,
|
|
142
|
+
children: customContent?.intro || 'You requested a sign-in link for your newsletter account. Click the button below to access your preferences:'
|
|
143
|
+
}),
|
|
144
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
145
|
+
href: props.magicLinkUrl,
|
|
146
|
+
style: mergedStyles.button,
|
|
147
|
+
children: customContent?.buttonText || 'Sign In to Your Account'
|
|
148
|
+
}),
|
|
149
|
+
customContent?.includeCode !== false && /*#__PURE__*/ _jsxs(Section, {
|
|
150
|
+
style: mergedStyles.codeSection,
|
|
151
|
+
children: [
|
|
152
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
153
|
+
style: {
|
|
154
|
+
...mergedStyles.text,
|
|
155
|
+
margin: '0 0 8px 0'
|
|
156
|
+
},
|
|
157
|
+
children: "Or use this verification code:"
|
|
158
|
+
}),
|
|
159
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
160
|
+
style: mergedStyles.code,
|
|
161
|
+
children: verificationCode
|
|
162
|
+
})
|
|
163
|
+
]
|
|
164
|
+
}),
|
|
165
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
166
|
+
style: mergedStyles.warning,
|
|
167
|
+
children: customContent?.warning || "If you didn't request this email, you can safely ignore it."
|
|
168
|
+
}),
|
|
169
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
170
|
+
style: mergedStyles.expire,
|
|
171
|
+
children: customContent?.expireText || 'This link will expire in 7 days for your security.'
|
|
172
|
+
})
|
|
173
|
+
]
|
|
174
|
+
});
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
//# sourceMappingURL=MagicLinkTemplate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/templates/MagicLinkTemplate.tsx"],"sourcesContent":["import React from 'react'\nimport {\n Heading,\n Text,\n Button,\n Section,\n} from '@react-email/components'\nimport { BaseTemplate } from './BaseTemplate'\nimport type { MagicLinkEmailProps } from '../types'\n\nconst magicLinkStyles = {\n heading: {\n fontSize: '28px',\n fontWeight: '700',\n color: '#1a1a1a',\n margin: '0 0 16px 0',\n },\n text: {\n fontSize: '16px',\n lineHeight: '24px',\n color: '#4a4a4a',\n margin: '0 0 16px 0',\n },\n button: {\n backgroundColor: '#0066cc',\n borderRadius: '6px',\n color: '#ffffff',\n fontSize: '16px',\n fontWeight: '600',\n textDecoration: 'none',\n textAlign: 'center' as const,\n display: 'block',\n width: '100%',\n padding: '16px 24px',\n margin: '32px 0',\n },\n codeSection: {\n backgroundColor: '#f6f8fa',\n borderRadius: '6px',\n padding: '24px',\n margin: '24px 0',\n textAlign: 'center' as const,\n },\n code: {\n fontSize: '24px',\n fontWeight: '700',\n color: '#1a1a1a',\n letterSpacing: '2px',\n fontFamily: 'monospace',\n },\n warning: {\n fontSize: '14px',\n color: '#dc3545',\n margin: '16px 0',\n padding: '12px',\n backgroundColor: '#f8d7da',\n borderRadius: '4px',\n },\n expire: {\n fontSize: '14px',\n color: '#6c757d',\n fontStyle: 'italic',\n },\n}\n\nexport const MagicLinkTemplate: React.FC<MagicLinkEmailProps> = ({\n magicLinkUrl,\n subscriber,\n}) => {\n // Extract a verification code from the URL for fallback\n const urlParams = new URL(magicLinkUrl).searchParams\n const token = urlParams.get('token')\n const verificationCode = token ? token.slice(-6).toUpperCase() : 'XXXXXX'\n\n return (\n <BaseTemplate\n preview=\"Sign in to manage your newsletter preferences\"\n >\n <Heading style={magicLinkStyles.heading}>\n Sign in to your account\n </Heading>\n \n <Text style={magicLinkStyles.text}>\n Hi{subscriber.name ? ` ${subscriber.name}` : ''},\n </Text>\n \n <Text style={magicLinkStyles.text}>\n You requested a sign-in link for your newsletter account. Click the button below to access your preferences:\n </Text>\n \n <Button\n href={magicLinkUrl}\n style={magicLinkStyles.button}\n >\n Sign In to Your Account\n </Button>\n \n <Section style={magicLinkStyles.codeSection}>\n <Text style={{ ...magicLinkStyles.text, margin: '0 0 8px 0' }}>\n Or use this verification code:\n </Text>\n <Text style={magicLinkStyles.code}>\n {verificationCode}\n </Text>\n </Section>\n \n <Text style={magicLinkStyles.warning}>\n If you didn't request this email, you can safely ignore it.\n </Text>\n \n <Text style={magicLinkStyles.expire}>\n This link will expire in 7 days for your security.\n </Text>\n </BaseTemplate>\n )\n}\n\n// Export a function that creates a custom magic link template\nexport function createMagicLinkTemplate(\n customContent?: {\n heading?: string\n intro?: string\n buttonText?: string\n warning?: string\n expireText?: string\n includeCode?: boolean\n },\n customStyles?: Partial<typeof magicLinkStyles>\n): React.FC<MagicLinkEmailProps> {\n const mergedStyles = {\n ...magicLinkStyles,\n ...customStyles,\n }\n \n return (props: MagicLinkEmailProps) => {\n const urlParams = new URL(props.magicLinkUrl).searchParams\n const token = urlParams.get('token')\n const verificationCode = token ? token.slice(-6).toUpperCase() : 'XXXXXX'\n \n return (\n <BaseTemplate\n preview={customContent?.heading || \"Sign in to manage your newsletter preferences\"}\n >\n <Heading style={mergedStyles.heading}>\n {customContent?.heading || 'Sign in to your account'}\n </Heading>\n \n <Text style={mergedStyles.text}>\n Hi{props.subscriber.name ? ` ${props.subscriber.name}` : ''},\n </Text>\n \n <Text style={mergedStyles.text}>\n {customContent?.intro || 'You requested a sign-in link for your newsletter account. Click the button below to access your preferences:'}\n </Text>\n \n <Button\n href={props.magicLinkUrl}\n style={mergedStyles.button}\n >\n {customContent?.buttonText || 'Sign In to Your Account'}\n </Button>\n \n {customContent?.includeCode !== false && (\n <Section style={mergedStyles.codeSection}>\n <Text style={{ ...mergedStyles.text, margin: '0 0 8px 0' }}>\n Or use this verification code:\n </Text>\n <Text style={mergedStyles.code}>\n {verificationCode}\n </Text>\n </Section>\n )}\n \n <Text style={mergedStyles.warning}>\n {customContent?.warning || \"If you didn't request this email, you can safely ignore it.\"}\n </Text>\n \n <Text style={mergedStyles.expire}>\n {customContent?.expireText || 'This link will expire in 7 days for your security.'}\n </Text>\n </BaseTemplate>\n )\n }\n}"],"names":["React","Heading","Text","Button","Section","BaseTemplate","magicLinkStyles","heading","fontSize","fontWeight","color","margin","text","lineHeight","button","backgroundColor","borderRadius","textDecoration","textAlign","display","width","padding","codeSection","code","letterSpacing","fontFamily","warning","expire","fontStyle","MagicLinkTemplate","magicLinkUrl","subscriber","urlParams","URL","searchParams","token","get","verificationCode","slice","toUpperCase","preview","style","name","href","createMagicLinkTemplate","customContent","customStyles","mergedStyles","props","intro","buttonText","includeCode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BAEzB+B,eAAeK,cAAc;;gBAG/BL,eAAeM,gBAAgB,uBAC9B,MAAC/C;oBAAQqC,OAAOM,aAAazB,WAAW;;sCACtC,KAACpB;4BAAKuC,OAAO;gCAAE,GAAGM,aAAanC,IAAI;gCAAED,QAAQ;4BAAY;sCAAG;;sCAG5D,KAACT;4BAAKuC,OAAOM,aAAaxB,IAAI;sCAC3Bc;;;;8BAKP,KAACnC;oBAAKuC,OAAOM,aAAarB,OAAO;8BAC9BmB,eAAenB,WAAW;;8BAG7B,KAACxB;oBAAKuC,OAAOM,aAAapB,MAAM;8BAC7BkB,eAAeO,cAAc;;;;IAItC;AACF"}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Heading, Button, Markdown } from '@react-email/components';
|
|
4
|
+
import { BaseTemplate } from './BaseTemplate';
|
|
5
|
+
const newsletterStyles = {
|
|
6
|
+
heading: {
|
|
7
|
+
fontSize: '32px',
|
|
8
|
+
fontWeight: '700',
|
|
9
|
+
color: '#1a1a1a',
|
|
10
|
+
margin: '0 0 24px 0'
|
|
11
|
+
},
|
|
12
|
+
markdown: {
|
|
13
|
+
h1: {
|
|
14
|
+
fontSize: '28px',
|
|
15
|
+
fontWeight: '700',
|
|
16
|
+
color: '#1a1a1a',
|
|
17
|
+
margin: '32px 0 16px 0'
|
|
18
|
+
},
|
|
19
|
+
h2: {
|
|
20
|
+
fontSize: '24px',
|
|
21
|
+
fontWeight: '600',
|
|
22
|
+
color: '#1a1a1a',
|
|
23
|
+
margin: '24px 0 12px 0'
|
|
24
|
+
},
|
|
25
|
+
h3: {
|
|
26
|
+
fontSize: '20px',
|
|
27
|
+
fontWeight: '600',
|
|
28
|
+
color: '#1a1a1a',
|
|
29
|
+
margin: '20px 0 8px 0'
|
|
30
|
+
},
|
|
31
|
+
p: {
|
|
32
|
+
fontSize: '16px',
|
|
33
|
+
lineHeight: '24px',
|
|
34
|
+
color: '#4a4a4a',
|
|
35
|
+
margin: '0 0 16px 0'
|
|
36
|
+
},
|
|
37
|
+
a: {
|
|
38
|
+
color: '#0066cc',
|
|
39
|
+
textDecoration: 'underline'
|
|
40
|
+
},
|
|
41
|
+
ul: {
|
|
42
|
+
paddingLeft: '20px',
|
|
43
|
+
margin: '0 0 16px 0'
|
|
44
|
+
},
|
|
45
|
+
ol: {
|
|
46
|
+
paddingLeft: '20px',
|
|
47
|
+
margin: '0 0 16px 0'
|
|
48
|
+
},
|
|
49
|
+
li: {
|
|
50
|
+
fontSize: '16px',
|
|
51
|
+
lineHeight: '24px',
|
|
52
|
+
color: '#4a4a4a',
|
|
53
|
+
marginBottom: '8px'
|
|
54
|
+
},
|
|
55
|
+
img: {
|
|
56
|
+
maxWidth: '100%',
|
|
57
|
+
height: 'auto',
|
|
58
|
+
margin: '16px 0'
|
|
59
|
+
},
|
|
60
|
+
blockquote: {
|
|
61
|
+
borderLeft: '4px solid #e6ebf1',
|
|
62
|
+
paddingLeft: '16px',
|
|
63
|
+
margin: '0 0 16px 0',
|
|
64
|
+
fontStyle: 'italic',
|
|
65
|
+
color: '#6a6a6a'
|
|
66
|
+
},
|
|
67
|
+
code: {
|
|
68
|
+
backgroundColor: '#f6f8fa',
|
|
69
|
+
padding: '2px 4px',
|
|
70
|
+
borderRadius: '3px',
|
|
71
|
+
fontFamily: 'monospace',
|
|
72
|
+
fontSize: '14px'
|
|
73
|
+
},
|
|
74
|
+
pre: {
|
|
75
|
+
backgroundColor: '#f6f8fa',
|
|
76
|
+
padding: '16px',
|
|
77
|
+
borderRadius: '6px',
|
|
78
|
+
overflow: 'auto',
|
|
79
|
+
margin: '0 0 16px 0'
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
button: {
|
|
83
|
+
backgroundColor: '#0066cc',
|
|
84
|
+
borderRadius: '6px',
|
|
85
|
+
color: '#ffffff',
|
|
86
|
+
fontSize: '16px',
|
|
87
|
+
fontWeight: '600',
|
|
88
|
+
textDecoration: 'none',
|
|
89
|
+
textAlign: 'center',
|
|
90
|
+
display: 'block',
|
|
91
|
+
width: '100%',
|
|
92
|
+
padding: '12px 20px',
|
|
93
|
+
margin: '32px 0'
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
export const NewsletterTemplate = ({ subject, preheader, title, content, ctaButton, footer })=>{
|
|
97
|
+
return /*#__PURE__*/ _jsxs(BaseTemplate, {
|
|
98
|
+
preview: preheader || subject,
|
|
99
|
+
footer: footer,
|
|
100
|
+
children: [
|
|
101
|
+
title && /*#__PURE__*/ _jsx(Heading, {
|
|
102
|
+
style: newsletterStyles.heading,
|
|
103
|
+
children: title
|
|
104
|
+
}),
|
|
105
|
+
/*#__PURE__*/ _jsx(Markdown, {
|
|
106
|
+
markdownCustomStyles: newsletterStyles.markdown,
|
|
107
|
+
markdownContainerStyles: {
|
|
108
|
+
padding: '0'
|
|
109
|
+
},
|
|
110
|
+
children: content
|
|
111
|
+
}),
|
|
112
|
+
ctaButton && /*#__PURE__*/ _jsx(Button, {
|
|
113
|
+
href: ctaButton.href,
|
|
114
|
+
style: newsletterStyles.button,
|
|
115
|
+
children: ctaButton.text
|
|
116
|
+
})
|
|
117
|
+
]
|
|
118
|
+
});
|
|
119
|
+
};
|
|
120
|
+
// Export a function that creates a custom newsletter template
|
|
121
|
+
export function createNewsletterTemplate(customStyles) {
|
|
122
|
+
const mergedStyles = {
|
|
123
|
+
...newsletterStyles,
|
|
124
|
+
...customStyles
|
|
125
|
+
};
|
|
126
|
+
return (props)=>/*#__PURE__*/ _jsxs(BaseTemplate, {
|
|
127
|
+
preview: props.preheader || props.subject,
|
|
128
|
+
footer: props.footer,
|
|
129
|
+
children: [
|
|
130
|
+
props.title && /*#__PURE__*/ _jsx(Heading, {
|
|
131
|
+
style: mergedStyles.heading,
|
|
132
|
+
children: props.title
|
|
133
|
+
}),
|
|
134
|
+
/*#__PURE__*/ _jsx(Markdown, {
|
|
135
|
+
markdownCustomStyles: mergedStyles.markdown,
|
|
136
|
+
markdownContainerStyles: {
|
|
137
|
+
padding: '0'
|
|
138
|
+
},
|
|
139
|
+
children: props.content
|
|
140
|
+
}),
|
|
141
|
+
props.ctaButton && /*#__PURE__*/ _jsx(Button, {
|
|
142
|
+
href: props.ctaButton.href,
|
|
143
|
+
style: mergedStyles.button,
|
|
144
|
+
children: props.ctaButton.text
|
|
145
|
+
})
|
|
146
|
+
]
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
//# sourceMappingURL=NewsletterTemplate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/templates/NewsletterTemplate.tsx"],"sourcesContent":["import React from 'react'\nimport {\n Heading,\n Text,\n Link,\n Img,\n Button,\n Markdown,\n} from '@react-email/components'\nimport { BaseTemplate, baseStyles } from './BaseTemplate'\n\nexport interface NewsletterTemplateProps {\n subject: string\n preheader?: string\n title?: string\n content: string // Markdown content\n ctaButton?: {\n text: string\n href: string\n }\n footer?: {\n unsubscribeUrl?: string\n preferencesUrl?: string\n address?: string\n copyright?: string\n }\n}\n\nconst newsletterStyles = {\n heading: {\n fontSize: '32px',\n fontWeight: '700',\n color: '#1a1a1a',\n margin: '0 0 24px 0',\n },\n markdown: {\n h1: {\n fontSize: '28px',\n fontWeight: '700',\n color: '#1a1a1a',\n margin: '32px 0 16px 0',\n },\n h2: {\n fontSize: '24px',\n fontWeight: '600',\n color: '#1a1a1a',\n margin: '24px 0 12px 0',\n },\n h3: {\n fontSize: '20px',\n fontWeight: '600',\n color: '#1a1a1a',\n margin: '20px 0 8px 0',\n },\n p: {\n fontSize: '16px',\n lineHeight: '24px',\n color: '#4a4a4a',\n margin: '0 0 16px 0',\n },\n a: {\n color: '#0066cc',\n textDecoration: 'underline',\n },\n ul: {\n paddingLeft: '20px',\n margin: '0 0 16px 0',\n },\n ol: {\n paddingLeft: '20px',\n margin: '0 0 16px 0',\n },\n li: {\n fontSize: '16px',\n lineHeight: '24px',\n color: '#4a4a4a',\n marginBottom: '8px',\n },\n img: {\n maxWidth: '100%',\n height: 'auto',\n margin: '16px 0',\n },\n blockquote: {\n borderLeft: '4px solid #e6ebf1',\n paddingLeft: '16px',\n margin: '0 0 16px 0',\n fontStyle: 'italic',\n color: '#6a6a6a',\n },\n code: {\n backgroundColor: '#f6f8fa',\n padding: '2px 4px',\n borderRadius: '3px',\n fontFamily: 'monospace',\n fontSize: '14px',\n },\n pre: {\n backgroundColor: '#f6f8fa',\n padding: '16px',\n borderRadius: '6px',\n overflow: 'auto',\n margin: '0 0 16px 0',\n },\n },\n button: {\n backgroundColor: '#0066cc',\n borderRadius: '6px',\n color: '#ffffff',\n fontSize: '16px',\n fontWeight: '600',\n textDecoration: 'none',\n textAlign: 'center' as const,\n display: 'block',\n width: '100%',\n padding: '12px 20px',\n margin: '32px 0',\n },\n}\n\nexport const NewsletterTemplate: React.FC<NewsletterTemplateProps> = ({\n subject,\n preheader,\n title,\n content,\n ctaButton,\n footer,\n}) => {\n return (\n <BaseTemplate\n preview={preheader || subject}\n footer={footer}\n >\n {title && (\n <Heading style={newsletterStyles.heading}>\n {title}\n </Heading>\n )}\n \n <Markdown\n markdownCustomStyles={newsletterStyles.markdown}\n markdownContainerStyles={{\n padding: '0',\n }}\n >\n {content}\n </Markdown>\n \n {ctaButton && (\n <Button\n href={ctaButton.href}\n style={newsletterStyles.button}\n >\n {ctaButton.text}\n </Button>\n )}\n </BaseTemplate>\n )\n}\n\n// Export a function that creates a custom newsletter template\nexport function createNewsletterTemplate(\n customStyles?: Partial<typeof newsletterStyles>\n): React.FC<NewsletterTemplateProps> {\n const mergedStyles = {\n ...newsletterStyles,\n ...customStyles,\n }\n \n return (props: NewsletterTemplateProps) => (\n <BaseTemplate\n preview={props.preheader || props.subject}\n footer={props.footer}\n >\n {props.title && (\n <Heading style={mergedStyles.heading}>\n {props.title}\n </Heading>\n )}\n \n <Markdown\n markdownCustomStyles={mergedStyles.markdown}\n markdownContainerStyles={{\n padding: '0',\n }}\n >\n {props.content}\n </Markdown>\n \n {props.ctaButton && (\n <Button\n href={props.ctaButton.href}\n style={mergedStyles.button}\n >\n {props.ctaButton.text}\n </Button>\n )}\n </BaseTemplate>\n )\n}"],"names":["React","Heading","Button","Markdown","BaseTemplate","newsletterStyles","heading","fontSize","fontWeight","color","margin","markdown","h1","h2","h3","p","lineHeight","a","textDecoration","ul","paddingLeft","ol","li","marginBottom","img","maxWidth","height","blockquote","borderLeft","fontStyle","code","backgroundColor","padding","borderRadius","fontFamily","pre","overflow","button","textAlign","display","width","NewsletterTemplate","subject","preheader","title","content","ctaButton","footer","preview","style","markdownCustomStyles","markdownContainerStyles","href","text","createNewsletterTemplate","customStyles","mergedStyles","props"],"mappings":";AAAA,OAAOA,WAAW,QAAO;AACzB,SACEC,OAAO,EAIPC,MAAM,EACNC,QAAQ,QACH,0BAAyB;AAChC,SAASC,YAAY,QAAoB,iBAAgB;AAmBzD,MAAMC,mBAAmB;IACvBC,SAAS;QACPC,UAAU;QACVC,YAAY;QACZC,OAAO;QACPC,QAAQ;IACV;IACAC,UAAU;QACRC,IAAI;YACFL,UAAU;YACVC,YAAY;YACZC,OAAO;YACPC,QAAQ;QACV;QACAG,IAAI;YACFN,UAAU;YACVC,YAAY;YACZC,OAAO;YACPC,QAAQ;QACV;QACAI,IAAI;YACFP,UAAU;YACVC,YAAY;YACZC,OAAO;YACPC,QAAQ;QACV;QACAK,GAAG;YACDR,UAAU;YACVS,YAAY;YACZP,OAAO;YACPC,QAAQ;QACV;QACAO,GAAG;YACDR,OAAO;YACPS,gBAAgB;QAClB;QACAC,IAAI;YACFC,aAAa;YACbV,QAAQ;QACV;QACAW,IAAI;YACFD,aAAa;YACbV,QAAQ;QACV;QACAY,IAAI;YACFf,UAAU;YACVS,YAAY;YACZP,OAAO;YACPc,cAAc;QAChB;QACAC,KAAK;YACHC,UAAU;YACVC,QAAQ;YACRhB,QAAQ;QACV;QACAiB,YAAY;YACVC,YA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