@react-email/preview-server 4.1.0-canary.9 → 4.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/.next/BUILD_ID +1 -1
- package/.next/app-build-manifest.json +32 -32
- package/.next/app-path-routes-manifest.json +1 -1
- package/.next/build-manifest.json +14 -14
- package/.next/diagnostics/framework.json +1 -1
- package/.next/next-minimal-server.js.nft.json +1 -1
- package/.next/next-server.js.nft.json +1 -1
- package/.next/prerender-manifest.json +3 -3
- package/.next/required-server-files.json +5 -5
- package/.next/server/app/_not-found/page.js +1 -1
- package/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/favicon.ico/route.js +1 -1
- package/.next/server/app/favicon.ico/route.js.nft.json +1 -1
- package/.next/server/app/page.js +1 -1
- package/.next/server/app/page.js.nft.json +1 -1
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app/preview/[...slug]/page.js +356 -174
- package/.next/server/app/preview/[...slug]/page.js.nft.json +1 -1
- package/.next/server/app/preview/[...slug]/page_client-reference-manifest.js +1 -1
- package/.next/server/app-paths-manifest.json +1 -1
- package/.next/server/chunks/277.js +1 -0
- package/.next/server/chunks/{879.js → 532.js} +7 -7
- package/.next/server/chunks/550.js +6 -0
- package/.next/server/chunks/834.js +15 -0
- package/.next/server/chunks/851.js +20 -0
- package/.next/server/chunks/905.js +1 -0
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/next-font-manifest.js +1 -1
- package/.next/server/next-font-manifest.json +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/server/pages/_app.js +1 -1
- package/.next/server/pages/_app.js.nft.json +1 -1
- package/.next/server/pages/_document.js +1 -1
- package/.next/server/pages/_document.js.nft.json +1 -1
- package/.next/server/pages/_error.js +1 -1
- package/.next/server/pages/_error.js.nft.json +1 -1
- package/.next/server/server-reference-manifest.js +1 -1
- package/.next/server/server-reference-manifest.json +1 -1
- package/.next/static/{pT9c18D6E8gNsHAfpxTUA → K0QONxIGIQiCTm2sc3hH-}/_buildManifest.js +1 -1
- package/.next/static/chunks/343-0aa226f42148dce4.js +1 -0
- package/.next/static/chunks/353-5e7d05b120b2e25f.js +1 -0
- package/.next/static/chunks/445-576b0c51a037fe4d.js +1 -0
- package/.next/static/chunks/483-03a4518fac962ed2.js +1 -0
- package/.next/static/chunks/624-9d1650c8211771cd.js +1 -0
- package/.next/static/chunks/755-01456539a6894956.js +1 -0
- package/.next/static/chunks/app/_not-found/{page-aee2c5619f94a965.js → page-e9c9ee8e737ce3f8.js} +1 -1
- package/.next/static/chunks/app/layout-a5cce4132e5e62fa.js +1 -0
- package/.next/static/chunks/app/page-88bd6f22b758e157.js +1 -0
- package/.next/static/chunks/app/preview/[...slug]/page-65586b6a48695068.js +1 -0
- package/.next/static/chunks/{04c799b8-f2be86d6e75dbf29.js → e8809b48-6a73b3f51ba71e9c.js} +1 -1
- package/.next/static/chunks/{f33a14d2-188715a58266ac15.js → f33a14d2-13f6de3d216cf617.js} +1 -1
- package/.next/static/chunks/framework-4f208795521d076c.js +1 -0
- package/.next/static/chunks/main-0000d0a5ac74fec0.js +1 -0
- package/.next/static/chunks/main-app-5d960817b9651318.js +1 -0
- package/.next/static/chunks/pages/_app-550e3587fddcaa19.js +1 -0
- package/.next/static/chunks/pages/_error-870af0ad63b0e49e.js +1 -0
- package/.next/static/chunks/{webpack-c09dcf4c47767be8.js → webpack-fc6f324c4c88f6e3.js} +1 -1
- package/.next/static/css/48dcea18d820a298.css +3 -0
- package/.next/trace +27 -27
- package/.next/types/app/layout.ts +1 -1
- package/.next/types/app/page.ts +1 -1
- package/.next/types/app/preview/[...slug]/page.ts +1 -1
- package/CHANGELOG.md +27 -0
- package/package.json +6 -4
- package/readme.md +35 -0
- package/scripts/dev.mts +47 -0
- package/scripts/{fill-caniemail-data.mjs → fill-caniemail-data.mts} +0 -5
- package/scripts/seed.mts +21 -0
- package/scripts/utils/default-seed/auth/account-confirmation.tsx +68 -0
- package/scripts/utils/default-seed/auth/forgot-password.tsx +71 -0
- package/scripts/utils/default-seed/communications/payment-overdue.tsx +82 -0
- package/scripts/utils/default-seed/communications/team-invite.tsx +78 -0
- package/scripts/utils/default-seed/communications/webhooks-failed.tsx +89 -0
- package/scripts/utils/default-seed/feedback-request.tsx +78 -0
- package/scripts/utils/default-seed/marketing/changelog.tsx +98 -0
- package/src/actions/email-validation/__snapshots__/check-images.spec.tsx.snap +84 -0
- package/src/actions/email-validation/check-images.spec.tsx +1 -80
- package/src/app/layout.tsx +2 -2
- package/src/app/preview/[...slug]/preview.tsx +1 -1
- package/src/components/code-container.tsx +3 -1
- package/src/components/code.tsx +60 -59
- package/src/components/logo.tsx +68 -63
- package/src/components/send.tsx +8 -5
- package/src/components/shell.tsx +4 -1
- package/src/components/sidebar/file-tree-directory-children.tsx +4 -1
- package/src/components/toolbar.tsx +9 -5
- package/src/contexts/emails.tsx +2 -2
- package/src/contexts/preview.tsx +2 -2
- package/src/hooks/use-email-rendering-result.ts +2 -2
- package/src/utils/__snapshots__/get-email-component.spec.ts.snap +183 -1
- package/src/utils/caniemail/ast/get-used-style-properties.ts +1 -0
- package/src/utils/contains-email-template.spec.ts +12 -0
- package/src/utils/contains-email-template.ts +26 -9
- package/src/utils/get-email-component.spec.ts +3 -0
- package/.next/server/chunks/200.js +0 -1
- package/.next/server/chunks/3.js +0 -15
- package/.next/server/chunks/784.js +0 -6
- package/.next/server/chunks/823.js +0 -1
- package/.next/server/chunks/915.js +0 -20
- package/.next/static/chunks/188-e278e5f1e9c4067e.js +0 -1
- package/.next/static/chunks/336-0767fdc0ff1ceaa1.js +0 -1
- package/.next/static/chunks/551-d9ce0a77591e6bf7.js +0 -1
- package/.next/static/chunks/651-337b0388fdb8c85c.js +0 -1
- package/.next/static/chunks/713-6c7607cb54b8278e.js +0 -1
- package/.next/static/chunks/834-e77d5196a2631efe.js +0 -1
- package/.next/static/chunks/app/layout-4403d8068fbec772.js +0 -1
- package/.next/static/chunks/app/page-ddc5b5b5b8d2de0e.js +0 -1
- package/.next/static/chunks/app/preview/[...slug]/page-873416b81678fe6b.js +0 -1
- package/.next/static/chunks/framework-f71c687711cb40cc.js +0 -1
- package/.next/static/chunks/main-697e2f65b52ad05c.js +0 -1
- package/.next/static/chunks/main-app-deb9839bdc2bcbd4.js +0 -1
- package/.next/static/chunks/pages/_app-2e335329c12ac3e7.js +0 -1
- package/.next/static/chunks/pages/_error-73094c2ebe868f44.js +0 -1
- package/.next/static/css/692fd92effde156a.css +0 -3
- /package/.next/static/{pT9c18D6E8gNsHAfpxTUA → K0QONxIGIQiCTm2sc3hH-}/_ssgManifest.js +0 -0
- /package/scripts/{build-preview-server.mjs → build-preview-server.mts} +0 -0
|
@@ -1,3 +1,185 @@
|
|
|
1
1
|
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
2
|
|
|
3
|
-
exports[`getEmailComponent() > with a demo email template 1`] = `
|
|
3
|
+
exports[`getEmailComponent() > with a demo email template 1`] = `
|
|
4
|
+
"<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
5
|
+
<html dir="ltr" lang="en">
|
|
6
|
+
<head>
|
|
7
|
+
<link rel="preload" as="image" href="/static/vercel-logo.png" />
|
|
8
|
+
<link rel="preload" as="image" href="/static/vercel-user.png" />
|
|
9
|
+
<link rel="preload" as="image" href="/static/vercel-arrow.png" />
|
|
10
|
+
<link rel="preload" as="image" href="/static/vercel-team.png" />
|
|
11
|
+
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
|
|
12
|
+
<meta name="x-apple-disable-message-reformatting" />
|
|
13
|
+
<!--$-->
|
|
14
|
+
</head>
|
|
15
|
+
<body
|
|
16
|
+
style='margin-left:auto;margin-right:auto;margin-top:auto;margin-bottom:auto;background-color:rgb(255,255,255);padding-left:0.5rem;padding-right:0.5rem;font-family:ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"'>
|
|
17
|
+
<div
|
|
18
|
+
style="display:none;overflow:hidden;line-height:1px;opacity:0;max-height:0;max-width:0"
|
|
19
|
+
data-skip-in-text="true">
|
|
20
|
+
Join Alan on Vercel
|
|
21
|
+
<div>
|
|
22
|
+
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
<table
|
|
26
|
+
align="center"
|
|
27
|
+
width="100%"
|
|
28
|
+
border="0"
|
|
29
|
+
cellpadding="0"
|
|
30
|
+
cellspacing="0"
|
|
31
|
+
role="presentation"
|
|
32
|
+
style="margin-left:auto;margin-right:auto;margin-top:40px;margin-bottom:40px;max-width:465px;border-radius:0.25rem;border-width:1px;border-color:rgb(234,234,234);border-style:solid;padding:20px">
|
|
33
|
+
<tbody>
|
|
34
|
+
<tr style="width:100%">
|
|
35
|
+
<td>
|
|
36
|
+
<table
|
|
37
|
+
align="center"
|
|
38
|
+
width="100%"
|
|
39
|
+
border="0"
|
|
40
|
+
cellpadding="0"
|
|
41
|
+
cellspacing="0"
|
|
42
|
+
role="presentation"
|
|
43
|
+
style="margin-top:32px">
|
|
44
|
+
<tbody>
|
|
45
|
+
<tr>
|
|
46
|
+
<td>
|
|
47
|
+
<img
|
|
48
|
+
alt="Vercel Logo"
|
|
49
|
+
height="37"
|
|
50
|
+
src="/static/vercel-logo.png"
|
|
51
|
+
style="margin-left:auto;margin-right:auto;margin-top:0px;margin-bottom:0px;display:block;outline:none;border:none;text-decoration:none"
|
|
52
|
+
width="40" />
|
|
53
|
+
</td>
|
|
54
|
+
</tr>
|
|
55
|
+
</tbody>
|
|
56
|
+
</table>
|
|
57
|
+
<h1
|
|
58
|
+
style="margin-left:0px;margin-right:0px;margin-top:30px;margin-bottom:30px;padding:0px;text-align:center;font-weight:400;font-size:24px;color:rgb(0,0,0)">
|
|
59
|
+
Join <strong>Enigma</strong> on <strong>Vercel</strong>
|
|
60
|
+
</h1>
|
|
61
|
+
<p
|
|
62
|
+
style="font-size:14px;color:rgb(0,0,0);line-height:24px;margin-top:16px;margin-bottom:16px">
|
|
63
|
+
Hello
|
|
64
|
+
<!-- -->alanturing<!-- -->,
|
|
65
|
+
</p>
|
|
66
|
+
<p
|
|
67
|
+
style="font-size:14px;color:rgb(0,0,0);line-height:24px;margin-top:16px;margin-bottom:16px">
|
|
68
|
+
<strong>Alan</strong> (<a
|
|
69
|
+
href="mailto:alan.turing@example.com"
|
|
70
|
+
style="color:rgb(37,99,235);text-decoration-line:none"
|
|
71
|
+
target="_blank"
|
|
72
|
+
>alan.turing@example.com</a
|
|
73
|
+
>) has invited you to the <strong>Enigma</strong> team on<!-- -->
|
|
74
|
+
<strong>Vercel</strong>.
|
|
75
|
+
</p>
|
|
76
|
+
<table
|
|
77
|
+
align="center"
|
|
78
|
+
width="100%"
|
|
79
|
+
border="0"
|
|
80
|
+
cellpadding="0"
|
|
81
|
+
cellspacing="0"
|
|
82
|
+
role="presentation">
|
|
83
|
+
<tbody>
|
|
84
|
+
<tr>
|
|
85
|
+
<td>
|
|
86
|
+
<table
|
|
87
|
+
align="center"
|
|
88
|
+
width="100%"
|
|
89
|
+
border="0"
|
|
90
|
+
cellpadding="0"
|
|
91
|
+
cellspacing="0"
|
|
92
|
+
role="presentation">
|
|
93
|
+
<tbody style="width:100%">
|
|
94
|
+
<tr style="width:100%">
|
|
95
|
+
<td align="right" data-id="__react-email-column">
|
|
96
|
+
<img
|
|
97
|
+
alt="alanturing's profile picture"
|
|
98
|
+
height="64"
|
|
99
|
+
src="/static/vercel-user.png"
|
|
100
|
+
style="border-radius:9999px;display:block;outline:none;border:none;text-decoration:none"
|
|
101
|
+
width="64" />
|
|
102
|
+
</td>
|
|
103
|
+
<td align="center" data-id="__react-email-column">
|
|
104
|
+
<img
|
|
105
|
+
alt="Arrow indicating invitation"
|
|
106
|
+
height="9"
|
|
107
|
+
src="/static/vercel-arrow.png"
|
|
108
|
+
style="display:block;outline:none;border:none;text-decoration:none"
|
|
109
|
+
width="12" />
|
|
110
|
+
</td>
|
|
111
|
+
<td align="left" data-id="__react-email-column">
|
|
112
|
+
<img
|
|
113
|
+
alt="Enigma team logo"
|
|
114
|
+
height="64"
|
|
115
|
+
src="/static/vercel-team.png"
|
|
116
|
+
style="border-radius:9999px;display:block;outline:none;border:none;text-decoration:none"
|
|
117
|
+
width="64" />
|
|
118
|
+
</td>
|
|
119
|
+
</tr>
|
|
120
|
+
</tbody>
|
|
121
|
+
</table>
|
|
122
|
+
</td>
|
|
123
|
+
</tr>
|
|
124
|
+
</tbody>
|
|
125
|
+
</table>
|
|
126
|
+
<table
|
|
127
|
+
align="center"
|
|
128
|
+
width="100%"
|
|
129
|
+
border="0"
|
|
130
|
+
cellpadding="0"
|
|
131
|
+
cellspacing="0"
|
|
132
|
+
role="presentation"
|
|
133
|
+
style="margin-top:32px;margin-bottom:32px;text-align:center">
|
|
134
|
+
<tbody>
|
|
135
|
+
<tr>
|
|
136
|
+
<td>
|
|
137
|
+
<a
|
|
138
|
+
href="https://vercel.com"
|
|
139
|
+
style="border-radius:0.25rem;background-color:rgb(0,0,0);padding-left:20px;padding-right:20px;padding-top:12px;padding-bottom:12px;text-align:center;font-weight:600;font-size:12px;color:rgb(255,255,255);text-decoration-line:none;line-height:100%;text-decoration:none;display:inline-block;max-width:100%;mso-padding-alt:0px"
|
|
140
|
+
target="_blank"
|
|
141
|
+
><span
|
|
142
|
+
><!--[if mso]><i style="mso-font-width:500%;mso-text-raise:18" hidden>  </i><![endif]--></span
|
|
143
|
+
><span
|
|
144
|
+
style="max-width:100%;display:inline-block;line-height:120%;mso-padding-alt:0px;mso-text-raise:9px"
|
|
145
|
+
>Join the team</span
|
|
146
|
+
><span
|
|
147
|
+
><!--[if mso]><i style="mso-font-width:500%" hidden>  ​</i><![endif]--></span
|
|
148
|
+
></a
|
|
149
|
+
>
|
|
150
|
+
</td>
|
|
151
|
+
</tr>
|
|
152
|
+
</tbody>
|
|
153
|
+
</table>
|
|
154
|
+
<p
|
|
155
|
+
style="font-size:14px;color:rgb(0,0,0);line-height:24px;margin-top:16px;margin-bottom:16px">
|
|
156
|
+
or copy and paste this URL into your browser:<!-- -->
|
|
157
|
+
<a
|
|
158
|
+
href="https://vercel.com"
|
|
159
|
+
style="color:rgb(37,99,235);text-decoration-line:none"
|
|
160
|
+
target="_blank"
|
|
161
|
+
>https://vercel.com</a
|
|
162
|
+
>
|
|
163
|
+
</p>
|
|
164
|
+
<hr
|
|
165
|
+
style="margin-left:0px;margin-right:0px;margin-top:26px;margin-bottom:26px;width:100%;border-width:1px;border-color:rgb(234,234,234);border-style:solid;border:none;border-top:1px solid #eaeaea" />
|
|
166
|
+
<p
|
|
167
|
+
style="color:rgb(102,102,102);font-size:12px;line-height:24px;margin-top:16px;margin-bottom:16px">
|
|
168
|
+
This invitation was intended for<!-- -->
|
|
169
|
+
<span style="color:rgb(0,0,0)">alanturing</span>. This invite was
|
|
170
|
+
sent from <span style="color:rgb(0,0,0)">204.13.186.218</span>
|
|
171
|
+
<!-- -->located in<!-- -->
|
|
172
|
+
<span style="color:rgb(0,0,0)">São Paulo, Brazil</span>. If you
|
|
173
|
+
were not expecting this invitation, you can ignore this email. If
|
|
174
|
+
you are concerned about your account's safety, please reply
|
|
175
|
+
to this email to get in touch with us.
|
|
176
|
+
</p>
|
|
177
|
+
</td>
|
|
178
|
+
</tr>
|
|
179
|
+
</tbody>
|
|
180
|
+
</table>
|
|
181
|
+
<!--/$-->
|
|
182
|
+
</body>
|
|
183
|
+
</html>
|
|
184
|
+
"
|
|
185
|
+
`;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/** biome-ignore-all lint/nursery/noNestedComponentDefinitions: There are no components here, just visitor functions */
|
|
1
2
|
import traverse from '@babel/traverse';
|
|
2
3
|
import type { AST } from '../../../actions/email-validation/check-compatibility';
|
|
3
4
|
import { generateTailwindCssRules } from '../tailwind/generate-tailwind-rules';
|
|
@@ -51,6 +51,13 @@ describe('containsEmailTemplate()', () => {
|
|
|
51
51
|
},
|
|
52
52
|
],
|
|
53
53
|
},
|
|
54
|
+
{
|
|
55
|
+
absolutePath: '/fake/path/emails/first/second',
|
|
56
|
+
directoryName: 'first/second',
|
|
57
|
+
relativePath: 'first/second',
|
|
58
|
+
emailFilenames: ['email'],
|
|
59
|
+
subDirectories: [],
|
|
60
|
+
},
|
|
54
61
|
{
|
|
55
62
|
absolutePath: '/fake/path/emails/newsletters',
|
|
56
63
|
directoryName: 'newsletters',
|
|
@@ -104,6 +111,11 @@ describe('containsEmailTemplate()', () => {
|
|
|
104
111
|
},
|
|
105
112
|
],
|
|
106
113
|
};
|
|
114
|
+
|
|
115
|
+
it('should work with collapsed email directory', () => {
|
|
116
|
+
expect(containsEmailTemplate('first/second/email', directory)).toBe(true);
|
|
117
|
+
});
|
|
118
|
+
|
|
107
119
|
it('should work with email inside a single sub directory', () => {
|
|
108
120
|
expect(containsEmailTemplate('welcome/koala-welcome', directory)).toBe(
|
|
109
121
|
true,
|
|
@@ -14,20 +14,37 @@ export const containsEmailTemplate = (
|
|
|
14
14
|
relativeEmailPath: string,
|
|
15
15
|
directory: EmailsDirectory,
|
|
16
16
|
) => {
|
|
17
|
-
const
|
|
17
|
+
const emailPathSegments = relativeEmailPath
|
|
18
18
|
.replace(directory.relativePath, '')
|
|
19
19
|
.split('/')
|
|
20
20
|
.filter(Boolean);
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
|
|
22
|
+
return containsEmailPathSegments(emailPathSegments, directory);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const containsEmailPathSegments = (
|
|
26
|
+
relativeEmailSegments: string[],
|
|
27
|
+
directory: EmailsDirectory,
|
|
28
|
+
) => {
|
|
29
|
+
if (relativeEmailSegments.length === 1) {
|
|
30
|
+
const emailFilename = removeFilenameExtension(relativeEmailSegments[0]!);
|
|
23
31
|
return directory.emailFilenames.includes(emailFilename);
|
|
24
32
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
33
|
+
|
|
34
|
+
const remainingPath = relativeEmailSegments.join('/');
|
|
35
|
+
|
|
36
|
+
for (const subDirectory of directory.subDirectories) {
|
|
37
|
+
if (remainingPath.startsWith(subDirectory.directoryName)) {
|
|
38
|
+
const matchedSegments = subDirectory.directoryName
|
|
39
|
+
.split('/')
|
|
40
|
+
.filter(Boolean).length;
|
|
41
|
+
|
|
42
|
+
return containsEmailPathSegments(
|
|
43
|
+
relativeEmailSegments.slice(matchedSegments),
|
|
44
|
+
subDirectory,
|
|
45
|
+
);
|
|
46
|
+
}
|
|
30
47
|
}
|
|
31
48
|
|
|
32
|
-
return
|
|
49
|
+
return false;
|
|
33
50
|
};
|