@eifi1/ui-kit 0.51.2 → 0.51.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/dist/components/combobox-core.js +4 -5
- package/dist/components/combobox-core.js.map +1 -1
- package/dist/components/currency-option-list.js +3 -3
- package/dist/components/currency-option-list.js.map +1 -1
- package/dist/components/data-table-fit.js +7 -5
- package/dist/components/data-table-fit.js.map +1 -1
- package/dist/components/data-table-head.js +5 -1
- package/dist/components/data-table-head.js.map +1 -1
- package/dist/components/data-table.d.ts +8 -0
- package/dist/components/data-table.js.map +1 -1
- package/dist/components/grouped-picker.js +5 -4
- package/dist/components/grouped-picker.js.map +1 -1
- package/dist/components/icon-picker.js +5 -4
- package/dist/components/icon-picker.js.map +1 -1
- package/dist/components/inline-entity-combobox.js +4 -4
- package/dist/components/inline-entity-combobox.js.map +1 -1
- package/dist/components/legal-labels.js +9 -2
- package/dist/components/legal-labels.js.map +1 -1
- package/dist/components/legal-page.d.ts +35 -3
- package/dist/components/legal-page.js +22 -0
- package/dist/components/legal-page.js.map +1 -1
- package/dist/components/legal.d.ts +49 -5
- package/dist/components/legal.js +31 -3
- package/dist/components/legal.js.map +1 -1
- package/dist/components/list-labels.js +3 -1
- package/dist/components/list-labels.js.map +1 -1
- package/dist/components/list.d.ts +18 -1
- package/dist/components/list.js +32 -3
- package/dist/components/list.js.map +1 -1
- package/dist/eslint/index.js +1 -1
- package/dist/feedback/feedback-table.d.ts +3 -1
- package/dist/feedback/feedback-table.js +18 -4
- package/dist/feedback/feedback-table.js.map +1 -1
- package/dist/i18n/german.js +12 -3
- package/dist/i18n/german.js.map +1 -1
- package/dist/i18n/locales/en.js +16 -3
- package/dist/i18n/locales/en.js.map +2 -2
- package/dist/i18n/locales/es.js +12 -3
- package/dist/i18n/locales/es.js.map +1 -1
- package/dist/i18n/locales/fr.js +12 -3
- package/dist/i18n/locales/fr.js.map +1 -1
- package/dist/i18n/locales/hu.js +12 -3
- package/dist/i18n/locales/hu.js.map +1 -1
- package/dist/i18n/locales/it.js +12 -3
- package/dist/i18n/locales/it.js.map +1 -1
- package/dist/i18n/locales/zh.js +12 -3
- package/dist/i18n/locales/zh.js.map +1 -1
- package/dist/i18n/review.js +4 -0
- package/dist/i18n/review.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/text-match.d.ts +16 -0
- package/dist/lib/text-match.js +11 -1
- package/dist/lib/text-match.js.map +1 -1
- package/dist/settings/use-settings-focus.d.ts +7 -0
- package/dist/settings/use-settings-focus.js +2 -0
- package/dist/settings/use-settings-focus.js.map +1 -1
- package/dist/shell/dev-menu.d.ts +5 -0
- package/dist/shell/dev-menu.js +2 -1
- package/dist/shell/dev-menu.js.map +1 -1
- package/dist/shell/topbar-action-menu.d.ts +14 -1
- package/dist/shell/topbar-action-menu.js +85 -34
- package/dist/shell/topbar-action-menu.js.map +1 -1
- package/dist/shell.d.ts +1 -1
- package/dist/shell.js +2 -1
- package/dist/shell.js.map +1 -1
- package/package.json +1 -1
- package/src/components/combobox-core.tsx +5 -5
- package/src/components/currency-option-list.tsx +4 -5
- package/src/components/data-table-fit.ts +7 -5
- package/src/components/data-table-head.tsx +5 -1
- package/src/components/data-table.tsx +8 -0
- package/src/components/grouped-picker.tsx +15 -8
- package/src/components/icon-picker.tsx +6 -4
- package/src/components/inline-entity-combobox.tsx +5 -4
- package/src/components/legal-labels.ts +8 -1
- package/src/components/legal-page.tsx +72 -2
- package/src/components/legal.tsx +80 -5
- package/src/components/list-labels.ts +2 -0
- package/src/components/list.tsx +52 -2
- package/src/feedback/feedback-table.tsx +17 -1
- package/src/i18n/german.ts +10 -1
- package/src/i18n/locales/en.ts +4 -0
- package/src/i18n/locales/es.ts +10 -1
- package/src/i18n/locales/fr.ts +10 -1
- package/src/i18n/locales/hu.ts +10 -1
- package/src/i18n/locales/it.ts +10 -1
- package/src/i18n/locales/zh.ts +10 -1
- package/src/i18n/review.ts +4 -0
- package/src/index.ts +1 -0
- package/src/lib/text-match.ts +30 -0
- package/src/settings/use-settings-focus.ts +8 -0
- package/src/shell/dev-menu.tsx +6 -0
- package/src/shell/topbar-action-menu.tsx +122 -38
- package/src/shell.ts +1 -1
|
@@ -5,6 +5,8 @@ import { ArrowLeft } from "lucide-react";
|
|
|
5
5
|
import { UiKitProvider, useKitLocale } from "../i18n/kit-labels.js";
|
|
6
6
|
import { useNoIndex } from "../hooks/use-noindex.js";
|
|
7
7
|
import { cn } from "../lib/cn.js";
|
|
8
|
+
import { parseIsoDate } from "../lib/dates.js";
|
|
9
|
+
import { formatDate } from "../lib/format.js";
|
|
8
10
|
import { Checkbox } from "./checkbox.js";
|
|
9
11
|
import {
|
|
10
12
|
DEFAULT_LEGAL_LABELS,
|
|
@@ -17,6 +19,7 @@ import {
|
|
|
17
19
|
LegalSlotContext,
|
|
18
20
|
LegalText,
|
|
19
21
|
legalOperatorText,
|
|
22
|
+
resolveLegalRefs,
|
|
20
23
|
useLegalLabels,
|
|
21
24
|
warnLegalOnce
|
|
22
25
|
} from "./legal.js";
|
|
@@ -185,6 +188,8 @@ function LegalPage({
|
|
|
185
188
|
footer,
|
|
186
189
|
homeHref = "/",
|
|
187
190
|
notice,
|
|
191
|
+
updated,
|
|
192
|
+
summary,
|
|
188
193
|
onShowBindingLanguage,
|
|
189
194
|
locale: localeProp,
|
|
190
195
|
headingAs = "h1",
|
|
@@ -218,6 +223,21 @@ function LegalPage({
|
|
|
218
223
|
/* @__PURE__ */ jsx(Button, { type: "button", variant: "link", size: "sm", className: "h-auto p-0 align-baseline", onClick: onShowBindingLanguage, children: labels.translation.show(operatorText) })
|
|
219
224
|
] })
|
|
220
225
|
] }) : void 0;
|
|
226
|
+
const updatedValid = updated !== void 0 && parseIsoDate(updated) !== null;
|
|
227
|
+
if (updated !== void 0 && !updatedValid) {
|
|
228
|
+
warnLegalOnce(`LegalPage: updated="${updated}" is not a "YYYY-MM-DD" date; no "Last updated" line is shown.`);
|
|
229
|
+
}
|
|
230
|
+
const updatedLine = updatedValid ? /* @__PURE__ */ jsx("time", { dateTime: updated, children: (labels.updated ?? DEFAULT_LEGAL_LABELS.updated)(formatDate(updated, "long", { locale })) }) : void 0;
|
|
231
|
+
const summaryLabels = labels.summary ?? DEFAULT_LEGAL_LABELS.summary;
|
|
232
|
+
const SummaryHeading = context.sectionHeading;
|
|
233
|
+
const summaryBox = summary !== void 0 && summary.length > 0 ? /* @__PURE__ */ jsxs("section", { id: "summary", className: "rounded-lg border border-subtle bg-surface p-4 sm:p-5", children: [
|
|
234
|
+
/* @__PURE__ */ jsx(SummaryHeading, { className: "text-lg font-semibold break-words text-primary", children: summaryLabels.title }),
|
|
235
|
+
/* @__PURE__ */ jsx("ul", { className: "mt-3 space-y-2", children: summary.map((point, i) => /* @__PURE__ */ jsxs("li", { className: "flex gap-2.5 text-sm leading-relaxed text-secondary", children: [
|
|
236
|
+
/* @__PURE__ */ jsx("span", { "aria-hidden": true, className: "mt-2 size-1.5 shrink-0 rounded-full bg-brand" }),
|
|
237
|
+
/* @__PURE__ */ jsx("span", { className: "min-w-0 break-words", children: typeof point === "string" ? resolveLegalRefs(point, context) : point })
|
|
238
|
+
] }, i)) }),
|
|
239
|
+
/* @__PURE__ */ jsx("p", { className: "mt-3 text-xs text-muted", children: summaryLabels.note })
|
|
240
|
+
] }) : void 0;
|
|
221
241
|
return /* @__PURE__ */ jsx(UiKitProvider, { labels: overrides, children: /* @__PURE__ */ jsxs("div", { className: cn("flex min-h-full flex-col", className), children: [
|
|
222
242
|
header,
|
|
223
243
|
/* @__PURE__ */ jsx(Main, { className: "flex-1", children: /* @__PURE__ */ jsx(LegalPageContext.Provider, { value: context, children: /* @__PURE__ */ jsx(
|
|
@@ -226,7 +246,9 @@ function LegalPage({
|
|
|
226
246
|
back: /* @__PURE__ */ jsx(TextLink, { href: homeHref, icon: ArrowLeft, children: labels.backHome }),
|
|
227
247
|
title: labels.titles[page],
|
|
228
248
|
notice: shownNotice,
|
|
249
|
+
updated: updatedLine,
|
|
229
250
|
translationNote,
|
|
251
|
+
summary: summaryBox,
|
|
230
252
|
headingAs,
|
|
231
253
|
children: nodes
|
|
232
254
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/legal-page.tsx"],"sourcesContent":["import { Fragment, isValidElement, useContext, useMemo } from \"react\";\nimport type { ReactNode, Ref } from \"react\";\nimport { ArrowLeft } from \"lucide-react\";\n\nimport { UiKitProvider, useKitLocale } from \"../i18n/kit-labels\";\nimport type { LabelOverride, UiKitLabelOverrides } from \"../i18n/kit-labels\";\nimport { useNoIndex } from \"../hooks/use-noindex\";\nimport { cn } from \"../lib/cn\";\nimport { Checkbox } from \"./checkbox\";\nimport type { CheckboxProps } from \"./checkbox\";\nimport {\n DEFAULT_LEGAL_LABELS,\n LEGAL_HREFS,\n baseLanguage,\n LegalFooter,\n LegalLayout,\n LegalPageContext,\n LegalSection,\n LegalSlotContext,\n LegalText,\n legalOperatorText,\n useLegalLabels,\n warnLegalOnce,\n} from \"./legal\";\nimport type {\n LegalDisclaimerSectionLabels,\n LegalFramedSectionLabels,\n LegalLabels,\n LegalOperator,\n LegalOperatorSectionLabels,\n LegalOperatorText,\n LegalPageContextValue,\n LegalPageKey,\n LegalRefTarget,\n LegalSectionProps,\n LegalTextSectionLabels,\n} from \"./legal\";\nimport { TextLink } from \"./text-link\";\nimport { Button } from \"./button\";\n\n/**\n * The legal pages' frame and the kit's own sections — docs/legal-harmonization.md §3\n * and §4, the 0.28 round. The labels, the column, `LegalSection`, the links and the\n * footer are in `./legal`.\n */\n\n// ── The skeleton (§4.2) ───────────────────────────────────────────────────────\n\n/** Who writes a section: the kit's wording, the app's own, or the kit's wording with an\n * app paragraph in a fixed slot. */\nexport type LegalSectionOwner = \"kit\" | \"app\" | \"kit+app\";\n\nexport interface LegalSkeletonEntry {\n /** The section key — its `id` and its catalogue key. `\"*\"` is the slot where the\n * app's own sections go (zero or more: keksdose's `credits`, `price_pool`, …). */\n key: string;\n owner: LegalSectionOwner;\n}\n\nexport interface LegalSkeletonPage {\n /** Whether the page numbers its sections (\"3. Legal basis\"). The imprint does not. */\n numbered: boolean;\n /** The sections in their order. */\n sections: readonly LegalSkeletonEntry[];\n}\n\n/**\n * The section order every app's legal pages follow (§4.2), as data — so an app's test\n * can assert that its pages do, and so the order lives in one place, not in three apps'\n * reading of a table. `LegalPage` reads `numbered` from it.\n *\n * An app's test, given the section ids its page rendered in order:\n *\n * const fixed = LEGAL_SKELETON.privacy.sections.map((s) => s.key).filter((k) => k !== \"*\");\n * expect(ids.filter((id) => fixed.includes(id))).toEqual(fixed);\n *\n * Every fixed key is there, in the skeleton's order; the ids that are not in it are the\n * app's own sections, which belong where `\"*\"` stands.\n */\nexport const LEGAL_SKELETON: Readonly<Record<LegalPageKey, LegalSkeletonPage>> = Object.freeze({\n impressum: Object.freeze({\n numbered: false,\n sections: Object.freeze([\n { key: \"operator\", owner: \"kit\" },\n { key: \"contact\", owner: \"kit\" },\n { key: \"disclaimer\", owner: \"kit\" },\n { key: \"*\", owner: \"app\" },\n ] as const),\n }),\n privacy: Object.freeze({\n numbered: true,\n sections: Object.freeze([\n { key: \"controller\", owner: \"kit\" },\n { key: \"data\", owner: \"app\" },\n { key: \"legal_basis\", owner: \"kit+app\" },\n { key: \"third_parties\", owner: \"app\" },\n { key: \"*\", owner: \"app\" },\n { key: \"browser\", owner: \"kit+app\" },\n { key: \"transfers\", owner: \"app\" },\n { key: \"retention\", owner: \"app\" },\n { key: \"rights\", owner: \"kit+app\" },\n { key: \"contact\", owner: \"kit\" },\n ] as const),\n }),\n terms: Object.freeze({\n numbered: true,\n sections: Object.freeze([\n { key: \"scope\", owner: \"app\" },\n { key: \"no_advice\", owner: \"app\" },\n { key: \"*\", owner: \"app\" },\n { key: \"warranty\", owner: \"kit\" },\n { key: \"liability\", owner: \"kit\" },\n { key: \"changes\", owner: \"kit\" },\n // 0.28.1: which language's version prevails (the operator's `bindingLanguage`).\n { key: \"language\", owner: \"kit\" },\n { key: \"law\", owner: \"kit\" },\n ] as const),\n }),\n});\n\n/** The sections the kit writes (§4.3), on whichever page they sit. `contact` is on two\n * pages, with two texts; the page decides which. */\nexport type LegalKitSectionKey =\n | \"operator\"\n | \"contact\"\n | \"disclaimer\"\n | \"controller\"\n | \"legal_basis\"\n | \"browser\"\n | \"rights\"\n | \"warranty\"\n | \"liability\"\n | \"changes\"\n | \"language\"\n | \"law\";\n\n/** The kit's sections of one page, in the skeleton's order. */\nfunction kitSectionsOf(page: LegalPageKey): string[] {\n return LEGAL_SKELETON[page].sections.filter((s) => s.owner !== \"app\").map((s) => s.key);\n}\n\nconst PAGES: readonly LegalPageKey[] = [\"impressum\", \"privacy\", \"terms\"];\n\n// ── Kit sections ──────────────────────────────────────────────────────────────\n\ninterface LegalKitSectionBase {\n /** Default: the enclosing {@link LegalPage}'s page — needed outside one, and for\n * `contact` only (it is on two pages). */\n page?: LegalPageKey;\n /** Default: the enclosing {@link LegalPage}'s operator — needed outside one, by the\n * sections that name it (operator, both contacts, controller, law). */\n operator?: LegalOperator;\n /** Default: one level below the page's title (`h2` under an `h1`). */\n headingAs?: \"h2\" | \"h3\";\n labels?: LabelOverride<LegalLabels>;\n}\n\n/**\n * One of the kit's sections, by key. `children` is the app's paragraph where §4.2 says\n * \"kit + app\" — and only there, which the type holds an app to: the other sections'\n * wording is identical in every app, and an app that needs to say more says it in a\n * section of its own. `browser` takes the app's list of what it keeps, as `entries`.\n */\nexport type LegalKitSectionProps = LegalKitSectionBase &\n (\n | {\n section: \"browser\";\n variant?: never;\n /** What this app keeps in the browser, one entry per item — rendered as a `<ul>`\n * between the kit's two sentences. The app's words, in every language it serves. */\n entries: readonly string[];\n /** After the kit's text: what sign-out removes beyond the tokens, what stays. */\n children?: ReactNode;\n }\n | {\n section: \"legal_basis\" | \"rights\";\n variant?: never;\n entries?: never;\n /** `legal_basis`: after the kit's paragraph (consent, where an app relies on\n * it). `rights`: between the list of rights and the supervisory authorities\n * (how to export, how to delete). A plain string keeps its line breaks and has\n * its `{ref:key}` tokens resolved. */\n children?: ReactNode;\n }\n | {\n section: \"disclaimer\";\n /**\n * 0.32.0 (docs/billing-harmonization.md §8, legal decision 7): which disclaimer.\n * `non-commercial` (default) is the beta's \"private, non-commercial project\";\n * `commercial` is for an app that charges, sold through a Merchant of Record —\n * chosen per app, in the release that turns its billing on.\n */\n variant?: LegalDisclaimerVariant;\n entries?: never;\n children?: never;\n }\n | {\n section: Exclude<LegalKitSectionKey, \"browser\" | \"legal_basis\" | \"rights\" | \"disclaimer\">;\n variant?: never;\n entries?: never;\n children?: never;\n }\n );\n\n/** 0.32.0: the imprint disclaimer's two texts — see {@link LegalKitSectionProps}. */\nexport type LegalDisclaimerVariant = \"non-commercial\" | \"commercial\";\n\n/** The app's paragraph: a plain string as running text (line breaks kept, refs\n * resolved), anything else as it is. */\nfunction appPart(children: ReactNode): ReactNode {\n if (children === undefined || children === null || children === false) return null;\n if (typeof children === \"string\") return <LegalText key=\"app\" text={children} />;\n return <Fragment key=\"app\">{children}</Fragment>;\n}\n\n/**\n * One of the kit's sections (§4.3) — `<LegalKitSection section=\"warranty\" />` — with its\n * heading, its `id` (the key: `/terms#warranty`) and, on a numbered page, its number.\n *\n * The words are the kit's, in the `legal` labels, filled in with the operator; an app\n * adds only what §4.2 gives it a slot for. Inside a {@link LegalPage} the page and the\n * operator come from it, so a page reads as its section list:\n *\n * <LegalPage page=\"privacy\" operator={OPERATOR}>\n * <LegalKitSection section=\"controller\" />\n * <LegalSection key=\"data\" heading={t(\"legal.privacy.data.title\")} body={…} />\n * <LegalKitSection section=\"legal_basis\">{t(\"legal.privacy.legal_basis.app\")}</LegalKitSection>\n * …\n * </LegalPage>\n *\n * A key that is not one of the page's kit sections throws, naming the ones that are: it\n * is a typo in code, not a state a user can reach.\n */\nexport function LegalKitSection(props: LegalKitSectionProps) {\n const { section, headingAs, labels: labelsProp } = props;\n const context = useContext(LegalPageContext);\n const labels = useLegalLabels(labelsProp);\n const kitLocale = useKitLocale();\n\n const page = props.page ?? context?.page ?? onlyPageOf(section);\n const kitSections = kitSectionsOf(page);\n if (!kitSections.includes(section)) {\n throw new Error(\n `LegalKitSection: \"${section}\" is not one of the kit's sections of the ${page} page (${kitSections.join(\", \")}).`,\n );\n }\n const entry = (labels.sections[page] as Record<string, SectionLabels>)[section];\n const operator = props.operator ? legalOperatorText(props.operator, kitLocale) : context?.operator;\n const fill = (body: string | ((o: LegalOperatorText) => string)): string => {\n if (typeof body === \"string\") return body;\n if (!operator) {\n throw new Error(\n `LegalKitSection \"${section}\" names the operator: render it inside <LegalPage operator={…}>, or pass operator.`,\n );\n }\n if (section === \"language\" && !operator.bindingLanguage) {\n throw new Error(\n `LegalKitSection \"language\" names the binding language: give the operator a bindingLanguage (\"de-CH\").`,\n );\n }\n return body(operator);\n };\n\n const app = appPart(props.children);\n let parts: ReactNode[];\n if (\"lead\" in entry) {\n const lead = <LegalText key=\"lead\" text={entry.lead} />;\n const tail = <LegalText key=\"tail\" text={entry.tail} />;\n if (props.section === \"browser\") {\n const list =\n props.entries.length > 0 ? (\n <ul key=\"entries\" className=\"list-disc space-y-1 ps-5\">\n {props.entries.map((item, i) => (\n <li key={i}>{item}</li>\n ))}\n </ul>\n ) : null;\n parts = [lead, list, tail, app];\n } else {\n // `rights`: the app's paragraph sits between the rights and the authorities.\n parts = [lead, app, tail];\n }\n } else {\n // The imprint's commercial disclaimer (0.32.0): its own body under the same title.\n const commercial =\n props.section === \"disclaimer\" && props.variant === \"commercial\"\n ? ((entry as LegalDisclaimerSectionLabels).commercial ??\n DEFAULT_LEGAL_LABELS.sections.impressum.disclaimer.commercial)\n : undefined;\n parts = [<LegalText key=\"body\" text={commercial ?? fill(entry.body)} />, app];\n }\n\n return (\n <LegalSection id={section} heading={entry.title} headingAs={headingAs}>\n <div className=\"space-y-[1lh]\">{parts}</div>\n </LegalSection>\n );\n}\n\ntype SectionLabels = LegalTextSectionLabels | LegalOperatorSectionLabels | LegalFramedSectionLabels;\n\n/** The one page a kit section key is on; `contact` is on two, so it needs the page. */\nfunction onlyPageOf(section: string): LegalPageKey {\n const pages = PAGES.filter((p) => kitSectionsOf(p).includes(section));\n if (pages.length === 1) return pages[0];\n throw new Error(\n pages.length === 0\n ? `LegalKitSection: \"${section}\" is not one of the kit's sections.`\n : `LegalKitSection: \"${section}\" is on more than one page (${pages.join(\", \")}) — render it inside a LegalPage, or pass page.`,\n );\n}\n\n// ── The page ──────────────────────────────────────────────────────────────────\n\nexport interface LegalPageProps {\n /** Which page: the title, the default notice, whether the sections are numbered. */\n page: LegalPageKey;\n /** Who runs the app — the values the kit's sections name. The same in every app's\n * three pages; the kit holds none (§5). */\n operator: LegalOperator;\n /**\n * The sections, in reading order: {@link LegalKitSection}s and {@link LegalSection}s.\n *\n * They must be DIRECT children — or inside fragments, or in an array\n * (`SECTIONS.map(…)`). The page reads them before they render, to know every\n * section's number in advance: that is what lets a `{ref:key}` point forward\n * (keksdose's section 2 refers to section 10). A section wrapped in a component of the\n * app's own is invisible to that walk and renders unnumbered, with no key.\n */\n children: ReactNode;\n /** The app's public header — the one a signed-out visitor already sees (keksdose's\n * `LandingHeader`, Kurvenschmiede's `AppTopBar` without the shell). */\n header?: ReactNode;\n /** Default: `<LegalFooter />` with this page marked. `null` for none. */\n footer?: ReactNode;\n /** The back link's target. Default `/`, which takes a signed-in user into the app and\n * a signed-out one to the landing or sign-in page. */\n homeHref?: string;\n /** Default: the kit's beta notice on the imprint and the terms, its privacy notice on\n * the privacy policy (§3.2). `null` for none. */\n notice?: ReactNode;\n /**\n * 0.28.1: switches the app to the operator's `bindingLanguage` — the button after the\n * translation note on a page read in another language. Without it the note stands\n * alone; the app's own language switcher is in its header anyway.\n */\n onShowBindingLanguage?: () => void;\n /** The language the operator's country is named in. Default: the `<UiKitProvider\n * locale>`, else English. */\n locale?: string;\n /** The title's element. Default `h1`; `h2` for a page shown inside another (a\n * preview), whose sections then take `h3`. */\n headingAs?: \"h1\" | \"h2\";\n /** `false` draws the column as a `<div>` instead of `<main>` — for a page embedded in\n * one that has its own `<main>`. Default true. */\n landmark?: boolean;\n /** Default true: {@link useNoIndex}. `false` only where the page is not the page — a\n * preview inside another page. */\n noIndex?: boolean;\n /** On the outermost element (a full-height column). */\n className?: string;\n /** The `legal` labels for this page and everything in it — sections, footer,\n * checkbox — on top of the provider's. */\n labels?: LabelOverride<LegalLabels>;\n}\n\ninterface FlatNode {\n node: ReactNode;\n /** A stable React key from the node's place in the tree the app wrote. */\n path: string;\n}\n\n/** The children as a flat list, arrays and fragments opened — the sections the page can\n * see, in render order. */\nfunction flatten(node: ReactNode, path: string, out: FlatNode[]): void {\n if (node === null || node === undefined || typeof node === \"boolean\") return;\n if (isValidElement(node)) {\n if (node.type === Fragment) {\n flatten((node.props as { children?: ReactNode }).children, path, out);\n } else {\n out.push({ node, path: path || \"/\" });\n }\n return;\n }\n if (typeof node === \"object\" && Symbol.iterator in node) {\n Array.from(node as Iterable<ReactNode>).forEach((child, i) => {\n const step = isValidElement(child) && child.key !== null ? `$${child.key}` : `#${i}`;\n flatten(child, `${path}/${step}`, out);\n });\n return;\n }\n out.push({ node, path: path || \"/\" });\n}\n\n/** A section the walk found: its key (`undefined` when it has none) and heading. */\nfunction sectionOf(\n node: ReactNode,\n page: LegalPageKey,\n labels: LegalLabels,\n): { key: string | undefined; heading: ReactNode } | null {\n if (!isValidElement(node)) return null;\n if (node.type === LegalKitSection) {\n const { section } = node.props as LegalKitSectionProps;\n const entry = (labels.sections[page] as Record<string, SectionLabels | undefined>)[section];\n return { key: section, heading: entry?.title ?? section };\n }\n if (node.type === LegalSection) {\n const props = node.props as LegalSectionProps;\n return { key: props.id ?? node.key ?? undefined, heading: props.heading };\n }\n return null;\n}\n\n/**\n * The page's sections, each in a slot that tells it its key and number, and the map a\n * `{ref:key}` is resolved from — built from the children BEFORE they render.\n */\nfunction slotSections(\n children: ReactNode,\n page: LegalPageKey,\n labels: LegalLabels,\n): { nodes: ReactNode[]; targets: Map<string, LegalRefTarget> } {\n const flat: FlatNode[] = [];\n flatten(children, \"\", flat);\n const numbered = LEGAL_SKELETON[page].numbered;\n const targets = new Map<string, LegalRefTarget>();\n let count = 0;\n const nodes = flat.map(({ node, path }) => {\n const section = sectionOf(node, page, labels);\n if (!section) return <Fragment key={path}>{node}</Fragment>;\n count += 1;\n const number = numbered ? count : undefined;\n if (section.key !== undefined) {\n if (targets.has(section.key)) {\n warnLegalOnce(`two sections of the ${page} page share the key \"${section.key}\"; {ref:${section.key}} names the first.`);\n } else {\n targets.set(section.key, { number, heading: section.heading });\n }\n }\n return (\n <LegalSlotContext.Provider key={path} value={{ id: section.key, number }}>\n {node}\n </LegalSlotContext.Provider>\n );\n });\n return { nodes, targets };\n}\n\n/**\n * A legal page — Imprint, Privacy Policy or Terms — in the frame every app uses (§3.2):\n * the app's public header, the kit's column (back link, title, notice, sections) and the\n * public footer. keksdose's `features/legal/legal-layout.tsx`, the reference: its\n * `LegalPage` drew exactly this around the kit's `LegalLayout`, and kastlan and\n * Kurvenschmiede each drew a different frame (an auth card, the signed-in app shell).\n * Signed-in users see the same frame: the pages are public and outside the app shell.\n *\n * What it adds to the column:\n * - the title, from `legal.titles`, and \"← Back to home\" pointing at `homeHref`;\n * - the default notice per page — the beta notice, or the privacy notice on the privacy\n * policy, whose technical sections describe running code (§3.2, §7.3);\n * - numbers: the privacy and terms sections are \"N. Title\" in render order, the\n * imprint's are not (§4.1). The titles in the catalogues carry no number, so a\n * section added in the middle renumbers the rest instead of leaving them wrong;\n * - ids: every section's `id` is its key (`/privacy#rights`), which keeps\n * Kurvenschmiede's deep links working;\n * - `{ref:key}` in a section's text becomes that section's number, linked — forward\n * references included, since the page knows the order before any section renders\n * (see `children` for what that asks of the tree);\n * - `useNoIndex()`.\n */\nexport function LegalPage({\n page,\n operator,\n children,\n header,\n footer,\n homeHref = \"/\",\n notice,\n onShowBindingLanguage,\n locale: localeProp,\n headingAs = \"h1\",\n landmark = true,\n noIndex = true,\n className,\n labels: labelsProp,\n}: LegalPageProps) {\n useNoIndex(noIndex);\n const labels = useLegalLabels(labelsProp);\n const locale = useKitLocale(localeProp) ?? \"en\";\n // Not memoised: `countryName` keeps one `Intl.DisplayNames` per locale, so naming the\n // country again is a lookup, and the context is rebuilt with the children anyway.\n const operatorText = legalOperatorText(operator, locale);\n const overrides = useMemo<UiKitLabelOverrides | undefined>(\n () => (labelsProp ? { legal: labelsProp } : undefined),\n [labelsProp],\n );\n\n const { nodes, targets } = slotSections(children, page, labels);\n const context: LegalPageContextValue = {\n page,\n operator: operatorText,\n sectionHeading: headingAs === \"h1\" ? \"h2\" : \"h3\",\n targets,\n };\n const Main = landmark ? \"main\" : \"div\";\n const shownNotice =\n notice !== undefined ? notice : page === \"privacy\" ? labels.notice.privacy : labels.notice.beta;\n // 0.28.1 (Marcel): one language is binding and the lawyer reviews that one; a page read\n // in any other says so, with a way to the binding version.\n const translated =\n operator.bindingLanguage !== undefined && baseLanguage(operator.bindingLanguage) !== baseLanguage(locale);\n const translationNote = translated ? (\n <p className=\"text-sm text-secondary\">\n {labels.translation.note(operatorText)}\n {onShowBindingLanguage && (\n <>\n {\" \"}\n <Button type=\"button\" variant=\"link\" size=\"sm\" className=\"h-auto p-0 align-baseline\" onClick={onShowBindingLanguage}>\n {labels.translation.show(operatorText)}\n </Button>\n </>\n )}\n </p>\n ) : undefined;\n\n return (\n <UiKitProvider labels={overrides}>\n <div className={cn(\"flex min-h-full flex-col\", className)}>\n {header}\n <Main className=\"flex-1\">\n <LegalPageContext.Provider value={context}>\n <LegalLayout\n back={\n <TextLink href={homeHref} icon={ArrowLeft}>\n {labels.backHome}\n </TextLink>\n }\n title={labels.titles[page]}\n notice={shownNotice}\n translationNote={translationNote}\n headingAs={headingAs}\n >\n {nodes}\n </LegalLayout>\n </LegalPageContext.Provider>\n </Main>\n {footer === undefined ? <LegalFooter currentHref={LEGAL_HREFS[page]} /> : footer}\n </div>\n </UiKitProvider>\n );\n}\n\n// ── Terms acceptance (§3.4) ───────────────────────────────────────────────────\n\nexport interface LegalAcceptCheckboxProps\n extends Omit<CheckboxProps, \"label\" | \"checked\" | \"onCheckedChange\" | \"required\"> {\n checked: boolean;\n onCheckedChange: (checked: boolean) => void;\n /** Default `/terms`. */\n termsHref?: string;\n /** Default `/privacy`. */\n privacyHref?: string;\n labels?: LabelOverride<LegalLabels>;\n ref?: Ref<HTMLInputElement>;\n}\n\n/** `legal.accept` with its `{terms}` and `{privacy}` as links named by the page titles.\n * Split, not interpolated: the text between the placeholders is the template's own,\n * to the character — nothing is added around a link. */\nfunction acceptLabel(labels: LegalLabels, termsHref: string, privacyHref: string): ReactNode[] {\n const template = labels.accept;\n for (const placeholder of [\"{terms}\", \"{privacy}\"]) {\n if (!template.includes(placeholder)) warnLegalOnce(`legal.accept has no ${placeholder}: \"${template}\".`);\n }\n return template\n .split(/(\\{terms\\}|\\{privacy\\})/)\n .filter((part) => part !== \"\")\n .map((part, i) =>\n part === \"{terms}\" ? (\n <TextLink key={i} href={termsHref} tone=\"primary\">\n {labels.titles.terms}\n </TextLink>\n ) : part === \"{privacy}\" ? (\n <TextLink key={i} href={privacyHref} tone=\"primary\">\n {labels.titles.privacy}\n </TextLink>\n ) : (\n part\n ),\n );\n}\n\n/**\n * The register page's \"I accept the [Terms of Service] and the [Privacy Policy]\" (§3.4):\n * keksdose's checkbox (features/auth/register-page.tsx), for every app.\n *\n * A REQUIRED kit `Checkbox` — not a Switch: a form answer that waits for the submit\n * button. The app keeps its submit disabled while it is unticked, so there is never a\n * failed attempt and no `error` to show. Nothing is sent to the backend: no stored\n * version, no re-acceptance (Marcel, §2.4).\n *\n * The label is ONE template, `legal.accept`, so a language puts the links where its\n * grammar needs them, articles included — fr \"J’accepte les {terms} et la {privacy}\",\n * it \"Accetto le {terms} e l’{privacy}\" with no space after the elided article. The link\n * texts are the page titles (`legal.titles`), as on the pages themselves.\n */\nexport function LegalAcceptCheckbox({\n checked,\n onCheckedChange,\n termsHref = LEGAL_HREFS.terms,\n privacyHref = LEGAL_HREFS.privacy,\n labels: labelsProp,\n ref,\n ...rest\n}: LegalAcceptCheckboxProps) {\n const labels = useLegalLabels(labelsProp);\n return (\n <Checkbox\n {...rest}\n ref={ref}\n checked={checked}\n onCheckedChange={onCheckedChange}\n required\n label={acceptLabel(labels, termsHref, privacyHref)}\n />\n );\n}\n"],"mappings":";AAmN2C,SAgTnC,UAhTmC,KAgTnC,YAhTmC;AAnN3C,SAAS,YAAAA,WAAU,gBAAgB,YAAY,eAAe;AAE9D,SAAS,iBAAiB;AAE1B,SAAS,eAAe,oBAAoB;AAE5C,SAAS,kBAAkB;AAC3B,SAAS,UAAU;AACnB,SAAS,gBAAgB;AAEzB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAcP,SAAS,gBAAgB;AACzB,SAAS,cAAc;AAyChB,MAAM,iBAAoE,OAAO,OAAO;AAAA,EAC7F,WAAW,OAAO,OAAO;AAAA,IACvB,UAAU;AAAA,IACV,UAAU,OAAO,OAAO;AAAA,MACtB,EAAE,KAAK,YAAY,OAAO,MAAM;AAAA,MAChC,EAAE,KAAK,WAAW,OAAO,MAAM;AAAA,MAC/B,EAAE,KAAK,cAAc,OAAO,MAAM;AAAA,MAClC,EAAE,KAAK,KAAK,OAAO,MAAM;AAAA,IAC3B,CAAU;AAAA,EACZ,CAAC;AAAA,EACD,SAAS,OAAO,OAAO;AAAA,IACrB,UAAU;AAAA,IACV,UAAU,OAAO,OAAO;AAAA,MACtB,EAAE,KAAK,cAAc,OAAO,MAAM;AAAA,MAClC,EAAE,KAAK,QAAQ,OAAO,MAAM;AAAA,MAC5B,EAAE,KAAK,eAAe,OAAO,UAAU;AAAA,MACvC,EAAE,KAAK,iBAAiB,OAAO,MAAM;AAAA,MACrC,EAAE,KAAK,KAA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AA0B,OAAO,SAChC;AAAA,MAAC;AAAA;AAAA,QACC,MACE,oBAAC,YAAS,MAAM,UAAU,MAAM,WAC7B,iBAAO,UACV;AAAA,QAEF,OAAO,OAAO,OAAO,IAAI;AAAA,QACzB,QAAQ;AAAA,QACR;AAAA,QACA;AAAA,QAEC;AAAA;AAAA,IACH,GACF,GACF;AAAA,IACC,WAAW,SAAY,oBAAC,eAAY,aAAa,YAAY,IAAI,GAAG,IAAK;AAAA,KAC5E,GACF;AAEJ;AAmBA,SAAS,YAAY,QAAqB,WAAmB,aAAkC;AAC7F,QAAM,WAAW,OAAO;AACxB,aAAW,eAAe,CAAC,WAAW,WAAW,GAAG;AAClD,QAAI,CAAC,SAAS,SAAS,WAAW,EAAG,eAAc,uBAAuB,WAAW,MAAM,QAAQ,IAAI;AAAA,EACzG;AACA,SAAO,SACJ,MAAM,yBAAyB,EAC/B,OAAO,CAAC,SAAS,SAAS,EAAE,EAC5B;AAAA,IAAI,CAAC,MAAM,MACV,SAAS,YACP,oBAAC,YAAiB,MAAM,WAAW,MAAK,WACrC,iBAAO,OAAO,SADF,CAEf,IACE,SAAS,cACX,oBAAC,YAAiB,MAAM,aAAa,MAAK,WACvC,iBAAO,OAAO,WADF,CAEf,IAEA;AAAA,EAEJ;AACJ;AAgBO,SAAS,oBAAoB;AAAA,EAClC;AAAA,EACA;AAAA,EACA,YAAY,YAAY;AAAA,EACxB,cAAc,YAAY;AAAA,EAC1B,QAAQ;AAAA,EACR;AAAA,EACA,GAAG;AACL,GAA6B;AAC3B,QAAM,SAAS,eAAe,UAAU;AACxC,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ;AAAA,MACA;AAAA,MACA;AAAA,MACA,UAAQ;AAAA,MACR,OAAO,YAAY,QAAQ,WAAW,WAAW;AAAA;AAAA,EACnD;AAEJ;","names":["Fragment"]}
|
|
1
|
+
{"version":3,"sources":["../../src/components/legal-page.tsx"],"sourcesContent":["import { Fragment, isValidElement, useContext, useMemo } from \"react\";\nimport type { ReactNode, Ref } from \"react\";\nimport { ArrowLeft } from \"lucide-react\";\n\nimport { UiKitProvider, useKitLocale } from \"../i18n/kit-labels\";\nimport type { LabelOverride, UiKitLabelOverrides } from \"../i18n/kit-labels\";\nimport { useNoIndex } from \"../hooks/use-noindex\";\nimport { cn } from \"../lib/cn\";\nimport { parseIsoDate } from \"../lib/dates\";\nimport { formatDate } from \"../lib/format\";\nimport { Checkbox } from \"./checkbox\";\nimport type { CheckboxProps } from \"./checkbox\";\nimport {\n DEFAULT_LEGAL_LABELS,\n LEGAL_HREFS,\n baseLanguage,\n LegalFooter,\n LegalLayout,\n LegalPageContext,\n LegalSection,\n LegalSlotContext,\n LegalText,\n legalOperatorText,\n resolveLegalRefs,\n useLegalLabels,\n warnLegalOnce,\n} from \"./legal\";\nimport type {\n LegalDisclaimerSectionLabels,\n LegalFramedSectionLabels,\n LegalLabels,\n LegalOperator,\n LegalOperatorSectionLabels,\n LegalOperatorText,\n LegalPageContextValue,\n LegalPageKey,\n LegalRefTarget,\n LegalSectionProps,\n LegalTextSectionLabels,\n} from \"./legal\";\nimport { TextLink } from \"./text-link\";\nimport { Button } from \"./button\";\n\n/**\n * The legal pages' frame and the kit's own sections — docs/legal-harmonization.md §3\n * and §4, the 0.28 round. The labels, the column, `LegalSection`, the links and the\n * footer are in `./legal`.\n */\n\n// ── The skeleton (§4.2) ───────────────────────────────────────────────────────\n\n/** Who writes a section: the kit's wording, the app's own, or the kit's wording with an\n * app paragraph in a fixed slot. */\nexport type LegalSectionOwner = \"kit\" | \"app\" | \"kit+app\";\n\nexport interface LegalSkeletonEntry {\n /** The section key — its `id` and its catalogue key. `\"*\"` is the slot where the\n * app's own sections go (zero or more: keksdose's `credits`, `price_pool`, …). */\n key: string;\n owner: LegalSectionOwner;\n}\n\nexport interface LegalSkeletonPage {\n /** Whether the page numbers its sections (\"3. Legal basis\"). The imprint does not. */\n numbered: boolean;\n /** The sections in their order. */\n sections: readonly LegalSkeletonEntry[];\n}\n\n/**\n * The section order every app's legal pages follow (§4.2), as data — so an app's test\n * can assert that its pages do, and so the order lives in one place, not in three apps'\n * reading of a table. `LegalPage` reads `numbered` from it.\n *\n * An app's test, given the section ids its page rendered in order:\n *\n * const fixed = LEGAL_SKELETON.privacy.sections.map((s) => s.key).filter((k) => k !== \"*\");\n * expect(ids.filter((id) => fixed.includes(id))).toEqual(fixed);\n *\n * Every fixed key is there, in the skeleton's order; the ids that are not in it are the\n * app's own sections, which belong where `\"*\"` stands.\n */\nexport const LEGAL_SKELETON: Readonly<Record<LegalPageKey, LegalSkeletonPage>> = Object.freeze({\n impressum: Object.freeze({\n numbered: false,\n sections: Object.freeze([\n { key: \"operator\", owner: \"kit\" },\n { key: \"contact\", owner: \"kit\" },\n { key: \"disclaimer\", owner: \"kit\" },\n { key: \"*\", owner: \"app\" },\n ] as const),\n }),\n privacy: Object.freeze({\n numbered: true,\n sections: Object.freeze([\n { key: \"controller\", owner: \"kit\" },\n { key: \"data\", owner: \"app\" },\n { key: \"legal_basis\", owner: \"kit+app\" },\n { key: \"third_parties\", owner: \"app\" },\n { key: \"*\", owner: \"app\" },\n { key: \"browser\", owner: \"kit+app\" },\n { key: \"transfers\", owner: \"app\" },\n { key: \"retention\", owner: \"app\" },\n { key: \"rights\", owner: \"kit+app\" },\n { key: \"contact\", owner: \"kit\" },\n ] as const),\n }),\n terms: Object.freeze({\n numbered: true,\n sections: Object.freeze([\n { key: \"scope\", owner: \"app\" },\n { key: \"no_advice\", owner: \"app\" },\n { key: \"*\", owner: \"app\" },\n { key: \"warranty\", owner: \"kit\" },\n { key: \"liability\", owner: \"kit\" },\n { key: \"changes\", owner: \"kit\" },\n // 0.28.1: which language's version prevails (the operator's `bindingLanguage`).\n { key: \"language\", owner: \"kit\" },\n { key: \"law\", owner: \"kit\" },\n ] as const),\n }),\n});\n\n/** The sections the kit writes (§4.3), on whichever page they sit. `contact` is on two\n * pages, with two texts; the page decides which. */\nexport type LegalKitSectionKey =\n | \"operator\"\n | \"contact\"\n | \"disclaimer\"\n | \"controller\"\n | \"legal_basis\"\n | \"browser\"\n | \"rights\"\n | \"warranty\"\n | \"liability\"\n | \"changes\"\n | \"language\"\n | \"law\";\n\n/** The kit's sections of one page, in the skeleton's order. */\nfunction kitSectionsOf(page: LegalPageKey): string[] {\n return LEGAL_SKELETON[page].sections.filter((s) => s.owner !== \"app\").map((s) => s.key);\n}\n\nconst PAGES: readonly LegalPageKey[] = [\"impressum\", \"privacy\", \"terms\"];\n\n// ── Kit sections ──────────────────────────────────────────────────────────────\n\ninterface LegalKitSectionBase {\n /** Default: the enclosing {@link LegalPage}'s page — needed outside one, and for\n * `contact` only (it is on two pages). */\n page?: LegalPageKey;\n /** Default: the enclosing {@link LegalPage}'s operator — needed outside one, by the\n * sections that name it (operator, both contacts, controller, law). */\n operator?: LegalOperator;\n /** Default: one level below the page's title (`h2` under an `h1`). */\n headingAs?: \"h2\" | \"h3\";\n labels?: LabelOverride<LegalLabels>;\n}\n\n/**\n * One of the kit's sections, by key. `children` is the app's paragraph where §4.2 says\n * \"kit + app\" — and only there, which the type holds an app to: the other sections'\n * wording is identical in every app, and an app that needs to say more says it in a\n * section of its own. `browser` takes the app's list of what it keeps, as `entries`.\n */\nexport type LegalKitSectionProps = LegalKitSectionBase &\n (\n | {\n section: \"browser\";\n variant?: never;\n /** What this app keeps in the browser, one entry per item — rendered as a `<ul>`\n * between the kit's two sentences. The app's words, in every language it serves. */\n entries: readonly string[];\n /** After the kit's text: what sign-out removes beyond the tokens, what stays. */\n children?: ReactNode;\n }\n | {\n section: \"legal_basis\" | \"rights\";\n variant?: never;\n entries?: never;\n /** `legal_basis`: after the kit's paragraph (consent, where an app relies on\n * it). `rights`: between the list of rights and the supervisory authorities\n * (how to export, how to delete). A plain string keeps its line breaks and has\n * its `{ref:key}` tokens resolved. */\n children?: ReactNode;\n }\n | {\n section: \"disclaimer\";\n /**\n * 0.32.0 (docs/billing-harmonization.md §8, legal decision 7): which disclaimer.\n * `non-commercial` (default) is the beta's \"private, non-commercial project\";\n * `commercial` is for an app that charges, sold through a Merchant of Record —\n * chosen per app, in the release that turns its billing on.\n */\n variant?: LegalDisclaimerVariant;\n entries?: never;\n children?: never;\n }\n | {\n section: Exclude<LegalKitSectionKey, \"browser\" | \"legal_basis\" | \"rights\" | \"disclaimer\">;\n variant?: never;\n entries?: never;\n children?: never;\n }\n );\n\n/** 0.32.0: the imprint disclaimer's two texts — see {@link LegalKitSectionProps}. */\nexport type LegalDisclaimerVariant = \"non-commercial\" | \"commercial\";\n\n/** The app's paragraph: a plain string as running text (line breaks kept, refs\n * resolved), anything else as it is. */\nfunction appPart(children: ReactNode): ReactNode {\n if (children === undefined || children === null || children === false) return null;\n if (typeof children === \"string\") return <LegalText key=\"app\" text={children} />;\n return <Fragment key=\"app\">{children}</Fragment>;\n}\n\n/**\n * One of the kit's sections (§4.3) — `<LegalKitSection section=\"warranty\" />` — with its\n * heading, its `id` (the key: `/terms#warranty`) and, on a numbered page, its number.\n *\n * The words are the kit's, in the `legal` labels, filled in with the operator; an app\n * adds only what §4.2 gives it a slot for. Inside a {@link LegalPage} the page and the\n * operator come from it, so a page reads as its section list:\n *\n * <LegalPage page=\"privacy\" operator={OPERATOR}>\n * <LegalKitSection section=\"controller\" />\n * <LegalSection key=\"data\" heading={t(\"legal.privacy.data.title\")} body={…} />\n * <LegalKitSection section=\"legal_basis\">{t(\"legal.privacy.legal_basis.app\")}</LegalKitSection>\n * …\n * </LegalPage>\n *\n * A key that is not one of the page's kit sections throws, naming the ones that are: it\n * is a typo in code, not a state a user can reach.\n */\nexport function LegalKitSection(props: LegalKitSectionProps) {\n const { section, headingAs, labels: labelsProp } = props;\n const context = useContext(LegalPageContext);\n const labels = useLegalLabels(labelsProp);\n const kitLocale = useKitLocale();\n\n const page = props.page ?? context?.page ?? onlyPageOf(section);\n const kitSections = kitSectionsOf(page);\n if (!kitSections.includes(section)) {\n throw new Error(\n `LegalKitSection: \"${section}\" is not one of the kit's sections of the ${page} page (${kitSections.join(\", \")}).`,\n );\n }\n const entry = (labels.sections[page] as Record<string, SectionLabels>)[section];\n const operator = props.operator ? legalOperatorText(props.operator, kitLocale) : context?.operator;\n const fill = (body: string | ((o: LegalOperatorText) => string)): string => {\n if (typeof body === \"string\") return body;\n if (!operator) {\n throw new Error(\n `LegalKitSection \"${section}\" names the operator: render it inside <LegalPage operator={…}>, or pass operator.`,\n );\n }\n if (section === \"language\" && !operator.bindingLanguage) {\n throw new Error(\n `LegalKitSection \"language\" names the binding language: give the operator a bindingLanguage (\"de-CH\").`,\n );\n }\n return body(operator);\n };\n\n const app = appPart(props.children);\n let parts: ReactNode[];\n if (\"lead\" in entry) {\n const lead = <LegalText key=\"lead\" text={entry.lead} />;\n const tail = <LegalText key=\"tail\" text={entry.tail} />;\n if (props.section === \"browser\") {\n const list =\n props.entries.length > 0 ? (\n <ul key=\"entries\" className=\"list-disc space-y-1 ps-5\">\n {props.entries.map((item, i) => (\n <li key={i}>{item}</li>\n ))}\n </ul>\n ) : null;\n parts = [lead, list, tail, app];\n } else {\n // `rights`: the app's paragraph sits between the rights and the authorities.\n parts = [lead, app, tail];\n }\n } else {\n // The imprint's commercial disclaimer (0.32.0): its own body under the same title.\n const commercial =\n props.section === \"disclaimer\" && props.variant === \"commercial\"\n ? ((entry as LegalDisclaimerSectionLabels).commercial ??\n DEFAULT_LEGAL_LABELS.sections.impressum.disclaimer.commercial)\n : undefined;\n parts = [<LegalText key=\"body\" text={commercial ?? fill(entry.body)} />, app];\n }\n\n return (\n <LegalSection id={section} heading={entry.title} headingAs={headingAs}>\n <div className=\"space-y-[1lh]\">{parts}</div>\n </LegalSection>\n );\n}\n\ntype SectionLabels = LegalTextSectionLabels | LegalOperatorSectionLabels | LegalFramedSectionLabels;\n\n/** The one page a kit section key is on; `contact` is on two, so it needs the page. */\nfunction onlyPageOf(section: string): LegalPageKey {\n const pages = PAGES.filter((p) => kitSectionsOf(p).includes(section));\n if (pages.length === 1) return pages[0];\n throw new Error(\n pages.length === 0\n ? `LegalKitSection: \"${section}\" is not one of the kit's sections.`\n : `LegalKitSection: \"${section}\" is on more than one page (${pages.join(\", \")}) — render it inside a LegalPage, or pass page.`,\n );\n}\n\n// ── The page ──────────────────────────────────────────────────────────────────\n\nexport interface LegalPageProps {\n /** Which page: the title, the default notice, whether the sections are numbered. */\n page: LegalPageKey;\n /** Who runs the app — the values the kit's sections name. The same in every app's\n * three pages; the kit holds none (§5). */\n operator: LegalOperator;\n /**\n * The sections, in reading order: {@link LegalKitSection}s and {@link LegalSection}s.\n *\n * They must be DIRECT children — or inside fragments, or in an array\n * (`SECTIONS.map(…)`). The page reads them before they render, to know every\n * section's number in advance: that is what lets a `{ref:key}` point forward\n * (keksdose's section 2 refers to section 10). A section wrapped in a component of the\n * app's own is invisible to that walk and renders unnumbered, with no key.\n */\n children: ReactNode;\n /** The app's public header — the one a signed-out visitor already sees (keksdose's\n * `LandingHeader`, Kurvenschmiede's `AppTopBar` without the shell). */\n header?: ReactNode;\n /** Default: `<LegalFooter />` with this page marked. `null` for none. */\n footer?: ReactNode;\n /** The back link's target. Default `/`, which takes a signed-in user into the app and\n * a signed-out one to the landing or sign-in page. */\n homeHref?: string;\n /** Default: the kit's beta notice on the imprint and the terms, its privacy notice on\n * the privacy policy (§3.2). `null` for none. */\n notice?: ReactNode;\n /**\n * 0.51.3: the day this page's text last changed, \"YYYY-MM-DD\" (legal benchmark\n * 2026-10-29, gap 8). Shown under the title as `legal.updated` — \"Last updated:\n * 29 October 2026\", \"Stand: 29. Oktober 2026\" — with the date written out in `locale`,\n * so it follows the page's language like every other kit word, the switch to the\n * binding version included. Left out, no line. One date per page: the imprint, the\n * privacy policy and the terms change on their own days.\n *\n * An app that records which terms someone accepted (keksdose) stores the terms page's\n * date: it is the version the reader saw.\n *\n * The kit's sections are part of the page, so the date moves with their words too: a\n * kit release that changes them says so in its adoption note (\"Legal wording\"), and\n * the app sets the page's date to the day it ships that bump (§2, decision 10).\n */\n updated?: string;\n /**\n * 0.51.4: a plain-language summary before the first section (legal benchmark, Marcel\n * 2026-10-29) — the app's three to six points, each a sentence. The kit draws them as a\n * list under `legal.summary.title` (\"In short\", \"Das Wichtigste in Kürze\") and adds\n * `legal.summary.note`: the summary orients, only the full text binds. Worded without\n * \"below\", because on a translated page the text below is a translation too.\n *\n * A string point is running text with its `{ref:key}` resolved, as in a section:\n * \"You can delete your account at any time (section {ref:ending}).\" Unnumbered, with\n * the id `summary`; the sections' numbers do not count it. Left out or empty, nothing.\n */\n summary?: readonly ReactNode[];\n /**\n * 0.28.1: switches the app to the operator's `bindingLanguage` — the button after the\n * translation note on a page read in another language. Without it the note stands\n * alone; the app's own language switcher is in its header anyway.\n */\n onShowBindingLanguage?: () => void;\n /** The language the operator's country is named in. Default: the `<UiKitProvider\n * locale>`, else English. */\n locale?: string;\n /** The title's element. Default `h1`; `h2` for a page shown inside another (a\n * preview), whose sections then take `h3`. */\n headingAs?: \"h1\" | \"h2\";\n /** `false` draws the column as a `<div>` instead of `<main>` — for a page embedded in\n * one that has its own `<main>`. Default true. */\n landmark?: boolean;\n /** Default true: {@link useNoIndex}. `false` only where the page is not the page — a\n * preview inside another page. */\n noIndex?: boolean;\n /** On the outermost element (a full-height column). */\n className?: string;\n /** The `legal` labels for this page and everything in it — sections, footer,\n * checkbox — on top of the provider's. */\n labels?: LabelOverride<LegalLabels>;\n}\n\ninterface FlatNode {\n node: ReactNode;\n /** A stable React key from the node's place in the tree the app wrote. */\n path: string;\n}\n\n/** The children as a flat list, arrays and fragments opened — the sections the page can\n * see, in render order. */\nfunction flatten(node: ReactNode, path: string, out: FlatNode[]): void {\n if (node === null || node === undefined || typeof node === \"boolean\") return;\n if (isValidElement(node)) {\n if (node.type === Fragment) {\n flatten((node.props as { children?: ReactNode }).children, path, out);\n } else {\n out.push({ node, path: path || \"/\" });\n }\n return;\n }\n if (typeof node === \"object\" && Symbol.iterator in node) {\n Array.from(node as Iterable<ReactNode>).forEach((child, i) => {\n const step = isValidElement(child) && child.key !== null ? `$${child.key}` : `#${i}`;\n flatten(child, `${path}/${step}`, out);\n });\n return;\n }\n out.push({ node, path: path || \"/\" });\n}\n\n/** A section the walk found: its key (`undefined` when it has none) and heading. */\nfunction sectionOf(\n node: ReactNode,\n page: LegalPageKey,\n labels: LegalLabels,\n): { key: string | undefined; heading: ReactNode } | null {\n if (!isValidElement(node)) return null;\n if (node.type === LegalKitSection) {\n const { section } = node.props as LegalKitSectionProps;\n const entry = (labels.sections[page] as Record<string, SectionLabels | undefined>)[section];\n return { key: section, heading: entry?.title ?? section };\n }\n if (node.type === LegalSection) {\n const props = node.props as LegalSectionProps;\n return { key: props.id ?? node.key ?? undefined, heading: props.heading };\n }\n return null;\n}\n\n/**\n * The page's sections, each in a slot that tells it its key and number, and the map a\n * `{ref:key}` is resolved from — built from the children BEFORE they render.\n */\nfunction slotSections(\n children: ReactNode,\n page: LegalPageKey,\n labels: LegalLabels,\n): { nodes: ReactNode[]; targets: Map<string, LegalRefTarget> } {\n const flat: FlatNode[] = [];\n flatten(children, \"\", flat);\n const numbered = LEGAL_SKELETON[page].numbered;\n const targets = new Map<string, LegalRefTarget>();\n let count = 0;\n const nodes = flat.map(({ node, path }) => {\n const section = sectionOf(node, page, labels);\n if (!section) return <Fragment key={path}>{node}</Fragment>;\n count += 1;\n const number = numbered ? count : undefined;\n if (section.key !== undefined) {\n if (targets.has(section.key)) {\n warnLegalOnce(`two sections of the ${page} page share the key \"${section.key}\"; {ref:${section.key}} names the first.`);\n } else {\n targets.set(section.key, { number, heading: section.heading });\n }\n }\n return (\n <LegalSlotContext.Provider key={path} value={{ id: section.key, number }}>\n {node}\n </LegalSlotContext.Provider>\n );\n });\n return { nodes, targets };\n}\n\n/**\n * A legal page — Imprint, Privacy Policy or Terms — in the frame every app uses (§3.2):\n * the app's public header, the kit's column (back link, title, notice, sections) and the\n * public footer. keksdose's `features/legal/legal-layout.tsx`, the reference: its\n * `LegalPage` drew exactly this around the kit's `LegalLayout`, and kastlan and\n * Kurvenschmiede each drew a different frame (an auth card, the signed-in app shell).\n * Signed-in users see the same frame: the pages are public and outside the app shell.\n *\n * What it adds to the column:\n * - the title, from `legal.titles`, and \"← Back to home\" pointing at `homeHref`;\n * - the as-of line under the title, from `updated` (0.51.3);\n * - the plain-language summary before the sections, from `summary` (0.51.4);\n * - the default notice per page — the beta notice, or the privacy notice on the privacy\n * policy, whose technical sections describe running code (§3.2, §7.3);\n * - numbers: the privacy and terms sections are \"N. Title\" in render order, the\n * imprint's are not (§4.1). The titles in the catalogues carry no number, so a\n * section added in the middle renumbers the rest instead of leaving them wrong;\n * - ids: every section's `id` is its key (`/privacy#rights`), which keeps\n * Kurvenschmiede's deep links working;\n * - `{ref:key}` in a section's text becomes that section's number, linked — forward\n * references included, since the page knows the order before any section renders\n * (see `children` for what that asks of the tree);\n * - `useNoIndex()`.\n */\nexport function LegalPage({\n page,\n operator,\n children,\n header,\n footer,\n homeHref = \"/\",\n notice,\n updated,\n summary,\n onShowBindingLanguage,\n locale: localeProp,\n headingAs = \"h1\",\n landmark = true,\n noIndex = true,\n className,\n labels: labelsProp,\n}: LegalPageProps) {\n useNoIndex(noIndex);\n const labels = useLegalLabels(labelsProp);\n const locale = useKitLocale(localeProp) ?? \"en\";\n // Not memoised: `countryName` keeps one `Intl.DisplayNames` per locale, so naming the\n // country again is a lookup, and the context is rebuilt with the children anyway.\n const operatorText = legalOperatorText(operator, locale);\n const overrides = useMemo<UiKitLabelOverrides | undefined>(\n () => (labelsProp ? { legal: labelsProp } : undefined),\n [labelsProp],\n );\n\n const { nodes, targets } = slotSections(children, page, labels);\n const context: LegalPageContextValue = {\n page,\n operator: operatorText,\n sectionHeading: headingAs === \"h1\" ? \"h2\" : \"h3\",\n targets,\n };\n const Main = landmark ? \"main\" : \"div\";\n const shownNotice =\n notice !== undefined ? notice : page === \"privacy\" ? labels.notice.privacy : labels.notice.beta;\n // 0.28.1 (Marcel): one language is binding and the lawyer reviews that one; a page read\n // in any other says so, with a way to the binding version.\n const translated =\n operator.bindingLanguage !== undefined && baseLanguage(operator.bindingLanguage) !== baseLanguage(locale);\n const translationNote = translated ? (\n <p className=\"text-sm text-secondary\">\n {labels.translation.note(operatorText)}\n {onShowBindingLanguage && (\n <>\n {\" \"}\n <Button type=\"button\" variant=\"link\" size=\"sm\" className=\"h-auto p-0 align-baseline\" onClick={onShowBindingLanguage}>\n {labels.translation.show(operatorText)}\n </Button>\n </>\n )}\n </p>\n ) : undefined;\n // A calendar day, written out in the page's language; `formatDate` reads a bare\n // \"YYYY-MM-DD\" as that day in every zone. A malformed date shows no line rather than a\n // made-up one (\"2026-02-30\" would roll over into March).\n const updatedValid = updated !== undefined && parseIsoDate(updated) !== null;\n if (updated !== undefined && !updatedValid) {\n warnLegalOnce(`LegalPage: updated=\"${updated}\" is not a \"YYYY-MM-DD\" date; no \"Last updated\" line is shown.`);\n }\n const updatedLine = updatedValid ? (\n <time dateTime={updated}>\n {(labels.updated ?? DEFAULT_LEGAL_LABELS.updated!)(formatDate(updated, \"long\", { locale }))}\n </time>\n ) : undefined;\n const summaryLabels = labels.summary ?? DEFAULT_LEGAL_LABELS.summary!;\n const SummaryHeading = context.sectionHeading;\n const summaryBox =\n summary !== undefined && summary.length > 0 ? (\n <section id=\"summary\" className=\"rounded-lg border border-subtle bg-surface p-4 sm:p-5\">\n <SummaryHeading className=\"text-lg font-semibold break-words text-primary\">{summaryLabels.title}</SummaryHeading>\n <ul className=\"mt-3 space-y-2\">\n {summary.map((point, i) => (\n <li key={i} className=\"flex gap-2.5 text-sm leading-relaxed text-secondary\">\n <span aria-hidden className=\"mt-2 size-1.5 shrink-0 rounded-full bg-brand\" />\n <span className=\"min-w-0 break-words\">\n {typeof point === \"string\" ? resolveLegalRefs(point, context) : point}\n </span>\n </li>\n ))}\n </ul>\n <p className=\"mt-3 text-xs text-muted\">{summaryLabels.note}</p>\n </section>\n ) : undefined;\n\n return (\n <UiKitProvider labels={overrides}>\n <div className={cn(\"flex min-h-full flex-col\", className)}>\n {header}\n <Main className=\"flex-1\">\n <LegalPageContext.Provider value={context}>\n <LegalLayout\n back={\n <TextLink href={homeHref} icon={ArrowLeft}>\n {labels.backHome}\n </TextLink>\n }\n title={labels.titles[page]}\n notice={shownNotice}\n updated={updatedLine}\n translationNote={translationNote}\n summary={summaryBox}\n headingAs={headingAs}\n >\n {nodes}\n </LegalLayout>\n </LegalPageContext.Provider>\n </Main>\n {footer === undefined ? <LegalFooter currentHref={LEGAL_HREFS[page]} /> : footer}\n </div>\n </UiKitProvider>\n );\n}\n\n// ── Terms acceptance (§3.4) ───────────────────────────────────────────────────\n\nexport interface LegalAcceptCheckboxProps\n extends Omit<CheckboxProps, \"label\" | \"checked\" | \"onCheckedChange\" | \"required\"> {\n checked: boolean;\n onCheckedChange: (checked: boolean) => void;\n /** Default `/terms`. */\n termsHref?: string;\n /** Default `/privacy`. */\n privacyHref?: string;\n labels?: LabelOverride<LegalLabels>;\n ref?: Ref<HTMLInputElement>;\n}\n\n/** `legal.accept` with its `{terms}` and `{privacy}` as links named by the page titles.\n * Split, not interpolated: the text between the placeholders is the template's own,\n * to the character — nothing is added around a link. */\nfunction acceptLabel(labels: LegalLabels, termsHref: string, privacyHref: string): ReactNode[] {\n const template = labels.accept;\n for (const placeholder of [\"{terms}\", \"{privacy}\"]) {\n if (!template.includes(placeholder)) warnLegalOnce(`legal.accept has no ${placeholder}: \"${template}\".`);\n }\n return template\n .split(/(\\{terms\\}|\\{privacy\\})/)\n .filter((part) => part !== \"\")\n .map((part, i) =>\n part === \"{terms}\" ? (\n <TextLink key={i} href={termsHref} tone=\"primary\">\n {labels.titles.terms}\n </TextLink>\n ) : part === \"{privacy}\" ? (\n <TextLink key={i} href={privacyHref} tone=\"primary\">\n {labels.titles.privacy}\n </TextLink>\n ) : (\n part\n ),\n );\n}\n\n/**\n * The register page's \"I accept the [Terms of Service] and the [Privacy Policy]\" (§3.4):\n * keksdose's checkbox (features/auth/register-page.tsx), for every app.\n *\n * A REQUIRED kit `Checkbox` — not a Switch: a form answer that waits for the submit\n * button. The app keeps its submit disabled while it is unticked, so there is never a\n * failed attempt and no `error` to show. The checkbox itself sends nothing and asks for\n * no re-acceptance (Marcel, §2.4). An app that records which terms someone accepted\n * stores, with the account, the terms page's `updated` date — the version the reader\n * saw — on its own (keksdose since 2026-10-29; §3.4).\n *\n * The label is ONE template, `legal.accept`, so a language puts the links where its\n * grammar needs them, articles included — fr \"J’accepte les {terms} et la {privacy}\",\n * it \"Accetto le {terms} e l’{privacy}\" with no space after the elided article. The link\n * texts are the page titles (`legal.titles`), as on the pages themselves.\n */\nexport function LegalAcceptCheckbox({\n checked,\n onCheckedChange,\n termsHref = LEGAL_HREFS.terms,\n privacyHref = LEGAL_HREFS.privacy,\n labels: labelsProp,\n ref,\n ...rest\n}: LegalAcceptCheckboxProps) {\n const labels = useLegalLabels(labelsProp);\n return (\n <Checkbox\n {...rest}\n ref={ref}\n checked={checked}\n onCheckedChange={onCheckedChange}\n required\n label={acceptLabel(labels, termsHref, privacyHref)}\n />\n );\n}\n"],"mappings":";AAsN2C,SAgVnC,UAhVmC,KAgVnC,YAhVmC;AAtN3C,SAAS,YAAAA,WAAU,gBAAgB,YAAY,eAAe;AAE9D,SAAS,iBAAiB;AAE1B,SAAS,eAAe,oBAAoB;AAE5C,SAAS,kBAAkB;AAC3B,SAAS,UAAU;AACnB,SAAS,oBAAoB;AAC7B,SAAS,kBAAkB;AAC3B,SAAS,gBAAgB;AAEzB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAcP,SAAS,gBAAgB;AACzB,SAAS,cAAc;AAyChB,MAAM,iBAAoE,OAAO,OAAO;AAAA,EAC7F,WAAW,OAAO,OAAO;AAAA,IACvB,UAAU;AAAA,IACV,UAAU,OAAO,OAAO;AAAA,MACtB,EAAE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J;","names":["Fragment"]}
|
|
@@ -27,6 +27,10 @@ import { DEFAULT_LEGAL_LABELS } from "./legal-labels.js";
|
|
|
27
27
|
export type LegalPageKey = "impressum" | "privacy" | "terms";
|
|
28
28
|
/** The three routes (§3.1): one per page, the language from i18n, no per-language URLs. */
|
|
29
29
|
export declare const LEGAL_HREFS: Readonly<Record<LegalPageKey, string>>;
|
|
30
|
+
/** 0.51.4: the two public pages an app MAY have beside the legal ones, linked after
|
|
31
|
+
* them in the footer (§3.3) — keksdose's /security and /accessibility. Not legal pages:
|
|
32
|
+
* an app draws them with `PublicPage`, in its own words, at routes of its choosing. */
|
|
33
|
+
export type LegalInfoPageKey = "security" | "accessibility";
|
|
30
34
|
/**
|
|
31
35
|
* Who runs the app — the values the kit's legal sections are filled in with (§5).
|
|
32
36
|
*
|
|
@@ -121,8 +125,11 @@ export interface LegalFramedSectionLabels {
|
|
|
121
125
|
export interface LegalLabels {
|
|
122
126
|
/** The accessible name of {@link LegalLinks}' and {@link LegalFooter}'s `<nav>`. */
|
|
123
127
|
navLabel: string;
|
|
124
|
-
/** The short labels of the three links, everywhere the links appear (§3.3)
|
|
125
|
-
|
|
128
|
+
/** The short labels of the three links, everywhere the links appear (§3.3), and since
|
|
129
|
+
* 0.51.4 of the two optional public pages after them (`securityHref`,
|
|
130
|
+
* `accessibilityHref` on {@link LegalLinks}) — optional keys, as every key added to a
|
|
131
|
+
* namespace an app may annotate: left out, the provider's, then English. */
|
|
132
|
+
links: Record<LegalPageKey, string> & Partial<Record<LegalInfoPageKey, string>>;
|
|
126
133
|
/** The pages' titles — the `<h1>`, and the links of the terms checkbox. */
|
|
127
134
|
titles: Record<LegalPageKey, string>;
|
|
128
135
|
/** The back link above the title: "← Back to home". */
|
|
@@ -150,6 +157,22 @@ export interface LegalLabels {
|
|
|
150
157
|
note: (o: LegalOperatorText) => string;
|
|
151
158
|
show: (o: LegalOperatorText) => string;
|
|
152
159
|
};
|
|
160
|
+
/**
|
|
161
|
+
* 0.51.3: the as-of line under the title (§3.2), "Last updated: 29 October 2026" —
|
|
162
|
+
* {@link LegalPage}'s `updated`, called with the date already written out in the page's
|
|
163
|
+
* locale. OPTIONAL, as every key added to a namespace an app may annotate: left out,
|
|
164
|
+
* the provider's, then English.
|
|
165
|
+
*/
|
|
166
|
+
updated?: (date: string) => string;
|
|
167
|
+
/**
|
|
168
|
+
* 0.51.4: the plain-language summary at the top of a page ({@link LegalPage}'s
|
|
169
|
+
* `summary`, §3.2) — its heading, and the line under the points saying that only the
|
|
170
|
+
* full text binds. Optional, as `updated`.
|
|
171
|
+
*/
|
|
172
|
+
summary?: {
|
|
173
|
+
title: string;
|
|
174
|
+
note: string;
|
|
175
|
+
};
|
|
153
176
|
/** The kit's sections (§4.3), by page and section key. */
|
|
154
177
|
sections: {
|
|
155
178
|
impressum: {
|
|
@@ -238,6 +261,15 @@ export interface LegalLinksProps {
|
|
|
238
261
|
/** Default (0.28): the three routes, `/impressum`, `/privacy` and `/terms`, with the
|
|
239
262
|
* kit's short link labels (`legal.links`), in the contract's order. */
|
|
240
263
|
links?: readonly LegalLink[];
|
|
264
|
+
/**
|
|
265
|
+
* 0.51.4: the app's security page — a "Security" link after the others, with the kit's
|
|
266
|
+
* label (`legal.links.security`). Left out, no link: only an app that has the page
|
|
267
|
+
* names its route.
|
|
268
|
+
*/
|
|
269
|
+
securityHref?: string;
|
|
270
|
+
/** 0.51.4: the app's accessibility statement — "Accessibility", last. As
|
|
271
|
+
* `securityHref`. */
|
|
272
|
+
accessibilityHref?: string;
|
|
241
273
|
/** The page being shown; its link is marked `aria-current="page"`. Usually the
|
|
242
274
|
* router's pathname. */
|
|
243
275
|
currentHref?: string;
|
|
@@ -262,13 +294,17 @@ export interface LegalLinksProps {
|
|
|
262
294
|
* already hears three links, and "middle dot" between them is noise. They are flex items
|
|
263
295
|
* of the row like the links, so the row's gap spaces them evenly.
|
|
264
296
|
*/
|
|
265
|
-
export declare function LegalLinks({ links, currentHref, nav, onLinkClick, labels: labelsProp, className, }: LegalLinksProps): import("react").JSX.Element;
|
|
297
|
+
export declare function LegalLinks({ links, securityHref, accessibilityHref, currentHref, nav, onLinkClick, labels: labelsProp, className, }: LegalLinksProps): import("react").JSX.Element;
|
|
266
298
|
export interface LegalFooterProps {
|
|
267
299
|
/** Under the links, centred — the app's tagline (keksdose: "Self-hosted household
|
|
268
300
|
* budgeting & bookkeeping."). */
|
|
269
301
|
children?: ReactNode;
|
|
270
302
|
/** Default: the three routes with the kit's link labels — see {@link LegalLinks}. */
|
|
271
303
|
links?: readonly LegalLink[];
|
|
304
|
+
/** 0.51.4: "Security" after the others — see {@link LegalLinksProps.securityHref}. */
|
|
305
|
+
securityHref?: string;
|
|
306
|
+
/** 0.51.4: "Accessibility", last — see {@link LegalLinksProps.accessibilityHref}. */
|
|
307
|
+
accessibilityHref?: string;
|
|
272
308
|
/** Marks that link `aria-current="page"`. {@link LegalPage}'s default footer passes
|
|
273
309
|
* its own page. */
|
|
274
310
|
currentHref?: string;
|
|
@@ -293,8 +329,12 @@ export interface LegalFooterProps {
|
|
|
293
329
|
* landing, auth, legal and 404 pages; kastlan and Kurvenschmiede had them on some pages
|
|
294
330
|
* only. Its palette classes (`border-slate-200 bg-white dark:…`) became the surface and
|
|
295
331
|
* border tokens, so it follows the theme like the rest of the kit.
|
|
332
|
+
*
|
|
333
|
+
* 0.51.4: an app with a security page or an accessibility statement passes their routes
|
|
334
|
+
* (`securityHref`, `accessibilityHref`) and the row goes on with "Security · Accessibility"
|
|
335
|
+
* in the kit's words, so the footer reads the same in every app that has them.
|
|
296
336
|
*/
|
|
297
|
-
export declare function LegalFooter({ children, links, currentHref, landmark, className, labels }: LegalFooterProps): import("react").JSX.Element;
|
|
337
|
+
export declare function LegalFooter({ children, links, securityHref, accessibilityHref, currentHref, landmark, className, labels, }: LegalFooterProps): import("react").JSX.Element;
|
|
298
338
|
export interface LegalSectionProps {
|
|
299
339
|
heading: ReactNode;
|
|
300
340
|
/** Running text. Line breaks in it are kept (`white-space: pre-line`), so a
|
|
@@ -335,9 +375,13 @@ export interface LegalLayoutProps {
|
|
|
335
375
|
* than the others (its technical sections describe running code).
|
|
336
376
|
*/
|
|
337
377
|
notice?: ReactNode;
|
|
378
|
+
/** 0.51.3: right under the title — {@link LegalPage}'s "Last updated: …" line. */
|
|
379
|
+
updated?: ReactNode;
|
|
338
380
|
/** 0.28.1: under the title, before the notice — {@link LegalPage}'s note that this
|
|
339
381
|
* page is a translation and which language is binding. */
|
|
340
382
|
translationNote?: ReactNode;
|
|
383
|
+
/** 0.51.4: before the sections — {@link LegalPage}'s plain-language summary. */
|
|
384
|
+
summary?: ReactNode;
|
|
341
385
|
/** The sections — {@link LegalSection}s. */
|
|
342
386
|
children: ReactNode;
|
|
343
387
|
/** The three pages, linked at the end of the column with the current one marked.
|
|
@@ -350,4 +394,4 @@ export interface LegalLayoutProps {
|
|
|
350
394
|
className?: string;
|
|
351
395
|
labels?: LabelOverride<LegalLabels>;
|
|
352
396
|
}
|
|
353
|
-
export declare function LegalLayout({ title, back, notice, translationNote, children, links, currentHref, headingAs: Heading, className, labels, }: LegalLayoutProps): import("react").JSX.Element;
|
|
397
|
+
export declare function LegalLayout({ title, back, notice, updated, translationNote, summary, children, links, currentHref, headingAs: Heading, className, labels, }: LegalLayoutProps): import("react").JSX.Element;
|
package/dist/components/legal.js
CHANGED
|
@@ -87,8 +87,16 @@ function defaultLinks(labels) {
|
|
|
87
87
|
label: labels.links[page]
|
|
88
88
|
}));
|
|
89
89
|
}
|
|
90
|
+
function infoLinks(labels, hrefs) {
|
|
91
|
+
return ["security", "accessibility"].flatMap((page) => {
|
|
92
|
+
const href = hrefs[page];
|
|
93
|
+
return href ? [{ href, label: labels.links[page] ?? DEFAULT_LEGAL_LABELS.links[page] }] : [];
|
|
94
|
+
});
|
|
95
|
+
}
|
|
90
96
|
function LegalLinks({
|
|
91
97
|
links,
|
|
98
|
+
securityHref,
|
|
99
|
+
accessibilityHref,
|
|
92
100
|
currentHref,
|
|
93
101
|
nav = true,
|
|
94
102
|
onLinkClick,
|
|
@@ -96,7 +104,10 @@ function LegalLinks({
|
|
|
96
104
|
className
|
|
97
105
|
}) {
|
|
98
106
|
const labels = useLegalLabels(labelsProp);
|
|
99
|
-
const shown =
|
|
107
|
+
const shown = [
|
|
108
|
+
...links ?? defaultLinks(labels),
|
|
109
|
+
...infoLinks(labels, { security: securityHref, accessibility: accessibilityHref })
|
|
110
|
+
];
|
|
100
111
|
const items = shown.flatMap((link, i) => [
|
|
101
112
|
...i > 0 ? [/* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: "\xB7" }, `sep-${link.href}`)] : [],
|
|
102
113
|
/* @__PURE__ */ jsx(TextLink, { href: link.href, tone: "muted", current: link.href === currentHref, onClick: onLinkClick, children: link.label }, link.href)
|
|
@@ -105,13 +116,24 @@ function LegalLinks({
|
|
|
105
116
|
if (!nav) return /* @__PURE__ */ jsx("div", { className: rowClass, children: items });
|
|
106
117
|
return /* @__PURE__ */ jsx("nav", { "aria-label": labels.navLabel, className: rowClass, children: items });
|
|
107
118
|
}
|
|
108
|
-
function LegalFooter({
|
|
119
|
+
function LegalFooter({
|
|
120
|
+
children,
|
|
121
|
+
links,
|
|
122
|
+
securityHref,
|
|
123
|
+
accessibilityHref,
|
|
124
|
+
currentHref,
|
|
125
|
+
landmark = true,
|
|
126
|
+
className,
|
|
127
|
+
labels
|
|
128
|
+
}) {
|
|
109
129
|
const Root = landmark ? "footer" : "div";
|
|
110
130
|
return /* @__PURE__ */ jsx(Root, { className: cn("border-t border-subtle bg-surface", className), children: /* @__PURE__ */ jsxs("div", { className: "mx-auto max-w-5xl px-4 py-8 text-sm text-muted", children: [
|
|
111
131
|
/* @__PURE__ */ jsx(
|
|
112
132
|
LegalLinks,
|
|
113
133
|
{
|
|
114
134
|
links,
|
|
135
|
+
securityHref,
|
|
136
|
+
accessibilityHref,
|
|
115
137
|
currentHref,
|
|
116
138
|
labels,
|
|
117
139
|
className: "justify-center gap-y-2 text-sm"
|
|
@@ -141,7 +163,9 @@ function LegalLayout({
|
|
|
141
163
|
title,
|
|
142
164
|
back,
|
|
143
165
|
notice,
|
|
166
|
+
updated,
|
|
144
167
|
translationNote,
|
|
168
|
+
summary,
|
|
145
169
|
children,
|
|
146
170
|
links,
|
|
147
171
|
currentHref,
|
|
@@ -152,9 +176,13 @@ function LegalLayout({
|
|
|
152
176
|
return /* @__PURE__ */ jsxs("article", { className: cn("mx-auto w-full max-w-3xl px-4 py-12", className), children: [
|
|
153
177
|
back !== void 0 && /* @__PURE__ */ jsx("div", { className: "mb-4 text-sm", children: back }),
|
|
154
178
|
/* @__PURE__ */ jsx(Heading, { className: "text-3xl font-bold tracking-tight break-words text-primary", children: title }),
|
|
179
|
+
updated !== void 0 && updated !== null && /* @__PURE__ */ jsx("p", { className: "mt-2 text-sm text-muted", children: updated }),
|
|
155
180
|
translationNote !== void 0 && translationNote !== null && /* @__PURE__ */ jsx("div", { className: "mt-3", children: translationNote }),
|
|
156
181
|
notice !== void 0 && notice !== null && /* @__PURE__ */ jsx(AlertBanner, { tone: "warning", role: "note", className: "mt-4", children: notice }),
|
|
157
|
-
/* @__PURE__ */
|
|
182
|
+
/* @__PURE__ */ jsxs("div", { className: "mt-8 space-y-8", children: [
|
|
183
|
+
summary,
|
|
184
|
+
children
|
|
185
|
+
] }),
|
|
158
186
|
links !== void 0 && links.length > 0 && /* @__PURE__ */ jsx(LegalLinks, { links, currentHref, labels, className: "mt-12 border-t border-subtle pt-4" })
|
|
159
187
|
] });
|
|
160
188
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/legal.tsx"],"sourcesContent":["import { createContext, useContext } from \"react\";\nimport type { MouseEvent, ReactNode } from \"react\";\n\nimport { useKitLabels } from \"../i18n/kit-labels\";\nimport type { LabelOverride } from \"../i18n/kit-labels\";\nimport { cn } from \"../lib/cn\";\nimport { countryName } from \"../lib/countries\";\nimport { AlertBanner } from \"./alert-banner\";\nimport { TextLink } from \"./text-link\";\nimport { DEFAULT_LEGAL_LABELS } from \"./legal-labels\";\n\n/**\n * The legal pages — Imprint, Privacy Policy, Terms — for every app.\n *\n * 0.19 (docs/i18n-harmonization.md H10): keksdose and kastlan each carried the same\n * shell, written twice: a back link, the title, a \"closed beta, not yet reviewed by a\n * lawyer\" notice, sections of heading + running text, and kastlan's row of links to the\n * three pages with the current one marked. That shape moved here; the words stayed in\n * each app.\n *\n * 0.28 (docs/legal-harmonization.md) reverses the second half: the wording that is the\n * same in all three apps is the kit's too, in all seven languages, so there is ONE text\n * to change after the lawyer's review instead of three apps drifting apart sentence by\n * sentence. This module holds the labels (every kit-owned legal word, §4.3/§4.4), the\n * column (`LegalLayout`), the section (`LegalSection`, now numbered and cross-referenced\n * inside a `LegalPage`), the links row and the public footer. The page frame, the\n * kit-owned sections and the terms checkbox are in `./legal-page`.\n *\n * `LegalLayout` stays a CONTENT COLUMN, not a page: before 0.28 keksdose showed it inside\n * its public landing header and footer and kastlan inside `AuthLayout`. `LegalPage` is\n * the frame around it that the contract (§3.2) settled on — keksdose's.\n */\n\n// ── The operator ──────────────────────────────────────────────────────────────\n\n/** The three pages, by the key every app uses for them (§4.1). Kurvenschmiede's\n * `imprint` became `impressum`. */\nexport type LegalPageKey = \"impressum\" | \"privacy\" | \"terms\";\n\n/** The three routes (§3.1): one per page, the language from i18n, no per-language URLs. */\nexport const LEGAL_HREFS: Readonly<Record<LegalPageKey, string>> = Object.freeze({\n impressum: \"/impressum\",\n privacy: \"/privacy\",\n terms: \"/terms\",\n});\n\n/**\n * Who runs the app — the values the kit's legal sections are filled in with (§5).\n *\n * The kit holds NO personal data: every app passes the same values once, to\n * {@link LegalPage}'s `operator`. Plain strings, so the app's config or env can hold them.\n */\nexport interface LegalOperator {\n /** The operator's name, as the imprint prints it. */\n name: string;\n /** \"9470\"-shaped; printed before the city. */\n postalCode: string;\n /** The place — the imprint's address line and the terms' place of jurisdiction. */\n city: string;\n /** The canton or state, abbreviated as the place of jurisdiction writes it: \"SG\". */\n region: string;\n /**\n * ISO 3166-1 alpha-2: \"CH\". A CODE, not a name — the kit names it in the page's\n * language (`Intl.DisplayNames`, see `countryName`), so \"Switzerland\", \"Schweiz\",\n * \"Suisse\" and \"瑞士\" all come from one value.\n */\n country: string;\n /** The contact address the imprint and the privacy policy print. */\n email: string;\n /**\n * The language whose version of the legal texts is BINDING (\"de-CH\"), a BCP 47 code\n * (0.28.1, Marcel 2026-10-05). The lawyer reviews that one; the others are translations\n * for convenience. With it, {@link LegalPage} shows a note on every page read in\n * another language, and the terms' `language` section says which version prevails.\n * Only the language subtag counts: \"de-CH\" and \"de\" are the same language here.\n */\n bindingLanguage?: string;\n}\n\n/**\n * The operator as the kit's texts read it: {@link LegalOperator} with `country` already\n * NAMED in the page's language (\"Schweiz\", not \"CH\").\n *\n * The label functions take this rather than the code so they stay pure string functions\n * of plain values, like every other function label in the kit: a catalogue never calls\n * `Intl`, and a review row can be rendered from placeholders (`{{country}}`).\n */\nexport type LegalOperatorText = Readonly<Record<keyof LegalOperator, string>>;\n\n/** The language subtag of a BCP 47 code, lower-cased: \"de-CH\" → \"de\". */\nexport function baseLanguage(code: string): string {\n return code.split(/[-_]/)[0]!.toLowerCase();\n}\n\nconst languageNamers = new Map<string, Intl.DisplayNames | null>();\n\n/** The name of a language in `locale` — \"Deutsch\", \"German\", \"allemand\", \"德语\" — from its\n * language subtag, so \"de-CH\" is plain \"German\", not \"Swiss High German\". The code itself\n * when the runtime cannot name it. */\nfunction languageName(code: string, locale: string): string {\n let namer = languageNamers.get(locale);\n if (namer === undefined) {\n try {\n namer = new Intl.DisplayNames([locale], { type: \"language\" });\n } catch {\n namer = null;\n }\n languageNamers.set(locale, namer);\n }\n const base = baseLanguage(code);\n try {\n return namer?.of(base) ?? base;\n } catch {\n return base;\n }\n}\n\n/** @internal The operator as the texts read it: its country named in `locale` (English\n * without one — `countryName`'s rule, so an app that set no locale reads English). */\nexport function legalOperatorText(operator: LegalOperator, locale: string = \"en\"): LegalOperatorText {\n return {\n ...operator,\n country: countryName(operator.country, locale),\n bindingLanguage: operator.bindingLanguage ? languageName(operator.bindingLanguage, locale) : \"\",\n };\n}\n\n// ── Labels ────────────────────────────────────────────────────────────────────\n\n/** A kit section whose text is fixed: a heading and one body. */\nexport interface LegalTextSectionLabels {\n title: string;\n body: string;\n}\n\n/**\n * 0.32.0: the imprint's disclaimer, with the body of its COMMERCIAL variant\n * (docs/billing-harmonization.md §8; legal decision 7). The title is the same in both:\n * liability for content and links is the subject either way.\n */\nexport interface LegalDisclaimerSectionLabels extends LegalTextSectionLabels {\n /**\n * The body for `<LegalKitSection section=\"disclaimer\" variant=\"commercial\">`: a paid\n * service sold through a Merchant of Record, which sells in its own name (§2.2), so the\n * \"private, non-commercial … closed beta\" of `body` would be untrue. OPTIONAL, as every\n * key added to a namespace an app may annotate: left out, the provider's, then English.\n */\n commercial?: string;\n}\n\n/** A kit section whose text names the operator (§4.3 `{name}`, `{email}`, …). */\nexport interface LegalOperatorSectionLabels {\n title: string;\n /** Called with the operator, its country already named in the page's language. Line\n * breaks are kept (`white-space: pre-line`): an address is plain lines. */\n body: (operator: LegalOperatorText) => string;\n}\n\n/** A kit section with an app slot (or a list) between its two parts. */\nexport interface LegalFramedSectionLabels {\n title: string;\n /** Before the app's part. */\n lead: string;\n /** After it. */\n tail: string;\n}\n\n/**\n * Every word of the legal pages that is the kit's — docs/legal-harmonization.md §4.3 and\n * §4.4, verbatim. English, British spelling; the other six languages are in the\n * catalogues (`@eifi1/ui-kit/i18n/<code>`).\n *\n * Keys follow the contract: `sections.<page>.<section key>`, the section keys being\n * keksdose's (`legal_basis`, not `legalBasis`), because the same key is the section's\n * `id` (`/privacy#legal_basis`) and the app's own sections sit beside these under the\n * same names in its catalogue. Titles carry NO number: {@link LegalPage} numbers the\n * privacy and terms sections in render order (§4.1).\n */\nexport interface LegalLabels {\n /** The accessible name of {@link LegalLinks}' and {@link LegalFooter}'s `<nav>`. */\n navLabel: string;\n /** The short labels of the three links, everywhere the links appear (§3.3). */\n links: Record<LegalPageKey, string>;\n /** The pages' titles — the `<h1>`, and the links of the terms checkbox. */\n titles: Record<LegalPageKey, string>;\n /** The back link above the title: \"← Back to home\". */\n backHome: string;\n /**\n * The terms checkbox (§3.4) — ONE template with `{terms}` and `{privacy}`, which\n * become the links (named with `titles`). Not a prefix plus a joiner: a language puts\n * the links where its grammar wants them, articles included, and nothing is added\n * around a placeholder — Italian elides, \"e l’{privacy}\", with no space.\n */\n accept: string;\n /** The notice under the title (§3.2): `beta` on the imprint and the terms, `privacy`\n * on the privacy policy. */\n notice: {\n beta: string;\n privacy: string;\n };\n /**\n * 0.28.1: on a page read in another language than the operator's `bindingLanguage` —\n * `note` under the title, `show` on the button that switches to the binding version\n * (when the app passes `onShowBindingLanguage`). `o.bindingLanguage` is the binding\n * language's NAME in the reader's language (\"German\", \"allemand\").\n */\n translation: {\n note: (o: LegalOperatorText) => string;\n show: (o: LegalOperatorText) => string;\n };\n /** The kit's sections (§4.3), by page and section key. */\n sections: {\n impressum: {\n operator: LegalOperatorSectionLabels;\n contact: LegalOperatorSectionLabels;\n /** `body` is the default, non-commercial text; `commercial` the 0.32 variant. */\n disclaimer: LegalDisclaimerSectionLabels;\n };\n privacy: {\n controller: LegalOperatorSectionLabels;\n /** The app's paragraph follows the body (§4.2): consent, where an app relies on it. */\n legal_basis: LegalTextSectionLabels;\n /** `lead`, then the app's entries as a list, then `tail`, then the app's paragraph. */\n browser: LegalFramedSectionLabels;\n /** `lead` (the rights), then the app's paragraph (export, deletion), then `tail`\n * (the supervisory authorities). */\n rights: LegalFramedSectionLabels;\n contact: LegalOperatorSectionLabels;\n };\n terms: {\n warranty: LegalTextSectionLabels;\n liability: LegalTextSectionLabels;\n changes: LegalTextSectionLabels;\n /** 0.28.1: which language's version prevails — `o.bindingLanguage`, named. */\n language: LegalOperatorSectionLabels;\n /** The place of jurisdiction is the operator's `{city} ({region}), {country}`. */\n law: LegalOperatorSectionLabels;\n };\n };\n}\n\n// Defined in ./legal-labels, which holds no component code (0.34, KS U8).\nexport { DEFAULT_LEGAL_LABELS };\n\n/** The `legal` namespace, resolved: defaults < provider < `labels` prop. The prop may be\n * partial at every depth (`{ titles: { terms: \"…\" } }`), as the provider's is. */\nexport function useLegalLabels(labels?: LabelOverride<LegalLabels>): LegalLabels {\n return useKitLabels(\"legal\", DEFAULT_LEGAL_LABELS, labels);\n}\n\n// ── What a LegalPage tells the sections inside it ─────────────────────────────\n\n/** Where a `{ref:key}` points: the section's number on a numbered page, else its heading. */\nexport interface LegalRefTarget {\n number?: number;\n heading: ReactNode;\n}\n\n/** @internal Set by `LegalPage` around its column; `null` outside one. */\nexport interface LegalPageContextValue {\n page: LegalPageKey;\n /** The operator with its country named — what the kit sections are filled in with. */\n operator: LegalOperatorText;\n /** The heading level of a section that does not choose one: one below the title. */\n sectionHeading: \"h2\" | \"h3\";\n /** Every section's key, in render order — known BEFORE any section renders, so a\n * reference can point forward (keksdose's section 2 refers to section 10). */\n targets: ReadonlyMap<string, LegalRefTarget>;\n}\n\n/** @internal */\nexport const LegalPageContext = createContext<LegalPageContextValue | null>(null);\n\n/** @internal The place `LegalPage` gave one section: its key and its number. Reset to\n * `null` inside a section, so a section nested in another's children takes neither. */\nexport interface LegalSectionSlot {\n id?: string;\n number?: number;\n}\n\n/** @internal */\nexport const LegalSlotContext = createContext<LegalSectionSlot | null>(null);\n\n/** @internal `{ref:retention}`. A key is a section key: letters, digits, `_` and `-`. */\nconst REF_TOKEN = /\\{ref:([A-Za-z0-9_-]+)\\}/g;\n\n/**\n * A development build's console note — never in production (the consumer's bundler\n * makes `import.meta.env.DEV` false) and never under vitest. Optional-chained:\n * `import.meta.env` is a Vite injection, absent under plain Node.\n */\nfunction devWarnings(): boolean {\n return Boolean(import.meta.env?.DEV) && !import.meta.env?.VITEST;\n}\nconst warned = new Set<string>();\n/** @internal Once per message. */\nexport function warnLegalOnce(message: string): void {\n if (!devWarnings() || warned.has(message)) return;\n warned.add(message);\n console.warn(`[ui-kit] ${message}`);\n}\n\n/**\n * `text` with every `{ref:key}` replaced by a link to `#key` that reads the section's\n * number — the words around it stay the app's (\"see section {ref:retention}\", \"siehe\n * Abschnitt {ref:retention}\"), so each language keeps its grammar (§4.1). On the imprint,\n * which is not numbered, the link reads the section's heading instead.\n *\n * Outside a {@link LegalPage} the text is returned as it is: there is no order to count.\n * A key the page has no section for stays visible as the raw token — a broken reference\n * an app test can find (`not.toHaveTextContent(\"{ref:\")`), not a silently wrong number.\n */\nexport function resolveLegalRefs(text: string, page: LegalPageContextValue | null): ReactNode {\n if (!page || !text.includes(\"{ref:\")) return text;\n const out: ReactNode[] = [];\n let last = 0;\n for (const match of text.matchAll(REF_TOKEN)) {\n const at = match.index ?? 0;\n if (at > last) out.push(text.slice(last, at));\n const key = match[1];\n const target = page.targets.get(key);\n if (target) {\n out.push(\n <TextLink key={`${key}@${at}`} href={`#${key}`}>\n {target.number ?? target.heading}\n </TextLink>,\n );\n } else {\n warnLegalOnce(`{ref:${key}} on the ${page.page} page points at no section of it.`);\n out.push(match[0]);\n }\n last = at + match[0].length;\n }\n if (last < text.length) out.push(text.slice(last));\n return out;\n}\n\n/** @internal Running text — one translation string — with its line breaks kept and its\n * `{ref:key}` tokens resolved. */\nexport function LegalText({ text, className }: { text: string; className?: string }) {\n const page = useContext(LegalPageContext);\n // `break-words`: an address, an email or a URL in a translation is one long word, and\n // on a 390px phone it would push the column wider than the screen.\n return <p className={cn(\"whitespace-pre-line break-words\", className)}>{resolveLegalRefs(text, page)}</p>;\n}\n\n// ── Links ─────────────────────────────────────────────────────────────────────\n\nexport interface LegalLink {\n href: string;\n /** \"Imprint\", \"Privacy Policy\", \"Terms\". */\n label: ReactNode;\n}\n\nexport interface LegalLinksProps {\n /** Default (0.28): the three routes, `/impressum`, `/privacy` and `/terms`, with the\n * kit's short link labels (`legal.links`), in the contract's order. */\n links?: readonly LegalLink[];\n /** The page being shown; its link is marked `aria-current=\"page\"`. Usually the\n * router's pathname. */\n currentHref?: string;\n /** `false` renders the links without the `<nav>` landmark — inside `AuthLayout`'s\n * `footer` or `TopBarActionMenu`'s `footer`, which are named `<nav>`s already. The row\n * keeps its spacing and `className` either way (0.27.1: it used to return the bare\n * links, so in a plain container — Kurvenschmiede's account-menu `<li>` — they ran\n * together as \"ImpressumDatenschutzerklärungNutz…\" and overflowed). Default true. */\n nav?: boolean;\n /** Called on a click on any of the links, before it navigates — an account menu closes\n * itself here (0.28.1, keksdose: it had to catch the click on a wrapping `<div>`). */\n onLinkClick?: (event: MouseEvent<HTMLAnchorElement>) => void;\n labels?: LabelOverride<LegalLabels>;\n className?: string;\n}\n\n/** The default links: the three routes under the kit's short labels. */\nfunction defaultLinks(labels: LegalLabels): LegalLink[] {\n return ([\"impressum\", \"privacy\", \"terms\"] as const).map((page) => ({\n href: LEGAL_HREFS[page],\n label: labels.links[page],\n }));\n}\n\n/**\n * The legal pages as a row of quiet links, the one you are on marked (kastlan's\n * `LegalLinks`). Wraps on a phone.\n *\n * 0.28: `·` separators between the links, keksdose's footer style, wherever the links\n * appear — the account menu included (§3.3). The dots are `aria-hidden`: a screen reader\n * already hears three links, and \"middle dot\" between them is noise. They are flex items\n * of the row like the links, so the row's gap spaces them evenly.\n */\nexport function LegalLinks({\n links,\n currentHref,\n nav = true,\n onLinkClick,\n labels: labelsProp,\n className,\n}: LegalLinksProps) {\n const labels = useLegalLabels(labelsProp);\n const shown = links ?? defaultLinks(labels);\n const items = shown.flatMap((link, i) => [\n ...(i > 0 ? [<span key={`sep-${link.href}`} aria-hidden=\"true\">·</span>] : []),\n <TextLink key={link.href} href={link.href} tone=\"muted\" current={link.href === currentHref} onClick={onLinkClick}>\n {link.label}\n </TextLink>,\n ]);\n const rowClass = cn(\"flex flex-wrap items-center gap-x-4 gap-y-1 text-xs\", className);\n if (!nav) return <div className={rowClass}>{items}</div>;\n return (\n <nav aria-label={labels.navLabel} className={rowClass}>\n {items}\n </nav>\n );\n}\n\n// ── Footer ────────────────────────────────────────────────────────────────────\n\nexport interface LegalFooterProps {\n /** Under the links, centred — the app's tagline (keksdose: \"Self-hosted household\n * budgeting & bookkeeping.\"). */\n children?: ReactNode;\n /** Default: the three routes with the kit's link labels — see {@link LegalLinks}. */\n links?: readonly LegalLink[];\n /** Marks that link `aria-current=\"page\"`. {@link LegalPage}'s default footer passes\n * its own page. */\n currentHref?: string;\n /**\n * Default true: the footer is a `<footer>`. `false` draws a `<div>` — for a host that is\n * a footer already: `AuthLayout`'s `footer` slot is one, and HTML forbids a footer inside\n * a footer (0.28.1, kastlan). On an `AuthLayout` page the usual choice is simpler still:\n * `footer={<LegalLinks nav={false} />}` with `footerLabel` set to the kit's `navLabel`\n * ({@link useLegalLabels}).\n */\n landmark?: boolean;\n className?: string;\n labels?: LabelOverride<LegalLabels>;\n}\n\n/**\n * The public footer (§3.3): the three links, centred, with their separators, in a\n * `<nav aria-label=\"Legal\">` — on the landing or home page, every signed-out page the app\n * has, the legal pages and the 404. The rule behind it: from every page a signed-out\n * visitor can reach, the three links are one click away.\n *\n * keksdose's `SiteFooter` (features/landing/site-footer.tsx), which carried them on its\n * landing, auth, legal and 404 pages; kastlan and Kurvenschmiede had them on some pages\n * only. Its palette classes (`border-slate-200 bg-white dark:…`) became the surface and\n * border tokens, so it follows the theme like the rest of the kit.\n */\nexport function LegalFooter({ children, links, currentHref, landmark = true, className, labels }: LegalFooterProps) {\n const Root = landmark ? \"footer\" : \"div\";\n return (\n <Root className={cn(\"border-t border-subtle bg-surface\", className)}>\n <div className=\"mx-auto max-w-5xl px-4 py-8 text-sm text-muted\">\n <LegalLinks\n links={links}\n currentHref={currentHref}\n labels={labels}\n className=\"justify-center gap-y-2 text-sm\"\n />\n {children !== undefined && children !== null && <p className=\"mt-4 text-center\">{children}</p>}\n </div>\n </Root>\n );\n}\n\n// ── Section ───────────────────────────────────────────────────────────────────\n\nexport interface LegalSectionProps {\n heading: ReactNode;\n /** Running text. Line breaks in it are kept (`white-space: pre-line`), so a\n * translation can hold an address or a list as plain lines. Inside a\n * {@link LegalPage}, `{ref:key}` becomes the number of section `key`, linked. */\n body?: string;\n /** Anything richer than plain text — links, a list — after `body`. A plain string\n * here has its `{ref:key}` tokens resolved too. */\n children?: ReactNode;\n /**\n * The section's `id`, for a link to it from elsewhere. Inside a {@link LegalPage} it\n * defaults to the element's React `key` — keksdose's\n * `SECTIONS.map((s) => <LegalSection key={s} … />)` gets `id=\"retention\"` with\n * nothing added — and it is the key a `{ref:…}` names.\n */\n id?: string;\n /** The heading's element. Default `h2` under the layout's `h1` (inside a\n * `LegalPage`, one level below its title). */\n headingAs?: \"h2\" | \"h3\";\n}\n\n/**\n * One section: heading and running text.\n *\n * 0.28, inside a {@link LegalPage}: its `id` (the `key` unless given), its number on the\n * privacy policy and the terms (\"3. Legal basis\" — titles carry no number, §4.1), and\n * `{ref:key}` resolution in `body`. Outside one it is exactly the 0.19 section.\n */\nexport function LegalSection({ heading, body, children, id: idProp, headingAs }: LegalSectionProps) {\n const page = useContext(LegalPageContext);\n const slot = useContext(LegalSlotContext);\n const id = idProp ?? slot?.id;\n const number = slot?.number;\n const Heading = headingAs ?? page?.sectionHeading ?? \"h2\";\n return (\n <section id={id} className=\"scroll-mt-20\">\n <Heading className=\"text-lg font-semibold break-words text-primary\">\n {number !== undefined && `${number}. `}\n {heading}\n </Heading>\n <LegalSlotContext.Provider value={null}>\n {body !== undefined && (\n <LegalText text={body} className=\"mt-2 text-sm leading-relaxed text-secondary\" />\n )}\n {children !== undefined && (\n <div className=\"mt-2 text-sm leading-relaxed break-words text-secondary\">\n {typeof children === \"string\" ? resolveLegalRefs(children, page) : children}\n </div>\n )}\n </LegalSlotContext.Provider>\n </section>\n );\n}\n\n// ── Layout ────────────────────────────────────────────────────────────────────\n\nexport interface LegalLayoutProps {\n /** \"Imprint\", \"Privacy Policy\", \"Terms\". */\n title: ReactNode;\n /** Above the title — the app's \"← Back\" link (`<TextLink icon={ArrowLeft}>`). Inside\n * a {@link LegalPage}, \"← Back to home\". */\n back?: ReactNode;\n /**\n * A notice under the title, as a warning banner with `role=\"note\"` — page furniture,\n * not an alert. Per page, not per layout: the privacy page says something more precise\n * than the others (its technical sections describe running code).\n */\n notice?: ReactNode;\n /** 0.28.1: under the title, before the notice — {@link LegalPage}'s note that this\n * page is a translation and which language is binding. */\n translationNote?: ReactNode;\n /** The sections — {@link LegalSection}s. */\n children: ReactNode;\n /** The three pages, linked at the end of the column with the current one marked.\n * Leave out when the page's chrome already shows them (a {@link LegalFooter}). */\n links?: readonly LegalLink[];\n currentHref?: string;\n /** Default `h1`: the page's heading. */\n headingAs?: \"h1\" | \"h2\";\n /** Extra classes on the column — `px-0 py-0` inside a chrome that pads already. */\n className?: string;\n labels?: LabelOverride<LegalLabels>;\n}\n\nexport function LegalLayout({\n title,\n back,\n notice,\n translationNote,\n children,\n links,\n currentHref,\n headingAs: Heading = \"h1\",\n className,\n labels,\n}: LegalLayoutProps) {\n return (\n <article className={cn(\"mx-auto w-full max-w-3xl px-4 py-12\", className)}>\n {back !== undefined && <div className=\"mb-4 text-sm\">{back}</div>}\n <Heading className=\"text-3xl font-bold tracking-tight break-words text-primary\">{title}</Heading>\n {translationNote !== undefined && translationNote !== null && <div className=\"mt-3\">{translationNote}</div>}\n {notice !== undefined && notice !== null && (\n <AlertBanner tone=\"warning\" role=\"note\" className=\"mt-4\">\n {notice}\n </AlertBanner>\n )}\n <div className=\"mt-8 space-y-8\">{children}</div>\n {links !== undefined && links.length > 0 && (\n <LegalLinks links={links} currentHref={currentHref} labels={labels} className=\"mt-12 border-t border-subtle pt-4\" />\n )}\n </article>\n );\n}\n"],"mappings":";AAmUQ,cAmIF,YAnIE;AAnUR,SAAS,eAAe,kBAAkB;AAG1C,SAAS,oBAAoB;AAE7B,SAAS,UAAU;AACnB,SAAS,mBAAmB;AAC5B,SAAS,mBAAmB;AAC5B,SAAS,gBAAgB;AACzB,SAAS,4BAA4B;AA+B9B,MAAM,cAAsD,OAAO,OAAO;AAAA,EAC/E,WAAW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jB,EAA0B,OAAO,MAC/B;AAAA,eAAS,UACR,oBAAC,aAAU,MAAM,MAAM,WAAU,+CAA8C;AAAA,MAEhF,aAAa,UACZ,oBAAC,SAAI,WAAU,2DACZ,iBAAO,aAAa,WAAW,iBAAiB,UAAU,IAAI,IAAI,UACrE;AAAA,OAEJ;AAAA,KACF;AAEJ;AAgCO,SAAS,YAAY;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,WAAW,UAAU;AAAA,EACrB;AAAA,EACA;AACF,GAAqB;AACnB,SACE,qBAAC,aAAQ,WAAW,GAAG,uCAAuC,SAAS,GACpE;AAAA,aAAS,UAAa,oBAAC,SAAI,WAAU,gBAAgB,gBAAK;AAAA,IAC3D,oBAAC,WAAQ,WAAU,8DAA8D,iBAAM;AAAA,IACtF,oBAAoB,UAAa,oBAAoB,QAAQ,oBAAC,SAAI,WAAU,QAAQ,2BAAgB;AAAA,IACpG,WAAW,UAAa,WAAW,QAClC,oBAAC,eAAY,MAAK,WAAU,MAAK,QAAO,WAAU,QAC/C,kBACH;AAAA,IAEF,oBAAC,SAAI,WAAU,kBAAkB,UAAS;AAAA,IACzC,UAAU,UAAa,MAAM,SAAS,KACrC,oBAAC,cAAW,OAAc,aAA0B,QAAgB,WAAU,qCAAoC;AAAA,KAEtH;AAEJ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/components/legal.tsx"],"sourcesContent":["import { createContext, useContext } from \"react\";\nimport type { MouseEvent, ReactNode } from \"react\";\n\nimport { useKitLabels } from \"../i18n/kit-labels\";\nimport type { LabelOverride } from \"../i18n/kit-labels\";\nimport { cn } from \"../lib/cn\";\nimport { countryName } from \"../lib/countries\";\nimport { AlertBanner } from \"./alert-banner\";\nimport { TextLink } from \"./text-link\";\nimport { DEFAULT_LEGAL_LABELS } from \"./legal-labels\";\n\n/**\n * The legal pages — Imprint, Privacy Policy, Terms — for every app.\n *\n * 0.19 (docs/i18n-harmonization.md H10): keksdose and kastlan each carried the same\n * shell, written twice: a back link, the title, a \"closed beta, not yet reviewed by a\n * lawyer\" notice, sections of heading + running text, and kastlan's row of links to the\n * three pages with the current one marked. That shape moved here; the words stayed in\n * each app.\n *\n * 0.28 (docs/legal-harmonization.md) reverses the second half: the wording that is the\n * same in all three apps is the kit's too, in all seven languages, so there is ONE text\n * to change after the lawyer's review instead of three apps drifting apart sentence by\n * sentence. This module holds the labels (every kit-owned legal word, §4.3/§4.4), the\n * column (`LegalLayout`), the section (`LegalSection`, now numbered and cross-referenced\n * inside a `LegalPage`), the links row and the public footer. The page frame, the\n * kit-owned sections and the terms checkbox are in `./legal-page`.\n *\n * `LegalLayout` stays a CONTENT COLUMN, not a page: before 0.28 keksdose showed it inside\n * its public landing header and footer and kastlan inside `AuthLayout`. `LegalPage` is\n * the frame around it that the contract (§3.2) settled on — keksdose's.\n */\n\n// ── The operator ──────────────────────────────────────────────────────────────\n\n/** The three pages, by the key every app uses for them (§4.1). Kurvenschmiede's\n * `imprint` became `impressum`. */\nexport type LegalPageKey = \"impressum\" | \"privacy\" | \"terms\";\n\n/** The three routes (§3.1): one per page, the language from i18n, no per-language URLs. */\nexport const LEGAL_HREFS: Readonly<Record<LegalPageKey, string>> = Object.freeze({\n impressum: \"/impressum\",\n privacy: \"/privacy\",\n terms: \"/terms\",\n});\n\n/** 0.51.4: the two public pages an app MAY have beside the legal ones, linked after\n * them in the footer (§3.3) — keksdose's /security and /accessibility. Not legal pages:\n * an app draws them with `PublicPage`, in its own words, at routes of its choosing. */\nexport type LegalInfoPageKey = \"security\" | \"accessibility\";\n\n/**\n * Who runs the app — the values the kit's legal sections are filled in with (§5).\n *\n * The kit holds NO personal data: every app passes the same values once, to\n * {@link LegalPage}'s `operator`. Plain strings, so the app's config or env can hold them.\n */\nexport interface LegalOperator {\n /** The operator's name, as the imprint prints it. */\n name: string;\n /** \"9470\"-shaped; printed before the city. */\n postalCode: string;\n /** The place — the imprint's address line and the terms' place of jurisdiction. */\n city: string;\n /** The canton or state, abbreviated as the place of jurisdiction writes it: \"SG\". */\n region: string;\n /**\n * ISO 3166-1 alpha-2: \"CH\". A CODE, not a name — the kit names it in the page's\n * language (`Intl.DisplayNames`, see `countryName`), so \"Switzerland\", \"Schweiz\",\n * \"Suisse\" and \"瑞士\" all come from one value.\n */\n country: string;\n /** The contact address the imprint and the privacy policy print. */\n email: string;\n /**\n * The language whose version of the legal texts is BINDING (\"de-CH\"), a BCP 47 code\n * (0.28.1, Marcel 2026-10-05). The lawyer reviews that one; the others are translations\n * for convenience. With it, {@link LegalPage} shows a note on every page read in\n * another language, and the terms' `language` section says which version prevails.\n * Only the language subtag counts: \"de-CH\" and \"de\" are the same language here.\n */\n bindingLanguage?: string;\n}\n\n/**\n * The operator as the kit's texts read it: {@link LegalOperator} with `country` already\n * NAMED in the page's language (\"Schweiz\", not \"CH\").\n *\n * The label functions take this rather than the code so they stay pure string functions\n * of plain values, like every other function label in the kit: a catalogue never calls\n * `Intl`, and a review row can be rendered from placeholders (`{{country}}`).\n */\nexport type LegalOperatorText = Readonly<Record<keyof LegalOperator, string>>;\n\n/** The language subtag of a BCP 47 code, lower-cased: \"de-CH\" → \"de\". */\nexport function baseLanguage(code: string): string {\n return code.split(/[-_]/)[0]!.toLowerCase();\n}\n\nconst languageNamers = new Map<string, Intl.DisplayNames | null>();\n\n/** The name of a language in `locale` — \"Deutsch\", \"German\", \"allemand\", \"德语\" — from its\n * language subtag, so \"de-CH\" is plain \"German\", not \"Swiss High German\". The code itself\n * when the runtime cannot name it. */\nfunction languageName(code: string, locale: string): string {\n let namer = languageNamers.get(locale);\n if (namer === undefined) {\n try {\n namer = new Intl.DisplayNames([locale], { type: \"language\" });\n } catch {\n namer = null;\n }\n languageNamers.set(locale, namer);\n }\n const base = baseLanguage(code);\n try {\n return namer?.of(base) ?? base;\n } catch {\n return base;\n }\n}\n\n/** @internal The operator as the texts read it: its country named in `locale` (English\n * without one — `countryName`'s rule, so an app that set no locale reads English). */\nexport function legalOperatorText(operator: LegalOperator, locale: string = \"en\"): LegalOperatorText {\n return {\n ...operator,\n country: countryName(operator.country, locale),\n bindingLanguage: operator.bindingLanguage ? languageName(operator.bindingLanguage, locale) : \"\",\n };\n}\n\n// ── Labels ────────────────────────────────────────────────────────────────────\n\n/** A kit section whose text is fixed: a heading and one body. */\nexport interface LegalTextSectionLabels {\n title: string;\n body: string;\n}\n\n/**\n * 0.32.0: the imprint's disclaimer, with the body of its COMMERCIAL variant\n * (docs/billing-harmonization.md §8; legal decision 7). The title is the same in both:\n * liability for content and links is the subject either way.\n */\nexport interface LegalDisclaimerSectionLabels extends LegalTextSectionLabels {\n /**\n * The body for `<LegalKitSection section=\"disclaimer\" variant=\"commercial\">`: a paid\n * service sold through a Merchant of Record, which sells in its own name (§2.2), so the\n * \"private, non-commercial … closed beta\" of `body` would be untrue. OPTIONAL, as every\n * key added to a namespace an app may annotate: left out, the provider's, then English.\n */\n commercial?: string;\n}\n\n/** A kit section whose text names the operator (§4.3 `{name}`, `{email}`, …). */\nexport interface LegalOperatorSectionLabels {\n title: string;\n /** Called with the operator, its country already named in the page's language. Line\n * breaks are kept (`white-space: pre-line`): an address is plain lines. */\n body: (operator: LegalOperatorText) => string;\n}\n\n/** A kit section with an app slot (or a list) between its two parts. */\nexport interface LegalFramedSectionLabels {\n title: string;\n /** Before the app's part. */\n lead: string;\n /** After it. */\n tail: string;\n}\n\n/**\n * Every word of the legal pages that is the kit's — docs/legal-harmonization.md §4.3 and\n * §4.4, verbatim. English, British spelling; the other six languages are in the\n * catalogues (`@eifi1/ui-kit/i18n/<code>`).\n *\n * Keys follow the contract: `sections.<page>.<section key>`, the section keys being\n * keksdose's (`legal_basis`, not `legalBasis`), because the same key is the section's\n * `id` (`/privacy#legal_basis`) and the app's own sections sit beside these under the\n * same names in its catalogue. Titles carry NO number: {@link LegalPage} numbers the\n * privacy and terms sections in render order (§4.1).\n */\nexport interface LegalLabels {\n /** The accessible name of {@link LegalLinks}' and {@link LegalFooter}'s `<nav>`. */\n navLabel: string;\n /** The short labels of the three links, everywhere the links appear (§3.3), and since\n * 0.51.4 of the two optional public pages after them (`securityHref`,\n * `accessibilityHref` on {@link LegalLinks}) — optional keys, as every key added to a\n * namespace an app may annotate: left out, the provider's, then English. */\n links: Record<LegalPageKey, string> & Partial<Record<LegalInfoPageKey, string>>;\n /** The pages' titles — the `<h1>`, and the links of the terms checkbox. */\n titles: Record<LegalPageKey, string>;\n /** The back link above the title: \"← Back to home\". */\n backHome: string;\n /**\n * The terms checkbox (§3.4) — ONE template with `{terms}` and `{privacy}`, which\n * become the links (named with `titles`). Not a prefix plus a joiner: a language puts\n * the links where its grammar wants them, articles included, and nothing is added\n * around a placeholder — Italian elides, \"e l’{privacy}\", with no space.\n */\n accept: string;\n /** The notice under the title (§3.2): `beta` on the imprint and the terms, `privacy`\n * on the privacy policy. */\n notice: {\n beta: string;\n privacy: string;\n };\n /**\n * 0.28.1: on a page read in another language than the operator's `bindingLanguage` —\n * `note` under the title, `show` on the button that switches to the binding version\n * (when the app passes `onShowBindingLanguage`). `o.bindingLanguage` is the binding\n * language's NAME in the reader's language (\"German\", \"allemand\").\n */\n translation: {\n note: (o: LegalOperatorText) => string;\n show: (o: LegalOperatorText) => string;\n };\n /**\n * 0.51.3: the as-of line under the title (§3.2), \"Last updated: 29 October 2026\" —\n * {@link LegalPage}'s `updated`, called with the date already written out in the page's\n * locale. OPTIONAL, as every key added to a namespace an app may annotate: left out,\n * the provider's, then English.\n */\n updated?: (date: string) => string;\n /**\n * 0.51.4: the plain-language summary at the top of a page ({@link LegalPage}'s\n * `summary`, §3.2) — its heading, and the line under the points saying that only the\n * full text binds. Optional, as `updated`.\n */\n summary?: {\n title: string;\n note: string;\n };\n /** The kit's sections (§4.3), by page and section key. */\n sections: {\n impressum: {\n operator: LegalOperatorSectionLabels;\n contact: LegalOperatorSectionLabels;\n /** `body` is the default, non-commercial text; `commercial` the 0.32 variant. */\n disclaimer: LegalDisclaimerSectionLabels;\n };\n privacy: {\n controller: LegalOperatorSectionLabels;\n /** The app's paragraph follows the body (§4.2): consent, where an app relies on it. */\n legal_basis: LegalTextSectionLabels;\n /** `lead`, then the app's entries as a list, then `tail`, then the app's paragraph. */\n browser: LegalFramedSectionLabels;\n /** `lead` (the rights), then the app's paragraph (export, deletion), then `tail`\n * (the supervisory authorities). */\n rights: LegalFramedSectionLabels;\n contact: LegalOperatorSectionLabels;\n };\n terms: {\n warranty: LegalTextSectionLabels;\n liability: LegalTextSectionLabels;\n changes: LegalTextSectionLabels;\n /** 0.28.1: which language's version prevails — `o.bindingLanguage`, named. */\n language: LegalOperatorSectionLabels;\n /** The place of jurisdiction is the operator's `{city} ({region}), {country}`. */\n law: LegalOperatorSectionLabels;\n };\n };\n}\n\n// Defined in ./legal-labels, which holds no component code (0.34, KS U8).\nexport { DEFAULT_LEGAL_LABELS };\n\n/** The `legal` namespace, resolved: defaults < provider < `labels` prop. The prop may be\n * partial at every depth (`{ titles: { terms: \"…\" } }`), as the provider's is. */\nexport function useLegalLabels(labels?: LabelOverride<LegalLabels>): LegalLabels {\n return useKitLabels(\"legal\", DEFAULT_LEGAL_LABELS, labels);\n}\n\n// ── What a LegalPage tells the sections inside it ─────────────────────────────\n\n/** Where a `{ref:key}` points: the section's number on a numbered page, else its heading. */\nexport interface LegalRefTarget {\n number?: number;\n heading: ReactNode;\n}\n\n/** @internal Set by `LegalPage` around its column; `null` outside one. */\nexport interface LegalPageContextValue {\n page: LegalPageKey;\n /** The operator with its country named — what the kit sections are filled in with. */\n operator: LegalOperatorText;\n /** The heading level of a section that does not choose one: one below the title. */\n sectionHeading: \"h2\" | \"h3\";\n /** Every section's key, in render order — known BEFORE any section renders, so a\n * reference can point forward (keksdose's section 2 refers to section 10). */\n targets: ReadonlyMap<string, LegalRefTarget>;\n}\n\n/** @internal */\nexport const LegalPageContext = createContext<LegalPageContextValue | null>(null);\n\n/** @internal The place `LegalPage` gave one section: its key and its number. Reset to\n * `null` inside a section, so a section nested in another's children takes neither. */\nexport interface LegalSectionSlot {\n id?: string;\n number?: number;\n}\n\n/** @internal */\nexport const LegalSlotContext = createContext<LegalSectionSlot | null>(null);\n\n/** @internal `{ref:retention}`. A key is a section key: letters, digits, `_` and `-`. */\nconst REF_TOKEN = /\\{ref:([A-Za-z0-9_-]+)\\}/g;\n\n/**\n * A development build's console note — never in production (the consumer's bundler\n * makes `import.meta.env.DEV` false) and never under vitest. Optional-chained:\n * `import.meta.env` is a Vite injection, absent under plain Node.\n */\nfunction devWarnings(): boolean {\n return Boolean(import.meta.env?.DEV) && !import.meta.env?.VITEST;\n}\nconst warned = new Set<string>();\n/** @internal Once per message. */\nexport function warnLegalOnce(message: string): void {\n if (!devWarnings() || warned.has(message)) return;\n warned.add(message);\n console.warn(`[ui-kit] ${message}`);\n}\n\n/**\n * `text` with every `{ref:key}` replaced by a link to `#key` that reads the section's\n * number — the words around it stay the app's (\"see section {ref:retention}\", \"siehe\n * Abschnitt {ref:retention}\"), so each language keeps its grammar (§4.1). On the imprint,\n * which is not numbered, the link reads the section's heading instead.\n *\n * Outside a {@link LegalPage} the text is returned as it is: there is no order to count.\n * A key the page has no section for stays visible as the raw token — a broken reference\n * an app test can find (`not.toHaveTextContent(\"{ref:\")`), not a silently wrong number.\n */\nexport function resolveLegalRefs(text: string, page: LegalPageContextValue | null): ReactNode {\n if (!page || !text.includes(\"{ref:\")) return text;\n const out: ReactNode[] = [];\n let last = 0;\n for (const match of text.matchAll(REF_TOKEN)) {\n const at = match.index ?? 0;\n if (at > last) out.push(text.slice(last, at));\n const key = match[1];\n const target = page.targets.get(key);\n if (target) {\n out.push(\n <TextLink key={`${key}@${at}`} href={`#${key}`}>\n {target.number ?? target.heading}\n </TextLink>,\n );\n } else {\n warnLegalOnce(`{ref:${key}} on the ${page.page} page points at no section of it.`);\n out.push(match[0]);\n }\n last = at + match[0].length;\n }\n if (last < text.length) out.push(text.slice(last));\n return out;\n}\n\n/** @internal Running text — one translation string — with its line breaks kept and its\n * `{ref:key}` tokens resolved. */\nexport function LegalText({ text, className }: { text: string; className?: string }) {\n const page = useContext(LegalPageContext);\n // `break-words`: an address, an email or a URL in a translation is one long word, and\n // on a 390px phone it would push the column wider than the screen.\n return <p className={cn(\"whitespace-pre-line break-words\", className)}>{resolveLegalRefs(text, page)}</p>;\n}\n\n// ── Links ─────────────────────────────────────────────────────────────────────\n\nexport interface LegalLink {\n href: string;\n /** \"Imprint\", \"Privacy Policy\", \"Terms\". */\n label: ReactNode;\n}\n\nexport interface LegalLinksProps {\n /** Default (0.28): the three routes, `/impressum`, `/privacy` and `/terms`, with the\n * kit's short link labels (`legal.links`), in the contract's order. */\n links?: readonly LegalLink[];\n /**\n * 0.51.4: the app's security page — a \"Security\" link after the others, with the kit's\n * label (`legal.links.security`). Left out, no link: only an app that has the page\n * names its route.\n */\n securityHref?: string;\n /** 0.51.4: the app's accessibility statement — \"Accessibility\", last. As\n * `securityHref`. */\n accessibilityHref?: string;\n /** The page being shown; its link is marked `aria-current=\"page\"`. Usually the\n * router's pathname. */\n currentHref?: string;\n /** `false` renders the links without the `<nav>` landmark — inside `AuthLayout`'s\n * `footer` or `TopBarActionMenu`'s `footer`, which are named `<nav>`s already. The row\n * keeps its spacing and `className` either way (0.27.1: it used to return the bare\n * links, so in a plain container — Kurvenschmiede's account-menu `<li>` — they ran\n * together as \"ImpressumDatenschutzerklärungNutz…\" and overflowed). Default true. */\n nav?: boolean;\n /** Called on a click on any of the links, before it navigates — an account menu closes\n * itself here (0.28.1, keksdose: it had to catch the click on a wrapping `<div>`). */\n onLinkClick?: (event: MouseEvent<HTMLAnchorElement>) => void;\n labels?: LabelOverride<LegalLabels>;\n className?: string;\n}\n\n/** The default links: the three routes under the kit's short labels. */\nfunction defaultLinks(labels: LegalLabels): LegalLink[] {\n return ([\"impressum\", \"privacy\", \"terms\"] as const).map((page) => ({\n href: LEGAL_HREFS[page],\n label: labels.links[page],\n }));\n}\n\n/** The optional pages after them, each only where the app named its route. */\nfunction infoLinks(labels: LegalLabels, hrefs: Partial<Record<LegalInfoPageKey, string>>): LegalLink[] {\n return ([\"security\", \"accessibility\"] as const).flatMap((page) => {\n const href = hrefs[page];\n return href ? [{ href, label: labels.links[page] ?? DEFAULT_LEGAL_LABELS.links[page] }] : [];\n });\n}\n\n/**\n * The legal pages as a row of quiet links, the one you are on marked (kastlan's\n * `LegalLinks`). Wraps on a phone.\n *\n * 0.28: `·` separators between the links, keksdose's footer style, wherever the links\n * appear — the account menu included (§3.3). The dots are `aria-hidden`: a screen reader\n * already hears three links, and \"middle dot\" between them is noise. They are flex items\n * of the row like the links, so the row's gap spaces them evenly.\n */\nexport function LegalLinks({\n links,\n securityHref,\n accessibilityHref,\n currentHref,\n nav = true,\n onLinkClick,\n labels: labelsProp,\n className,\n}: LegalLinksProps) {\n const labels = useLegalLabels(labelsProp);\n const shown = [\n ...(links ?? defaultLinks(labels)),\n ...infoLinks(labels, { security: securityHref, accessibility: accessibilityHref }),\n ];\n const items = shown.flatMap((link, i) => [\n ...(i > 0 ? [<span key={`sep-${link.href}`} aria-hidden=\"true\">·</span>] : []),\n <TextLink key={link.href} href={link.href} tone=\"muted\" current={link.href === currentHref} onClick={onLinkClick}>\n {link.label}\n </TextLink>,\n ]);\n const rowClass = cn(\"flex flex-wrap items-center gap-x-4 gap-y-1 text-xs\", className);\n if (!nav) return <div className={rowClass}>{items}</div>;\n return (\n <nav aria-label={labels.navLabel} className={rowClass}>\n {items}\n </nav>\n );\n}\n\n// ── Footer ────────────────────────────────────────────────────────────────────\n\nexport interface LegalFooterProps {\n /** Under the links, centred — the app's tagline (keksdose: \"Self-hosted household\n * budgeting & bookkeeping.\"). */\n children?: ReactNode;\n /** Default: the three routes with the kit's link labels — see {@link LegalLinks}. */\n links?: readonly LegalLink[];\n /** 0.51.4: \"Security\" after the others — see {@link LegalLinksProps.securityHref}. */\n securityHref?: string;\n /** 0.51.4: \"Accessibility\", last — see {@link LegalLinksProps.accessibilityHref}. */\n accessibilityHref?: string;\n /** Marks that link `aria-current=\"page\"`. {@link LegalPage}'s default footer passes\n * its own page. */\n currentHref?: string;\n /**\n * Default true: the footer is a `<footer>`. `false` draws a `<div>` — for a host that is\n * a footer already: `AuthLayout`'s `footer` slot is one, and HTML forbids a footer inside\n * a footer (0.28.1, kastlan). On an `AuthLayout` page the usual choice is simpler still:\n * `footer={<LegalLinks nav={false} />}` with `footerLabel` set to the kit's `navLabel`\n * ({@link useLegalLabels}).\n */\n landmark?: boolean;\n className?: string;\n labels?: LabelOverride<LegalLabels>;\n}\n\n/**\n * The public footer (§3.3): the three links, centred, with their separators, in a\n * `<nav aria-label=\"Legal\">` — on the landing or home page, every signed-out page the app\n * has, the legal pages and the 404. The rule behind it: from every page a signed-out\n * visitor can reach, the three links are one click away.\n *\n * keksdose's `SiteFooter` (features/landing/site-footer.tsx), which carried them on its\n * landing, auth, legal and 404 pages; kastlan and Kurvenschmiede had them on some pages\n * only. Its palette classes (`border-slate-200 bg-white dark:…`) became the surface and\n * border tokens, so it follows the theme like the rest of the kit.\n *\n * 0.51.4: an app with a security page or an accessibility statement passes their routes\n * (`securityHref`, `accessibilityHref`) and the row goes on with \"Security · Accessibility\"\n * in the kit's words, so the footer reads the same in every app that has them.\n */\nexport function LegalFooter({\n children,\n links,\n securityHref,\n accessibilityHref,\n currentHref,\n landmark = true,\n className,\n labels,\n}: LegalFooterProps) {\n const Root = landmark ? \"footer\" : \"div\";\n return (\n <Root className={cn(\"border-t border-subtle bg-surface\", className)}>\n <div className=\"mx-auto max-w-5xl px-4 py-8 text-sm text-muted\">\n <LegalLinks\n links={links}\n securityHref={securityHref}\n accessibilityHref={accessibilityHref}\n currentHref={currentHref}\n labels={labels}\n className=\"justify-center gap-y-2 text-sm\"\n />\n {children !== undefined && children !== null && <p className=\"mt-4 text-center\">{children}</p>}\n </div>\n </Root>\n );\n}\n\n// ── Section ───────────────────────────────────────────────────────────────────\n\nexport interface LegalSectionProps {\n heading: ReactNode;\n /** Running text. Line breaks in it are kept (`white-space: pre-line`), so a\n * translation can hold an address or a list as plain lines. Inside a\n * {@link LegalPage}, `{ref:key}` becomes the number of section `key`, linked. */\n body?: string;\n /** Anything richer than plain text — links, a list — after `body`. A plain string\n * here has its `{ref:key}` tokens resolved too. */\n children?: ReactNode;\n /**\n * The section's `id`, for a link to it from elsewhere. Inside a {@link LegalPage} it\n * defaults to the element's React `key` — keksdose's\n * `SECTIONS.map((s) => <LegalSection key={s} … />)` gets `id=\"retention\"` with\n * nothing added — and it is the key a `{ref:…}` names.\n */\n id?: string;\n /** The heading's element. Default `h2` under the layout's `h1` (inside a\n * `LegalPage`, one level below its title). */\n headingAs?: \"h2\" | \"h3\";\n}\n\n/**\n * One section: heading and running text.\n *\n * 0.28, inside a {@link LegalPage}: its `id` (the `key` unless given), its number on the\n * privacy policy and the terms (\"3. Legal basis\" — titles carry no number, §4.1), and\n * `{ref:key}` resolution in `body`. Outside one it is exactly the 0.19 section.\n */\nexport function LegalSection({ heading, body, children, id: idProp, headingAs }: LegalSectionProps) {\n const page = useContext(LegalPageContext);\n const slot = useContext(LegalSlotContext);\n const id = idProp ?? slot?.id;\n const number = slot?.number;\n const Heading = headingAs ?? page?.sectionHeading ?? \"h2\";\n return (\n <section id={id} className=\"scroll-mt-20\">\n <Heading className=\"text-lg font-semibold break-words text-primary\">\n {number !== undefined && `${number}. `}\n {heading}\n </Heading>\n <LegalSlotContext.Provider value={null}>\n {body !== undefined && (\n <LegalText text={body} className=\"mt-2 text-sm leading-relaxed text-secondary\" />\n )}\n {children !== undefined && (\n <div className=\"mt-2 text-sm leading-relaxed break-words text-secondary\">\n {typeof children === \"string\" ? resolveLegalRefs(children, page) : children}\n </div>\n )}\n </LegalSlotContext.Provider>\n </section>\n );\n}\n\n// ── Layout ────────────────────────────────────────────────────────────────────\n\nexport interface LegalLayoutProps {\n /** \"Imprint\", \"Privacy Policy\", \"Terms\". */\n title: ReactNode;\n /** Above the title — the app's \"← Back\" link (`<TextLink icon={ArrowLeft}>`). Inside\n * a {@link LegalPage}, \"← Back to home\". */\n back?: ReactNode;\n /**\n * A notice under the title, as a warning banner with `role=\"note\"` — page furniture,\n * not an alert. Per page, not per layout: the privacy page says something more precise\n * than the others (its technical sections describe running code).\n */\n notice?: ReactNode;\n /** 0.51.3: right under the title — {@link LegalPage}'s \"Last updated: …\" line. */\n updated?: ReactNode;\n /** 0.28.1: under the title, before the notice — {@link LegalPage}'s note that this\n * page is a translation and which language is binding. */\n translationNote?: ReactNode;\n /** 0.51.4: before the sections — {@link LegalPage}'s plain-language summary. */\n summary?: ReactNode;\n /** The sections — {@link LegalSection}s. */\n children: ReactNode;\n /** The three pages, linked at the end of the column with the current one marked.\n * Leave out when the page's chrome already shows them (a {@link LegalFooter}). */\n links?: readonly LegalLink[];\n currentHref?: string;\n /** Default `h1`: the page's heading. */\n headingAs?: \"h1\" | \"h2\";\n /** Extra classes on the column — `px-0 py-0` inside a chrome that pads already. */\n className?: string;\n labels?: LabelOverride<LegalLabels>;\n}\n\nexport function LegalLayout({\n title,\n back,\n notice,\n updated,\n translationNote,\n summary,\n children,\n links,\n currentHref,\n headingAs: Heading = \"h1\",\n className,\n labels,\n}: LegalLayoutProps) {\n return (\n <article className={cn(\"mx-auto w-full max-w-3xl px-4 py-12\", className)}>\n {back !== undefined && <div className=\"mb-4 text-sm\">{back}</div>}\n <Heading className=\"text-3xl font-bold tracking-tight break-words text-primary\">{title}</Heading>\n {updated !== undefined && updated !== null && <p className=\"mt-2 text-sm text-muted\">{updated}</p>}\n {translationNote !== undefined && translationNote !== null && <div className=\"mt-3\">{translationNote}</div>}\n {notice !== undefined && notice !== null && (\n <AlertBanner tone=\"warning\" role=\"note\" className=\"mt-4\">\n {notice}\n </AlertBanner>\n )}\n <div className=\"mt-8 space-y-8\">\n {summary}\n {children}\n </div>\n {links !== undefined && links.length > 0 && (\n <LegalLinks links={links} currentHref={currentHref} labels={labels} className=\"mt-12 border-t border-subtle pt-4\" />\n )}\n </article>\n );\n}\n"],"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