Update hivegrid-cloud reference to latest main
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e98d38e716
commit
7b21524c86
3781 files changed
+373484
-225607
No files matched your search
+5
-5
@@ -1,14 +1,14 @@
|
||||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
||||
|
||||
exports[`BaseLayout > applies tenant brand overrides (logo + primary color) 1`] = `"<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="preload" as="image" href="https://cdn.acme.test/logo.png"/><title>Hi</title></head><body style="margin:0;padding:0;background-color:#f4f5f7;color:#0f172a;font-family:ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;font-size:16px;line-height:1.5"><div style="display:none;font-size:1px;line-height:1px;max-height:0;max-width:0;opacity:0;overflow:hidden">snippet</div><div style="width:100%;max-width:560px;margin:0 auto;padding:24px 16px"><div style="background-color:#ffffff;border:1px solid #e2e8f0;border-radius:20px;padding:32px"><div style="padding-bottom:16px;text-align:left"><img src="https://cdn.acme.test/logo.png" alt="Acme" width="48" height="48" style="display:block;border:0;border-radius:12px"/></div><p>Body</p><div style="margin-top:24px;padding-top:16px;border-top:1px solid;font-size:12px;line-height:1.5;border-top-color:#e2e8f0;color:#475569"><div><a href="https://tool-ctrl.de/privacy" style="text-decoration:underline;color:#2563eb">Privacy</a><span style="margin:0 6px">·</span><a href="https://tool-ctrl.de/terms" style="text-decoration:underline;color:#2563eb">Terms</a><span style="margin:0 6px">·</span><a href="https://tool-ctrl.de/imprint" style="text-decoration:underline;color:#2563eb">Imprint</a></div><div style="margin-top:8px">Questions? Email us at <a href="mailto:info@tool-ctrl.de" style="text-decoration:underline;color:#2563eb">info@tool-ctrl.de</a>.</div></div></div></div></body></html>"`;
|
||||
exports[`BaseLayout > applies tenant brand overrides (logo + primary color) 1`] = `"<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="preload" as="image" href="https://cdn.acme.test/logo.png"/><title>Hi</title></head><body style="margin:0;padding:0;background-color:#f4f5f7;color:#0f172a;font-family:ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;font-size:16px;line-height:1.5"><div style="display:none;font-size:1px;line-height:1px;max-height:0;max-width:0;opacity:0;overflow:hidden">snippet</div><div style="width:100%;max-width:560px;margin:0 auto;padding:24px 16px"><div style="background-color:#ffffff;border:1px solid #e2e8f0;border-radius:20px;padding:32px"><div style="padding-bottom:16px;text-align:left"><img src="https://cdn.acme.test/logo.png" alt="Acme" width="48" height="48" style="display:block;border:0;border-radius:12px"/></div><p>Body</p><div style="margin-top:24px;padding-top:16px;border-top:1px solid;font-size:12px;line-height:1.5;border-top-color:#e2e8f0;color:#475569"><div><a href="https://hivegrid.de/datenschutz" style="text-decoration:underline;color:#2563eb">Privacy</a><span style="margin:0 6px">·</span><a href="https://hivegrid.de/agb" style="text-decoration:underline;color:#2563eb">Terms</a><span style="margin:0 6px">·</span><a href="https://hivegrid.de/impressum" style="text-decoration:underline;color:#2563eb">Imprint</a></div><div style="margin-top:8px">Questions? Email us at <a href="mailto:support@hivegrid.de" style="text-decoration:underline;color:#2563eb">support@hivegrid.de</a>.</div></div></div></div></body></html>"`;
|
||||
|
||||
exports[`BaseLayout > renders default-brand snapshot 1`] = `"<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><title>Hello</title></head><body style="margin:0;padding:0;background-color:#f4f5f7;color:#0f172a;font-family:ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;font-size:16px;line-height:1.5"><div style="display:none;font-size:1px;line-height:1px;max-height:0;max-width:0;opacity:0;overflow:hidden">A preview</div><div style="width:100%;max-width:560px;margin:0 auto;padding:24px 16px"><div style="background-color:#ffffff;border:1px solid #e2e8f0;border-radius:20px;padding:32px"><div style="padding-bottom:16px;text-align:left"><strong style="color:#0f172a;font-size:18px">ToolCTRL</strong></div><div style="color:#475569;font-size:13px;font-weight:700;letter-spacing:0.08em;text-transform:uppercase;margin-bottom:8px">Eyebrow</div><h1>Title</h1><div style="margin-top:24px;padding-top:16px;border-top:1px solid;font-size:12px;line-height:1.5;border-top-color:#e2e8f0;color:#475569"><div><a href="https://tool-ctrl.de/privacy" style="text-decoration:underline;color:#2563eb">Privacy</a><span style="margin:0 6px">·</span><a href="https://tool-ctrl.de/terms" style="text-decoration:underline;color:#2563eb">Terms</a><span style="margin:0 6px">·</span><a href="https://tool-ctrl.de/imprint" style="text-decoration:underline;color:#2563eb">Imprint</a></div><div style="margin-top:8px">Questions? Email us at <a href="mailto:info@tool-ctrl.de" style="text-decoration:underline;color:#2563eb">info@tool-ctrl.de</a>.</div></div></div></div></body></html>"`;
|
||||
exports[`BaseLayout > renders default-brand snapshot 1`] = `"<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><title>Hello</title></head><body style="margin:0;padding:0;background-color:#f4f5f7;color:#0f172a;font-family:ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;font-size:16px;line-height:1.5"><div style="display:none;font-size:1px;line-height:1px;max-height:0;max-width:0;opacity:0;overflow:hidden">A preview</div><div style="width:100%;max-width:560px;margin:0 auto;padding:24px 16px"><div style="background-color:#ffffff;border:1px solid #e2e8f0;border-radius:20px;padding:32px"><div style="padding-bottom:16px;text-align:left"><strong style="color:#0f172a;font-size:18px">HiveGrid</strong></div><div style="color:#475569;font-size:13px;font-weight:700;letter-spacing:0.08em;text-transform:uppercase;margin-bottom:8px">Eyebrow</div><h1>Title</h1><div style="margin-top:24px;padding-top:16px;border-top:1px solid;font-size:12px;line-height:1.5;border-top-color:#e2e8f0;color:#475569"><div><a href="https://hivegrid.de/datenschutz" style="text-decoration:underline;color:#2563eb">Privacy</a><span style="margin:0 6px">·</span><a href="https://hivegrid.de/agb" style="text-decoration:underline;color:#2563eb">Terms</a><span style="margin:0 6px">·</span><a href="https://hivegrid.de/impressum" style="text-decoration:underline;color:#2563eb">Imprint</a></div><div style="margin-top:8px">Questions? Email us at <a href="mailto:support@hivegrid.de" style="text-decoration:underline;color:#2563eb">support@hivegrid.de</a>.</div></div></div></div></body></html>"`;
|
||||
|
||||
exports[`BaseLayout > renders default-brand snapshot 2`] = `
|
||||
"A preview
|
||||
ToolCTRL
|
||||
HiveGrid
|
||||
Eyebrow
|
||||
Title
|
||||
Privacy (https://tool-ctrl.de/privacy)·Terms (https://tool-ctrl.de/terms)·Imprint (https://tool-ctrl.de/imprint)
|
||||
Questions? Email us at info@tool-ctrl.de (mailto:info@tool-ctrl.de)."
|
||||
Privacy (https://hivegrid.de/datenschutz)·Terms (https://hivegrid.de/agb)·Imprint (https://hivegrid.de/impressum)
|
||||
Questions? Email us at support@hivegrid.de (mailto:support@hivegrid.de)."
|
||||
`;
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
import { describe, expect, test } from "vitest";
|
||||
import { renderReactEmail } from "../render-helpers.js";
|
||||
import { BaseLayout } from "./BaseLayout.js";
|
||||
import { Footer } from "./Footer.js";
|
||||
import { defaultMailBrand, withBrandDefaults } from "./theme.js";
|
||||
|
||||
describe("Footer legal-link branches", () => {
|
||||
test("renders no legal links and shows an unsubscribe link when legal URLs are absent", () => {
|
||||
const brand = withBrandDefaults({ privacyUrl: undefined, termsUrl: undefined, imprintUrl: undefined });
|
||||
const { html } = renderReactEmail(
|
||||
<Footer brand={brand} unsubscribeUrl="https://app.example.com/unsubscribe?token=abc" />
|
||||
);
|
||||
|
||||
expect(html).not.toContain(">Privacy<");
|
||||
expect(html).not.toContain(">Terms<");
|
||||
expect(html).not.toContain(">Imprint<");
|
||||
expect(html).toContain(">Unsubscribe<");
|
||||
expect(html).toContain('href="https://app.example.com/unsubscribe?token=abc"');
|
||||
// The support contact line is always rendered.
|
||||
expect(html).toContain(`mailto:${brand.supportEmail}`);
|
||||
});
|
||||
|
||||
test("renders only the privacy link (no separators) when terms and imprint are absent", () => {
|
||||
const brand = withBrandDefaults({ termsUrl: undefined, imprintUrl: undefined });
|
||||
const { html } = renderReactEmail(<Footer brand={brand} />);
|
||||
|
||||
expect(html).toContain(">Privacy<");
|
||||
expect(html).not.toContain(">Terms<");
|
||||
expect(html).not.toContain(">Imprint<");
|
||||
// No middot separator should be emitted when only one legal link exists.
|
||||
expect(html).not.toContain(">·<");
|
||||
// No unsubscribe link when none was supplied.
|
||||
expect(html).not.toContain(">Unsubscribe<");
|
||||
});
|
||||
});
|
||||
|
||||
describe("BaseLayout preview-text branch", () => {
|
||||
test("omits the hidden preview div when no previewText is supplied", () => {
|
||||
const { html } = renderReactEmail(
|
||||
<BaseLayout brand={defaultMailBrand} title="No preview">
|
||||
<p>Body</p>
|
||||
</BaseLayout>
|
||||
);
|
||||
|
||||
// The preview snippet container uses a 1px font-size — it must be absent here.
|
||||
expect(html).not.toContain("font-size:1px");
|
||||
expect(html).toContain("Body");
|
||||
});
|
||||
});
|
||||
+8
-8
@@ -1,9 +1,9 @@
|
||||
/**
|
||||
* Default brand-theme tokens for React-Email transactional templates.
|
||||
*
|
||||
* Templates accept a `brand` prop derived from `@toolctrl/brand`'s
|
||||
* Templates accept a `brand` prop derived from `@hivegrid/brand`'s
|
||||
* `BrandTokens`. When undefined we fall back to these defaults so
|
||||
* preview/storybook renders stay deterministic regardless of tenant
|
||||
* preview renders stay deterministic regardless of tenant
|
||||
* configuration. Keep this aligned with `packages/brand/src/index.ts`.
|
||||
*/
|
||||
export interface MailBrand {
|
||||
@@ -27,7 +27,7 @@ export interface MailBrand {
|
||||
}
|
||||
|
||||
export const defaultMailBrand: MailBrand = {
|
||||
productName: "ToolCTRL",
|
||||
productName: "HiveGrid",
|
||||
primaryColor: "#2563eb",
|
||||
primaryTextColor: "#ffffff",
|
||||
textColor: "#0f172a",
|
||||
@@ -38,11 +38,11 @@ export const defaultMailBrand: MailBrand = {
|
||||
linkColor: "#2563eb",
|
||||
fontFamily:
|
||||
"ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif",
|
||||
supportEmail: "info@tool-ctrl.de",
|
||||
supportFromName: "ToolCTRL Support",
|
||||
privacyUrl: "https://tool-ctrl.de/privacy",
|
||||
termsUrl: "https://tool-ctrl.de/terms",
|
||||
imprintUrl: "https://tool-ctrl.de/imprint",
|
||||
supportEmail: "support@hivegrid.de",
|
||||
supportFromName: "HiveGrid Support",
|
||||
privacyUrl: "https://hivegrid.de/datenschutz",
|
||||
termsUrl: "https://hivegrid.de/agb",
|
||||
imprintUrl: "https://hivegrid.de/impressum",
|
||||
} as const;
|
||||
|
||||
export function withBrandDefaults(override?: Partial<MailBrand>): MailBrand {
|
||||
|
||||
Reference in new issue
Block a user