@prenta/sections-react 0.15.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.
Files changed (76) hide show
  1. package/CHANGELOG.md +1037 -0
  2. package/LICENSE +21 -0
  3. package/README.md +36 -0
  4. package/dist/PrentaForm.d.ts +22 -0
  5. package/dist/PrentaForm.d.ts.map +1 -0
  6. package/dist/PrentaForm.js +203 -0
  7. package/dist/PrentaForm.js.map +1 -0
  8. package/dist/PrentaFormHtml.d.ts +19 -0
  9. package/dist/PrentaFormHtml.d.ts.map +1 -0
  10. package/dist/PrentaFormHtml.js +18 -0
  11. package/dist/PrentaFormHtml.js.map +1 -0
  12. package/dist/Sections.d.ts +40 -0
  13. package/dist/Sections.d.ts.map +1 -0
  14. package/dist/Sections.js +80 -0
  15. package/dist/Sections.js.map +1 -0
  16. package/dist/SiteNav.d.ts +38 -0
  17. package/dist/SiteNav.d.ts.map +1 -0
  18. package/dist/SiteNav.js +38 -0
  19. package/dist/SiteNav.js.map +1 -0
  20. package/dist/attribution.d.ts +31 -0
  21. package/dist/attribution.d.ts.map +1 -0
  22. package/dist/attribution.js +66 -0
  23. package/dist/attribution.js.map +1 -0
  24. package/dist/components/WidgetEmbedSection.d.ts +9 -0
  25. package/dist/components/WidgetEmbedSection.d.ts.map +1 -0
  26. package/dist/components/WidgetEmbedSection.js +113 -0
  27. package/dist/components/WidgetEmbedSection.js.map +1 -0
  28. package/dist/components/defaults.d.ts +34 -0
  29. package/dist/components/defaults.d.ts.map +1 -0
  30. package/dist/components/defaults.js +170 -0
  31. package/dist/components/defaults.js.map +1 -0
  32. package/dist/forms.d.ts +103 -0
  33. package/dist/forms.d.ts.map +1 -0
  34. package/dist/forms.js +217 -0
  35. package/dist/forms.js.map +1 -0
  36. package/dist/image.d.ts +17 -0
  37. package/dist/image.d.ts.map +1 -0
  38. package/dist/image.js +14 -0
  39. package/dist/image.js.map +1 -0
  40. package/dist/index.d.ts +51 -0
  41. package/dist/index.d.ts.map +1 -0
  42. package/dist/index.js +44 -0
  43. package/dist/index.js.map +1 -0
  44. package/dist/lcp.d.ts +30 -0
  45. package/dist/lcp.d.ts.map +1 -0
  46. package/dist/lcp.js +34 -0
  47. package/dist/lcp.js.map +1 -0
  48. package/dist/primitives.d.ts +14 -0
  49. package/dist/primitives.d.ts.map +1 -0
  50. package/dist/primitives.js +18 -0
  51. package/dist/primitives.js.map +1 -0
  52. package/dist/registry.d.ts +40 -0
  53. package/dist/registry.d.ts.map +1 -0
  54. package/dist/registry.js +62 -0
  55. package/dist/registry.js.map +1 -0
  56. package/dist/sizes.d.ts +30 -0
  57. package/dist/sizes.d.ts.map +1 -0
  58. package/dist/sizes.js +34 -0
  59. package/dist/sizes.js.map +1 -0
  60. package/dist/testing.d.ts +95 -0
  61. package/dist/testing.d.ts.map +1 -0
  62. package/dist/testing.js +159 -0
  63. package/dist/testing.js.map +1 -0
  64. package/dist/types.d.ts +130 -0
  65. package/dist/types.d.ts.map +1 -0
  66. package/dist/types.js +2 -0
  67. package/dist/types.js.map +1 -0
  68. package/dist/utils.d.ts +21 -0
  69. package/dist/utils.d.ts.map +1 -0
  70. package/dist/utils.js +65 -0
  71. package/dist/utils.js.map +1 -0
  72. package/dist/webmcp.d.ts +6 -0
  73. package/dist/webmcp.d.ts.map +1 -0
  74. package/dist/webmcp.js +18 -0
  75. package/dist/webmcp.js.map +1 -0
  76. package/package.json +69 -0
@@ -0,0 +1,66 @@
1
+ 'use client';
2
+ /**
3
+ * Consent-gated marketing attribution capture for the public site.
4
+ *
5
+ * Wraps cms-core's attribution module with a consent check: when
6
+ * `@prenta/plugin-consent` is installed (optional peer dependency),
7
+ * capture only runs with an analytics grant; when it is not installed, the
8
+ * site has no consent framework and first-party capture proceeds.
9
+ */
10
+ import { useEffect } from 'react';
11
+ import { captureAttribution } from '@prenta/core/forms/attribution';
12
+ /**
13
+ * Whether attribution may be captured under the site's consent state.
14
+ *
15
+ * - Plugin not installed → the site has no consent framework; resolve `true`.
16
+ * - Analytics already granted → resolve `true` immediately.
17
+ * - No decision yet → wait for the visitor's banner choice (the URL's UTM
18
+ * params are still intact at that point, so a late grant loses nothing).
19
+ *
20
+ * The consent plugin is an optional peer, so it is loaded with a dynamic
21
+ * import (documented exception to the no-inline-imports rule — same pattern
22
+ * as `WidgetEmbedSection`): a static import would break sites that don't
23
+ * install it.
24
+ */
25
+ export async function attributionConsentAllowed() {
26
+ try {
27
+ const consent = await import('@prenta/plugin-consent');
28
+ const existing = consent.readConsentState();
29
+ if (existing)
30
+ return consent.hasAnalyticsConsent(existing);
31
+ return consent.hasAnalyticsConsent(await consent.waitForConsentState());
32
+ }
33
+ catch {
34
+ return true;
35
+ }
36
+ }
37
+ /**
38
+ * Capture the current page as an attribution touch if consent allows.
39
+ * Resolves `true` when capture ran (callers can then attach attribution on
40
+ * submit without re-checking consent).
41
+ */
42
+ export async function captureAttributionIfAllowed() {
43
+ if (typeof window === 'undefined')
44
+ return false;
45
+ const allowed = await attributionConsentAllowed();
46
+ if (!allowed)
47
+ return false;
48
+ captureAttribution();
49
+ return true;
50
+ }
51
+ /**
52
+ * Site-wide attribution tracker. Mount once in the public site layout so
53
+ * UTMs, ad click IDs, and referrers are recorded on the page the visitor
54
+ * *lands* on — not just pages that contain a form. `<PrentaForm>` also
55
+ * captures on mount, so this is optional but improves first-touch fidelity
56
+ * for multi-page journeys (ad → landing page → contact page → submit).
57
+ *
58
+ * Renders nothing.
59
+ */
60
+ export function AttributionTracker() {
61
+ useEffect(() => {
62
+ void captureAttributionIfAllowed();
63
+ }, []);
64
+ return null;
65
+ }
66
+ //# sourceMappingURL=attribution.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attribution.js","sourceRoot":"","sources":["../src/attribution.ts"],"names":[],"mappings":"AAAA,YAAY,CAAA;AAEZ;;;;;;;GAOG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACjC,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAA;AAEnE;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,KAAK,UAAU,yBAAyB;IAC7C,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,wBAAwB,CAAC,CAAA;QACtD,MAAM,QAAQ,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAA;QAC3C,IAAI,QAAQ;YAAE,OAAO,OAAO,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAA;QAC1D,OAAO,OAAO,CAAC,mBAAmB,CAAC,MAAM,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAAA;IACzE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAA;IACb,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,2BAA2B;IAC/C,IAAI,OAAO,MAAM,KAAK,WAAW;QAAE,OAAO,KAAK,CAAA;IAC/C,MAAM,OAAO,GAAG,MAAM,yBAAyB,EAAE,CAAA;IACjD,IAAI,CAAC,OAAO;QAAE,OAAO,KAAK,CAAA;IAC1B,kBAAkB,EAAE,CAAA;IACpB,OAAO,IAAI,CAAA;AACb,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,kBAAkB;IAChC,SAAS,CAAC,GAAG,EAAE;QACb,KAAK,2BAA2B,EAAE,CAAA;IACpC,CAAC,EAAE,EAAE,CAAC,CAAA;IACN,OAAO,IAAI,CAAA;AACb,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { SectionRendererProps } from '../types.js';
2
+ /**
3
+ * Lazy third-party widget section — loads provider scripts on intersection (and
4
+ * optionally after cookie consent). Reserves min-height to prevent CLS.
5
+ */
6
+ export declare function WidgetEmbedSection({ section }: SectionRendererProps): React.ReactNode;
7
+ /** Reset script dedupe — for tests only. */
8
+ export declare function resetWidgetEmbedScriptsForTests(): void;
9
+ //# sourceMappingURL=WidgetEmbedSection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WidgetEmbedSection.d.ts","sourceRoot":"","sources":["../../src/components/WidgetEmbedSection.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AA0EvD;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,OAAO,EAAE,EAAE,oBAAoB,GAAG,KAAK,CAAC,SAAS,CA+DrF;AAED,4CAA4C;AAC5C,wBAAgB,+BAA+B,IAAI,IAAI,CAEtD"}
@@ -0,0 +1,113 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useEffect, useRef, useState } from 'react';
4
+ import { parseWidgetEmbed, WIDGET_PROVIDER_LABEL, } from '@prenta/core/page-sections';
5
+ const LOADED_SCRIPTS = new Set();
6
+ function str(content, key, fallback = '') {
7
+ const v = content[key];
8
+ return typeof v === 'string' ? v : fallback;
9
+ }
10
+ function appendScript(src, id) {
11
+ if (LOADED_SCRIPTS.has(id) || document.getElementById(id))
12
+ return;
13
+ const script = document.createElement('script');
14
+ script.id = id;
15
+ script.src = src;
16
+ script.async = true;
17
+ script.defer = true;
18
+ document.body.appendChild(script);
19
+ LOADED_SCRIPTS.add(id);
20
+ }
21
+ function mountWidget(parsed, container) {
22
+ container.replaceChildren();
23
+ if (parsed.provider === 'elfsight') {
24
+ const root = document.createElement('div');
25
+ root.className = `elfsight-app-${parsed.widgetId}`;
26
+ root.setAttribute('data-elfsight-app-lazy', '');
27
+ container.appendChild(root);
28
+ appendScript('https://static.elfsight.com/platform/platform.js', 'prenta-elfsight-platform');
29
+ return;
30
+ }
31
+ if (parsed.provider === 'trustpilot') {
32
+ const root = document.createElement('div');
33
+ root.className = 'trustpilot-widget';
34
+ root.setAttribute('data-locale', 'en-US');
35
+ root.setAttribute('data-template-id', parsed.widgetId);
36
+ root.setAttribute('data-businessunit-id', parsed.embedUrl ?? '');
37
+ root.setAttribute('data-style-height', `${parsed.minHeightPx}px`);
38
+ root.setAttribute('data-style-width', '100%');
39
+ root.setAttribute('data-theme', 'light');
40
+ container.appendChild(root);
41
+ appendScript('https://widget.trustpilot.com/bootstrap/v5/tp.widget.bootstrap.min.js', 'prenta-trustpilot-bootstrap');
42
+ return;
43
+ }
44
+ const root = document.createElement('div');
45
+ root.className = 'calendly-inline-widget';
46
+ root.setAttribute('data-url', parsed.embedUrl ?? '');
47
+ root.style.minWidth = '320px';
48
+ root.style.height = `${Math.max(parsed.minHeightPx, 630)}px`;
49
+ container.appendChild(root);
50
+ appendScript('https://assets.calendly.com/assets/external/widget.js', 'prenta-calendly-widget');
51
+ }
52
+ async function consentAllows(requireConsent) {
53
+ if (!requireConsent)
54
+ return true;
55
+ try {
56
+ const { readConsent, hasAnalyticsConsent, onConsent } = await import('@prenta/plugin-consent');
57
+ if (hasAnalyticsConsent(readConsent()))
58
+ return true;
59
+ return await new Promise((resolve) => {
60
+ const off = onConsent((level) => {
61
+ off();
62
+ resolve(level === 'all');
63
+ });
64
+ });
65
+ }
66
+ catch {
67
+ return true;
68
+ }
69
+ }
70
+ /**
71
+ * Lazy third-party widget section — loads provider scripts on intersection (and
72
+ * optionally after cookie consent). Reserves min-height to prevent CLS.
73
+ */
74
+ export function WidgetEmbedSection({ section }) {
75
+ const content = section.content ?? {};
76
+ const parsed = parseWidgetEmbed(content);
77
+ const title = str(content, 'title', 'Embedded widget');
78
+ const requireConsent = str(content, 'requireConsent', 'true') !== 'false';
79
+ const hostRef = useRef(null);
80
+ const [mounted, setMounted] = useState(false);
81
+ useEffect(() => {
82
+ if (!parsed || !hostRef.current)
83
+ return;
84
+ let cancelled = false;
85
+ const host = hostRef.current;
86
+ const observer = new IntersectionObserver((entries) => {
87
+ if (!entries.some((e) => e.isIntersecting))
88
+ return;
89
+ observer.disconnect();
90
+ void (async () => {
91
+ const allowed = await consentAllows(requireConsent);
92
+ if (cancelled || !allowed || !hostRef.current)
93
+ return;
94
+ mountWidget(parsed, hostRef.current);
95
+ setMounted(true);
96
+ })();
97
+ }, { rootMargin: '200px 0px' });
98
+ observer.observe(host);
99
+ return () => {
100
+ cancelled = true;
101
+ observer.disconnect();
102
+ };
103
+ }, [parsed, requireConsent]);
104
+ if (!parsed) {
105
+ return (_jsx("div", { className: "mx-auto max-w-3xl px-6", children: _jsx("p", { className: "text-sm text-zinc-400 italic", children: "No valid widget configuration." }) }));
106
+ }
107
+ return (_jsx("section", { className: "mx-auto max-w-3xl px-6", "aria-label": title, "data-widget-provider": parsed.provider, "data-widget-loaded": mounted ? 'true' : 'false', children: _jsx("div", { ref: hostRef, className: "w-full overflow-hidden rounded-xl bg-zinc-50", style: { minHeight: `${parsed.minHeightPx}px` }, children: !mounted && (_jsxs("p", { className: "flex h-full min-h-[inherit] items-center justify-center px-4 text-center text-sm text-zinc-500", children: [WIDGET_PROVIDER_LABEL[parsed.provider], " widget loads when visible", requireConsent ? ' and cookies are accepted' : '', "."] })) }) }));
108
+ }
109
+ /** Reset script dedupe — for tests only. */
110
+ export function resetWidgetEmbedScriptsForTests() {
111
+ LOADED_SCRIPTS.clear();
112
+ }
113
+ //# sourceMappingURL=WidgetEmbedSection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WidgetEmbedSection.js","sourceRoot":"","sources":["../../src/components/WidgetEmbedSection.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACnD,OAAO,EACL,gBAAgB,EAChB,qBAAqB,GAEtB,MAAM,4BAA4B,CAAA;AAGnC,MAAM,cAAc,GAAG,IAAI,GAAG,EAAU,CAAA;AAExC,SAAS,GAAG,CAAC,OAAgC,EAAE,GAAW,EAAE,QAAQ,GAAG,EAAE;IACvE,MAAM,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,CAAA;IACtB,OAAO,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAA;AAC7C,CAAC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CAAC,KAAK,EAAE,CAAA;AACxB,CAAC"}
@@ -0,0 +1,34 @@
1
+ import type { SectionRenderer, SectionRendererMap } from '../types.js';
2
+ export declare const HeroSection: SectionRenderer;
3
+ export declare const TextSection: SectionRenderer;
4
+ export declare const FeatureSection: SectionRenderer;
5
+ export declare const StatsSection: SectionRenderer;
6
+ export declare const CtaSection: SectionRenderer;
7
+ export declare const ArticleBodySection: SectionRenderer;
8
+ export declare const QuoteSection: SectionRenderer;
9
+ export declare const AuthorBioSection: SectionRenderer;
10
+ export declare const RelatedPostsSection: SectionRenderer;
11
+ export declare const GallerySection: SectionRenderer;
12
+ /**
13
+ * Renderer for the `form` section: a heading/intro plus an embedded form.
14
+ * When the consumer passes a pre-fetched schema via `options.prefetchedForms`,
15
+ * renders {@link PrentaFormHtml} (zero-JS + WebMCP). Otherwise falls back to
16
+ * the client {@link PrentaForm} island.
17
+ */
18
+ export declare const FormSection: SectionRenderer;
19
+ /**
20
+ * Renderer for the `embed` section: a lazy-loaded provider iframe (YouTube /
21
+ * Vimeo / Loom) inside a fixed aspect-ratio box so it reserves its space and
22
+ * never causes layout shift (CLS). The URL is re-parsed through the cms-core
23
+ * allowlist here too, so an iframe can only ever point at an approved provider
24
+ * even if a renderer is fed unvalidated content.
25
+ */
26
+ export declare const EmbedSection: SectionRenderer;
27
+ /**
28
+ * The built-in renderer map. Keys are the canonical `sectionType` ids from
29
+ * `@prenta/core/page-sections`. A drift guard (see registry tests)
30
+ * keeps this in lockstep with the cms-core registry so no section type can
31
+ * exist without a renderer.
32
+ */
33
+ export declare const DEFAULT_SECTION_RENDERERS: SectionRendererMap;
34
+ //# sourceMappingURL=defaults.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../src/components/defaults.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,eAAe,EAAE,kBAAkB,EAAwB,MAAM,aAAa,CAAA;AAQ5F,eAAO,MAAM,WAAW,EAAE,eAwDzB,CAAA;AAED,eAAO,MAAM,WAAW,EAAE,eAezB,CAAA;AAED,eAAO,MAAM,cAAc,EAAE,eAuD5B,CAAA;AAED,eAAO,MAAM,YAAY,EAAE,eAiC1B,CAAA;AAED,eAAO,MAAM,UAAU,EAAE,eAuBxB,CAAA;AAED,eAAO,MAAM,kBAAkB,EAAE,eAsBhC,CAAA;AAED,eAAO,MAAM,YAAY,EAAE,eAoB1B,CAAA;AAED,eAAO,MAAM,gBAAgB,EAAE,eAwC9B,CAAA;AAED,eAAO,MAAM,mBAAmB,EAAE,eA6BjC,CAAA;AAED,eAAO,MAAM,cAAc,EAAE,eA4C5B,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,WAAW,EAAE,eAkCzB,CAAA;AAUD;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,EAAE,eAiC1B,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,EAAE,kBAcvC,CAAA"}
@@ -0,0 +1,170 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { parseEmbed } from '@prenta/core/page-sections';
3
+ import { PrentaForm } from '../PrentaForm.js';
4
+ import { PrentaFormHtml } from '../PrentaFormHtml.js';
5
+ import { WidgetEmbedSection } from './WidgetEmbedSection.js';
6
+ import { Button } from '../primitives.js';
7
+ import { FEATURE_SIZES, FULL_WIDTH_SIZES, gallerySizes } from '../sizes.js';
8
+ import { bool, isDark, num, rows, str } from '../utils.js';
9
+ export const HeroSection = ({ section, options, }) => {
10
+ const c = section.content;
11
+ const dark = isDark(section.settings);
12
+ const img = str(c, 'imageUrl');
13
+ return (_jsxs("div", { className: "mx-auto max-w-3xl px-6 text-center", children: [str(c, 'eyebrow') && (_jsx("p", { className: "mb-3 text-sm font-medium tracking-wide uppercase opacity-80", "data-cms-field": "eyebrow", children: str(c, 'eyebrow') })), _jsx("h1", { className: "text-4xl font-bold tracking-tight sm:text-5xl", "data-cms-field": "heading", children: str(c, 'heading') }), str(c, 'body') && (_jsx("p", { className: "mx-auto mt-4 max-w-2xl text-lg opacity-90", "data-cms-field": "body", children: str(c, 'body') })), _jsxs("div", { className: "mt-8 flex flex-wrap items-center justify-center gap-3", children: [_jsx(Button, { label: str(c, 'primaryButtonLabel'), href: str(c, 'primaryButtonUrl'), tone: dark ? 'onDark' : 'primary', fieldPath: "primaryButtonLabel" }), _jsx(Button, { label: str(c, 'secondaryButtonLabel'), href: str(c, 'secondaryButtonUrl'), tone: "ghost", fieldPath: "secondaryButtonLabel" })] }), img && (_jsx("div", { className: "mt-10", "data-cms-field": "imageUrl", "data-cms-field-kind": "media", children: options.renderImage({
14
+ src: img,
15
+ alt: str(c, 'imageAlt'),
16
+ width: num(c, 'imageWidth'),
17
+ height: num(c, 'imageHeight'),
18
+ // The hero image is the canonical LCP element — claim the page's
19
+ // single priority slot and serve it full-width.
20
+ priority: options.lcp.claim(),
21
+ sizes: FULL_WIDTH_SIZES,
22
+ className: 'mx-auto w-full rounded-xl object-cover shadow-sm',
23
+ }) }))] }));
24
+ };
25
+ export const TextSection = ({ section }) => {
26
+ const c = section.content;
27
+ const align = str(c, 'alignment', 'center') === 'left' ? 'text-left' : 'mx-auto text-center';
28
+ return (_jsxs("div", { className: `max-w-3xl px-6 ${align}`, children: [_jsx("h2", { className: "text-3xl font-bold tracking-tight", "data-cms-field": "heading", children: str(c, 'heading') }), str(c, 'body') && (_jsx("p", { className: "mt-4 text-lg whitespace-pre-line opacity-80", "data-cms-field": "body", children: str(c, 'body') }))] }));
29
+ };
30
+ export const FeatureSection = ({ section, options, }) => {
31
+ const c = section.content;
32
+ const left = str(c, 'imagePosition', 'right') === 'left';
33
+ const img = str(c, 'imageUrl');
34
+ return (_jsxs("div", { className: "mx-auto grid max-w-5xl items-center gap-10 px-6 md:grid-cols-2", children: [_jsxs("div", { className: left ? 'md:order-2' : '', children: [str(c, 'label') && (_jsx("p", { className: "mb-2 text-sm font-medium tracking-wide text-violet-600 uppercase", "data-cms-field": "label", children: str(c, 'label') })), _jsx("h2", { className: "text-3xl font-bold tracking-tight", "data-cms-field": "heading", children: str(c, 'heading') }), str(c, 'body') && (_jsx("p", { className: "mt-3 text-lg opacity-80", "data-cms-field": "body", children: str(c, 'body') })), _jsx("div", { className: "mt-5", children: _jsx(Button, { label: str(c, 'buttonLabel'), href: str(c, 'buttonUrl'), fieldPath: "buttonLabel" }) })] }), _jsx("div", { className: left ? 'md:order-1' : '', "data-cms-field": img ? 'imageUrl' : undefined, "data-cms-field-kind": img ? 'media' : undefined, children: img ? (options.renderImage({
35
+ src: img,
36
+ alt: str(c, 'imageAlt'),
37
+ width: num(c, 'imageWidth'),
38
+ height: num(c, 'imageHeight'),
39
+ priority: options.lcp.claim(),
40
+ sizes: FEATURE_SIZES,
41
+ className: 'w-full rounded-xl object-cover shadow-sm',
42
+ })) : (_jsx("div", { className: "aspect-video w-full rounded-xl bg-zinc-100", "aria-hidden": true })) })] }));
43
+ };
44
+ export const StatsSection = ({ section }) => {
45
+ const c = section.content;
46
+ return (_jsxs("div", { className: "mx-auto max-w-5xl px-6 text-center", children: [str(c, 'heading') && (_jsx("h2", { className: "text-3xl font-bold tracking-tight", "data-cms-field": "heading", children: str(c, 'heading') })), str(c, 'body') && (_jsx("p", { className: "mx-auto mt-3 max-w-2xl text-lg opacity-80", "data-cms-field": "body", children: str(c, 'body') })), _jsx("dl", { className: "mt-10 grid grid-cols-1 gap-8 sm:grid-cols-3", children: rows(c, 'stats').map((row, i) => (_jsxs("div", { children: [_jsx("dt", { className: "text-4xl font-bold text-violet-600", "data-cms-field": `stats.${i}.value`, children: str(row, 'value') }), _jsx("dd", { className: "mt-1 text-sm font-medium opacity-70", "data-cms-field": `stats.${i}.label`, children: str(row, 'label') }), str(row, 'description') && (_jsx("dd", { className: "mt-1 text-xs opacity-60", "data-cms-field": `stats.${i}.description`, children: str(row, 'description') }))] }, i))) })] }));
47
+ };
48
+ export const CtaSection = ({ section }) => {
49
+ const c = section.content;
50
+ const dark = isDark(section.settings);
51
+ return (_jsxs("div", { className: "mx-auto max-w-3xl px-6 text-center", children: [_jsx("h2", { className: "text-3xl font-bold tracking-tight", "data-cms-field": "heading", children: str(c, 'heading') }), str(c, 'body') && (_jsx("p", { className: "mx-auto mt-3 max-w-xl text-lg opacity-90", "data-cms-field": "body", children: str(c, 'body') })), _jsx("div", { className: "mt-6", children: _jsx(Button, { label: str(c, 'buttonLabel'), href: str(c, 'buttonUrl'), tone: dark ? 'onDark' : 'primary', fieldPath: "buttonLabel" }) })] }));
52
+ };
53
+ export const ArticleBodySection = ({ section, ctx, options, }) => {
54
+ const c = section.content;
55
+ const source = str(c, 'source', 'field');
56
+ const rawHtml = source === 'override' ? str(c, 'body') : (ctx?.body ?? '');
57
+ const width = str(c, 'width', 'normal') === 'wide' ? 'max-w-4xl' : 'max-w-2xl';
58
+ if (!rawHtml) {
59
+ return _jsx("div", { className: `mx-auto ${width} px-6 text-zinc-400 italic`, children: "No body content yet." });
60
+ }
61
+ // Author-supplied HTML. Prenta sanitizes on write; `options.sanitizeHtml`
62
+ // (default identity) lets consumers add defense-in-depth — see RenderOptions.
63
+ // Rich-text inline editing is out of scope for visual-editing v1 — no field attr.
64
+ const html = options.sanitizeHtml(rawHtml);
65
+ return (_jsx("div", { className: `prose prose-zinc mx-auto ${width} px-6`, dangerouslySetInnerHTML: { __html: html } }));
66
+ };
67
+ export const QuoteSection = ({ section }) => {
68
+ const c = section.content;
69
+ return (_jsxs("figure", { className: "mx-auto max-w-3xl px-6 text-center", children: [_jsxs("blockquote", { className: "text-2xl font-medium text-zinc-900 sm:text-3xl", "data-cms-field": "quote", children: ["\u201C", str(c, 'quote'), "\u201D"] }), (str(c, 'attribution') || str(c, 'role')) && (_jsxs("figcaption", { className: "mt-4 text-sm text-zinc-500", children: [_jsx("span", { "data-cms-field": "attribution", children: str(c, 'attribution') }), str(c, 'role') && (_jsxs("span", { className: "opacity-70", "data-cms-field": "role", children: [' ', "\u2014 ", str(c, 'role')] }))] }))] }));
70
+ };
71
+ export const AuthorBioSection = ({ section, ctx, options, }) => {
72
+ const c = section.content;
73
+ const author = ctx?.author;
74
+ return (_jsxs("div", { className: "mx-auto max-w-3xl px-6", children: [str(c, 'heading') && (_jsx("h2", { className: "mb-4 text-sm font-semibold tracking-wide text-zinc-500 uppercase", "data-cms-field": "heading", children: str(c, 'heading') })), _jsxs("div", { className: "flex items-center gap-4", children: [bool(c, 'showAvatar', true) && (_jsx("div", { className: "h-14 w-14 shrink-0 overflow-hidden rounded-full bg-zinc-200", children: author?.avatarUrl &&
75
+ // Route the avatar through the image renderer (dimensioned, lazy)
76
+ // so it benefits from next/image + never ships a raw <img>.
77
+ options.renderImage({
78
+ src: author.avatarUrl,
79
+ alt: author.name ?? '',
80
+ width: 56,
81
+ height: 56,
82
+ sizes: '56px',
83
+ className: 'h-full w-full object-cover',
84
+ }) })), _jsxs("div", { children: [_jsx("p", { className: "font-medium text-zinc-900", children: author?.name ?? 'Staff Writer' }), author?.bio && _jsx("p", { className: "mt-1 text-sm text-zinc-600", children: author.bio })] })] })] }));
85
+ };
86
+ export const RelatedPostsSection = ({ section, ctx, }) => {
87
+ const c = section.content;
88
+ const related = ctx?.relatedPosts ?? [];
89
+ const placeholders = related.length ? related : [null, null, null];
90
+ return (_jsxs("div", { className: "mx-auto max-w-5xl px-6", children: [str(c, 'heading') && (_jsx("h2", { className: "mb-6 text-2xl font-bold tracking-tight", "data-cms-field": "heading", children: str(c, 'heading') })), _jsx("div", { className: "grid grid-cols-1 gap-6 sm:grid-cols-3", children: placeholders.map((p, i) => (_jsxs("a", { href: p?.url ?? '#', className: "block rounded-xl border border-zinc-200 p-5 transition-colors hover:border-violet-300 hover:bg-zinc-50", children: [_jsx("p", { className: "font-medium text-zinc-900", children: p?.title ?? 'Related post' }), p?.excerpt && _jsx("p", { className: "mt-2 text-sm text-zinc-600", children: p.excerpt })] }, i))) })] }));
91
+ };
92
+ export const GallerySection = ({ section, options, }) => {
93
+ const c = section.content;
94
+ const cols = str(c, 'columns', '3');
95
+ const colCount = cols === '2' ? 2 : cols === '4' ? 4 : 3;
96
+ const colClass = cols === '2' ? 'sm:grid-cols-2' : cols === '4' ? 'sm:grid-cols-4' : 'sm:grid-cols-3';
97
+ const imgSizes = gallerySizes(colCount);
98
+ return (_jsxs("div", { className: "mx-auto max-w-5xl px-6", children: [str(c, 'heading') && (_jsx("h2", { className: "mb-6 text-2xl font-bold tracking-tight", "data-cms-field": "heading", children: str(c, 'heading') })), _jsx("div", { className: `grid grid-cols-1 gap-4 ${colClass}`, children: rows(c, 'images').map((img, i) => (_jsxs("figure", { "data-cms-field": `images.${i}.url`, "data-cms-field-kind": "media", children: [options.renderImage({
99
+ src: str(img, 'url'),
100
+ alt: str(img, 'alt'),
101
+ width: num(img, 'width'),
102
+ height: num(img, 'height'),
103
+ // Only the first gallery image can claim the page's priority slot;
104
+ // the rest lazy-load so they never compete with the LCP image.
105
+ priority: i === 0 ? options.lcp.claim() : false,
106
+ sizes: imgSizes,
107
+ className: 'aspect-square w-full rounded-lg object-cover',
108
+ }), str(img, 'caption') && (_jsx("figcaption", { className: "mt-1 text-xs text-zinc-500", "data-cms-field": `images.${i}.caption`, children: str(img, 'caption') }))] }, i))) })] }));
109
+ };
110
+ /**
111
+ * Renderer for the `form` section: a heading/intro plus an embedded form.
112
+ * When the consumer passes a pre-fetched schema via `options.prefetchedForms`,
113
+ * renders {@link PrentaFormHtml} (zero-JS + WebMCP). Otherwise falls back to
114
+ * the client {@link PrentaForm} island.
115
+ */
116
+ export const FormSection = ({ section, options, }) => {
117
+ const c = section.content;
118
+ const formSlug = str(c, 'formSlug');
119
+ const heading = str(c, 'heading');
120
+ const description = str(c, 'description');
121
+ const prefetched = formSlug ? options.prefetchedForms[formSlug] : undefined;
122
+ return (_jsxs("div", { className: "mx-auto max-w-xl px-6", children: [heading && (_jsx("h2", { className: "text-2xl font-bold tracking-tight", "data-cms-field": "heading", children: heading })), description && (_jsx("p", { className: "mt-3 text-zinc-600", "data-cms-field": "description", children: description })), formSlug && prefetched ? (_jsx("div", { className: heading || description ? 'mt-6' : '', children: _jsx(PrentaFormHtml, { form: prefetched }) })) : formSlug ? (_jsx("div", { className: heading || description ? 'mt-6' : '', children: _jsx(PrentaForm, { slug: formSlug, baseUrl: options.baseUrl }) })) : (_jsx("p", { className: "mt-4 text-sm text-zinc-400", children: "No form selected." }))] }));
123
+ };
124
+ /** Aspect-ratio container classes for the `embed` section's reserved space. */
125
+ const EMBED_RATIO_CLASS = {
126
+ '16:9': 'aspect-video',
127
+ '4:3': 'aspect-[4/3]',
128
+ '1:1': 'aspect-square',
129
+ '9:16': 'aspect-[9/16]',
130
+ };
131
+ /**
132
+ * Renderer for the `embed` section: a lazy-loaded provider iframe (YouTube /
133
+ * Vimeo / Loom) inside a fixed aspect-ratio box so it reserves its space and
134
+ * never causes layout shift (CLS). The URL is re-parsed through the cms-core
135
+ * allowlist here too, so an iframe can only ever point at an approved provider
136
+ * even if a renderer is fed unvalidated content.
137
+ */
138
+ export const EmbedSection = ({ section }) => {
139
+ const c = section.content;
140
+ const parsed = parseEmbed(str(c, 'url'));
141
+ const ratioClass = EMBED_RATIO_CLASS[str(c, 'ratio', '16:9')] ?? EMBED_RATIO_CLASS['16:9'];
142
+ const title = str(c, 'title');
143
+ const caption = str(c, 'caption');
144
+ if (!parsed) {
145
+ return (_jsx("div", { className: "mx-auto max-w-3xl px-6", children: _jsx("p", { className: "text-sm text-zinc-400 italic", children: "No valid video URL set." }) }));
146
+ }
147
+ return (_jsxs("figure", { className: "mx-auto max-w-3xl px-6", children: [_jsx("div", { className: `relative w-full overflow-hidden rounded-xl bg-zinc-100 ${ratioClass}`, children: _jsx("iframe", { src: parsed.embedUrl, title: title || `${parsed.provider} video`, loading: "lazy", className: "absolute inset-0 h-full w-full border-0", allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share", allowFullScreen: true, referrerPolicy: "strict-origin-when-cross-origin" }) }), caption && (_jsx("figcaption", { className: "mt-2 text-center text-sm text-zinc-500", "data-cms-field": "caption", children: caption }))] }));
148
+ };
149
+ /**
150
+ * The built-in renderer map. Keys are the canonical `sectionType` ids from
151
+ * `@prenta/core/page-sections`. A drift guard (see registry tests)
152
+ * keeps this in lockstep with the cms-core registry so no section type can
153
+ * exist without a renderer.
154
+ */
155
+ export const DEFAULT_SECTION_RENDERERS = {
156
+ hero: HeroSection,
157
+ text: TextSection,
158
+ feature: FeatureSection,
159
+ stats: StatsSection,
160
+ cta: CtaSection,
161
+ form: FormSection,
162
+ 'article-body': ArticleBodySection,
163
+ quote: QuoteSection,
164
+ 'author-bio': AuthorBioSection,
165
+ 'related-posts': RelatedPostsSection,
166
+ gallery: GallerySection,
167
+ embed: EmbedSection,
168
+ 'widget-embed': WidgetEmbedSection,
169
+ };
170
+ //# sourceMappingURL=defaults.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defaults.js","sourceRoot":"","sources":["../../src/components/defaults.tsx"],"names":[],"mappings":";AAgBA,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAA;AAEvD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC3E,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA;AAE1D,MAAM,CAAC,MAAM,WAAW,GAAoB,CAAC,EAC3C,OAAO,EACP,OAAO,GACc,EAAa,EAAE;IACpC,MAAM,CAAC,GAAG,OAAO,CAAC,OAAO,CAAA;IACzB,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,QAA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-0,0 +1,103 @@
1
+ /**
2
+ * Pure, SSR-safe helpers + wire types for the public form renderer.
3
+ *
4
+ * These mirror the `GET /api/cms/public/forms/:slug` response shape produced by
5
+ * cms-core's `buildPublicForm`. They are intentionally permissive (the data
6
+ * arrives off the network as JSON) and contain NO browser APIs so they can be
7
+ * unit-tested in a Node environment and imported by server components.
8
+ */
9
+ import type { FormAnalyticsConfig } from '@prenta/core/forms/analytics';
10
+ /** A single renderable field, as delivered by the public form schema. */
11
+ export interface PublicFormField {
12
+ id: string;
13
+ key: string;
14
+ label: string;
15
+ type: string;
16
+ required: boolean;
17
+ placeholder?: string;
18
+ helpText?: string;
19
+ defaultValue?: unknown;
20
+ options?: Array<{
21
+ label: string;
22
+ value: string;
23
+ }>;
24
+ width?: string;
25
+ sortOrder: number;
26
+ }
27
+ /** The public form schema (honeypot field is stripped from `fields`). */
28
+ export interface PublicForm {
29
+ id: string;
30
+ name: string;
31
+ slug: string;
32
+ description?: string;
33
+ fields: PublicFormField[];
34
+ /** Relative path to POST the submission to (e.g. `/api/cms/public/forms/contact/submit`). */
35
+ submitPath: string;
36
+ successMessage?: string;
37
+ redirectUrl?: string;
38
+ spam: {
39
+ honeypotFieldKey?: string;
40
+ minSubmitSeconds?: number;
41
+ };
42
+ captcha?: {
43
+ provider: string;
44
+ siteKey: string;
45
+ };
46
+ schemaVersionId?: string | null;
47
+ /** GA4 tracking config — present only when tracking is enabled for the form. */
48
+ analytics?: FormAnalyticsConfig;
49
+ webmcp?: {
50
+ enabled: boolean;
51
+ toolName: string;
52
+ toolDescription: string;
53
+ autoSubmit: boolean;
54
+ fieldParams: Record<string, string>;
55
+ };
56
+ }
57
+ /**
58
+ * Coerce a raw JSON value into a {@link PublicForm}, or `null` when it is not a
59
+ * usable form schema. Accepts either the bare form object or the API's
60
+ * `{ data: form }` envelope.
61
+ */
62
+ export declare function coercePublicForm(raw: unknown): PublicForm | null;
63
+ /** What the renderer should do after a successful submission. */
64
+ export interface SubmitOutcome {
65
+ /** When set, navigate here instead of showing a message. */
66
+ redirectUrl?: string;
67
+ message: string;
68
+ }
69
+ /**
70
+ * Resolve the post-submit behaviour from the API response.
71
+ *
72
+ * The submit endpoint returns `data.confirmation` as an *object*
73
+ * (`{ type, message?, redirectUrl? }` — cms-core's `SubmissionConfirmation`).
74
+ * A legacy string form is tolerated. Falls back to the schema's
75
+ * `redirectUrl` / `successMessage`, then a generic message.
76
+ */
77
+ export declare function resolveSubmitOutcome(raw: unknown, form: Pick<PublicForm, 'successMessage' | 'redirectUrl'>): SubmitOutcome;
78
+ /** How a public field type renders. */
79
+ export type FieldControl = 'input' | 'textarea' | 'select' | 'checkbox' | 'radio';
80
+ /** Decide which control a field type maps to. */
81
+ export declare function fieldControl(type: string): FieldControl;
82
+ /** Map a field type to an `<input type="...">` value (control === 'input' only). */
83
+ export declare function htmlInputType(type: string): string;
84
+ /** The initial value map for a form (honeypot excluded — it is a hidden field). */
85
+ export declare function initialValues(form: Pick<PublicForm, 'fields'>): Record<string, unknown>;
86
+ /** Label of the first required field left empty, or `null` when all are filled. */
87
+ export declare function firstMissingRequired(form: Pick<PublicForm, 'fields'>, values: Record<string, unknown>): string | null;
88
+ export interface SubmitBodyArgs {
89
+ values: Record<string, unknown>;
90
+ honeypotKey?: string;
91
+ honeypotValue?: string;
92
+ elapsedMs?: number | null;
93
+ pageUrl?: string | null;
94
+ captchaToken?: string | null;
95
+ attribution?: Record<string, unknown> | null;
96
+ }
97
+ /**
98
+ * Build the JSON body for `POST {submitPath}`. The honeypot value is merged
99
+ * into `fields` under its key (it must NOT be a top-level property), matching
100
+ * `parseSubmissionRequest` in cms-core.
101
+ */
102
+ export declare function buildSubmitBody(args: SubmitBodyArgs): Record<string, unknown>;
103
+ //# sourceMappingURL=forms.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"forms.d.ts","sourceRoot":"","sources":["../src/forms.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,mBAAmB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