@molecule/app-legal-pages-react 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,115 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work.
38
+
39
+ "Derivative Works" shall mean any work, whether in Source or Object
40
+ form, that is based on (or derived from) the Work and for which the
41
+ editorial revisions, annotations, elaborations, or other modifications
42
+ represent, as a whole, an original work of authorship.
43
+
44
+ "Contribution" shall mean any work of authorship, including the
45
+ original version of the Work and any modifications or additions
46
+ to that Work, that is intentionally submitted to the Licensor for
47
+ inclusion in the Work by the copyright owner or by an individual or
48
+ Legal Entity authorized to submit on behalf of the copyright owner.
49
+
50
+ "Contributor" shall mean Licensor and any individual or Legal Entity
51
+ on behalf of whom a Contribution has been received by the Licensor and
52
+ subsequently incorporated within the Work.
53
+
54
+ 2. Grant of Copyright License. Subject to the terms and conditions of
55
+ this License, each Contributor hereby grants to You a perpetual,
56
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
57
+ copyright license to reproduce, prepare Derivative Works of,
58
+ publicly display, publicly perform, sublicense, and distribute the
59
+ Work and such Derivative Works in Source or Object form.
60
+
61
+ 3. Grant of Patent License. Subject to the terms and conditions of
62
+ this License, each Contributor hereby grants to You a perpetual,
63
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
64
+ patent license to make, have made, use, offer to sell, sell, import,
65
+ and otherwise transfer the Work.
66
+
67
+ 4. Redistribution. You may reproduce and distribute copies of the
68
+ Work or Derivative Works thereof in any medium, with or without
69
+ modifications, and in Source or Object form, provided that You
70
+ meet the following conditions:
71
+
72
+ (a) You must give any other recipients of the Work or
73
+ Derivative Works a copy of this License; and
74
+
75
+ (b) You must cause any modified files to carry prominent notices
76
+ stating that You changed the files; and
77
+
78
+ (c) You must retain, in the Source form of any Derivative Works
79
+ that You distribute, all copyright, patent, trademark, and
80
+ attribution notices from the Source form of the Work,
81
+ excluding those notices that do not pertain to any part of
82
+ the Derivative Works; and
83
+
84
+ (d) If the Work includes a "NOTICE" text file as part of its
85
+ distribution, then any Derivative Works that You distribute must
86
+ include a readable copy of the attribution notices contained
87
+ within such NOTICE file.
88
+
89
+ 5. Submission of Contributions.
90
+
91
+ 6. Trademarks. This License does not grant permission to use the trade
92
+ names, trademarks, service marks, or product names of the Licensor.
93
+
94
+ 7. Disclaimer of Warranty. Unless required by applicable law or
95
+ agreed to in writing, Licensor provides the Work on an "AS IS" BASIS,
96
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND.
97
+
98
+ 8. Limitation of Liability. In no event and under no legal theory shall
99
+ any Contributor be liable to You for damages.
100
+
101
+ 9. Accepting Warranty or Additional Liability.
102
+
103
+ Copyright 2026 Molecule Dev, Inc.
104
+
105
+ Licensed under the Apache License, Version 2.0 (the "License");
106
+ you may not use this file except in compliance with the License.
107
+ You may obtain a copy of the License at
108
+
109
+ http://www.apache.org/licenses/LICENSE-2.0
110
+
111
+ Unless required by applicable law or agreed to in writing, software
112
+ distributed under the License is distributed on an "AS IS" BASIS,
113
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
114
+ See the License for the specific language governing permissions and
115
+ limitations under the License.
@@ -0,0 +1,47 @@
1
+ import type { JSX, ReactNode } from 'react';
2
+ /**
3
+ * Props for {@link ContentPageShell}.
4
+ */
5
+ export interface ContentPageShellProps {
6
+ /** `data-mol-id` applied to the hero `<header>` for AI-agent selectors. */
7
+ dataMolId?: string;
8
+ /** Small uppercase label above the title (e.g. "Legal", "Billing"). */
9
+ eyebrow?: ReactNode;
10
+ /**
11
+ * Page title, rendered in the app's headline font inside the hero band.
12
+ * Omit to skip the hero entirely (e.g. for content that renders its own
13
+ * heading, like a pricing tier grid).
14
+ */
15
+ title?: ReactNode;
16
+ /** Optional supporting line under the title (e.g. "Last updated …"). */
17
+ subtitle?: ReactNode;
18
+ /** App-specific top navigation, rendered above the hero. */
19
+ header?: ReactNode;
20
+ /** App-specific footer, rendered below the content. */
21
+ footer?: ReactNode;
22
+ /** Page body. Rendered inside a surface card unless {@link bare} is set. */
23
+ children: ReactNode;
24
+ /**
25
+ * When true, the body is rendered without the surface card wrapper — for
26
+ * content that brings its own surfaces (e.g. a pricing tier grid).
27
+ */
28
+ bare?: boolean;
29
+ /** Container width passed to ClassMap `container({ size })`. Defaults to `'md'`. */
30
+ containerSize?: 'sm' | 'md' | 'lg' | 'xl';
31
+ }
32
+ /**
33
+ * Branded shell for public content pages (Privacy, Terms, Pricing,
34
+ * PlanUpdated, …).
35
+ *
36
+ * Renders the app's own `header`/`footer` slots around a themed hero band
37
+ * (eyebrow + title + subtitle) and a surface-card content area. Everything
38
+ * is driven by theme tokens (`--mol-color-*`) and the app's font utility
39
+ * classes (`font-display` for the title, `font-body`/`font-label` for the
40
+ * rest), so each app's palette and typography are applied automatically
41
+ * without per-app overrides.
42
+ *
43
+ * @param props - See {@link ContentPageShellProps}.
44
+ * @returns The rendered content-page shell.
45
+ */
46
+ export declare function ContentPageShell({ dataMolId, eyebrow, title, subtitle, header, footer, children, bare, containerSize, }: ContentPageShellProps): JSX.Element;
47
+ //# sourceMappingURL=ContentPageShell.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContentPageShell.d.ts","sourceRoot":"","sources":["../src/ContentPageShell.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,GAAG,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAI1D;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,2EAA2E;IAC3E,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,uEAAuE;IACvE,OAAO,CAAC,EAAE,SAAS,CAAA;IACnB;;;;OAIG;IACH,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB,wEAAwE;IACxE,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,4DAA4D;IAC5D,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB,uDAAuD;IACvD,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB,4EAA4E;IAC5E,QAAQ,EAAE,SAAS,CAAA;IACnB;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,oFAAoF;IACpF,aAAa,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;CAC1C;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,SAAS,EACT,OAAO,EACP,KAAK,EACL,QAAQ,EACR,MAAM,EACN,MAAM,EACN,QAAQ,EACR,IAAY,EACZ,aAAoB,GACrB,EAAE,qBAAqB,GAAG,GAAG,CAAC,OAAO,CA0FrC"}
@@ -0,0 +1,24 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { getClassMap } from '@molecule/app-ui';
3
+ /**
4
+ * Branded shell for public content pages (Privacy, Terms, Pricing,
5
+ * PlanUpdated, …).
6
+ *
7
+ * Renders the app's own `header`/`footer` slots around a themed hero band
8
+ * (eyebrow + title + subtitle) and a surface-card content area. Everything
9
+ * is driven by theme tokens (`--mol-color-*`) and the app's font utility
10
+ * classes (`font-display` for the title, `font-body`/`font-label` for the
11
+ * rest), so each app's palette and typography are applied automatically
12
+ * without per-app overrides.
13
+ *
14
+ * @param props - See {@link ContentPageShellProps}.
15
+ * @returns The rendered content-page shell.
16
+ */
17
+ export function ContentPageShell({ dataMolId, eyebrow, title, subtitle, header, footer, children, bare = false, containerSize = 'md', }) {
18
+ const cm = getClassMap();
19
+ const heroStyle = {
20
+ background: 'linear-gradient(135deg, color-mix(in srgb, var(--mol-color-primary) 14%, var(--mol-color-background)) 0%, var(--mol-color-background) 70%)',
21
+ borderBottom: '1px solid color-mix(in srgb, var(--mol-color-on-surface) 8%, transparent)',
22
+ };
23
+ return (_jsxs("div", { className: cm.cn(cm.flex({ direction: 'col' }), cm.minH('screen'), 'bg-background text-on-surface font-body'), children: [header, title ? (_jsxs("header", { "data-mol-id": dataMolId, className: cm.cn('relative overflow-hidden', cm.sp('px', 6), cm.sp('py', 16)), style: heroStyle, children: [_jsx("div", { "aria-hidden": "true", className: cm.cn('pointer-events-none absolute -right-24 -top-24 h-72 w-72 rounded-full blur-3xl'), style: { background: 'color-mix(in srgb, var(--mol-color-primary) 22%, transparent)' } }), _jsxs("div", { className: cm.cn(cm.container({ size: containerSize }), 'relative z-10'), children: [eyebrow ? (_jsx("p", { className: cm.cn(cm.textSize('xs'), cm.fontWeight('bold'), cm.sp('mb', 3), 'font-label uppercase tracking-widest text-primary'), children: eyebrow })) : null, _jsx("h1", { className: cm.cn(cm.textSize('4xl'), cm.fontWeight('extrabold'), 'font-display tracking-tight'), children: title }), subtitle ? (_jsx("p", { className: cm.cn(cm.textSize('base'), cm.sp('mt', 3), 'font-body text-on-surface-variant'), children: subtitle })) : null] })] })) : null, _jsx("main", { className: cm.cn(cm.flex1, cm.sp('px', 6), cm.sp('py', 10)), children: _jsx("div", { className: cm.cn(cm.container({ size: containerSize })), children: bare ? (children) : (_jsx("div", { className: cm.cn(cm.surface, cm.sp('p', 8), 'rounded-2xl shadow-lg border border-outline-variant/40'), children: children })) }) }), footer] }));
24
+ }
@@ -0,0 +1,43 @@
1
+ import { type JSX, type ReactNode } from 'react';
2
+ /** Which legal document a {@link LegalContentPage} renders. */
3
+ export type LegalKind = 'privacy' | 'terms';
4
+ /**
5
+ * Props for {@link LegalContentPage}.
6
+ */
7
+ export interface LegalContentPageProps {
8
+ /** Which legal document to render. */
9
+ kind: LegalKind;
10
+ /** App name interpolated into the policy body (privacy uses `{{appName}}`). */
11
+ appName?: string;
12
+ /**
13
+ * Lazy-loader for the legal HTML (pass `loadContent` from the app's
14
+ * `src/config.ts`, which re-exports it from
15
+ * `@molecule/app-locales-legal-default`). Called once on mount so the
16
+ * standalone page shows the **same** bonded content as the footer modal.
17
+ */
18
+ loadContent?: (key: 'privacyPolicy' | 'termsOfService') => Promise<void> | void;
19
+ /** App-specific top navigation, rendered above the hero. */
20
+ header?: ReactNode;
21
+ /** App-specific footer, rendered below the content. */
22
+ footer?: ReactNode;
23
+ /** i18n key for the small uppercase eyebrow. Defaults to `nav.legal`. */
24
+ eyebrowKey?: string;
25
+ /** Default eyebrow text. Defaults to `Legal`. */
26
+ eyebrowDefault?: string;
27
+ }
28
+ /**
29
+ * Standalone Privacy / Terms page that renders the **same** bonded legal
30
+ * HTML the footer modal shows (`content.privacyPolicy` /
31
+ * `content.termsOfService` from `@molecule/app-locales-legal-default`),
32
+ * wrapped in the branded {@link ContentPageShell}.
33
+ *
34
+ * This keeps the in-place footer modal and the standalone `/privacy`,
35
+ * `/terms` routes perfectly in sync — one source of legal copy, two
36
+ * surfaces. Drop one of these into each app's `pages/Privacy.tsx` /
37
+ * `pages/Terms.tsx`, passing the app's own header/footer chrome.
38
+ *
39
+ * @param props - See {@link LegalContentPageProps}.
40
+ * @returns The rendered legal content page.
41
+ */
42
+ export declare function LegalContentPage({ kind, appName, loadContent, header, footer, eyebrowKey, eyebrowDefault, }: LegalContentPageProps): JSX.Element;
43
+ //# sourceMappingURL=LegalContentPage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LegalContentPage.d.ts","sourceRoot":"","sources":["../src/LegalContentPage.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,GAAG,EAAE,KAAK,SAAS,EAAuB,MAAM,OAAO,CAAA;AAOrE,+DAA+D;AAC/D,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,OAAO,CAAA;AAiB3C;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,sCAAsC;IACtC,IAAI,EAAE,SAAS,CAAA;IACf,+EAA+E;IAC/E,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,eAAe,GAAG,gBAAgB,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;IAC/E,4DAA4D;IAC5D,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB,uDAAuD;IACvD,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB,yEAAyE;IACzE,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,iDAAiD;IACjD,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,IAAI,EACJ,OAAO,EACP,WAAW,EACX,MAAM,EACN,MAAM,EACN,UAAwB,EACxB,cAAwB,GACzB,EAAE,qBAAqB,GAAG,GAAG,CAAC,OAAO,CA+BrC"}
@@ -0,0 +1,51 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useEffect, useState } from 'react';
3
+ import { useTranslation } from '@molecule/app-react';
4
+ import { getClassMap } from '@molecule/app-ui';
5
+ import { ContentPageShell } from './ContentPageShell.js';
6
+ const CONTENT_KEY = {
7
+ privacy: 'content.privacyPolicy',
8
+ terms: 'content.termsOfService',
9
+ };
10
+ const TITLE = {
11
+ privacy: { key: 'footer.privacyPolicy', def: 'Privacy Policy' },
12
+ terms: { key: 'footer.termsOfService', def: 'Terms of Service' },
13
+ };
14
+ const MODULE = {
15
+ privacy: 'privacyPolicy',
16
+ terms: 'termsOfService',
17
+ };
18
+ /**
19
+ * Standalone Privacy / Terms page that renders the **same** bonded legal
20
+ * HTML the footer modal shows (`content.privacyPolicy` /
21
+ * `content.termsOfService` from `@molecule/app-locales-legal-default`),
22
+ * wrapped in the branded {@link ContentPageShell}.
23
+ *
24
+ * This keeps the in-place footer modal and the standalone `/privacy`,
25
+ * `/terms` routes perfectly in sync — one source of legal copy, two
26
+ * surfaces. Drop one of these into each app's `pages/Privacy.tsx` /
27
+ * `pages/Terms.tsx`, passing the app's own header/footer chrome.
28
+ *
29
+ * @param props - See {@link LegalContentPageProps}.
30
+ * @returns The rendered legal content page.
31
+ */
32
+ export function LegalContentPage({ kind, appName, loadContent, header, footer, eyebrowKey = 'nav.legal', eyebrowDefault = 'Legal', }) {
33
+ const cm = getClassMap();
34
+ const { t } = useTranslation();
35
+ // Re-render once the bonded content has been registered for the
36
+ // current locale so `t(content.*)` resolves to the real HTML.
37
+ const [, setReady] = useState(false);
38
+ useEffect(() => {
39
+ let cancelled = false;
40
+ const done = () => {
41
+ if (!cancelled)
42
+ setReady(true);
43
+ };
44
+ Promise.resolve(loadContent?.(MODULE[kind])).then(done, done);
45
+ return () => {
46
+ cancelled = true;
47
+ };
48
+ }, [loadContent, kind]);
49
+ const html = t(CONTENT_KEY[kind], appName ? { appName } : {}, { defaultValue: '' });
50
+ return (_jsx(ContentPageShell, { dataMolId: `page-${kind}`, header: header, footer: footer, eyebrow: t(eyebrowKey, {}, { defaultValue: eyebrowDefault }), title: t(TITLE[kind].key, {}, { defaultValue: TITLE[kind].def }), children: _jsx("div", { className: cm.prose, dangerouslySetInnerHTML: { __html: html } }) }));
51
+ }
@@ -0,0 +1,61 @@
1
+ import { type JSX, type ReactNode } from 'react';
2
+ /** Shared options for the legal-modal hook + component. */
3
+ export interface UseLegalModalsOptions {
4
+ /** App name interpolated into the privacy AND terms bodies (`{{appName}}`). */
5
+ appName?: string;
6
+ /**
7
+ * Lazy-loader for the legal HTML — pass `loadContent` from the app's
8
+ * `src/config.ts`. Called right before a modal opens so the bonded
9
+ * content is present on first render.
10
+ */
11
+ loadContent?: (key: 'privacyPolicy' | 'termsOfService') => Promise<void> | void;
12
+ }
13
+ /** Imperative API returned by {@link useLegalModals}. */
14
+ export interface LegalModalsApi {
15
+ /** Open the Privacy Policy modal (loads content first). */
16
+ openPrivacy: () => Promise<void>;
17
+ /** Open the Terms of Service modal (loads content first). */
18
+ openTerms: () => Promise<void>;
19
+ /** The two `<Modal>` elements — render once anywhere in the tree. */
20
+ modals: JSX.Element;
21
+ }
22
+ /**
23
+ * Headless hook powering in-place Privacy/Terms modals. Use it when the
24
+ * triggers live in different parts of a bespoke footer (or a signup
25
+ * page); place `{modals}` once and wire `openPrivacy`/`openTerms` to your
26
+ * own links/buttons.
27
+ *
28
+ * The modal body is the SAME bonded HTML the {@link LegalContentPage}
29
+ * standalone routes render (`content.privacyPolicy` /
30
+ * `content.termsOfService`), so every legal surface stays in sync.
31
+ *
32
+ * @param options - See {@link UseLegalModalsOptions}.
33
+ * @returns Imperative {@link LegalModalsApi}.
34
+ */
35
+ export declare function useLegalModals({ appName, loadContent, }?: UseLegalModalsOptions): LegalModalsApi;
36
+ /** Props for {@link LegalModalLinks}. */
37
+ export interface LegalModalLinksProps extends UseLegalModalsOptions {
38
+ /** className applied to each trigger `<button>` (match the footer's link style). */
39
+ linkClassName?: string;
40
+ /** Which links to render. Defaults to `'both'`. */
41
+ show?: 'both' | 'privacy' | 'terms';
42
+ /** Override the Privacy label (defaults to i18n `footer.privacyPolicy`). */
43
+ privacyLabel?: ReactNode;
44
+ /** Override the Terms label (defaults to i18n `footer.termsOfService`). */
45
+ termsLabel?: ReactNode;
46
+ }
47
+ /**
48
+ * Drop-in Privacy/Terms links that open IN-PLACE modals instead of
49
+ * navigating — for bespoke footers and signup pages. Replace
50
+ * `<Link to="/privacy">Privacy</Link>` / `<Link to="/terms">Terms</Link>`
51
+ * with `<LegalModalLinks linkClassName={...} appName={APP_NAME} loadContent={loadContent} />`.
52
+ *
53
+ * Renders the trigger button(s) + the modals together, so it suits the
54
+ * common case where the two legal links are adjacent. For separated
55
+ * triggers, use {@link useLegalModals} directly.
56
+ *
57
+ * @param props - See {@link LegalModalLinksProps}.
58
+ * @returns The trigger button(s) and their modals.
59
+ */
60
+ export declare function LegalModalLinks({ linkClassName, show, privacyLabel, termsLabel, ...opts }: LegalModalLinksProps): JSX.Element;
61
+ //# sourceMappingURL=LegalModalLinks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LegalModalLinks.d.ts","sourceRoot":"","sources":["../src/LegalModalLinks.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,GAAG,EAAE,KAAK,SAAS,EAAY,MAAM,OAAO,CAAA;AAM1D,2DAA2D;AAC3D,MAAM,WAAW,qBAAqB;IACpC,+EAA+E;IAC/E,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;;;OAIG;IACH,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,eAAe,GAAG,gBAAgB,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;CAChF;AAED,yDAAyD;AACzD,MAAM,WAAW,cAAc;IAC7B,2DAA2D;IAC3D,WAAW,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IAChC,6DAA6D;IAC7D,SAAS,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IAC9B,qEAAqE;IACrE,MAAM,EAAE,GAAG,CAAC,OAAO,CAAA;CACpB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAAC,EAC7B,OAAO,EACP,WAAW,GACZ,GAAE,qBAA0B,GAAG,cAAc,CA+C7C;AAED,yCAAyC;AACzC,MAAM,WAAW,oBAAqB,SAAQ,qBAAqB;IACjE,oFAAoF;IACpF,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,mDAAmD;IACnD,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAA;IACnC,4EAA4E;IAC5E,YAAY,CAAC,EAAE,SAAS,CAAA;IACxB,2EAA2E;IAC3E,UAAU,CAAC,EAAE,SAAS,CAAA;CACvB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAAC,EAC9B,aAAa,EACb,IAAa,EACb,YAAY,EACZ,UAAU,EACV,GAAG,IAAI,EACR,EAAE,oBAAoB,GAAG,GAAG,CAAC,OAAO,CAkBpC"}
@@ -0,0 +1,58 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from 'react';
3
+ import { useTranslation } from '@molecule/app-react';
4
+ import { getClassMap } from '@molecule/app-ui';
5
+ import { Modal } from '@molecule/app-ui-react';
6
+ /**
7
+ * Headless hook powering in-place Privacy/Terms modals. Use it when the
8
+ * triggers live in different parts of a bespoke footer (or a signup
9
+ * page); place `{modals}` once and wire `openPrivacy`/`openTerms` to your
10
+ * own links/buttons.
11
+ *
12
+ * The modal body is the SAME bonded HTML the {@link LegalContentPage}
13
+ * standalone routes render (`content.privacyPolicy` /
14
+ * `content.termsOfService`), so every legal surface stays in sync.
15
+ *
16
+ * @param options - See {@link UseLegalModalsOptions}.
17
+ * @returns Imperative {@link LegalModalsApi}.
18
+ */
19
+ export function useLegalModals({ appName, loadContent, } = {}) {
20
+ const cm = getClassMap();
21
+ const { t } = useTranslation();
22
+ const [privacyOpen, setPrivacyOpen] = useState(false);
23
+ const [termsOpen, setTermsOpen] = useState(false);
24
+ const openPrivacy = async () => {
25
+ if (loadContent)
26
+ await loadContent('privacyPolicy');
27
+ setPrivacyOpen(true);
28
+ };
29
+ const openTerms = async () => {
30
+ if (loadContent)
31
+ await loadContent('termsOfService');
32
+ setTermsOpen(true);
33
+ };
34
+ const modals = (_jsxs(_Fragment, { children: [_jsx(Modal, { open: privacyOpen, onClose: () => setPrivacyOpen(false), title: t('footer.privacyPolicy', {}, { defaultValue: 'Privacy Policy' }), size: "lg", children: _jsx("div", { className: cm.prose, dangerouslySetInnerHTML: {
35
+ __html: t('content.privacyPolicy', appName ? { appName } : {}, { defaultValue: '' }),
36
+ } }) }), _jsx(Modal, { open: termsOpen, onClose: () => setTermsOpen(false), title: t('footer.termsOfService', {}, { defaultValue: 'Terms of Service' }), size: "lg", children: _jsx("div", { className: cm.prose, dangerouslySetInnerHTML: {
37
+ __html: t('content.termsOfService', appName ? { appName } : {}, { defaultValue: '' }),
38
+ } }) })] }));
39
+ return { openPrivacy, openTerms, modals };
40
+ }
41
+ /**
42
+ * Drop-in Privacy/Terms links that open IN-PLACE modals instead of
43
+ * navigating — for bespoke footers and signup pages. Replace
44
+ * `<Link to="/privacy">Privacy</Link>` / `<Link to="/terms">Terms</Link>`
45
+ * with `<LegalModalLinks linkClassName={...} appName={APP_NAME} loadContent={loadContent} />`.
46
+ *
47
+ * Renders the trigger button(s) + the modals together, so it suits the
48
+ * common case where the two legal links are adjacent. For separated
49
+ * triggers, use {@link useLegalModals} directly.
50
+ *
51
+ * @param props - See {@link LegalModalLinksProps}.
52
+ * @returns The trigger button(s) and their modals.
53
+ */
54
+ export function LegalModalLinks({ linkClassName, show = 'both', privacyLabel, termsLabel, ...opts }) {
55
+ const { t } = useTranslation();
56
+ const { openPrivacy, openTerms, modals } = useLegalModals(opts);
57
+ return (_jsxs(_Fragment, { children: [show !== 'terms' && (_jsx("button", { type: "button", className: linkClassName, onClick: openPrivacy, children: privacyLabel ?? t('footer.privacyPolicy', {}, { defaultValue: 'Privacy Policy' }) })), show !== 'privacy' && (_jsx("button", { type: "button", className: linkClassName, onClick: openTerms, children: termsLabel ?? t('footer.termsOfService', {}, { defaultValue: 'Terms of Service' }) })), modals] }));
58
+ }
@@ -0,0 +1,33 @@
1
+ import type { JSX, ReactNode } from 'react';
2
+ import type { SpacingScale } from '@molecule/app-ui';
3
+ /** Props for {@link LegalPageLayout}. */
4
+ export interface LegalPageLayoutProps {
5
+ /** `data-mol-id` for AI agent selectors. */
6
+ dataMolId?: string;
7
+ /** Rendered heading text (usually `t('...')`). */
8
+ title: ReactNode;
9
+ /** Body content — paragraphs, `<LegalPageSection>`s, etc. */
10
+ children: ReactNode;
11
+ /** ClassMap `container({size})` value. Defaults to `'md'`. */
12
+ containerSize?: 'sm' | 'md' | 'lg' | 'xl';
13
+ /** Stack gap between body children passed to ClassMap `stack()`. Defaults to 4. */
14
+ stackGap?: SpacingScale;
15
+ /** Override the main wrapper's className (used by apps with custom chrome). */
16
+ mainClassName?: string;
17
+ /** Override the body wrapper's className. */
18
+ bodyClassName?: string;
19
+ }
20
+ /**
21
+ * Canonical Terms / Privacy layout shell.
22
+ *
23
+ * `<main data-mol-id={...} class="container py-12">
24
+ * <h1>{title}</h1>
25
+ * <div class="prose stack">{children}</div>
26
+ * </main>`
27
+ *
28
+ * Use this as the content shell for legal pages. Custom chrome (landing
29
+ * top-nav, admin sidebar, etc.) should wrap the shell at the call site.
30
+ * @param props - Component props (see {@link LegalPageLayoutProps}).
31
+ */
32
+ export declare function LegalPageLayout({ dataMolId, title, children, containerSize, stackGap, mainClassName, bodyClassName, }: LegalPageLayoutProps): JSX.Element;
33
+ //# sourceMappingURL=LegalPageLayout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LegalPageLayout.d.ts","sourceRoot":"","sources":["../src/LegalPageLayout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAE3C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAGpD,yCAAyC;AACzC,MAAM,WAAW,oBAAoB;IACnC,4CAA4C;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,kDAAkD;IAClD,KAAK,EAAE,SAAS,CAAA;IAChB,6DAA6D;IAC7D,QAAQ,EAAE,SAAS,CAAA;IACnB,8DAA8D;IAC9D,aAAa,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;IACzC,mFAAmF;IACnF,QAAQ,CAAC,EAAE,YAAY,CAAA;IACvB,+EAA+E;IAC/E,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,6CAA6C;IAC7C,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,EAC9B,SAAS,EACT,KAAK,EACL,QAAQ,EACR,aAAoB,EACpB,QAAY,EACZ,aAAa,EACb,aAAa,GACd,EAAE,oBAAoB,GAAG,GAAG,CAAC,OAAO,CAWpC"}
@@ -0,0 +1,18 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { getClassMap } from '@molecule/app-ui';
3
+ /**
4
+ * Canonical Terms / Privacy layout shell.
5
+ *
6
+ * `<main data-mol-id={...} class="container py-12">
7
+ * <h1>{title}</h1>
8
+ * <div class="prose stack">{children}</div>
9
+ * </main>`
10
+ *
11
+ * Use this as the content shell for legal pages. Custom chrome (landing
12
+ * top-nav, admin sidebar, etc.) should wrap the shell at the call site.
13
+ * @param props - Component props (see {@link LegalPageLayoutProps}).
14
+ */
15
+ export function LegalPageLayout({ dataMolId, title, children, containerSize = 'md', stackGap = 4, mainClassName, bodyClassName, }) {
16
+ const cm = getClassMap();
17
+ return (_jsxs("main", { "data-mol-id": dataMolId, className: mainClassName ?? cm.cn(cm.container({ size: containerSize }), cm.sp('py', 12)), children: [_jsx("h1", { className: cm.cn(cm.textSize('3xl'), cm.fontWeight('bold'), cm.sp('mb', 6)), children: title }), _jsx("div", { className: bodyClassName ?? cm.cn(cm.prose, cm.stack(stackGap)), children: children })] }));
18
+ }
@@ -0,0 +1,18 @@
1
+ import type { JSX, ReactNode } from 'react';
2
+ import type { SpacingScale } from '@molecule/app-ui';
3
+ /** Props for {@link LegalPageSection}. */
4
+ export interface LegalPageSectionProps {
5
+ /** Rendered heading text. */
6
+ title: ReactNode;
7
+ /** Section body — one or more paragraphs. */
8
+ children: ReactNode;
9
+ /** Stack gap between heading and body (ClassMap `stack()`). Defaults to 2. */
10
+ stackGap?: SpacingScale;
11
+ }
12
+ /**
13
+ * One sub-section of a legal page (`h2` + body) styled for use inside
14
+ * `<LegalPageLayout>`.
15
+ * @param props - Component props (see {@link LegalPageSectionProps}).
16
+ */
17
+ export declare function LegalPageSection({ title, children, stackGap, }: LegalPageSectionProps): JSX.Element;
18
+ //# sourceMappingURL=LegalPageSection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LegalPageSection.d.ts","sourceRoot":"","sources":["../src/LegalPageSection.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAE3C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAGpD,0CAA0C;AAC1C,MAAM,WAAW,qBAAqB;IACpC,6BAA6B;IAC7B,KAAK,EAAE,SAAS,CAAA;IAChB,6CAA6C;IAC7C,QAAQ,EAAE,SAAS,CAAA;IACnB,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,YAAY,CAAA;CACxB;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,KAAK,EACL,QAAQ,EACR,QAAY,GACb,EAAE,qBAAqB,GAAG,GAAG,CAAC,OAAO,CAQrC"}
@@ -0,0 +1,11 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { getClassMap } from '@molecule/app-ui';
3
+ /**
4
+ * One sub-section of a legal page (`h2` + body) styled for use inside
5
+ * `<LegalPageLayout>`.
6
+ * @param props - Component props (see {@link LegalPageSectionProps}).
7
+ */
8
+ export function LegalPageSection({ title, children, stackGap = 2, }) {
9
+ const cm = getClassMap();
10
+ return (_jsxs("section", { className: cm.stack(stackGap), children: [_jsx("h2", { className: cm.cn(cm.textSize('xl'), cm.fontWeight('semibold')), children: title }), children] }));
11
+ }
@@ -0,0 +1,28 @@
1
+ import type { JSX } from 'react';
2
+ /** Props for {@link PlanUpdatedPage}. */
3
+ export interface PlanUpdatedPageProps {
4
+ /** i18n key for the primary message heading. */
5
+ messageKey?: string;
6
+ /** Default message when the key is missing. */
7
+ messageDefault?: string;
8
+ /** i18n key for the secondary heading. */
9
+ thankYouKey?: string;
10
+ /** Default thank-you text when the key is missing. */
11
+ thankYouDefault?: string;
12
+ /** i18n key for the action-button label. */
13
+ actionKey?: string;
14
+ /** Default action label when the key is missing. */
15
+ actionDefault?: string;
16
+ /** Href the action button navigates to. Defaults to `/`. */
17
+ actionHref?: string;
18
+ }
19
+ /**
20
+ * "Plan updated" confirmation screen.
21
+ *
22
+ * Waits for auth state to initialize, then shows a two-line confirmation
23
+ * with a single return-home action. i18n keys are configurable so apps
24
+ * can match their existing locale shape.
25
+ * @param props - Component props (see {@link PlanUpdatedPageProps}).
26
+ */
27
+ export declare function PlanUpdatedPage({ messageKey, messageDefault, thankYouKey, thankYouDefault, actionKey, actionDefault, actionHref, }?: PlanUpdatedPageProps): JSX.Element;
28
+ //# sourceMappingURL=PlanUpdatedPage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PlanUpdatedPage.d.ts","sourceRoot":"","sources":["../src/PlanUpdatedPage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAOhC,yCAAyC;AACzC,MAAM,WAAW,oBAAoB;IACnC,gDAAgD;IAChD,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,+CAA+C;IAC/C,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,0CAA0C;IAC1C,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,sDAAsD;IACtD,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,4CAA4C;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,oDAAoD;IACpD,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,4DAA4D;IAC5D,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,EAC9B,UAAkC,EAClC,cAA8C,EAC9C,WAAoC,EACpC,eAA8B,EAC9B,SAAoC,EACpC,aAAgC,EAChC,UAAgB,GACjB,GAAE,oBAAyB,GAAG,GAAG,CAAC,OAAO,CA0BzC"}
@@ -0,0 +1,22 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Link } from 'react-router';
3
+ import { useAuth, useTranslation } from '@molecule/app-react';
4
+ import { getClassMap } from '@molecule/app-ui';
5
+ import { Button, Flex, Spinner } from '@molecule/app-ui-react';
6
+ /**
7
+ * "Plan updated" confirmation screen.
8
+ *
9
+ * Waits for auth state to initialize, then shows a two-line confirmation
10
+ * with a single return-home action. i18n keys are configurable so apps
11
+ * can match their existing locale shape.
12
+ * @param props - Component props (see {@link PlanUpdatedPageProps}).
13
+ */
14
+ export function PlanUpdatedPage({ messageKey = 'planUpdated.message', messageDefault = 'Your plan has been updated.', thankYouKey = 'planUpdated.thankYou', thankYouDefault = 'Thank you!', actionKey = 'planUpdated.returnHome', actionDefault = 'Return to Home', actionHref = '/', } = {}) {
15
+ const cm = getClassMap();
16
+ const { t } = useTranslation();
17
+ const { state } = useAuth();
18
+ if (!state.initialized) {
19
+ return (_jsx(Flex, { align: "center", justify: "center", className: cm.sp('py', 12), children: _jsx(Spinner, {}) }));
20
+ }
21
+ return (_jsxs("main", { "data-mol-id": "page-plan-updated", className: cm.cn(cm.textCenter, cm.sp('py', 12)), children: [_jsx("h2", { className: cm.cn(cm.textSize('2xl'), cm.fontWeight('bold'), cm.sp('mb', 2)), children: t(messageKey, {}, { defaultValue: messageDefault }) }), _jsx("h2", { className: cm.cn(cm.textSize('2xl'), cm.fontWeight('bold'), cm.sp('mb', 8)), children: t(thankYouKey, {}, { defaultValue: thankYouDefault }) }), _jsx(Link, { to: actionHref, children: _jsx(Button, { children: t(actionKey, {}, { defaultValue: actionDefault }) }) })] }));
22
+ }
@@ -0,0 +1,26 @@
1
+ import type { JSX, ReactNode } from 'react';
2
+ import type { SpacingScale } from '@molecule/app-ui';
3
+ /** Props for {@link PrivacyPage}. */
4
+ export interface PrivacyPageProps {
5
+ /** i18n key for the page heading. Defaults to `privacy.title`. */
6
+ titleKey?: string;
7
+ /** Default for the heading when the key is missing. Defaults to `"Privacy"`. */
8
+ titleDefault?: string;
9
+ /** i18n key for the single-paragraph intro (ignored when `children` is passed). */
10
+ introKey?: string;
11
+ /** Default intro body when the key is missing. */
12
+ introDefault?: string;
13
+ /** Optional override body — use when the page has real content. */
14
+ children?: ReactNode;
15
+ /** Stack gap between body children. */
16
+ stackGap?: SpacingScale;
17
+ }
18
+ /**
19
+ * Default Privacy-policy page scaffold.
20
+ *
21
+ * With no props, renders the canonical boilerplate Privacy page.
22
+ * Pass `children` to render real content.
23
+ * @param props - Component props (see {@link PrivacyPageProps}).
24
+ */
25
+ export declare function PrivacyPage({ titleKey, titleDefault, introKey, introDefault, children, stackGap, }: PrivacyPageProps): JSX.Element;
26
+ //# sourceMappingURL=PrivacyPage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PrivacyPage.d.ts","sourceRoot":"","sources":["../src/PrivacyPage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAG3C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAIpD,qCAAqC;AACrC,MAAM,WAAW,gBAAgB;IAC/B,kEAAkE;IAClE,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,gFAAgF;IAChF,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,mFAAmF;IACnF,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,kDAAkD;IAClD,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,mEAAmE;IACnE,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,uCAAuC;IACvC,QAAQ,CAAC,EAAE,YAAY,CAAA;CACxB;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,EAC1B,QAA0B,EAC1B,YAAwB,EACxB,QAA0B,EAC1B,YAAsF,EACtF,QAAQ,EACR,QAAQ,GACT,EAAE,gBAAgB,GAAG,GAAG,CAAC,OAAO,CAWhC"}
@@ -0,0 +1,14 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useTranslation } from '@molecule/app-react';
3
+ import { LegalPageLayout } from './LegalPageLayout.js';
4
+ /**
5
+ * Default Privacy-policy page scaffold.
6
+ *
7
+ * With no props, renders the canonical boilerplate Privacy page.
8
+ * Pass `children` to render real content.
9
+ * @param props - Component props (see {@link PrivacyPageProps}).
10
+ */
11
+ export function PrivacyPage({ titleKey = 'privacy.title', titleDefault = 'Privacy', introKey = 'privacy.intro', introDefault = 'This is the Privacy page. Replace this placeholder with real content.', children, stackGap, }) {
12
+ const { t } = useTranslation();
13
+ return (_jsx(LegalPageLayout, { dataMolId: "page-privacy", title: t(titleKey, {}, { defaultValue: titleDefault }), stackGap: stackGap, children: children ?? _jsx("p", { children: t(introKey, {}, { defaultValue: introDefault }) }) }));
14
+ }
@@ -0,0 +1,27 @@
1
+ import type { JSX, ReactNode } from 'react';
2
+ import type { SpacingScale } from '@molecule/app-ui';
3
+ /** Props for {@link TermsPage}. */
4
+ export interface TermsPageProps {
5
+ /** i18n key for the page heading. Defaults to `terms.title`. */
6
+ titleKey?: string;
7
+ /** Default for the heading when the i18n key is missing. Defaults to `"Terms"`. */
8
+ titleDefault?: string;
9
+ /** i18n key for the single-paragraph intro (ignored when `children` is passed). */
10
+ introKey?: string;
11
+ /** Default intro body when the key is missing. */
12
+ introDefault?: string;
13
+ /** Optional override body — use when the page has real content, not boilerplate. */
14
+ children?: ReactNode;
15
+ /** Stack gap between body children. */
16
+ stackGap?: SpacingScale;
17
+ }
18
+ /**
19
+ * Default Terms-of-service page scaffold.
20
+ *
21
+ * With no props, renders the canonical boilerplate Terms
22
+ * (`<main><h1>{t('terms.title')}</h1><p>{t('terms.intro')}</p></main>`).
23
+ * Pass `children` to render real content (e.g. `<LegalPageSection>`s).
24
+ * @param props - Component props (see {@link TermsPageProps}).
25
+ */
26
+ export declare function TermsPage({ titleKey, titleDefault, introKey, introDefault, children, stackGap, }: TermsPageProps): JSX.Element;
27
+ //# sourceMappingURL=TermsPage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TermsPage.d.ts","sourceRoot":"","sources":["../src/TermsPage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAG3C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAIpD,mCAAmC;AACnC,MAAM,WAAW,cAAc;IAC7B,gEAAgE;IAChE,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,mFAAmF;IACnF,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,mFAAmF;IACnF,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,kDAAkD;IAClD,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,oFAAoF;IACpF,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,uCAAuC;IACvC,QAAQ,CAAC,EAAE,YAAY,CAAA;CACxB;AAED;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,EACxB,QAAwB,EACxB,YAAsB,EACtB,QAAwB,EACxB,YAAoF,EACpF,QAAQ,EACR,QAAQ,GACT,EAAE,cAAc,GAAG,GAAG,CAAC,OAAO,CAW9B"}
@@ -0,0 +1,15 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useTranslation } from '@molecule/app-react';
3
+ import { LegalPageLayout } from './LegalPageLayout.js';
4
+ /**
5
+ * Default Terms-of-service page scaffold.
6
+ *
7
+ * With no props, renders the canonical boilerplate Terms
8
+ * (`<main><h1>{t('terms.title')}</h1><p>{t('terms.intro')}</p></main>`).
9
+ * Pass `children` to render real content (e.g. `<LegalPageSection>`s).
10
+ * @param props - Component props (see {@link TermsPageProps}).
11
+ */
12
+ export function TermsPage({ titleKey = 'terms.title', titleDefault = 'Terms', introKey = 'terms.intro', introDefault = 'This is the Terms page. Replace this placeholder with real content.', children, stackGap, }) {
13
+ const { t } = useTranslation();
14
+ return (_jsx(LegalPageLayout, { dataMolId: "page-terms", title: t(titleKey, {}, { defaultValue: titleDefault }), stackGap: stackGap, children: children ?? _jsx("p", { children: t(introKey, {}, { defaultValue: introDefault }) }) }));
15
+ }
@@ -0,0 +1,67 @@
1
+ /**
2
+ * React page scaffolds for Terms, Privacy, and PlanUpdated.
3
+ *
4
+ * Exports:
5
+ * - Drop-in pages: `<TermsPage>`, `<PrivacyPage>` (boilerplate bodies with
6
+ * configurable i18n keys), `<PlanUpdatedPage>` (post-checkout confirmation).
7
+ * - Bonded-content pages: `<LegalContentPage kind="privacy" | "terms">` — renders
8
+ * the SAME legal HTML as the footer modals (`content.privacyPolicy` /
9
+ * `content.termsOfService` from `@molecule/app-locales-legal-default`), inside
10
+ * the branded `<ContentPageShell>`.
11
+ * - In-place modals: `<LegalModalLinks>` + `useLegalModals()` — Privacy/Terms
12
+ * triggers that open modals instead of navigating.
13
+ * - Primitives: `<ContentPageShell>` (hero band + surface card),
14
+ * `<LegalPageLayout>`, `<LegalPageSection>`.
15
+ *
16
+ * @remarks
17
+ * - `LegalContentPage` / `useLegalModals` render bonded HTML that defaults to an
18
+ * EMPTY string until the locale module is registered — pass your app's
19
+ * `loadContent` (from `src/config.ts`, re-exporting
20
+ * `@molecule/app-locales-legal-default`) or the page/modal body will be blank.
21
+ * - `PlanUpdatedPage` requires BOTH a react-router `<Router>` ancestor (it renders
22
+ * a `<Link>`) and wired auth state from `@molecule/app-react` — without an auth
23
+ * provider it shows a spinner forever (`state.initialized` never flips). The
24
+ * rest of the package is router-free.
25
+ * - **Name collision:** `PlanUpdatedPage` is also exported by
26
+ * `@molecule/app-pricing-page-react` (the pricing-page-flavored success page), and a
27
+ * standalone `<PlanUpdated>` lives in `@molecule/app-plan-updated-page-react`. THIS
28
+ * package's `<PlanUpdatedPage>` is the legal-pages-kit confirmation page — import it
29
+ * from `@molecule/app-legal-pages-react` when you use this kit's other pages.
30
+ * - `ContentPageShell`'s hero reads `var(--mol-color-primary)` and
31
+ * `var(--mol-color-background)` with no fallback, and uses Tailwind theme
32
+ * utilities (`font-display`, `bg-background`, `border-outline-variant`) — the
33
+ * app theme must define the `--mol-color-` override tokens and font utilities
34
+ * or the hero band renders unstyled.
35
+ * - `TermsPage`/`PrivacyPage` default keys (`terms.title`, `terms.intro`,
36
+ * `privacy.title`, `privacy.intro`) and the `nav.legal` eyebrow ship in no
37
+ * locale bond — the English `defaultValue`s render unless your app defines
38
+ * those keys (all keys are overridable via props).
39
+ *
40
+ * @example
41
+ * ```tsx
42
+ * import { ContentPageShell, LegalPageLayout, LegalPageSection, TermsPage } from '@molecule/app-legal-pages-react'
43
+ *
44
+ * // Drop-in Terms page (boilerplate body):
45
+ * <TermsPage />
46
+ *
47
+ * // Custom Terms page with structured sections:
48
+ * <ContentPageShell eyebrow="Legal" title="Terms of Service" subtitle="Last updated June 2025">
49
+ * <LegalPageLayout title="Terms of Service">
50
+ * <LegalPageSection title="Acceptance">
51
+ * <p>By using this service you agree to these terms.</p>
52
+ * </LegalPageSection>
53
+ * </LegalPageLayout>
54
+ * </ContentPageShell>
55
+ * ```
56
+ *
57
+ * @module
58
+ */
59
+ export * from './ContentPageShell.js';
60
+ export * from './LegalContentPage.js';
61
+ export * from './LegalModalLinks.js';
62
+ export * from './LegalPageLayout.js';
63
+ export * from './LegalPageSection.js';
64
+ export * from './PlanUpdatedPage.js';
65
+ export * from './PrivacyPage.js';
66
+ export * from './TermsPage.js';
67
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AAEH,cAAc,uBAAuB,CAAA;AACrC,cAAc,uBAAuB,CAAA;AACrC,cAAc,sBAAsB,CAAA;AACpC,cAAc,sBAAsB,CAAA;AACpC,cAAc,uBAAuB,CAAA;AACrC,cAAc,sBAAsB,CAAA;AACpC,cAAc,kBAAkB,CAAA;AAChC,cAAc,gBAAgB,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,66 @@
1
+ /**
2
+ * React page scaffolds for Terms, Privacy, and PlanUpdated.
3
+ *
4
+ * Exports:
5
+ * - Drop-in pages: `<TermsPage>`, `<PrivacyPage>` (boilerplate bodies with
6
+ * configurable i18n keys), `<PlanUpdatedPage>` (post-checkout confirmation).
7
+ * - Bonded-content pages: `<LegalContentPage kind="privacy" | "terms">` — renders
8
+ * the SAME legal HTML as the footer modals (`content.privacyPolicy` /
9
+ * `content.termsOfService` from `@molecule/app-locales-legal-default`), inside
10
+ * the branded `<ContentPageShell>`.
11
+ * - In-place modals: `<LegalModalLinks>` + `useLegalModals()` — Privacy/Terms
12
+ * triggers that open modals instead of navigating.
13
+ * - Primitives: `<ContentPageShell>` (hero band + surface card),
14
+ * `<LegalPageLayout>`, `<LegalPageSection>`.
15
+ *
16
+ * @remarks
17
+ * - `LegalContentPage` / `useLegalModals` render bonded HTML that defaults to an
18
+ * EMPTY string until the locale module is registered — pass your app's
19
+ * `loadContent` (from `src/config.ts`, re-exporting
20
+ * `@molecule/app-locales-legal-default`) or the page/modal body will be blank.
21
+ * - `PlanUpdatedPage` requires BOTH a react-router `<Router>` ancestor (it renders
22
+ * a `<Link>`) and wired auth state from `@molecule/app-react` — without an auth
23
+ * provider it shows a spinner forever (`state.initialized` never flips). The
24
+ * rest of the package is router-free.
25
+ * - **Name collision:** `PlanUpdatedPage` is also exported by
26
+ * `@molecule/app-pricing-page-react` (the pricing-page-flavored success page), and a
27
+ * standalone `<PlanUpdated>` lives in `@molecule/app-plan-updated-page-react`. THIS
28
+ * package's `<PlanUpdatedPage>` is the legal-pages-kit confirmation page — import it
29
+ * from `@molecule/app-legal-pages-react` when you use this kit's other pages.
30
+ * - `ContentPageShell`'s hero reads `var(--mol-color-primary)` and
31
+ * `var(--mol-color-background)` with no fallback, and uses Tailwind theme
32
+ * utilities (`font-display`, `bg-background`, `border-outline-variant`) — the
33
+ * app theme must define the `--mol-color-` override tokens and font utilities
34
+ * or the hero band renders unstyled.
35
+ * - `TermsPage`/`PrivacyPage` default keys (`terms.title`, `terms.intro`,
36
+ * `privacy.title`, `privacy.intro`) and the `nav.legal` eyebrow ship in no
37
+ * locale bond — the English `defaultValue`s render unless your app defines
38
+ * those keys (all keys are overridable via props).
39
+ *
40
+ * @example
41
+ * ```tsx
42
+ * import { ContentPageShell, LegalPageLayout, LegalPageSection, TermsPage } from '@molecule/app-legal-pages-react'
43
+ *
44
+ * // Drop-in Terms page (boilerplate body):
45
+ * <TermsPage />
46
+ *
47
+ * // Custom Terms page with structured sections:
48
+ * <ContentPageShell eyebrow="Legal" title="Terms of Service" subtitle="Last updated June 2025">
49
+ * <LegalPageLayout title="Terms of Service">
50
+ * <LegalPageSection title="Acceptance">
51
+ * <p>By using this service you agree to these terms.</p>
52
+ * </LegalPageSection>
53
+ * </LegalPageLayout>
54
+ * </ContentPageShell>
55
+ * ```
56
+ *
57
+ * @module
58
+ */
59
+ export * from './ContentPageShell.js';
60
+ export * from './LegalContentPage.js';
61
+ export * from './LegalModalLinks.js';
62
+ export * from './LegalPageLayout.js';
63
+ export * from './LegalPageSection.js';
64
+ export * from './PlanUpdatedPage.js';
65
+ export * from './PrivacyPage.js';
66
+ export * from './TermsPage.js';
package/package.json ADDED
@@ -0,0 +1,49 @@
1
+ {
2
+ "name": "@molecule/app-legal-pages-react",
3
+ "version": "1.0.0",
4
+ "description": "React page scaffolds for Terms, Privacy, and PlanUpdated (i18n-driven, customizable keys)",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "scripts": {
9
+ "build": "tsc",
10
+ "test": "vitest run",
11
+ "test:watch": "vitest"
12
+ },
13
+ "exports": {
14
+ ".": {
15
+ "types": "./dist/index.d.ts",
16
+ "import": "./dist/index.js"
17
+ }
18
+ },
19
+ "files": [
20
+ "dist"
21
+ ],
22
+ "keywords": [
23
+ "molecule",
24
+ "legal",
25
+ "pages",
26
+ "react"
27
+ ],
28
+ "license": "Apache-2.0",
29
+ "peerDependencies": {
30
+ "@molecule/app-react": "^1.0.0",
31
+ "@molecule/app-ui": "^1.0.0",
32
+ "@molecule/app-ui-react": "^1.0.0",
33
+ "react": "^18.0.0 || ^19.0.0",
34
+ "react-router": "^7.0.0 || ^8.0.0"
35
+ },
36
+ "devDependencies": {
37
+ "@molecule/app-react": "1.0.0",
38
+ "@molecule/app-ui": "1.0.0",
39
+ "@molecule/app-ui-react": "1.0.0",
40
+ "@types/node": "26.1.2",
41
+ "@types/react": "19.2.17",
42
+ "@types/react-dom": "19.2.3",
43
+ "react": "19.2.8",
44
+ "react-dom": "19.2.8",
45
+ "react-router": "8.3.0",
46
+ "typescript": "6.0.3",
47
+ "vitest": "4.1.10"
48
+ }
49
+ }