@eifi1/ui-kit 0.35.0 → 0.37.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (269) hide show
  1. package/README.md +35 -5
  2. package/dist/admin/role-select.d.ts +3 -2
  3. package/dist/admin/role-select.js +2 -0
  4. package/dist/admin/role-select.js.map +1 -1
  5. package/dist/components/amount-input.d.ts +2 -2
  6. package/dist/components/amount-input.js.map +1 -1
  7. package/dist/components/autocomplete.d.ts +2 -2
  8. package/dist/components/autocomplete.js +2 -1
  9. package/dist/components/autocomplete.js.map +1 -1
  10. package/dist/components/button-look.d.ts +1 -1
  11. package/dist/components/button-look.js +9 -4
  12. package/dist/components/button-look.js.map +1 -1
  13. package/dist/components/checkbox-group.d.ts +5 -2
  14. package/dist/components/checkbox-group.js +15 -4
  15. package/dist/components/checkbox-group.js.map +1 -1
  16. package/dist/components/column-mapper.d.ts +5 -3
  17. package/dist/components/column-mapper.js +2 -0
  18. package/dist/components/column-mapper.js.map +1 -1
  19. package/dist/components/combobox.d.ts +2 -2
  20. package/dist/components/combobox.js +2 -1
  21. package/dist/components/combobox.js.map +1 -1
  22. package/dist/components/country-select.d.ts +3 -3
  23. package/dist/components/country-select.js +3 -0
  24. package/dist/components/country-select.js.map +1 -1
  25. package/dist/components/currency-select.d.ts +3 -2
  26. package/dist/components/currency-select.js +10 -1
  27. package/dist/components/currency-select.js.map +1 -1
  28. package/dist/components/date-field.d.ts +2 -1
  29. package/dist/components/date-field.js.map +1 -1
  30. package/dist/components/date-picker.js +3 -0
  31. package/dist/components/date-picker.js.map +1 -1
  32. package/dist/components/date-range-picker.js +3 -0
  33. package/dist/components/date-range-picker.js.map +1 -1
  34. package/dist/components/entity-combobox.d.ts +2 -2
  35. package/dist/components/entity-combobox.js +2 -1
  36. package/dist/components/entity-combobox.js.map +1 -1
  37. package/dist/components/field-parts.d.ts +66 -11
  38. package/dist/components/field-parts.js +32 -10
  39. package/dist/components/field-parts.js.map +1 -1
  40. package/dist/components/field-strip.d.ts +3 -2
  41. package/dist/components/field-strip.js +2 -1
  42. package/dist/components/field-strip.js.map +1 -1
  43. package/dist/components/field.d.ts +3 -2
  44. package/dist/components/field.js +24 -15
  45. package/dist/components/field.js.map +1 -1
  46. package/dist/components/help-popover.d.ts +9 -7
  47. package/dist/components/help-popover.js.map +1 -1
  48. package/dist/components/icon-picker.d.ts +3 -2
  49. package/dist/components/icon-picker.js +3 -0
  50. package/dist/components/icon-picker.js.map +1 -1
  51. package/dist/components/inline-entity-combobox.d.ts +2 -2
  52. package/dist/components/inline-entity-combobox.js +2 -1
  53. package/dist/components/inline-entity-combobox.js.map +1 -1
  54. package/dist/components/input.d.ts +2 -2
  55. package/dist/components/input.js +2 -1
  56. package/dist/components/input.js.map +1 -1
  57. package/dist/components/month-picker.d.ts +2 -1
  58. package/dist/components/month-picker.js +8 -1
  59. package/dist/components/month-picker.js.map +1 -1
  60. package/dist/components/multi-entity-combobox.d.ts +2 -2
  61. package/dist/components/multi-entity-combobox.js +2 -1
  62. package/dist/components/multi-entity-combobox.js.map +1 -1
  63. package/dist/components/multi-select.d.ts +2 -2
  64. package/dist/components/multi-select.js +3 -0
  65. package/dist/components/multi-select.js.map +1 -1
  66. package/dist/components/number-input.d.ts +2 -2
  67. package/dist/components/number-input.js.map +1 -1
  68. package/dist/components/numeric-field.d.ts +5 -2
  69. package/dist/components/numeric-field.js +4 -1
  70. package/dist/components/numeric-field.js.map +1 -1
  71. package/dist/components/one-time-code-input.d.ts +2 -1
  72. package/dist/components/one-time-code-input.js +2 -1
  73. package/dist/components/one-time-code-input.js.map +1 -1
  74. package/dist/components/phone-input.d.ts +1 -1
  75. package/dist/components/phone-input.js +4 -0
  76. package/dist/components/phone-input.js.map +1 -1
  77. package/dist/components/popover.js +1 -1
  78. package/dist/components/popover.js.map +1 -1
  79. package/dist/components/select.d.ts +4 -3
  80. package/dist/components/select.js +2 -1
  81. package/dist/components/select.js.map +1 -1
  82. package/dist/components/slider.d.ts +3 -2
  83. package/dist/components/slider.js +7 -1
  84. package/dist/components/slider.js.map +1 -1
  85. package/dist/components/stat-tile.js +2 -11
  86. package/dist/components/stat-tile.js.map +1 -1
  87. package/dist/components/swatch-picker.d.ts +3 -2
  88. package/dist/components/swatch-picker.js +3 -0
  89. package/dist/components/swatch-picker.js.map +1 -1
  90. package/dist/components/text-link.js +3 -1
  91. package/dist/components/text-link.js.map +1 -1
  92. package/dist/components/textarea.d.ts +2 -1
  93. package/dist/components/textarea.js +9 -3
  94. package/dist/components/textarea.js.map +1 -1
  95. package/dist/components/toggle-group.d.ts +2 -2
  96. package/dist/components/toggle-group.js +7 -3
  97. package/dist/components/toggle-group.js.map +1 -1
  98. package/dist/eslint/index.js +1 -1
  99. package/dist/eslint/role-utilities.d.ts +34 -2
  100. package/dist/eslint/role-utilities.js +30 -9
  101. package/dist/eslint/role-utilities.js.map +1 -1
  102. package/dist/i18n/defaults.js +5 -1
  103. package/dist/i18n/defaults.js.map +1 -1
  104. package/dist/i18n/german.js +97 -1
  105. package/dist/i18n/german.js.map +1 -1
  106. package/dist/i18n/kit-labels.d.ts +16 -0
  107. package/dist/i18n/kit-labels.js +21 -1
  108. package/dist/i18n/kit-labels.js.map +1 -1
  109. package/dist/i18n/locales/en.js +103 -2
  110. package/dist/i18n/locales/en.js.map +3 -3
  111. package/dist/i18n/locales/es.js +95 -1
  112. package/dist/i18n/locales/es.js.map +1 -1
  113. package/dist/i18n/locales/fr.js +96 -1
  114. package/dist/i18n/locales/fr.js.map +1 -1
  115. package/dist/i18n/locales/hu.js +95 -1
  116. package/dist/i18n/locales/hu.js.map +1 -1
  117. package/dist/i18n/locales/it.js +96 -1
  118. package/dist/i18n/locales/it.js.map +1 -1
  119. package/dist/i18n/locales/zh.js +95 -1
  120. package/dist/i18n/locales/zh.js.map +1 -1
  121. package/dist/i18n/review.js +13 -0
  122. package/dist/i18n/review.js.map +1 -1
  123. package/dist/i18n/shared-labels.js +3 -1
  124. package/dist/i18n/shared-labels.js.map +1 -1
  125. package/dist/index.d.ts +21 -0
  126. package/dist/index.js +38 -0
  127. package/dist/index.js.map +1 -1
  128. package/dist/lib/device-settings.d.ts +72 -0
  129. package/dist/lib/device-settings.js +64 -0
  130. package/dist/lib/device-settings.js.map +1 -0
  131. package/dist/lib/plain-text.d.ts +11 -0
  132. package/dist/lib/plain-text.js +16 -0
  133. package/dist/lib/plain-text.js.map +1 -0
  134. package/dist/lib/safe-storage.d.ts +6 -0
  135. package/dist/lib/safe-storage.js +11 -0
  136. package/dist/lib/safe-storage.js.map +1 -1
  137. package/dist/notifications/notification-parts.d.ts +39 -0
  138. package/dist/notifications/notification-parts.js +47 -0
  139. package/dist/notifications/notification-parts.js.map +1 -0
  140. package/dist/notifications/notification-types-setting.d.ts +62 -0
  141. package/dist/notifications/notification-types-setting.js +192 -0
  142. package/dist/notifications/notification-types-setting.js.map +1 -0
  143. package/dist/notifications/notification-types.d.ts +75 -0
  144. package/dist/notifications/notification-types.js +2 -0
  145. package/dist/notifications/notification-types.js.map +1 -0
  146. package/dist/notifications/notifications-labels.d.ts +131 -0
  147. package/dist/notifications/notifications-labels.js +83 -0
  148. package/dist/notifications/notifications-labels.js.map +1 -0
  149. package/dist/notifications/push-device-setting.d.ts +37 -0
  150. package/dist/notifications/push-device-setting.js +164 -0
  151. package/dist/notifications/push-device-setting.js.map +1 -0
  152. package/dist/notifications/push-devices-setting.d.ts +44 -0
  153. package/dist/notifications/push-devices-setting.js +203 -0
  154. package/dist/notifications/push-devices-setting.js.map +1 -0
  155. package/dist/notifications/quiet-hours-setting.d.ts +47 -0
  156. package/dist/notifications/quiet-hours-setting.js +131 -0
  157. package/dist/notifications/quiet-hours-setting.js.map +1 -0
  158. package/dist/notifications/time-zone-select.d.ts +50 -0
  159. package/dist/notifications/time-zone-select.js +76 -0
  160. package/dist/notifications/time-zone-select.js.map +1 -0
  161. package/dist/notifications/unsubscribe-panel.d.ts +53 -0
  162. package/dist/notifications/unsubscribe-panel.js +139 -0
  163. package/dist/notifications/unsubscribe-panel.js.map +1 -0
  164. package/dist/notifications/use-push-device.d.ts +122 -0
  165. package/dist/notifications/use-push-device.js +230 -0
  166. package/dist/notifications/use-push-device.js.map +1 -0
  167. package/dist/rhf/fields.d.ts +26 -19
  168. package/dist/rhf/fields.js +51 -22
  169. package/dist/rhf/fields.js.map +1 -1
  170. package/dist/settings/device-reset-setting-labels.d.ts +3 -0
  171. package/dist/settings/device-reset-setting-labels.js +15 -0
  172. package/dist/settings/device-reset-setting-labels.js.map +1 -0
  173. package/dist/settings/device-reset-setting.d.ts +58 -0
  174. package/dist/settings/device-reset-setting.js +51 -0
  175. package/dist/settings/device-reset-setting.js.map +1 -0
  176. package/dist/shell/app-shell.js +5 -0
  177. package/dist/shell/app-shell.js.map +1 -1
  178. package/dist/theme/contrast-tokens.d.ts +42 -4
  179. package/dist/theme/contrast-tokens.js +56 -9
  180. package/dist/theme/contrast-tokens.js.map +1 -1
  181. package/dist/theme/contrast.d.ts +4 -2
  182. package/dist/theme/contrast.js +13 -0
  183. package/dist/theme/contrast.js.map +1 -1
  184. package/dist/theme/palette-derive.d.ts +15 -1
  185. package/dist/theme/palette-derive.js +37 -8
  186. package/dist/theme/palette-derive.js.map +1 -1
  187. package/dist/theme/palette-presets.d.ts +2 -1
  188. package/dist/theme/palette-presets.js +5 -5
  189. package/dist/theme/palette-presets.js.map +1 -1
  190. package/dist/theme/palette-store.js +6 -0
  191. package/dist/theme/palette-store.js.map +1 -1
  192. package/dist/theme/text-size.js +6 -0
  193. package/dist/theme/text-size.js.map +1 -1
  194. package/dist/theme/theme-store.js +6 -0
  195. package/dist/theme/theme-store.js.map +1 -1
  196. package/package.json +1 -1
  197. package/src/admin/role-select.tsx +4 -1
  198. package/src/components/amount-input.tsx +2 -1
  199. package/src/components/autocomplete.tsx +5 -2
  200. package/src/components/button-look.ts +15 -5
  201. package/src/components/checkbox-group.tsx +22 -4
  202. package/src/components/column-mapper.tsx +6 -2
  203. package/src/components/combobox.tsx +5 -2
  204. package/src/components/country-select.tsx +6 -1
  205. package/src/components/currency-select.tsx +12 -3
  206. package/src/components/date-field.tsx +2 -2
  207. package/src/components/date-picker.tsx +3 -0
  208. package/src/components/date-range-picker.tsx +3 -0
  209. package/src/components/entity-combobox.tsx +5 -2
  210. package/src/components/field-parts.tsx +107 -19
  211. package/src/components/field-strip.tsx +4 -3
  212. package/src/components/field.tsx +28 -15
  213. package/src/components/help-popover.tsx +9 -7
  214. package/src/components/icon-picker.tsx +8 -3
  215. package/src/components/inline-entity-combobox.tsx +5 -2
  216. package/src/components/input.tsx +4 -2
  217. package/src/components/month-picker.tsx +10 -3
  218. package/src/components/multi-entity-combobox.tsx +5 -2
  219. package/src/components/multi-select.tsx +6 -1
  220. package/src/components/number-input.tsx +2 -2
  221. package/src/components/numeric-field.ts +10 -2
  222. package/src/components/one-time-code-input.tsx +5 -3
  223. package/src/components/phone-input.tsx +4 -0
  224. package/src/components/popover.tsx +3 -1
  225. package/src/components/select.tsx +6 -3
  226. package/src/components/slider.tsx +10 -3
  227. package/src/components/stat-tile.tsx +3 -18
  228. package/src/components/swatch-picker.tsx +9 -4
  229. package/src/components/text-link.tsx +3 -1
  230. package/src/components/textarea.tsx +11 -4
  231. package/src/components/toggle-group.tsx +21 -5
  232. package/src/eslint/role-utilities.ts +67 -11
  233. package/src/i18n/defaults.ts +4 -0
  234. package/src/i18n/german.ts +113 -0
  235. package/src/i18n/kit-labels.tsx +52 -1
  236. package/src/i18n/locales/en.ts +6 -0
  237. package/src/i18n/locales/es.ts +106 -0
  238. package/src/i18n/locales/fr.ts +106 -0
  239. package/src/i18n/locales/hu.ts +104 -0
  240. package/src/i18n/locales/it.ts +105 -0
  241. package/src/i18n/locales/zh.ts +96 -0
  242. package/src/i18n/review.ts +13 -0
  243. package/src/i18n/shared-labels.ts +2 -0
  244. package/src/index.ts +50 -0
  245. package/src/lib/device-settings.ts +146 -0
  246. package/src/lib/plain-text.ts +22 -0
  247. package/src/lib/safe-storage.ts +16 -0
  248. package/src/notifications/notification-parts.tsx +83 -0
  249. package/src/notifications/notification-types-setting.tsx +309 -0
  250. package/src/notifications/notification-types.ts +80 -0
  251. package/src/notifications/notifications-labels.ts +238 -0
  252. package/src/notifications/push-device-setting.tsx +224 -0
  253. package/src/notifications/push-devices-setting.tsx +306 -0
  254. package/src/notifications/quiet-hours-setting.tsx +185 -0
  255. package/src/notifications/time-zone-select.tsx +126 -0
  256. package/src/notifications/unsubscribe-panel.tsx +203 -0
  257. package/src/notifications/use-push-device.ts +392 -0
  258. package/src/rhf/fields.tsx +77 -29
  259. package/src/settings/device-reset-setting-labels.ts +20 -0
  260. package/src/settings/device-reset-setting.tsx +119 -0
  261. package/src/shell/app-shell.tsx +8 -0
  262. package/src/theme/contrast-tokens.ts +106 -12
  263. package/src/theme/contrast.ts +30 -4
  264. package/src/theme/palette-derive.ts +68 -7
  265. package/src/theme/palette-presets.ts +9 -6
  266. package/src/theme/palette-store.ts +12 -0
  267. package/src/theme/text-size.ts +8 -0
  268. package/src/theme/theme-store.ts +10 -0
  269. package/tokens.css +38 -4
@@ -0,0 +1,47 @@
1
+ "use client";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import { useState } from "react";
4
+ import { useKitLabels } from "../i18n/kit-labels.js";
5
+ import { hasContent } from "../lib/presence.js";
6
+ import { AlertBanner } from "../components/alert-banner.js";
7
+ import { DEFAULT_NOTIFICATIONS_LABELS } from "./notifications-labels.js";
8
+ function useNotificationsLabels(prop) {
9
+ return useKitLabels("notifications", DEFAULT_NOTIFICATIONS_LABELS, prop);
10
+ }
11
+ function describeFailure(own, fallback) {
12
+ return hasContent(own) ? own : fallback;
13
+ }
14
+ function FailureLine({ children }) {
15
+ if (!hasContent(children)) return null;
16
+ return /* @__PURE__ */ jsx(AlertBanner, { tone: "danger", size: "sm", role: "alert", children });
17
+ }
18
+ function useWriteOverlay(source) {
19
+ const [entries, setEntries] = useState(/* @__PURE__ */ new Map());
20
+ const [seen, setSeen] = useState(source);
21
+ if (seen !== source) {
22
+ setSeen(source);
23
+ const kept = new Map([...entries].filter(([, entry]) => entry.running));
24
+ if (kept.size !== entries.size) setEntries(kept);
25
+ }
26
+ return {
27
+ has: (key) => entries.has(key),
28
+ get: (key) => entries.get(key)?.value,
29
+ pending: (key) => entries.get(key)?.running === true,
30
+ set: (key, value) => setEntries((current) => new Map(current).set(key, { value, running: true })),
31
+ settle: (key, ok) => setEntries((current) => {
32
+ const entry = current.get(key);
33
+ if (!entry) return current;
34
+ const next = new Map(current);
35
+ if (ok) next.set(key, { value: entry.value, running: false });
36
+ else next.delete(key);
37
+ return next;
38
+ })
39
+ };
40
+ }
41
+ export {
42
+ FailureLine,
43
+ describeFailure,
44
+ useNotificationsLabels,
45
+ useWriteOverlay
46
+ };
47
+ //# sourceMappingURL=notification-parts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/notifications/notification-parts.tsx"],"sourcesContent":["import { useState } from \"react\";\nimport type { ReactNode } from \"react\";\n\nimport { useKitLabels, type LabelOverride } from \"../i18n/kit-labels\";\nimport { hasContent } from \"../lib/presence\";\nimport { AlertBanner } from \"../components/alert-banner\";\nimport { DEFAULT_NOTIFICATIONS_LABELS } from \"./notifications-labels\";\nimport type { NotificationsLabels } from \"./notifications-labels\";\n\n/**\n * What the notification cards share: their words, the failure line under a card, and\n * the overlay a card shows while its write runs.\n *\n * @internal Not part of the barrel; the cards are.\n */\n\n/** The `notifications` namespace: English, then the provider, then the card's prop. */\nexport function useNotificationsLabels(prop?: LabelOverride<NotificationsLabels>): NotificationsLabels {\n return useKitLabels(\"notifications\", DEFAULT_NOTIFICATIONS_LABELS, prop);\n}\n\n/** The app's words for a failure, else `fallback`. */\nexport function describeFailure(own: ReactNode | undefined, fallback: ReactNode): ReactNode {\n return hasContent(own) ? own : fallback;\n}\n\n/** A failure, said under the card's controls — nothing toasts (§4.2). */\nexport function FailureLine({ children }: { children: ReactNode }) {\n if (!hasContent(children)) return null;\n return (\n <AlertBanner tone=\"danger\" size=\"sm\" role=\"alert\">\n {children}\n </AlertBanner>\n );\n}\n\n/** What {@link useWriteOverlay} answers. */\nexport interface WriteOverlay<V> {\n has: (key: string) => boolean;\n get: (key: string) => V | undefined;\n pending: (key: string) => boolean;\n set: (key: string, value: V) => void;\n settle: (key: string, ok: boolean) => void;\n}\n\n/**\n * Values a card shows while its write runs, over what the server last answered.\n *\n * `set(key, value)` shows `value` at once; `settle(key, ok)` drops it again when the\n * write failed (the server's value comes back) and keeps it when it succeeded, until the\n * app hands the card a new `source` — the PATCH's answer, or a refetch — which clears\n * every settled entry, so a card whose app does not update its query on success does not\n * flick back to the old value in between. `pending(key)` says whether a write for `key`\n * is still running.\n *\n * The reset on a new `source` is React's \"adjust state while rendering\" pattern, not an\n * effect: the overlay is gone in the same render that shows the new value.\n */\nexport function useWriteOverlay<V>(source: unknown): WriteOverlay<V> {\n const [entries, setEntries] = useState<ReadonlyMap<string, { value: V; running: boolean }>>(new Map());\n const [seen, setSeen] = useState(source);\n if (seen !== source) {\n setSeen(source);\n const kept = new Map([...entries].filter(([, entry]) => entry.running));\n if (kept.size !== entries.size) setEntries(kept);\n }\n return {\n has: (key: string) => entries.has(key),\n get: (key: string) => entries.get(key)?.value,\n pending: (key: string) => entries.get(key)?.running === true,\n set: (key: string, value: V) =>\n setEntries((current) => new Map(current).set(key, { value, running: true })),\n settle: (key: string, ok: boolean) =>\n setEntries((current) => {\n const entry = current.get(key);\n if (!entry) return current;\n const next = new Map(current);\n if (ok) next.set(key, { value: entry.value, running: false });\n else next.delete(key);\n return next;\n }),\n };\n}\n"],"mappings":";AA8BI;AA9BJ,SAAS,gBAAgB;AAGzB,SAAS,oBAAwC;AACjD,SAAS,kBAAkB;AAC3B,SAAS,mBAAmB;AAC5B,SAAS,oCAAoC;AAWtC,SAAS,uBAAuB,MAAgE;AACrG,SAAO,aAAa,iBAAiB,8BAA8B,IAAI;AACzE;AAGO,SAAS,gBAAgB,KAA4B,UAAgC;AAC1F,S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type { LabelOverride } from "../i18n/kit-labels.js";
3
+ import type { NotificationsLabels } from "./notifications-labels.js";
4
+ import type { DigestCadence, NotificationSettingsPatch, NotificationTypeEntry, NotificationTypeGroup, NotificationTypesValue } from "./notification-types.js";
5
+ export interface NotificationTypesSettingProps<Id extends string = string> extends Omit<ComponentPropsWithRef<"div">, "children" | "onChange"> {
6
+ /** The app's words for its types, in its order. Where an app types its ids. */
7
+ types: readonly NotificationTypeEntry<Id>[];
8
+ /** The `GET`'s `types` (§3.2); `undefined` while the first load runs. */
9
+ value: NotificationTypesValue | undefined;
10
+ /** The settings are loading. */
11
+ loading?: boolean;
12
+ /**
13
+ * Save one change — `PATCH /notifications/settings` with this body: one switch per
14
+ * call (`{types: {digest: {app: true}}}`), or `{digest_cadence}`. The switch shows its
15
+ * new state while the call runs and goes back if it rejects; hand the card the
16
+ * PATCH's answer (or refetch) when it resolves.
17
+ */
18
+ onChange: (patch: NotificationSettingsPatch<Id>) => Promise<unknown> | void;
19
+ /** Headings over the types, in the app's words (keksdose's three). Without them, one
20
+ * list in the order of `types`. In development every type the server answered must
21
+ * be in one. */
22
+ groups?: readonly NotificationTypeGroup<Id>[];
23
+ /** The digest type and the account's cadence: a cadence `Select` under that type
24
+ * while it is on. */
25
+ digest?: {
26
+ type: Id;
27
+ cadence: DigestCadence;
28
+ };
29
+ /** Under a type while it is on — keksdose's low-balance threshold field. */
30
+ renderExtra?: (id: Id) => ReactNode;
31
+ /** The account's address is unverified: every e-mail switch says
32
+ * `labels.emailUnverified` under it (decision 16). */
33
+ emailUnverified?: boolean;
34
+ /** Nothing can be changed (the switches stay readable). */
35
+ disabled?: boolean;
36
+ /** The app's own words for a failed save, or `undefined` for the kit's `failed`. */
37
+ describeError?: (error: unknown) => ReactNode | undefined;
38
+ labels?: LabelOverride<NotificationsLabels>;
39
+ }
40
+ /**
41
+ * What the person hears about, and how (docs/notifications-harmonization.md §2.1–§2.3,
42
+ * §4.2): one row per type the SERVER answered, the app's words on it, a switch for "in
43
+ * the app" and "By e-mail" under it where the type offers mail. Where the app has no
44
+ * "in the app" channel (Kurvenschmiede), the e-mail switch is the row's own, with the
45
+ * type's label.
46
+ *
47
+ * **The server's list is the only list.** The card keeps no defaults and no list of
48
+ * types: it draws what `value` holds, in the order of `groups`, else of `types`. A type
49
+ * the app names that the server did not answer is not drawn (kastlan's tenant receives
50
+ * neither of its types). In development a type the server answered with no entry in
51
+ * `types`, or in no group when `groups` is given, throws — keksdose's compile-time
52
+ * `_EVERY_TYPE_IS_GROUPED`, now at run time, since the list is the server's.
53
+ *
54
+ * **Each flip saves at once**, one switch per call; the switch shows its new state while
55
+ * the call runs and goes back if it rejects, with the failure said under the card. The
56
+ * digest's cadence and the app's extra field (`renderExtra`) show under their type while
57
+ * it is on.
58
+ *
59
+ * Under a write lock the switches are `commit` controls exempt from billing: a lapsed
60
+ * plan never keeps a person from turning notifications off (billing §12.13).
61
+ */
62
+ export declare function NotificationTypesSetting<Id extends string = string>({ types, value, loading, onChange, groups, digest, renderExtra, emailUnverified, disabled, describeError, labels: labelsProp, className, ...rest }: NotificationTypesSettingProps<Id>): import("react").JSX.Element;
@@ -0,0 +1,192 @@
1
+ "use client";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
+ import { useId, useState } from "react";
4
+ import { cn } from "../lib/cn.js";
5
+ import { hasContent } from "../lib/presence.js";
6
+ import { Card } from "../components/card.js";
7
+ import { Select } from "../components/select.js";
8
+ import { Skeleton } from "../components/skeleton.js";
9
+ import { Switch } from "../components/switch.js";
10
+ import { SectionLabel } from "../components/text.js";
11
+ import { COMMIT_EXCEPT_BILLING } from "../components/write-lock.js";
12
+ import { CARD_DESCRIPTION_CLASS } from "../settings/settings-card-classes.js";
13
+ import { SettingsCardTitle } from "../settings/settings-heading.js";
14
+ import { settle, useMounted } from "../account/account-parts.js";
15
+ import { describeFailure, FailureLine, useNotificationsLabels, useWriteOverlay } from "./notification-parts.js";
16
+ function devChecks() {
17
+ return Boolean(import.meta.env?.DEV);
18
+ }
19
+ const switchKey = (id, channel) => `${id}.${channel}`;
20
+ const CADENCE_KEY = "digest_cadence";
21
+ function NotificationTypesSetting({
22
+ types,
23
+ value,
24
+ loading,
25
+ onChange,
26
+ groups,
27
+ digest,
28
+ renderExtra,
29
+ emailUnverified = false,
30
+ disabled = false,
31
+ describeError,
32
+ labels: labelsProp,
33
+ className,
34
+ ...rest
35
+ }) {
36
+ const labels = useNotificationsLabels(labelsProp);
37
+ const overlay = useWriteOverlay(value);
38
+ const cadenceOverlay = useWriteOverlay(digest?.cadence);
39
+ const [failure, setFailure] = useState(null);
40
+ const mounted = useMounted();
41
+ const groupId = useId();
42
+ const answered = value ? Object.keys(value) : [];
43
+ const entries = new Map(types.map((entry) => [entry.id, entry]));
44
+ if (value && devChecks()) {
45
+ const unnamed = answered.filter((id) => !entries.has(id));
46
+ if (unnamed.length) {
47
+ throw new Error(
48
+ `NotificationTypesSetting: the server answered ${unnamed.map((id) => `"${id}"`).join(", ")} with no entry in \`types\` \u2014 give every type the server can send its words.`
49
+ );
50
+ }
51
+ if (groups) {
52
+ const grouped = new Set(groups.flatMap((group) => group.types));
53
+ const loose = answered.filter((id) => !grouped.has(id));
54
+ if (loose.length) {
55
+ throw new Error(
56
+ `NotificationTypesSetting: ${loose.map((id) => `"${id}"`).join(", ")} is in no group \u2014 a type in no group is drawn nowhere, and could not be turned off.`
57
+ );
58
+ }
59
+ }
60
+ }
61
+ const rowOf = (id) => {
62
+ const switches = value?.[id];
63
+ const entry = entries.get(id);
64
+ if (!switches || !entry || switches.app === null && switches.email === null) return null;
65
+ return { entry, switches };
66
+ };
67
+ const rowsOf = (ids) => ids.map(rowOf).filter((row) => row !== null);
68
+ const shown = (id, channel, server) => {
69
+ const key = switchKey(id, channel);
70
+ return overlay.get(key) ?? server;
71
+ };
72
+ const rowOn = ({ entry, switches }) => switches.app !== null ? shown(entry.id, "app", switches.app) : shown(entry.id, "email", switches.email === true);
73
+ const save = (key, patch, which, next) => {
74
+ if (which.pending(key)) return;
75
+ setFailure(null);
76
+ which.set(key, next);
77
+ settle(() => onChange(patch)).then(
78
+ () => {
79
+ if (mounted.current) which.settle(key, true);
80
+ },
81
+ (error) => {
82
+ if (!mounted.current) return;
83
+ which.settle(key, false);
84
+ setFailure(describeFailure(describeError?.(error), labels.failed));
85
+ }
86
+ );
87
+ };
88
+ const flip = (id, channel, on) => save(
89
+ switchKey(id, channel),
90
+ { types: { [id]: { [channel]: on } } },
91
+ overlay,
92
+ on
93
+ );
94
+ const cadence = cadenceOverlay.get(CADENCE_KEY) ?? digest?.cadence;
95
+ const unverifiedLine = emailUnverified ? /* @__PURE__ */ jsx("span", { className: "block", "data-email-unverified": "", children: labels.emailUnverified }) : null;
96
+ const renderRow = (row) => {
97
+ const { entry, switches } = row;
98
+ const on = rowOn(row);
99
+ const emailOnly = switches.app === null;
100
+ const both = !emailOnly && switches.email !== null;
101
+ const cadenceSelect = on && digest?.type === entry.id && cadence ? /* @__PURE__ */ jsxs(
102
+ Select,
103
+ {
104
+ label: labels.digestCadence,
105
+ value: cadence,
106
+ disabled,
107
+ commit: COMMIT_EXCEPT_BILLING,
108
+ onChange: (event) => {
109
+ const next = event.target.value;
110
+ if (next !== cadence) save(CADENCE_KEY, { digest_cadence: next }, cadenceOverlay, next);
111
+ },
112
+ className: "max-w-44",
113
+ children: [
114
+ /* @__PURE__ */ jsx("option", { value: "weekly", children: labels.digestWeekly }),
115
+ /* @__PURE__ */ jsx("option", { value: "monthly", children: labels.digestMonthly })
116
+ ]
117
+ }
118
+ ) : null;
119
+ const extra = on ? renderExtra?.(entry.id) : null;
120
+ const description = emailOnly && unverifiedLine ? /* @__PURE__ */ jsxs(Fragment, { children: [
121
+ entry.description !== void 0 && /* @__PURE__ */ jsx("span", { className: "block", children: entry.description }),
122
+ unverifiedLine
123
+ ] }) : entry.description;
124
+ return /* @__PURE__ */ jsxs(
125
+ "div",
126
+ {
127
+ "data-notification-type": entry.id,
128
+ role: both ? "group" : void 0,
129
+ "aria-label": both ? entry.label : void 0,
130
+ className: "space-y-2",
131
+ children: [
132
+ /* @__PURE__ */ jsx(
133
+ Switch,
134
+ {
135
+ label: entry.label,
136
+ description,
137
+ checked: on,
138
+ disabled,
139
+ commit: COMMIT_EXCEPT_BILLING,
140
+ onCheckedChange: (next) => flip(entry.id, emailOnly ? "email" : "app", next)
141
+ }
142
+ ),
143
+ both && /* @__PURE__ */ jsx("div", { className: "ps-4", children: /* @__PURE__ */ jsx(
144
+ Switch,
145
+ {
146
+ size: "sm",
147
+ label: labels.byEmail,
148
+ description: unverifiedLine ?? void 0,
149
+ checked: shown(entry.id, "email", switches.email === true),
150
+ disabled,
151
+ commit: COMMIT_EXCEPT_BILLING,
152
+ onCheckedChange: (next) => flip(entry.id, "email", next)
153
+ }
154
+ ) }),
155
+ (cadenceSelect || hasContent(extra)) && /* @__PURE__ */ jsxs("div", { className: "ps-4 space-y-2", children: [
156
+ cadenceSelect,
157
+ extra
158
+ ] })
159
+ ]
160
+ },
161
+ entry.id
162
+ );
163
+ };
164
+ let body;
165
+ if (loading || value === void 0) {
166
+ body = /* @__PURE__ */ jsx(Skeleton, { lines: 3, label: labels.typesLoading });
167
+ } else if (groups) {
168
+ const drawn = groups.map((group) => ({ group, rows: rowsOf(group.types) })).filter(({ rows }) => rows.length > 0);
169
+ body = drawn.length === 0 ? /* @__PURE__ */ jsx("p", { className: CARD_DESCRIPTION_CLASS, children: labels.typesEmpty }) : drawn.map(({ group, rows }) => {
170
+ const headingId = `${groupId}-${group.id}`;
171
+ return /* @__PURE__ */ jsxs("div", { role: "group", "aria-labelledby": headingId, className: "space-y-3", children: [
172
+ /* @__PURE__ */ jsx(SectionLabel, { as: "div", size: "xs", id: headingId, children: group.label }),
173
+ rows.map(renderRow)
174
+ ] }, group.id);
175
+ });
176
+ } else {
177
+ const rows = rowsOf(types.map((entry) => entry.id));
178
+ body = rows.length === 0 ? /* @__PURE__ */ jsx("p", { className: CARD_DESCRIPTION_CLASS, children: labels.typesEmpty }) : /* @__PURE__ */ jsx("div", { className: "space-y-3", children: rows.map(renderRow) });
179
+ }
180
+ return /* @__PURE__ */ jsxs(Card, { ...rest, className: cn("p-4 space-y-3", className), children: [
181
+ /* @__PURE__ */ jsxs("div", { children: [
182
+ /* @__PURE__ */ jsx(SettingsCardTitle, { children: labels.typesTitle }),
183
+ /* @__PURE__ */ jsx("div", { className: CARD_DESCRIPTION_CLASS, children: labels.typesDescription })
184
+ ] }),
185
+ body,
186
+ /* @__PURE__ */ jsx(FailureLine, { children: failure })
187
+ ] });
188
+ }
189
+ export {
190
+ NotificationTypesSetting
191
+ };
192
+ //# sourceMappingURL=notification-types-setting.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/notifications/notification-types-setting.tsx"],"sourcesContent":["import { useId, useState } from \"react\";\nimport type { ComponentPropsWithRef, ReactNode } from \"react\";\n\nimport type { LabelOverride } from \"../i18n/kit-labels\";\nimport { cn } from \"../lib/cn\";\nimport { hasContent } from \"../lib/presence\";\nimport { Card } from \"../components/card\";\nimport { Select } from \"../components/select\";\nimport { Skeleton } from \"../components/skeleton\";\nimport { Switch } from \"../components/switch\";\nimport { SectionLabel } from \"../components/text\";\nimport { COMMIT_EXCEPT_BILLING } from \"../components/write-lock\";\nimport { CARD_DESCRIPTION_CLASS } from \"../settings/settings-card-classes\";\nimport { SettingsCardTitle } from \"../settings/settings-heading\";\nimport { settle, useMounted } from \"../account/account-parts\";\nimport { describeFailure, FailureLine, useNotificationsLabels, useWriteOverlay } from \"./notification-parts\";\nimport type { WriteOverlay } from \"./notification-parts\";\nimport type { NotificationsLabels } from \"./notifications-labels\";\nimport type {\n DigestCadence,\n NotificationSettingsPatch,\n NotificationSwitches,\n NotificationTypeEntry,\n NotificationTypeGroup,\n NotificationTypesValue,\n} from \"./notification-types\";\n\n/** Is this a development build? Dead code in a consumer's production bundle; on under\n * vitest, where a type the card cannot draw is a bug a test should fail on (as\n * `SettingsSection`'s catalogue check). */\nfunction devChecks(): boolean {\n return Boolean(import.meta.env?.DEV);\n}\n\nexport interface NotificationTypesSettingProps<Id extends string = string>\n extends Omit<ComponentPropsWithRef<\"div\">, \"children\" | \"onChange\"> {\n /** The app's words for its types, in its order. Where an app types its ids. */\n types: readonly NotificationTypeEntry<Id>[];\n /** The `GET`'s `types` (§3.2); `undefined` while the first load runs. */\n value: NotificationTypesValue | undefined;\n /** The settings are loading. */\n loading?: boolean;\n /**\n * Save one change — `PATCH /notifications/settings` with this body: one switch per\n * call (`{types: {digest: {app: true}}}`), or `{digest_cadence}`. The switch shows its\n * new state while the call runs and goes back if it rejects; hand the card the\n * PATCH's answer (or refetch) when it resolves.\n */\n onChange: (patch: NotificationSettingsPatch<Id>) => Promise<unknown> | void;\n /** Headings over the types, in the app's words (keksdose's three). Without them, one\n * list in the order of `types`. In development every type the server answered must\n * be in one. */\n groups?: readonly NotificationTypeGroup<Id>[];\n /** The digest type and the account's cadence: a cadence `Select` under that type\n * while it is on. */\n digest?: { type: Id; cadence: DigestCadence };\n /** Under a type while it is on — keksdose's low-balance threshold field. */\n renderExtra?: (id: Id) => ReactNode;\n /** The account's address is unverified: every e-mail switch says\n * `labels.emailUnverified` under it (decision 16). */\n emailUnverified?: boolean;\n /** Nothing can be changed (the switches stay readable). */\n disabled?: boolean;\n /** The app's own words for a failed save, or `undefined` for the kit's `failed`. */\n describeError?: (error: unknown) => ReactNode | undefined;\n labels?: LabelOverride<NotificationsLabels>;\n}\n\n/** One drawn type: the app's words and the server's switches. */\ninterface Row<Id extends string> {\n entry: NotificationTypeEntry<Id>;\n switches: NotificationSwitches;\n}\n\n/** A switch's key in the write overlay. */\nconst switchKey = (id: string, channel: \"app\" | \"email\") => `${id}.${channel}`;\nconst CADENCE_KEY = \"digest_cadence\";\n\n/**\n * What the person hears about, and how (docs/notifications-harmonization.md §2.1–§2.3,\n * §4.2): one row per type the SERVER answered, the app's words on it, a switch for \"in\n * the app\" and \"By e-mail\" under it where the type offers mail. Where the app has no\n * \"in the app\" channel (Kurvenschmiede), the e-mail switch is the row's own, with the\n * type's label.\n *\n * **The server's list is the only list.** The card keeps no defaults and no list of\n * types: it draws what `value` holds, in the order of `groups`, else of `types`. A type\n * the app names that the server did not answer is not drawn (kastlan's tenant receives\n * neither of its types). In development a type the server answered with no entry in\n * `types`, or in no group when `groups` is given, throws — keksdose's compile-time\n * `_EVERY_TYPE_IS_GROUPED`, now at run time, since the list is the server's.\n *\n * **Each flip saves at once**, one switch per call; the switch shows its new state while\n * the call runs and goes back if it rejects, with the failure said under the card. The\n * digest's cadence and the app's extra field (`renderExtra`) show under their type while\n * it is on.\n *\n * Under a write lock the switches are `commit` controls exempt from billing: a lapsed\n * plan never keeps a person from turning notifications off (billing §12.13).\n */\nexport function NotificationTypesSetting<Id extends string = string>({\n types,\n value,\n loading,\n onChange,\n groups,\n digest,\n renderExtra,\n emailUnverified = false,\n disabled = false,\n describeError,\n labels: labelsProp,\n className,\n ...rest\n}: NotificationTypesSettingProps<Id>) {\n const labels = useNotificationsLabels(labelsProp);\n const overlay = useWriteOverlay<boolean>(value);\n const cadenceOverlay = useWriteOverlay<DigestCadence>(digest?.cadence);\n const [failure, setFailure] = useState<ReactNode>(null);\n const mounted = useMounted();\n const groupId = useId();\n\n const answered = value ? Object.keys(value) : [];\n const entries = new Map(types.map((entry) => [entry.id as string, entry]));\n if (value && devChecks()) {\n const unnamed = answered.filter((id) => !entries.has(id));\n if (unnamed.length) {\n throw new Error(\n `NotificationTypesSetting: the server answered ${unnamed.map((id) => `\"${id}\"`).join(\", \")} with no entry in \\`types\\` — give every type the server can send its words.`,\n );\n }\n if (groups) {\n const grouped = new Set<string>(groups.flatMap((group) => group.types));\n const loose = answered.filter((id) => !grouped.has(id));\n if (loose.length) {\n throw new Error(\n `NotificationTypesSetting: ${loose.map((id) => `\"${id}\"`).join(\", \")} is in no group — a type in no group is drawn nowhere, and could not be turned off.`,\n );\n }\n }\n }\n\n const rowOf = (id: Id): Row<Id> | null => {\n const switches = value?.[id];\n const entry = entries.get(id);\n if (!switches || !entry || (switches.app === null && switches.email === null)) return null;\n return { entry, switches };\n };\n const rowsOf = (ids: readonly Id[]) => ids.map(rowOf).filter((row): row is Row<Id> => row !== null);\n\n const shown = (id: string, channel: \"app\" | \"email\", server: boolean): boolean => {\n const key = switchKey(id, channel);\n return overlay.get(key) ?? server;\n };\n /** The row's own switch: `app`, or `email` where the app has no `app` channel. */\n const rowOn = ({ entry, switches }: Row<Id>) =>\n switches.app !== null\n ? shown(entry.id, \"app\", switches.app)\n : shown(entry.id, \"email\", switches.email === true);\n\n const save = <V,>(key: string, patch: NotificationSettingsPatch<Id>, which: WriteOverlay<V>, next: V) => {\n if (which.pending(key)) return;\n setFailure(null);\n which.set(key, next);\n settle(() => onChange(patch)).then(\n () => {\n if (mounted.current) which.settle(key, true);\n },\n (error: unknown) => {\n if (!mounted.current) return;\n which.settle(key, false);\n setFailure(describeFailure(describeError?.(error), labels.failed));\n },\n );\n };\n\n const flip = (id: Id, channel: \"app\" | \"email\", on: boolean) =>\n save(\n switchKey(id, channel),\n { types: { [id]: { [channel]: on } } as NotificationSettingsPatch<Id>[\"types\"] },\n overlay,\n on,\n );\n\n const cadence = cadenceOverlay.get(CADENCE_KEY) ?? digest?.cadence;\n\n const unverifiedLine = emailUnverified ? (\n <span className=\"block\" data-email-unverified=\"\">\n {labels.emailUnverified}\n </span>\n ) : null;\n\n const renderRow = (row: Row<Id>) => {\n const { entry, switches } = row;\n const on = rowOn(row);\n const emailOnly = switches.app === null;\n const both = !emailOnly && switches.email !== null;\n const cadenceSelect =\n on && digest?.type === entry.id && cadence ? (\n <Select\n label={labels.digestCadence}\n value={cadence}\n disabled={disabled}\n commit={COMMIT_EXCEPT_BILLING}\n onChange={(event) => {\n const next = event.target.value as DigestCadence;\n if (next !== cadence) save(CADENCE_KEY, { digest_cadence: next }, cadenceOverlay, next);\n }}\n className=\"max-w-44\"\n >\n <option value=\"weekly\">{labels.digestWeekly}</option>\n <option value=\"monthly\">{labels.digestMonthly}</option>\n </Select>\n ) : null;\n const extra = on ? renderExtra?.(entry.id) : null;\n const description =\n emailOnly && unverifiedLine ? (\n <>\n {entry.description !== undefined && <span className=\"block\">{entry.description}</span>}\n {unverifiedLine}\n </>\n ) : (\n entry.description\n );\n return (\n <div\n key={entry.id}\n data-notification-type={entry.id}\n // A row with two switches is a group named by its type, so \"By e-mail\" is heard\n // with the type it belongs to.\n role={both ? \"group\" : undefined}\n aria-label={both ? entry.label : undefined}\n className=\"space-y-2\"\n >\n <Switch\n label={entry.label}\n description={description}\n checked={on}\n disabled={disabled}\n commit={COMMIT_EXCEPT_BILLING}\n onCheckedChange={(next) => flip(entry.id, emailOnly ? \"email\" : \"app\", next)}\n />\n {both && (\n <div className=\"ps-4\">\n <Switch\n size=\"sm\"\n label={labels.byEmail}\n description={unverifiedLine ?? undefined}\n checked={shown(entry.id, \"email\", switches.email === true)}\n disabled={disabled}\n commit={COMMIT_EXCEPT_BILLING}\n onCheckedChange={(next) => flip(entry.id, \"email\", next)}\n />\n </div>\n )}\n {(cadenceSelect || hasContent(extra)) && (\n <div className=\"ps-4 space-y-2\">\n {cadenceSelect}\n {extra}\n </div>\n )}\n </div>\n );\n };\n\n let body: ReactNode;\n if (loading || value === undefined) {\n body = <Skeleton lines={3} label={labels.typesLoading} />;\n } else if (groups) {\n const drawn = groups\n .map((group) => ({ group, rows: rowsOf(group.types) }))\n .filter(({ rows }) => rows.length > 0);\n body =\n drawn.length === 0 ? (\n <p className={CARD_DESCRIPTION_CLASS}>{labels.typesEmpty}</p>\n ) : (\n drawn.map(({ group, rows }) => {\n const headingId = `${groupId}-${group.id}`;\n return (\n <div key={group.id} role=\"group\" aria-labelledby={headingId} className=\"space-y-3\">\n <SectionLabel as=\"div\" size=\"xs\" id={headingId}>\n {group.label}\n </SectionLabel>\n {rows.map(renderRow)}\n </div>\n );\n })\n );\n } else {\n const rows = rowsOf(types.map((entry) => entry.id));\n body =\n rows.length === 0 ? (\n <p className={CARD_DESCRIPTION_CLASS}>{labels.typesEmpty}</p>\n ) : (\n <div className=\"space-y-3\">{rows.map(renderRow)}</div>\n );\n }\n\n return (\n <Card {...rest} className={cn(\"p-4 space-y-3\", className)}>\n <div>\n <SettingsCardTitle>{labels.typesTitle}</SettingsCardTitle>\n <div className={CARD_DESCRIPTION_CLASS}>{labels.typesDescription}</div>\n </div>\n {body}\n <FailureLine>{failure}</FailureLine>\n </Card>\n );\n}\n"],"mappings":";AA2LI,SA8BI,UA9BJ,KAYI,YAZJ;AA3LJ,SAAS,OAAO,gBAAgB;AAIhC,SAAS,UAAU;AACnB,SAAS,kBAAkB;AAC3B,SAAS,YAAY;AACrB,SAAS,cAAc;AACvB,SAAS,gBAAgB;AACzB,SAAS,cAAc;AACvB,SAAS,oBAAoB;AAC7B,SAAS,6BAA6B;AACtC,SAAS,8BAA8B;AACvC,SAAS,yBAAyB;AAClC,SAAS,QAAQ,kBAAkB;AACnC,SAAS,iBAAiB,aAAa,wBAAwB,uBAAuB;AAetF,SAAS,YAAqB;AAC5B,SAAO,QAAQ,YAAY,KAAK,GAAG;AACrC;AA2CA,MAAM,YAAY,CAAC,IAAY,YAA6B,GAAG,EAAE,IAAI,OAAO;AAC5E,MAAM,cAAc;AAwBb,SAAS,yBAAqD;AAAA,EACnE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,kBAAkB;AAAA,EAClB,WAAW;AAAA,EACX;AAAA,EACA,QAAQ;AAAA,EACR;AAAA,EACA,GAAG;AACL,GAAsC;AACpC,QAAM,SAAS,uBAAuB,UAAU;AAChD,QAAM,UAAU,gBAAyB,KAAK;AAC9C,QAAM,iBAAiB,gBAA+B,QAAQ,OAAO;AACrE,QAAM,CAAC,SAAS,UAAU,IAAI,SAAoB,IAAI;AACtD,QAAM,UAAU,WAAW;AAC3B,QAAM,UAAU,MAAM;AAEtB,QAAM,WAAW,QAAQ,OAAO,KAAK,KAAK,IAAI,CAAC;AAC/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AW,UAAU,QAAW;AAClC,WAAO,oBAAC,YAAS,OAAO,GAAG,OAAO,OAAO,cAAc;AAAA,EACzD,WAAW,QAAQ;AACjB,UAAM,QAAQ,OACX,IAAI,CAAC,WAAW,EAAE,OAAO,MAAM,OAAO,MAAM,KAAK,EAAE,EAAE,EACrD,OAAO,CAAC,EAAE,KAAK,MAAM,KAAK,SAAS,CAAC;AACvC,WACE,MAAM,WAAW,IACf,oBAAC,OAAE,WAAW,wBAAyB,iBAAO,YAAW,IAEzD,MAAM,IAAI,CAAC,EAAE,OAAO,KAAK,MAAM;AAC7B,YAAM,YAAY,GAAG,OAAO,IAAI,MAAM,EAAE;AACxC,aACE,qBAAC,SAAmB,MAAK,SAAQ,mBAAiB,WAAW,WAAU,aACrE;AAAA,4BAAC,gBAAa,IAAG,OAAM,MAAK,MAAK,IAAI,WAClC,gBAAM,OACT;AAAA,QACC,KAAK,IAAI,SAAS;AAAA,WAJX,MAAM,EAKhB;AAAA,IAEJ,CAAC;AAAA,EAEP,OAAO;AACL,UAAM,OAAO,OAAO,MAAM,IAAI,CAAC,UAAU,MAAM,EAAE,CAAC;AAClD,WACE,KAAK,WAAW,IACd,oBAAC,OAAE,WAAW,wBAAyB,iBAAO,YAAW,IAEzD,oBAAC,SAAI,WAAU,aAAa,eAAK,IAAI,SAAS,GAAE;AAAA,EAEtD;AAEA,SACE,qBAAC,QAAM,GAAG,MAAM,WAAW,GAAG,iBAAiB,SAAS,GACtD;AAAA,yBAAC,SACC;AAAA,0BAAC,qBAAmB,iBAAO,YAAW;AAAA,MACtC,oBAAC,SAAI,WAAW,wBAAyB,iBAAO,kBAAiB;AAAA,OACnE;AAAA,IACC;AAAA,IACD,oBAAC,eAAa,mBAAQ;AAAA,KACxB;AAEJ;","names":[]}
@@ -0,0 +1,75 @@
1
+ import type { ReactNode } from "react";
2
+ /**
3
+ * The shapes the notification cards share (docs/notifications-harmonization.md §3.2,
4
+ * §3.5, §4.2): the server's `GET /notifications/settings` answer, the parts of its
5
+ * `PATCH` the cards send, one push device, and the app's words for its types.
6
+ *
7
+ * Types only — the kit keeps no list of notification types and no defaults (§2.1): the
8
+ * server's registry is the one list, and the cards draw what it answers.
9
+ */
10
+ /** The digest's cadence, one for the account (§2.5): Monday, or the 1st, in its zone. */
11
+ export type DigestCadence = "weekly" | "monthly";
12
+ /**
13
+ * One type's two switches in the `GET` (§3.2). `null` where the type does not offer
14
+ * that channel: `email` for a type with no mail, `app` in an app with no "in the app"
15
+ * channel (Kurvenschmiede: `{app: null, email: true}`). An unset switch already reads as
16
+ * its default — the server fills it in.
17
+ */
18
+ export interface NotificationSwitches {
19
+ app: boolean | null;
20
+ email: boolean | null;
21
+ }
22
+ /** The `GET`'s `types`: every type the account can receive, in the registry's order. */
23
+ export type NotificationTypesValue = Readonly<Record<string, NotificationSwitches>>;
24
+ /**
25
+ * The app's words for one of its types — where an app TYPES its ids, so its own maps
26
+ * (keksdose's inbox icons) are keyed on the same list (§5.1). The kit draws the type
27
+ * only when the server answered it.
28
+ */
29
+ export interface NotificationTypeEntry<Id extends string = string> {
30
+ id: Id;
31
+ /** The switch's label: what the person hears about. */
32
+ label: string;
33
+ /** The line under it, attached to the switch. */
34
+ description?: ReactNode;
35
+ }
36
+ /** A heading over some of the types, in the app's words (keksdose's "Budget", "Scans &
37
+ * sharing", "Summaries & news"). */
38
+ export interface NotificationTypeGroup<Id extends string = string> {
39
+ /** A stable key for the group. */
40
+ id: string;
41
+ label: ReactNode;
42
+ /** The group's types, in the order they are drawn. */
43
+ types: readonly Id[];
44
+ }
45
+ /**
46
+ * The parts of `PATCH /notifications/settings` (§3.2) the cards send. Omitted keeps; a
47
+ * type's `null` puts both its switches back to their defaults; `quiet_hours_*: null`
48
+ * clears a time. One switch per call from the types card (`{types: {digest: {app:
49
+ * true}}}`), or `{digest_cadence}`; quiet hours send a time, with the device's zone the
50
+ * first time; the zone picker sends `{timezone}`.
51
+ */
52
+ export interface NotificationSettingsPatch<Id extends string = string> {
53
+ types?: Partial<Record<Id, {
54
+ app?: boolean;
55
+ email?: boolean;
56
+ } | null>>;
57
+ digest_cadence?: DigestCadence;
58
+ quiet_hours_start?: string | null;
59
+ quiet_hours_end?: string | null;
60
+ timezone?: string;
61
+ }
62
+ /** One registered push device, as `GET /notifications/devices` lists it (§3.5), oldest
63
+ * first. The owner gets the whole endpoint, which marks "this device". */
64
+ export interface PushDeviceItem<Id extends string | number = string> {
65
+ id: Id;
66
+ endpoint: string;
67
+ /** The browser's user agent at registration; `null` when it sent none. */
68
+ user_agent: string | null;
69
+ /** ISO date-time. */
70
+ created_at: string;
71
+ /** ISO date-time of the last delivery the push service accepted, or `null`. */
72
+ last_success_at: string | null;
73
+ /** Failed deliveries in a row; the server removes the device at 10. */
74
+ failure_count: number;
75
+ }
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ //# sourceMappingURL=notification-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,131 @@
1
+ /** The ten IANA regions `Intl` lists zones under — keksdose's `tz_region_*` — in the
2
+ * kit's words. A region a runtime adds later keeps its IANA name. */
3
+ export interface NotificationRegionLabels {
4
+ Africa: string;
5
+ America: string;
6
+ Antarctica: string;
7
+ Arctic: string;
8
+ Asia: string;
9
+ Atlantic: string;
10
+ Australia: string;
11
+ Europe: string;
12
+ Indian: string;
13
+ Pacific: string;
14
+ }
15
+ /**
16
+ * Every string the notification parts render — the `notifications` namespace of
17
+ * `<UiKitProvider labels>`, overridable per instance through `labels`: the types card,
18
+ * quiet hours and the zone picker, this device's push, the device list, and the
19
+ * unsubscribe page. Cancel is `common.cancel`.
20
+ */
21
+ export interface NotificationsLabels {
22
+ /** The types card's title. */
23
+ typesTitle: string;
24
+ /** The line under it. */
25
+ typesDescription: string;
26
+ /** The e-mail switch under a type that offers mail. */
27
+ byEmail: string;
28
+ /** Under every e-mail switch while the account's address is unverified (decision 16):
29
+ * no notification mail goes to an unverified address. */
30
+ emailUnverified: string;
31
+ /** The digest's cadence select. */
32
+ digestCadence: string;
33
+ digestWeekly: string;
34
+ digestMonthly: string;
35
+ /** While the settings load. */
36
+ typesLoading: string;
37
+ /** The server answered no types for this account. */
38
+ typesEmpty: string;
39
+ quietTitle: string;
40
+ /** The line under the title; `inbox`: the app keeps an inbox, which a held push still
41
+ * reaches. */
42
+ quietDescription: (inbox: boolean) => string;
43
+ /** The start time's label. */
44
+ quietFrom: string;
45
+ /** The end time's label. */
46
+ quietUntil: string;
47
+ /** One time set, the other not: quiet hours fail open until both are. */
48
+ quietIncomplete: string;
49
+ /** The zone picker's label. */
50
+ timeZone: string;
51
+ /** Given the device's zone, as the picker names it, when it differs from the one the
52
+ * server applies. */
53
+ deviceZone: (zone: string) => string;
54
+ /** The button that takes the device's zone. */
55
+ useDeviceZone: string;
56
+ /** The zone picker's region headings. */
57
+ regions: NotificationRegionLabels;
58
+ pushTitle: string;
59
+ pushDescription: string;
60
+ /** The browser has no push. */
61
+ unsupported: string;
62
+ /** iOS outside the installed app, given the app's name. */
63
+ iosInstall: (app: string) => string;
64
+ /** The server has no VAPID keys. */
65
+ notConfigured: string;
66
+ /** The browser's permission is denied. */
67
+ blocked: string;
68
+ /** This device gets notifications for the signed-in account. */
69
+ on: string;
70
+ off: string;
71
+ /** This browser's subscription belongs to another account. */
72
+ otherAccount: string;
73
+ enable: string;
74
+ disable: string;
75
+ sendTest: string;
76
+ /** Turning on did not finish (the permission prompt dismissed, a refusal). */
77
+ enableFailed: string;
78
+ /** No service worker, or one that is not ready in 10 s. */
79
+ noServiceWorker: string;
80
+ /** The browser's push service did not answer in 15 s. */
81
+ pushTimeout: string;
82
+ /** Given how many devices the push service accepted the test for (≥ 1). */
83
+ testSent: (count: number) => string;
84
+ /** The test reached no device. */
85
+ testNone: string;
86
+ testFailed: string;
87
+ /** The explainer before the browser's one permission prompt. */
88
+ explainerTitle: string;
89
+ explainerBody: (app: string) => string;
90
+ explainerHint: string;
91
+ explainerContinue: string;
92
+ devicesTitle: string;
93
+ devicesDescription: string;
94
+ devicesLoading: string;
95
+ devicesEmpty: string;
96
+ /** A device whose user agent says nothing the kit recognises. */
97
+ unknownDevice: string;
98
+ /** The chip on this browser's row. */
99
+ thisDevice: string;
100
+ /** Given the registration date, formatted. */
101
+ added: (date: string) => string;
102
+ /** Given the last accepted delivery, formatted. */
103
+ lastDelivery: (date: string) => string;
104
+ noDelivery: string;
105
+ /** Given the failed deliveries in a row (≥ 1). */
106
+ failures: (count: number) => string;
107
+ /** A row's button, visible text — and the confirm's answer. */
108
+ remove: string;
109
+ /** The same button's accessible name, given the device: it starts with `remove`. */
110
+ removeItem: (device: string) => string;
111
+ /** The question the row asks before it removes. */
112
+ removePrompt: string;
113
+ unsubscribeTitle: string;
114
+ /** Given the type's name in the app's words. */
115
+ unsubscribeAbout: (type: string) => string;
116
+ /** No type name to give. */
117
+ unsubscribeGeneric: string;
118
+ stopThese: string;
119
+ stopAll: (app: string) => string;
120
+ stoppedThese: string;
121
+ stoppedAll: (app: string) => string;
122
+ /** Account mail is not a notification, and keeps coming. */
123
+ accountMail: string;
124
+ turnBackOn: string;
125
+ openSettings: string;
126
+ /** A token the server refused, or one that does not parse. */
127
+ invalidLink: string;
128
+ /** A request failed, and the app had no words of its own. */
129
+ failed: string;
130
+ }
131
+ export declare const DEFAULT_NOTIFICATIONS_LABELS: NotificationsLabels;
@@ -0,0 +1,83 @@
1
+ "use client";
2
+ const DEFAULT_NOTIFICATIONS_LABELS = {
3
+ typesTitle: "Notify me about",
4
+ typesDescription: "Choose what you hear about, and how.",
5
+ byEmail: "By e-mail",
6
+ emailUnverified: "Confirm your address to receive these.",
7
+ digestCadence: "Frequency",
8
+ digestWeekly: "Weekly",
9
+ digestMonthly: "Monthly",
10
+ typesLoading: "Loading notification settings\u2026",
11
+ typesEmpty: "There are no notifications for this account.",
12
+ quietTitle: "Quiet hours",
13
+ quietDescription: (inbox) => inbox ? "No push notifications during this window. They still reach your inbox." : "No push notifications during this window.",
14
+ quietFrom: "From",
15
+ quietUntil: "Until",
16
+ quietIncomplete: "Set both a start and an end time. Quiet hours take effect once both are set.",
17
+ timeZone: "Time zone",
18
+ deviceZone: (zone) => `This device is in ${zone}.`,
19
+ useDeviceZone: "Use it",
20
+ regions: {
21
+ Africa: "Africa",
22
+ America: "Americas",
23
+ Antarctica: "Antarctica",
24
+ Arctic: "Arctic",
25
+ Asia: "Asia",
26
+ Atlantic: "Atlantic",
27
+ Australia: "Australia",
28
+ Europe: "Europe",
29
+ Indian: "Indian Ocean",
30
+ Pacific: "Pacific"
31
+ },
32
+ pushTitle: "Push notifications",
33
+ pushDescription: "Notifications on this device, also while the app is closed.",
34
+ unsupported: "This browser doesn\u2019t support push notifications.",
35
+ iosInstall: (app) => `On iPhone or iPad, add ${app} to your Home Screen first: iOS delivers notifications only to the installed app.`,
36
+ notConfigured: "Push notifications aren\u2019t set up on this server.",
37
+ blocked: "Notifications are blocked in this browser\u2019s settings.",
38
+ on: "Notifications are on for this device.",
39
+ off: "Notifications are off for this device.",
40
+ otherAccount: "This browser gets notifications for another account. Turn them on here to get them for the account you\u2019re signed in with.",
41
+ enable: "Turn on notifications",
42
+ disable: "Turn off",
43
+ sendTest: "Send a test",
44
+ enableFailed: "Couldn\u2019t turn on notifications.",
45
+ noServiceWorker: "Couldn\u2019t reach the app\u2019s service worker. Reload the page and try again.",
46
+ pushTimeout: "The browser\u2019s push service didn\u2019t answer. Check your connection and try again.",
47
+ testSent: (count) => count === 1 ? "Test sent to 1 device" : `Test sent to ${count} devices`,
48
+ testNone: "No device accepted the test. Turn notifications on for this device first.",
49
+ testFailed: "Couldn\u2019t send a test notification.",
50
+ explainerTitle: "Turn on notifications?",
51
+ explainerBody: (app) => `${app} sends a notification only for the kinds you choose, and you can turn them off at any time.`,
52
+ explainerHint: "Your browser asks for permission next.",
53
+ explainerContinue: "Continue",
54
+ devicesTitle: "Notification devices",
55
+ devicesDescription: "Every device that gets push notifications for your account. Remove any you no longer use.",
56
+ devicesLoading: "Loading devices\u2026",
57
+ devicesEmpty: "No device gets notifications yet.",
58
+ unknownDevice: "Unknown device",
59
+ thisDevice: "This device",
60
+ added: (date) => `Added ${date}`,
61
+ lastDelivery: (date) => `Last delivery ${date}`,
62
+ noDelivery: "No delivery yet",
63
+ failures: (count) => count === 1 ? "1 failed delivery in a row" : `${count} failed deliveries in a row`,
64
+ remove: "Remove",
65
+ removeItem: (device) => `Remove ${device}`,
66
+ removePrompt: "Stop sending notifications to this device?",
67
+ unsubscribeTitle: "E-mail notifications",
68
+ unsubscribeAbout: (type) => `You get e-mails about: ${type}.`,
69
+ unsubscribeGeneric: "You get notification e-mails.",
70
+ stopThese: "Stop these e-mails",
71
+ stopAll: (app) => `Stop all notification e-mails from ${app}`,
72
+ stoppedThese: "Done. You won\u2019t get these e-mails any more.",
73
+ stoppedAll: (app) => `Done. You won\u2019t get notification e-mails from ${app} any more.`,
74
+ accountMail: "E-mails about your account still come.",
75
+ turnBackOn: "You can turn them back on at any time in Settings.",
76
+ openSettings: "Open Settings",
77
+ invalidLink: "This link doesn\u2019t work any more. You can turn e-mails off in Settings instead.",
78
+ failed: "That didn\u2019t work. Please try again."
79
+ };
80
+ export {
81
+ DEFAULT_NOTIFICATIONS_LABELS
82
+ };
83
+ //# sourceMappingURL=notifications-labels.js.map