@eifi1/ui-kit 0.28.0 → 0.28.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/README.md +3 -3
  2. package/dist/chart.d.ts +1 -1
  3. package/dist/components/amount-input.d.ts +1 -1
  4. package/dist/components/button-group.d.ts +1 -1
  5. package/dist/components/calculator.d.ts +1 -1
  6. package/dist/components/confirm-dialog.d.ts +1 -1
  7. package/dist/components/copy-button.d.ts +1 -1
  8. package/dist/components/danger-confirm.d.ts +1 -1
  9. package/dist/components/facing-pair.d.ts +1 -1
  10. package/dist/components/file-button.d.ts +1 -1
  11. package/dist/components/file-dropzone.d.ts +1 -1
  12. package/dist/components/form-actions.d.ts +1 -1
  13. package/dist/components/iban-input.d.ts +1 -1
  14. package/dist/components/language-select.d.ts +1 -1
  15. package/dist/components/legal-page.d.ts +9 -3
  16. package/dist/components/legal-page.js +24 -5
  17. package/dist/components/legal-page.js.map +1 -1
  18. package/dist/components/legal.d.ts +1 -1
  19. package/dist/components/legal.js +49 -5
  20. package/dist/components/legal.js.map +1 -1
  21. package/dist/components/money-field.d.ts +1 -1
  22. package/dist/components/number-field.d.ts +1 -1
  23. package/dist/components/number-input.d.ts +1 -1
  24. package/dist/components/numpad-sheet.d.ts +1 -1
  25. package/dist/components/phone-input.d.ts +1 -1
  26. package/dist/components/series-chart.d.ts +1 -1
  27. package/dist/components/settings-fields.d.ts +1 -1
  28. package/dist/components/share-card.d.ts +1 -1
  29. package/dist/components/text-link.d.ts +1 -1
  30. package/dist/components/time-input.d.ts +1 -1
  31. package/dist/components/ui.d.ts +1 -1
  32. package/dist/feedback/feedback-attachment.d.ts +1 -1
  33. package/dist/feedback/feedback-context.d.ts +1 -1
  34. package/dist/feedback/feedback-crash.d.ts +1 -1
  35. package/dist/feedback/feedback-dialog.d.ts +1 -1
  36. package/dist/feedback/feedback-inbox.d.ts +1 -1
  37. package/dist/feedback/feedback-labels.d.ts +1 -1
  38. package/dist/feedback/feedback-menu.d.ts +1 -1
  39. package/dist/feedback/feedback-record.d.ts +1 -1
  40. package/dist/feedback/feedback-row-detail.d.ts +1 -1
  41. package/dist/feedback/feedback-status-undo.d.ts +1 -1
  42. package/dist/feedback/feedback-submit.d.ts +1 -1
  43. package/dist/feedback/feedback-swipe.d.ts +1 -1
  44. package/dist/feedback/feedback-table.d.ts +1 -1
  45. package/dist/feedback/feedback-thread.d.ts +1 -1
  46. package/dist/feedback.d.ts +1 -1
  47. package/dist/hooks/use-file-drop.d.ts +1 -1
  48. package/dist/i18n/defaults.d.ts +1 -1
  49. package/dist/i18n/german.d.ts +1 -1
  50. package/dist/i18n/german.js +8 -0
  51. package/dist/i18n/german.js.map +1 -1
  52. package/dist/i18n/kit-labels.d.ts +1 -1
  53. package/dist/i18n/languages.d.ts +1 -1
  54. package/dist/i18n/locales/de-CH.d.ts +1 -1
  55. package/dist/i18n/locales/en.d.ts +1 -1
  56. package/dist/i18n/locales/es.d.ts +1 -1
  57. package/dist/i18n/locales/es.js +11 -3
  58. package/dist/i18n/locales/es.js.map +1 -1
  59. package/dist/i18n/locales/fr.d.ts +1 -1
  60. package/dist/i18n/locales/fr.js +8 -0
  61. package/dist/i18n/locales/fr.js.map +1 -1
  62. package/dist/i18n/locales/hu.d.ts +1 -1
  63. package/dist/i18n/locales/hu.js +11 -3
  64. package/dist/i18n/locales/hu.js.map +1 -1
  65. package/dist/i18n/locales/it.d.ts +1 -1
  66. package/dist/i18n/locales/it.js +9 -1
  67. package/dist/i18n/locales/it.js.map +1 -1
  68. package/dist/i18n/locales/zh.d.ts +1 -1
  69. package/dist/i18n/locales/zh.js +9 -1
  70. package/dist/i18n/locales/zh.js.map +1 -1
  71. package/dist/i18n/review.d.ts +1 -1
  72. package/dist/i18n/review.js +9 -7
  73. package/dist/i18n/review.js.map +1 -1
  74. package/dist/index.d.ts +1 -1
  75. package/dist/index.js +13 -1
  76. package/dist/index.js.map +1 -1
  77. package/dist/{kit-labels-SBN0biPl.d.ts → kit-labels-Du0uHBq4.d.ts} +41 -5
  78. package/dist/rhf/fields.d.ts +1 -1
  79. package/dist/rhf/form.d.ts +1 -1
  80. package/dist/rhf.d.ts +1 -1
  81. package/dist/shell/app-shell.d.ts +1 -1
  82. package/dist/shell/top-bar-brand.d.ts +1 -1
  83. package/dist/shell.d.ts +1 -1
  84. package/dist/wizard/stepper-nav.d.ts +1 -1
  85. package/dist/wizard.d.ts +1 -1
  86. package/package.json +1 -1
  87. package/src/components/legal-page.tsx +35 -0
  88. package/src/components/legal.tsx +93 -7
  89. package/src/i18n/german.ts +10 -0
  90. package/src/i18n/locales/es.ts +13 -3
  91. package/src/i18n/locales/fr.ts +10 -0
  92. package/src/i18n/locales/hu.ts +13 -3
  93. package/src/i18n/locales/it.ts +11 -1
  94. package/src/i18n/locales/zh.ts +11 -1
  95. package/src/i18n/review.ts +7 -6
  96. package/src/index.ts +10 -1
package/README.md CHANGED
@@ -382,14 +382,14 @@ columns, strings and permissions (see the note at the top of `src/feedback/feedb
382
382
 
383
383
  <!-- BEGIN GENERATED: exports — node scripts/gen-export-inventory.mjs -->
384
384
 
385
- **1414 names from 206 modules** — 665 values and 749 types. _Italic_ is a type-only export.
385
+ **1417 names from 206 modules** — 668 values and 749 types. _Italic_ is a type-only export.
386
386
 
387
387
  Generated from `dist/index.d.ts` by `node scripts/gen-export-inventory.mjs`; the count
388
388
  is pinned by `src/__tests__/public-surface.test.ts`. Do not edit between the markers.
389
389
 
390
390
  | Entry point | Names |
391
391
  |---|---|
392
- | `@eifi1/ui-kit` | 1414 |
392
+ | `@eifi1/ui-kit` | 1417 |
393
393
  | `@eifi1/ui-kit/chart` | 104 |
394
394
  | `@eifi1/ui-kit/shell` | 24 |
395
395
  | `@eifi1/ui-kit/data-table` | 51 |
@@ -478,7 +478,7 @@ re-slicing of it, never a second API.
478
478
  | `components/file-button` | `DEFAULT_FILE_PICKER_LABELS`, `FileButton`, `matchesAccept`, `useFilePicker`, _`FileButtonProps`_, _`FilePickerLabels`_, _`FileRejection`_, _`FileRejectionReason`_, _`FileScreenOptions`_, _`UseFilePickerOptions`_, _`UseFilePickerReturn`_ |
479
479
  | `components/form-actions` | `DEFAULT_FORM_ACTIONS_LABELS`, `FormActions`, _`FormActionsAlign`_, _`FormActionsDestructive`_, _`FormActionsLabels`_, _`FormActionsPlacement`_, _`FormActionsProps`_, _`FormActionsStickyWithin`_, _`FormActionsSubmitProps`_, _`FormActionsSubmitShortcut`_, _`ResponsiveFormActionsPlacement`_ |
480
480
  | `components/iban-input` | `DEFAULT_IBAN_INPUT_LABELS`, `IbanInput`, _`IbanInputLabels`_, _`IbanInputProps`_ |
481
- | `components/legal` | `DEFAULT_LEGAL_LABELS`, `LegalFooter`, `LegalLayout`, `LegalLinks`, `LegalSection`, _`LegalFooterProps`_, _`LegalFramedSectionLabels`_, _`LegalLabels`_, _`LegalLayoutProps`_, _`LegalLink`_, _`LegalLinksProps`_, _`LegalOperator`_, _`LegalOperatorSectionLabels`_, _`LegalOperatorText`_, _`LegalPageKey`_, _`LegalSectionProps`_, _`LegalTextSectionLabels`_ |
481
+ | `components/legal` | `DEFAULT_LEGAL_LABELS`, `LEGAL_HREFS`, `LegalFooter`, `LegalLayout`, `LegalLinks`, `legalOperatorText`, `LegalSection`, `useLegalLabels`, _`LegalFooterProps`_, _`LegalFramedSectionLabels`_, _`LegalLabels`_, _`LegalLayoutProps`_, _`LegalLink`_, _`LegalLinksProps`_, _`LegalOperator`_, _`LegalOperatorSectionLabels`_, _`LegalOperatorText`_, _`LegalPageKey`_, _`LegalSectionProps`_, _`LegalTextSectionLabels`_ |
482
482
  | `components/phone-input` | `DEFAULT_PHONE_INPUT_LABELS`, `PhoneInput`, _`PhoneInputLabels`_, _`PhoneInputProps`_ |
483
483
  | `components/share-card` | `DEFAULT_SHARE_CARD_LABELS`, `ShareCard`, `ShareDialog`, `SharePanel`, _`ShareAddRequest`_, _`ShareCandidate`_, _`ShareCardLabels`_, _`ShareCardProps`_, _`ShareDialogProps`_, _`ShareGrantee`_, _`SharePanelProps`_, _`SharePendingGrant`_, _`ShareRole`_ |
484
484
  | `components/field` | `Field`, _`FieldControlProps`_, _`FieldLabelVisibility`_, _`FieldProps`_, _`FieldRenderMeta`_ |
package/dist/chart.d.ts CHANGED
@@ -13,7 +13,7 @@ export { TimeTickUnit } from './components/series-chart-ticks.js';
13
13
  import 'recharts';
14
14
  import 'react';
15
15
  import './lib/direction.js';
16
- import './kit-labels-SBN0biPl.js';
16
+ import './kit-labels-Du0uHBq4.js';
17
17
  import './data-table-labels-DUELeXpa.js';
18
18
  import './components/data-table-sort.js';
19
19
  import './components/swipeable-row.js';
@@ -2,7 +2,7 @@ import * as react from 'react';
2
2
  import { ReactNode } from 'react';
3
3
  import { CalculatorButtonLabels } from './calculator.js';
4
4
  import { NumberPadSheetLabels } from './numpad-sheet.js';
5
- import '../kit-labels-SBN0biPl.js';
5
+ import '../kit-labels-Du0uHBq4.js';
6
6
  import '../data-table-labels-DUELeXpa.js';
7
7
  import './data-table-sort.js';
8
8
  import './swipeable-row.js';
@@ -1,6 +1,6 @@
1
1
  import * as react from 'react';
2
2
  import { ComponentPropsWithoutRef, ReactNode, Ref, MouseEvent, ReactElement } from 'react';
3
- import { bA as ButtonVariant, by as ButtonSize } from '../kit-labels-SBN0biPl.js';
3
+ import { bA as ButtonVariant, by as ButtonSize } from '../kit-labels-Du0uHBq4.js';
4
4
  import '../data-table-labels-DUELeXpa.js';
5
5
  import './data-table-sort.js';
6
6
  import './swipeable-row.js';
@@ -1,5 +1,5 @@
1
1
  import * as react from 'react';
2
- import { bB as CalculatorLabels } from '../kit-labels-SBN0biPl.js';
2
+ import { bB as CalculatorLabels } from '../kit-labels-Du0uHBq4.js';
3
3
  import '../data-table-labels-DUELeXpa.js';
4
4
  import './data-table-sort.js';
5
5
  import './swipeable-row.js';
@@ -1,5 +1,5 @@
1
1
  import 'react';
2
- export { bX as ConfirmDialogLabels, bY as ConfirmFn, bZ as ConfirmOptions, b_ as ConfirmProvider, b$ as ConfirmProviderProps, c0 as ConfirmTone, cd as DEFAULT_CONFIRM_DIALOG_LABELS, eq as useConfirm } from '../kit-labels-SBN0biPl.js';
2
+ export { bX as ConfirmDialogLabels, bY as ConfirmFn, bZ as ConfirmOptions, b_ as ConfirmProvider, b$ as ConfirmProviderProps, c0 as ConfirmTone, cd as DEFAULT_CONFIRM_DIALOG_LABELS, es as useConfirm } from '../kit-labels-Du0uHBq4.js';
3
3
  import '../data-table-labels-DUELeXpa.js';
4
4
  import './data-table-sort.js';
5
5
  import './swipeable-row.js';
@@ -1,5 +1,5 @@
1
1
  import 'react';
2
- export { c1 as CopyButton, c2 as CopyButtonLabels, c3 as CopyButtonProps, ce as DEFAULT_COPY_BUTTON_LABELS } from '../kit-labels-SBN0biPl.js';
2
+ export { c1 as CopyButton, c2 as CopyButtonLabels, c3 as CopyButtonProps, ce as DEFAULT_COPY_BUTTON_LABELS } from '../kit-labels-Du0uHBq4.js';
3
3
  import './tooltip.js';
4
4
  import '../data-table-labels-DUELeXpa.js';
5
5
  import './data-table-sort.js';
@@ -1,5 +1,5 @@
1
1
  import 'react';
2
- export { c5 as CurrentPasswordInput, c6 as CurrentPasswordInputLabels, c7 as CurrentPasswordInputProps, cg as DEFAULT_DANGER_CONFIRM_LABELS, cv as DangerConfirm, cw as DangerConfirmLabels, cx as DangerConfirmProps, cy as DangerConfirmValues, cz as DangerConsequence, ea as TypedConfirmField, eb as TypedConfirmFieldLabels, ec as TypedConfirmFieldProps, ed as TypedMatch, ep as typedMatches, eB as usePromisePending } from '../kit-labels-SBN0biPl.js';
2
+ export { c5 as CurrentPasswordInput, c6 as CurrentPasswordInputLabels, c7 as CurrentPasswordInputProps, cg as DEFAULT_DANGER_CONFIRM_LABELS, cv as DangerConfirm, cw as DangerConfirmLabels, cx as DangerConfirmProps, cy as DangerConfirmValues, cz as DangerConsequence, eb as TypedConfirmField, ec as TypedConfirmFieldLabels, ed as TypedConfirmFieldProps, ee as TypedMatch, er as typedMatches, eE as usePromisePending } from '../kit-labels-Du0uHBq4.js';
3
3
  import '../data-table-labels-DUELeXpa.js';
4
4
  import './data-table-sort.js';
5
5
  import './swipeable-row.js';
@@ -6,7 +6,7 @@ import './series-chart-labels.js';
6
6
  import './toggle-legend.js';
7
7
  import './series-chart-ticks.js';
8
8
  import './series-chart-budget.js';
9
- import '../kit-labels-SBN0biPl.js';
9
+ import '../kit-labels-Du0uHBq4.js';
10
10
  import '../data-table-labels-DUELeXpa.js';
11
11
  import './data-table-sort.js';
12
12
  import './swipeable-row.js';
@@ -1,5 +1,5 @@
1
1
  import 'react';
2
- export { cj as DEFAULT_FILE_PICKER_LABELS, cP as FileButton, cQ as FileButtonProps, eA as FilePickHandler, cS as FilePickerLabels, cT as FileRejection, cU as FileRejectionReason, cV as FileScreenOptions, ei as UseFilePickerOptions, ej as UseFilePickerReturn, eC as formatAccept, eD as judgePick, em as matchesAccept, eE as screenFiles, eF as summariseRejections, er as useFilePicker } from '../kit-labels-SBN0biPl.js';
2
+ export { cj as DEFAULT_FILE_PICKER_LABELS, cP as FileButton, cQ as FileButtonProps, eD as FilePickHandler, cS as FilePickerLabels, cT as FileRejection, cU as FileRejectionReason, cV as FileScreenOptions, ej as UseFilePickerOptions, ek as UseFilePickerReturn, eF as formatAccept, eG as judgePick, eo as matchesAccept, eH as screenFiles, eI as summariseRejections, et as useFilePicker } from '../kit-labels-Du0uHBq4.js';
3
3
  import '../data-table-labels-DUELeXpa.js';
4
4
  import './data-table-sort.js';
5
5
  import './swipeable-row.js';
@@ -1,6 +1,6 @@
1
1
  import * as react from 'react';
2
2
  import { ComponentPropsWithoutRef, ReactNode } from 'react';
3
- import { cT as FileRejection, eA as FilePickHandler, cS as FilePickerLabels } from '../kit-labels-SBN0biPl.js';
3
+ import { cT as FileRejection, eD as FilePickHandler, cS as FilePickerLabels } from '../kit-labels-Du0uHBq4.js';
4
4
  import '../data-table-labels-DUELeXpa.js';
5
5
  import './data-table-sort.js';
6
6
  import './swipeable-row.js';
@@ -1,6 +1,6 @@
1
1
  import 'react';
2
2
  import 'lucide-react';
3
- export { ck as DEFAULT_FORM_ACTIONS_LABELS, cY as FormActions, cZ as FormActionsAlign, c_ as FormActionsDestructive, c$ as FormActionsLabels, d0 as FormActionsPlacement, d1 as FormActionsProps, d2 as FormActionsStickyWithin, d3 as FormActionsSubmitProps, d4 as FormActionsSubmitShortcut, dN as ResponsiveFormActionsPlacement } from '../kit-labels-SBN0biPl.js';
3
+ export { ck as DEFAULT_FORM_ACTIONS_LABELS, cY as FormActions, cZ as FormActionsAlign, c_ as FormActionsDestructive, c$ as FormActionsLabels, d0 as FormActionsPlacement, d1 as FormActionsProps, d2 as FormActionsStickyWithin, d3 as FormActionsSubmitProps, d4 as FormActionsSubmitShortcut, dO as ResponsiveFormActionsPlacement } from '../kit-labels-Du0uHBq4.js';
4
4
  import '../data-table-labels-DUELeXpa.js';
5
5
  import './data-table-sort.js';
6
6
  import './swipeable-row.js';
@@ -1,6 +1,6 @@
1
1
  import 'react';
2
2
  import '../lib/iban.js';
3
- export { cl as DEFAULT_IBAN_INPUT_LABELS, d5 as IbanInput, d6 as IbanInputLabels, d7 as IbanInputProps } from '../kit-labels-SBN0biPl.js';
3
+ export { cl as DEFAULT_IBAN_INPUT_LABELS, d5 as IbanInput, d6 as IbanInputLabels, d7 as IbanInputProps } from '../kit-labels-Du0uHBq4.js';
4
4
  import '../data-table-labels-DUELeXpa.js';
5
5
  import './data-table-sort.js';
6
6
  import './swipeable-row.js';
@@ -1,6 +1,6 @@
1
1
  import * as react from 'react';
2
2
  import { KitLanguageCode, KitLanguage } from '../i18n/languages.js';
3
- import { dP as SelectProps } from '../kit-labels-SBN0biPl.js';
3
+ import { dQ as SelectProps } from '../kit-labels-Du0uHBq4.js';
4
4
  import '../shell/topbar-controls.js';
5
5
  import '../theme/palette-presets.js';
6
6
  import '../theme/chart-palette.js';
@@ -1,6 +1,6 @@
1
1
  import * as react from 'react';
2
2
  import { Ref, ReactNode } from 'react';
3
- import { dC as LegalPageKey, dn as LabelOverride, dt as LegalLabels, dz as LegalOperator } from '../kit-labels-SBN0biPl.js';
3
+ import { dD as LegalPageKey, dp as LabelOverride, du as LegalLabels, dA as LegalOperator } from '../kit-labels-Du0uHBq4.js';
4
4
  import { CheckboxProps } from './checkbox.js';
5
5
  import '../data-table-labels-DUELeXpa.js';
6
6
  import './data-table-sort.js';
@@ -107,7 +107,7 @@ interface LegalSkeletonPage {
107
107
  declare const LEGAL_SKELETON: Readonly<Record<LegalPageKey, LegalSkeletonPage>>;
108
108
  /** The sections the kit writes (§4.3), on whichever page they sit. `contact` is on two
109
109
  * pages, with two texts; the page decides which. */
110
- type LegalKitSectionKey = "operator" | "contact" | "disclaimer" | "controller" | "legal_basis" | "browser" | "rights" | "warranty" | "liability" | "changes" | "law";
110
+ type LegalKitSectionKey = "operator" | "contact" | "disclaimer" | "controller" | "legal_basis" | "browser" | "rights" | "warranty" | "liability" | "changes" | "language" | "law";
111
111
  interface LegalKitSectionBase {
112
112
  /** Default: the enclosing {@link LegalPage}'s page — needed outside one, and for
113
113
  * `contact` only (it is on two pages). */
@@ -191,6 +191,12 @@ interface LegalPageProps {
191
191
  /** Default: the kit's beta notice on the imprint and the terms, its privacy notice on
192
192
  * the privacy policy (§3.2). `null` for none. */
193
193
  notice?: ReactNode;
194
+ /**
195
+ * 0.28.1: switches the app to the operator's `bindingLanguage` — the button after the
196
+ * translation note on a page read in another language. Without it the note stands
197
+ * alone; the app's own language switcher is in its header anyway.
198
+ */
199
+ onShowBindingLanguage?: () => void;
194
200
  /** The language the operator's country is named in. Default: the `<UiKitProvider
195
201
  * locale>`, else English. */
196
202
  locale?: string;
@@ -231,7 +237,7 @@ interface LegalPageProps {
231
237
  * (see `children` for what that asks of the tree);
232
238
  * - `useNoIndex()`.
233
239
  */
234
- declare function LegalPage({ page, operator, children, header, footer, homeHref, notice, locale: localeProp, headingAs, landmark, noIndex, className, labels: labelsProp, }: LegalPageProps): react.JSX.Element;
240
+ declare function LegalPage({ page, operator, children, header, footer, homeHref, notice, onShowBindingLanguage, locale: localeProp, headingAs, landmark, noIndex, className, labels: labelsProp, }: LegalPageProps): react.JSX.Element;
235
241
  interface LegalAcceptCheckboxProps extends Omit<CheckboxProps, "label" | "checked" | "onCheckedChange" | "required"> {
236
242
  checked: boolean;
237
243
  onCheckedChange: (checked: boolean) => void;
@@ -1,6 +1,6 @@
1
1
  "use client";
2
- import { jsx, jsxs } from "react/jsx-runtime";
3
- import { Fragment, isValidElement, useContext, useMemo } from "react";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
+ import { Fragment as Fragment2, isValidElement, useContext, useMemo } from "react";
4
4
  import { ArrowLeft } from "lucide-react";
5
5
  import { UiKitProvider, useKitLocale } from "../i18n/kit-labels.js";
6
6
  import { useNoIndex } from "../hooks/use-noindex.js";
@@ -8,6 +8,7 @@ import { cn } from "../lib/cn.js";
8
8
  import { Checkbox } from "./checkbox.js";
9
9
  import {
10
10
  LEGAL_HREFS,
11
+ baseLanguage,
11
12
  LegalFooter,
12
13
  LegalLayout,
13
14
  LegalPageContext,
@@ -19,6 +20,7 @@ import {
19
20
  warnLegalOnce
20
21
  } from "./legal.js";
21
22
  import { TextLink } from "./text-link.js";
23
+ import { Button } from "./ui.js";
22
24
  const LEGAL_SKELETON = Object.freeze({
23
25
  impressum: Object.freeze({
24
26
  numbered: false,
@@ -53,6 +55,8 @@ const LEGAL_SKELETON = Object.freeze({
53
55
  { key: "warranty", owner: "kit" },
54
56
  { key: "liability", owner: "kit" },
55
57
  { key: "changes", owner: "kit" },
58
+ // 0.28.1: which language's version prevails (the operator's `bindingLanguage`).
59
+ { key: "language", owner: "kit" },
56
60
  { key: "law", owner: "kit" }
57
61
  ])
58
62
  })
@@ -64,7 +68,7 @@ const PAGES = ["impressum", "privacy", "terms"];
64
68
  function appPart(children) {
65
69
  if (children === void 0 || children === null || children === false) return null;
66
70
  if (typeof children === "string") return /* @__PURE__ */ jsx(LegalText, { text: children }, "app");
67
- return /* @__PURE__ */ jsx(Fragment, { children }, "app");
71
+ return /* @__PURE__ */ jsx(Fragment2, { children }, "app");
68
72
  }
69
73
  function LegalKitSection(props) {
70
74
  const { section, headingAs, labels: labelsProp } = props;
@@ -87,6 +91,11 @@ function LegalKitSection(props) {
87
91
  `LegalKitSection "${section}" names the operator: render it inside <LegalPage operator={\u2026}>, or pass operator.`
88
92
  );
89
93
  }
94
+ if (section === "language" && !operator.bindingLanguage) {
95
+ throw new Error(
96
+ `LegalKitSection "language" names the binding language: give the operator a bindingLanguage ("de-CH").`
97
+ );
98
+ }
90
99
  return body(operator);
91
100
  };
92
101
  const app = appPart(props.children);
@@ -115,7 +124,7 @@ function onlyPageOf(section) {
115
124
  function flatten(node, path, out) {
116
125
  if (node === null || node === void 0 || typeof node === "boolean") return;
117
126
  if (isValidElement(node)) {
118
- if (node.type === Fragment) {
127
+ if (node.type === Fragment2) {
119
128
  flatten(node.props.children, path, out);
120
129
  } else {
121
130
  out.push({ node, path: path || "/" });
@@ -152,7 +161,7 @@ function slotSections(children, page, labels) {
152
161
  let count = 0;
153
162
  const nodes = flat.map(({ node, path }) => {
154
163
  const section = sectionOf(node, page, labels);
155
- if (!section) return /* @__PURE__ */ jsx(Fragment, { children: node }, path);
164
+ if (!section) return /* @__PURE__ */ jsx(Fragment2, { children: node }, path);
156
165
  count += 1;
157
166
  const number = numbered ? count : void 0;
158
167
  if (section.key !== void 0) {
@@ -174,6 +183,7 @@ function LegalPage({
174
183
  footer,
175
184
  homeHref = "/",
176
185
  notice,
186
+ onShowBindingLanguage,
177
187
  locale: localeProp,
178
188
  headingAs = "h1",
179
189
  landmark = true,
@@ -198,6 +208,14 @@ function LegalPage({
198
208
  };
199
209
  const Main = landmark ? "main" : "div";
200
210
  const shownNotice = notice !== void 0 ? notice : page === "privacy" ? labels.notice.privacy : labels.notice.beta;
211
+ const translated = operator.bindingLanguage !== void 0 && baseLanguage(operator.bindingLanguage) !== baseLanguage(locale);
212
+ const translationNote = translated ? /* @__PURE__ */ jsxs("p", { className: "text-sm text-[var(--text-secondary)]", children: [
213
+ labels.translation.note(operatorText),
214
+ onShowBindingLanguage && /* @__PURE__ */ jsxs(Fragment, { children: [
215
+ " ",
216
+ /* @__PURE__ */ jsx(Button, { type: "button", variant: "link", size: "sm", className: "h-auto p-0 align-baseline", onClick: onShowBindingLanguage, children: labels.translation.show(operatorText) })
217
+ ] })
218
+ ] }) : void 0;
201
219
  return /* @__PURE__ */ jsx(UiKitProvider, { labels: overrides, children: /* @__PURE__ */ jsxs("div", { className: cn("flex min-h-full flex-col", className), children: [
202
220
  header,
203
221
  /* @__PURE__ */ jsx(Main, { className: "flex-1", children: /* @__PURE__ */ jsx(LegalPageContext.Provider, { value: context, children: /* @__PURE__ */ jsx(
@@ -206,6 +224,7 @@ function LegalPage({
206
224
  back: /* @__PURE__ */ jsx(TextLink, { href: homeHref, icon: ArrowLeft, children: labels.backHome }),
207
225
  title: labels.titles[page],
208
226
  notice: shownNotice,
227
+ translationNote,
209
228
  headingAs,
210
229
  children: nodes
211
230
  }
@@ -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 LEGAL_HREFS,\n LegalFooter,\n LegalLayout,\n LegalPageContext,\n LegalSection,\n LegalSlotContext,\n LegalText,\n legalOperatorText,\n useLegalLabels,\n warnLegalOnce,\n} from \"./legal\";\nimport type {\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\";\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 { 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 | \"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 /** 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 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: Exclude<LegalKitSectionKey, \"browser\" | \"legal_basis\" | \"rights\">;\n entries?: never;\n children?: never;\n }\n );\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 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 parts = [<LegalText key=\"body\" text={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 /** 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 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\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 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":";AA0L2C,cAyRrC,YAzRqC;AA1L3C,SAAS,UAAU,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,OACK;AAaP,SAAS,gBAAgB;AAyClB,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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A,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":[]}
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 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 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 \"./ui\";\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 /** 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 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: Exclude<LegalKitSectionKey, \"browser\" | \"legal_basis\" | \"rights\">;\n entries?: never;\n children?: never;\n }\n );\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 parts = [<LegalText key=\"body\" text={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-[var(--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":";AA+L2C,SA0SnC,UA1SmC,KA0SnC,YA1SmC;AA/L3C,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,OACK;AAaP,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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ACnD;AAEJ;","names":["Fragment"]}
@@ -1,5 +1,5 @@
1
1
  import 'react';
2
- export { cm as DEFAULT_LEGAL_LABELS, eG as LEGAL_HREFS, dq as LegalFooter, dr as LegalFooterProps, ds as LegalFramedSectionLabels, dt as LegalLabels, du as LegalLayout, dv as LegalLayoutProps, dw as LegalLink, dx as LegalLinks, dy as LegalLinksProps, dz as LegalOperator, dA as LegalOperatorSectionLabels, dB as LegalOperatorText, eH as LegalPageContext, eI as LegalPageContextValue, dC as LegalPageKey, eJ as LegalRefTarget, dD as LegalSection, dE as LegalSectionProps, eK as LegalSectionSlot, eL as LegalSlotContext, eM as LegalText, dF as LegalTextSectionLabels, eN as legalOperatorText, eO as resolveLegalRefs, eP as useLegalLabels, eQ as warnLegalOnce } from '../kit-labels-SBN0biPl.js';
2
+ export { cm as DEFAULT_LEGAL_LABELS, dm as LEGAL_HREFS, dr as LegalFooter, ds as LegalFooterProps, dt as LegalFramedSectionLabels, du as LegalLabels, dv as LegalLayout, dw as LegalLayoutProps, dx as LegalLink, dy as LegalLinks, dz as LegalLinksProps, dA as LegalOperator, dB as LegalOperatorSectionLabels, dC as LegalOperatorText, eJ as LegalPageContext, eK as LegalPageContextValue, dD as LegalPageKey, eL as LegalRefTarget, dE as LegalSection, dF as LegalSectionProps, eM as LegalSectionSlot, eN as LegalSlotContext, eO as LegalText, dG as LegalTextSectionLabels, eP as baseLanguage, en as legalOperatorText, eQ as resolveLegalRefs, eC as useLegalLabels, eR as warnLegalOnce } from '../kit-labels-Du0uHBq4.js';
3
3
  import '../data-table-labels-DUELeXpa.js';
4
4
  import './data-table-sort.js';
5
5
  import './swipeable-row.js';
@@ -11,8 +11,33 @@ const LEGAL_HREFS = Object.freeze({
11
11
  privacy: "/privacy",
12
12
  terms: "/terms"
13
13
  });
14
+ function baseLanguage(code) {
15
+ return code.split(/[-_]/)[0].toLowerCase();
16
+ }
17
+ const languageNamers = /* @__PURE__ */ new Map();
18
+ function languageName(code, locale) {
19
+ let namer = languageNamers.get(locale);
20
+ if (namer === void 0) {
21
+ try {
22
+ namer = new Intl.DisplayNames([locale], { type: "language" });
23
+ } catch {
24
+ namer = null;
25
+ }
26
+ languageNamers.set(locale, namer);
27
+ }
28
+ const base = baseLanguage(code);
29
+ try {
30
+ return namer?.of(base) ?? base;
31
+ } catch {
32
+ return base;
33
+ }
34
+ }
14
35
  function legalOperatorText(operator, locale = "en") {
15
- return { ...operator, country: countryName(operator.country, locale) };
36
+ return {
37
+ ...operator,
38
+ country: countryName(operator.country, locale),
39
+ bindingLanguage: operator.bindingLanguage ? languageName(operator.bindingLanguage, locale) : ""
40
+ };
16
41
  }
17
42
  const DEFAULT_LEGAL_LABELS = {
18
43
  navLabel: "Legal",
@@ -32,6 +57,10 @@ const DEFAULT_LEGAL_LABELS = {
32
57
  beta: "Closed beta. These texts have not been reviewed by a lawyer yet and will be before a public launch.",
33
58
  privacy: "Closed beta. The legal wording below has not been reviewed by a lawyer yet and will be before a public launch. The technical descriptions \u2014 what is stored, where, and who can read it \u2014 describe what the software actually does today, and are meant to be checked against it."
34
59
  },
60
+ translation: {
61
+ note: (o) => `This is a translation for your convenience. The ${o.bindingLanguage} version is binding.`,
62
+ show: (o) => `Show the ${o.bindingLanguage} version`
63
+ },
35
64
  sections: {
36
65
  impressum: {
37
66
  operator: {
@@ -93,6 +122,10 @@ The full postal address is supplied on request to data subjects and supervisory
93
122
  title: "Changes to these terms",
94
123
  body: "These terms may be updated as the service evolves. Material changes will be announced by email or in the app; continued use after a change means you accept it."
95
124
  },
125
+ language: {
126
+ title: "Language",
127
+ body: (o) => `These terms are written in ${o.bindingLanguage}. Translations into other languages are provided for convenience only; where a translation differs, the ${o.bindingLanguage} version prevails.`
128
+ },
96
129
  law: {
97
130
  title: "Governing law",
98
131
  body: (o) => `These terms are governed by Swiss law, excluding its conflict-of-laws rules. As far as legally permissible, the place of jurisdiction is ${o.city} (${o.region}), ${o.country}.`
@@ -147,19 +180,27 @@ function defaultLinks(labels) {
147
180
  label: labels.links[page]
148
181
  }));
149
182
  }
150
- function LegalLinks({ links, currentHref, nav = true, labels: labelsProp, className }) {
183
+ function LegalLinks({
184
+ links,
185
+ currentHref,
186
+ nav = true,
187
+ onLinkClick,
188
+ labels: labelsProp,
189
+ className
190
+ }) {
151
191
  const labels = useLegalLabels(labelsProp);
152
192
  const shown = links ?? defaultLinks(labels);
153
193
  const items = shown.flatMap((link, i) => [
154
194
  ...i > 0 ? [/* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: "\xB7" }, `sep-${link.href}`)] : [],
155
- /* @__PURE__ */ jsx(TextLink, { href: link.href, tone: "muted", current: link.href === currentHref, children: link.label }, link.href)
195
+ /* @__PURE__ */ jsx(TextLink, { href: link.href, tone: "muted", current: link.href === currentHref, onClick: onLinkClick, children: link.label }, link.href)
156
196
  ]);
157
197
  const rowClass = cn("flex flex-wrap items-center gap-x-4 gap-y-1 text-xs", className);
158
198
  if (!nav) return /* @__PURE__ */ jsx("div", { className: rowClass, children: items });
159
199
  return /* @__PURE__ */ jsx("nav", { "aria-label": labels.navLabel, className: rowClass, children: items });
160
200
  }
161
- function LegalFooter({ children, links, currentHref, className, labels }) {
162
- return /* @__PURE__ */ jsx("footer", { className: cn("border-t border-[var(--border)] bg-[var(--bg-surface)]", className), children: /* @__PURE__ */ jsxs("div", { className: "mx-auto max-w-5xl px-4 py-8 text-sm text-[var(--text-muted)]", children: [
201
+ function LegalFooter({ children, links, currentHref, landmark = true, className, labels }) {
202
+ const Root = landmark ? "footer" : "div";
203
+ return /* @__PURE__ */ jsx(Root, { className: cn("border-t border-[var(--border)] bg-[var(--bg-surface)]", className), children: /* @__PURE__ */ jsxs("div", { className: "mx-auto max-w-5xl px-4 py-8 text-sm text-[var(--text-muted)]", children: [
163
204
  /* @__PURE__ */ jsx(
164
205
  LegalLinks,
165
206
  {
@@ -193,6 +234,7 @@ function LegalLayout({
193
234
  title,
194
235
  back,
195
236
  notice,
237
+ translationNote,
196
238
  children,
197
239
  links,
198
240
  currentHref,
@@ -203,6 +245,7 @@ function LegalLayout({
203
245
  return /* @__PURE__ */ jsxs("article", { className: cn("mx-auto w-full max-w-3xl px-4 py-12", className), children: [
204
246
  back !== void 0 && /* @__PURE__ */ jsx("div", { className: "mb-4 text-sm", children: back }),
205
247
  /* @__PURE__ */ jsx(Heading, { className: "text-3xl font-bold tracking-tight break-words text-[var(--text-primary)]", children: title }),
248
+ translationNote !== void 0 && translationNote !== null && /* @__PURE__ */ jsx("div", { className: "mt-3", children: translationNote }),
206
249
  notice !== void 0 && notice !== null && /* @__PURE__ */ jsx(AlertBanner, { tone: "warning", role: "note", className: "mt-4", children: notice }),
207
250
  /* @__PURE__ */ jsx("div", { className: "mt-8 space-y-8", children }),
208
251
  links !== void 0 && links.length > 0 && /* @__PURE__ */ jsx(LegalLinks, { links, currentHref, labels, className: "mt-12 border-t border-[var(--border)] pt-4" })
@@ -218,6 +261,7 @@ export {
218
261
  LegalSection,
219
262
  LegalSlotContext,
220
263
  LegalText,
264
+ baseLanguage,
221
265
  legalOperatorText,
222
266
  resolveLegalRefs,
223
267
  useLegalLabels,