@eifi1/ui-kit 0.51.7 → 0.53.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 (775) hide show
  1. package/README.md +178 -67
  2. package/dist/account/account-parts.d.ts +10 -8
  3. package/dist/account/account-parts.js +1 -18
  4. package/dist/account/account-parts.js.map +1 -1
  5. package/dist/account/data-export-setting-labels.js +1 -1
  6. package/dist/account/data-export-setting-labels.js.map +1 -1
  7. package/dist/account/delete-account-setting-labels.js +1 -1
  8. package/dist/account/delete-account-setting-labels.js.map +1 -1
  9. package/dist/account/email-change-setting-labels.js +1 -1
  10. package/dist/account/email-change-setting-labels.js.map +1 -1
  11. package/dist/account/passkeys-setting.d.ts +9 -2
  12. package/dist/account/passkeys-setting.js +41 -29
  13. package/dist/account/passkeys-setting.js.map +1 -1
  14. package/dist/account/sessions-setting.d.ts +3 -2
  15. package/dist/account/sessions-setting.js +10 -8
  16. package/dist/account/sessions-setting.js.map +1 -1
  17. package/dist/admin/admin-action-confirm.js +1 -3
  18. package/dist/admin/admin-action-confirm.js.map +1 -1
  19. package/dist/admin/admin-parts.d.ts +6 -3
  20. package/dist/admin/admin-parts.js +6 -21
  21. package/dist/admin/admin-parts.js.map +1 -1
  22. package/dist/admin/mail-test-card-labels.js +1 -1
  23. package/dist/admin/mail-test-card-labels.js.map +1 -1
  24. package/dist/admin/plan-change-labels.d.ts +2 -2
  25. package/dist/admin/plan-change-labels.js +1 -17
  26. package/dist/admin/plan-change-labels.js.map +1 -1
  27. package/dist/admin/plan-change.d.ts +3 -42
  28. package/dist/admin/plan-change.js +1 -1
  29. package/dist/admin/plan-change.js.map +1 -1
  30. package/dist/admin/reviewer-scope-editor.js +3 -3
  31. package/dist/admin/reviewer-scope-editor.js.map +1 -1
  32. package/dist/auth/auth-errors-labels.d.ts +11 -0
  33. package/dist/auth/auth-errors-labels.js +13 -0
  34. package/dist/auth/auth-errors-labels.js.map +1 -0
  35. package/dist/auth/auth-errors.d.ts +7 -23
  36. package/dist/auth/auth-errors.js +2 -15
  37. package/dist/auth/auth-errors.js.map +1 -1
  38. package/dist/auth/complete-name-dialog.js +2 -1
  39. package/dist/auth/complete-name-dialog.js.map +1 -1
  40. package/dist/auth/forgot-password-form-labels.js +1 -1
  41. package/dist/auth/forgot-password-form-labels.js.map +1 -1
  42. package/dist/auth/forgot-password-form.js +7 -2
  43. package/dist/auth/forgot-password-form.js.map +1 -1
  44. package/dist/auth/register-form-labels.js +1 -1
  45. package/dist/auth/register-form-labels.js.map +1 -1
  46. package/dist/auth/reset-password-form-labels.js +1 -1
  47. package/dist/auth/reset-password-form-labels.js.map +1 -1
  48. package/dist/auth/reset-password-form.js +5 -1
  49. package/dist/auth/reset-password-form.js.map +1 -1
  50. package/dist/auth/sign-in-form-labels.js +1 -1
  51. package/dist/auth/sign-in-form-labels.js.map +1 -1
  52. package/dist/auth/status-parts.d.ts +0 -3
  53. package/dist/auth/status-parts.js +0 -4
  54. package/dist/auth/status-parts.js.map +1 -1
  55. package/dist/auth/verify-email-labels.js +1 -1
  56. package/dist/auth/verify-email-labels.js.map +1 -1
  57. package/dist/auth/verify-email.js +7 -2
  58. package/dist/auth/verify-email.js.map +1 -1
  59. package/dist/billing/cancel-subscription.d.ts +10 -7
  60. package/dist/billing/cancel-subscription.js +6 -6
  61. package/dist/billing/cancel-subscription.js.map +1 -1
  62. package/dist/billing/plan-card.d.ts +5 -3
  63. package/dist/billing/plan-card.js +7 -8
  64. package/dist/billing/plan-card.js.map +1 -1
  65. package/dist/billing/plan-change-labels.d.ts +42 -0
  66. package/dist/billing/plan-change-labels.js +22 -0
  67. package/dist/billing/plan-change-labels.js.map +1 -0
  68. package/dist/billing/plan-switch.d.ts +9 -6
  69. package/dist/billing/plan-switch.js +7 -5
  70. package/dist/billing/plan-switch.js.map +1 -1
  71. package/dist/chart.d.ts +4 -3
  72. package/dist/chart.js +72 -4
  73. package/dist/chart.js.map +1 -1
  74. package/dist/components/account-chips.d.ts +5 -5
  75. package/dist/components/account-chips.js +11 -13
  76. package/dist/components/account-chips.js.map +1 -1
  77. package/dist/components/alert-banner.d.ts +16 -5
  78. package/dist/components/alert-banner.js +46 -1
  79. package/dist/components/alert-banner.js.map +1 -1
  80. package/dist/components/amount-input.d.ts +13 -0
  81. package/dist/components/amount-input.js +1 -0
  82. package/dist/components/amount-input.js.map +1 -1
  83. package/dist/components/autocomplete.js +57 -65
  84. package/dist/components/autocomplete.js.map +1 -1
  85. package/dist/components/bulk-action-bar.d.ts +12 -2
  86. package/dist/components/bulk-action-bar.js +65 -21
  87. package/dist/components/bulk-action-bar.js.map +1 -1
  88. package/dist/components/button-look.d.ts +5 -5
  89. package/dist/components/button-look.js.map +1 -1
  90. package/dist/components/button.d.ts +2 -2
  91. package/dist/components/button.js.map +1 -1
  92. package/dist/components/chart-edge.d.ts +16 -0
  93. package/dist/components/chart-edge.js +14 -1
  94. package/dist/components/chart-edge.js.map +1 -1
  95. package/dist/components/chart-figure.d.ts +13 -0
  96. package/dist/components/chart-figure.js +15 -0
  97. package/dist/components/chart-figure.js.map +1 -0
  98. package/dist/components/chart-zoom-core.js +1 -4
  99. package/dist/components/chart-zoom-core.js.map +1 -1
  100. package/dist/components/chart.d.ts +8 -1
  101. package/dist/components/chart.js +19 -10
  102. package/dist/components/chart.js.map +1 -1
  103. package/dist/components/combobox-core.d.ts +111 -2
  104. package/dist/components/combobox-core.js +148 -42
  105. package/dist/components/combobox-core.js.map +1 -1
  106. package/dist/components/combobox.d.ts +1 -1
  107. package/dist/components/combobox.js +141 -130
  108. package/dist/components/combobox.js.map +1 -1
  109. package/dist/components/copy-button.d.ts +6 -5
  110. package/dist/components/copy-button.js +5 -3
  111. package/dist/components/copy-button.js.map +1 -1
  112. package/dist/components/country-select.js +2 -2
  113. package/dist/components/country-select.js.map +1 -1
  114. package/dist/components/data-table-column-settings.d.ts +1 -1
  115. package/dist/components/data-table-column-settings.js +33 -7
  116. package/dist/components/data-table-column-settings.js.map +1 -1
  117. package/dist/components/data-table-filters.d.ts +4 -2
  118. package/dist/components/data-table-filters.js +2 -2
  119. package/dist/components/data-table-filters.js.map +1 -1
  120. package/dist/components/data-table-fit.d.ts +6 -4
  121. package/dist/components/data-table-fit.js +4 -1
  122. package/dist/components/data-table-fit.js.map +1 -1
  123. package/dist/components/data-table-groups.d.ts +1 -1
  124. package/dist/components/data-table-groups.js.map +1 -1
  125. package/dist/components/data-table-head.d.ts +1 -1
  126. package/dist/components/data-table-head.js +15 -12
  127. package/dist/components/data-table-head.js.map +1 -1
  128. package/dist/components/data-table-mobile.d.ts +12 -7
  129. package/dist/components/data-table-mobile.js +43 -30
  130. package/dist/components/data-table-mobile.js.map +1 -1
  131. package/dist/components/data-table-pagination.js +11 -6
  132. package/dist/components/data-table-pagination.js.map +1 -1
  133. package/dist/components/data-table-resize.d.ts +1 -1
  134. package/dist/components/data-table-resize.js.map +1 -1
  135. package/dist/components/data-table-row-actions.d.ts +2 -2
  136. package/dist/components/data-table-row-actions.js.map +1 -1
  137. package/dist/components/data-table-row.d.ts +6 -2
  138. package/dist/components/data-table-row.js +17 -10
  139. package/dist/components/data-table-row.js.map +1 -1
  140. package/dist/components/data-table-selection.d.ts +1 -1
  141. package/dist/components/data-table-selection.js.map +1 -1
  142. package/dist/components/data-table-shared.d.ts +10 -2
  143. package/dist/components/data-table-shared.js +18 -0
  144. package/dist/components/data-table-shared.js.map +1 -1
  145. package/dist/components/data-table-sort.d.ts +21 -2
  146. package/dist/components/data-table-sort.js +24 -0
  147. package/dist/components/data-table-sort.js.map +1 -1
  148. package/dist/components/data-table-virtual.d.ts +1 -1
  149. package/dist/components/data-table-virtual.js +18 -6
  150. package/dist/components/data-table-virtual.js.map +1 -1
  151. package/dist/components/data-table.d.ts +13 -4
  152. package/dist/components/data-table.js +139 -36
  153. package/dist/components/data-table.js.map +1 -1
  154. package/dist/components/date-field.d.ts +25 -3
  155. package/dist/components/date-field.js +33 -8
  156. package/dist/components/date-field.js.map +1 -1
  157. package/dist/components/date-picker.d.ts +16 -3
  158. package/dist/components/date-picker.js +55 -26
  159. package/dist/components/date-picker.js.map +1 -1
  160. package/dist/components/date-range-picker.d.ts +38 -24
  161. package/dist/components/date-range-picker.js +23 -7
  162. package/dist/components/date-range-picker.js.map +1 -1
  163. package/dist/components/error-boundary.js +37 -30
  164. package/dist/components/error-boundary.js.map +1 -1
  165. package/dist/components/{ui-labels.d.ts → field-base-labels.d.ts} +0 -2
  166. package/dist/components/{ui-labels.js → field-base-labels.js} +2 -9
  167. package/dist/components/field-base-labels.js.map +1 -0
  168. package/dist/components/field-base.d.ts +4 -3
  169. package/dist/components/field-base.js +3 -3
  170. package/dist/components/field-base.js.map +1 -1
  171. package/dist/components/form-actions.js +11 -5
  172. package/dist/components/form-actions.js.map +1 -1
  173. package/dist/components/hover-menu.d.ts +3 -0
  174. package/dist/components/hover-menu.js +5 -3
  175. package/dist/components/hover-menu.js.map +1 -1
  176. package/dist/components/icon-button.js +14 -9
  177. package/dist/components/icon-button.js.map +1 -1
  178. package/dist/components/inline-confirm.d.ts +43 -0
  179. package/dist/components/inline-confirm.js +67 -0
  180. package/dist/components/inline-confirm.js.map +1 -0
  181. package/dist/components/inline-entity-combobox.d.ts +4 -3
  182. package/dist/components/inline-entity-combobox.js +148 -140
  183. package/dist/components/inline-entity-combobox.js.map +1 -1
  184. package/dist/components/input.js +1 -1
  185. package/dist/components/input.js.map +1 -1
  186. package/dist/components/jump-calendar.js +28 -112
  187. package/dist/components/jump-calendar.js.map +1 -1
  188. package/dist/components/legal-page.d.ts +3 -1
  189. package/dist/components/legal-page.js +3 -2
  190. package/dist/components/legal-page.js.map +1 -1
  191. package/dist/components/legal.d.ts +4 -2
  192. package/dist/components/legal.js.map +1 -1
  193. package/dist/components/lightbox.d.ts +2 -2
  194. package/dist/components/lightbox.js +17 -6
  195. package/dist/components/lightbox.js.map +1 -1
  196. package/dist/components/list.d.ts +6 -2
  197. package/dist/components/list.js +3 -2
  198. package/dist/components/list.js.map +1 -1
  199. package/dist/components/measured-grid.d.ts +1 -1
  200. package/dist/components/measured-grid.js +2 -1
  201. package/dist/components/measured-grid.js.map +1 -1
  202. package/dist/components/mini-calendar.js +3 -5
  203. package/dist/components/mini-calendar.js.map +1 -1
  204. package/dist/components/modal.js +3 -1
  205. package/dist/components/modal.js.map +1 -1
  206. package/dist/components/month-grid.d.ts +55 -0
  207. package/dist/components/month-grid.js +148 -0
  208. package/dist/components/month-grid.js.map +1 -0
  209. package/dist/components/month-picker.d.ts +36 -4
  210. package/dist/components/month-picker.js +123 -146
  211. package/dist/components/month-picker.js.map +1 -1
  212. package/dist/components/multi-select.d.ts +2 -2
  213. package/dist/components/multi-select.js +11 -6
  214. package/dist/components/multi-select.js.map +1 -1
  215. package/dist/components/nav-pills.d.ts +1 -1
  216. package/dist/components/nav-pills.js.map +1 -1
  217. package/dist/components/picker-sheet.js +2 -1
  218. package/dist/components/picker-sheet.js.map +1 -1
  219. package/dist/components/pie-chart-labels.d.ts +7 -0
  220. package/dist/components/pie-chart-labels.js +1 -0
  221. package/dist/components/pie-chart-labels.js.map +1 -1
  222. package/dist/components/pie-chart.d.ts +5 -3
  223. package/dist/components/pie-chart.js +7 -22
  224. package/dist/components/pie-chart.js.map +1 -1
  225. package/dist/components/popover.d.ts +3 -0
  226. package/dist/components/popover.js +7 -1
  227. package/dist/components/popover.js.map +1 -1
  228. package/dist/components/row-actions.js +2 -1
  229. package/dist/components/row-actions.js.map +1 -1
  230. package/dist/components/series-chart-axes.d.ts +4 -4
  231. package/dist/components/series-chart-axes.js.map +1 -1
  232. package/dist/components/series-chart-labels.d.ts +7 -4
  233. package/dist/components/series-chart-labels.js.map +1 -1
  234. package/dist/components/series-chart.d.ts +92 -23
  235. package/dist/components/series-chart.js +74 -30
  236. package/dist/components/series-chart.js.map +1 -1
  237. package/dist/components/share-card.js +3 -3
  238. package/dist/components/share-card.js.map +1 -1
  239. package/dist/components/tabs-labels.d.ts +2 -0
  240. package/dist/components/tabs-labels.js +11 -0
  241. package/dist/components/tabs-labels.js.map +1 -0
  242. package/dist/components/tabs.d.ts +1 -1
  243. package/dist/components/tabs.js +1 -1
  244. package/dist/components/tabs.js.map +1 -1
  245. package/dist/components/toggle-legend.d.ts +2 -2
  246. package/dist/components/toggle-legend.js +6 -6
  247. package/dist/components/toggle-legend.js.map +1 -1
  248. package/dist/components/translation-review-editor.d.ts +4 -2
  249. package/dist/components/translation-review-editor.js +2 -3
  250. package/dist/components/translation-review-editor.js.map +1 -1
  251. package/dist/components/translation-review.d.ts +2 -1
  252. package/dist/components/translation-review.js +2 -2
  253. package/dist/components/translation-review.js.map +1 -1
  254. package/dist/components/treemap-labels.d.ts +31 -0
  255. package/dist/components/treemap-labels.js +10 -0
  256. package/dist/components/treemap-labels.js.map +1 -0
  257. package/dist/components/treemap-layout.d.ts +62 -0
  258. package/dist/components/treemap-layout.js +126 -0
  259. package/dist/components/treemap-layout.js.map +1 -0
  260. package/dist/components/treemap.d.ts +167 -19
  261. package/dist/components/treemap.js +340 -100
  262. package/dist/components/treemap.js.map +1 -1
  263. package/dist/components/use-table-state.d.ts +5 -5
  264. package/dist/components/use-table-state.js +4 -1
  265. package/dist/components/use-table-state.js.map +1 -1
  266. package/dist/data-table.d.ts +1 -2
  267. package/dist/data-table.js +1 -4
  268. package/dist/data-table.js.map +1 -1
  269. package/dist/demo/demo-countdown.d.ts +0 -5
  270. package/dist/demo/demo-countdown.js +0 -4
  271. package/dist/demo/demo-countdown.js.map +1 -1
  272. package/dist/eslint/index.js +1 -1
  273. package/dist/eslint/role-utilities.d.ts +36 -7
  274. package/dist/eslint/role-utilities.js +42 -9
  275. package/dist/eslint/role-utilities.js.map +1 -1
  276. package/dist/feedback/feedback-dialog.d.ts +25 -16
  277. package/dist/feedback/feedback-dialog.js +6 -2
  278. package/dist/feedback/feedback-dialog.js.map +1 -1
  279. package/dist/feedback/feedback-mutation.d.ts +18 -0
  280. package/dist/feedback/feedback-mutation.js +8 -0
  281. package/dist/feedback/feedback-mutation.js.map +1 -0
  282. package/dist/feedback/feedback-page-link.d.ts +53 -0
  283. package/dist/feedback/feedback-page-link.js +37 -0
  284. package/dist/feedback/feedback-page-link.js.map +1 -0
  285. package/dist/feedback/feedback-public-list.d.ts +8 -4
  286. package/dist/feedback/feedback-public-list.js +2 -2
  287. package/dist/feedback/feedback-public-list.js.map +1 -1
  288. package/dist/feedback/feedback-replies.d.ts +3 -1
  289. package/dist/feedback/feedback-replies.js +5 -4
  290. package/dist/feedback/feedback-replies.js.map +1 -1
  291. package/dist/feedback/feedback-row-detail-labels.js +0 -3
  292. package/dist/feedback/feedback-row-detail-labels.js.map +1 -1
  293. package/dist/feedback/feedback-row-detail.d.ts +33 -44
  294. package/dist/feedback/feedback-row-detail.js +28 -34
  295. package/dist/feedback/feedback-row-detail.js.map +1 -1
  296. package/dist/feedback/feedback-status-undo.d.ts +17 -14
  297. package/dist/feedback/feedback-status-undo.js +10 -15
  298. package/dist/feedback/feedback-status-undo.js.map +1 -1
  299. package/dist/feedback/feedback-submit-dialog.d.ts +1 -1
  300. package/dist/feedback/feedback-submit-dialog.js +1 -1
  301. package/dist/feedback/feedback-submit-dialog.js.map +1 -1
  302. package/dist/feedback/feedback-submit.js +9 -3
  303. package/dist/feedback/feedback-submit.js.map +1 -1
  304. package/dist/feedback/feedback-swipe.d.ts +1 -1
  305. package/dist/feedback/feedback-swipe.js.map +1 -1
  306. package/dist/feedback/feedback-table.d.ts +21 -9
  307. package/dist/feedback/feedback-table.js +45 -25
  308. package/dist/feedback/feedback-table.js.map +1 -1
  309. package/dist/feedback/feedback-thread-labels.d.ts +2 -2
  310. package/dist/feedback/feedback-thread-labels.js.map +1 -1
  311. package/dist/feedback/feedback-thread.d.ts +15 -23
  312. package/dist/feedback/feedback-thread.js +2 -1
  313. package/dist/feedback/feedback-thread.js.map +1 -1
  314. package/dist/feedback.d.ts +6 -6
  315. package/dist/feedback.js +90 -6
  316. package/dist/feedback.js.map +1 -1
  317. package/dist/hooks/use-focus-trap.d.ts +35 -0
  318. package/dist/hooks/use-focus-trap.js +6 -4
  319. package/dist/hooks/use-focus-trap.js.map +1 -1
  320. package/dist/hooks/use-hotkey.d.ts +5 -2
  321. package/dist/hooks/use-hotkey.js +5 -4
  322. package/dist/hooks/use-hotkey.js.map +1 -1
  323. package/dist/hooks/use-long-press.d.ts +7 -4
  324. package/dist/hooks/use-long-press.js +3 -0
  325. package/dist/hooks/use-long-press.js.map +1 -1
  326. package/dist/hooks/use-media-query.js +12 -4
  327. package/dist/hooks/use-media-query.js.map +1 -1
  328. package/dist/hooks/use-mounted.d.ts +22 -0
  329. package/dist/hooks/use-mounted.js +24 -0
  330. package/dist/hooks/use-mounted.js.map +1 -0
  331. package/dist/hooks/use-overlay-history.js +19 -3
  332. package/dist/hooks/use-overlay-history.js.map +1 -1
  333. package/dist/i18n/defaults.js +4 -9
  334. package/dist/i18n/defaults.js.map +1 -1
  335. package/dist/i18n/german.js +7 -18
  336. package/dist/i18n/german.js.map +1 -1
  337. package/dist/i18n/kit-labels.d.ts +9 -11
  338. package/dist/i18n/kit-labels.js.map +1 -1
  339. package/dist/i18n/locales/en.js +15 -64
  340. package/dist/i18n/locales/en.js.map +3 -3
  341. package/dist/i18n/locales/es.js +7 -18
  342. package/dist/i18n/locales/es.js.map +1 -1
  343. package/dist/i18n/locales/fr.js +20 -27
  344. package/dist/i18n/locales/fr.js.map +1 -1
  345. package/dist/i18n/locales/hu.js +9 -18
  346. package/dist/i18n/locales/hu.js.map +1 -1
  347. package/dist/i18n/locales/it.js +7 -19
  348. package/dist/i18n/locales/it.js.map +1 -1
  349. package/dist/i18n/locales/zh.js +8 -18
  350. package/dist/i18n/locales/zh.js.map +1 -1
  351. package/dist/i18n/review.js +12 -2
  352. package/dist/i18n/review.js.map +1 -1
  353. package/dist/i18n/shared-labels.js +0 -1
  354. package/dist/i18n/shared-labels.js.map +1 -1
  355. package/dist/index.d.ts +21 -23
  356. package/dist/index.js +50 -65
  357. package/dist/index.js.map +1 -1
  358. package/dist/landing/routing.d.ts +3 -1
  359. package/dist/landing/routing.js +4 -7
  360. package/dist/landing/routing.js.map +1 -1
  361. package/dist/lib/broadcast.d.ts +17 -0
  362. package/dist/lib/broadcast.js +30 -0
  363. package/dist/lib/broadcast.js.map +1 -0
  364. package/dist/lib/date-format.d.ts +37 -2
  365. package/dist/lib/date-format.js +34 -8
  366. package/dist/lib/date-format.js.map +1 -1
  367. package/dist/lib/day-format.d.ts +46 -0
  368. package/dist/lib/day-format.js +46 -0
  369. package/dist/lib/day-format.js.map +1 -0
  370. package/dist/lib/describe-failure.d.ts +14 -0
  371. package/dist/lib/describe-failure.js +9 -0
  372. package/dist/lib/describe-failure.js.map +1 -0
  373. package/dist/lib/direction.d.ts +16 -0
  374. package/dist/lib/direction.js +9 -1
  375. package/dist/lib/direction.js.map +1 -1
  376. package/dist/lib/focus-left.d.ts +63 -0
  377. package/dist/lib/focus-left.js +67 -0
  378. package/dist/lib/focus-left.js.map +1 -0
  379. package/dist/lib/format.js +5 -14
  380. package/dist/lib/format.js.map +1 -1
  381. package/dist/lib/http-status.d.ts +24 -0
  382. package/dist/lib/http-status.js +14 -0
  383. package/dist/lib/http-status.js.map +1 -0
  384. package/dist/lib/intl-cache.d.ts +14 -0
  385. package/dist/lib/intl-cache.js +15 -0
  386. package/dist/lib/intl-cache.js.map +1 -0
  387. package/dist/lib/iso-day.d.ts +11 -0
  388. package/dist/lib/iso-day.js +8 -0
  389. package/dist/lib/iso-day.js.map +1 -0
  390. package/dist/lib/lazy-with-fallback.d.ts +31 -0
  391. package/dist/lib/lazy-with-fallback.js +40 -0
  392. package/dist/lib/lazy-with-fallback.js.map +1 -0
  393. package/dist/lib/path-pattern.d.ts +34 -0
  394. package/dist/lib/path-pattern.js +24 -0
  395. package/dist/lib/path-pattern.js.map +1 -0
  396. package/dist/lib/reduced-motion.d.ts +2 -1
  397. package/dist/lib/reduced-motion.js.map +1 -1
  398. package/dist/lib/round.d.ts +2 -1
  399. package/dist/lib/round.js +2 -1
  400. package/dist/lib/round.js.map +1 -1
  401. package/dist/lib/safe-storage.d.ts +24 -5
  402. package/dist/lib/safe-storage.js +27 -2
  403. package/dist/lib/safe-storage.js.map +1 -1
  404. package/dist/lib/session-refresh.js +1 -1
  405. package/dist/lib/session-refresh.js.map +1 -1
  406. package/dist/lib/share-format.d.ts +13 -0
  407. package/dist/lib/share-format.js +10 -0
  408. package/dist/lib/share-format.js.map +1 -0
  409. package/dist/lib/text-case.d.ts +17 -0
  410. package/dist/lib/text-case.js +8 -0
  411. package/dist/lib/text-case.js.map +1 -0
  412. package/dist/lib/text-match.d.ts +29 -0
  413. package/dist/lib/text-match.js +20 -2
  414. package/dist/lib/text-match.js.map +1 -1
  415. package/dist/lib/thenable.d.ts +13 -0
  416. package/dist/lib/thenable.js +8 -0
  417. package/dist/lib/thenable.js.map +1 -0
  418. package/dist/lib/translation-review.d.ts +7 -2
  419. package/dist/lib/translation-review.js +4 -4
  420. package/dist/lib/translation-review.js.map +1 -1
  421. package/dist/notifications/device-zone-report.js +1 -1
  422. package/dist/notifications/device-zone-report.js.map +1 -1
  423. package/dist/notifications/notification-bell.d.ts +2 -1
  424. package/dist/notifications/notification-bell.js +3 -3
  425. package/dist/notifications/notification-bell.js.map +1 -1
  426. package/dist/notifications/notification-inbox.d.ts +10 -6
  427. package/dist/notifications/notification-inbox.js +26 -48
  428. package/dist/notifications/notification-inbox.js.map +1 -1
  429. package/dist/notifications/notification-parts.d.ts +3 -2
  430. package/dist/notifications/notification-parts.js +1 -3
  431. package/dist/notifications/notification-parts.js.map +1 -1
  432. package/dist/notifications/notification-types-setting.js +1 -1
  433. package/dist/notifications/notification-types-setting.js.map +1 -1
  434. package/dist/notifications/notifications-labels.d.ts +6 -0
  435. package/dist/notifications/notifications-labels.js +1 -0
  436. package/dist/notifications/notifications-labels.js.map +1 -1
  437. package/dist/notifications/push-device-setting.js +1 -1
  438. package/dist/notifications/push-device-setting.js.map +1 -1
  439. package/dist/notifications/push-devices-setting.d.ts +2 -1
  440. package/dist/notifications/push-devices-setting.js +27 -49
  441. package/dist/notifications/push-devices-setting.js.map +1 -1
  442. package/dist/notifications/quiet-hours-setting.d.ts +10 -3
  443. package/dist/notifications/quiet-hours-setting.js +65 -26
  444. package/dist/notifications/quiet-hours-setting.js.map +1 -1
  445. package/dist/notifications/unsubscribe-panel.js +4 -7
  446. package/dist/notifications/unsubscribe-panel.js.map +1 -1
  447. package/dist/notifications/use-push-device.d.ts +39 -1
  448. package/dist/notifications/use-push-device.js +28 -7
  449. package/dist/notifications/use-push-device.js.map +1 -1
  450. package/dist/offline/query-persistence.d.ts +3 -1
  451. package/dist/offline/query-persistence.js +19 -2
  452. package/dist/offline/query-persistence.js.map +1 -1
  453. package/dist/rhf/fields.d.ts +11 -4
  454. package/dist/rhf/fields.js.map +1 -1
  455. package/dist/search/command-palette.js +1 -1
  456. package/dist/search/command-palette.js.map +1 -1
  457. package/dist/search/global-search.js +19 -9
  458. package/dist/search/global-search.js.map +1 -1
  459. package/dist/search/search-index.d.ts +0 -6
  460. package/dist/search/search-index.js +0 -4
  461. package/dist/search/search-index.js.map +1 -1
  462. package/dist/search/use-command-key.d.ts +12 -1
  463. package/dist/search/use-command-key.js +3 -12
  464. package/dist/search/use-command-key.js.map +1 -1
  465. package/dist/search.d.ts +1 -1
  466. package/dist/search.js +6 -1
  467. package/dist/search.js.map +1 -1
  468. package/dist/settings/use-settings-focus.js +1 -0
  469. package/dist/settings/use-settings-focus.js.map +1 -1
  470. package/dist/shell/account-menu-language.d.ts +5 -3
  471. package/dist/shell/account-menu-language.js +2 -2
  472. package/dist/shell/account-menu-language.js.map +1 -1
  473. package/dist/shell/account-menu-text-size.d.ts +9 -6
  474. package/dist/shell/account-menu-text-size.js +2 -2
  475. package/dist/shell/account-menu-text-size.js.map +1 -1
  476. package/dist/shell/app-shell.d.ts +0 -10
  477. package/dist/shell/app-shell.js +1 -7
  478. package/dist/shell/app-shell.js.map +1 -1
  479. package/dist/shell/company-switcher.d.ts +1 -1
  480. package/dist/shell/company-switcher.js.map +1 -1
  481. package/dist/shell/dev-menu.d.ts +1 -1
  482. package/dist/shell/dev-menu.js +5 -18
  483. package/dist/shell/dev-menu.js.map +1 -1
  484. package/dist/shell/top-bar-actions.d.ts +1 -1
  485. package/dist/shell/top-bar-actions.js.map +1 -1
  486. package/dist/shell/top-bar-parts-labels.d.ts +1 -3
  487. package/dist/shell/top-bar-parts-labels.js +0 -1
  488. package/dist/shell/top-bar-parts-labels.js.map +1 -1
  489. package/dist/shell.d.ts +7 -10
  490. package/dist/shell.js +14 -23
  491. package/dist/shell.js.map +1 -1
  492. package/dist/sync/engine.d.ts +30 -4
  493. package/dist/sync/engine.js +172 -52
  494. package/dist/sync/engine.js.map +1 -1
  495. package/dist/sync.d.ts +2 -2
  496. package/dist/sync.js +2 -10
  497. package/dist/sync.js.map +1 -1
  498. package/dist/testing/css-variables.js +3 -8
  499. package/dist/testing/css-variables.js.map +1 -1
  500. package/dist/theme/chart-palette.d.ts +0 -5
  501. package/dist/theme/chart-palette.js +0 -2
  502. package/dist/theme/chart-palette.js.map +1 -1
  503. package/dist/theme/contrast.d.ts +2 -1
  504. package/dist/theme/contrast.js +3 -8
  505. package/dist/theme/contrast.js.map +1 -1
  506. package/dist/theme/palette-store.js +6 -6
  507. package/dist/theme/palette-store.js.map +1 -1
  508. package/dist/theme/text-size.js +3 -8
  509. package/dist/theme/text-size.js.map +1 -1
  510. package/dist/theme/theme-store.js +3 -6
  511. package/dist/theme/theme-store.js.map +1 -1
  512. package/dist/tour/tour-catalogue.d.ts +7 -4
  513. package/dist/tour/tour-catalogue.js +12 -10
  514. package/dist/tour/tour-catalogue.js.map +1 -1
  515. package/dist/tour/tour-dock.d.ts +0 -2
  516. package/dist/tour/tour-dock.js +0 -2
  517. package/dist/tour/tour-dock.js.map +1 -1
  518. package/dist/tour/tour-gates.d.ts +4 -0
  519. package/dist/tour/tour-gates.js +14 -0
  520. package/dist/tour/tour-gates.js.map +1 -1
  521. package/dist/tour/tour-overlay.d.ts +27 -0
  522. package/dist/tour/tour-overlay.js +741 -0
  523. package/dist/tour/tour-overlay.js.map +1 -0
  524. package/dist/tour/tour.d.ts +13 -3
  525. package/dist/tour/tour.js +59 -781
  526. package/dist/tour/tour.js.map +1 -1
  527. package/dist/tour/use-tour-progress.js +1 -1
  528. package/dist/tour/use-tour-progress.js.map +1 -1
  529. package/dist/wizard/stepper-nav.d.ts +5 -1
  530. package/dist/wizard/stepper-nav.js.map +1 -1
  531. package/dist/wizard/types.d.ts +6 -2
  532. package/dist/wizard/types.js.map +1 -1
  533. package/dist/wizard/use-wizard.d.ts +3 -1
  534. package/dist/wizard/use-wizard.js.map +1 -1
  535. package/dist/wizard/validation.d.ts +3 -1
  536. package/dist/wizard/validation.js.map +1 -1
  537. package/package.json +10 -6
  538. package/src/account/account-parts.ts +5 -25
  539. package/src/account/data-export-setting-labels.ts +1 -1
  540. package/src/account/delete-account-setting-labels.ts +1 -1
  541. package/src/account/email-change-setting-labels.ts +1 -1
  542. package/src/account/passkeys-setting.tsx +60 -38
  543. package/src/account/sessions-setting.tsx +18 -12
  544. package/src/admin/admin-action-confirm.tsx +1 -5
  545. package/src/admin/admin-parts.ts +11 -25
  546. package/src/admin/mail-test-card-labels.ts +1 -1
  547. package/src/admin/plan-change-labels.ts +5 -23
  548. package/src/admin/plan-change.tsx +7 -44
  549. package/src/admin/reviewer-scope-editor.tsx +3 -3
  550. package/src/auth/auth-errors-labels.ts +23 -0
  551. package/src/auth/auth-errors.ts +11 -38
  552. package/src/auth/complete-name-dialog.tsx +4 -1
  553. package/src/auth/forgot-password-form-labels.ts +1 -1
  554. package/src/auth/forgot-password-form.tsx +11 -6
  555. package/src/auth/register-form-labels.ts +1 -1
  556. package/src/auth/reset-password-form-labels.ts +1 -1
  557. package/src/auth/reset-password-form.tsx +8 -4
  558. package/src/auth/sign-in-form-labels.ts +1 -1
  559. package/src/auth/status-parts.tsx +0 -6
  560. package/src/auth/verify-email-labels.ts +1 -1
  561. package/src/auth/verify-email.tsx +11 -6
  562. package/src/billing/cancel-subscription.tsx +15 -12
  563. package/src/billing/plan-card.tsx +18 -10
  564. package/src/billing/plan-change-labels.ts +66 -0
  565. package/src/billing/plan-switch.tsx +15 -12
  566. package/src/chart.ts +73 -6
  567. package/src/components/account-chips.tsx +20 -23
  568. package/src/components/alert-banner.tsx +82 -5
  569. package/src/components/amount-input.tsx +18 -7
  570. package/src/components/autocomplete.tsx +64 -70
  571. package/src/components/bulk-action-bar.tsx +70 -2
  572. package/src/components/button-look.ts +5 -5
  573. package/src/components/button.tsx +2 -2
  574. package/src/components/chart-edge.ts +34 -1
  575. package/src/components/chart-figure.tsx +35 -0
  576. package/src/components/chart-zoom-core.tsx +6 -5
  577. package/src/components/chart.tsx +26 -5
  578. package/src/components/combobox-core.tsx +293 -62
  579. package/src/components/combobox.tsx +183 -153
  580. package/src/components/copy-button.tsx +34 -23
  581. package/src/components/country-select.tsx +16 -11
  582. package/src/components/data-table-column-settings.tsx +52 -10
  583. package/src/components/data-table-filters.ts +6 -4
  584. package/src/components/data-table-fit.ts +19 -5
  585. package/src/components/data-table-groups.tsx +1 -1
  586. package/src/components/data-table-head.tsx +32 -22
  587. package/src/components/data-table-mobile.tsx +61 -26
  588. package/src/components/data-table-pagination.tsx +21 -6
  589. package/src/components/data-table-resize.ts +1 -1
  590. package/src/components/data-table-row-actions.tsx +3 -3
  591. package/src/components/data-table-row.tsx +25 -14
  592. package/src/components/data-table-selection.ts +1 -1
  593. package/src/components/data-table-shared.tsx +33 -1
  594. package/src/components/data-table-sort.ts +57 -2
  595. package/src/components/data-table-virtual.ts +32 -8
  596. package/src/components/data-table.tsx +239 -68
  597. package/src/components/date-field.tsx +66 -9
  598. package/src/components/date-picker.tsx +125 -49
  599. package/src/components/date-range-picker.tsx +71 -36
  600. package/src/components/error-boundary.tsx +53 -39
  601. package/src/components/field-base-labels.ts +20 -0
  602. package/src/components/field-base.tsx +13 -7
  603. package/src/components/form-actions.tsx +20 -5
  604. package/src/components/hover-menu.tsx +18 -8
  605. package/src/components/icon-button.tsx +14 -9
  606. package/src/components/inline-confirm.tsx +116 -0
  607. package/src/components/inline-entity-combobox.tsx +197 -153
  608. package/src/components/input.tsx +1 -1
  609. package/src/components/jump-calendar.tsx +30 -146
  610. package/src/components/legal-page.tsx +10 -7
  611. package/src/components/legal.tsx +4 -2
  612. package/src/components/lightbox.tsx +21 -8
  613. package/src/components/list.tsx +10 -4
  614. package/src/components/measured-grid.tsx +8 -4
  615. package/src/components/mini-calendar.tsx +6 -5
  616. package/src/components/modal.tsx +6 -1
  617. package/src/components/month-grid.tsx +229 -0
  618. package/src/components/month-picker.tsx +192 -200
  619. package/src/components/multi-select.tsx +21 -9
  620. package/src/components/nav-pills.tsx +1 -1
  621. package/src/components/picker-sheet.tsx +12 -9
  622. package/src/components/pie-chart-labels.ts +8 -0
  623. package/src/components/pie-chart.tsx +22 -28
  624. package/src/components/popover.tsx +18 -1
  625. package/src/components/row-actions.tsx +2 -1
  626. package/src/components/series-chart-axes.ts +9 -4
  627. package/src/components/series-chart-labels.ts +7 -4
  628. package/src/components/series-chart.tsx +253 -87
  629. package/src/components/share-card.tsx +6 -6
  630. package/src/components/tabs-labels.ts +13 -0
  631. package/src/components/tabs.tsx +2 -2
  632. package/src/components/toggle-legend.tsx +16 -11
  633. package/src/components/translation-review-editor.tsx +6 -5
  634. package/src/components/translation-review.tsx +4 -3
  635. package/src/components/treemap-labels.ts +47 -0
  636. package/src/components/treemap-layout.ts +210 -0
  637. package/src/components/treemap.tsx +780 -138
  638. package/src/components/use-table-state.ts +12 -9
  639. package/src/data-table.ts +1 -4
  640. package/src/demo/demo-countdown.ts +3 -8
  641. package/src/eslint/role-utilities.ts +97 -19
  642. package/src/feedback/feedback-dialog.tsx +30 -19
  643. package/src/feedback/feedback-mutation.ts +20 -0
  644. package/src/feedback/feedback-page-link.ts +90 -0
  645. package/src/feedback/feedback-public-list.tsx +13 -7
  646. package/src/feedback/feedback-replies.tsx +13 -6
  647. package/src/feedback/feedback-row-detail-labels.ts +0 -3
  648. package/src/feedback/feedback-row-detail.tsx +70 -84
  649. package/src/feedback/feedback-status-undo.ts +28 -28
  650. package/src/feedback/feedback-submit-dialog.tsx +2 -2
  651. package/src/feedback/feedback-submit.tsx +21 -7
  652. package/src/feedback/feedback-swipe.tsx +1 -1
  653. package/src/feedback/feedback-table.tsx +86 -38
  654. package/src/feedback/feedback-thread-labels.ts +2 -2
  655. package/src/feedback/feedback-thread.tsx +18 -26
  656. package/src/feedback.ts +89 -6
  657. package/src/hooks/use-focus-trap.ts +8 -24
  658. package/src/hooks/use-hotkey.ts +24 -7
  659. package/src/hooks/use-long-press.ts +16 -2
  660. package/src/hooks/use-media-query.ts +20 -4
  661. package/src/hooks/use-mounted.ts +39 -0
  662. package/src/hooks/use-overlay-history.ts +32 -3
  663. package/src/i18n/defaults.ts +4 -9
  664. package/src/i18n/german.ts +8 -19
  665. package/src/i18n/kit-labels.tsx +9 -11
  666. package/src/i18n/locales/es.ts +8 -19
  667. package/src/i18n/locales/fr.ts +21 -30
  668. package/src/i18n/locales/hu.ts +10 -19
  669. package/src/i18n/locales/it.ts +8 -20
  670. package/src/i18n/locales/zh.ts +9 -19
  671. package/src/i18n/review.ts +12 -2
  672. package/src/i18n/shared-labels.ts +0 -1
  673. package/src/index.ts +57 -49
  674. package/src/landing/routing.tsx +14 -10
  675. package/src/lib/broadcast.ts +52 -0
  676. package/src/lib/date-format.ts +89 -13
  677. package/src/lib/day-format.ts +96 -0
  678. package/src/lib/describe-failure.ts +18 -0
  679. package/src/lib/direction.ts +39 -0
  680. package/src/lib/focus-left.ts +156 -0
  681. package/src/lib/format.ts +5 -17
  682. package/src/lib/http-status.ts +38 -0
  683. package/src/lib/intl-cache.ts +25 -0
  684. package/src/lib/iso-day.ts +13 -0
  685. package/src/lib/lazy-with-fallback.ts +82 -0
  686. package/src/lib/path-pattern.ts +55 -0
  687. package/src/lib/reduced-motion.ts +2 -1
  688. package/src/lib/round.ts +7 -2
  689. package/src/lib/safe-storage.ts +48 -6
  690. package/src/lib/session-refresh.ts +1 -1
  691. package/src/lib/share-format.ts +18 -0
  692. package/src/lib/text-case.ts +19 -0
  693. package/src/lib/text-match.ts +57 -2
  694. package/src/lib/thenable.ts +19 -0
  695. package/src/lib/translation-review.ts +13 -5
  696. package/src/notifications/device-zone-report.ts +1 -1
  697. package/src/notifications/notification-bell.tsx +7 -4
  698. package/src/notifications/notification-inbox.tsx +40 -58
  699. package/src/notifications/notification-parts.tsx +3 -4
  700. package/src/notifications/notification-types-setting.tsx +1 -1
  701. package/src/notifications/notifications-labels.ts +7 -0
  702. package/src/notifications/push-device-setting.tsx +1 -1
  703. package/src/notifications/push-devices-setting.tsx +30 -55
  704. package/src/notifications/quiet-hours-setting.tsx +93 -31
  705. package/src/notifications/unsubscribe-panel.tsx +4 -7
  706. package/src/notifications/use-push-device.ts +76 -10
  707. package/src/offline/query-persistence.ts +35 -3
  708. package/src/rhf/fields.tsx +11 -4
  709. package/src/search/command-palette.tsx +2 -4
  710. package/src/search/global-search.tsx +36 -15
  711. package/src/search/search-index.ts +0 -15
  712. package/src/search/use-command-key.ts +13 -12
  713. package/src/search.ts +10 -1
  714. package/src/settings/use-settings-focus.ts +3 -0
  715. package/src/shell/account-menu-language.tsx +6 -4
  716. package/src/shell/account-menu-text-size.tsx +10 -7
  717. package/src/shell/app-shell.tsx +0 -13
  718. package/src/shell/company-switcher.tsx +1 -1
  719. package/src/shell/dev-menu.tsx +8 -22
  720. package/src/shell/top-bar-actions.tsx +1 -1
  721. package/src/shell/top-bar-parts-labels.ts +1 -4
  722. package/src/shell.ts +21 -17
  723. package/src/sync/engine.ts +339 -61
  724. package/src/sync.ts +2 -8
  725. package/src/testing/css-variables.ts +8 -9
  726. package/src/theme/chart-palette.ts +0 -2
  727. package/src/theme/contrast.ts +8 -9
  728. package/src/theme/palette-store.ts +9 -9
  729. package/src/theme/text-size.ts +6 -8
  730. package/src/theme/theme-store.ts +7 -9
  731. package/src/tour/tour-catalogue.tsx +26 -15
  732. package/src/tour/tour-dock.ts +0 -2
  733. package/src/tour/tour-gates.ts +23 -0
  734. package/src/tour/tour-overlay.tsx +1170 -0
  735. package/src/tour/tour.tsx +108 -1202
  736. package/src/tour/use-tour-progress.ts +1 -1
  737. package/src/wizard/stepper-nav.tsx +3 -1
  738. package/src/wizard/types.ts +11 -2
  739. package/src/wizard/use-wizard.ts +2 -1
  740. package/src/wizard/validation.ts +8 -2
  741. package/tokens.css +6 -5
  742. package/dist/components/field-sync-labels.d.ts +0 -2
  743. package/dist/components/field-sync-labels.js +0 -12
  744. package/dist/components/field-sync-labels.js.map +0 -1
  745. package/dist/components/field-sync.d.ts +0 -164
  746. package/dist/components/field-sync.js +0 -269
  747. package/dist/components/field-sync.js.map +0 -1
  748. package/dist/components/section-nav.d.ts +0 -37
  749. package/dist/components/section-nav.js +0 -33
  750. package/dist/components/section-nav.js.map +0 -1
  751. package/dist/components/sign-chip-labels.d.ts +0 -2
  752. package/dist/components/sign-chip-labels.js +0 -11
  753. package/dist/components/sign-chip-labels.js.map +0 -1
  754. package/dist/components/sign-chip.d.ts +0 -68
  755. package/dist/components/sign-chip.js +0 -47
  756. package/dist/components/sign-chip.js.map +0 -1
  757. package/dist/components/ui-labels.js.map +0 -1
  758. package/dist/lib/isin.d.ts +0 -28
  759. package/dist/lib/isin.js +0 -36
  760. package/dist/lib/isin.js.map +0 -1
  761. package/dist/shell/dev-switchers.d.ts +0 -6
  762. package/dist/shell/dev-switchers.js +0 -12
  763. package/dist/shell/dev-switchers.js.map +0 -1
  764. package/dist/shell/role-switcher.d.ts +0 -21
  765. package/dist/shell/role-switcher.js +0 -31
  766. package/dist/shell/role-switcher.js.map +0 -1
  767. package/src/components/field-sync-labels.ts +0 -13
  768. package/src/components/field-sync.tsx +0 -482
  769. package/src/components/section-nav.tsx +0 -65
  770. package/src/components/sign-chip-labels.ts +0 -12
  771. package/src/components/sign-chip.tsx +0 -124
  772. package/src/components/ui-labels.ts +0 -24
  773. package/src/lib/isin.ts +0 -62
  774. package/src/shell/dev-switchers.tsx +0 -18
  775. package/src/shell/role-switcher.tsx +0 -46
@@ -1 +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) => 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,SAAO,WAAW,GAAG,IAAI,MAAM;AACjC;AAGO,SAAS,YAAY,EAAE,SAAS,GAA4B;AACjE,MAAI,CAAC,WAAW,QAAQ,EAAG,QAAO;AAClC,SACE,oBAAC,eAAY,MAAK,UAAS,MAAK,MAAK,MAAK,SACvC,UACH;AAEJ;AAwBO,SAAS,gBAAmB,QAAkC;AACnE,QAAM,CAAC,SAAS,UAAU,IAAI,SAA8D,oBAAI,IAAI,CAAC;AACrG,QAAM,CAAC,MAAM,OAAO,IAAI,SAAS,MAAM;AACvC,MAAI,SAAS,QAAQ;AACnB,YAAQ,MAAM;AACd,UAAM,OAAO,IAAI,IAAI,CAAC,GAAG,OAAO,EAAE,OAAO,CAAC,CAAC,EAAE,KAAK,MAAM,MAAM,OAAO,CAAC;AACtE,QAAI,KAAK,SAAS,QAAQ,KAAM,YAAW,IAAI;AAAA,EACjD;AACA,SAAO;AAAA,IACL,KAAK,CAAC,QAAgB,QAAQ,IAAI,GAAG;AAAA,IACrC,KAAK,CAAC,QAAgB,QAAQ,IAAI,GAAG,GAAG;AAAA,IACxC,SAAS,CAAC,QAAgB,QAAQ,IAAI,GAAG,GAAG,YAAY;AAAA,IACxD,KAAK,CAAC,KAAa,UAAa,WAAW,CAAC,YAAY,IAAI,IAAI,OAAO,EAAE,IAAI,KAAK,EAAE,OAAO,SAAS,KAAK,CAAC,CAAC;AAAA,IAC3G,QAAQ,CAAC,KAAa,OACpB,WAAW,CAAC,YAAY;AACtB,YAAM,QAAQ,QAAQ,IAAI,GAAG;AAC7B,UAAI,CAAC,MAAO,QAAO;AACnB,YAAM,OAAO,IAAI,IAAI,OAAO;AAC5B,UAAI,GAAI,MAAK,IAAI,KAAK,EAAE,OAAO,MAAM,OAAO,SAAS,MAAM,CAAC;AAAA,UACvD,MAAK,OAAO,GAAG;AACpB,aAAO;AAAA,IACT,CAAC;AAAA,EACL;AACF;","names":[]}
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` — in lib/ since 0.52, for the auth forms\n * too (refactor audit 2026-10-30, DUP-14). */\nexport { describeFailure } from \"../lib/describe-failure\";\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) => 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":";AA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,MAAM,OAAO,SAAS,MAAM,CAAC;AAAA,UACvD,MAAK,OAAO,GAAG;AACpB,aAAO;AAAA,IACT,CAAC;AAAA,EACL;AACF;","names":[]}
@@ -12,7 +12,7 @@ import { COMMIT_EXCEPT_BILLING } from "../components/write-lock.js";
12
12
  import { usePhoneLayout } from "../hooks/use-breakpoint.js";
13
13
  import { CARD_DESCRIPTION_CLASS } from "../settings/settings-card-classes.js";
14
14
  import { SettingsCardTitle } from "../settings/settings-heading.js";
15
- import { settle, useMounted } from "../account/account-parts.js";
15
+ import { settle, useMounted } from "../hooks/use-mounted.js";
16
16
  import { describeFailure, FailureLine, useNotificationsLabels, useWriteOverlay } from "./notification-parts.js";
17
17
  function devChecks() {
18
18
  return Boolean(import.meta.env?.DEV);
@@ -1 +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 { usePhoneLayout } from \"../hooks/use-breakpoint\";\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 NotificationChannel,\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> extends Omit<\n ComponentPropsWithRef<\"div\">,\n \"children\" | \"onChange\"\n> {\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: NotificationChannel) => `${id}.${channel}`;\nconst CADENCE_KEY = \"digest_cadence\";\n\n/** The grid of a several-channel row on a wide screen: the type's words, then one narrow\n * column per channel drawn. Literal classes, so Tailwind's scan finds them. */\nconst COLUMN_GRID: Record<number, string> = {\n 1: \"grid-cols-[minmax(0,1fr)_4.5rem]\",\n 2: \"grid-cols-[minmax(0,1fr)_repeat(2,4.5rem)]\",\n 3: \"grid-cols-[minmax(0,1fr)_repeat(3,4.5rem)]\",\n};\n\n/** The channels in the card's column order (§10.2). */\nconst CHANNELS: readonly NotificationChannel[] = [\"app\", \"push\", \"email\"];\n\n/** The channels a type offers: every one the server did not answer `null` (or leave out,\n * as `push` before server-kit 0.16). */\nconst channelsOf = (switches: NotificationSwitches): NotificationChannel[] =>\n CHANNELS.filter((channel) => switches[channel] !== null && switches[channel] !== undefined);\n\n/**\n * What the person hears about, and how (docs/notifications-harmonization.md §2.1–§2.3,\n * §4.2, §10.2): one row per type the SERVER answered, the app's words on it, and a switch\n * per channel the type offers — \"In the app\", \"Push\", \"E-mail\". On a wide screen they are\n * narrow columns under those headings; on a phone they stack under the type's label. A\n * channel the server answers `null` is not drawn (kastlan and KS offer no push; KS no\n * \"in the app\"), and a row with one channel keeps a single switch named by the type\n * (Kurvenschmiede's e-mail-only rows).\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 phone = usePhoneLayout();\n const rowOf = (id: Id): Row<Id> | null => {\n const switches = value?.[id];\n const entry = entries.get(id);\n if (!switches || !entry || channelsOf(switches).length === 0) 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: NotificationChannel, server: boolean): boolean => {\n const key = switchKey(id, channel);\n return overlay.get(key) ?? server;\n };\n const channelOn = ({ entry, switches }: Row<Id>, channel: NotificationChannel) =>\n shown(entry.id, channel, switches[channel] === true);\n /** The type reaches the person at all: some channel is on (the cadence and the app's\n * extra show then). */\n const rowOn = (row: Row<Id>) => channelsOf(row.switches).some((channel) => channelOn(row, channel));\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: NotificationChannel, 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 channelLabel: Record<NotificationChannel, string> = {\n app: labels.channelApp,\n push: labels.channelPush,\n email: labels.channelEmail,\n };\n /** The columns on a wide screen: every channel some several-channel row offers. */\n const drawnRows =\n value && !loading ? rowsOf(groups ? groups.flatMap((group) => group.types) : types.map((entry) => entry.id)) : [];\n const multi = drawnRows.filter((row) => channelsOf(row.switches).length > 1);\n const columns = CHANNELS.filter((channel) => multi.some((row) => channelsOf(row.switches).includes(channel)));\n const columnHeadings =\n !phone && columns.length > 0 ? (\n // The switches carry the channel's name themselves; the headings are for the eye.\n <div aria-hidden className={cn(\"grid gap-x-2\", COLUMN_GRID[columns.length])} data-channel-headings=\"\">\n <span />\n {columns.map((channel) => (\n <span key={channel} className=\"text-center text-caption font-medium text-muted\">\n {channelLabel[channel]}\n </span>\n ))}\n </div>\n ) : null;\n\n const renderRow = (row: Row<Id>) => {\n const { entry, switches } = row;\n const on = rowOn(row);\n const offered = channelsOf(switches);\n const single = offered.length === 1 ? offered[0] : 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 below =\n cadenceSelect || hasContent(extra) ? (\n <div className=\"ps-4 space-y-2\">\n {cadenceSelect}\n {extra}\n </div>\n ) : null;\n\n // One channel: today's single switch, named by the type (KS's e-mail-only rows).\n if (single) {\n const description =\n single === \"email\" && unverifiedLine ? (\n <>\n {entry.description !== undefined && <span className=\"block\">{entry.description}</span>}\n {unverifiedLine}\n </>\n ) : (\n entry.description\n );\n return (\n <div key={entry.id} data-notification-type={entry.id} data-channels={single} className=\"space-y-2\">\n <Switch\n label={entry.label}\n description={description}\n checked={channelOn(row, single)}\n disabled={disabled}\n commit={COMMIT_EXCEPT_BILLING}\n onCheckedChange={(next) => flip(entry.id, single, next)}\n />\n {below}\n </div>\n );\n }\n\n // Several channels: a group named by its type, a switch per channel — columns on a\n // wide screen (the headings above the list name them), stacked on a phone.\n const labelId = `${groupId}-type-${entry.id}`;\n const unverifiedId = `${groupId}-unverified-${entry.id}`;\n const channelSwitch = (channel: NotificationChannel) => (\n <Switch\n key={channel}\n size=\"sm\"\n label={phone ? channelLabel[channel] : undefined}\n aria-label={phone ? undefined : channelLabel[channel]}\n description={phone && channel === \"email\" ? (unverifiedLine ?? undefined) : undefined}\n aria-describedby={!phone && channel === \"email\" && unverifiedLine ? unverifiedId : undefined}\n checked={channelOn(row, channel)}\n disabled={disabled}\n commit={COMMIT_EXCEPT_BILLING}\n onCheckedChange={(next) => flip(entry.id, channel, next)}\n data-channel={channel}\n />\n );\n const text = (\n <div className=\"min-w-0\">\n <div id={labelId} className=\"text-sm font-medium text-primary\">\n {entry.label}\n </div>\n {(entry.description !== undefined || (!phone && offered.includes(\"email\") && unverifiedLine)) && (\n <div className={CARD_DESCRIPTION_CLASS}>\n {entry.description !== undefined && <span className=\"block\">{entry.description}</span>}\n {!phone && offered.includes(\"email\") && <span id={unverifiedId}>{unverifiedLine}</span>}\n </div>\n )}\n </div>\n );\n return (\n <div\n key={entry.id}\n data-notification-type={entry.id}\n data-channels={offered.join(\" \")}\n role=\"group\"\n aria-labelledby={labelId}\n className=\"space-y-2\"\n >\n {phone ? (\n <>\n {text}\n <div className=\"ps-4 space-y-2\" data-stacked=\"\">\n {offered.map(channelSwitch)}\n </div>\n </>\n ) : (\n <div className={cn(\"grid items-start gap-x-2\", COLUMN_GRID[columns.length])}>\n {text}\n {columns.map((channel) => (\n <div key={channel} className=\"flex justify-center pt-0.5\">\n {offered.includes(channel) ? channelSwitch(channel) : null}\n </div>\n ))}\n </div>\n )}\n {below}\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.map((group) => ({ group, rows: rowsOf(group.types) })).filter(({ rows }) => rows.length > 0);\n body =\n drawn.length === 0 ? (\n <p className={CARD_DESCRIPTION_CLASS}>{labels.typesEmpty}</p>\n ) : (\n <>\n {columnHeadings}\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 );\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\">\n {columnHeadings}\n {rows.map(renderRow)}\n </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":";AAkNI,SA+DM,UA/DN,KAkBE,YAlBF;AAlNJ,SAAS,OAAO,gBAAgB;AAIhC,SAAS,UAA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AAA,MAEJ,CAAC;AAAA,OACH;AAAA,EAEN,OAAO;AACL,UAAM,OAAO,OAAO,MAAM,IAAI,CAAC,UAAU,MAAM,EAAE,CAAC;AAClD,WACE,KAAK,WAAW,IACd,oBAAC,OAAE,WAAW,wBAAyB,iBAAO,YAAW,IAEzD,qBAAC,SAAI,WAAU,aACZ;AAAA;AAAA,MACA,KAAK,IAAI,SAAS;AAAA,OACrB;AAAA,EAEN;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":[]}
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 { usePhoneLayout } from \"../hooks/use-breakpoint\";\nimport { CARD_DESCRIPTION_CLASS } from \"../settings/settings-card-classes\";\nimport { SettingsCardTitle } from \"../settings/settings-heading\";\nimport { settle, useMounted } from \"../hooks/use-mounted\";\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 NotificationChannel,\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> extends Omit<\n ComponentPropsWithRef<\"div\">,\n \"children\" | \"onChange\"\n> {\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: NotificationChannel) => `${id}.${channel}`;\nconst CADENCE_KEY = \"digest_cadence\";\n\n/** The grid of a several-channel row on a wide screen: the type's words, then one narrow\n * column per channel drawn. Literal classes, so Tailwind's scan finds them. */\nconst COLUMN_GRID: Record<number, string> = {\n 1: \"grid-cols-[minmax(0,1fr)_4.5rem]\",\n 2: \"grid-cols-[minmax(0,1fr)_repeat(2,4.5rem)]\",\n 3: \"grid-cols-[minmax(0,1fr)_repeat(3,4.5rem)]\",\n};\n\n/** The channels in the card's column order (§10.2). */\nconst CHANNELS: readonly NotificationChannel[] = [\"app\", \"push\", \"email\"];\n\n/** The channels a type offers: every one the server did not answer `null` (or leave out,\n * as `push` before server-kit 0.16). */\nconst channelsOf = (switches: NotificationSwitches): NotificationChannel[] =>\n CHANNELS.filter((channel) => switches[channel] !== null && switches[channel] !== undefined);\n\n/**\n * What the person hears about, and how (docs/notifications-harmonization.md §2.1–§2.3,\n * §4.2, §10.2): one row per type the SERVER answered, the app's words on it, and a switch\n * per channel the type offers — \"In the app\", \"Push\", \"E-mail\". On a wide screen they are\n * narrow columns under those headings; on a phone they stack under the type's label. A\n * channel the server answers `null` is not drawn (kastlan and KS offer no push; KS no\n * \"in the app\"), and a row with one channel keeps a single switch named by the type\n * (Kurvenschmiede's e-mail-only rows).\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 phone = usePhoneLayout();\n const rowOf = (id: Id): Row<Id> | null => {\n const switches = value?.[id];\n const entry = entries.get(id);\n if (!switches || !entry || channelsOf(switches).length === 0) 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: NotificationChannel, server: boolean): boolean => {\n const key = switchKey(id, channel);\n return overlay.get(key) ?? server;\n };\n const channelOn = ({ entry, switches }: Row<Id>, channel: NotificationChannel) =>\n shown(entry.id, channel, switches[channel] === true);\n /** The type reaches the person at all: some channel is on (the cadence and the app's\n * extra show then). */\n const rowOn = (row: Row<Id>) => channelsOf(row.switches).some((channel) => channelOn(row, channel));\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: NotificationChannel, 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 channelLabel: Record<NotificationChannel, string> = {\n app: labels.channelApp,\n push: labels.channelPush,\n email: labels.channelEmail,\n };\n /** The columns on a wide screen: every channel some several-channel row offers. */\n const drawnRows =\n value && !loading ? rowsOf(groups ? groups.flatMap((group) => group.types) : types.map((entry) => entry.id)) : [];\n const multi = drawnRows.filter((row) => channelsOf(row.switches).length > 1);\n const columns = CHANNELS.filter((channel) => multi.some((row) => channelsOf(row.switches).includes(channel)));\n const columnHeadings =\n !phone && columns.length > 0 ? (\n // The switches carry the channel's name themselves; the headings are for the eye.\n <div aria-hidden className={cn(\"grid gap-x-2\", COLUMN_GRID[columns.length])} data-channel-headings=\"\">\n <span />\n {columns.map((channel) => (\n <span key={channel} className=\"text-center text-caption font-medium text-muted\">\n {channelLabel[channel]}\n </span>\n ))}\n </div>\n ) : null;\n\n const renderRow = (row: Row<Id>) => {\n const { entry, switches } = row;\n const on = rowOn(row);\n const offered = channelsOf(switches);\n const single = offered.length === 1 ? offered[0] : 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 below =\n cadenceSelect || hasContent(extra) ? (\n <div className=\"ps-4 space-y-2\">\n {cadenceSelect}\n {extra}\n </div>\n ) : null;\n\n // One channel: today's single switch, named by the type (KS's e-mail-only rows).\n if (single) {\n const description =\n single === \"email\" && unverifiedLine ? (\n <>\n {entry.description !== undefined && <span className=\"block\">{entry.description}</span>}\n {unverifiedLine}\n </>\n ) : (\n entry.description\n );\n return (\n <div key={entry.id} data-notification-type={entry.id} data-channels={single} className=\"space-y-2\">\n <Switch\n label={entry.label}\n description={description}\n checked={channelOn(row, single)}\n disabled={disabled}\n commit={COMMIT_EXCEPT_BILLING}\n onCheckedChange={(next) => flip(entry.id, single, next)}\n />\n {below}\n </div>\n );\n }\n\n // Several channels: a group named by its type, a switch per channel — columns on a\n // wide screen (the headings above the list name them), stacked on a phone.\n const labelId = `${groupId}-type-${entry.id}`;\n const unverifiedId = `${groupId}-unverified-${entry.id}`;\n const channelSwitch = (channel: NotificationChannel) => (\n <Switch\n key={channel}\n size=\"sm\"\n label={phone ? channelLabel[channel] : undefined}\n aria-label={phone ? undefined : channelLabel[channel]}\n description={phone && channel === \"email\" ? (unverifiedLine ?? undefined) : undefined}\n aria-describedby={!phone && channel === \"email\" && unverifiedLine ? unverifiedId : undefined}\n checked={channelOn(row, channel)}\n disabled={disabled}\n commit={COMMIT_EXCEPT_BILLING}\n onCheckedChange={(next) => flip(entry.id, channel, next)}\n data-channel={channel}\n />\n );\n const text = (\n <div className=\"min-w-0\">\n <div id={labelId} className=\"text-sm font-medium text-primary\">\n {entry.label}\n </div>\n {(entry.description !== undefined || (!phone && offered.includes(\"email\") && unverifiedLine)) && (\n <div className={CARD_DESCRIPTION_CLASS}>\n {entry.description !== undefined && <span className=\"block\">{entry.description}</span>}\n {!phone && offered.includes(\"email\") && <span id={unverifiedId}>{unverifiedLine}</span>}\n </div>\n )}\n </div>\n );\n return (\n <div\n key={entry.id}\n data-notification-type={entry.id}\n data-channels={offered.join(\" \")}\n role=\"group\"\n aria-labelledby={labelId}\n className=\"space-y-2\"\n >\n {phone ? (\n <>\n {text}\n <div className=\"ps-4 space-y-2\" data-stacked=\"\">\n {offered.map(channelSwitch)}\n </div>\n </>\n ) : (\n <div className={cn(\"grid items-start gap-x-2\", COLUMN_GRID[columns.length])}>\n {text}\n {columns.map((channel) => (\n <div key={channel} className=\"flex justify-center pt-0.5\">\n {offered.includes(channel) ? channelSwitch(channel) : null}\n </div>\n ))}\n </div>\n )}\n {below}\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.map((group) => ({ group, rows: rowsOf(group.types) })).filter(({ rows }) => rows.length > 0);\n body =\n drawn.length === 0 ? (\n <p className={CARD_DESCRIPTION_CLASS}>{labels.typesEmpty}</p>\n ) : (\n <>\n {columnHeadings}\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 );\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\">\n {columnHeadings}\n {rows.map(renderRow)}\n </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":";AAkNI,SA+DM,UA/DN,KAkBE,YAlBF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C,KAAK,IAAI,SAAS;AAAA,aAJX,MAAM,EAKhB;AAAA,MAEJ,CAAC;AAAA,OACH;AAAA,EAEN,OAAO;AACL,UAAM,OAAO,OAAO,MAAM,IAAI,CAAC,UAAU,MAAM,EAAE,CAAC;AAClD,WACE,KAAK,WAAW,IACd,oBAAC,OAAE,WAAW,wBAAyB,iBAAO,YAAW,IAEzD,qBAAC,SAAI,WAAU,aACZ;AAAA;AAAA,MACA,KAAK,IAAI,SAAS;AAAA,OACrB;AAAA,EAEN;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":[]}
@@ -145,6 +145,12 @@ export interface NotificationsLabels {
145
145
  /** Account mail is not a notification, and keeps coming. */
146
146
  accountMail: string;
147
147
  turnBackOn: string;
148
+ /**
149
+ * 0.52: the line under the outcome, {@link accountMail} and {@link turnBackOn} as one
150
+ * text — joined by the catalogue, not by the panel: the panel glued them with an ASCII
151
+ * space, which Chinese does not put between sentences (refactor audit 2026-10-30, DOC-11).
152
+ */
153
+ stoppedHint: (accountMail: string, turnBackOn: string) => string;
148
154
  openSettings: string;
149
155
  /** A token the server refused, or one that does not parse. */
150
156
  invalidLink: string;
@@ -86,6 +86,7 @@ const DEFAULT_NOTIFICATIONS_LABELS = {
86
86
  stoppedAll: (app) => `Done. You won\u2019t get notification e-mails from ${app} any more.`,
87
87
  accountMail: "E-mails about your account still come.",
88
88
  turnBackOn: "You can turn them back on at any time in Settings.",
89
+ stoppedHint: (accountMail, turnBackOn) => `${accountMail} ${turnBackOn}`,
89
90
  openSettings: "Open Settings",
90
91
  invalidLink: "This link doesn\u2019t work any more. You can turn e-mails off in Settings instead.",
91
92
  failed: "That didn\u2019t work. Please try again."
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/notifications/notifications-labels.ts"],"sourcesContent":["// The words of the notification cards (docs/notifications-harmonization.md §4.2), in a\n// module with no component code: the English catalogue (src/i18n/defaults.ts) imports\n// them without the components, so `en` loads as one chunk like the other languages\n// (0.34, KS U8). The cards read it through `useKitLabels(\"notifications\", …)`.\n\n/** The ten IANA regions `Intl` lists zones under — keksdose's `tz_region_*` — in the\n * kit's words. A region a runtime adds later keeps its IANA name. */\nexport interface NotificationRegionLabels {\n Africa: string;\n America: string;\n Antarctica: string;\n Arctic: string;\n Asia: string;\n Atlantic: string;\n Australia: string;\n Europe: string;\n Indian: string;\n Pacific: string;\n}\n\n/**\n * Every string the notification parts render — the `notifications` namespace of\n * `<UiKitProvider labels>`, overridable per instance through `labels`: the types card,\n * quiet hours, this device's push, the device list, and the\n * unsubscribe page. Cancel is `common.cancel`.\n */\nexport interface NotificationsLabels {\n /* ── The types card ─────────────────────────────────────────────────── */\n /** The types card's title. */\n typesTitle: string;\n /** The line under it. */\n typesDescription: string;\n /** 0.46 (§10.2): the channel columns' headings, and each switch's name. */\n channelApp: string;\n channelPush: string;\n channelEmail: string;\n /** Under every e-mail switch while the account's address is unverified (decision 16):\n * no notification mail goes to an unverified address. */\n emailUnverified: string;\n /** The digest's cadence select. */\n digestCadence: string;\n digestWeekly: string;\n digestMonthly: string;\n /** While the settings load. */\n typesLoading: string;\n /** The server answered no types for this account. */\n typesEmpty: string;\n\n /* ── Quiet hours ────────────────────────────────────────────────────── */\n quietTitle: string;\n /** The line under the title; `inbox`: the app keeps an inbox, which a held push still\n * reaches; `held` (0.46, §10.4): the app queues a held push and sends it when the\n * window ends, instead of dropping it. */\n quietDescription: (inbox: boolean, held?: boolean) => string;\n /** 0.46 (§10.3, automatic only): the card names the account's zone, read-only, given\n * the zone as `zoneName` writes it (\"Europe / Zurich\"); it follows the device last used. */\n quietZone: (zone: string) => string;\n /** The start time's label. */\n quietFrom: string;\n /** The end time's label. */\n quietUntil: string;\n /** One time set, the other not: quiet hours fail open until both are. */\n quietIncomplete: string;\n /** The zone's region headings, in a zone's name (\"Europe / Zurich\"). */\n regions: NotificationRegionLabels;\n\n /* ── This device ────────────────────────────────────────────────────── */\n pushTitle: string;\n pushDescription: string;\n /** The browser has no push. */\n unsupported: string;\n /** iOS outside the installed app, given the app's name. */\n iosInstall: (app: string) => string;\n /** The server has no VAPID keys. */\n notConfigured: string;\n /** The browser's permission is denied. */\n blocked: string;\n /** This device gets notifications for the signed-in account. */\n on: string;\n off: string;\n /** This browser's subscription belongs to another account. */\n otherAccount: string;\n enable: string;\n disable: string;\n sendTest: string;\n /** Turning on did not finish (the permission prompt dismissed, a refusal). */\n enableFailed: string;\n /** No service worker, or one that is not ready in 10 s. */\n noServiceWorker: string;\n /** The browser's push service did not answer in 15 s. */\n pushTimeout: string;\n /** Given how many devices the push service accepted the test for (≥ 1). */\n testSent: (count: number) => string;\n /** The test reached no device. */\n testNone: string;\n testFailed: string;\n /** The explainer before the browser's one permission prompt. */\n explainerTitle: string;\n explainerBody: (app: string) => string;\n explainerHint: string;\n explainerContinue: string;\n\n /* ── The device list ────────────────────────────────────────────────── */\n devicesTitle: string;\n devicesDescription: string;\n devicesLoading: string;\n devicesEmpty: string;\n /** A device whose user agent says nothing the kit recognises. */\n unknownDevice: string;\n /** The chip on this browser's row. */\n thisDevice: string;\n /** Given the registration date, formatted. */\n added: (date: string) => string;\n /** Given the last accepted delivery, formatted. */\n lastDelivery: (date: string) => string;\n noDelivery: string;\n /** Given the failed deliveries in a row (≥ 1). */\n failures: (count: number) => string;\n /** A row's button, visible text — and the confirm's answer. */\n remove: string;\n /** The same button's accessible name, given the device: it starts with `remove`. */\n removeItem: (device: string) => string;\n /** The question the row asks before it removes. */\n removePrompt: string;\n /** 0.46 (§10.2): the disclosure on a device's row listing the types with push on. */\n deviceTypes: string;\n /** The line inside it. */\n deviceTypesDescription: string;\n /** No type has push on for the account. */\n deviceTypesEmpty: string;\n\n /* ── The inbox and the bell (0.46, §10.1) ───────────────────────────── */\n /** The inbox's heading (keksdose's \"Inbox\"). */\n inboxTitle: string;\n inboxLoading: string;\n /** Nothing in the inbox. */\n inboxEmpty: string;\n markAllRead: string;\n /** The header's clear button, and the confirm's answer. */\n clearAll: string;\n /** The question asked before the inbox is cleared. */\n clearPrompt: string;\n /** The row that loads the next page. */\n showMore: string;\n /** The bell's name. */\n bellLabel: string;\n /** Read after the bell's name, given the unread count (≥ 1). */\n bellUnread: (count: number) => string;\n /** The bell panel's link to the app's inbox. */\n allNotifications: string;\n\n /* ── The unsubscribe page ───────────────────────────────────────────── */\n unsubscribeTitle: string;\n /** Given the type's name in the app's words. */\n unsubscribeAbout: (type: string) => string;\n /** No type name to give. */\n unsubscribeGeneric: string;\n stopThese: string;\n stopAll: (app: string) => string;\n stoppedThese: string;\n stoppedAll: (app: string) => string;\n /** Account mail is not a notification, and keeps coming. */\n accountMail: string;\n turnBackOn: string;\n openSettings: string;\n /** A token the server refused, or one that does not parse. */\n invalidLink: string;\n\n /* ── Every card ─────────────────────────────────────────────────────── */\n /** A request failed, and the app had no words of its own. */\n failed: string;\n}\n\nexport const DEFAULT_NOTIFICATIONS_LABELS: NotificationsLabels = {\n typesTitle: \"Notify me about\",\n typesDescription: \"Choose what you hear about, and how.\",\n channelApp: \"In the app\",\n channelPush: \"Push\",\n channelEmail: \"E-mail\",\n emailUnverified: \"Confirm your address to receive these.\",\n digestCadence: \"Frequency\",\n digestWeekly: \"Weekly\",\n digestMonthly: \"Monthly\",\n typesLoading: \"Loading notification settings…\",\n typesEmpty: \"There are no notifications for this account.\",\n\n quietTitle: \"Quiet hours\",\n quietDescription: (inbox, held) =>\n held\n ? inbox\n ? \"Push notifications wait during this window and arrive when it ends. They reach your inbox at once.\"\n : \"Push notifications wait during this window and arrive when it ends.\"\n : inbox\n ? \"No push notifications during this window. They still reach your inbox.\"\n : \"No push notifications during this window.\",\n quietZone: (zone) => `In your time zone (${zone}), which follows the device you last used.`,\n quietFrom: \"From\",\n quietUntil: \"Until\",\n quietIncomplete: \"Set both a start and an end time. Quiet hours take effect once both are set.\",\n regions: {\n Africa: \"Africa\",\n America: \"Americas\",\n Antarctica: \"Antarctica\",\n Arctic: \"Arctic\",\n Asia: \"Asia\",\n Atlantic: \"Atlantic\",\n Australia: \"Australia\",\n Europe: \"Europe\",\n Indian: \"Indian Ocean\",\n Pacific: \"Pacific\",\n },\n\n pushTitle: \"Push notifications\",\n pushDescription: \"Notifications on this device, also while the app is closed.\",\n unsupported: \"This browser doesn’t support push notifications.\",\n iosInstall: (app) =>\n `On iPhone or iPad, add ${app} to your Home Screen first: iOS delivers notifications only to the installed app.`,\n notConfigured: \"Push notifications aren’t set up on this server.\",\n blocked: \"Notifications are blocked in this browser’s settings.\",\n on: \"Notifications are on for this device.\",\n off: \"Notifications are off for this device.\",\n otherAccount:\n \"This browser gets notifications for another account. Turn them on here to get them for the account you’re signed in with.\",\n enable: \"Turn on notifications\",\n disable: \"Turn off\",\n sendTest: \"Send a test\",\n enableFailed: \"Couldn’t turn on notifications.\",\n noServiceWorker: \"Couldn’t reach the app’s service worker. Reload the page and try again.\",\n pushTimeout: \"The browser’s push service didn’t answer. Check your connection and try again.\",\n testSent: (count) => (count === 1 ? \"Test sent to 1 device\" : `Test sent to ${count} devices`),\n testNone: \"No device accepted the test. Turn notifications on for this device first.\",\n testFailed: \"Couldn’t send a test notification.\",\n explainerTitle: \"Turn on notifications?\",\n explainerBody: (app) =>\n `${app} sends a notification only for the kinds you choose, and you can turn them off at any time.`,\n explainerHint: \"Your browser asks for permission next.\",\n explainerContinue: \"Continue\",\n\n devicesTitle: \"Notification devices\",\n devicesDescription: \"Every device that gets push notifications for your account. Remove any you no longer use.\",\n devicesLoading: \"Loading devices…\",\n devicesEmpty: \"No device gets notifications yet.\",\n unknownDevice: \"Unknown device\",\n thisDevice: \"This device\",\n added: (date) => `Added ${date}`,\n lastDelivery: (date) => `Last delivery ${date}`,\n noDelivery: \"No delivery yet\",\n failures: (count) => (count === 1 ? \"1 failed delivery in a row\" : `${count} failed deliveries in a row`),\n remove: \"Remove\",\n removeItem: (device) => `Remove ${device}`,\n removePrompt: \"Stop sending notifications to this device?\",\n deviceTypes: \"Types on this device\",\n deviceTypesDescription: \"Turn a type off to mute it on this device only.\",\n deviceTypesEmpty: \"No type has push notifications turned on.\",\n\n inboxTitle: \"Inbox\",\n inboxLoading: \"Loading notifications…\",\n inboxEmpty: \"You’re all caught up.\",\n markAllRead: \"Mark all as read\",\n clearAll: \"Clear all\",\n clearPrompt: \"Delete all notifications from your inbox?\",\n showMore: \"Show more\",\n bellLabel: \"Notifications\",\n bellUnread: (count) => `${count} unread`,\n allNotifications: \"All notifications\",\n\n unsubscribeTitle: \"E-mail notifications\",\n unsubscribeAbout: (type) => `You get e-mails about: ${type}.`,\n unsubscribeGeneric: \"You get notification e-mails.\",\n stopThese: \"Stop these e-mails\",\n stopAll: (app) => `Stop all notification e-mails from ${app}`,\n stoppedThese: \"Done. You won’t get these e-mails any more.\",\n stoppedAll: (app) => `Done. You won’t get notification e-mails from ${app} any more.`,\n accountMail: \"E-mails about your account still come.\",\n turnBackOn: \"You can turn them back on at any time in Settings.\",\n openSettings: \"Open Settings\",\n invalidLink: \"This link doesn’t work any more. You can turn e-mails off in Settings instead.\",\n\n failed: \"That didn’t work. Please try again.\",\n};\n"],"mappings":";AA6KO,MAAM,+BAAoD;AAAA,EAC/D,YAAY;AAAA,EACZ,kBAAkB;AAAA,EAClB,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,cAAc;AAAA,EACd,iBAAiB;AAAA,EACjB,eAAe;AAAA,EACf,cAAc;AAAA,EACd,eAAe;AAAA,EACf,cAAc;AAAA,EACd,YAAY;AAAA,EAEZ,YAAY;AAAA,EACZ,kBAAkB,CAAC,OAAO,SACxB,OACI,QACE,uGACA,wEACF,QACE,2EACA;AAAA,EACR,WAAW,CAAC,SAAS,sBAAsB,IAAI;AAAA,EAC/C,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AAU;AAAA,EACV,aAAa;AAAA,EACb,UAAU;AAAA,EACV,WAAW;AAAA,EACX,YAAY,CAAC,UAAU,GAAG,KAAK;AAAA,EAC/B,kBAAkB;AAAA,EAElB,kBAAkB;AAAA,EAClB,kBAAkB,CAAC,SAAS,0BAA0B,IAAI;AAAA,EAC1D,oBAAoB;AAAA,EACpB,WAAW;AAAA,EACX,SAAS,CAAC,QAAQ,sCAAsC,GAAG;AAAA,EAC3D,cAAc;AAAA,EACd,YAAY,CAAC,QAAQ,sDAAiD,GAAG;AAAA,EACzE,aAAa;AAAA,EACb,YAAY;AAAA,EACZ,cAAc;AAAA,EACd,aAAa;AAAA,EAEb,QAAQ;AACV;","names":[]}
1
+ {"version":3,"sources":["../../src/notifications/notifications-labels.ts"],"sourcesContent":["// The words of the notification cards (docs/notifications-harmonization.md §4.2), in a\n// module with no component code: the English catalogue (src/i18n/defaults.ts) imports\n// them without the components, so `en` loads as one chunk like the other languages\n// (0.34, KS U8). The cards read it through `useKitLabels(\"notifications\", …)`.\n\n/** The ten IANA regions `Intl` lists zones under — keksdose's `tz_region_*` — in the\n * kit's words. A region a runtime adds later keeps its IANA name. */\nexport interface NotificationRegionLabels {\n Africa: string;\n America: string;\n Antarctica: string;\n Arctic: string;\n Asia: string;\n Atlantic: string;\n Australia: string;\n Europe: string;\n Indian: string;\n Pacific: string;\n}\n\n/**\n * Every string the notification parts render — the `notifications` namespace of\n * `<UiKitProvider labels>`, overridable per instance through `labels`: the types card,\n * quiet hours, this device's push, the device list, and the\n * unsubscribe page. Cancel is `common.cancel`.\n */\nexport interface NotificationsLabels {\n /* ── The types card ─────────────────────────────────────────────────── */\n /** The types card's title. */\n typesTitle: string;\n /** The line under it. */\n typesDescription: string;\n /** 0.46 (§10.2): the channel columns' headings, and each switch's name. */\n channelApp: string;\n channelPush: string;\n channelEmail: string;\n /** Under every e-mail switch while the account's address is unverified (decision 16):\n * no notification mail goes to an unverified address. */\n emailUnverified: string;\n /** The digest's cadence select. */\n digestCadence: string;\n digestWeekly: string;\n digestMonthly: string;\n /** While the settings load. */\n typesLoading: string;\n /** The server answered no types for this account. */\n typesEmpty: string;\n\n /* ── Quiet hours ────────────────────────────────────────────────────── */\n quietTitle: string;\n /** The line under the title; `inbox`: the app keeps an inbox, which a held push still\n * reaches; `held` (0.46, §10.4): the app queues a held push and sends it when the\n * window ends, instead of dropping it. */\n quietDescription: (inbox: boolean, held?: boolean) => string;\n /** 0.46 (§10.3, automatic only): the card names the account's zone, read-only, given\n * the zone as `zoneName` writes it (\"Europe / Zurich\"); it follows the device last used. */\n quietZone: (zone: string) => string;\n /** The start time's label. */\n quietFrom: string;\n /** The end time's label. */\n quietUntil: string;\n /** One time set, the other not: quiet hours fail open until both are. */\n quietIncomplete: string;\n /** The zone's region headings, in a zone's name (\"Europe / Zurich\"). */\n regions: NotificationRegionLabels;\n\n /* ── This device ────────────────────────────────────────────────────── */\n pushTitle: string;\n pushDescription: string;\n /** The browser has no push. */\n unsupported: string;\n /** iOS outside the installed app, given the app's name. */\n iosInstall: (app: string) => string;\n /** The server has no VAPID keys. */\n notConfigured: string;\n /** The browser's permission is denied. */\n blocked: string;\n /** This device gets notifications for the signed-in account. */\n on: string;\n off: string;\n /** This browser's subscription belongs to another account. */\n otherAccount: string;\n enable: string;\n disable: string;\n sendTest: string;\n /** Turning on did not finish (the permission prompt dismissed, a refusal). */\n enableFailed: string;\n /** No service worker, or one that is not ready in 10 s. */\n noServiceWorker: string;\n /** The browser's push service did not answer in 15 s. */\n pushTimeout: string;\n /** Given how many devices the push service accepted the test for (≥ 1). */\n testSent: (count: number) => string;\n /** The test reached no device. */\n testNone: string;\n testFailed: string;\n /** The explainer before the browser's one permission prompt. */\n explainerTitle: string;\n explainerBody: (app: string) => string;\n explainerHint: string;\n explainerContinue: string;\n\n /* ── The device list ────────────────────────────────────────────────── */\n devicesTitle: string;\n devicesDescription: string;\n devicesLoading: string;\n devicesEmpty: string;\n /** A device whose user agent says nothing the kit recognises. */\n unknownDevice: string;\n /** The chip on this browser's row. */\n thisDevice: string;\n /** Given the registration date, formatted. */\n added: (date: string) => string;\n /** Given the last accepted delivery, formatted. */\n lastDelivery: (date: string) => string;\n noDelivery: string;\n /** Given the failed deliveries in a row (≥ 1). */\n failures: (count: number) => string;\n /** A row's button, visible text — and the confirm's answer. */\n remove: string;\n /** The same button's accessible name, given the device: it starts with `remove`. */\n removeItem: (device: string) => string;\n /** The question the row asks before it removes. */\n removePrompt: string;\n /** 0.46 (§10.2): the disclosure on a device's row listing the types with push on. */\n deviceTypes: string;\n /** The line inside it. */\n deviceTypesDescription: string;\n /** No type has push on for the account. */\n deviceTypesEmpty: string;\n\n /* ── The inbox and the bell (0.46, §10.1) ───────────────────────────── */\n /** The inbox's heading (keksdose's \"Inbox\"). */\n inboxTitle: string;\n inboxLoading: string;\n /** Nothing in the inbox. */\n inboxEmpty: string;\n markAllRead: string;\n /** The header's clear button, and the confirm's answer. */\n clearAll: string;\n /** The question asked before the inbox is cleared. */\n clearPrompt: string;\n /** The row that loads the next page. */\n showMore: string;\n /** The bell's name. */\n bellLabel: string;\n /** Read after the bell's name, given the unread count (≥ 1). */\n bellUnread: (count: number) => string;\n /** The bell panel's link to the app's inbox. */\n allNotifications: string;\n\n /* ── The unsubscribe page ───────────────────────────────────────────── */\n unsubscribeTitle: string;\n /** Given the type's name in the app's words. */\n unsubscribeAbout: (type: string) => string;\n /** No type name to give. */\n unsubscribeGeneric: string;\n stopThese: string;\n stopAll: (app: string) => string;\n stoppedThese: string;\n stoppedAll: (app: string) => string;\n /** Account mail is not a notification, and keeps coming. */\n accountMail: string;\n turnBackOn: string;\n /**\n * 0.52: the line under the outcome, {@link accountMail} and {@link turnBackOn} as one\n * text — joined by the catalogue, not by the panel: the panel glued them with an ASCII\n * space, which Chinese does not put between sentences (refactor audit 2026-10-30, DOC-11).\n */\n stoppedHint: (accountMail: string, turnBackOn: string) => string;\n openSettings: string;\n /** A token the server refused, or one that does not parse. */\n invalidLink: string;\n\n /* ── Every card ─────────────────────────────────────────────────────── */\n /** A request failed, and the app had no words of its own. */\n failed: string;\n}\n\nexport const DEFAULT_NOTIFICATIONS_LABELS: NotificationsLabels = {\n typesTitle: \"Notify me about\",\n typesDescription: \"Choose what you hear about, and how.\",\n channelApp: \"In the app\",\n channelPush: \"Push\",\n channelEmail: \"E-mail\",\n emailUnverified: \"Confirm your address to receive these.\",\n digestCadence: \"Frequency\",\n digestWeekly: \"Weekly\",\n digestMonthly: \"Monthly\",\n typesLoading: \"Loading notification settings…\",\n typesEmpty: \"There are no notifications for this account.\",\n\n quietTitle: \"Quiet hours\",\n quietDescription: (inbox, held) =>\n held\n ? inbox\n ? \"Push notifications wait during this window and arrive when it ends. They reach your inbox at once.\"\n : \"Push notifications wait during this window and arrive when it ends.\"\n : inbox\n ? \"No push notifications during this window. They still reach your inbox.\"\n : \"No push notifications during this window.\",\n quietZone: (zone) => `In your time zone (${zone}), which follows the device you last used.`,\n quietFrom: \"From\",\n quietUntil: \"Until\",\n quietIncomplete: \"Set both a start and an end time. Quiet hours take effect once both are set.\",\n regions: {\n Africa: \"Africa\",\n America: \"Americas\",\n Antarctica: \"Antarctica\",\n Arctic: \"Arctic\",\n Asia: \"Asia\",\n Atlantic: \"Atlantic\",\n Australia: \"Australia\",\n Europe: \"Europe\",\n Indian: \"Indian Ocean\",\n Pacific: \"Pacific\",\n },\n\n pushTitle: \"Push notifications\",\n pushDescription: \"Notifications on this device, also while the app is closed.\",\n unsupported: \"This browser doesn’t support push notifications.\",\n iosInstall: (app) =>\n `On iPhone or iPad, add ${app} to your Home Screen first: iOS delivers notifications only to the installed app.`,\n notConfigured: \"Push notifications aren’t set up on this server.\",\n blocked: \"Notifications are blocked in this browser’s settings.\",\n on: \"Notifications are on for this device.\",\n off: \"Notifications are off for this device.\",\n otherAccount:\n \"This browser gets notifications for another account. Turn them on here to get them for the account you’re signed in with.\",\n enable: \"Turn on notifications\",\n disable: \"Turn off\",\n sendTest: \"Send a test\",\n enableFailed: \"Couldn’t turn on notifications.\",\n noServiceWorker: \"Couldn’t reach the app’s service worker. Reload the page and try again.\",\n pushTimeout: \"The browser’s push service didn’t answer. Check your connection and try again.\",\n testSent: (count) => (count === 1 ? \"Test sent to 1 device\" : `Test sent to ${count} devices`),\n testNone: \"No device accepted the test. Turn notifications on for this device first.\",\n testFailed: \"Couldn’t send a test notification.\",\n explainerTitle: \"Turn on notifications?\",\n explainerBody: (app) =>\n `${app} sends a notification only for the kinds you choose, and you can turn them off at any time.`,\n explainerHint: \"Your browser asks for permission next.\",\n explainerContinue: \"Continue\",\n\n devicesTitle: \"Notification devices\",\n devicesDescription: \"Every device that gets push notifications for your account. Remove any you no longer use.\",\n devicesLoading: \"Loading devices…\",\n devicesEmpty: \"No device gets notifications yet.\",\n unknownDevice: \"Unknown device\",\n thisDevice: \"This device\",\n added: (date) => `Added ${date}`,\n lastDelivery: (date) => `Last delivery ${date}`,\n noDelivery: \"No delivery yet\",\n failures: (count) => (count === 1 ? \"1 failed delivery in a row\" : `${count} failed deliveries in a row`),\n remove: \"Remove\",\n removeItem: (device) => `Remove ${device}`,\n removePrompt: \"Stop sending notifications to this device?\",\n deviceTypes: \"Types on this device\",\n deviceTypesDescription: \"Turn a type off to mute it on this device only.\",\n deviceTypesEmpty: \"No type has push notifications turned on.\",\n\n inboxTitle: \"Inbox\",\n inboxLoading: \"Loading notifications…\",\n inboxEmpty: \"You’re all caught up.\",\n markAllRead: \"Mark all as read\",\n clearAll: \"Clear all\",\n clearPrompt: \"Delete all notifications from your inbox?\",\n showMore: \"Show more\",\n bellLabel: \"Notifications\",\n bellUnread: (count) => `${count} unread`,\n allNotifications: \"All notifications\",\n\n unsubscribeTitle: \"E-mail notifications\",\n unsubscribeAbout: (type) => `You get e-mails about: ${type}.`,\n unsubscribeGeneric: \"You get notification e-mails.\",\n stopThese: \"Stop these e-mails\",\n stopAll: (app) => `Stop all notification e-mails from ${app}`,\n stoppedThese: \"Done. You won’t get these e-mails any more.\",\n stoppedAll: (app) => `Done. You won’t get notification e-mails from ${app} any more.`,\n accountMail: \"E-mails about your account still come.\",\n turnBackOn: \"You can turn them back on at any time in Settings.\",\n stoppedHint: (accountMail, turnBackOn) => `${accountMail} ${turnBackOn}`,\n openSettings: \"Open Settings\",\n invalidLink: \"This link doesn’t work any more. You can turn e-mails off in Settings instead.\",\n\n failed: \"That didn’t work. Please try again.\",\n};\n"],"mappings":";AAmLO,MAAM,+BAAoD;AAAA,EAC/D,YAAY;AAAA,EACZ,kBAAkB;AAAA,EAClB,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,cAAc;AAAA,EACd,iBAAiB;AAAA,EACjB,eAAe;AAAA,EACf,cAAc;AAAA,EACd,eAAe;AAAA,EACf,cAAc;AAAA,EACd,YAAY;AAAA,EAEZ,YAAY;AAAA,EACZ,kBAAkB,CAAC,OAAO,SACxB,OACI,QACE,uGACA,wEACF,QACE,2EACA;AAAA,EACR,WAAW,CAAC,SAAS,sBAAsB,IAAI;AAAA,EAC/C,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,iBAAiB;AAAA,EACjB,SAAS;AAAA,IACP,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,UAAU;AAAA,IACV,WAAW;AAAA,IACX,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,SAAS;AAAA,EACX;AAAA,EAEA,WAAW;AAAA,EACX,iBAAiB;AAAA,EACjB,aAAa;AAAA,EACb,YAAY,CAAC,QACX,0BAA0B,GAAG;AAAA,EAC/B,eAAe;AAAA,EACf,SAAS;AAAA,EACT,IAAI;AAAA,EACJ,KAAK;AAAA,EACL,cACE;AAAA,EACF,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,UAAU;AAAA,EACV,cAAc;AAAA,EACd,iBAAiB;AAAA,EACjB,aAAa;AAAA,EACb,UAAU,CAAC,UAAW,UAAU,IAAI,0BAA0B,gBAAgB,KAAK;AAAA,EACnF,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,gBAAgB;AAAA,EAChB,eAAe,CAAC,QACd,GAAG,GAAG;AAAA,EACR,eAAe;AAAA,EACf,mBAAmB;AAAA,EAEnB,cAAc;AAAA,EACd,oBAAoB;AAAA,EACpB,gBAAgB;AAAA,EAChB,cAAc;AAAA,EACd,eAAe;AAAA,EACf,YAAY;AAAA,EACZ,OAAO,CAAC,SAAS,SAAS,IAAI;AAAA,EAC9B,cAAc,CAAC,SAAS,iBAAiB,IAAI;AAAA,EAC7C,YAAY;AAAA,EACZ,UAAU,CAAC,UAAW,UAAU,IAAI,+BAA+B,GAAG,KAAK;AAAA,EAC3E,QAAQ;AAAA,EACR,YAAY,CAAC,WAAW,UAAU,MAAM;AAAA,EACxC,cAAc;AAAA,EACd,aAAa;AAAA,EACb,wBAAwB;AAAA,EACxB,kBAAkB;AAAA,EAElB,YAAY;AAAA,EACZ,cAAc;AAAA,EACd,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,UAAU;AAAA,EACV,aAAa;AAAA,EACb,UAAU;AAAA,EACV,WAAW;AAAA,EACX,YAAY,CAAC,UAAU,GAAG,KAAK;AAAA,EAC/B,kBAAkB;AAAA,EAElB,kBAAkB;AAAA,EAClB,kBAAkB,CAAC,SAAS,0BAA0B,IAAI;AAAA,EAC1D,oBAAoB;AAAA,EACpB,WAAW;AAAA,EACX,SAAS,CAAC,QAAQ,sCAAsC,GAAG;AAAA,EAC3D,cAAc;AAAA,EACd,YAAY,CAAC,QAAQ,sDAAiD,GAAG;AAAA,EACzE,aAAa;AAAA,EACb,YAAY;AAAA,EACZ,aAAa,CAAC,aAAa,eAAe,GAAG,WAAW,IAAI,UAAU;AAAA,EACtE,cAAc;AAAA,EACd,aAAa;AAAA,EAEb,QAAQ;AACV;","names":[]}
@@ -11,7 +11,7 @@ import { DialogFrame } from "../components/dialog-frame.js";
11
11
  import { COMMIT_EXCEPT_BILLING } from "../components/write-lock.js";
12
12
  import { CARD_DESCRIPTION_CLASS } from "../settings/settings-card-classes.js";
13
13
  import { SettingsCardTitle } from "../settings/settings-heading.js";
14
- import { useMounted } from "../account/account-parts.js";
14
+ import { useMounted } from "../hooks/use-mounted.js";
15
15
  import { describeFailure, FailureLine, useNotificationsLabels } from "./notification-parts.js";
16
16
  import { PushDeviceError } from "./use-push-device.js";
17
17
  function PushDeviceSetting({
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/notifications/push-device-setting.tsx"],"sourcesContent":["import { useState } from \"react\";\nimport type { ComponentPropsWithRef, ReactNode } from \"react\";\n\nimport { useKitLabels, type LabelOverride } from \"../i18n/kit-labels\";\nimport { DEFAULT_COMMON_LABELS } from \"../i18n/shared-labels\";\nimport { cn } from \"../lib/cn\";\nimport { AlertBanner } from \"../components/alert-banner\";\nimport { Button } from \"../components/button\";\nimport { Card } from \"../components/card\";\nimport { DialogFrame } from \"../components/dialog-frame\";\nimport { COMMIT_EXCEPT_BILLING } from \"../components/write-lock\";\nimport { CARD_DESCRIPTION_CLASS } from \"../settings/settings-card-classes\";\nimport { SettingsCardTitle } from \"../settings/settings-heading\";\nimport { useMounted } from \"../account/account-parts\";\nimport { describeFailure, FailureLine, useNotificationsLabels } from \"./notification-parts\";\nimport type { NotificationsLabels } from \"./notifications-labels\";\nimport { PushDeviceError } from \"./use-push-device\";\nimport type { PushDevice } from \"./use-push-device\";\n\n/** Which action failed — {@link PushDeviceSettingProps.describeError}'s second argument. */\nexport type PushDeviceAction = \"enable\" | \"disable\" | \"test\";\n\nexport interface PushDeviceSettingProps extends Omit<ComponentPropsWithRef<\"div\">, \"children\"> {\n /** This browser's push, from {@link usePushDevice}. */\n push: PushDevice;\n /** The app's name, for the iOS line and the explainer. */\n appName: string;\n /** The app's own words for a failure, or `undefined` for the kit's. The kit already\n * has words for a missing service worker and an unanswered push service. */\n describeError?: (error: unknown, action: PushDeviceAction) => ReactNode | undefined;\n labels?: LabelOverride<NotificationsLabels>;\n}\n\n/** What the line under the buttons says. */\ntype Outcome = { tone: \"status\" | \"warning\" | \"danger\"; text: ReactNode } | null;\n\n/**\n * Push on THIS device (docs/notifications-harmonization.md §2.2, §2.7, §4.2): keksdose's\n * push block, as a card of its own. Registering the device is the switch — push has no\n * account switch. One state at a time, in keksdose's order\n * (`notifications-card.tsx:333-402`):\n *\n * 1. the browser has no push;\n * 2. iOS outside the installed app (iOS delivers only to the installed app);\n * 3. push is not set up on the server (no VAPID keys);\n * 4. notifications blocked in the browser;\n * 5. on or off — with \"another account\" when this browser's subscription is someone\n * else's — and \"Turn on notifications\", or \"Send a test\" and \"Turn off\".\n *\n * **The explainer comes before the browser's one prompt**: turning on while the\n * permission is still `\"default\"` opens a dialog first (what the notifications are for,\n * that the browser asks next); with it granted, it goes straight on. A test that reached\n * no device says so (`testNone`) — a 404/410 removes the row on the server while this\n * browser still holds its subscription. Outcomes are a line under the buttons; nothing\n * toasts.\n */\nexport function PushDeviceSetting({\n push,\n appName,\n describeError,\n labels: labelsProp,\n className,\n ...rest\n}: PushDeviceSettingProps) {\n const labels = useNotificationsLabels(labelsProp);\n const common = useKitLabels(\"common\", DEFAULT_COMMON_LABELS);\n const [explainer, setExplainer] = useState(false);\n const [running, setRunning] = useState<PushDeviceAction | null>(null);\n const [outcome, setOutcome] = useState<Outcome>(null);\n const mounted = useMounted();\n\n const failureOf = (error: unknown, action: PushDeviceAction, fallback: string): ReactNode => {\n if (error instanceof PushDeviceError) {\n return error.code === \"no_service_worker\" ? labels.noServiceWorker : labels.pushTimeout;\n }\n return describeFailure(describeError?.(error, action), fallback);\n };\n\n const run = <T,>(action: PushDeviceAction, call: () => Promise<T>, done: (value: T) => Outcome, fallback: string) => {\n if (running) return;\n setRunning(action);\n setOutcome(null);\n call().then(\n (value) => {\n if (!mounted.current) return;\n setRunning(null);\n setOutcome(done(value));\n },\n (error: unknown) => {\n if (!mounted.current) return;\n setRunning(null);\n setOutcome({ tone: \"danger\", text: failureOf(error, action, fallback) });\n },\n );\n };\n\n const enable = () =>\n run(\n \"enable\",\n () => push.enable(),\n (ok): Outcome => (ok ? null : { tone: \"danger\", text: labels.enableFailed }),\n labels.enableFailed,\n );\n const disable = () =>\n run(\n \"disable\",\n () => push.disable(),\n () => null,\n labels.failed,\n );\n const test = () =>\n run(\n \"test\",\n () => push.sendTest(),\n ({ sent }): Outcome =>\n sent > 0 ? { tone: \"status\", text: labels.testSent(sent) } : { tone: \"warning\", text: labels.testNone },\n labels.testFailed,\n );\n\n const turnOn = () => {\n if (push.permission === \"granted\") enable();\n else setExplainer(true);\n };\n\n let state: ReactNode;\n if (!push.supported) {\n state = <p className={CARD_DESCRIPTION_CLASS}>{labels.unsupported}</p>;\n } else if (push.ios && !push.installed) {\n state = <p className={CARD_DESCRIPTION_CLASS}>{labels.iosInstall(appName)}</p>;\n } else if (push.configured === false) {\n state = <p className={CARD_DESCRIPTION_CLASS}>{labels.notConfigured}</p>;\n } else if (push.permission === \"denied\") {\n state = <p className=\"text-xs text-warning\">{labels.blocked}</p>;\n } else {\n const busy = push.busy || running !== null;\n state = (\n <>\n <p className={CARD_DESCRIPTION_CLASS} data-push-state={push.subscribed ? \"on\" : \"off\"}>\n {push.subscribed ? labels.on : labels.off}\n </p>\n {push.foreignSubscription && <p className=\"text-xs text-warning\">{labels.otherAccount}</p>}\n <div className=\"flex flex-wrap gap-2\">\n {push.subscribed ? (\n <>\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"secondary\"\n commit={COMMIT_EXCEPT_BILLING}\n pending={running === \"test\"}\n disabled={busy && running !== \"test\"}\n onClick={test}\n >\n {labels.sendTest}\n </Button>\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"ghost\"\n commit={COMMIT_EXCEPT_BILLING}\n pending={running === \"disable\"}\n disabled={busy && running !== \"disable\"}\n onClick={disable}\n >\n {labels.disable}\n </Button>\n </>\n ) : (\n <Button\n type=\"button\"\n size=\"sm\"\n commit={COMMIT_EXCEPT_BILLING}\n pending={running === \"enable\"}\n disabled={busy && running !== \"enable\"}\n onClick={turnOn}\n >\n {labels.enable}\n </Button>\n )}\n </div>\n {outcome?.tone === \"status\" && (\n <p role=\"status\" className={CARD_DESCRIPTION_CLASS}>\n {outcome.text}\n </p>\n )}\n {outcome?.tone === \"warning\" && (\n <AlertBanner tone=\"warning\" size=\"sm\" role=\"status\">\n {outcome.text}\n </AlertBanner>\n )}\n {outcome?.tone === \"danger\" && <FailureLine>{outcome.text}</FailureLine>}\n </>\n );\n }\n\n return (\n <Card {...rest} className={cn(\"p-4 space-y-3\", className)}>\n <div>\n <SettingsCardTitle>{labels.pushTitle}</SettingsCardTitle>\n <div className={CARD_DESCRIPTION_CLASS}>{labels.pushDescription}</div>\n </div>\n {state}\n <DialogFrame\n open={explainer}\n onClose={() => setExplainer(false)}\n title={labels.explainerTitle}\n description={labels.explainerBody(appName)}\n actions={(close) => (\n <div className=\"flex justify-end gap-2\">\n <Button type=\"button\" variant=\"ghost\" onClick={close}>\n {common.cancel}\n </Button>\n <Button\n type=\"button\"\n onClick={() => {\n setExplainer(false);\n // Only now the browser's one permission prompt.\n enable();\n }}\n >\n {labels.explainerContinue}\n </Button>\n </div>\n )}\n >\n <p className={CARD_DESCRIPTION_CLASS}>{labels.explainerHint}</p>\n </DialogFrame>\n </Card>\n );\n}\n"],"mappings":";AA8HY,SAiBA,UAjBA,KAiBA,YAjBA;AA9HZ,SAAS,gBAAgB;AAGzB,SAAS,oBAAwC;AACjD,SAAS,6BAA6B;AACtC,SAAS,UAAU;AACnB,SAAS,mBAAmB;AAC5B,SAAS,cAAc;AACvB,SAAS,YAAY;AACrB,SAAS,mBAAmB;AAC5B,SAAS,6BAA6B;AACtC,SAAS,8BAA8B;AACvC,SAAS,yBAAyB;AAClC,SAAS,kBAAkB;AAC3B,SAAS,iBAAiB,aAAa,8BAA8B;AAErE,SAAS,uBAAuB;AAwCzB,SAAS,kBAAkB;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR;AAAA,EACA,GAAG;AACL,GAA2B;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eAAc;AAAA;AAAA,IAC9D;AAAA,KACF;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../src/notifications/push-device-setting.tsx"],"sourcesContent":["import { useState } from \"react\";\nimport type { ComponentPropsWithRef, ReactNode } from \"react\";\n\nimport { useKitLabels, type LabelOverride } from \"../i18n/kit-labels\";\nimport { DEFAULT_COMMON_LABELS } from \"../i18n/shared-labels\";\nimport { cn } from \"../lib/cn\";\nimport { AlertBanner } from \"../components/alert-banner\";\nimport { Button } from \"../components/button\";\nimport { Card } from \"../components/card\";\nimport { DialogFrame } from \"../components/dialog-frame\";\nimport { COMMIT_EXCEPT_BILLING } from \"../components/write-lock\";\nimport { CARD_DESCRIPTION_CLASS } from \"../settings/settings-card-classes\";\nimport { SettingsCardTitle } from \"../settings/settings-heading\";\nimport { useMounted } from \"../hooks/use-mounted\";\nimport { describeFailure, FailureLine, useNotificationsLabels } from \"./notification-parts\";\nimport type { NotificationsLabels } from \"./notifications-labels\";\nimport { PushDeviceError } from \"./use-push-device\";\nimport type { PushDevice } from \"./use-push-device\";\n\n/** Which action failed — {@link PushDeviceSettingProps.describeError}'s second argument. */\nexport type PushDeviceAction = \"enable\" | \"disable\" | \"test\";\n\nexport interface PushDeviceSettingProps extends Omit<ComponentPropsWithRef<\"div\">, \"children\"> {\n /** This browser's push, from {@link usePushDevice}. */\n push: PushDevice;\n /** The app's name, for the iOS line and the explainer. */\n appName: string;\n /** The app's own words for a failure, or `undefined` for the kit's. The kit already\n * has words for a missing service worker and an unanswered push service. */\n describeError?: (error: unknown, action: PushDeviceAction) => ReactNode | undefined;\n labels?: LabelOverride<NotificationsLabels>;\n}\n\n/** What the line under the buttons says. */\ntype Outcome = { tone: \"status\" | \"warning\" | \"danger\"; text: ReactNode } | null;\n\n/**\n * Push on THIS device (docs/notifications-harmonization.md §2.2, §2.7, §4.2): keksdose's\n * push block, as a card of its own. Registering the device is the switch — push has no\n * account switch. One state at a time, in keksdose's order\n * (`notifications-card.tsx:333-402`):\n *\n * 1. the browser has no push;\n * 2. iOS outside the installed app (iOS delivers only to the installed app);\n * 3. push is not set up on the server (no VAPID keys);\n * 4. notifications blocked in the browser;\n * 5. on or off — with \"another account\" when this browser's subscription is someone\n * else's — and \"Turn on notifications\", or \"Send a test\" and \"Turn off\".\n *\n * **The explainer comes before the browser's one prompt**: turning on while the\n * permission is still `\"default\"` opens a dialog first (what the notifications are for,\n * that the browser asks next); with it granted, it goes straight on. A test that reached\n * no device says so (`testNone`) — a 404/410 removes the row on the server while this\n * browser still holds its subscription. Outcomes are a line under the buttons; nothing\n * toasts.\n */\nexport function PushDeviceSetting({\n push,\n appName,\n describeError,\n labels: labelsProp,\n className,\n ...rest\n}: PushDeviceSettingProps) {\n const labels = useNotificationsLabels(labelsProp);\n const common = useKitLabels(\"common\", DEFAULT_COMMON_LABELS);\n const [explainer, setExplainer] = useState(false);\n const [running, setRunning] = useState<PushDeviceAction | null>(null);\n const [outcome, setOutcome] = useState<Outcome>(null);\n const mounted = useMounted();\n\n const failureOf = (error: unknown, action: PushDeviceAction, fallback: string): ReactNode => {\n if (error instanceof PushDeviceError) {\n return error.code === \"no_service_worker\" ? labels.noServiceWorker : labels.pushTimeout;\n }\n return describeFailure(describeError?.(error, action), fallback);\n };\n\n const run = <T,>(action: PushDeviceAction, call: () => Promise<T>, done: (value: T) => Outcome, fallback: string) => {\n if (running) return;\n setRunning(action);\n setOutcome(null);\n call().then(\n (value) => {\n if (!mounted.current) return;\n setRunning(null);\n setOutcome(done(value));\n },\n (error: unknown) => {\n if (!mounted.current) return;\n setRunning(null);\n setOutcome({ tone: \"danger\", text: failureOf(error, action, fallback) });\n },\n );\n };\n\n const enable = () =>\n run(\n \"enable\",\n () => push.enable(),\n (ok): Outcome => (ok ? null : { tone: \"danger\", text: labels.enableFailed }),\n labels.enableFailed,\n );\n const disable = () =>\n run(\n \"disable\",\n () => push.disable(),\n () => null,\n labels.failed,\n );\n const test = () =>\n run(\n \"test\",\n () => push.sendTest(),\n ({ sent }): Outcome =>\n sent > 0 ? { tone: \"status\", text: labels.testSent(sent) } : { tone: \"warning\", text: labels.testNone },\n labels.testFailed,\n );\n\n const turnOn = () => {\n if (push.permission === \"granted\") enable();\n else setExplainer(true);\n };\n\n let state: ReactNode;\n if (!push.supported) {\n state = <p className={CARD_DESCRIPTION_CLASS}>{labels.unsupported}</p>;\n } else if (push.ios && !push.installed) {\n state = <p className={CARD_DESCRIPTION_CLASS}>{labels.iosInstall(appName)}</p>;\n } else if (push.configured === false) {\n state = <p className={CARD_DESCRIPTION_CLASS}>{labels.notConfigured}</p>;\n } else if (push.permission === \"denied\") {\n state = <p className=\"text-xs text-warning\">{labels.blocked}</p>;\n } else {\n const busy = push.busy || running !== null;\n state = (\n <>\n <p className={CARD_DESCRIPTION_CLASS} data-push-state={push.subscribed ? \"on\" : \"off\"}>\n {push.subscribed ? labels.on : labels.off}\n </p>\n {push.foreignSubscription && <p className=\"text-xs text-warning\">{labels.otherAccount}</p>}\n <div className=\"flex flex-wrap gap-2\">\n {push.subscribed ? (\n <>\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"secondary\"\n commit={COMMIT_EXCEPT_BILLING}\n pending={running === \"test\"}\n disabled={busy && running !== \"test\"}\n onClick={test}\n >\n {labels.sendTest}\n </Button>\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"ghost\"\n commit={COMMIT_EXCEPT_BILLING}\n pending={running === \"disable\"}\n disabled={busy && running !== \"disable\"}\n onClick={disable}\n >\n {labels.disable}\n </Button>\n </>\n ) : (\n <Button\n type=\"button\"\n size=\"sm\"\n commit={COMMIT_EXCEPT_BILLING}\n pending={running === \"enable\"}\n disabled={busy && running !== \"enable\"}\n onClick={turnOn}\n >\n {labels.enable}\n </Button>\n )}\n </div>\n {outcome?.tone === \"status\" && (\n <p role=\"status\" className={CARD_DESCRIPTION_CLASS}>\n {outcome.text}\n </p>\n )}\n {outcome?.tone === \"warning\" && (\n <AlertBanner tone=\"warning\" size=\"sm\" role=\"status\">\n {outcome.text}\n </AlertBanner>\n )}\n {outcome?.tone === \"danger\" && <FailureLine>{outcome.text}</FailureLine>}\n </>\n );\n }\n\n return (\n <Card {...rest} className={cn(\"p-4 space-y-3\", className)}>\n <div>\n <SettingsCardTitle>{labels.pushTitle}</SettingsCardTitle>\n <div className={CARD_DESCRIPTION_CLASS}>{labels.pushDescription}</div>\n </div>\n {state}\n <DialogFrame\n open={explainer}\n onClose={() => setExplainer(false)}\n title={labels.explainerTitle}\n description={labels.explainerBody(appName)}\n actions={(close) => (\n <div className=\"flex justify-end gap-2\">\n <Button type=\"button\" variant=\"ghost\" onClick={close}>\n {common.cancel}\n </Button>\n <Button\n type=\"button\"\n onClick={() => {\n setExplainer(false);\n // Only now the browser's one permission prompt.\n enable();\n }}\n >\n {labels.explainerContinue}\n </Button>\n </div>\n )}\n >\n <p className={CARD_DESCRIPTION_CLASS}>{labels.explainerHint}</p>\n </DialogFrame>\n </Card>\n );\n}\n"],"mappings":";AA8HY,SAiBA,UAjBA,KAiBA,YAjBA;AA9HZ,SAAS,gBAAgB;AAGzB,SAAS,oBAAwC;AACjD,SAAS,6BAA6B;AACtC,SAAS,UAAU;AACnB,SAAS,mBAAmB;AAC5B,SAAS,cAAc;AACvB,SAAS,YAAY;AACrB,SAAS,mBAAmB;AAC5B,SAAS,6BAA6B;AACtC,SAAS,8BAA8B;AACvC,SAAS,yBAAyB;AAClC,SAAS,kBAAkB;AAC3B,SAAS,iBAAiB,aAAa,8BAA8B;AAErE,SAAS,uBAAuB;AAwCzB,SAAS,kBAAkB;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR;AAAA,EACA,GAAG;AACL,GAA2B;AACzB,QAAM,SAAS,uBAAuB,UAAU;AAChD,QAAM,SAAS,aAAa,UAAU,qBAAqB;AAC3D,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,KAAK;AAChD,QAAM,CAAC,SAAS,UAAU,IAAI,SAAkC,IAAI;AACpE,QAAM,C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L,QAAQ;AAAA,UACR,SAAS,YAAY;AAAA,UACrB,UAAU,QAAQ,YAAY;AAAA,UAC9B,SAAS;AAAA,UAER,iBAAO;AAAA;AAAA,MACV,GAEJ;AAAA,MACC,SAAS,SAAS,YACjB,oBAAC,OAAE,MAAK,UAAS,WAAW,wBACzB,kBAAQ,MACX;AAAA,MAED,SAAS,SAAS,aACjB,oBAAC,eAAY,MAAK,WAAU,MAAK,MAAK,MAAK,UACxC,kBAAQ,MACX;AAAA,MAED,SAAS,SAAS,YAAY,oBAAC,eAAa,kBAAQ,MAAK;AAAA,OAC5D;AAAA,EAEJ;AAEA,SACE,qBAAC,QAAM,GAAG,MAAM,WAAW,GAAG,iBAAiB,SAAS,GACtD;AAAA,yBAAC,SACC;AAAA,0BAAC,qBAAmB,iBAAO,WAAU;AAAA,MACrC,oBAAC,SAAI,WAAW,wBAAyB,iBAAO,iBAAgB;AAAA,OAClE;AAAA,IACC;AAAA,IACD;AAAA,MAAC;AAAA;AAAA,QACC,MAAM;AAAA,QACN,SAAS,MAAM,aAAa,KAAK;AAAA,QACjC,OAAO,OAAO;AAAA,QACd,aAAa,OAAO,cAAc,OAAO;AAAA,QACzC,SAAS,CAAC,UACR,qBAAC,SAAI,WAAU,0BACb;AAAA,8BAAC,UAAO,MAAK,UAAS,SAAQ,SAAQ,SAAS,OAC5C,iBAAO,QACV;AAAA,UACA;AAAA,YAAC;AAAA;AAAA,cACC,MAAK;AAAA,cACL,SAAS,MAAM;AACb,6BAAa,KAAK;AAElB,uBAAO;AAAA,cACT;AAAA,cAEC,iBAAO;AAAA;AAAA,UACV;AAAA,WACF;AAAA,QAGF,8BAAC,OAAE,WAAW,wBAAyB,iBAAO,eAAc;AAAA;AAAA,IAC9D;AAAA,KACF;AAEJ;","names":[]}
@@ -19,7 +19,8 @@ export interface PushDevicesSettingProps<Id extends string | number = string> ex
19
19
  /** `DELETE /notifications/devices/{id}`. Asked first; refresh `devices` once it
20
20
  * resolves. */
21
21
  onRemove: (id: Id) => Promise<unknown> | void;
22
- /** The dates' text. Default: the provider's locale, medium date. */
22
+ /** The dates' text. Default: the provider's `formatDate` (the app's date preference),
23
+ * else a medium date in the provider's locale and `timeZone`. */
23
24
  formatDate?: (date: Date) => string;
24
25
  /** Overrides the provider's locale for the default format. */
25
26
  locale?: string;
@@ -1,21 +1,23 @@
1
1
  "use client";
2
2
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
- import { useEffect, useRef, useState } from "react";
3
+ import { useRef, useState } from "react";
4
4
  import { MonitorSmartphone } from "lucide-react";
5
- import { useKitLabels, useKitLocale } from "../i18n/kit-labels.js";
5
+ import { useKitLabels } from "../i18n/kit-labels.js";
6
6
  import { DEFAULT_COMMON_LABELS } from "../i18n/shared-labels.js";
7
7
  import { cn } from "../lib/cn.js";
8
- import { formatDate } from "../lib/format.js";
8
+ import { useDayFormatter } from "../lib/day-format.js";
9
+ import { toDate } from "../lib/format.js";
9
10
  import { Button } from "../components/button.js";
10
11
  import { Card } from "../components/card.js";
11
12
  import { Chip } from "../components/chip.js";
12
13
  import { Disclosure } from "../components/disclosure.js";
14
+ import { InlineConfirm } from "../components/inline-confirm.js";
13
15
  import { Skeleton } from "../components/skeleton.js";
14
16
  import { Switch } from "../components/switch.js";
15
17
  import { COMMIT_EXCEPT_BILLING } from "../components/write-lock.js";
16
18
  import { CARD_DESCRIPTION_CLASS } from "../settings/settings-card-classes.js";
17
19
  import { SettingsCardTitle } from "../settings/settings-heading.js";
18
- import { settle, useMounted } from "../account/account-parts.js";
20
+ import { settle, useMounted } from "../hooks/use-mounted.js";
19
21
  import { describeFailure, FailureLine, useNotificationsLabels, useWriteOverlay } from "./notification-parts.js";
20
22
  import { notifyPushSubscriptionChanged } from "./use-push-device.js";
21
23
  function describeUserAgent(ua) {
@@ -52,15 +54,14 @@ function PushDevicesSetting({
52
54
  const labels = useNotificationsLabels(labelsProp);
53
55
  const mutedOverlay = useWriteOverlay(devices);
54
56
  const common = useKitLabels("common", DEFAULT_COMMON_LABELS);
55
- const locale = useKitLocale(localeProp);
57
+ const day = useDayFormatter(formatDateProp, localeProp);
56
58
  const [asking, setAsking] = useState(null);
57
59
  const [busyId, setBusyId] = useState(null);
58
60
  const [failure, setFailure] = useState(null);
59
61
  const mounted = useMounted();
60
62
  const dateText = (iso) => {
61
- const date = new Date(iso);
62
- if (Number.isNaN(date.getTime())) return iso;
63
- return formatDateProp ? formatDateProp(date) : formatDate(date, "medium", { locale });
63
+ const date = toDate(iso);
64
+ return date ? day(date) : iso;
64
65
  };
65
66
  const remove = (device) => {
66
67
  if (busyId !== null) return;
@@ -179,46 +180,26 @@ function DeviceRow({
179
180
  cancelLabel,
180
181
  types
181
182
  }) {
182
- const cancelRef = useRef(null);
183
183
  const removeRef = useRef(null);
184
- const [returning, setReturning] = useState(false);
185
- useEffect(() => {
186
- if (asking) cancelRef.current?.focus();
187
- else if (returning) removeRef.current?.focus();
188
- }, [asking, returning]);
189
- const leave = () => {
190
- setReturning(true);
191
- onCancel();
192
- };
193
- const escapeLeaves = (event) => {
194
- if (event.key === "Escape") {
195
- event.preventDefault();
196
- event.stopPropagation();
197
- leave();
198
- }
199
- };
200
184
  const row = { "data-push-device-id": String(device.id), "data-current": current || void 0 };
201
185
  if (asking) {
202
- return /* @__PURE__ */ jsxs("li", { ...row, className: "space-y-2 py-2", children: [
203
- /* @__PURE__ */ jsx("p", { role: "alert", className: "text-sm", children: labels.removePrompt }),
204
- /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-2", children: [
205
- /* @__PURE__ */ jsx(
206
- Button,
207
- {
208
- type: "button",
209
- size: "sm",
210
- variant: "danger",
211
- commit: COMMIT_EXCEPT_BILLING,
212
- pending: busy,
213
- "aria-label": labels.removeItem(name),
214
- onClick: onConfirm,
215
- onKeyDown: escapeLeaves,
216
- children: labels.remove
217
- }
218
- ),
219
- /* @__PURE__ */ jsx(Button, { ref: cancelRef, type: "button", size: "sm", variant: "ghost", onClick: leave, onKeyDown: escapeLeaves, children: cancelLabel })
220
- ] })
221
- ] });
186
+ return /* @__PURE__ */ jsx(
187
+ InlineConfirm,
188
+ {
189
+ as: "li",
190
+ ...row,
191
+ className: "py-2",
192
+ prompt: labels.removePrompt,
193
+ confirmLabel: labels.remove,
194
+ confirmName: labels.removeItem(name),
195
+ cancelLabel,
196
+ onConfirm,
197
+ onLeave: onCancel,
198
+ busy,
199
+ commit: COMMIT_EXCEPT_BILLING,
200
+ returnFocusRef: removeRef
201
+ }
202
+ );
222
203
  }
223
204
  return /* @__PURE__ */ jsxs("li", { ...row, className: "space-y-1 py-2", children: [
224
205
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
@@ -245,10 +226,7 @@ function DeviceRow({
245
226
  commit: COMMIT_EXCEPT_BILLING,
246
227
  disabled: blocked,
247
228
  "aria-label": labels.removeItem(name),
248
- onClick: () => {
249
- setReturning(false);
250
- onAsk();
251
- },
229
+ onClick: onAsk,
252
230
  children: labels.remove
253
231
  }
254
232
  )
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/notifications/push-devices-setting.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from \"react\";\nimport type { ComponentPropsWithRef, KeyboardEvent, ReactNode } from \"react\";\nimport { MonitorSmartphone } from \"lucide-react\";\n\nimport { useKitLabels, useKitLocale, type LabelOverride } from \"../i18n/kit-labels\";\nimport { DEFAULT_COMMON_LABELS } from \"../i18n/shared-labels\";\nimport { cn } from \"../lib/cn\";\nimport { formatDate } from \"../lib/format\";\nimport { Button } from \"../components/button\";\nimport { Card } from \"../components/card\";\nimport { Chip } from \"../components/chip\";\nimport { Disclosure } from \"../components/disclosure\";\nimport { Skeleton } from \"../components/skeleton\";\nimport { Switch } from \"../components/switch\";\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 { NotificationsLabels } from \"./notifications-labels\";\nimport type { NotificationTypeEntry, NotificationTypesValue, PushDeviceItem } from \"./notification-types\";\nimport { notifyPushSubscriptionChanged } from \"./use-push-device\";\n\n/**\n * A name for a stored user agent: \"Chrome · Android\", \"Firefox · Windows\" (keksdose\n * `push-devices-card.tsx:19-45`). Best effort: an agent it does not recognise comes back\n * as it is, cut at 60 characters so a token soup cannot blow up the row; `null` for none.\n * The order matters — Edge and Opera say \"Chrome\" too, and Chrome says \"Safari\".\n */\nexport function describeUserAgent(ua: string | null): string | null {\n if (!ua) return null;\n const browser = /edg(?:e|a|ios)?\\//i.test(ua)\n ? \"Edge\"\n : /opr\\/|opera/i.test(ua)\n ? \"Opera\"\n : /firefox|fxios/i.test(ua)\n ? \"Firefox\"\n : /chrome|crios/i.test(ua)\n ? \"Chrome\"\n : /safari/i.test(ua)\n ? \"Safari\"\n : null;\n const os = /windows/i.test(ua)\n ? \"Windows\"\n : /android/i.test(ua)\n ? \"Android\"\n : /iphone|ipad|ipod/i.test(ua)\n ? \"iOS\"\n : /mac os x|macintosh/i.test(ua)\n ? \"macOS\"\n : /linux/i.test(ua)\n ? \"Linux\"\n : null;\n if (!browser && !os) return ua.length > 60 ? `${ua.slice(0, 60)}…` : ua;\n return [browser, os].filter(Boolean).join(\" · \");\n}\n\nexport interface PushDevicesSettingProps<Id extends string | number = string> extends Omit<\n ComponentPropsWithRef<\"div\">,\n \"children\"\n> {\n /** `GET /notifications/devices`, oldest first; `undefined` while the first load runs. */\n devices: readonly PushDeviceItem<Id>[] | undefined;\n loading?: boolean;\n /** This browser's endpoint (`usePushDevice().currentEndpoint`): its row says \"This\n * device\", and removing it also unsubscribes the browser. */\n currentEndpoint?: string | null;\n /** `DELETE /notifications/devices/{id}`. Asked first; refresh `devices` once it\n * resolves. */\n onRemove: (id: Id) => Promise<unknown> | void;\n /** The dates' text. Default: the provider's locale, medium date. */\n formatDate?: (date: Date) => string;\n /** Overrides the provider's locale for the default format. */\n locale?: string;\n /** The app's own words for a failed removal, or `undefined` for the kit's `failed`. */\n describeError?: (error: unknown) => ReactNode | undefined;\n /**\n * 0.46 (§10.2): \"Types on this device\" on each row — a switch per type whose account\n * `push` is on, all on until the device mutes one. Save the device's WHOLE list:\n * `PATCH /notifications/devices/{id} {\"muted_types\": [...]}`; refresh `devices` once it\n * resolves. Left out, no row has the disclosure.\n */\n onMutedTypesChange?: (id: Id, mutedTypes: string[]) => Promise<unknown> | void;\n /** The app's words for its types (the types card's `types`), for the disclosure. */\n types?: readonly NotificationTypeEntry[];\n /** The settings `GET`'s `types` (the types card's `value`): which types have push on. */\n typeSwitches?: NotificationTypesValue;\n labels?: LabelOverride<NotificationsLabels>;\n}\n\n/** Tear down this browser's subscription after its server row went: otherwise the\n * browser still holds one, and the push card would say \"on\" for a device nothing can\n * reach. Best effort — the row is already gone. */\nasync function unsubscribeThisBrowser(): Promise<void> {\n try {\n const registration = await navigator.serviceWorker?.getRegistration();\n const subscription = await registration?.pushManager.getSubscription();\n await subscription?.unsubscribe();\n } catch {\n /* the server row is gone either way */\n }\n notifyPushSubscriptionChanged();\n}\n\n/**\n * Every device that gets push for the account (docs/notifications-harmonization.md §3.5,\n * §4.2) — keksdose's devices card: the browser and system read from the stored user\n * agent, \"This device\" on this browser's row, when it was added and last delivered to,\n * the failures in a row in the warning tone, and \"Remove\".\n *\n * **Remove asks first, in the row**, as `PasskeysSetting` does: the card must work in an\n * app without a `ConfirmProvider`, and the question belongs beside the device it names.\n * Focus moves to Cancel. **Removing this device** also unsubscribes the browser and fires\n * `PUSH_SUBSCRIPTION_CHANGED` (keksdose `push-devices-card.tsx:83-97`), so the push card\n * stops saying \"on\".\n *\n * **\"Types on this device\"** (0.46, §10.2, with `onMutedTypesChange`): a disclosure under\n * each row with a switch per type the account gets by push; turning one off mutes it on\n * that device only — a device can mute types, never add them. Each flip saves the\n * device's whole `muted_types` list.\n *\n * Under a write lock Remove and the type switches are `commit` controls exempt from\n * billing.\n */\nexport function PushDevicesSetting<Id extends string | number = string>({\n devices,\n loading,\n currentEndpoint,\n onRemove,\n formatDate: formatDateProp,\n locale: localeProp,\n describeError,\n onMutedTypesChange,\n types,\n typeSwitches,\n labels: labelsProp,\n className,\n ...rest\n}: PushDevicesSettingProps<Id>) {\n const labels = useNotificationsLabels(labelsProp);\n const mutedOverlay = useWriteOverlay<string[]>(devices);\n const common = useKitLabels(\"common\", DEFAULT_COMMON_LABELS);\n const locale = useKitLocale(localeProp);\n const [asking, setAsking] = useState<Id | null>(null);\n const [busyId, setBusyId] = useState<Id | null>(null);\n const [failure, setFailure] = useState<ReactNode>(null);\n const mounted = useMounted();\n\n const dateText = (iso: string): string => {\n const date = new Date(iso);\n if (Number.isNaN(date.getTime())) return iso;\n return formatDateProp ? formatDateProp(date) : formatDate(date, \"medium\", { locale });\n };\n\n const remove = (device: PushDeviceItem<Id>) => {\n if (busyId !== null) return;\n setBusyId(device.id);\n setFailure(null);\n const isThis = Boolean(currentEndpoint) && device.endpoint === currentEndpoint;\n settle(() => onRemove(device.id))\n .then(async () => {\n if (isThis) await unsubscribeThisBrowser();\n if (!mounted.current) return;\n setBusyId(null);\n setAsking(null);\n })\n .catch((error: unknown) => {\n if (!mounted.current) return;\n setBusyId(null);\n setFailure(describeFailure(describeError?.(error), labels.failed));\n });\n };\n\n // The types a device can mute: those the account gets by push, in the app's order.\n const pushTypes = (types ?? []).filter((entry) => typeSwitches?.[entry.id]?.push === true);\n const mutedOf = (device: PushDeviceItem<Id>): string[] =>\n mutedOverlay.get(String(device.id)) ??\n // Ids the registry dropped (no longer in the settings answer) are ignored.\n (device.muted_types ?? []).filter((id) => !typeSwitches || id in typeSwitches);\n const setMuted = (device: PushDeviceItem<Id>, id: string, on: boolean) => {\n const key = String(device.id);\n if (!onMutedTypesChange || mutedOverlay.pending(key)) return;\n const current = mutedOf(device);\n const next = on ? current.filter((muted) => muted !== id) : [...current.filter((muted) => muted !== id), id];\n setFailure(null);\n mutedOverlay.set(key, next);\n settle(() => onMutedTypesChange(device.id, next)).then(\n () => {\n if (mounted.current) mutedOverlay.settle(key, true);\n },\n (error: unknown) => {\n if (!mounted.current) return;\n mutedOverlay.settle(key, false);\n setFailure(describeFailure(describeError?.(error), labels.failed));\n },\n );\n };\n const typesOf = (device: PushDeviceItem<Id>, name: string): ReactNode => {\n if (!onMutedTypesChange) return null;\n const muted = mutedOf(device);\n return (\n <Disclosure\n variant=\"bare\"\n title={labels.deviceTypes}\n // Every row has one: the name says whose (it starts with the visible words).\n triggerProps={{ \"aria-label\": `${labels.deviceTypes}: ${name}` }}\n className=\"text-sm\"\n data-device-types=\"\"\n >\n <div className=\"space-y-2 pt-1 ps-6\">\n {pushTypes.length === 0 ? (\n <p className={CARD_DESCRIPTION_CLASS}>{labels.deviceTypesEmpty}</p>\n ) : (\n <>\n <p className={CARD_DESCRIPTION_CLASS}>{labels.deviceTypesDescription}</p>\n {pushTypes.map((entry) => (\n <Switch\n key={entry.id}\n size=\"sm\"\n label={entry.label}\n checked={!muted.includes(entry.id)}\n commit={COMMIT_EXCEPT_BILLING}\n onCheckedChange={(on) => setMuted(device, entry.id, on)}\n />\n ))}\n </>\n )}\n </div>\n </Disclosure>\n );\n };\n\n let body: ReactNode;\n if (loading || devices === undefined) {\n body = <Skeleton lines={2} label={labels.devicesLoading} />;\n } else if (devices.length === 0) {\n body = <p className={CARD_DESCRIPTION_CLASS}>{labels.devicesEmpty}</p>;\n } else {\n body = (\n <ul aria-label={labels.devicesTitle} className=\"divide-y divide-subtle\">\n {devices.map((device) => (\n <DeviceRow\n key={device.id}\n device={device}\n name={describeUserAgent(device.user_agent) ?? labels.unknownDevice}\n current={Boolean(currentEndpoint) && device.endpoint === currentEndpoint}\n added={dateText(device.created_at)}\n lastDelivery={device.last_success_at ? dateText(device.last_success_at) : null}\n asking={asking === device.id}\n busy={busyId === device.id}\n blocked={busyId !== null && busyId !== device.id}\n onAsk={() => setAsking(device.id)}\n onCancel={() => setAsking(null)}\n onConfirm={() => remove(device)}\n labels={labels}\n cancelLabel={common.cancel}\n types={typesOf(device, describeUserAgent(device.user_agent) ?? labels.unknownDevice)}\n />\n ))}\n </ul>\n );\n }\n\n return (\n <Card {...rest} className={cn(\"p-4 space-y-3\", className)}>\n <div>\n <SettingsCardTitle>{labels.devicesTitle}</SettingsCardTitle>\n <div className={CARD_DESCRIPTION_CLASS}>{labels.devicesDescription}</div>\n </div>\n {body}\n <FailureLine>{failure}</FailureLine>\n </Card>\n );\n}\n\nfunction DeviceRow<Id extends string | number>({\n device,\n name,\n current,\n added,\n lastDelivery,\n asking,\n busy,\n blocked,\n onAsk,\n onCancel,\n onConfirm,\n labels,\n cancelLabel,\n types,\n}: {\n device: PushDeviceItem<Id>;\n name: string;\n current: boolean;\n added: string;\n lastDelivery: string | null;\n asking: boolean;\n busy: boolean;\n blocked: boolean;\n onAsk: () => void;\n onCancel: () => void;\n onConfirm: () => void;\n labels: NotificationsLabels;\n cancelLabel: string;\n /** \"Types on this device\", under the row (0.46). */\n types: ReactNode;\n}) {\n const cancelRef = useRef<HTMLButtonElement>(null);\n const removeRef = useRef<HTMLButtonElement>(null);\n // Which way the confirm closed: back to Remove, so focus does not fall to <body>.\n const [returning, setReturning] = useState(false);\n useEffect(() => {\n if (asking) cancelRef.current?.focus();\n else if (returning) removeRef.current?.focus();\n }, [asking, returning]);\n\n const leave = () => {\n setReturning(true);\n onCancel();\n };\n const escapeLeaves = (event: KeyboardEvent<HTMLButtonElement>) => {\n if (event.key === \"Escape\") {\n event.preventDefault();\n event.stopPropagation();\n leave();\n }\n };\n\n const row = { \"data-push-device-id\": String(device.id), \"data-current\": current || undefined };\n\n if (asking) {\n return (\n <li {...row} className=\"space-y-2 py-2\">\n <p role=\"alert\" className=\"text-sm\">\n {labels.removePrompt}\n </p>\n <div className=\"flex flex-wrap gap-2\">\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"danger\"\n commit={COMMIT_EXCEPT_BILLING}\n pending={busy}\n aria-label={labels.removeItem(name)}\n onClick={onConfirm}\n onKeyDown={escapeLeaves}\n >\n {labels.remove}\n </Button>\n <Button ref={cancelRef} type=\"button\" size=\"sm\" variant=\"ghost\" onClick={leave} onKeyDown={escapeLeaves}>\n {cancelLabel}\n </Button>\n </div>\n </li>\n );\n }\n\n return (\n <li {...row} className=\"space-y-1 py-2\">\n <div className=\"flex items-center gap-3\">\n <MonitorSmartphone aria-hidden className=\"size-4 shrink-0 text-muted\" />\n <div className=\"min-w-0 flex-1\">\n <div className=\"flex flex-wrap items-center gap-x-2 gap-y-1\">\n <span className=\"min-w-0 break-words text-sm font-medium\">{name}</span>\n {current && (\n <Chip size=\"sm\" tone=\"brand\">\n {labels.thisDevice}\n </Chip>\n )}\n </div>\n <div className={CARD_DESCRIPTION_CLASS}>\n {labels.added(added)}\n {\" · \"}\n {lastDelivery ? labels.lastDelivery(lastDelivery) : labels.noDelivery}\n </div>\n {device.failure_count > 0 && (\n <div className=\"text-xs text-warning\">{labels.failures(device.failure_count)}</div>\n )}\n </div>\n <Button\n ref={removeRef}\n type=\"button\"\n size=\"sm\"\n variant=\"ghost\"\n commit={COMMIT_EXCEPT_BILLING}\n disabled={blocked}\n aria-label={labels.removeItem(name)}\n onClick={() => {\n setReturning(false);\n onAsk();\n }}\n >\n {labels.remove}\n </Button>\n </div>\n {types}\n </li>\n );\n}\n"],"mappings":";AAmNY,SAEA,UAFA,KAEA,YAFA;AAnNZ,SAAS,WAAW,QAAQ,gBAAgB;AAE5C,SAAS,yBAAyB;AAElC,SAAS,cAAc,oBAAwC;AAC/D,SAAS,6BAA6B;AACtC,SAAS,UAAU;AACnB,SAAS,kBAAkB;AAC3B,SAAS,cAAc;AACvB,SAAS,YAAY;AACrB,SAAS,YAAY;AACrB,SAAS,kBAAkB;AAC3B,SAAS,gBAAgB;AACzB,SAAS,cAAc;AACvB,SAAS,6BAA6B;AACtC,SAAS,8BAA8B;AACvC,SAAS,yBAAyB;AACl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AA,yBAAC,SAAI,WAAU,2BACb;AAAA,0BAAC,qBAAkB,eAAW,MAAC,WAAU,8BAA6B;AAAA,MACtE,qBAAC,SAAI,WAAU,kBACb;AAAA,6BAAC,SAAI,WAAU,+CACb;AAAA,8BAAC,UAAK,WAAU,2CAA2C,gBAAK;AAAA,UAC/D,WACC,oBAAC,QAAK,MAAK,MAAK,MAAK,SAClB,iBAAO,YACV;AAAA,WAEJ;AAAA,QACA,qBAAC,SAAI,WAAW,wBACb;AAAA,iBAAO,MAAM,KAAK;AAAA,UAClB;AAAA,UACA,eAAe,OAAO,aAAa,YAAY,IAAI,OAAO;AAAA,WAC7D;AAAA,QACC,OAAO,gBAAgB,KACtB,oBAAC,SAAI,WAAU,wBAAwB,iBAAO,SAAS,OAAO,aAAa,GAAE;AAAA,SAEjF;AAAA,MACA;AAAA,QAAC;AAAA;AAAA,UACC,KAAK;AAAA,UACL,MAAK;AAAA,UACL,MAAK;AAAA,UACL,SAAQ;AAAA,UACR,QAAQ;AAAA,UACR,UAAU;AAAA,UACV,cAAY,OAAO,WAAW,IAAI;AAAA,UAClC,SAAS,MAAM;AACb,yBAAa,KAAK;AAClB,kBAAM;AAAA,UACR;AAAA,UAEC,iBAAO;AAAA;AAAA,MACV;AAAA,OACF;AAAA,IACC;AAAA,KACH;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../src/notifications/push-devices-setting.tsx"],"sourcesContent":["import { useRef, useState } from \"react\";\nimport type { ComponentPropsWithRef, ReactNode } from \"react\";\nimport { MonitorSmartphone } from \"lucide-react\";\n\nimport { useKitLabels, type LabelOverride } from \"../i18n/kit-labels\";\nimport { DEFAULT_COMMON_LABELS } from \"../i18n/shared-labels\";\nimport { cn } from \"../lib/cn\";\nimport { useDayFormatter } from \"../lib/day-format\";\nimport { toDate } from \"../lib/format\";\nimport { Button } from \"../components/button\";\nimport { Card } from \"../components/card\";\nimport { Chip } from \"../components/chip\";\nimport { Disclosure } from \"../components/disclosure\";\nimport { InlineConfirm } from \"../components/inline-confirm\";\nimport { Skeleton } from \"../components/skeleton\";\nimport { Switch } from \"../components/switch\";\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 \"../hooks/use-mounted\";\nimport { describeFailure, FailureLine, useNotificationsLabels, useWriteOverlay } from \"./notification-parts\";\nimport type { NotificationsLabels } from \"./notifications-labels\";\nimport type { NotificationTypeEntry, NotificationTypesValue, PushDeviceItem } from \"./notification-types\";\nimport { notifyPushSubscriptionChanged } from \"./use-push-device\";\n\n/**\n * A name for a stored user agent: \"Chrome · Android\", \"Firefox · Windows\" (keksdose\n * `push-devices-card.tsx:19-45`). Best effort: an agent it does not recognise comes back\n * as it is, cut at 60 characters so a token soup cannot blow up the row; `null` for none.\n * The order matters — Edge and Opera say \"Chrome\" too, and Chrome says \"Safari\".\n */\nexport function describeUserAgent(ua: string | null): string | null {\n if (!ua) return null;\n const browser = /edg(?:e|a|ios)?\\//i.test(ua)\n ? \"Edge\"\n : /opr\\/|opera/i.test(ua)\n ? \"Opera\"\n : /firefox|fxios/i.test(ua)\n ? \"Firefox\"\n : /chrome|crios/i.test(ua)\n ? \"Chrome\"\n : /safari/i.test(ua)\n ? \"Safari\"\n : null;\n const os = /windows/i.test(ua)\n ? \"Windows\"\n : /android/i.test(ua)\n ? \"Android\"\n : /iphone|ipad|ipod/i.test(ua)\n ? \"iOS\"\n : /mac os x|macintosh/i.test(ua)\n ? \"macOS\"\n : /linux/i.test(ua)\n ? \"Linux\"\n : null;\n if (!browser && !os) return ua.length > 60 ? `${ua.slice(0, 60)}…` : ua;\n return [browser, os].filter(Boolean).join(\" · \");\n}\n\nexport interface PushDevicesSettingProps<Id extends string | number = string> extends Omit<\n ComponentPropsWithRef<\"div\">,\n \"children\"\n> {\n /** `GET /notifications/devices`, oldest first; `undefined` while the first load runs. */\n devices: readonly PushDeviceItem<Id>[] | undefined;\n loading?: boolean;\n /** This browser's endpoint (`usePushDevice().currentEndpoint`): its row says \"This\n * device\", and removing it also unsubscribes the browser. */\n currentEndpoint?: string | null;\n /** `DELETE /notifications/devices/{id}`. Asked first; refresh `devices` once it\n * resolves. */\n onRemove: (id: Id) => Promise<unknown> | void;\n /** The dates' text. Default: the provider's `formatDate` (the app's date preference),\n * else a medium date in the provider's locale and `timeZone`. */\n formatDate?: (date: Date) => string;\n /** Overrides the provider's locale for the default format. */\n locale?: string;\n /** The app's own words for a failed removal, or `undefined` for the kit's `failed`. */\n describeError?: (error: unknown) => ReactNode | undefined;\n /**\n * 0.46 (§10.2): \"Types on this device\" on each row — a switch per type whose account\n * `push` is on, all on until the device mutes one. Save the device's WHOLE list:\n * `PATCH /notifications/devices/{id} {\"muted_types\": [...]}`; refresh `devices` once it\n * resolves. Left out, no row has the disclosure.\n */\n onMutedTypesChange?: (id: Id, mutedTypes: string[]) => Promise<unknown> | void;\n /** The app's words for its types (the types card's `types`), for the disclosure. */\n types?: readonly NotificationTypeEntry[];\n /** The settings `GET`'s `types` (the types card's `value`): which types have push on. */\n typeSwitches?: NotificationTypesValue;\n labels?: LabelOverride<NotificationsLabels>;\n}\n\n/** Tear down this browser's subscription after its server row went: otherwise the\n * browser still holds one, and the push card would say \"on\" for a device nothing can\n * reach. Best effort — the row is already gone. */\nasync function unsubscribeThisBrowser(): Promise<void> {\n try {\n const registration = await navigator.serviceWorker?.getRegistration();\n const subscription = await registration?.pushManager.getSubscription();\n await subscription?.unsubscribe();\n } catch {\n /* the server row is gone either way */\n }\n notifyPushSubscriptionChanged();\n}\n\n/**\n * Every device that gets push for the account (docs/notifications-harmonization.md §3.5,\n * §4.2) — keksdose's devices card: the browser and system read from the stored user\n * agent, \"This device\" on this browser's row, when it was added and last delivered to,\n * the failures in a row in the warning tone, and \"Remove\".\n *\n * **Remove asks first, in the row**, as `PasskeysSetting` does: the card must work in an\n * app without a `ConfirmProvider`, and the question belongs beside the device it names.\n * Focus moves to Cancel. **Removing this device** also unsubscribes the browser and fires\n * `PUSH_SUBSCRIPTION_CHANGED` (keksdose `push-devices-card.tsx:83-97`), so the push card\n * stops saying \"on\".\n *\n * **\"Types on this device\"** (0.46, §10.2, with `onMutedTypesChange`): a disclosure under\n * each row with a switch per type the account gets by push; turning one off mutes it on\n * that device only — a device can mute types, never add them. Each flip saves the\n * device's whole `muted_types` list.\n *\n * Under a write lock Remove and the type switches are `commit` controls exempt from\n * billing.\n */\nexport function PushDevicesSetting<Id extends string | number = string>({\n devices,\n loading,\n currentEndpoint,\n onRemove,\n formatDate: formatDateProp,\n locale: localeProp,\n describeError,\n onMutedTypesChange,\n types,\n typeSwitches,\n labels: labelsProp,\n className,\n ...rest\n}: PushDevicesSettingProps<Id>) {\n const labels = useNotificationsLabels(labelsProp);\n const mutedOverlay = useWriteOverlay<string[]>(devices);\n const common = useKitLabels(\"common\", DEFAULT_COMMON_LABELS);\n // The prop, else the provider's `formatDate` (the app's date preference), else the kit's\n // in the provider's locale and `timeZone` (refactor audit 2026-10-30, DUP-2).\n const day = useDayFormatter(formatDateProp, localeProp);\n const [asking, setAsking] = useState<Id | null>(null);\n const [busyId, setBusyId] = useState<Id | null>(null);\n const [failure, setFailure] = useState<ReactNode>(null);\n const mounted = useMounted();\n\n const dateText = (iso: string): string => {\n const date = toDate(iso);\n return date ? day(date) : iso;\n };\n\n const remove = (device: PushDeviceItem<Id>) => {\n if (busyId !== null) return;\n setBusyId(device.id);\n setFailure(null);\n const isThis = Boolean(currentEndpoint) && device.endpoint === currentEndpoint;\n settle(() => onRemove(device.id))\n .then(async () => {\n if (isThis) await unsubscribeThisBrowser();\n if (!mounted.current) return;\n setBusyId(null);\n setAsking(null);\n })\n .catch((error: unknown) => {\n if (!mounted.current) return;\n setBusyId(null);\n setFailure(describeFailure(describeError?.(error), labels.failed));\n });\n };\n\n // The types a device can mute: those the account gets by push, in the app's order.\n const pushTypes = (types ?? []).filter((entry) => typeSwitches?.[entry.id]?.push === true);\n const mutedOf = (device: PushDeviceItem<Id>): string[] =>\n mutedOverlay.get(String(device.id)) ??\n // Ids the registry dropped (no longer in the settings answer) are ignored.\n (device.muted_types ?? []).filter((id) => !typeSwitches || id in typeSwitches);\n const setMuted = (device: PushDeviceItem<Id>, id: string, on: boolean) => {\n const key = String(device.id);\n if (!onMutedTypesChange || mutedOverlay.pending(key)) return;\n const current = mutedOf(device);\n const next = on ? current.filter((muted) => muted !== id) : [...current.filter((muted) => muted !== id), id];\n setFailure(null);\n mutedOverlay.set(key, next);\n settle(() => onMutedTypesChange(device.id, next)).then(\n () => {\n if (mounted.current) mutedOverlay.settle(key, true);\n },\n (error: unknown) => {\n if (!mounted.current) return;\n mutedOverlay.settle(key, false);\n setFailure(describeFailure(describeError?.(error), labels.failed));\n },\n );\n };\n const typesOf = (device: PushDeviceItem<Id>, name: string): ReactNode => {\n if (!onMutedTypesChange) return null;\n const muted = mutedOf(device);\n return (\n <Disclosure\n variant=\"bare\"\n title={labels.deviceTypes}\n // Every row has one: the name says whose (it starts with the visible words).\n triggerProps={{ \"aria-label\": `${labels.deviceTypes}: ${name}` }}\n className=\"text-sm\"\n data-device-types=\"\"\n >\n <div className=\"space-y-2 pt-1 ps-6\">\n {pushTypes.length === 0 ? (\n <p className={CARD_DESCRIPTION_CLASS}>{labels.deviceTypesEmpty}</p>\n ) : (\n <>\n <p className={CARD_DESCRIPTION_CLASS}>{labels.deviceTypesDescription}</p>\n {pushTypes.map((entry) => (\n <Switch\n key={entry.id}\n size=\"sm\"\n label={entry.label}\n checked={!muted.includes(entry.id)}\n commit={COMMIT_EXCEPT_BILLING}\n onCheckedChange={(on) => setMuted(device, entry.id, on)}\n />\n ))}\n </>\n )}\n </div>\n </Disclosure>\n );\n };\n\n let body: ReactNode;\n if (loading || devices === undefined) {\n body = <Skeleton lines={2} label={labels.devicesLoading} />;\n } else if (devices.length === 0) {\n body = <p className={CARD_DESCRIPTION_CLASS}>{labels.devicesEmpty}</p>;\n } else {\n body = (\n <ul aria-label={labels.devicesTitle} className=\"divide-y divide-subtle\">\n {devices.map((device) => (\n <DeviceRow\n key={device.id}\n device={device}\n name={describeUserAgent(device.user_agent) ?? labels.unknownDevice}\n current={Boolean(currentEndpoint) && device.endpoint === currentEndpoint}\n added={dateText(device.created_at)}\n lastDelivery={device.last_success_at ? dateText(device.last_success_at) : null}\n asking={asking === device.id}\n busy={busyId === device.id}\n blocked={busyId !== null && busyId !== device.id}\n onAsk={() => setAsking(device.id)}\n onCancel={() => setAsking(null)}\n onConfirm={() => remove(device)}\n labels={labels}\n cancelLabel={common.cancel}\n types={typesOf(device, describeUserAgent(device.user_agent) ?? labels.unknownDevice)}\n />\n ))}\n </ul>\n );\n }\n\n return (\n <Card {...rest} className={cn(\"p-4 space-y-3\", className)}>\n <div>\n <SettingsCardTitle>{labels.devicesTitle}</SettingsCardTitle>\n <div className={CARD_DESCRIPTION_CLASS}>{labels.devicesDescription}</div>\n </div>\n {body}\n <FailureLine>{failure}</FailureLine>\n </Card>\n );\n}\n\nfunction DeviceRow<Id extends string | number>({\n device,\n name,\n current,\n added,\n lastDelivery,\n asking,\n busy,\n blocked,\n onAsk,\n onCancel,\n onConfirm,\n labels,\n cancelLabel,\n types,\n}: {\n device: PushDeviceItem<Id>;\n name: string;\n current: boolean;\n added: string;\n lastDelivery: string | null;\n asking: boolean;\n busy: boolean;\n blocked: boolean;\n onAsk: () => void;\n onCancel: () => void;\n onConfirm: () => void;\n labels: NotificationsLabels;\n cancelLabel: string;\n /** \"Types on this device\", under the row (0.46). */\n types: ReactNode;\n}) {\n // Back to Remove when the confirm leaves, so focus does not fall to <body>.\n const removeRef = useRef<HTMLButtonElement>(null);\n\n const row = { \"data-push-device-id\": String(device.id), \"data-current\": current || undefined };\n\n if (asking) {\n return (\n <InlineConfirm\n as=\"li\"\n {...row}\n className=\"py-2\"\n prompt={labels.removePrompt}\n confirmLabel={labels.remove}\n confirmName={labels.removeItem(name)}\n cancelLabel={cancelLabel}\n onConfirm={onConfirm}\n onLeave={onCancel}\n busy={busy}\n commit={COMMIT_EXCEPT_BILLING}\n returnFocusRef={removeRef}\n />\n );\n }\n\n return (\n <li {...row} className=\"space-y-1 py-2\">\n <div className=\"flex items-center gap-3\">\n <MonitorSmartphone aria-hidden className=\"size-4 shrink-0 text-muted\" />\n <div className=\"min-w-0 flex-1\">\n <div className=\"flex flex-wrap items-center gap-x-2 gap-y-1\">\n <span className=\"min-w-0 break-words text-sm font-medium\">{name}</span>\n {current && (\n <Chip size=\"sm\" tone=\"brand\">\n {labels.thisDevice}\n </Chip>\n )}\n </div>\n <div className={CARD_DESCRIPTION_CLASS}>\n {labels.added(added)}\n {\" · \"}\n {lastDelivery ? labels.lastDelivery(lastDelivery) : labels.noDelivery}\n </div>\n {device.failure_count > 0 && (\n <div className=\"text-xs text-warning\">{labels.failures(device.failure_count)}</div>\n )}\n </div>\n <Button\n ref={removeRef}\n type=\"button\"\n size=\"sm\"\n variant=\"ghost\"\n commit={COMMIT_EXCEPT_BILLING}\n disabled={blocked}\n aria-label={labels.removeItem(name)}\n onClick={onAsk}\n >\n {labels.remove}\n </Button>\n </div>\n {types}\n </li>\n );\n}\n"],"mappings":";AAuNY,SAEA,UAFA,KAEA,YAFA;AAvNZ,SAAS,QAAQ,gBAAgB;AAEjC,SAAS,yBAAyB;AAElC,SAAS,oBAAwC;AACjD,SAAS,6BAA6B;AACtC,SAAS,UAAU;AACnB,SAAS,uBAAuB;AAChC,SAAS,cAAc;AACvB,SAAS,cAAc;AACvB,SAAS,YAAY;AACrB,SAAS,YAAY;AACrB,SAAS,kBAAkB;AAC3B,SAAS,qBAAqB;AAC9B,SAAS,gBAAgB;AACzB,SAAS,cAAc;AACvB,SAAS,6BAA6B;AACtC,SAAS,8BAA8B;AACvC,SAAS,yBAAyB;AAClC,SAAS,QAAQ,kBAAkB;AACnC,SAAS,iBAAiB,aAAa,wBAAwB,uBAAuB;AAGtF,SAAS,qCAAqC;AAQvC,SAAS,kBAAk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