@betterinternship/core 2.26.1 → 2.26.4
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/dist/lib/email/action.d.ts +5 -0
- package/dist/lib/email/action.js +14 -0
- package/dist/lib/email/action.js.map +1 -0
- package/dist/lib/email/index.d.ts +1 -0
- package/dist/lib/email/index.js +1 -0
- package/dist/lib/email/index.js.map +1 -1
- package/dist/lib/email/preview.d.ts +1 -0
- package/dist/lib/email/preview.js +14 -3
- package/dist/lib/email/preview.js.map +1 -1
- package/dist/lib/email/shell.js +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const escapeHtml = (value) => value
|
|
2
|
+
.replaceAll('&', '&')
|
|
3
|
+
.replaceAll('<', '<')
|
|
4
|
+
.replaceAll('>', '>')
|
|
5
|
+
.replaceAll('"', '"')
|
|
6
|
+
.replaceAll("'", ''');
|
|
7
|
+
export const renderEmailAction = ({ href, label }) => {
|
|
8
|
+
const escapedHref = escapeHtml(href);
|
|
9
|
+
return `<div style="margin:20px 0 0">
|
|
10
|
+
<a href="${escapedHref}" style="display:inline-block;padding:12px 22px;background:#155eef;color:#ffffff;border-radius:8px;text-decoration:none;font-size:14px;font-weight:700">${escapeHtml(label)} →</a>
|
|
11
|
+
<p style="margin:8px 0 0;font-size:11px;line-height:1.45;color:#8a94a8;word-break:break-all">Or copy this link: <a href="${escapedHref}" style="color:#64748b;text-decoration:underline;word-break:break-all">${escapedHref}</a></p>
|
|
12
|
+
</div>`;
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action.js","sourceRoot":"","sources":["../../../lib/email/action.ts"],"names":[],"mappings":"AAKA,MAAM,UAAU,GAAG,CAAC,KAAa,EAAE,EAAE,CACnC,KAAK;KACF,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC;KACxB,UAAU,CAAC,GAAG,EAAE,MAAM,CAAC;KACvB,UAAU,CAAC,GAAG,EAAE,MAAM,CAAC;KACvB,UAAU,CAAC,GAAG,EAAE,QAAQ,CAAC;KACzB,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;AAG9B,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,EAAE,IAAI,EAAE,KAAK,EAAsB,EAAE,EAAE;IACvE,MAAM,WAAW,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;IACrC,OAAO;aACI,WAAW,2JAA2J,UAAU,CAAC,KAAK,CAAC;6HACvE,WAAW,0EAA0E,WAAW;OACtN,CAAC;AACR,CAAC,CAAC"}
|
package/dist/lib/email/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/email/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/email/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC"}
|
|
@@ -1,18 +1,28 @@
|
|
|
1
1
|
import { mkdirSync, writeFileSync } from 'fs';
|
|
2
2
|
import { join } from 'path';
|
|
3
|
+
import { spawnSync } from 'child_process';
|
|
3
4
|
const escapeHtml = (value) => value
|
|
4
5
|
.replaceAll('&', '&')
|
|
5
6
|
.replaceAll('<', '<')
|
|
6
7
|
.replaceAll('>', '>')
|
|
7
8
|
.replaceAll('"', '"')
|
|
8
9
|
.replaceAll("'", ''');
|
|
10
|
+
const isModified = (sourcePath) => {
|
|
11
|
+
if (!sourcePath)
|
|
12
|
+
return false;
|
|
13
|
+
const result = spawnSync('git', ['status', '--porcelain', '--', sourcePath], {
|
|
14
|
+
encoding: 'utf8',
|
|
15
|
+
});
|
|
16
|
+
return result.status === 0 && Boolean(result.stdout.trim());
|
|
17
|
+
};
|
|
9
18
|
export const writeEmailPreviewCatalog = ({ title, previews, outputDirectory, }) => {
|
|
10
19
|
mkdirSync(outputDirectory, { recursive: true });
|
|
11
|
-
const catalogItems = previews.map(({ name, html }, index) => {
|
|
20
|
+
const catalogItems = previews.map(({ name, html, sourcePath }, index) => {
|
|
12
21
|
const filename = `${String(index + 1).padStart(2, '0')}.html`;
|
|
13
22
|
writeFileSync(join(outputDirectory, filename), html);
|
|
14
23
|
const escapedName = escapeHtml(name);
|
|
15
|
-
|
|
24
|
+
const badge = isModified(sourcePath) ? '<span>Updated</span>' : '';
|
|
25
|
+
return `<section><h2>${escapedName}${badge}</h2><iframe src="${filename}" title="${escapedName}"></iframe></section>`;
|
|
16
26
|
});
|
|
17
27
|
const escapedTitle = escapeHtml(title);
|
|
18
28
|
const catalogPath = join(outputDirectory, 'index.html');
|
|
@@ -26,7 +36,8 @@ export const writeEmailPreviewCatalog = ({ title, previews, outputDirectory, })
|
|
|
26
36
|
h1 { margin: 0 0 8px; }
|
|
27
37
|
p { margin: 0 0 32px; color: #5c6880; }
|
|
28
38
|
section { max-width: 680px; margin: 0 auto 36px; }
|
|
29
|
-
h2 { font-size: 16px; margin: 0 0 10px; }
|
|
39
|
+
h2 { display: flex; align-items: center; gap: 8px; font-size: 16px; margin: 0 0 10px; }
|
|
40
|
+
h2 span { padding: 3px 7px; border-radius: 999px; background: #dbeafe; color: #1d4ed8; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
|
|
30
41
|
iframe { width: 100%; height: 760px; border: 1px solid #d7deea; background: #fff; border-radius: 8px; }
|
|
31
42
|
</style>
|
|
32
43
|
</head>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preview.js","sourceRoot":"","sources":["../../../lib/email/preview.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAA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,UAAU,EAAE,EAAE,KAAK,EAAE,EAAE;QACtE,MAAM,QAAQ,GAAG,GAAG,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;QAC9D,aAAa,CAAC,IAAI,CAAC,eAAe,EAAE,QAAQ,CAAC,EAAE,IAAI,CAAC,CAAC;QACrD,MAAM,WAAW,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;QACrC,MAAM,KAAK,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC,EAAE,CAAC;QACnE,OAAO,gBAAgB,WAAW,GAAG,KAAK,qBAAqB,QAAQ,YAAY,WAAW,uBAAuB,CAAC;IACxH,CAAC,CAAC,CAAC;IAEH,MAAM,YAAY,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;IACvC,MAAM,WAAW,GAAG,IAAI,CAAC,eAAe,EAAE,YAAY,CAAC,CAAC;IACxD,aAAa,CACX,WAAW,EACX;;;;aAIS,YAAY;;;;;;;;;;;;UAYf,YAAY;;MAEhB,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC;;QAEzB,CACL,CAAC;IAEF,OAAO,WAAW,CAAC;AACrB,CAAC,CAAC"}
|
package/dist/lib/email/shell.js
CHANGED
|
@@ -18,7 +18,7 @@ export const renderEmailShell = ({ logoUrl, heading, bodyHtml, footerHtml = 'Thi
|
|
|
18
18
|
</div>
|
|
19
19
|
|
|
20
20
|
<div style="width:100%;max-width:520px;margin:0 auto;background:#ffffff;border:1px solid #e4e8f0;border-radius:14px;overflow:hidden">
|
|
21
|
-
<div style="padding:34px 32px 36px">
|
|
21
|
+
<div style="padding:34px 32px 36px;font-size:15px;line-height:1.7;color:#4b5872">
|
|
22
22
|
${bodyHtml}
|
|
23
23
|
</div>
|
|
24
24
|
|