@tangle-network/agent-app 0.59.0 → 0.59.2
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/app-auth/index.js +1 -1
- package/dist/{chunk-YPPVNQOC.js → chunk-TLVRBD2M.js} +19 -8
- package/dist/chunk-TLVRBD2M.js.map +1 -0
- package/dist/email/index.d.ts +3 -0
- package/dist/email/index.js +1 -1
- package/dist/email/layout.d.ts +11 -1
- package/dist/email/palette.d.ts +0 -2
- package/package.json +1 -1
- package/dist/chunk-YPPVNQOC.js.map +0 -1
package/dist/app-auth/index.js
CHANGED
|
@@ -29,7 +29,6 @@ var EMAIL_PALETTE = {
|
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
31
|
var EMAIL_FONT_STACK = "Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Helvetica, Arial, sans-serif";
|
|
32
|
-
var TANGLE_POSTAL_ADDRESS = "Tangle Technologies, Inc., 3740 South Ocean Blvd, #1407, Highland Beach, FL 33487, USA";
|
|
33
32
|
|
|
34
33
|
// src/email/layout.ts
|
|
35
34
|
var MARK_CONTENT_ID = "tangle-mark";
|
|
@@ -85,12 +84,19 @@ function paragraph(text, margin) {
|
|
|
85
84
|
function link(label, href, style) {
|
|
86
85
|
return `<a class="t-link" href="${escapeHtml(href)}" style="color:${L.accentText};text-decoration:none;${style}">${escapeHtml(label)}</a>`;
|
|
87
86
|
}
|
|
87
|
+
function productSuffix(product) {
|
|
88
|
+
return product.name.replace(/^Tangle\s+/i, "");
|
|
89
|
+
}
|
|
88
90
|
function header(product) {
|
|
91
|
+
const type = `font-family:${FONT};font-size:17px;line-height:20px;letter-spacing:-0.01em;color:${L.ink}`;
|
|
89
92
|
return [
|
|
90
93
|
'<table role="presentation" cellpadding="0" cellspacing="0" border="0">',
|
|
91
94
|
"<tr>",
|
|
92
|
-
`<td style="padding:0 10px 0 0;vertical-align:middle"><img src="cid:${MARK_CONTENT_ID}" width="28" height="28" alt="
|
|
93
|
-
`<td class="t-ink" style="vertical-align:middle;
|
|
95
|
+
`<td style="padding:0 10px 0 0;vertical-align:middle"><img src="cid:${MARK_CONTENT_ID}" width="28" height="28" alt="" style="display:block;width:28px;height:28px;border:0;outline:none;text-decoration:none"></td>`,
|
|
96
|
+
`<td class="t-ink" style="vertical-align:middle;white-space:nowrap;${type}">`,
|
|
97
|
+
`<span class="t-ink" style="${type};font-weight:700">Tangle</span>`,
|
|
98
|
+
`<span class="t-ink" style="${type};font-weight:500"> ${escapeHtml(productSuffix(product))}</span>`,
|
|
99
|
+
"</td>",
|
|
94
100
|
"</tr>",
|
|
95
101
|
"</table>"
|
|
96
102
|
].join("");
|
|
@@ -147,9 +153,14 @@ function footerLines(footer, product) {
|
|
|
147
153
|
escapeHtml(where),
|
|
148
154
|
escapeHtml(footer.reason),
|
|
149
155
|
...manage ? [link("Manage notifications", manage, "text-decoration:underline")] : [],
|
|
150
|
-
escapeHtml(
|
|
156
|
+
...footer.postalAddress ? [escapeHtml(footer.postalAddress)] : []
|
|
157
|
+
];
|
|
158
|
+
const text = [
|
|
159
|
+
where,
|
|
160
|
+
footer.reason,
|
|
161
|
+
...manage ? [`Manage notifications: ${manage}`] : [],
|
|
162
|
+
...footer.postalAddress ? [footer.postalAddress] : []
|
|
151
163
|
];
|
|
152
|
-
const text = [where, footer.reason, ...manage ? [`Manage notifications: ${manage}`] : [], TANGLE_POSTAL_ADDRESS];
|
|
153
164
|
return { html, text };
|
|
154
165
|
}
|
|
155
166
|
var PREHEADER_SPACER = "͏‌ ".repeat(40);
|
|
@@ -199,7 +210,7 @@ ${STYLE}
|
|
|
199
210
|
].join("\n");
|
|
200
211
|
}
|
|
201
212
|
function renderText(content, product) {
|
|
202
|
-
const blocks = [product
|
|
213
|
+
const blocks = [`Tangle ${productSuffix(product)}`, content.title, ...content.paragraphs];
|
|
203
214
|
if (content.items && content.items.length > 0) {
|
|
204
215
|
blocks.push(content.items.map((item) => {
|
|
205
216
|
const lines = [`- ${item.title}`];
|
|
@@ -385,7 +396,7 @@ function lintEmailHtml(html) {
|
|
|
385
396
|
}
|
|
386
397
|
}
|
|
387
398
|
for (const img of tags(visible, "img")) {
|
|
388
|
-
if (
|
|
399
|
+
if (attribute(img, "alt") === null) issue("image", `Image without alt text: ${img.slice(0, 80)}`);
|
|
389
400
|
if (!attribute(img, "width") || !attribute(img, "height")) issue("image", `Image without width and height: ${img.slice(0, 80)}`);
|
|
390
401
|
const src = attribute(img, "src") ?? "";
|
|
391
402
|
if (!/^(?:https:|cid:)/.test(src)) issue("image", `Image source must be https: or cid: (${src.slice(0, 40)})`);
|
|
@@ -410,4 +421,4 @@ export {
|
|
|
410
421
|
noticeEmail,
|
|
411
422
|
lintEmailHtml
|
|
412
423
|
};
|
|
413
|
-
//# sourceMappingURL=chunk-
|
|
424
|
+
//# sourceMappingURL=chunk-TLVRBD2M.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/email/mark.generated.ts","../src/email/palette.ts","../src/email/layout.ts","../src/email/templates.ts","../src/email/lint.ts"],"sourcesContent":["// GENERATED by scripts/email-mark.mjs from @tangle-network/brand TangleKnot; do not edit.\n/** The Tangle knot as a 84px transparent PNG (base64), shown at 28px in email headers. */\nexport const TANGLE_MARK_PNG_BASE64 =\n 'iVBORw0KGgoAAAANSUhEUgAAAFQAAABUCAYAAAAcaxDBAAAQAElEQVR4nOxcDZBV1X3//8+9971dVvkwEhR1GuvEatIY09hmOklTCU2bMQYnH3ZMTAmRZRdpqIAYgV3Iy35CgAUEBBGcBNskliSmTZqPjtox6dhJaGY61NFGpfEDSBRBgbjsvnfv+fd/P86959x73+5b9r26mdm/Luede+/5uP/zO//z/zjnCpikupKASaorTTK0zjTJ0DrTJEPrTJMMrTNNMrTOZMM4qWuxewsBXsVDcxEBzSQUBQAJ4VhxilHq/6sPHyY/SU+NIeYriFw6TMMnMC6Rfj5oFVVrOfWh+Wx0zUWiEyT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n","/**\n * The Brand roles the email layout paints with, as literal hex. Email clients\n * cannot read CSS variables, and importing `@tangle-network/brand` at runtime\n * would load React into a server-only renderer, so the values live here and\n * `tests/email/palette.test.ts` fails when they drift from Brand's `palettes`.\n */\nexport const EMAIL_PALETTE = {\n light: {\n canvas: '#eceef3',\n card: '#ffffff',\n well: '#f6f7fa',\n hairline: '#c7c6d6',\n ink: '#2d2d2d',\n inkSecondary: '#3f3f3f',\n inkMuted: '#4c4c4c',\n accent: '#4c3fc5',\n onAccent: '#ffffff',\n accentText: '#3c32e9',\n },\n dark: {\n canvas: '#0a0a14',\n card: '#191826',\n well: '#12111f',\n hairline: '#2a293d',\n ink: '#e6e6e6',\n inkSecondary: '#c7c7c7',\n inkMuted: '#b5b5b5',\n accent: '#4c3fc5',\n onAccent: '#ffffff',\n accentText: '#a5b4fc',\n },\n} as const\n\n/**\n * Brand's `--font-sans` stack with the system faces email clients actually\n * have. No client used for this mail loads web fonts reliably, so Inter shows\n * only where it is installed and the platform UI face carries the rest.\n */\nexport const EMAIL_FONT_STACK =\n \"Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Helvetica, Arial, sans-serif\"\n","import { TANGLE_MARK_PNG_BASE64 } from './mark.generated'\nimport { EMAIL_FONT_STACK, EMAIL_PALETTE } from './palette'\n\n/** The app an email comes from. */\nexport interface EmailProduct {\n /**\n * The product name, e.g. `GTM Agent`. The header reads `Tangle GTM Agent`;\n * subjects and the sender use the name alone. A name that already starts\n * with `Tangle` (`Tangle Sandbox`) is not doubled.\n */\n name: string\n /** The app's absolute origin; app-relative links resolve against it. */\n url: string\n}\n\n/** Why the recipient got the email and where they control it. */\nexport interface EmailFooter {\n /** The workspace the email concerns. */\n workspaceName?: string\n /** One sentence, e.g. `You own this workspace.` */\n reason: string\n /** Where the recipient changes which emails they get; absolute or app-relative. */\n manageUrl?: string\n /**\n * The sender's postal address, for marketing mail such as a digest. Leave it\n * unset on transactional mail (approvals, invites, sign-in), which does not\n * need one.\n */\n postalAddress?: string\n}\n\n/** A button. `url` is absolute or app-relative. */\nexport interface EmailAction {\n label: string\n url: string\n}\n\n/** One row in the email's list box: an approval request or a digest entry. */\nexport interface EmailItem {\n title: string\n detail?: string\n /** Makes the title a link; absolute or app-relative. */\n url?: string\n}\n\n/** An inline image the HTML references by `cid:`; the mail client must send it with the message. */\nexport interface EmailAttachment {\n filename: string\n /** Base64 file content, the form Resend and SES accept. */\n content: string\n contentType: string\n contentId: string\n}\n\n/** A rendered email, ready for any transport. */\nexport interface EmailMessage {\n subject: string\n /** The inbox preview line. */\n preheader: string\n html: string\n text: string\n /** Pass these through to the mail client; the header mark is one of them. */\n attachments: EmailAttachment[]\n}\n\n/** What a template places in the shared layout. */\ninterface EmailContent {\n subject: string\n preheader: string\n title: string\n paragraphs: readonly string[]\n items?: readonly EmailItem[]\n primary?: EmailAction\n secondary?: EmailAction\n /** Print the primary link under the buttons for clients that strip them. */\n showPrimaryLink?: boolean\n /** A short line under the buttons, e.g. an expiry. */\n note?: string\n footer: EmailFooter\n}\n\nconst MARK_CONTENT_ID = 'tangle-mark'\nconst MARK_ATTACHMENT: EmailAttachment = {\n filename: 'tangle.png',\n content: TANGLE_MARK_PNG_BASE64,\n contentType: 'image/png',\n contentId: MARK_CONTENT_ID,\n}\n\nconst L = EMAIL_PALETTE.light\nconst D = EMAIL_PALETTE.dark\nconst FONT = EMAIL_FONT_STACK\n\n// Inline styles carry the light design; this block only adapts it for clients\n// that honor dark mode or narrow screens. A client that drops <style> still\n// renders the complete light email.\nconst STYLE = `\n@media (prefers-color-scheme: dark) {\n .t-bg { background-color: ${D.canvas} !important; }\n .t-card { background-color: ${D.card} !important; border-color: ${D.hairline} !important; }\n .t-well { background-color: ${D.well} !important; }\n .t-rule { border-color: ${D.hairline} !important; }\n .t-ink { color: ${D.ink} !important; }\n .t-ink2 { color: ${D.inkSecondary} !important; }\n .t-muted { color: ${D.inkMuted} !important; }\n .t-link { color: ${D.accentText} !important; }\n .t-btn2 { border-color: ${D.hairline} !important; }\n}\n@media (max-width: 600px) {\n .t-outer { padding: 20px 8px !important; }\n .t-card { padding: 28px 22px 24px !important; }\n}\n[data-ogsb] .t-bg { background-color: ${D.canvas} !important; }\n[data-ogsb] .t-card { background-color: ${D.card} !important; }\n[data-ogsb] .t-well { background-color: ${D.well} !important; }\n[data-ogsc] .t-ink { color: ${D.ink} !important; }\n[data-ogsc] .t-ink2 { color: ${D.inkSecondary} !important; }\n[data-ogsc] .t-muted { color: ${D.inkMuted} !important; }\n[data-ogsc] .t-link { color: ${D.accentText} !important; }\n`.trim()\n\n/** Escape text for HTML element content and quoted attribute values. */\nfunction escapeHtml(value: string): string {\n return value\n .replace(/&/g, '&')\n .replace(/</g, '<')\n .replace(/>/g, '>')\n .replace(/\"/g, '"')\n .replace(/'/g, ''')\n}\n\n/** An absolute http(s) URL; app-relative paths resolve against the product origin. */\nfunction resolveEmailUrl(url: string, product: EmailProduct): string {\n const resolved = new URL(url, product.url)\n if (resolved.protocol !== 'https:' && resolved.protocol !== 'http:') {\n throw new TypeError(`Email links must be http(s): ${resolved.protocol}`)\n }\n return resolved.toString()\n}\n\n/** `Title — Product`, the one subject shape every Tangle email uses. */\nexport function emailSubject(subject: string, product: EmailProduct): string {\n return `${subject} — ${product.name}`\n}\n\nfunction paragraph(text: string, margin: string): string {\n return `<p class=\"t-ink2\" style=\"margin:${margin};font-family:${FONT};font-size:15px;line-height:24px;color:${L.inkSecondary}\">${escapeHtml(text)}</p>`\n}\n\nfunction link(label: string, href: string, style: string): string {\n return `<a class=\"t-link\" href=\"${escapeHtml(href)}\" style=\"color:${L.accentText};text-decoration:none;${style}\">${escapeHtml(label)}</a>`\n}\n\n/** The product name after the `Tangle` logotype: `GTM Agent`, or `Sandbox` for `Tangle Sandbox`. */\nfunction productSuffix(product: EmailProduct): string {\n return product.name.replace(/^Tangle\\s+/i, '')\n}\n\n// Brand's lockup: the knot, `Tangle` in the logotype's bold, then the product\n// name at a lighter weight, as the product site headers set it.\nfunction header(product: EmailProduct): string {\n const type = `font-family:${FONT};font-size:17px;line-height:20px;letter-spacing:-0.01em;color:${L.ink}`\n return [\n '<table role=\"presentation\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\">',\n '<tr>',\n `<td style=\"padding:0 10px 0 0;vertical-align:middle\"><img src=\"cid:${MARK_CONTENT_ID}\" width=\"28\" height=\"28\" alt=\"\" style=\"display:block;width:28px;height:28px;border:0;outline:none;text-decoration:none\"></td>`,\n `<td class=\"t-ink\" style=\"vertical-align:middle;white-space:nowrap;${type}\">`,\n `<span class=\"t-ink\" style=\"${type};font-weight:700\">Tangle</span>`,\n `<span class=\"t-ink\" style=\"${type};font-weight:500\"> ${escapeHtml(productSuffix(product))}</span>`,\n '</td>',\n '</tr>',\n '</table>',\n ].join('')\n}\n\nfunction items(list: readonly EmailItem[], product: EmailProduct): string {\n const rows = list.map((item, index) => {\n const rule = index === 0 ? '' : `border-top:1px solid ${L.hairline};`\n const title = item.url\n ? link(item.title, resolveEmailUrl(item.url, product), 'font-weight:600')\n : escapeHtml(item.title)\n const detail = item.detail\n ? `<p class=\"t-muted\" style=\"margin:2px 0 0;font-family:${FONT};font-size:13px;line-height:20px;color:${L.inkMuted}\">${escapeHtml(item.detail)}</p>`\n : ''\n return [\n `<tr><td class=\"t-rule\" style=\"padding:14px 16px;${rule}\">`,\n `<p class=\"t-ink\" style=\"margin:0;font-family:${FONT};font-size:15px;line-height:22px;font-weight:600;color:${L.ink}\">${title}</p>`,\n detail,\n '</td></tr>',\n ].join('')\n })\n return [\n `<table role=\"presentation\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" class=\"t-well\" bgcolor=\"${L.well}\" style=\"background-color:${L.well};border-radius:8px;margin:4px 0 8px\">`,\n ...rows,\n '</table>',\n ].join('')\n}\n\nfunction primaryButton(action: EmailAction, href: string): string {\n return [\n `<td bgcolor=\"${L.accent}\" style=\"border-radius:8px;background-color:${L.accent};mso-padding-alt:12px 22px\">`,\n `<a href=\"${escapeHtml(href)}\" style=\"display:inline-block;padding:12px 22px;font-family:${FONT};font-size:15px;line-height:20px;font-weight:600;color:${L.onAccent};text-decoration:none;border-radius:8px\">${escapeHtml(action.label)}</a>`,\n '</td>',\n ].join('')\n}\n\nfunction secondaryButton(action: EmailAction, href: string): string {\n return [\n `<td class=\"t-btn2\" style=\"border:1px solid ${L.hairline};border-radius:8px;mso-padding-alt:11px 21px\">`,\n `<a class=\"t-ink\" href=\"${escapeHtml(href)}\" style=\"display:inline-block;padding:11px 21px;font-family:${FONT};font-size:15px;line-height:20px;font-weight:600;color:${L.ink};text-decoration:none;border-radius:8px\">${escapeHtml(action.label)}</a>`,\n '</td>',\n ].join('')\n}\n\nfunction buttons(content: EmailContent, product: EmailProduct): string {\n const cells: string[] = []\n if (content.primary) cells.push(primaryButton(content.primary, resolveEmailUrl(content.primary.url, product)))\n if (content.secondary) {\n if (cells.length > 0) cells.push('<td style=\"width:10px;font-size:0;line-height:0\"> </td>')\n cells.push(secondaryButton(content.secondary, resolveEmailUrl(content.secondary.url, product)))\n }\n if (cells.length === 0) return ''\n return `<table role=\"presentation\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"margin:20px 0 0\"><tr>${cells.join('')}</tr></table>`\n}\n\nfunction small(html: string, margin: string, size = 13): string {\n return `<p class=\"t-muted\" style=\"margin:${margin};font-family:${FONT};font-size:${size}px;line-height:${size + 7}px;color:${L.inkMuted}\">${html}</p>`\n}\n\nfunction footerLines(footer: EmailFooter, product: EmailProduct): { html: string[]; text: string[] } {\n const where = footer.workspaceName ? `${footer.workspaceName} · ${product.name}` : product.name\n const manage = footer.manageUrl ? resolveEmailUrl(footer.manageUrl, product) : null\n const html = [\n escapeHtml(where),\n escapeHtml(footer.reason),\n ...(manage ? [link('Manage notifications', manage, 'text-decoration:underline')] : []),\n ...(footer.postalAddress ? [escapeHtml(footer.postalAddress)] : []),\n ]\n const text = [\n where,\n footer.reason,\n ...(manage ? [`Manage notifications: ${manage}`] : []),\n ...(footer.postalAddress ? [footer.postalAddress] : []),\n ]\n return { html, text }\n}\n\n// Keeps the body text that follows out of the inbox preview line.\nconst PREHEADER_SPACER = '͏‌ '.repeat(40)\n\nfunction renderHtml(content: EmailContent, product: EmailProduct): string {\n const primaryHref = content.primary ? resolveEmailUrl(content.primary.url, product) : null\n const footer = footerLines(content.footer, product)\n const body = [\n `<h1 class=\"t-ink\" style=\"margin:0 0 12px;font-family:${FONT};font-size:22px;line-height:28px;font-weight:600;letter-spacing:-0.01em;color:${L.ink}\">${escapeHtml(content.title)}</h1>`,\n ...content.paragraphs.map((text) => paragraph(text, '0 0 12px')),\n content.items && content.items.length > 0 ? items(content.items, product) : '',\n buttons(content, product),\n content.showPrimaryLink && primaryHref\n ? small(`Or open this link: ${link(primaryHref, primaryHref, 'word-break:break-all')}`, '20px 0 0')\n : '',\n content.note ? small(escapeHtml(content.note), content.showPrimaryLink ? '8px 0 0' : '20px 0 0') : '',\n ].join('')\n\n return [\n '<!DOCTYPE html>',\n '<html lang=\"en\" xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:o=\"urn:schemas-microsoft-com:office:office\">',\n '<head>',\n '<meta charset=\"utf-8\">',\n '<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">',\n '<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">',\n '<meta name=\"x-apple-disable-message-reformatting\">',\n '<meta name=\"format-detection\" content=\"telephone=no, date=no, address=no, email=no, url=no\">',\n '<meta name=\"color-scheme\" content=\"light dark\">',\n '<meta name=\"supported-color-schemes\" content=\"light dark\">',\n `<title>${escapeHtml(content.subject)}</title>`,\n '<!--[if mso]><noscript><xml><o:OfficeDocumentSettings><o:PixelsPerInch>96</o:PixelsPerInch></o:OfficeDocumentSettings></xml></noscript><![endif]-->',\n `<style>\\n${STYLE}\\n</style>`,\n '</head>',\n `<body class=\"t-bg\" style=\"margin:0;padding:0;width:100%;background-color:${L.canvas};-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%\">`,\n `<div style=\"display:none;font-size:1px;line-height:1px;max-height:0;max-width:0;opacity:0;overflow:hidden;mso-hide:all\">${escapeHtml(content.preheader)}${PREHEADER_SPACER}</div>`,\n `<table role=\"presentation\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" class=\"t-bg\" bgcolor=\"${L.canvas}\" style=\"background-color:${L.canvas}\">`,\n '<tr><td class=\"t-outer\" align=\"center\" style=\"padding:32px 12px\">',\n '<!--[if mso]><table role=\"presentation\" width=\"560\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" align=\"center\"><tr><td><![endif]-->',\n '<table role=\"presentation\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"max-width:560px;margin:0 auto\">',\n `<tr><td style=\"padding:0 4px 20px\">${header(product)}</td></tr>`,\n `<tr><td class=\"t-card\" bgcolor=\"${L.card}\" style=\"background-color:${L.card};border:1px solid ${L.hairline};border-radius:12px;padding:36px 36px 32px\">${body}</td></tr>`,\n `<tr><td style=\"padding:24px 4px 0\">${footer.html.map((line, index) => small(line, index === 0 ? '0' : '4px 0 0', 12)).join('')}</td></tr>`,\n '</table>',\n '<!--[if mso]></td></tr></table><![endif]-->',\n '</td></tr>',\n '</table>',\n '</body>',\n '</html>',\n ].join('\\n')\n}\n\nfunction renderText(content: EmailContent, product: EmailProduct): string {\n const blocks: string[] = [`Tangle ${productSuffix(product)}`, content.title, ...content.paragraphs]\n if (content.items && content.items.length > 0) {\n blocks.push(content.items.map((item) => {\n const lines = [`- ${item.title}`]\n if (item.detail) lines.push(` ${item.detail}`)\n if (item.url) lines.push(` ${resolveEmailUrl(item.url, product)}`)\n return lines.join('\\n')\n }).join('\\n'))\n }\n const actions = [content.primary, content.secondary]\n .filter((action): action is EmailAction => Boolean(action))\n .map((action) => `${action.label}: ${resolveEmailUrl(action.url, product)}`)\n if (actions.length > 0) blocks.push(actions.join('\\n'))\n if (content.note) blocks.push(content.note)\n blocks.push(['--', ...footerLines(content.footer, product).text].join('\\n'))\n return `${blocks.join('\\n\\n')}\\n`\n}\n\n/** Place a template's content in the shared Tangle layout. */\nexport function renderEmail(product: EmailProduct, content: EmailContent): EmailMessage {\n return {\n subject: content.subject,\n preheader: content.preheader,\n html: renderHtml(content, product),\n text: renderText(content, product),\n attachments: [MARK_ATTACHMENT],\n }\n}\n\n/**\n * The HTML with inline images embedded as data URIs, for browser previews and\n * screenshots. Mail clients get `cid:` references and the attachments instead.\n */\nexport function emailPreviewHtml(message: Pick<EmailMessage, 'html' | 'attachments'>): string {\n return message.attachments.reduce(\n (html, attachment) => html.split(`cid:${attachment.contentId}`).join(`data:${attachment.contentType};base64,${attachment.content}`),\n message.html,\n )\n}\n\n/**\n * The From header for an app's mail: `GTM Agent · Tangle <noreply@tangle.tools>`.\n * The product leads because inbox sender columns truncate; `· Tangle` ties\n * every app to the company and the sending domain.\n */\nexport function emailSender(productName: string, address: string): string {\n if (!/^[^\\s<>@]+@[^\\s<>@]+\\.[^\\s<>@]+$/.test(address)) throw new TypeError(`Not an email address: ${address}`)\n const name = /\\bTangle\\b/i.test(productName) ? productName : `${productName} · Tangle`\n return `${name} <${address}>`\n}\n","import {\n emailSubject,\n renderEmail,\n type EmailAction,\n type EmailFooter,\n type EmailItem,\n type EmailMessage,\n type EmailProduct,\n} from './layout'\n\n/** Sentence case to mid-sentence: `Create agent` → `create agent`; acronyms such as `API key` keep their case. */\nfunction midSentence(text: string): string {\n const first = text.split(/\\s/, 1)[0] ?? ''\n if ((first.match(/[A-Z]/g) ?? []).length > 1) return text\n return text.charAt(0).toLowerCase() + text.slice(1)\n}\n\nfunction plural(count: number, one: string, many: string): string {\n return count === 1 ? one : many\n}\n\nfunction day(date: Date): string {\n return date.toLocaleDateString('en-US', { month: 'short', day: 'numeric', year: 'numeric', timeZone: 'UTC' })\n}\n\n/** One action an agent is waiting to run. */\nexport interface ApprovalEmailAction {\n /** What runs, in plain language and sentence case: `Create agent “Quinn”`. */\n summary: string\n /** Where it runs and until when, e.g. `ph0ny · open until Oct 9, 3:40 PM UTC`. */\n detail?: string\n}\n\n/** Input for {@link approvalEmail}. */\nexport interface ApprovalEmailInput {\n /** At least one action, in the order the agent asked. */\n actions: readonly ApprovalEmailAction[]\n /** The conversation the agent paused in. */\n conversation?: string\n /** Opens the decision, e.g. the chat with the approval card. */\n approveUrl: string\n /** Opens the context, e.g. every request waiting in the workspace. */\n reviewUrl: string\n footer: EmailFooter\n}\n\n/**\n * An agent paused until someone approves what it wants to do. Neither button\n * decides anything: link scanners open email links, so both lead to the app,\n * where the signed-in owner approves.\n */\nexport function approvalEmail(product: EmailProduct, input: ApprovalEmailInput): EmailMessage {\n const [first, ...rest] = input.actions\n if (!first) throw new TypeError('approvalEmail needs at least one action')\n const what = rest.length === 0\n ? midSentence(first.summary)\n : `${midSentence(first.summary)} and ${rest.length} more`\n const where = input.conversation ? ` in “${input.conversation}”` : ''\n return renderEmail(product, {\n subject: emailSubject(`Approve: ${what}`, product),\n preheader: `The agent paused${where} until you decide.`,\n title: rest.length === 0 ? 'Approval needed' : `${input.actions.length} approvals needed`,\n paragraphs: [`The agent paused${where} until you decide. Nothing runs until you approve.`],\n items: input.actions.map((action): EmailItem => ({ title: action.summary, ...(action.detail ? { detail: action.detail } : {}) })),\n primary: { label: 'Approve', url: input.approveUrl },\n secondary: { label: 'Review', url: input.reviewUrl },\n footer: input.footer,\n })\n}\n\n/** Input for {@link inviteEmail}. */\nexport interface InviteEmailInput {\n workspaceName: string\n /** Who sent the invitation: a name or an email address. */\n inviter: string\n /** The role the invitation grants, e.g. `editor`. */\n role: string\n acceptUrl: string\n expiresAt: Date\n}\n\n/** Someone invited the recipient to a workspace. */\nexport function inviteEmail(product: EmailProduct, input: InviteEmailInput): EmailMessage {\n const role = input.role.toLowerCase()\n const article = /^[aeiou]/.test(role) ? 'an' : 'a'\n return renderEmail(product, {\n subject: emailSubject(`Join ${input.workspaceName}`, product),\n preheader: `${input.inviter} invited you to ${input.workspaceName}.`,\n title: `Join ${input.workspaceName}`,\n paragraphs: [`${input.inviter} invited you to ${input.workspaceName} on ${product.name} as ${article} ${role}.`],\n primary: { label: 'Accept invitation', url: input.acceptUrl },\n showPrimaryLink: true,\n note: `This invitation expires on ${day(input.expiresAt)}.`,\n footer: {\n workspaceName: input.workspaceName,\n reason: `You received this because ${input.inviter} invited this address.`,\n },\n })\n}\n\n/** Input for {@link digestEmail}. */\nexport interface DigestEmailInput {\n workspaceName: string\n /** The day the digest covers. */\n date: Date\n /** What happened, most important first. */\n items: readonly EmailItem[]\n /** Opens the workspace. */\n openUrl: string\n footer: EmailFooter\n}\n\n/** What happened in a workspace that day. */\nexport function digestEmail(product: EmailProduct, input: DigestEmailInput): EmailMessage {\n const count = input.items.length\n const updates = `${count} ${plural(count, 'update', 'updates')}`\n const date = input.date.toLocaleDateString('en-US', { weekday: 'long', month: 'long', day: 'numeric', timeZone: 'UTC' })\n return renderEmail(product, {\n subject: emailSubject(`${input.workspaceName}: ${updates}`, product),\n preheader: input.items[0]?.title ?? `Nothing new in ${input.workspaceName}.`,\n title: `What happened in ${input.workspaceName}`,\n paragraphs: [count === 0 ? `Nothing new on ${date}.` : `${updates} on ${date}.`],\n items: input.items,\n primary: { label: `Open ${product.name}`, url: input.openUrl },\n footer: input.footer,\n })\n}\n\n/** Input for {@link noticeEmail}. */\nexport interface NoticeEmailInput {\n /** Short; the product name is appended. */\n subject: string\n title: string\n /** One or two short paragraphs. */\n body: string | readonly string[]\n action?: EmailAction\n secondaryAction?: EmailAction\n /** Print the action's link too, for one-time links such as sign-in. */\n showLink?: boolean\n note?: string\n /** Inbox preview line. Defaults to the first paragraph. */\n preheader?: string\n footer: EmailFooter\n}\n\n/** Any other transactional message: one title, a short body and at most two buttons. */\nexport function noticeEmail(product: EmailProduct, input: NoticeEmailInput): EmailMessage {\n const paragraphs = typeof input.body === 'string' ? [input.body] : [...input.body]\n return renderEmail(product, {\n subject: emailSubject(input.subject, product),\n preheader: input.preheader ?? paragraphs[0] ?? input.title,\n title: input.title,\n paragraphs,\n ...(input.action ? { primary: input.action } : {}),\n ...(input.secondaryAction ? { secondary: input.secondaryAction } : {}),\n ...(input.showLink ? { showPrimaryLink: true } : {}),\n ...(input.note ? { note: input.note } : {}),\n footer: input.footer,\n })\n}\n","/** One way an email's HTML would break in Gmail or Outlook. */\nexport interface EmailLintIssue {\n rule:\n | 'document'\n | 'external-css'\n | 'style-block'\n | 'unsupported-element'\n | 'unsupported-css'\n | 'layout-table'\n | 'inline-style'\n | 'image'\n | 'link'\n | 'size'\n message: string\n}\n\n// Gmail clips a message body larger than about 102 KB behind \"View entire message\".\nconst GMAIL_CLIP_BYTES = 102_000\n\nconst tags = (html: string, name: string): string[] =>\n html.match(new RegExp(`<${name}\\\\b[^>]*>`, 'gi')) ?? []\n\nconst attribute = (tag: string, name: string): string | null => {\n const match = new RegExp(`\\\\s${name}=\"([^\"]*)\"`, 'i').exec(tag)\n return match ? match[1]! : null\n}\n\n/** Top-level rules of a stylesheet: their selector or at-rule preludes. */\nfunction preludes(css: string): string[] {\n const out: string[] = []\n let depth = 0\n let start = 0\n for (let i = 0; i < css.length; i++) {\n if (css[i] === '{') {\n if (depth === 0) out.push(css.slice(start, i).trim())\n depth++\n } else if (css[i] === '}') {\n depth--\n if (depth === 0) start = i + 1\n }\n }\n return out\n}\n\n/**\n * Check rendered email HTML against what Gmail and Outlook render: a complete\n * document, layout in presentation tables, styles inline (a `<style>` block may\n * only add dark-mode and narrow-screen overrides), images with alt text and\n * fixed size, absolute links, and a body small enough that Gmail does not clip.\n */\nexport function lintEmailHtml(html: string): EmailLintIssue[] {\n const issues: EmailLintIssue[] = []\n const issue = (rule: EmailLintIssue['rule'], message: string) => issues.push({ rule, message })\n const visible = html.replace(/<!--[\\s\\S]*?-->/g, '')\n\n if (!/^<!DOCTYPE html>/i.test(html)) issue('document', 'Missing <!DOCTYPE html>')\n if (!/<html\\b[^>]*\\slang=\"[^\"]+\"/i.test(html)) issue('document', 'Missing <html lang>')\n if (!/<meta charset=\"utf-8\">/i.test(html)) issue('document', 'Missing <meta charset=\"utf-8\">')\n if (!/<title>[^<]+<\\/title>/i.test(html)) issue('document', 'Missing <title>')\n\n if (/<link\\b[^>]*rel=\"?stylesheet/i.test(visible)) issue('external-css', 'Linked stylesheets are stripped')\n if (/@import\\b/i.test(visible)) issue('external-css', '@import is stripped')\n\n for (const block of visible.match(/<style\\b[^>]*>([\\s\\S]*?)<\\/style>/gi) ?? []) {\n const css = block.replace(/<\\/?style\\b[^>]*>/gi, '').replace(/\\/\\*[\\s\\S]*?\\*\\//g, '')\n for (const prelude of preludes(css)) {\n if (!prelude.startsWith('@media') && !prelude.startsWith('[data-og')) {\n issue('style-block', `<style> may only hold overrides; \"${prelude}\" must be inline`)\n }\n }\n }\n\n for (const name of ['script', 'form', 'input', 'button', 'svg', 'iframe', 'video', 'audio', 'object', 'embed']) {\n if (tags(visible, name).length > 0) issue('unsupported-element', `<${name}> is stripped or unsupported`)\n }\n\n for (const pattern of [\n /display\\s*:\\s*(?:flex|grid|inline-flex)/i,\n /position\\s*:/i,\n /float\\s*:/i,\n /var\\(/i,\n /calc\\(/i,\n /rgba?\\(|hsla?\\(/i,\n /background-image\\s*:|url\\(/i,\n ]) {\n if (pattern.test(visible)) issue('unsupported-css', `Outlook does not render ${pattern.source}`)\n }\n\n for (const table of tags(visible, 'table')) {\n if (attribute(table, 'role') !== 'presentation') issue('layout-table', `Layout table without role=\"presentation\": ${table.slice(0, 80)}`)\n for (const name of ['cellpadding', 'cellspacing', 'border']) {\n if (attribute(table, name) !== '0') issue('layout-table', `Layout table without ${name}=\"0\": ${table.slice(0, 80)}`)\n }\n }\n for (const div of tags(visible, 'div')) {\n const style = attribute(div, 'style') ?? ''\n if (!/display\\s*:\\s*none/i.test(style) && /(?:^|;)\\s*(?:max-)?width\\s*:/i.test(style)) {\n issue('layout-table', 'Outlook ignores <div> widths; size with a table cell')\n }\n }\n\n for (const name of ['p', 'h1', 'h2', 'h3', 'a', 'span']) {\n for (const tag of tags(visible, name)) {\n const style = attribute(tag, 'style') ?? ''\n if (!/(?:^|;)\\s*color\\s*:/i.test(style) || !/font-(?:family|size)\\s*:/i.test(style) && name !== 'a') {\n issue('inline-style', `<${name}> without inline color and font: ${tag.slice(0, 80)}`)\n }\n }\n }\n\n for (const img of tags(visible, 'img')) {\n // alt=\"\" is valid for a decorative image, such as a mark beside its own wordmark.\n if (attribute(img, 'alt') === null) issue('image', `Image without alt text: ${img.slice(0, 80)}`)\n if (!attribute(img, 'width') || !attribute(img, 'height')) issue('image', `Image without width and height: ${img.slice(0, 80)}`)\n const src = attribute(img, 'src') ?? ''\n if (!/^(?:https:|cid:)/.test(src)) issue('image', `Image source must be https: or cid: (${src.slice(0, 40)})`)\n }\n\n for (const anchor of tags(visible, 'a')) {\n const href = attribute(anchor, 'href') ?? ''\n if (!/^(?:https:\\/\\/|mailto:|http:\\/\\/(?:localhost|127\\.0\\.0\\.1)[:/])/.test(href)) {\n issue('link', `Links must be absolute https: ${href.slice(0, 60)}`)\n }\n }\n\n const bytes = new TextEncoder().encode(html).length\n if (bytes > GMAIL_CLIP_BYTES) issue('size', `${bytes} bytes; Gmail clips above ${GMAIL_CLIP_BYTES}`)\n return issues\n}\n"],"mappings":";AAEO,IAAM,yBACX;;;ACGK,IAAM,gBAAgB;AAAA,EAC3B,OAAO;AAAA,IACL,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,MAAM;AAAA,IACN,UAAU;AAAA,IACV,KAAK;AAAA,IACL,cAAc;AAAA,IACd,UAAU;AAAA,IACV,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,YAAY;AAAA,EACd;AAAA,EACA,MAAM;AAAA,IACJ,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,MAAM;AAAA,IACN,UAAU;AAAA,IACV,KAAK;AAAA,IACL,cAAc;AAAA,IACd,UAAU;AAAA,IACV,QAAQ;AAAA,IACR,UAA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,UAAM,MAAM,UAAU,KAAK,KAAK,KAAK;AACrC,QAAI,CAAC,mBAAmB,KAAK,GAAG,EAAG,OAAM,SAAS,wCAAwC,IAAI,MAAM,GAAG,EAAE,CAAC,GAAG;AAAA,EAC/G;AAEA,aAAW,UAAU,KAAK,SAAS,GAAG,GAAG;AACvC,UAAM,OAAO,UAAU,QAAQ,MAAM,KAAK;AAC1C,QAAI,CAAC,kEAAkE,KAAK,IAAI,GAAG;AACjF,YAAM,QAAQ,iCAAiC,KAAK,MAAM,GAAG,EAAE,CAAC,EAAE;AAAA,IACpE;AAAA,EACF;AAEA,QAAM,QAAQ,IAAI,YAAY,EAAE,OAAO,IAAI,EAAE;AAC7C,MAAI,QAAQ,iBAAkB,OAAM,QAAQ,GAAG,KAAK,6BAA6B,gBAAgB,EAAE;AACnG,SAAO;AACT;","names":[]}
|
package/dist/email/index.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Transactional email for Tangle agent apps: one branded layout and typed
|
|
3
3
|
* templates that each return `{ subject, preheader, html, text, attachments }`.
|
|
4
|
+
* The header is the Tangle lockup with the product name (`Tangle GTM Agent`);
|
|
5
|
+
* the footer names the workspace, the reason and a manage link, plus a postal
|
|
6
|
+
* address only when a marketing email such as a digest passes one.
|
|
4
7
|
*
|
|
5
8
|
* Transport-free and dependency-free, so it runs in Workers and Node alike:
|
|
6
9
|
* the app hands the message to its own Resend or SES client. The header's
|
package/dist/email/index.js
CHANGED
package/dist/email/layout.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
/** The app an email comes from. */
|
|
2
2
|
export interface EmailProduct {
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* The product name, e.g. `GTM Agent`. The header reads `Tangle GTM Agent`;
|
|
5
|
+
* subjects and the sender use the name alone. A name that already starts
|
|
6
|
+
* with `Tangle` (`Tangle Sandbox`) is not doubled.
|
|
7
|
+
*/
|
|
4
8
|
name: string;
|
|
5
9
|
/** The app's absolute origin; app-relative links resolve against it. */
|
|
6
10
|
url: string;
|
|
@@ -13,6 +17,12 @@ export interface EmailFooter {
|
|
|
13
17
|
reason: string;
|
|
14
18
|
/** Where the recipient changes which emails they get; absolute or app-relative. */
|
|
15
19
|
manageUrl?: string;
|
|
20
|
+
/**
|
|
21
|
+
* The sender's postal address, for marketing mail such as a digest. Leave it
|
|
22
|
+
* unset on transactional mail (approvals, invites, sign-in), which does not
|
|
23
|
+
* need one.
|
|
24
|
+
*/
|
|
25
|
+
postalAddress?: string;
|
|
16
26
|
}
|
|
17
27
|
/** A button. `url` is absolute or app-relative. */
|
|
18
28
|
export interface EmailAction {
|
package/dist/email/palette.d.ts
CHANGED
|
@@ -36,5 +36,3 @@ export declare const EMAIL_PALETTE: {
|
|
|
36
36
|
* only where it is installed and the platform UI face carries the rest.
|
|
37
37
|
*/
|
|
38
38
|
export declare const EMAIL_FONT_STACK = "Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Helvetica, Arial, sans-serif";
|
|
39
|
-
/** The postal line every Tangle email footer carries (Stripe business profile support address). */
|
|
40
|
-
export declare const TANGLE_POSTAL_ADDRESS = "Tangle Technologies, Inc., 3740 South Ocean Blvd, #1407, Highland Beach, FL 33487, USA";
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/email/mark.generated.ts","../src/email/palette.ts","../src/email/layout.ts","../src/email/templates.ts","../src/email/lint.ts"],"sourcesContent":["// GENERATED by scripts/email-mark.mjs from @tangle-network/brand TangleKnot; do not edit.\n/** The Tangle knot as a 84px transparent PNG (base64), shown at 28px in email headers. */\nexport const TANGLE_MARK_PNG_BASE64 =\n 'iVBORw0KGgoAAAANSUhEUgAAAFQAAABUCAYAAAAcaxDBAAAQAElEQVR4nOxcDZBV1X3//8+9971dVvkwEhR1GuvEatIY09hmOklTCU2bMQYnH3ZMTAmRZRdpqIAYgV3Iy35CgAU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ov8qFyupt3VPGdIR8zAxNU1e7O5879vv88yLu5UzuVSGNIEVSX/2FoQWkngNDQ07LPMi7r2YCqG/hpWQ0pMph/HVGl03fE2DhbzygF8vkPLx9HKecx83QSTJpAp8C+d2kSYbWmSYZWmeaZGidaZKhdaZJhtaZJhlaZ/o/AAAA//8mfCa5AAAABklEQVQDAPyiOFzVbOpbAAAAAElFTkSuQmCC'\n","/**\n * The Brand roles the email layout paints with, as literal hex. Email clients\n * cannot read CSS variables, and importing `@tangle-network/brand` at runtime\n * would load React into a server-only renderer, so the values live here and\n * `tests/email/palette.test.ts` fails when they drift from Brand's `palettes`.\n */\nexport const EMAIL_PALETTE = {\n light: {\n canvas: '#eceef3',\n card: '#ffffff',\n well: '#f6f7fa',\n hairline: '#c7c6d6',\n ink: '#2d2d2d',\n inkSecondary: '#3f3f3f',\n inkMuted: '#4c4c4c',\n accent: '#4c3fc5',\n onAccent: '#ffffff',\n accentText: '#3c32e9',\n },\n dark: {\n canvas: '#0a0a14',\n card: '#191826',\n well: '#12111f',\n hairline: '#2a293d',\n ink: '#e6e6e6',\n inkSecondary: '#c7c7c7',\n inkMuted: '#b5b5b5',\n accent: '#4c3fc5',\n onAccent: '#ffffff',\n accentText: '#a5b4fc',\n },\n} as const\n\n/**\n * Brand's `--font-sans` stack with the system faces email clients actually\n * have. No client used for this mail loads web fonts reliably, so Inter shows\n * only where it is installed and the platform UI face carries the rest.\n */\nexport const EMAIL_FONT_STACK =\n \"Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Helvetica, Arial, sans-serif\"\n\n/** The postal line every Tangle email footer carries (Stripe business profile support address). */\nexport const TANGLE_POSTAL_ADDRESS =\n 'Tangle Technologies, Inc., 3740 South Ocean Blvd, #1407, Highland Beach, FL 33487, USA'\n","import { TANGLE_MARK_PNG_BASE64 } from './mark.generated'\nimport { EMAIL_FONT_STACK, EMAIL_PALETTE, TANGLE_POSTAL_ADDRESS } from './palette'\n\n/** The app an email comes from. */\nexport interface EmailProduct {\n /** Shown beside the Tangle mark, after each subject and in the sender name, e.g. `GTM Agent`. */\n name: string\n /** The app's absolute origin; app-relative links resolve against it. */\n url: string\n}\n\n/** Why the recipient got the email and where they control it. */\nexport interface EmailFooter {\n /** The workspace the email concerns. */\n workspaceName?: string\n /** One sentence, e.g. `You own this workspace.` */\n reason: string\n /** Where the recipient changes which emails they get; absolute or app-relative. */\n manageUrl?: string\n}\n\n/** A button. `url` is absolute or app-relative. */\nexport interface EmailAction {\n label: string\n url: string\n}\n\n/** One row in the email's list box: an approval request or a digest entry. */\nexport interface EmailItem {\n title: string\n detail?: string\n /** Makes the title a link; absolute or app-relative. */\n url?: string\n}\n\n/** An inline image the HTML references by `cid:`; the mail client must send it with the message. */\nexport interface EmailAttachment {\n filename: string\n /** Base64 file content, the form Resend and SES accept. */\n content: string\n contentType: string\n contentId: string\n}\n\n/** A rendered email, ready for any transport. */\nexport interface EmailMessage {\n subject: string\n /** The inbox preview line. */\n preheader: string\n html: string\n text: string\n /** Pass these through to the mail client; the header mark is one of them. */\n attachments: EmailAttachment[]\n}\n\n/** What a template places in the shared layout. */\ninterface EmailContent {\n subject: string\n preheader: string\n title: string\n paragraphs: readonly string[]\n items?: readonly EmailItem[]\n primary?: EmailAction\n secondary?: EmailAction\n /** Print the primary link under the buttons for clients that strip them. */\n showPrimaryLink?: boolean\n /** A short line under the buttons, e.g. an expiry. */\n note?: string\n footer: EmailFooter\n}\n\nconst MARK_CONTENT_ID = 'tangle-mark'\nconst MARK_ATTACHMENT: EmailAttachment = {\n filename: 'tangle.png',\n content: TANGLE_MARK_PNG_BASE64,\n contentType: 'image/png',\n contentId: MARK_CONTENT_ID,\n}\n\nconst L = EMAIL_PALETTE.light\nconst D = EMAIL_PALETTE.dark\nconst FONT = EMAIL_FONT_STACK\n\n// Inline styles carry the light design; this block only adapts it for clients\n// that honor dark mode or narrow screens. A client that drops <style> still\n// renders the complete light email.\nconst STYLE = `\n@media (prefers-color-scheme: dark) {\n .t-bg { background-color: ${D.canvas} !important; }\n .t-card { background-color: ${D.card} !important; border-color: ${D.hairline} !important; }\n .t-well { background-color: ${D.well} !important; }\n .t-rule { border-color: ${D.hairline} !important; }\n .t-ink { color: ${D.ink} !important; }\n .t-ink2 { color: ${D.inkSecondary} !important; }\n .t-muted { color: ${D.inkMuted} !important; }\n .t-link { color: ${D.accentText} !important; }\n .t-btn2 { border-color: ${D.hairline} !important; }\n}\n@media (max-width: 600px) {\n .t-outer { padding: 20px 8px !important; }\n .t-card { padding: 28px 22px 24px !important; }\n}\n[data-ogsb] .t-bg { background-color: ${D.canvas} !important; }\n[data-ogsb] .t-card { background-color: ${D.card} !important; }\n[data-ogsb] .t-well { background-color: ${D.well} !important; }\n[data-ogsc] .t-ink { color: ${D.ink} !important; }\n[data-ogsc] .t-ink2 { color: ${D.inkSecondary} !important; }\n[data-ogsc] .t-muted { color: ${D.inkMuted} !important; }\n[data-ogsc] .t-link { color: ${D.accentText} !important; }\n`.trim()\n\n/** Escape text for HTML element content and quoted attribute values. */\nfunction escapeHtml(value: string): string {\n return value\n .replace(/&/g, '&')\n .replace(/</g, '<')\n .replace(/>/g, '>')\n .replace(/\"/g, '"')\n .replace(/'/g, ''')\n}\n\n/** An absolute http(s) URL; app-relative paths resolve against the product origin. */\nfunction resolveEmailUrl(url: string, product: EmailProduct): string {\n const resolved = new URL(url, product.url)\n if (resolved.protocol !== 'https:' && resolved.protocol !== 'http:') {\n throw new TypeError(`Email links must be http(s): ${resolved.protocol}`)\n }\n return resolved.toString()\n}\n\n/** `Title — Product`, the one subject shape every Tangle email uses. */\nexport function emailSubject(subject: string, product: EmailProduct): string {\n return `${subject} — ${product.name}`\n}\n\nfunction paragraph(text: string, margin: string): string {\n return `<p class=\"t-ink2\" style=\"margin:${margin};font-family:${FONT};font-size:15px;line-height:24px;color:${L.inkSecondary}\">${escapeHtml(text)}</p>`\n}\n\nfunction link(label: string, href: string, style: string): string {\n return `<a class=\"t-link\" href=\"${escapeHtml(href)}\" style=\"color:${L.accentText};text-decoration:none;${style}\">${escapeHtml(label)}</a>`\n}\n\nfunction header(product: EmailProduct): string {\n return [\n '<table role=\"presentation\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\">',\n '<tr>',\n `<td style=\"padding:0 10px 0 0;vertical-align:middle\"><img src=\"cid:${MARK_CONTENT_ID}\" width=\"28\" height=\"28\" alt=\"Tangle\" style=\"display:block;width:28px;height:28px;border:0;outline:none;text-decoration:none\"></td>`,\n `<td class=\"t-ink\" style=\"vertical-align:middle;font-family:${FONT};font-size:16px;line-height:20px;font-weight:600;letter-spacing:-0.01em;color:${L.ink}\">${escapeHtml(product.name)}</td>`,\n '</tr>',\n '</table>',\n ].join('')\n}\n\nfunction items(list: readonly EmailItem[], product: EmailProduct): string {\n const rows = list.map((item, index) => {\n const rule = index === 0 ? '' : `border-top:1px solid ${L.hairline};`\n const title = item.url\n ? link(item.title, resolveEmailUrl(item.url, product), 'font-weight:600')\n : escapeHtml(item.title)\n const detail = item.detail\n ? `<p class=\"t-muted\" style=\"margin:2px 0 0;font-family:${FONT};font-size:13px;line-height:20px;color:${L.inkMuted}\">${escapeHtml(item.detail)}</p>`\n : ''\n return [\n `<tr><td class=\"t-rule\" style=\"padding:14px 16px;${rule}\">`,\n `<p class=\"t-ink\" style=\"margin:0;font-family:${FONT};font-size:15px;line-height:22px;font-weight:600;color:${L.ink}\">${title}</p>`,\n detail,\n '</td></tr>',\n ].join('')\n })\n return [\n `<table role=\"presentation\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" class=\"t-well\" bgcolor=\"${L.well}\" style=\"background-color:${L.well};border-radius:8px;margin:4px 0 8px\">`,\n ...rows,\n '</table>',\n ].join('')\n}\n\nfunction primaryButton(action: EmailAction, href: string): string {\n return [\n `<td bgcolor=\"${L.accent}\" style=\"border-radius:8px;background-color:${L.accent};mso-padding-alt:12px 22px\">`,\n `<a href=\"${escapeHtml(href)}\" style=\"display:inline-block;padding:12px 22px;font-family:${FONT};font-size:15px;line-height:20px;font-weight:600;color:${L.onAccent};text-decoration:none;border-radius:8px\">${escapeHtml(action.label)}</a>`,\n '</td>',\n ].join('')\n}\n\nfunction secondaryButton(action: EmailAction, href: string): string {\n return [\n `<td class=\"t-btn2\" style=\"border:1px solid ${L.hairline};border-radius:8px;mso-padding-alt:11px 21px\">`,\n `<a class=\"t-ink\" href=\"${escapeHtml(href)}\" style=\"display:inline-block;padding:11px 21px;font-family:${FONT};font-size:15px;line-height:20px;font-weight:600;color:${L.ink};text-decoration:none;border-radius:8px\">${escapeHtml(action.label)}</a>`,\n '</td>',\n ].join('')\n}\n\nfunction buttons(content: EmailContent, product: EmailProduct): string {\n const cells: string[] = []\n if (content.primary) cells.push(primaryButton(content.primary, resolveEmailUrl(content.primary.url, product)))\n if (content.secondary) {\n if (cells.length > 0) cells.push('<td style=\"width:10px;font-size:0;line-height:0\"> </td>')\n cells.push(secondaryButton(content.secondary, resolveEmailUrl(content.secondary.url, product)))\n }\n if (cells.length === 0) return ''\n return `<table role=\"presentation\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"margin:20px 0 0\"><tr>${cells.join('')}</tr></table>`\n}\n\nfunction small(html: string, margin: string, size = 13): string {\n return `<p class=\"t-muted\" style=\"margin:${margin};font-family:${FONT};font-size:${size}px;line-height:${size + 7}px;color:${L.inkMuted}\">${html}</p>`\n}\n\nfunction footerLines(footer: EmailFooter, product: EmailProduct): { html: string[]; text: string[] } {\n const where = footer.workspaceName ? `${footer.workspaceName} · ${product.name}` : product.name\n const manage = footer.manageUrl ? resolveEmailUrl(footer.manageUrl, product) : null\n const html = [\n escapeHtml(where),\n escapeHtml(footer.reason),\n ...(manage ? [link('Manage notifications', manage, 'text-decoration:underline')] : []),\n escapeHtml(TANGLE_POSTAL_ADDRESS),\n ]\n const text = [where, footer.reason, ...(manage ? [`Manage notifications: ${manage}`] : []), TANGLE_POSTAL_ADDRESS]\n return { html, text }\n}\n\n// Keeps the body text that follows out of the inbox preview line.\nconst PREHEADER_SPACER = '͏‌ '.repeat(40)\n\nfunction renderHtml(content: EmailContent, product: EmailProduct): string {\n const primaryHref = content.primary ? resolveEmailUrl(content.primary.url, product) : null\n const footer = footerLines(content.footer, product)\n const body = [\n `<h1 class=\"t-ink\" style=\"margin:0 0 12px;font-family:${FONT};font-size:22px;line-height:28px;font-weight:600;letter-spacing:-0.01em;color:${L.ink}\">${escapeHtml(content.title)}</h1>`,\n ...content.paragraphs.map((text) => paragraph(text, '0 0 12px')),\n content.items && content.items.length > 0 ? items(content.items, product) : '',\n buttons(content, product),\n content.showPrimaryLink && primaryHref\n ? small(`Or open this link: ${link(primaryHref, primaryHref, 'word-break:break-all')}`, '20px 0 0')\n : '',\n content.note ? small(escapeHtml(content.note), content.showPrimaryLink ? '8px 0 0' : '20px 0 0') : '',\n ].join('')\n\n return [\n '<!DOCTYPE html>',\n '<html lang=\"en\" xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:o=\"urn:schemas-microsoft-com:office:office\">',\n '<head>',\n '<meta charset=\"utf-8\">',\n '<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">',\n '<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">',\n '<meta name=\"x-apple-disable-message-reformatting\">',\n '<meta name=\"format-detection\" content=\"telephone=no, date=no, address=no, email=no, url=no\">',\n '<meta name=\"color-scheme\" content=\"light dark\">',\n '<meta name=\"supported-color-schemes\" content=\"light dark\">',\n `<title>${escapeHtml(content.subject)}</title>`,\n '<!--[if mso]><noscript><xml><o:OfficeDocumentSettings><o:PixelsPerInch>96</o:PixelsPerInch></o:OfficeDocumentSettings></xml></noscript><![endif]-->',\n `<style>\\n${STYLE}\\n</style>`,\n '</head>',\n `<body class=\"t-bg\" style=\"margin:0;padding:0;width:100%;background-color:${L.canvas};-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%\">`,\n `<div style=\"display:none;font-size:1px;line-height:1px;max-height:0;max-width:0;opacity:0;overflow:hidden;mso-hide:all\">${escapeHtml(content.preheader)}${PREHEADER_SPACER}</div>`,\n `<table role=\"presentation\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" class=\"t-bg\" bgcolor=\"${L.canvas}\" style=\"background-color:${L.canvas}\">`,\n '<tr><td class=\"t-outer\" align=\"center\" style=\"padding:32px 12px\">',\n '<!--[if mso]><table role=\"presentation\" width=\"560\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" align=\"center\"><tr><td><![endif]-->',\n '<table role=\"presentation\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"max-width:560px;margin:0 auto\">',\n `<tr><td style=\"padding:0 4px 20px\">${header(product)}</td></tr>`,\n `<tr><td class=\"t-card\" bgcolor=\"${L.card}\" style=\"background-color:${L.card};border:1px solid ${L.hairline};border-radius:12px;padding:36px 36px 32px\">${body}</td></tr>`,\n `<tr><td style=\"padding:24px 4px 0\">${footer.html.map((line, index) => small(line, index === 0 ? '0' : '4px 0 0', 12)).join('')}</td></tr>`,\n '</table>',\n '<!--[if mso]></td></tr></table><![endif]-->',\n '</td></tr>',\n '</table>',\n '</body>',\n '</html>',\n ].join('\\n')\n}\n\nfunction renderText(content: EmailContent, product: EmailProduct): string {\n const blocks: string[] = [product.name, content.title, ...content.paragraphs]\n if (content.items && content.items.length > 0) {\n blocks.push(content.items.map((item) => {\n const lines = [`- ${item.title}`]\n if (item.detail) lines.push(` ${item.detail}`)\n if (item.url) lines.push(` ${resolveEmailUrl(item.url, product)}`)\n return lines.join('\\n')\n }).join('\\n'))\n }\n const actions = [content.primary, content.secondary]\n .filter((action): action is EmailAction => Boolean(action))\n .map((action) => `${action.label}: ${resolveEmailUrl(action.url, product)}`)\n if (actions.length > 0) blocks.push(actions.join('\\n'))\n if (content.note) blocks.push(content.note)\n blocks.push(['--', ...footerLines(content.footer, product).text].join('\\n'))\n return `${blocks.join('\\n\\n')}\\n`\n}\n\n/** Place a template's content in the shared Tangle layout. */\nexport function renderEmail(product: EmailProduct, content: EmailContent): EmailMessage {\n return {\n subject: content.subject,\n preheader: content.preheader,\n html: renderHtml(content, product),\n text: renderText(content, product),\n attachments: [MARK_ATTACHMENT],\n }\n}\n\n/**\n * The HTML with inline images embedded as data URIs, for browser previews and\n * screenshots. Mail clients get `cid:` references and the attachments instead.\n */\nexport function emailPreviewHtml(message: Pick<EmailMessage, 'html' | 'attachments'>): string {\n return message.attachments.reduce(\n (html, attachment) => html.split(`cid:${attachment.contentId}`).join(`data:${attachment.contentType};base64,${attachment.content}`),\n message.html,\n )\n}\n\n/**\n * The From header for an app's mail: `GTM Agent · Tangle <noreply@tangle.tools>`.\n * The product leads because inbox sender columns truncate; `· Tangle` ties\n * every app to the company and the sending domain.\n */\nexport function emailSender(productName: string, address: string): string {\n if (!/^[^\\s<>@]+@[^\\s<>@]+\\.[^\\s<>@]+$/.test(address)) throw new TypeError(`Not an email address: ${address}`)\n const name = /\\bTangle\\b/i.test(productName) ? productName : `${productName} · Tangle`\n return `${name} <${address}>`\n}\n","import {\n emailSubject,\n renderEmail,\n type EmailAction,\n type EmailFooter,\n type EmailItem,\n type EmailMessage,\n type EmailProduct,\n} from './layout'\n\n/** Sentence case to mid-sentence: `Create agent` → `create agent`; acronyms such as `API key` keep their case. */\nfunction midSentence(text: string): string {\n const first = text.split(/\\s/, 1)[0] ?? ''\n if ((first.match(/[A-Z]/g) ?? []).length > 1) return text\n return text.charAt(0).toLowerCase() + text.slice(1)\n}\n\nfunction plural(count: number, one: string, many: string): string {\n return count === 1 ? one : many\n}\n\nfunction day(date: Date): string {\n return date.toLocaleDateString('en-US', { month: 'short', day: 'numeric', year: 'numeric', timeZone: 'UTC' })\n}\n\n/** One action an agent is waiting to run. */\nexport interface ApprovalEmailAction {\n /** What runs, in plain language and sentence case: `Create agent “Quinn”`. */\n summary: string\n /** Where it runs and until when, e.g. `ph0ny · open until Oct 9, 3:40 PM UTC`. */\n detail?: string\n}\n\n/** Input for {@link approvalEmail}. */\nexport interface ApprovalEmailInput {\n /** At least one action, in the order the agent asked. */\n actions: readonly ApprovalEmailAction[]\n /** The conversation the agent paused in. */\n conversation?: string\n /** Opens the decision, e.g. the chat with the approval card. */\n approveUrl: string\n /** Opens the context, e.g. every request waiting in the workspace. */\n reviewUrl: string\n footer: EmailFooter\n}\n\n/**\n * An agent paused until someone approves what it wants to do. Neither button\n * decides anything: link scanners open email links, so both lead to the app,\n * where the signed-in owner approves.\n */\nexport function approvalEmail(product: EmailProduct, input: ApprovalEmailInput): EmailMessage {\n const [first, ...rest] = input.actions\n if (!first) throw new TypeError('approvalEmail needs at least one action')\n const what = rest.length === 0\n ? midSentence(first.summary)\n : `${midSentence(first.summary)} and ${rest.length} more`\n const where = input.conversation ? ` in “${input.conversation}”` : ''\n return renderEmail(product, {\n subject: emailSubject(`Approve: ${what}`, product),\n preheader: `The agent paused${where} until you decide.`,\n title: rest.length === 0 ? 'Approval needed' : `${input.actions.length} approvals needed`,\n paragraphs: [`The agent paused${where} until you decide. Nothing runs until you approve.`],\n items: input.actions.map((action): EmailItem => ({ title: action.summary, ...(action.detail ? { detail: action.detail } : {}) })),\n primary: { label: 'Approve', url: input.approveUrl },\n secondary: { label: 'Review', url: input.reviewUrl },\n footer: input.footer,\n })\n}\n\n/** Input for {@link inviteEmail}. */\nexport interface InviteEmailInput {\n workspaceName: string\n /** Who sent the invitation: a name or an email address. */\n inviter: string\n /** The role the invitation grants, e.g. `editor`. */\n role: string\n acceptUrl: string\n expiresAt: Date\n}\n\n/** Someone invited the recipient to a workspace. */\nexport function inviteEmail(product: EmailProduct, input: InviteEmailInput): EmailMessage {\n const role = input.role.toLowerCase()\n const article = /^[aeiou]/.test(role) ? 'an' : 'a'\n return renderEmail(product, {\n subject: emailSubject(`Join ${input.workspaceName}`, product),\n preheader: `${input.inviter} invited you to ${input.workspaceName}.`,\n title: `Join ${input.workspaceName}`,\n paragraphs: [`${input.inviter} invited you to ${input.workspaceName} on ${product.name} as ${article} ${role}.`],\n primary: { label: 'Accept invitation', url: input.acceptUrl },\n showPrimaryLink: true,\n note: `This invitation expires on ${day(input.expiresAt)}.`,\n footer: {\n workspaceName: input.workspaceName,\n reason: `You received this because ${input.inviter} invited this address.`,\n },\n })\n}\n\n/** Input for {@link digestEmail}. */\nexport interface DigestEmailInput {\n workspaceName: string\n /** The day the digest covers. */\n date: Date\n /** What happened, most important first. */\n items: readonly EmailItem[]\n /** Opens the workspace. */\n openUrl: string\n footer: EmailFooter\n}\n\n/** What happened in a workspace that day. */\nexport function digestEmail(product: EmailProduct, input: DigestEmailInput): EmailMessage {\n const count = input.items.length\n const updates = `${count} ${plural(count, 'update', 'updates')}`\n const date = input.date.toLocaleDateString('en-US', { weekday: 'long', month: 'long', day: 'numeric', timeZone: 'UTC' })\n return renderEmail(product, {\n subject: emailSubject(`${input.workspaceName}: ${updates}`, product),\n preheader: input.items[0]?.title ?? `Nothing new in ${input.workspaceName}.`,\n title: `What happened in ${input.workspaceName}`,\n paragraphs: [count === 0 ? `Nothing new on ${date}.` : `${updates} on ${date}.`],\n items: input.items,\n primary: { label: `Open ${product.name}`, url: input.openUrl },\n footer: input.footer,\n })\n}\n\n/** Input for {@link noticeEmail}. */\nexport interface NoticeEmailInput {\n /** Short; the product name is appended. */\n subject: string\n title: string\n /** One or two short paragraphs. */\n body: string | readonly string[]\n action?: EmailAction\n secondaryAction?: EmailAction\n /** Print the action's link too, for one-time links such as sign-in. */\n showLink?: boolean\n note?: string\n /** Inbox preview line. Defaults to the first paragraph. */\n preheader?: string\n footer: EmailFooter\n}\n\n/** Any other transactional message: one title, a short body and at most two buttons. */\nexport function noticeEmail(product: EmailProduct, input: NoticeEmailInput): EmailMessage {\n const paragraphs = typeof input.body === 'string' ? [input.body] : [...input.body]\n return renderEmail(product, {\n subject: emailSubject(input.subject, product),\n preheader: input.preheader ?? paragraphs[0] ?? input.title,\n title: input.title,\n paragraphs,\n ...(input.action ? { primary: input.action } : {}),\n ...(input.secondaryAction ? { secondary: input.secondaryAction } : {}),\n ...(input.showLink ? { showPrimaryLink: true } : {}),\n ...(input.note ? { note: input.note } : {}),\n footer: input.footer,\n })\n}\n","/** One way an email's HTML would break in Gmail or Outlook. */\nexport interface EmailLintIssue {\n rule:\n | 'document'\n | 'external-css'\n | 'style-block'\n | 'unsupported-element'\n | 'unsupported-css'\n | 'layout-table'\n | 'inline-style'\n | 'image'\n | 'link'\n | 'size'\n message: string\n}\n\n// Gmail clips a message body larger than about 102 KB behind \"View entire message\".\nconst GMAIL_CLIP_BYTES = 102_000\n\nconst tags = (html: string, name: string): string[] =>\n html.match(new RegExp(`<${name}\\\\b[^>]*>`, 'gi')) ?? []\n\nconst attribute = (tag: string, name: string): string | null => {\n const match = new RegExp(`\\\\s${name}=\"([^\"]*)\"`, 'i').exec(tag)\n return match ? match[1]! : null\n}\n\n/** Top-level rules of a stylesheet: their selector or at-rule preludes. */\nfunction preludes(css: string): string[] {\n const out: string[] = []\n let depth = 0\n let start = 0\n for (let i = 0; i < css.length; i++) {\n if (css[i] === '{') {\n if (depth === 0) out.push(css.slice(start, i).trim())\n depth++\n } else if (css[i] === '}') {\n depth--\n if (depth === 0) start = i + 1\n }\n }\n return out\n}\n\n/**\n * Check rendered email HTML against what Gmail and Outlook render: a complete\n * document, layout in presentation tables, styles inline (a `<style>` block may\n * only add dark-mode and narrow-screen overrides), images with alt text and\n * fixed size, absolute links, and a body small enough that Gmail does not clip.\n */\nexport function lintEmailHtml(html: string): EmailLintIssue[] {\n const issues: EmailLintIssue[] = []\n const issue = (rule: EmailLintIssue['rule'], message: string) => issues.push({ rule, message })\n const visible = html.replace(/<!--[\\s\\S]*?-->/g, '')\n\n if (!/^<!DOCTYPE html>/i.test(html)) issue('document', 'Missing <!DOCTYPE html>')\n if (!/<html\\b[^>]*\\slang=\"[^\"]+\"/i.test(html)) issue('document', 'Missing <html lang>')\n if (!/<meta charset=\"utf-8\">/i.test(html)) issue('document', 'Missing <meta charset=\"utf-8\">')\n if (!/<title>[^<]+<\\/title>/i.test(html)) issue('document', 'Missing <title>')\n\n if (/<link\\b[^>]*rel=\"?stylesheet/i.test(visible)) issue('external-css', 'Linked stylesheets are stripped')\n if (/@import\\b/i.test(visible)) issue('external-css', '@import is stripped')\n\n for (const block of visible.match(/<style\\b[^>]*>([\\s\\S]*?)<\\/style>/gi) ?? []) {\n const css = block.replace(/<\\/?style\\b[^>]*>/gi, '').replace(/\\/\\*[\\s\\S]*?\\*\\//g, '')\n for (const prelude of preludes(css)) {\n if (!prelude.startsWith('@media') && !prelude.startsWith('[data-og')) {\n issue('style-block', `<style> may only hold overrides; \"${prelude}\" must be inline`)\n }\n }\n }\n\n for (const name of ['script', 'form', 'input', 'button', 'svg', 'iframe', 'video', 'audio', 'object', 'embed']) {\n if (tags(visible, name).length > 0) issue('unsupported-element', `<${name}> is stripped or unsupported`)\n }\n\n for (const pattern of [\n /display\\s*:\\s*(?:flex|grid|inline-flex)/i,\n /position\\s*:/i,\n /float\\s*:/i,\n /var\\(/i,\n /calc\\(/i,\n /rgba?\\(|hsla?\\(/i,\n /background-image\\s*:|url\\(/i,\n ]) {\n if (pattern.test(visible)) issue('unsupported-css', `Outlook does not render ${pattern.source}`)\n }\n\n for (const table of tags(visible, 'table')) {\n if (attribute(table, 'role') !== 'presentation') issue('layout-table', `Layout table without role=\"presentation\": ${table.slice(0, 80)}`)\n for (const name of ['cellpadding', 'cellspacing', 'border']) {\n if (attribute(table, name) !== '0') issue('layout-table', `Layout table without ${name}=\"0\": ${table.slice(0, 80)}`)\n }\n }\n for (const div of tags(visible, 'div')) {\n const style = attribute(div, 'style') ?? ''\n if (!/display\\s*:\\s*none/i.test(style) && /(?:^|;)\\s*(?:max-)?width\\s*:/i.test(style)) {\n issue('layout-table', 'Outlook ignores <div> widths; size with a table cell')\n }\n }\n\n for (const name of ['p', 'h1', 'h2', 'h3', 'a', 'span']) {\n for (const tag of tags(visible, name)) {\n const style = attribute(tag, 'style') ?? ''\n if (!/(?:^|;)\\s*color\\s*:/i.test(style) || !/font-(?:family|size)\\s*:/i.test(style) && name !== 'a') {\n issue('inline-style', `<${name}> without inline color and font: ${tag.slice(0, 80)}`)\n }\n }\n }\n\n for (const img of tags(visible, 'img')) {\n if (!attribute(img, 'alt')) issue('image', `Image without alt text: ${img.slice(0, 80)}`)\n if (!attribute(img, 'width') || !attribute(img, 'height')) issue('image', `Image without width and height: ${img.slice(0, 80)}`)\n const src = attribute(img, 'src') ?? ''\n if (!/^(?:https:|cid:)/.test(src)) issue('image', `Image source must be https: or cid: (${src.slice(0, 40)})`)\n }\n\n for (const anchor of tags(visible, 'a')) {\n const href = attribute(anchor, 'href') ?? ''\n if (!/^(?:https:\\/\\/|mailto:|http:\\/\\/(?:localhost|127\\.0\\.0\\.1)[:/])/.test(href)) {\n issue('link', `Links must be absolute https: ${href.slice(0, 60)}`)\n }\n }\n\n const bytes = new TextEncoder().encode(html).length\n if (bytes > GMAIL_CLIP_BYTES) issue('size', `${bytes} bytes; Gmail clips above ${GMAIL_CLIP_BYTES}`)\n return issues\n}\n"],"mappings":";AAEO,IAAM,yBACX;;;ACGK,IAAM,gBAAgB;AAAA,EAC3B,OAAO;AAAA,IACL,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,MAAM;AAAA,IACN,UAAU;AAAA,IACV,KAAK;AAAA,IACL,cAAc;AAAA,IACd,UAAU;AAAA,IACV,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,YAAY;AAAA,EACd;AAAA,EACA,MAAM;AAAA,IACJ,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,MAAM;AAAA,IACN,UAAU;AAAA,IACV,KAAK;AAAA,IACL,cAAc;AAAA,IACd,UAAU;AAAA,IACV,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,YAAY;AAAA,EACd;AACF;AAOO,IAAM,mBACX;AAGK,IAAM,wBACX;;;AC4BF,IAAM,kBAAkB;AACxB,IAAM,kBAAmC;AAAA,EACvC,UAAU;AAAA,EACV,SAA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