@eifi1/ui-kit 0.32.1 → 0.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -8
- package/dist/account/delete-account-setting.d.ts +10 -10
- package/dist/account/delete-account-setting.js +2 -1
- package/dist/account/delete-account-setting.js.map +1 -1
- package/dist/account/email-change-setting.d.ts +5 -0
- package/dist/account/email-change-setting.js +4 -3
- package/dist/account/email-change-setting.js.map +1 -1
- package/dist/account/sessions-setting.d.ts +4 -0
- package/dist/account/sessions-setting.js +3 -2
- package/dist/account/sessions-setting.js.map +1 -1
- package/dist/admin/admin-action-confirm.d.ts +10 -10
- package/dist/admin/admin-action-confirm.js.map +1 -1
- package/dist/admin/invitations-panel.d.ts +10 -10
- package/dist/admin/invitations-panel.js +4 -3
- package/dist/admin/invitations-panel.js.map +1 -1
- package/dist/admin/plan-change.d.ts +100 -0
- package/dist/admin/plan-change.js +208 -0
- package/dist/admin/plan-change.js.map +1 -0
- package/dist/admin/reviewer-scope-editor.d.ts +10 -10
- package/dist/admin/reviewer-scope-editor.js.map +1 -1
- package/dist/admin/role-select.d.ts +7 -7
- package/dist/admin/role-select.js.map +1 -1
- package/dist/admin/transfer-ownership-dialog.d.ts +10 -10
- package/dist/admin/user-roster.d.ts +7 -7
- package/dist/admin/user-roster.js +2 -2
- package/dist/admin/user-roster.js.map +1 -1
- package/dist/auth/auth-errors.d.ts +13 -2
- package/dist/auth/auth-errors.js +5 -1
- package/dist/auth/auth-errors.js.map +1 -1
- package/dist/auth/complete-name-dialog.d.ts +4 -1
- package/dist/auth/complete-name-dialog.js +2 -1
- package/dist/auth/complete-name-dialog.js.map +1 -1
- package/dist/auth/register-form.d.ts +10 -10
- package/dist/billing/billing-banner.d.ts +13 -11
- package/dist/billing/billing-banner.js.map +1 -1
- package/dist/billing/billing-labels.d.ts +10 -10
- package/dist/billing/billing-labels.js +10 -1
- package/dist/billing/billing-labels.js.map +1 -1
- package/dist/billing/billing-lock.d.ts +39 -12
- package/dist/billing/billing-lock.js +9 -3
- package/dist/billing/billing-lock.js.map +1 -1
- package/dist/billing/billing-overview.d.ts +154 -0
- package/dist/billing/billing-overview.js +2 -0
- package/dist/billing/billing-overview.js.map +1 -0
- package/dist/billing/billing-standing.d.ts +10 -10
- package/dist/billing/checkout-processing.d.ts +217 -0
- package/dist/billing/checkout-processing.js +198 -0
- package/dist/billing/checkout-processing.js.map +1 -0
- package/dist/billing/checkout-return.d.ts +51 -0
- package/dist/billing/checkout-return.js +43 -0
- package/dist/billing/checkout-return.js.map +1 -0
- package/dist/billing/pay-page.d.ts +210 -0
- package/dist/billing/pay-page.js +113 -0
- package/dist/billing/pay-page.js.map +1 -0
- package/dist/billing/plan-card.d.ts +10 -10
- package/dist/billing/plan-limit-notice.d.ts +10 -10
- package/dist/billing/plan-limit-toast.d.ts +143 -0
- package/dist/billing/plan-limit-toast.js +40 -0
- package/dist/billing/plan-limit-toast.js.map +1 -0
- package/dist/billing/subscription-actions.d.ts +38 -15
- package/dist/billing/subscription-actions.js +9 -2
- package/dist/billing/subscription-actions.js.map +1 -1
- package/dist/billing/subscription-status-chip.d.ts +9 -9
- package/dist/bin/eifi1-pay-page.mjs +166 -0
- package/dist/chart.d.ts +10 -10
- package/dist/components/account-chips.d.ts +6 -1
- package/dist/components/account-settings.d.ts +4 -1
- package/dist/components/account-settings.js +2 -1
- package/dist/components/account-settings.js.map +1 -1
- package/dist/components/amount-input.d.ts +10 -10
- package/dist/components/autocomplete.d.ts +2 -1
- package/dist/components/autocomplete.js +3 -1
- package/dist/components/autocomplete.js.map +1 -1
- package/dist/components/button-group.d.ts +10 -10
- package/dist/components/button-group.js +1 -1
- package/dist/components/button-group.js.map +1 -1
- package/dist/components/calculator.d.ts +10 -10
- package/dist/components/calculator.js +3 -3
- package/dist/components/calculator.js.map +1 -1
- package/dist/components/checkbox-group.d.ts +2 -1
- package/dist/components/checkbox-group.js.map +1 -1
- package/dist/components/checkbox.d.ts +2 -1
- package/dist/components/checkbox.js.map +1 -1
- package/dist/components/chip.d.ts +2 -1
- package/dist/components/chip.js +19 -17
- package/dist/components/chip.js.map +1 -1
- package/dist/components/choice-card.d.ts +3 -1
- package/dist/components/choice-card.js +1 -1
- package/dist/components/choice-card.js.map +1 -1
- package/dist/components/combobox.d.ts +4 -3
- package/dist/components/combobox.js.map +1 -1
- package/dist/components/confirm-dialog.d.ts +10 -10
- package/dist/components/confirm-dialog.js +6 -3
- package/dist/components/confirm-dialog.js.map +1 -1
- package/dist/components/copy-button.d.ts +11 -11
- package/dist/components/country-select.d.ts +2 -1
- package/dist/components/country-select.js.map +1 -1
- package/dist/components/danger-confirm.d.ts +10 -10
- package/dist/components/danger-confirm.js.map +1 -1
- package/dist/components/data-table-cells.d.ts +12 -1
- package/dist/components/data-table-filter-popover.d.ts +12 -1
- package/dist/components/data-table-filters.d.ts +12 -1
- package/dist/components/data-table-labels.d.ts +12 -1
- package/dist/components/data-table-pagination.d.ts +12 -1
- package/dist/components/data-table.d.ts +12 -1
- package/dist/components/data-table.js +3 -3
- package/dist/components/data-table.js.map +1 -1
- package/dist/components/date-picker.js +6 -4
- package/dist/components/date-picker.js.map +1 -1
- package/dist/components/entity-combobox.d.ts +3 -2
- package/dist/components/entity-combobox.js.map +1 -1
- package/dist/components/facing-pair.d.ts +10 -10
- package/dist/components/field-parts.d.ts +32 -4
- package/dist/components/field-parts.js +54 -19
- package/dist/components/field-parts.js.map +1 -1
- package/dist/components/file-button.d.ts +10 -10
- package/dist/components/file-button.js +3 -2
- package/dist/components/file-button.js.map +1 -1
- package/dist/components/file-dropzone.d.ts +11 -11
- package/dist/components/file-dropzone.js.map +1 -1
- package/dist/components/floating-panel.js +5 -5
- package/dist/components/floating-panel.js.map +1 -1
- package/dist/components/form-actions.d.ts +9 -9
- package/dist/components/form-actions.js +3 -3
- package/dist/components/form-actions.js.map +1 -1
- package/dist/components/iban-input.d.ts +10 -10
- package/dist/components/inline-edit-field.d.ts +2 -1
- package/dist/components/inline-edit-field.js +6 -6
- package/dist/components/inline-edit-field.js.map +1 -1
- package/dist/components/language-select.d.ts +10 -10
- package/dist/components/legal-page.d.ts +10 -10
- package/dist/components/legal.d.ts +10 -10
- package/dist/components/list.d.ts +2 -1
- package/dist/components/list.js +4 -5
- package/dist/components/list.js.map +1 -1
- package/dist/components/money-field.d.ts +10 -10
- package/dist/components/month-picker.js +54 -44
- package/dist/components/month-picker.js.map +1 -1
- package/dist/components/multi-entity-combobox.d.ts +3 -2
- package/dist/components/multi-entity-combobox.js.map +1 -1
- package/dist/components/number-field.d.ts +10 -10
- package/dist/components/number-input.d.ts +10 -10
- package/dist/components/numpad-sheet.d.ts +10 -10
- package/dist/components/numpad-sheet.js +2 -2
- package/dist/components/numpad-sheet.js.map +1 -1
- package/dist/components/page-header.js +6 -1
- package/dist/components/page-header.js.map +1 -1
- package/dist/components/phone-input.d.ts +10 -10
- package/dist/components/popover.d.ts +1 -1
- package/dist/components/popover.js +2 -0
- package/dist/components/popover.js.map +1 -1
- package/dist/components/row-actions.d.ts +5 -5
- package/dist/components/row-actions.js +130 -38
- package/dist/components/row-actions.js.map +1 -1
- package/dist/components/series-chart.d.ts +10 -10
- package/dist/components/settings-fields.d.ts +10 -10
- package/dist/components/share-card.d.ts +7 -7
- package/dist/components/share-card.js +26 -10
- package/dist/components/share-card.js.map +1 -1
- package/dist/components/status-dot.d.ts +1 -0
- package/dist/components/status-dot.js +2 -2
- package/dist/components/status-dot.js.map +1 -1
- package/dist/components/swatch-picker.d.ts +2 -1
- package/dist/components/swatch-picker.js.map +1 -1
- package/dist/components/swipeable-row.d.ts +88 -17
- package/dist/components/swipeable-row.js +46 -9
- package/dist/components/swipeable-row.js.map +1 -1
- package/dist/components/switch.d.ts +2 -1
- package/dist/components/switch.js.map +1 -1
- package/dist/components/table.d.ts +2 -1
- package/dist/components/table.js +6 -0
- package/dist/components/table.js.map +1 -1
- package/dist/components/text-link.d.ts +9 -9
- package/dist/components/time-input.d.ts +10 -10
- package/dist/components/toggle-group.d.ts +2 -1
- package/dist/components/toggle-group.js +1 -1
- package/dist/components/toggle-group.js.map +1 -1
- package/dist/components/translation-review-editor.d.ts +4 -0
- package/dist/components/translation-review-editor.js +4 -3
- package/dist/components/translation-review-editor.js.map +1 -1
- package/dist/components/translation-review-parts.d.ts +1 -0
- package/dist/components/translation-review.d.ts +1 -0
- package/dist/components/translation-review.js +15 -18
- package/dist/components/translation-review.js.map +1 -1
- package/dist/components/ui.d.ts +9 -9
- package/dist/components/ui.js +48 -28
- package/dist/components/ui.js.map +1 -1
- package/dist/components/use-table-state.d.ts +12 -1
- package/dist/components/user-avatar.d.ts +1 -0
- package/dist/components/write-lock.d.ts +101 -13
- package/dist/components/write-lock.js +37 -13
- package/dist/components/write-lock.js.map +1 -1
- package/dist/{data-table-labels-kpAAVi6g.d.ts → data-table-labels-BJ5JE_X2.d.ts} +17 -0
- package/dist/data-table.d.ts +12 -1
- package/dist/{delete-account-setting-FLyJf-kZ.d.ts → delete-account-setting-DiPX4Vue.d.ts} +365 -47
- package/dist/feedback/feedback-attachment.d.ts +10 -10
- package/dist/feedback/feedback-attachment.js +7 -7
- package/dist/feedback/feedback-attachment.js.map +1 -1
- package/dist/feedback/feedback-context.d.ts +10 -10
- package/dist/feedback/feedback-crash.d.ts +10 -10
- package/dist/feedback/feedback-dialog.d.ts +10 -10
- package/dist/feedback/feedback-inbox.d.ts +9 -9
- package/dist/feedback/feedback-inbox.js +7 -3
- package/dist/feedback/feedback-inbox.js.map +1 -1
- package/dist/feedback/feedback-labels.d.ts +10 -10
- package/dist/feedback/feedback-menu.d.ts +3 -3
- package/dist/feedback/feedback-record.d.ts +10 -10
- package/dist/feedback/feedback-row-detail.d.ts +10 -10
- package/dist/feedback/feedback-row-detail.js.map +1 -1
- package/dist/feedback/feedback-status-undo.d.ts +10 -10
- package/dist/feedback/feedback-submit.d.ts +10 -10
- package/dist/feedback/feedback-swipe.d.ts +10 -10
- package/dist/feedback/feedback-swipe.js +3 -6
- package/dist/feedback/feedback-swipe.js.map +1 -1
- package/dist/feedback/feedback-table.d.ts +10 -10
- package/dist/feedback/feedback-table.js.map +1 -1
- package/dist/feedback/feedback-thread.d.ts +10 -10
- package/dist/feedback.d.ts +10 -10
- package/dist/hooks/use-file-drop.d.ts +10 -10
- package/dist/i18n/defaults.d.ts +10 -10
- package/dist/i18n/defaults.js +2 -0
- package/dist/i18n/defaults.js.map +1 -1
- package/dist/i18n/german.d.ts +10 -10
- package/dist/i18n/german.js +34 -1
- package/dist/i18n/german.js.map +1 -1
- package/dist/i18n/kit-labels.d.ts +4 -4
- package/dist/i18n/kit-labels.js.map +1 -1
- package/dist/i18n/languages.d.ts +10 -10
- package/dist/i18n/locales/de-CH.d.ts +10 -10
- package/dist/i18n/locales/en.d.ts +10 -10
- package/dist/i18n/locales/es.d.ts +10 -10
- package/dist/i18n/locales/es.js +34 -1
- package/dist/i18n/locales/es.js.map +1 -1
- package/dist/i18n/locales/fr.d.ts +10 -10
- package/dist/i18n/locales/fr.js +35 -1
- package/dist/i18n/locales/fr.js.map +1 -1
- package/dist/i18n/locales/hu.d.ts +10 -10
- package/dist/i18n/locales/hu.js +36 -1
- package/dist/i18n/locales/hu.js.map +1 -1
- package/dist/i18n/locales/it.d.ts +10 -10
- package/dist/i18n/locales/it.js +34 -1
- package/dist/i18n/locales/it.js.map +1 -1
- package/dist/i18n/locales/zh.d.ts +10 -10
- package/dist/i18n/locales/zh.js +34 -1
- package/dist/i18n/locales/zh.js.map +1 -1
- package/dist/i18n/review.d.ts +10 -10
- package/dist/i18n/review.js +8 -1
- package/dist/i18n/review.js.map +1 -1
- package/dist/index.d.ts +10 -5
- package/dist/index.js +40 -2
- package/dist/index.js.map +1 -1
- package/dist/landing/landing-actions.d.ts +10 -10
- package/dist/landing/landing-sections.d.ts +10 -10
- package/dist/landing/public-header.d.ts +10 -10
- package/dist/landing/routing.d.ts +10 -10
- package/dist/pay/.well-known/apple-developer-merchantid-domain-association +1 -0
- package/dist/pay/index.html +30 -0
- package/dist/pay/pay.css +126 -0
- package/dist/pay/pay.js +198 -0
- package/dist/rhf/fields.d.ts +10 -10
- package/dist/rhf/form.d.ts +10 -10
- package/dist/rhf.d.ts +10 -10
- package/dist/settings/settings-section.d.ts +10 -10
- package/dist/shell/app-shell.d.ts +9 -9
- package/dist/shell/app-shell.js +2 -1
- package/dist/shell/app-shell.js.map +1 -1
- package/dist/shell/top-bar-brand.d.ts +10 -10
- package/dist/shell/topbar-action-menu.d.ts +1 -0
- package/dist/shell.d.ts +10 -10
- package/dist/testing/css-variables.d.ts +74 -0
- package/dist/testing/css-variables.generated.d.ts +7 -0
- package/dist/testing/css-variables.generated.js +8 -0
- package/dist/testing/css-variables.generated.js.map +1 -0
- package/dist/testing/css-variables.js +93 -0
- package/dist/testing/css-variables.js.map +1 -0
- package/dist/testing/index.d.ts +1 -0
- package/dist/testing/index.js +12 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/theme/contrast-tokens.d.ts +44 -1
- package/dist/theme/contrast-tokens.js +21 -0
- package/dist/theme/contrast-tokens.js.map +1 -1
- package/dist/theme/contrast.d.ts +2 -2
- package/dist/theme/palette-derive.js +60 -11
- package/dist/theme/palette-derive.js.map +1 -1
- package/dist/theme/palette-presets.js +45 -43
- package/dist/theme/palette-presets.js.map +1 -1
- package/dist/wizard/stepper-nav.d.ts +11 -11
- package/dist/wizard/stepper-nav.js.map +1 -1
- package/dist/wizard.d.ts +10 -10
- package/package.json +10 -2
- package/src/account/delete-account-setting.tsx +6 -1
- package/src/account/email-change-setting.tsx +9 -3
- package/src/account/sessions-setting.tsx +7 -2
- package/src/admin/admin-action-confirm.tsx +2 -1
- package/src/admin/invitations-panel.tsx +9 -3
- package/src/admin/plan-change.tsx +459 -0
- package/src/admin/reviewer-scope-editor.tsx +2 -1
- package/src/admin/role-select.tsx +2 -1
- package/src/admin/user-roster.tsx +5 -3
- package/src/auth/auth-errors.ts +25 -2
- package/src/auth/complete-name-dialog.tsx +6 -2
- package/src/billing/billing-banner.tsx +3 -1
- package/src/billing/billing-labels.ts +45 -0
- package/src/billing/billing-lock.ts +36 -3
- package/src/billing/billing-overview.ts +58 -0
- package/src/billing/checkout-processing.ts +391 -0
- package/src/billing/checkout-return.ts +90 -0
- package/src/billing/pay-page.ts +242 -0
- package/src/billing/plan-limit-toast.tsx +91 -0
- package/src/billing/subscription-actions.tsx +41 -8
- package/src/components/account-settings.tsx +6 -2
- package/src/components/autocomplete.tsx +5 -2
- package/src/components/button-group.tsx +4 -1
- package/src/components/calculator.tsx +10 -6
- package/src/components/checkbox-group.tsx +2 -2
- package/src/components/checkbox.tsx +2 -1
- package/src/components/chip.tsx +37 -32
- package/src/components/choice-card.tsx +4 -2
- package/src/components/combobox.tsx +4 -4
- package/src/components/confirm-dialog.tsx +13 -6
- package/src/components/country-select.tsx +2 -2
- package/src/components/danger-confirm.tsx +2 -2
- package/src/components/data-table.tsx +20 -9
- package/src/components/date-picker.tsx +10 -7
- package/src/components/entity-combobox.tsx +3 -3
- package/src/components/field-parts.tsx +61 -14
- package/src/components/file-button.tsx +5 -4
- package/src/components/file-dropzone.tsx +2 -2
- package/src/components/floating-panel.tsx +7 -5
- package/src/components/form-actions.tsx +12 -5
- package/src/components/inline-edit-field.tsx +13 -13
- package/src/components/list.tsx +10 -9
- package/src/components/month-picker.tsx +8 -2
- package/src/components/multi-entity-combobox.tsx +3 -3
- package/src/components/numpad-sheet.tsx +8 -4
- package/src/components/page-header.tsx +15 -1
- package/src/components/popover.tsx +4 -0
- package/src/components/row-actions.tsx +201 -50
- package/src/components/share-card.tsx +67 -13
- package/src/components/status-dot.tsx +7 -7
- package/src/components/swatch-picker.tsx +2 -2
- package/src/components/swipeable-row.tsx +138 -27
- package/src/components/switch.tsx +2 -1
- package/src/components/table.tsx +8 -1
- package/src/components/toggle-group.tsx +5 -3
- package/src/components/translation-review-editor.tsx +8 -3
- package/src/components/translation-review.tsx +18 -22
- package/src/components/ui.tsx +98 -44
- package/src/components/write-lock.tsx +150 -24
- package/src/feedback/feedback-attachment.tsx +13 -9
- package/src/feedback/feedback-inbox.tsx +10 -6
- package/src/feedback/feedback-row-detail.tsx +3 -2
- package/src/feedback/feedback-swipe.tsx +6 -11
- package/src/feedback/feedback-table.tsx +2 -1
- package/src/i18n/defaults.ts +2 -0
- package/src/i18n/german.ts +38 -0
- package/src/i18n/kit-labels.tsx +4 -0
- package/src/i18n/locales/es.ts +34 -0
- package/src/i18n/locales/fr.ts +39 -0
- package/src/i18n/locales/hu.ts +37 -0
- package/src/i18n/locales/it.ts +35 -0
- package/src/i18n/locales/zh.ts +33 -0
- package/src/i18n/review.ts +7 -0
- package/src/index.ts +48 -4
- package/src/shell/app-shell.tsx +11 -6
- package/src/testing/css-variables.generated.ts +112 -0
- package/src/testing/css-variables.ts +191 -0
- package/src/testing/index.ts +13 -0
- package/src/theme/contrast-tokens.ts +53 -2
- package/src/theme/palette-derive.ts +87 -10
- package/src/theme/palette-presets.ts +45 -43
- package/src/wizard/stepper-nav.tsx +2 -1
- package/tokens.css +306 -46
package/README.md
CHANGED
|
@@ -382,15 +382,15 @@ columns, strings and permissions (see the note at the top of `src/feedback/feedb
|
|
|
382
382
|
|
|
383
383
|
<!-- BEGIN GENERATED: exports — node scripts/gen-export-inventory.mjs -->
|
|
384
384
|
|
|
385
|
-
**
|
|
385
|
+
**1876 names from 278 modules** — 879 values and 997 types. _Italic_ is a type-only export.
|
|
386
386
|
|
|
387
387
|
Generated from `dist/index.d.ts` by `node scripts/gen-export-inventory.mjs`; the count
|
|
388
388
|
is pinned by `src/__tests__/public-surface.test.ts`. Do not edit between the markers.
|
|
389
389
|
|
|
390
390
|
| Entry point | Names |
|
|
391
391
|
|---|---|
|
|
392
|
-
| `@eifi1/ui-kit` |
|
|
393
|
-
| `@eifi1/ui-kit/chart` |
|
|
392
|
+
| `@eifi1/ui-kit` | 1876 |
|
|
393
|
+
| `@eifi1/ui-kit/chart` | 105 |
|
|
394
394
|
| `@eifi1/ui-kit/shell` | 76 |
|
|
395
395
|
| `@eifi1/ui-kit/data-table` | 51 |
|
|
396
396
|
| `@eifi1/ui-kit/wizard` | 25 |
|
|
@@ -399,6 +399,7 @@ is pinned by `src/__tests__/public-surface.test.ts`. Do not edit between the mar
|
|
|
399
399
|
| `@eifi1/ui-kit/search` | 23 |
|
|
400
400
|
| `@eifi1/ui-kit/dates` | 22 |
|
|
401
401
|
| `@eifi1/ui-kit/table-text` | 14 |
|
|
402
|
+
| `@eifi1/ui-kit/testing` | 4 |
|
|
402
403
|
| `@eifi1/ui-kit/rhf` | 60 |
|
|
403
404
|
|
|
404
405
|
Everything below is reachable from the main `@eifi1/ui-kit` barrel. The subpaths are a
|
|
@@ -446,7 +447,7 @@ re-slicing of it, never a second API.
|
|
|
446
447
|
| `hooks/use-hotkey` | `matchesHotkey`, `parseHotkey`, `useHotkey`, _`Hotkey`_, _`ParsedHotkey`_, _`UseHotkeyOptions`_ |
|
|
447
448
|
| `hooks/use-authed-src` | `useAuthedSrc`, _`AuthedFetcher`_, _`AuthedSrcStatus`_, _`UseAuthedSrcOptions`_, _`UseAuthedSrcResult`_ |
|
|
448
449
|
| `hooks/use-windowed-rows` | `useWindowedRows`, `WINDOWED_ROW_INDEX`, _`WindowedRows`_ |
|
|
449
|
-
| `hooks/use-breakpoint` | `BREAKPOINT_REM`, `breakpointQuery`, `useBreakpoint`, `usePhoneLayout`, _`Breakpoint`_, _`BreakpointVariant`_ |
|
|
450
|
+
| `hooks/use-breakpoint` | `BREAKPOINT_REM`, `breakpointQuery`, `remPx`, `useBreakpoint`, `usePhoneLayout`, `useRemPx`, _`Breakpoint`_, _`BreakpointVariant`_, _`RemLength`_ |
|
|
450
451
|
| `hooks/use-large-text` | `useCoarsePointer`, `useInlineFacts`, `useLargeText` |
|
|
451
452
|
|
|
452
453
|
### theme, palettes, colour
|
|
@@ -469,6 +470,7 @@ re-slicing of it, never a second API.
|
|
|
469
470
|
| `admin/admin-action-confirm` | `AdminActionConfirm`, `DEFAULT_ADMIN_ACTION_LABELS`, _`AdminActionConfirmProps`_, _`AdminActionConfirmValues`_, _`AdminActionLabels`_, _`AdminActionTarget`_, _`AdminConfirmLevel`_ |
|
|
470
471
|
| `admin/user-roster` | `adminUserStates`, `DEFAULT_USER_ROSTER_LABELS`, `USER_ROSTER_SORT_KEYS`, `UserIdentityCell`, `userRosterColumns`, `userRosterSort`, `UserRowActions`, `useUserRosterColumns`, _`AdminUserStateFields`_, _`RoleEditing`_, _`RosterState`_, _`UserIdentityCellProps`_, _`UserRosterColumnsOptions`_, _`UserRosterLabels`_, _`UserRosterRow`_, _`UserRosterSortKey`_, _`UserRowAction`_, _`UserRowActionList`_, _`UserRowActionsProps`_ |
|
|
471
472
|
| `admin/invitations-panel` | `DEFAULT_INVITATIONS_LABELS`, `InvitationsPanel`, _`InvitationDraft`_, _`InvitationRow`_, _`InvitationScope`_, _`InvitationSentAnswer`_, _`InvitationsLabels`_, _`InvitationsPanelProps`_, _`InvitationStatus`_ |
|
|
473
|
+
| `admin/plan-change` | `DEFAULT_PLAN_CHANGE_LABELS`, `PlanChangeConfirm`, `planColumn`, `usePlanChangeResult`, `usePlanColumn`, _`PlanChange`_, _`PlanChangeConfirmProps`_, _`PlanChangeLabels`_, _`PlanChangeLine`_, _`PlanChangeOutcome`_, _`PlanChangeResultOptions`_, _`PlanChangeTone`_, _`PlanColumnOptions`_, _`PlanColumnUsage`_ |
|
|
472
474
|
| `admin/reviewer-scope-editor` | `DEFAULT_REVIEWER_SCOPE_LABELS`, `ReviewerScopeEditor`, _`ReviewerScope`_, _`ReviewerScopeArea`_, _`ReviewerScopeEditorProps`_, _`ReviewerScopeLabels`_, _`ReviewerScopeLanguage`_ |
|
|
473
475
|
| `admin/role-select` | `DEFAULT_ROLE_SELECT_LABELS`, `RolesEditor`, `RoleSelect`, _`RoleLock`_, _`RoleLockCode`_, _`RolesEditorProps`_, _`RoleSelectLabels`_, _`RoleSelectProps`_ |
|
|
474
476
|
| `admin/transfer-ownership-dialog` | `DEFAULT_TRANSFER_OWNERSHIP_LABELS`, `TransferOwnershipDialog`, _`TransferCandidate`_, _`TransferOwnershipDialogProps`_, _`TransferOwnershipLabels`_, _`TransferUnavailable`_, _`TransferValues`_ |
|
|
@@ -510,9 +512,14 @@ re-slicing of it, never a second API.
|
|
|
510
512
|
| `billing/billing-banner` | `BillingBanner`, _`BillingBannerKind`_, _`BillingBannerProps`_ |
|
|
511
513
|
| `billing/plan-limit-notice` | `planLimitMailto`, `PlanLimitNotice`, _`PlanLimitNoticeProps`_ |
|
|
512
514
|
| `billing/plan-limit` | `isPlanLimit`, _`PlanLimitRefusal`_ |
|
|
513
|
-
| `billing/billing-lock` | `combineWriteLocks`, `useBillingLockReason`, _`BillingLockReasonOptions`_, _`CombinedWriteLock`_, _`WriteLockSource`_ |
|
|
515
|
+
| `billing/billing-lock` | `combineWriteLocks`, `useBillingLockReason`, `useBillingWriteLock`, _`BillingLockReasonOptions`_, _`CombinedWriteLock`_, _`WriteLockSource`_ |
|
|
514
516
|
| `billing/billing-standing` | `billingDaysLeft`, `billingLockAt`, `isBillingReadOnly`, _`BillingStanding`_ |
|
|
515
517
|
| `billing/subscription-actions` | `SubscriptionActions`, _`SubscriptionActionsProps`_ |
|
|
518
|
+
| `billing/checkout-return` | `CHECKOUT_RETURN_PARAM`, `CHECKOUT_RETURN_VALUE`, `checkoutReturnUrl`, `isCheckoutReturn`, `withoutCheckoutReturn` |
|
|
519
|
+
| `billing/checkout-processing` | `checkoutFingerprint`, `checkoutLanded`, `noteCheckoutStarted`, `useCheckoutProcessing`, _`CheckoutOverview`_, _`CheckoutProcessingOptions`_ |
|
|
520
|
+
| `billing/pay-page` | `paddleLocale`, `PAY_PAGE_LANG_PARAM`, `payPageUrl`, _`PaddleEnvironment`_ |
|
|
521
|
+
| `billing/billing-overview` | _`BillingOverview`_, _`PortalRequest`_, _`PortalTarget`_, _`SubscriptionSource`_ |
|
|
522
|
+
| `billing/plan-limit-toast` | `usePlanLimitToast`, _`PlanLimitToastOptions`_ |
|
|
516
523
|
|
|
517
524
|
### components
|
|
518
525
|
|
|
@@ -527,13 +534,13 @@ re-slicing of it, never a second API.
|
|
|
527
534
|
| `components/iban-input` | `DEFAULT_IBAN_INPUT_LABELS`, `IbanInput`, _`IbanInputLabels`_, _`IbanInputProps`_ |
|
|
528
535
|
| `components/legal` | `DEFAULT_LEGAL_LABELS`, `LEGAL_HREFS`, `LegalFooter`, `LegalLayout`, `LegalLinks`, `legalOperatorText`, `LegalSection`, `useLegalLabels`, _`LegalDisclaimerSectionLabels`_, _`LegalFooterProps`_, _`LegalFramedSectionLabels`_, _`LegalLabels`_, _`LegalLayoutProps`_, _`LegalLink`_, _`LegalLinksProps`_, _`LegalOperator`_, _`LegalOperatorSectionLabels`_, _`LegalOperatorText`_, _`LegalPageKey`_, _`LegalSectionProps`_, _`LegalTextSectionLabels`_ |
|
|
529
536
|
| `components/phone-input` | `DEFAULT_PHONE_INPUT_LABELS`, `PhoneInput`, _`PhoneInputLabels`_, _`PhoneInputProps`_ |
|
|
530
|
-
| `components/row-actions` | `DEFAULT_ROW_ACTIONS_LABELS`, `RowActions`, `rowActionsColumn`, _`RowAction`_, _`RowActionList`_, _`RowActionsCollapse`_, _`RowActionsColumnOptions`_, _`RowActionsLabels`_, _`RowActionsProps`_, _`RowActionsSize`_ |
|
|
537
|
+
| `components/row-actions` | `DEFAULT_ROW_ACTIONS_LABELS`, `RowActions`, `rowActionsColumn`, _`RowAction`_, _`RowActionList`_, _`RowActionsCollapse`_, _`RowActionsColumnOptions`_, _`RowActionsLabels`_, _`RowActionsProps`_, _`RowActionsSize`_, _`RowActionTone`_ |
|
|
531
538
|
| `components/share-card` | `DEFAULT_SHARE_CARD_LABELS`, `ShareCard`, `ShareDialog`, `SharePanel`, _`ShareAddRequest`_, _`ShareCandidate`_, _`ShareCardLabels`_, _`ShareCardProps`_, _`ShareDialogProps`_, _`ShareGrantee`_, _`SharePanelProps`_, _`SharePendingGrant`_, _`ShareRole`_ |
|
|
532
539
|
| `components/field` | `Field`, _`FieldControlProps`_, _`FieldLabelVisibility`_, _`FieldProps`_, _`FieldRenderMeta`_ |
|
|
533
540
|
| `components/search-field` | `SearchField`, _`SearchFieldProps`_ |
|
|
534
541
|
| `components/dropdown` | `DropdownPanel`, `DropdownSearchHeader`, `useDropdown`, `useDropdownSearch`, _`DropdownPanelProps`_, _`DropdownSearchHeaderProps`_ |
|
|
535
542
|
| `components/popover` | `DEFAULT_POPOVER_LABELS`, `Popover`, _`PopoverLabels`_, _`PopoverProps`_ |
|
|
536
|
-
| `components/swipeable-row` | `SwipeableRow`, _`SwipeableRowProps`_, _`SwipeAction`_ |
|
|
543
|
+
| `components/swipeable-row` | `SwipeableRow`, _`SwipeableRowProps`_, _`SwipeAction`_, _`SwipePaint`_, _`SwipeTone`_ |
|
|
537
544
|
| `components/calculator` | `CalculatorButton`, _`CalculatorButtonLabels`_ |
|
|
538
545
|
| `components/numpad-sheet` | `NumberPadSheet`, _`NumberPadSheetLabels`_ |
|
|
539
546
|
| `components/number-input` | `NumberInput`, `stepNumber` |
|
|
@@ -572,6 +579,7 @@ re-slicing of it, never a second API.
|
|
|
572
579
|
| `components/measured-grid` | `DEFAULT_MEASURED_GRID_LABELS`, `MeasuredGrid`, `useMeasuredRows`, _`MeasuredGridColumn`_, _`MeasuredGridLabels`_, _`MeasuredGridProps`_, _`MeasuredGridView`_, _`MeasuredRows`_, _`UseMeasuredRowsOptions`_ |
|
|
573
580
|
| `components/treemap` | `fitLabel`, `Treemap`, `TreemapCell`, _`TreemapCellProps`_, _`TreemapNode`_, _`TreemapProps`_ |
|
|
574
581
|
| `components/series-chart` | `anchoredBand`, `AXIS_TICK_WIDTH`, `AXIS_TITLE_STRIP`, `axisBandWidth`, `mergeSeries`, `oneAxis`, `padBand`, `paddedDomain`, `resolveTooltipPlacement`, `SeriesChart`, `seriesKey`, `seriesLegendEntries`, `soleSeriesColor`, `StaticSeriesChart`, `visibleSeries`, _`SeriesChartAxis`_, _`SeriesChartHit`_, _`SeriesChartMarker`_, _`SeriesChartPoint`_, _`SeriesChartProps`_, _`SeriesChartReference`_, _`SeriesChartRow`_, _`SeriesChartSeries`_, _`SeriesChartSpan`_, _`SeriesChartTickValues`_, _`SeriesChartTone`_, _`SeriesChartTooltip`_, _`SeriesChartTooltipPlacement`_, _`SeriesChartType`_, _`SeriesChartX`_, _`SeriesChartXTick`_, _`SeriesChartXValue`_, _`SeriesLegendAxes`_, _`SeriesSource`_ |
|
|
582
|
+
| `components/chart-height` | _`ChartHeight`_ |
|
|
575
583
|
| `components/chart-zoom` | `axisExtent`, `DEFAULT_Y_AXIS`, `defaultZoomAxes`, `fitXToY`, `fitYToX`, `NO_ZOOM`, `selectionFromDrag`, `SharedXZoom`, `withChartZoom`, `ZOOM_MIN_DRAG`, `ZOOM_SQUARE_ENOUGH`, `zoomAfter`, `zoomAxesFor`, `zoomDomains`, _`ZoomAxes`_, _`ZoomAxesSetting`_, _`ZoomBinding`_, _`ZoomDrag`_, _`ZoomFitSeries`_, _`ZoomFitSource`_, _`ZoomRow`_, _`ZoomSelection`_, _`ZoomState`_, _`ZoomTarget`_ |
|
|
576
584
|
| `components/toggle-legend` | `LegendColumn`, `LegendGroup`, `StaticLegend`, `STEP_DASH`, `STROKE_PATTERNS`, `strokeDash`, `toggleHidden`, `ToggleLegend`, _`LegendEntry`_, _`StaticLegendProps`_, _`ToggleLegendProps`_ |
|
|
577
585
|
| `components/facing-pair` | `FACING_SIDES`, `facingAxes`, `facingBand`, `facingHeadingPad`, _`FacingSide`_ |
|
|
@@ -597,7 +605,7 @@ re-slicing of it, never a second API.
|
|
|
597
605
|
| `components/tree-view` | `TreeRow`, `TreeView`, _`TreeItemState`_, _`TreeNode`_, _`TreeRowProps`_, _`TreeViewProps`_ |
|
|
598
606
|
| `components/chart` | `ChartContainer`, `ChartLegend`, `ChartLegendContent`, `ChartTooltip`, `ChartTooltipContent`, `useChart`, _`ChartConfig`_, _`ChartSeriesConfig`_ |
|
|
599
607
|
| `components/description-list` | `DEFAULT_DESCRIPTION_LIST_LABELS`, `DescriptionItem`, `DescriptionList`, _`DescriptionItemProps`_, _`DescriptionListColumns`_, _`DescriptionListDensity`_, _`DescriptionListLabels`_, _`DescriptionListLayout`_, _`DescriptionListProps`_ |
|
|
600
|
-
| `components/write-lock` | `DEFAULT_WRITE_LOCK_LABELS`, `useWriteLock`, `WriteLockProvider`, _`WriteLock`_, _`WriteLockLabels`_, _`WriteLockProviderProps`_ |
|
|
608
|
+
| `components/write-lock` | `COMMIT_EXCEPT_BILLING`, `DEFAULT_WRITE_LOCK_LABELS`, `useWriteLock`, `writeLockFor`, `WriteLockProvider`, _`CommitScope`_, _`WriteLock`_, _`WriteLockHold`_, _`WriteLockKind`_, _`WriteLockLabels`_, _`WriteLockProviderProps`_ |
|
|
601
609
|
| `components/account-chips` | `ACCOUNT_STATE_TONES`, `AccountStateChip`, `dateColumn`, `DateMark`, `DEFAULT_ACCOUNT_STATE_LABELS`, `RoleChip`, _`AccountState`_, _`AccountStateChipProps`_, _`AccountStateLabels`_, _`DateColumnOptions`_, _`DateMarkProps`_, _`RoleChipProps`_, _`RoleDefinition`_, _`RoleVocabulary`_ |
|
|
602
610
|
| `components/server-wake` | `DEFAULT_SERVER_WAKE_LABELS`, `ServerWakeNotice`, `useServerWakeStage`, _`ServerWakeLabels`_, _`ServerWakeNoticeProps`_ |
|
|
603
611
|
| `components/line-items` | `DEFAULT_LINE_ITEMS_LABELS`, `LineItems`, _`LineItemCellContext`_, _`LineItemsColumn`_, _`LineItemsFieldLabels`_, _`LineItemsLabels`_, _`LineItemsProps`_, _`LineItemsRemoveAlign`_, _`LineItemsRemovePlacement`_, _`LineItemsRowProps`_, _`LineItemsSummary`_, _`LineItemsSummaryTone`_ |
|
|
@@ -1,18 +1,23 @@
|
|
|
1
1
|
import 'react';
|
|
2
|
-
export { cz as DEFAULT_DELETE_ACCOUNT_LABELS,
|
|
2
|
+
export { cz as DEFAULT_DELETE_ACCOUNT_LABELS, d0 as DeleteAccountConsequence, d1 as DeleteAccountLabels, d2 as DeleteAccountSetting, d3 as DeleteAccountSettingProps, d4 as DeleteAccountValues, d5 as DeletionMode } from '../delete-account-setting-DiPX4Vue.js';
|
|
3
3
|
import '../components/tooltip.js';
|
|
4
4
|
import '../hooks/use-anchored-rect.js';
|
|
5
5
|
import '../lib/clipping.js';
|
|
6
|
-
import '../data-table-labels-
|
|
6
|
+
import '../data-table-labels-BJ5JE_X2.js';
|
|
7
7
|
import '../components/data-table-sort.js';
|
|
8
8
|
import '../components/swipeable-row.js';
|
|
9
|
+
import '../components/status-dot.js';
|
|
10
|
+
import '../components/progress-bar.js';
|
|
11
|
+
import '../components/signed-amount.js';
|
|
12
|
+
import '../components/stat-tile.js';
|
|
13
|
+
import '../components/chip.js';
|
|
14
|
+
import 'lucide-react';
|
|
15
|
+
import '../components/field-parts.js';
|
|
16
|
+
import '../components/write-lock.js';
|
|
9
17
|
import '../components/mini-calendar.js';
|
|
10
18
|
import '../components/calendar-heatmap.js';
|
|
11
19
|
import '../components/popover.js';
|
|
12
20
|
import '../hooks/use-breakpoint.js';
|
|
13
|
-
import '../components/chip.js';
|
|
14
|
-
import 'lucide-react';
|
|
15
|
-
import '../components/field-parts.js';
|
|
16
21
|
import '../components/field-sync.js';
|
|
17
22
|
import '../wizard/types.js';
|
|
18
23
|
import '../tour/tour.js';
|
|
@@ -24,7 +29,6 @@ import '../components/page-contents.js';
|
|
|
24
29
|
import '../components/series-chart-labels.js';
|
|
25
30
|
import '../components/pie-chart-labels.js';
|
|
26
31
|
import '../components/sparkline.js';
|
|
27
|
-
import '../components/stat-tile.js';
|
|
28
32
|
import '../components/signature-pad.js';
|
|
29
33
|
import '../components/password-strength.js';
|
|
30
34
|
import '../components/swatch-picker.js';
|
|
@@ -36,9 +40,6 @@ import '../hooks/use-search-param-state.js';
|
|
|
36
40
|
import '../components/measured-grid.js';
|
|
37
41
|
import '../components/user-avatar.js';
|
|
38
42
|
import '../lib/person-name.js';
|
|
39
|
-
import '../components/status-dot.js';
|
|
40
|
-
import '../components/progress-bar.js';
|
|
41
|
-
import '../components/signed-amount.js';
|
|
42
43
|
import '../shell/topbar-action-menu.js';
|
|
43
44
|
import '../components/menu-item.js';
|
|
44
45
|
import '../components/floating-panel.js';
|
|
@@ -54,7 +55,6 @@ import '../components/error-boundary.js';
|
|
|
54
55
|
import '../components/authed-image.js';
|
|
55
56
|
import '../components/image-grid.js';
|
|
56
57
|
import '../components/lightbox.js';
|
|
57
|
-
import '../components/write-lock.js';
|
|
58
58
|
import '../auth/sign-in-form.js';
|
|
59
59
|
import '../landing/access.js';
|
|
60
60
|
import '../landing/landing-labels.js';
|
|
@@ -18,6 +18,7 @@ import { authErrorCode, englishRateLimited, isRateLimited, retryAfterSeconds } f
|
|
|
18
18
|
import { useFocusWhen } from "../auth/status-parts.js";
|
|
19
19
|
import { CARD_DESCRIPTION_CLASS, refusalCompanies, settle, useMounted } from "./account-parts.js";
|
|
20
20
|
import { SettingsCardTitle } from "../settings/settings-heading.js";
|
|
21
|
+
import { COMMIT_EXCEPT_BILLING } from "../components/write-lock.js";
|
|
21
22
|
const DEFAULT_DELETE_ACCOUNT_LABELS = {
|
|
22
23
|
title: "Delete account",
|
|
23
24
|
afterDays: (days) => days === 1 ? "Your account is deactivated at once and erased for good 1 day later." : `Your account is deactivated at once and erased for good ${days} days later.`,
|
|
@@ -146,7 +147,7 @@ function DeleteAccountSetting({
|
|
|
146
147
|
/* @__PURE__ */ jsxs(
|
|
147
148
|
DangerConfirm,
|
|
148
149
|
{
|
|
149
|
-
commit:
|
|
150
|
+
commit: COMMIT_EXCEPT_BILLING,
|
|
150
151
|
armLabel: labels.arm,
|
|
151
152
|
prompt: labels.prompt,
|
|
152
153
|
consequences: lines,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/account/delete-account-setting.tsx"],"sourcesContent":["import { isValidElement, useRef, useState } from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode } from \"react\";\nimport { UserX } from \"lucide-react\";\n\nimport { useKitLabels, useKitLocale } from \"../i18n/kit-labels\";\nimport { cn } from \"../lib/cn\";\nimport { AlertBanner } from \"../components/alert-banner\";\nimport { hasMessage } from \"../components/choice-parts\";\nimport {\n CurrentPasswordInput,\n DangerConfirm,\n DEFAULT_DANGER_CONFIRM_LABELS,\n TypedConfirmField,\n typedMatches,\n} from \"../components/danger-confirm\";\nimport type { DangerConsequence } from \"../components/danger-confirm\";\nimport { Card } from \"../components/ui\";\nimport { authErrorCode, englishRateLimited, isRateLimited, retryAfterSeconds } from \"../auth/auth-errors\";\nimport { useFocusWhen } from \"../auth/status-parts\";\nimport { CARD_DESCRIPTION_CLASS, refusalCompanies, settle, useMounted } from \"./account-parts\";\nimport { SettingsCardTitle } from \"../settings/settings-heading\";\n\n/* ── Labels ──────────────────────────────────────────────────────────────── */\n\n/**\n * Every string {@link DeleteAccountSetting} renders — the `deleteAccount` namespace of\n * `<UiKitProvider labels>`, overridable per instance through `labels`. The confirm's\n * Cancel, \"Password\" and \"Type … to confirm\" are `dangerConfirm`'s.\n */\nexport interface DeleteAccountLabels {\n /** The card's title. */\n title: string;\n /** Mode `after_days`, given the days: what happens and when. */\n afterDays: (days: number) => string;\n /** Mode `operator`: what happens, and who erases it. */\n operator: string;\n /** The button that opens the confirm. */\n arm: string;\n /** The confirm's warning, over the consequences. */\n prompt: string;\n /** The line in the consequences when `handOverCount` is given (Kurvenschmiede, §2.7),\n * given the count. */\n handOver: (count: number) => string;\n /** The button that sends it. */\n confirm: string;\n /** Said once the request is accepted — the app signs out next. */\n done: string;\n /** `password_incorrect` (server-kit's `400` for a wrong current password), under the\n * password field. */\n wrongPassword: string;\n /** `confirmation_mismatch` — the server did not take the typed address as the\n * account's — under the address field. */\n confirmationMismatch: string;\n /** `last_admin` — the account is the last active admin. */\n lastAdmin: string;\n /** `last_admin` naming the companies (kastlan checks per company), given them as one\n * list in the reader's language (\"Example AG and Sample GmbH\"). */\n lastAdminOf: (companies: string) => string;\n /** `household_has_members` — keksdose's guard (§6.4). */\n householdHasMembers: string;\n /** A request was throttled — HTTP 429 — given its `Retry-After` wait in seconds, or\n * `undefined` without one. */\n rateLimited: (seconds?: number) => string;\n /** Any other failure. */\n failed: string;\n}\n\nexport const DEFAULT_DELETE_ACCOUNT_LABELS: DeleteAccountLabels = {\n title: \"Delete account\",\n afterDays: (days) =>\n days === 1\n ? \"Your account is deactivated at once and erased for good 1 day later.\"\n : `Your account is deactivated at once and erased for good ${days} days later.`,\n operator: \"Your account is deactivated at once, and an operator will erase it for good.\",\n arm: \"Delete account…\",\n prompt: \"You will be signed out on every device, and your account can no longer be used.\",\n handOver: (count) =>\n count === 1\n ? \"1 item others can see will pass to an administrator.\"\n : `${count} items others can see will pass to an administrator.`,\n confirm: \"Delete my account\",\n done: \"Your account is deactivated. You are being signed out.\",\n wrongPassword: \"The password is incorrect.\",\n confirmationMismatch: \"This is not your account’s address.\",\n lastAdmin: \"You are the last administrator. Make someone else an administrator first.\",\n lastAdminOf: (companies) =>\n `You are the last administrator of ${companies}. Make someone else an administrator there first.`,\n householdHasMembers:\n \"Your household has other members, so the account can’t be deleted here. Please write to the operator.\",\n rateLimited: englishRateLimited,\n failed: \"Your account could not be deleted. Please try again.\",\n};\n\n/* ── Props ───────────────────────────────────────────────────────────────── */\n\n/** What happens after the deactivation (§2.1, §6.4) — the app's setting. */\nexport type DeletionMode = \"after_days\" | \"operator\";\n\n/** What {@link DeleteAccountSettingProps.onRequest} gets: the `POST /auth/me/deletion`\n * body. */\nexport interface DeleteAccountValues {\n /** As typed. */\n password: string;\n /** The address as TYPED, trimmed — the server re-checks it against the account\n * (server-kit's `confirm_email_matches`), as keksdose's admin actions do. */\n confirmEmail: string;\n}\n\n/** One line of the consequences: a node of the app's, or a {@link DangerConsequence}\n * for a key of its own and the `severe` mark. */\nexport type DeleteAccountConsequence = ReactNode | DangerConsequence;\n\nexport interface DeleteAccountSettingProps extends Omit<ComponentPropsWithoutRef<\"div\">, \"children\"> {\n /** The account's address — the text to type. */\n email: string;\n /** `\"after_days\"` (keksdose, Kurvenschmiede: erased by a scheduled job) or\n * `\"operator\"` (kastlan: company data is involved, an operator erases it). */\n mode: DeletionMode;\n /** With `after_days`: how many. Default 30 (§2.1). */\n days?: number;\n /**\n * What goes, in the app's words (§6.4: \"the app's own list\") — derived from the\n * account's own facts where it can be: keksdose's \"Budget X will be deleted; its 2\n * guests are told\", rather than the worst case for everybody.\n */\n consequences?: readonly DeleteAccountConsequence[];\n /** Kurvenschmiede (§2.7): how many owned items others can see — they pass to the\n * first active admin at erasure. A line of its own in the consequences; 0 or left\n * out, none. */\n handOverCount?: number;\n /**\n * The confirm was answered: send `POST /auth/me/deletion {password, confirm_email}`.\n * Resolve once it is accepted — the card says \"You are being signed out\" — and then\n * sign the user out: the server ended every session with the deactivation. Reject\n * with the client's error: `password_incorrect` under the password,\n * `confirmation_mismatch` under the address, `last_admin` (with kastlan's\n * `companies`) and `household_has_members` above the buttons, a 429 as\n * `rateLimited`, anything else (a demo account's 403, an app's own code) through\n * `describeError`, else `failed`. The confirm stays open with what was typed, for a\n * retry.\n */\n onRequest: (values: DeleteAccountValues) => Promise<unknown> | void;\n /** The app's own words for a failure, or `undefined` for the kit's. Asked first, for\n * every failure — kastlan's `last_admin` names the companies. */\n describeError?: (error: unknown) => ReactNode | undefined;\n labels?: Partial<DeleteAccountLabels>;\n}\n\n/** Whether an item is a `{ text }` line rather than a node — a React element is an\n * object too, and so would a `{ text }` lookalike be, so the element test comes first. */\nfunction isConsequence(item: DeleteAccountConsequence): item is DangerConsequence {\n return typeof item === \"object\" && item !== null && !isValidElement(item) && \"text\" in item;\n}\n\n/**\n * Deleting one's own account (docs/user-admin-harmonization.md §6.4, §2.1): what it does,\n * the password, the typed address — then the app signs out.\n *\n * **Two stages, said before the button.** The request DEACTIVATES the account at once\n * (no sign-in, every session ended, marked for deletion); the erasure follows per the\n * app's `mode` — \"erased for good 30 days later\" (`after_days`, a scheduled job) or \"an\n * operator will erase it\" (`operator`, kastlan, where company records are involved).\n * The sentence is under the title, so it is read before anything is pressed.\n *\n * **The confirm is a {@link DangerConfirm}** with the two guards of every \"type the\n * address\" rule in the apps: the address typed (compared caseless, as in all of them)\n * and the password. They are the tile's own {@link TypedConfirmField} and\n * {@link CurrentPasswordInput}, drawn in its fields slot and held by\n * `confirmDisabledReason` with the tile's own sentences, rather than its built-in\n * `phrase` / `requirePassword` — those have no error of their own, and a wrong password\n * belongs under the password. Its consequences are the app's list, plus\n * Kurvenschmiede's hand-over line (`handOverCount`, §2.7: shared work goes to an\n * administrator, never a refusal). The typed address goes to `onRequest` as typed, so\n * the server re-checks it (`confirm_email_matches`).\n *\n * **Refusals** (§6.4) are read by code ({@link authErrorCode}): `password_incorrect` (a\n * `400`, so an app's 401 handling never signs the person out over a typo) under the\n * password, `confirmation_mismatch` under the address, `last_admin` — naming kastlan's\n * companies when the answer lists them — and keksdose's `household_has_members` guard\n * above the buttons; a 429; and the rest in the app's words. The confirm stays open with\n * what was typed, for a retry; Cancel wipes it.\n *\n * **After success** the card says the account is deactivated and the person is being\n * signed out — the app's to do, since the kit sends nothing (auth §8).\n */\nexport function DeleteAccountSetting({\n email,\n mode,\n days = 30,\n consequences,\n handOverCount,\n onRequest,\n describeError,\n labels: labelsProp,\n className,\n ...rest\n}: DeleteAccountSettingProps) {\n const labels = useKitLabels(\"deleteAccount\", DEFAULT_DELETE_ACCOUNT_LABELS, labelsProp);\n // The guards speak the tile's words, so \"Type “…” to confirm\" and \"Enter your password\n // to confirm\" are translated once, in `dangerConfirm`.\n const guardLabels = useKitLabels(\"dangerConfirm\", DEFAULT_DANGER_CONFIRM_LABELS);\n const locale = useKitLocale();\n const [typed, setTyped] = useState(\"\");\n const [password, setPassword] = useState(\"\");\n const [busy, setBusy] = useState(false);\n const [fieldError, setFieldError] = useState<\"email\" | \"password\" | null>(null);\n const [failure, setFailure] = useState<ReactNode>(null);\n const [done, setDone] = useState(false);\n const mounted = useMounted();\n const typedRef = useRef<HTMLInputElement>(null);\n const passwordRef = useRef<HTMLInputElement>(null);\n const doneRef = useRef<HTMLDivElement>(null);\n // The tile went with the press; the answer takes the focus, so it is read out.\n useFocusWhen(done, doneRef);\n\n const modeSentence = mode === \"operator\" ? labels.operator : labels.afterDays(days);\n\n const lines: (string | DangerConsequence)[] = (consequences ?? [])\n // `{cond && \"…\"}` lines that came out empty are no lines.\n .filter((item) => item !== null && item !== undefined && item !== false && item !== \"\")\n .map((item, index) => (isConsequence(item) ? item : { key: `app-${index}`, text: item }));\n if (handOverCount !== undefined && handOverCount > 0) {\n lines.push({ key: \"hand-over\", text: labels.handOver(handOverCount) });\n }\n\n // The first guard still open, in the order the fields are drawn — DangerConfirm's rule.\n const held = !typedMatches(typed, email, \"caseless\")\n ? typeof guardLabels.needsPhrase === \"function\"\n ? guardLabels.needsPhrase(email)\n : guardLabels.needsPhrase\n : password === \"\"\n ? guardLabels.needsPassword\n : undefined;\n\n const present = (error: unknown) => {\n const own = describeError?.(error);\n if (hasMessage(own)) {\n setFailure(own);\n return;\n }\n if (isRateLimited(error)) {\n setFailure(labels.rateLimited(retryAfterSeconds(error)));\n return;\n }\n const code = authErrorCode(error);\n // `invalid_credentials` too, for a server that answered a wrong password so before\n // server-kit 0.4.0 named `password_incorrect`.\n if (code === \"password_incorrect\" || code === \"invalid_credentials\") {\n setFieldError(\"password\");\n passwordRef.current?.focus();\n return;\n }\n if (code === \"confirmation_mismatch\" || code === \"confirmation_required\") {\n setFieldError(\"email\");\n typedRef.current?.focus();\n return;\n }\n if (code === \"last_admin\") {\n const companies = refusalCompanies(error);\n setFailure(\n companies\n ? labels.lastAdminOf(new Intl.ListFormat(locale, { type: \"conjunction\" }).format(companies))\n : labels.lastAdmin,\n );\n return;\n }\n setFailure(code === \"household_has_members\" ? labels.householdHasMembers : labels.failed);\n };\n\n const confirm = () => {\n setFailure(null);\n setFieldError(null);\n setBusy(true);\n const values: DeleteAccountValues = { password, confirmEmail: typed.trim() };\n return settle(() => onRequest(values)).then(\n () => {\n if (!mounted.current) return;\n setBusy(false);\n setDone(true);\n },\n (error: unknown) => {\n if (mounted.current) {\n setBusy(false);\n present(error);\n }\n // Rejected again, so DangerConfirm stays armed with what was typed.\n throw error;\n },\n );\n };\n\n // A disarmed tile holds no password — DangerConfirm's own rule, for the fields it\n // does not own here.\n const disarmed = (armed: boolean) => {\n if (armed) return;\n setTyped(\"\");\n setPassword(\"\");\n setFieldError(null);\n setFailure(null);\n };\n\n return (\n <Card\n {...rest}\n data-state={done ? \"done\" : \"form\"}\n tone=\"danger\"\n className={cn(\"p-4 space-y-3\", className)}\n >\n <div>\n <SettingsCardTitle>{labels.title}</SettingsCardTitle>\n <div className={CARD_DESCRIPTION_CLASS}>{modeSentence}</div>\n </div>\n {done ? (\n <div ref={doneRef} tabIndex={-1} role=\"status\" className=\"flex items-start gap-2 text-sm outline-none\">\n <UserX aria-hidden className=\"mt-0.5 size-4 shrink-0 text-[var(--text-muted)]\" />\n <span>{labels.done}</span>\n </div>\n ) : (\n <>\n <DangerConfirm\n commit\n armLabel={labels.arm}\n prompt={labels.prompt}\n consequences={lines}\n confirmLabel={labels.confirm}\n confirmDisabledReason={held}\n busy={busy}\n onArmedChange={disarmed}\n onConfirm={confirm}\n >\n <TypedConfirmField\n ref={typedRef}\n target={email}\n match=\"caseless\"\n value={typed}\n onValueChange={(next) => {\n setTyped(next);\n if (fieldError === \"email\") setFieldError(null);\n }}\n error={fieldError === \"email\" ? labels.confirmationMismatch : undefined}\n busy={busy}\n />\n <CurrentPasswordInput\n ref={passwordRef}\n value={password}\n onValueChange={(next) => {\n setPassword(next);\n if (fieldError === \"password\") setFieldError(null);\n }}\n error={fieldError === \"password\" ? labels.wrongPassword : undefined}\n busy={busy}\n />\n </DangerConfirm>\n {hasMessage(failure) && (\n <AlertBanner tone=\"danger\" size=\"sm\" role=\"alert\">\n {failure}\n </AlertBanner>\n )}\n </>\n )}\n </Card>\n );\n}\n"],"mappings":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AA,QACC,OACC,qBAAC,SAAI,KAAK,SAAS,UAAU,IAAI,MAAK,UAAS,WAAU,+CACvD;AAAA,8BAAC,SAAM,eAAW,MAAC,WAAU,mDAAkD;AAAA,UAC/E,oBAAC,UAAM,iBAAO,MAAK;AAAA,WACrB,IAEA,iCACE;AAAA;AAAA,YAAC;AAAA;AAAA,cACC,QAAM;AAAA,cACN,UAAU,OAAO;AAAA,cACjB,QAAQ,OAAO;AAAA,cACf,cAAc;AAAA,cACd,cAAc,OAAO;AAAA,cACrB,uBAAuB;AAAA,cACvB;AAAA,cACA,eAAe;AAAA,cACf,WAAW;AAAA,cAEX;AAAA;AAAA,kBAAC;AAAA;AAAA,oBACC,KAAK;AAAA,oBACL,QAAQ;AAAA,oBACR,OAAM;AAAA,oBACN,OAAO;AAAA,oBACP,eAAe,CAAC,SAAS;AACvB,+BAAS,IAAI;AACb,0BAAI,eAAe,QAAS,eAAc,IAAI;AAAA,oBAChD;AAAA,oBACA,OAAO,eAAe,UAAU,OAAO,uBAAuB;AAAA,oBAC9D;AAAA;AAAA,gBACF;AAAA,gBACA;AAAA,kBAAC;AAAA;AAAA,oBACC,KAAK;AAAA,oBACL,OAAO;AAAA,oBACP,eAAe,CAAC,SAAS;AACvB,kCAAY,IAAI;AAChB,0BAAI,eAAe,WAAY,eAAc,IAAI;AAAA,oBACnD;AAAA,oBACA,OAAO,eAAe,aAAa,OAAO,gBAAgB;AAAA,oBAC1D;AAAA;AAAA,gBACF;AAAA;AAAA;AAAA,UACF;AAAA,UACC,WAAW,OAAO,KACjB,oBAAC,eAAY,MAAK,UAAS,MAAK,MAAK,MAAK,SACvC,mBACH;AAAA,WAEJ;AAAA;AAAA;AAAA,EAEJ;AAEJ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/account/delete-account-setting.tsx"],"sourcesContent":["import { isValidElement, useRef, useState } from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode } from \"react\";\nimport { UserX } from \"lucide-react\";\n\nimport { useKitLabels, useKitLocale } from \"../i18n/kit-labels\";\nimport { cn } from \"../lib/cn\";\nimport { AlertBanner } from \"../components/alert-banner\";\nimport { hasMessage } from \"../components/choice-parts\";\nimport {\n CurrentPasswordInput,\n DangerConfirm,\n DEFAULT_DANGER_CONFIRM_LABELS,\n TypedConfirmField,\n typedMatches,\n} from \"../components/danger-confirm\";\nimport type { DangerConsequence } from \"../components/danger-confirm\";\nimport { Card } from \"../components/ui\";\nimport { authErrorCode, englishRateLimited, isRateLimited, retryAfterSeconds } from \"../auth/auth-errors\";\nimport { useFocusWhen } from \"../auth/status-parts\";\nimport { CARD_DESCRIPTION_CLASS, refusalCompanies, settle, useMounted } from \"./account-parts\";\nimport { SettingsCardTitle } from \"../settings/settings-heading\";\nimport { COMMIT_EXCEPT_BILLING } from \"../components/write-lock\";\n\n/* ── Labels ──────────────────────────────────────────────────────────────── */\n\n/**\n * Every string {@link DeleteAccountSetting} renders — the `deleteAccount` namespace of\n * `<UiKitProvider labels>`, overridable per instance through `labels`. The confirm's\n * Cancel, \"Password\" and \"Type … to confirm\" are `dangerConfirm`'s.\n */\nexport interface DeleteAccountLabels {\n /** The card's title. */\n title: string;\n /** Mode `after_days`, given the days: what happens and when. */\n afterDays: (days: number) => string;\n /** Mode `operator`: what happens, and who erases it. */\n operator: string;\n /** The button that opens the confirm. */\n arm: string;\n /** The confirm's warning, over the consequences. */\n prompt: string;\n /** The line in the consequences when `handOverCount` is given (Kurvenschmiede, §2.7),\n * given the count. */\n handOver: (count: number) => string;\n /** The button that sends it. */\n confirm: string;\n /** Said once the request is accepted — the app signs out next. */\n done: string;\n /** `password_incorrect` (server-kit's `400` for a wrong current password), under the\n * password field. */\n wrongPassword: string;\n /** `confirmation_mismatch` — the server did not take the typed address as the\n * account's — under the address field. */\n confirmationMismatch: string;\n /** `last_admin` — the account is the last active admin. */\n lastAdmin: string;\n /** `last_admin` naming the companies (kastlan checks per company), given them as one\n * list in the reader's language (\"Example AG and Sample GmbH\"). */\n lastAdminOf: (companies: string) => string;\n /** `household_has_members` — keksdose's guard (§6.4). */\n householdHasMembers: string;\n /** A request was throttled — HTTP 429 — given its `Retry-After` wait in seconds, or\n * `undefined` without one. */\n rateLimited: (seconds?: number) => string;\n /** Any other failure. */\n failed: string;\n}\n\nexport const DEFAULT_DELETE_ACCOUNT_LABELS: DeleteAccountLabels = {\n title: \"Delete account\",\n afterDays: (days) =>\n days === 1\n ? \"Your account is deactivated at once and erased for good 1 day later.\"\n : `Your account is deactivated at once and erased for good ${days} days later.`,\n operator: \"Your account is deactivated at once, and an operator will erase it for good.\",\n arm: \"Delete account…\",\n prompt: \"You will be signed out on every device, and your account can no longer be used.\",\n handOver: (count) =>\n count === 1\n ? \"1 item others can see will pass to an administrator.\"\n : `${count} items others can see will pass to an administrator.`,\n confirm: \"Delete my account\",\n done: \"Your account is deactivated. You are being signed out.\",\n wrongPassword: \"The password is incorrect.\",\n confirmationMismatch: \"This is not your account’s address.\",\n lastAdmin: \"You are the last administrator. Make someone else an administrator first.\",\n lastAdminOf: (companies) =>\n `You are the last administrator of ${companies}. Make someone else an administrator there first.`,\n householdHasMembers:\n \"Your household has other members, so the account can’t be deleted here. Please write to the operator.\",\n rateLimited: englishRateLimited,\n failed: \"Your account could not be deleted. Please try again.\",\n};\n\n/* ── Props ───────────────────────────────────────────────────────────────── */\n\n/** What happens after the deactivation (§2.1, §6.4) — the app's setting. */\nexport type DeletionMode = \"after_days\" | \"operator\";\n\n/** What {@link DeleteAccountSettingProps.onRequest} gets: the `POST /auth/me/deletion`\n * body. */\nexport interface DeleteAccountValues {\n /** As typed. */\n password: string;\n /** The address as TYPED, trimmed — the server re-checks it against the account\n * (server-kit's `confirm_email_matches`), as keksdose's admin actions do. */\n confirmEmail: string;\n}\n\n/** One line of the consequences: a node of the app's, or a {@link DangerConsequence}\n * for a key of its own and the `severe` mark. */\nexport type DeleteAccountConsequence = ReactNode | DangerConsequence;\n\nexport interface DeleteAccountSettingProps extends Omit<ComponentPropsWithoutRef<\"div\">, \"children\"> {\n /** The account's address — the text to type. */\n email: string;\n /** `\"after_days\"` (keksdose, Kurvenschmiede: erased by a scheduled job) or\n * `\"operator\"` (kastlan: company data is involved, an operator erases it). */\n mode: DeletionMode;\n /** With `after_days`: how many. Default 30 (§2.1). */\n days?: number;\n /**\n * What goes, in the app's words (§6.4: \"the app's own list\") — derived from the\n * account's own facts where it can be: keksdose's \"Budget X will be deleted; its 2\n * guests are told\", rather than the worst case for everybody.\n */\n consequences?: readonly DeleteAccountConsequence[];\n /** Kurvenschmiede (§2.7): how many owned items others can see — they pass to the\n * first active admin at erasure. A line of its own in the consequences; 0 or left\n * out, none. */\n handOverCount?: number;\n /**\n * The confirm was answered: send `POST /auth/me/deletion {password, confirm_email}`.\n * Resolve once it is accepted — the card says \"You are being signed out\" — and then\n * sign the user out: the server ended every session with the deactivation. Reject\n * with the client's error: `password_incorrect` under the password,\n * `confirmation_mismatch` under the address, `last_admin` (with kastlan's\n * `companies`) and `household_has_members` above the buttons, a 429 as\n * `rateLimited`, anything else (a demo account's 403, an app's own code) through\n * `describeError`, else `failed`. The confirm stays open with what was typed, for a\n * retry.\n */\n onRequest: (values: DeleteAccountValues) => Promise<unknown> | void;\n /** The app's own words for a failure, or `undefined` for the kit's. Asked first, for\n * every failure — kastlan's `last_admin` names the companies. */\n describeError?: (error: unknown) => ReactNode | undefined;\n labels?: Partial<DeleteAccountLabels>;\n}\n\n/** Whether an item is a `{ text }` line rather than a node — a React element is an\n * object too, and so would a `{ text }` lookalike be, so the element test comes first. */\nfunction isConsequence(item: DeleteAccountConsequence): item is DangerConsequence {\n return typeof item === \"object\" && item !== null && !isValidElement(item) && \"text\" in item;\n}\n\n/**\n * Deleting one's own account (docs/user-admin-harmonization.md §6.4, §2.1): what it does,\n * the password, the typed address — then the app signs out.\n *\n * **Two stages, said before the button.** The request DEACTIVATES the account at once\n * (no sign-in, every session ended, marked for deletion); the erasure follows per the\n * app's `mode` — \"erased for good 30 days later\" (`after_days`, a scheduled job) or \"an\n * operator will erase it\" (`operator`, kastlan, where company records are involved).\n * The sentence is under the title, so it is read before anything is pressed.\n *\n * **The confirm is a {@link DangerConfirm}** with the two guards of every \"type the\n * address\" rule in the apps: the address typed (compared caseless, as in all of them)\n * and the password. They are the tile's own {@link TypedConfirmField} and\n * {@link CurrentPasswordInput}, drawn in its fields slot and held by\n * `confirmDisabledReason` with the tile's own sentences, rather than its built-in\n * `phrase` / `requirePassword` — those have no error of their own, and a wrong password\n * belongs under the password. Its consequences are the app's list, plus\n * Kurvenschmiede's hand-over line (`handOverCount`, §2.7: shared work goes to an\n * administrator, never a refusal). The typed address goes to `onRequest` as typed, so\n * the server re-checks it (`confirm_email_matches`).\n *\n * **Refusals** (§6.4) are read by code ({@link authErrorCode}): `password_incorrect` (a\n * `400`, so an app's 401 handling never signs the person out over a typo) under the\n * password, `confirmation_mismatch` under the address, `last_admin` — naming kastlan's\n * companies when the answer lists them — and keksdose's `household_has_members` guard\n * above the buttons; a 429; and the rest in the app's words. The confirm stays open with\n * what was typed, for a retry; Cancel wipes it.\n *\n * **After success** the card says the account is deactivated and the person is being\n * signed out — the app's to do, since the kit sends nothing (auth §8).\n *\n * **Under a write lock** the confirm is a `commit` exempt from billing\n * (`COMMIT_EXCEPT_BILLING`, 0.33): leaving never depends on paying\n * (docs/billing-harmonization.md decision 14, §12.36); a demo's lock still holds it.\n */\nexport function DeleteAccountSetting({\n email,\n mode,\n days = 30,\n consequences,\n handOverCount,\n onRequest,\n describeError,\n labels: labelsProp,\n className,\n ...rest\n}: DeleteAccountSettingProps) {\n const labels = useKitLabels(\"deleteAccount\", DEFAULT_DELETE_ACCOUNT_LABELS, labelsProp);\n // The guards speak the tile's words, so \"Type “…” to confirm\" and \"Enter your password\n // to confirm\" are translated once, in `dangerConfirm`.\n const guardLabels = useKitLabels(\"dangerConfirm\", DEFAULT_DANGER_CONFIRM_LABELS);\n const locale = useKitLocale();\n const [typed, setTyped] = useState(\"\");\n const [password, setPassword] = useState(\"\");\n const [busy, setBusy] = useState(false);\n const [fieldError, setFieldError] = useState<\"email\" | \"password\" | null>(null);\n const [failure, setFailure] = useState<ReactNode>(null);\n const [done, setDone] = useState(false);\n const mounted = useMounted();\n const typedRef = useRef<HTMLInputElement>(null);\n const passwordRef = useRef<HTMLInputElement>(null);\n const doneRef = useRef<HTMLDivElement>(null);\n // The tile went with the press; the answer takes the focus, so it is read out.\n useFocusWhen(done, doneRef);\n\n const modeSentence = mode === \"operator\" ? labels.operator : labels.afterDays(days);\n\n const lines: (string | DangerConsequence)[] = (consequences ?? [])\n // `{cond && \"…\"}` lines that came out empty are no lines.\n .filter((item) => item !== null && item !== undefined && item !== false && item !== \"\")\n .map((item, index) => (isConsequence(item) ? item : { key: `app-${index}`, text: item }));\n if (handOverCount !== undefined && handOverCount > 0) {\n lines.push({ key: \"hand-over\", text: labels.handOver(handOverCount) });\n }\n\n // The first guard still open, in the order the fields are drawn — DangerConfirm's rule.\n const held = !typedMatches(typed, email, \"caseless\")\n ? typeof guardLabels.needsPhrase === \"function\"\n ? guardLabels.needsPhrase(email)\n : guardLabels.needsPhrase\n : password === \"\"\n ? guardLabels.needsPassword\n : undefined;\n\n const present = (error: unknown) => {\n const own = describeError?.(error);\n if (hasMessage(own)) {\n setFailure(own);\n return;\n }\n if (isRateLimited(error)) {\n setFailure(labels.rateLimited(retryAfterSeconds(error)));\n return;\n }\n const code = authErrorCode(error);\n // `invalid_credentials` too, for a server that answered a wrong password so before\n // server-kit 0.4.0 named `password_incorrect`.\n if (code === \"password_incorrect\" || code === \"invalid_credentials\") {\n setFieldError(\"password\");\n passwordRef.current?.focus();\n return;\n }\n if (code === \"confirmation_mismatch\" || code === \"confirmation_required\") {\n setFieldError(\"email\");\n typedRef.current?.focus();\n return;\n }\n if (code === \"last_admin\") {\n const companies = refusalCompanies(error);\n setFailure(\n companies\n ? labels.lastAdminOf(new Intl.ListFormat(locale, { type: \"conjunction\" }).format(companies))\n : labels.lastAdmin,\n );\n return;\n }\n setFailure(code === \"household_has_members\" ? labels.householdHasMembers : labels.failed);\n };\n\n const confirm = () => {\n setFailure(null);\n setFieldError(null);\n setBusy(true);\n const values: DeleteAccountValues = { password, confirmEmail: typed.trim() };\n return settle(() => onRequest(values)).then(\n () => {\n if (!mounted.current) return;\n setBusy(false);\n setDone(true);\n },\n (error: unknown) => {\n if (mounted.current) {\n setBusy(false);\n present(error);\n }\n // Rejected again, so DangerConfirm stays armed with what was typed.\n throw error;\n },\n );\n };\n\n // A disarmed tile holds no password — DangerConfirm's own rule, for the fields it\n // does not own here.\n const disarmed = (armed: boolean) => {\n if (armed) return;\n setTyped(\"\");\n setPassword(\"\");\n setFieldError(null);\n setFailure(null);\n };\n\n return (\n <Card\n {...rest}\n data-state={done ? \"done\" : \"form\"}\n tone=\"danger\"\n className={cn(\"p-4 space-y-3\", className)}\n >\n <div>\n <SettingsCardTitle>{labels.title}</SettingsCardTitle>\n <div className={CARD_DESCRIPTION_CLASS}>{modeSentence}</div>\n </div>\n {done ? (\n <div ref={doneRef} tabIndex={-1} role=\"status\" className=\"flex items-start gap-2 text-sm outline-none\">\n <UserX aria-hidden className=\"mt-0.5 size-4 shrink-0 text-[var(--text-muted)]\" />\n <span>{labels.done}</span>\n </div>\n ) : (\n <>\n <DangerConfirm\n commit={COMMIT_EXCEPT_BILLING}\n armLabel={labels.arm}\n prompt={labels.prompt}\n consequences={lines}\n confirmLabel={labels.confirm}\n confirmDisabledReason={held}\n busy={busy}\n onArmedChange={disarmed}\n onConfirm={confirm}\n >\n <TypedConfirmField\n ref={typedRef}\n target={email}\n match=\"caseless\"\n value={typed}\n onValueChange={(next) => {\n setTyped(next);\n if (fieldError === \"email\") setFieldError(null);\n }}\n error={fieldError === \"email\" ? labels.confirmationMismatch : undefined}\n busy={busy}\n />\n <CurrentPasswordInput\n ref={passwordRef}\n value={password}\n onValueChange={(next) => {\n setPassword(next);\n if (fieldError === \"password\") setFieldError(null);\n }}\n error={fieldError === \"password\" ? labels.wrongPassword : undefined}\n busy={busy}\n />\n </DangerConfirm>\n {hasMessage(failure) && (\n <AlertBanner tone=\"danger\" size=\"sm\" role=\"alert\">\n {failure}\n </AlertBanner>\n )}\n </>\n )}\n </Card>\n );\n}\n"],"mappings":";AAyTM,SAUE,UATA,KADF;AAzTN,SAAS,gBAAgB,QAAQ,gBAAgB;AAEjD,SAAS,aAAa;AAEtB,SAAS,cAAc,oBAAoB;AAC3C,SAAS,UAAU;AACnB,SAAS,mBAAmB;AAC5B,SAAS,kBAAkB;AAC3B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,YAAY;AACrB,SAAS,eAAe,oBAAoB,eAAe,yBAAyB;AACpF,SAAS,oBAAoB;AAC7B,SAAS,wBAAwB,kBAAkB,QAAQ,kBAAkB;AAC7E,SAAS,yBAAyB;AAClC,SAAS,6BAA6B;AA+C/B,MAAM,gCAAqD;AAAA,EAChE,OAAO;AAAA,EACP,WAAW,CAAC,SACV,SAAS,IACL,yEACA,2DAA2D,IAAI;AAAA,EACrE,UAAU;AAAA,EACV,KAAK;AAAA,EACL,QAAQ;AAAA,EACR,UAAU,CAAC,UACT,UAAU,IACN,yDACA,GAAG,KAAK;AAAA,EACd,SAAS;AAAA,EACT,MAAM;AAAA,EACN,eAAe;AAAA,EACf,sBAAsB;AAAA,EACtB,WAAW;AAAA,EACX,aAAa,CAAC,cACZ,qCAAqC,SAAS;AAAA,EAChD,qBACE;AAAA,EACF,aAAa;AAAA,EACb,QAAQ;AACV;AA2DA,SAAS,cAAc,MAA2D;AAChF,SAAO,OAAO,SAAS,YAAY,SAAS,QAAQ,CAAC,eAAe,IAAI,KAAK,UAAU;AACzF;AAqCO,SAAS,qBAAqB;AAAA,EACnC;AAAA,EACA;AAAA,EACA,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR;AAAA,EACA,GAAG;AACL,GAA8B;AAC5B,QAAM,SA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]}
|
|
@@ -130,6 +130,11 @@ interface EmailChangeSettingProps extends Omit<ComponentPropsWithoutRef<"div">,
|
|
|
130
130
|
* **Done** (`confirmed`): "Your email address is now …" and, unless `passkeyNote` is
|
|
131
131
|
* off, that a passkey keeps its old label in the device's list — the authenticator
|
|
132
132
|
* stored the name it was given, and only a new passkey carries the new one.
|
|
133
|
+
*
|
|
134
|
+
* **Under a write lock** the request, "Send the link again" and "Cancel the change" are
|
|
135
|
+
* `commit` controls exempt from billing (`COMMIT_EXCEPT_BILLING`, 0.33): the address is
|
|
136
|
+
* the account's own settings, which a lapsed plan never locks
|
|
137
|
+
* (docs/billing-harmonization.md §3.3, §12.36); a demo's lock still does.
|
|
133
138
|
*/
|
|
134
139
|
declare function EmailChangeSetting({ currentEmail, pendingEmail, onRequest, onResend, onCancel, confirmed, passkeyNote, emailTag, describeError, labels: labelsProp, className, ...rest }: EmailChangeSettingProps): react.JSX.Element;
|
|
135
140
|
|
|
@@ -12,6 +12,7 @@ import { authErrorCode, englishRateLimited, isRateLimited, retryAfterSeconds } f
|
|
|
12
12
|
import { emailParts, taggedEmail } from "../auth/email-tag.js";
|
|
13
13
|
import { CARD_DESCRIPTION_CLASS, settle, useMounted } from "./account-parts.js";
|
|
14
14
|
import { SettingsCardTitle } from "../settings/settings-heading.js";
|
|
15
|
+
import { COMMIT_EXCEPT_BILLING } from "../components/write-lock.js";
|
|
15
16
|
const DEFAULT_EMAIL_CHANGE_LABELS = {
|
|
16
17
|
title: "Email address",
|
|
17
18
|
current: "Current address",
|
|
@@ -125,7 +126,7 @@ function EmailChangeSetting({
|
|
|
125
126
|
type: "button",
|
|
126
127
|
variant: "secondary",
|
|
127
128
|
size: "sm",
|
|
128
|
-
commit:
|
|
129
|
+
commit: COMMIT_EXCEPT_BILLING,
|
|
129
130
|
pending: busy === "resend",
|
|
130
131
|
disabled: busy === "cancel",
|
|
131
132
|
onClick: () => run("resend", onResend),
|
|
@@ -138,7 +139,7 @@ function EmailChangeSetting({
|
|
|
138
139
|
type: "button",
|
|
139
140
|
variant: "ghost",
|
|
140
141
|
size: "sm",
|
|
141
|
-
commit:
|
|
142
|
+
commit: COMMIT_EXCEPT_BILLING,
|
|
142
143
|
pending: busy === "cancel",
|
|
143
144
|
disabled: busy === "resend",
|
|
144
145
|
onClick: () => run("cancel", onCancel),
|
|
@@ -267,7 +268,7 @@ function EmailChangeSetting({
|
|
|
267
268
|
}
|
|
268
269
|
),
|
|
269
270
|
failure && /* @__PURE__ */ jsx(AlertBanner, { tone: "danger", size: "sm", role: "alert", children: failure.message }),
|
|
270
|
-
/* @__PURE__ */ jsx(Button, { type: "submit", commit:
|
|
271
|
+
/* @__PURE__ */ jsx(Button, { type: "submit", commit: COMMIT_EXCEPT_BILLING, disabled: !working && !canSubmit, pending: working, children: labels.submit })
|
|
271
272
|
] })
|
|
272
273
|
] });
|
|
273
274
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/account/email-change-setting.tsx"],"sourcesContent":["import { useEffect, useId, useRef, useState } from \"react\";\nimport type { ComponentPropsWithoutRef, FormEvent, ReactNode } from \"react\";\nimport { MailCheck } from \"lucide-react\";\n\nimport { DEFAULT_COMMON_LABELS, useKitLabels } from \"../i18n/kit-labels\";\nimport { cn } from \"../lib/cn\";\nimport { AlertBanner } from \"../components/alert-banner\";\nimport { hasMessage } from \"../components/choice-parts\";\nimport { CurrentPasswordInput } from \"../components/danger-confirm\";\nimport { Button, Card, Input } from \"../components/ui\";\nimport { authErrorCode, englishRateLimited, isRateLimited, retryAfterSeconds } from \"../auth/auth-errors\";\nimport { emailParts, taggedEmail } from \"../auth/email-tag\";\nimport { CARD_DESCRIPTION_CLASS, settle, useMounted } from \"./account-parts\";\nimport { SettingsCardTitle } from \"../settings/settings-heading\";\n\n/* ── Labels ──────────────────────────────────────────────────────────────── */\n\n/** Every string {@link EmailChangeSetting} renders — the `emailChange` namespace of\n * `<UiKitProvider labels>`, overridable per instance through `labels`. */\nexport interface EmailChangeLabels {\n /** The card's title. */\n title: string;\n /** Names the address the account has now: \"Current address: ada@example.com\". */\n current: string;\n /** The new address's field. */\n newEmail: string;\n /** The password field. */\n password: string;\n /** Under the password field: why it is asked again. */\n passwordHint: string;\n /** The address-tag button (auth §4.5), given the exact address it would use. */\n emailTagUse: (address: string) => string;\n /** The line after the address-tag button. */\n emailTagHint: string;\n /** The submit button. */\n submit: string;\n /** Under the new address while it is the current one. */\n sameAsCurrent: string;\n /** `email_taken`, under the new address. */\n emailTaken: string;\n /** `password_incorrect`, under the password. */\n wrongPassword: string;\n /** The pending state, given the new address the link went to. */\n pending: (newEmail: string) => string;\n /** Under it, given the current address — which still signs in until the link is\n * confirmed. */\n pendingHint: (currentEmail: string) => string;\n /** Mails the link again. */\n resend: string;\n /** Said once it went. */\n resent: string;\n /** Drops the change; the current address stays. */\n cancel: string;\n /** The done state (`confirmed`), given the address the account has now. */\n confirmed: (email: string) => string;\n /** Under it (`passkeyNote`): a passkey's label in the authenticator keeps the old\n * address (§6.2). */\n passkeyNote: string;\n /** A request was throttled — HTTP 429 — given its `Retry-After` wait in seconds, or\n * `undefined` without one. */\n rateLimited: (seconds?: number) => string;\n /** Any other failure, of any of the three requests. */\n failed: string;\n}\n\nexport const DEFAULT_EMAIL_CHANGE_LABELS: EmailChangeLabels = {\n title: \"Email address\",\n current: \"Current address\",\n newEmail: \"New email address\",\n password: \"Current password\",\n passwordHint: \"Your address is how you sign in, so changing it takes your password.\",\n emailTagUse: (address) => `Use ${address}`,\n emailTagHint:\n \"Many providers deliver name+tag@… to the same inbox, so mail from this app is easy to filter and trace. Check yours does before you rely on it: you would sign in with the tagged address.\",\n submit: \"Change email address\",\n sameAsCurrent: \"This is already your address.\",\n emailTaken: \"An account with this email address already exists.\",\n wrongPassword: \"The password is incorrect.\",\n pending: (newEmail) => `Confirm the link we sent to ${newEmail}.`,\n pendingHint: (currentEmail) =>\n `Until you do, you keep signing in with ${currentEmail}. Check your spam folder too.`,\n resend: \"Send the link again\",\n resent: \"We sent the link again.\",\n cancel: \"Cancel the change\",\n confirmed: (email) => `Your email address is now ${email}.`,\n passkeyNote: \"Your passkeys keep working. Your device may still list them under your old address.\",\n rateLimited: englishRateLimited,\n failed: \"That didn’t work. Please try again.\",\n};\n\n/* ── Props ───────────────────────────────────────────────────────────────── */\n\n/** What {@link EmailChangeSettingProps.onRequest} gets: the `POST /auth/me/email` body. */\nexport interface EmailChangeValues {\n /** Trimmed. A `+tag` stays (auth §4.5); lower-casing is the server's. */\n newEmail: string;\n /** As typed. */\n password: string;\n}\n\n/** Which request failed — {@link EmailChangeSettingProps.describeError}'s second\n * argument. */\nexport type EmailChangeAction = \"request\" | \"resend\" | \"cancel\";\n\nexport interface EmailChangeSettingProps extends Omit<ComponentPropsWithoutRef<\"div\">, \"children\" | \"onSubmit\"> {\n /** The account's address now. */\n currentEmail: string;\n /**\n * The address a change waits on, from the app's server state — so a reload, or\n * another tab, shows the pending state. `null`: none, whatever the card did. Left out\n * (`undefined`), the card keeps its own: pending from a resolved `onRequest` until a\n * resolved `onCancel`.\n */\n pendingEmail?: string | null;\n /**\n * The form was submitted: send `POST /auth/me/email {new_email, password}` (§6.2).\n * Resolve once the link is mailed — refresh `pendingEmail` first if the app passes\n * it — and the card shows \"Confirm the link we sent to …\". Reject with the client's\n * error: `email_taken` shows under the new address, `password_incorrect` (server-kit's\n * `400` for a wrong current password; an older `invalid_credentials` too) under the\n * password, a 429 as `rateLimited`, anything else as `failed` unless `describeError`\n * has the app's words.\n */\n onRequest: (values: EmailChangeValues) => Promise<unknown> | void;\n /** Mail the link again. Left out, no button. */\n onResend?: () => Promise<unknown> | void;\n /** Drop the pending change. Left out, no button. */\n onCancel?: () => Promise<unknown> | void;\n /**\n * The change was just confirmed — the app's confirm route (`POST /auth/me/email/confirm`)\n * came back here. Says \"Your email address is now …\" over the form, with\n * `passkeyNote`.\n */\n confirmed?: boolean;\n /** With `confirmed`: say that a passkey's label keeps the old address (§6.2). Default\n * `true`; `false` for an account without passkeys. */\n passkeyNote?: boolean;\n /**\n * The app's address tag (`\"kastlan\"`, auth §4.5): once the new address is plausible a\n * button under it offers the tagged form — the rule of `RegisterForm`, since this is\n * the person's own address. Never applied on its own. Left out, no offer.\n */\n emailTag?: string;\n /** The app's own words for a failure, or `undefined` for the kit's. Asked first, for\n * every failure (a demo account's 403, the device offline). */\n describeError?: (error: unknown, action: EmailChangeAction) => ReactNode | undefined;\n labels?: Partial<EmailChangeLabels>;\n}\n\ninterface Failure {\n action: EmailChangeAction;\n message: ReactNode;\n}\n\n/**\n * Changing the account's email address (docs/user-admin-harmonization.md §6.2, §2.5):\n * the current address, the new one, the password — then a pending state until the new\n * address confirms its link.\n *\n * **The new address must confirm before it takes effect.** The server mails a one-time\n * link to the NEW address (and a notice to the old one); until it is opened, the account\n * keeps the old address and signs in with it. So the card's answer to a request is not\n * \"changed\" but \"Confirm the link we sent to …\", with \"Send the link again\" and \"Cancel\n * the change\". The state is the server's: pass `pendingEmail` and a reload shows it too.\n *\n * **The password is asked again** because the address is the identity: whoever holds the\n * session must not move the account to a mailbox of their own. It is a\n * {@link CurrentPasswordInput}, so a password manager fills it and offers no new one.\n *\n * **The `+tag` offer** (`emailTag`) is RegisterForm's: the address is the person's own,\n * so `you+kastlan@…` is offered under the field, applied only on a click.\n *\n * **It never sends a request** (auth §8): `onRequest`, `onResend` and `onCancel` are the\n * app's, and their refusals are read by code — `email_taken` and `password_incorrect`\n * under their fields, which take the focus; a 429 as \"Too many attempts\". A wrong\n * password is a `400 password_incorrect`, never a 401: an app's client reads a 401 on a\n * signed-in route as an ended session, and would sign the person out for a typo.\n *\n * **Done** (`confirmed`): \"Your email address is now …\" and, unless `passkeyNote` is\n * off, that a passkey keeps its old label in the device's list — the authenticator\n * stored the name it was given, and only a new passkey carries the new one.\n */\nexport function EmailChangeSetting({\n currentEmail,\n pendingEmail,\n onRequest,\n onResend,\n onCancel,\n confirmed,\n passkeyNote = true,\n emailTag,\n describeError,\n labels: labelsProp,\n className,\n ...rest\n}: EmailChangeSettingProps) {\n const labels = useKitLabels(\"emailChange\", DEFAULT_EMAIL_CHANGE_LABELS, labelsProp);\n const common = useKitLabels(\"common\", DEFAULT_COMMON_LABELS);\n const [newEmail, setNewEmail] = useState(\"\");\n const [password, setPassword] = useState(\"\");\n const [ownPending, setOwnPending] = useState<string | null>(null);\n const [busy, setBusy] = useState<EmailChangeAction | null>(null);\n const [failure, setFailure] = useState<Failure | null>(null);\n // `email_taken` belongs to the address it was answered for; another one clears it.\n const [taken, setTaken] = useState<string | null>(null);\n const [wrongPassword, setWrongPassword] = useState(false);\n const [resent, setResent] = useState(false);\n const mounted = useMounted();\n const titleId = useId();\n const tagHintId = useId();\n const emailRef = useRef<HTMLInputElement>(null);\n const passwordRef = useRef<HTMLInputElement>(null);\n const pendingRef = useRef<HTMLDivElement>(null);\n\n const pending = pendingEmail !== undefined ? pendingEmail : ownPending;\n const isPending = pending !== null && pending !== \"\";\n\n // The state swapped under the button that was pressed (the form for the pending\n // message, or back): the focus goes to what came in, never down to <body>. Only after\n // the person's own request — a pending state that arrives with the page takes nothing.\n const focusNext = useRef<\"pending\" | \"form\" | null>(null);\n useEffect(() => {\n const target = focusNext.current;\n if (target === \"pending\" && isPending) {\n focusNext.current = null;\n pendingRef.current?.focus();\n } else if (target === \"form\" && !isPending) {\n focusNext.current = null;\n emailRef.current?.focus();\n }\n }, [isPending]);\n\n const messageFor = (error: unknown, action: EmailChangeAction): ReactNode => {\n const own = describeError?.(error, action);\n if (hasMessage(own)) return own;\n return isRateLimited(error) ? labels.rateLimited(retryAfterSeconds(error)) : labels.failed;\n };\n\n /* ── The pending state ── */\n if (isPending) {\n const run = (action: \"resend\" | \"cancel\", call: () => unknown) => {\n if (busy) return;\n setBusy(action);\n setFailure(null);\n setResent(false);\n settle(call).then(\n () => {\n if (!mounted.current) return;\n setBusy(null);\n if (action === \"resend\") {\n setResent(true);\n return;\n }\n focusNext.current = \"form\";\n setOwnPending(null);\n },\n (error: unknown) => {\n if (!mounted.current) return;\n setBusy(null);\n setFailure({ action, message: messageFor(error, action) });\n },\n );\n };\n return (\n <Card {...rest} data-state=\"pending\" className={cn(\"p-4 space-y-3\", className)}>\n <div>\n <SettingsCardTitle id={titleId}>{labels.title}</SettingsCardTitle>\n <div className={cn(CARD_DESCRIPTION_CLASS, \"break-all\")}>{common.fieldValue(labels.current, currentEmail)}</div>\n </div>\n {/* Focusable, not a control: the request's answer is read out when it takes the\n focus from the submit that went with the form. */}\n <div ref={pendingRef} tabIndex={-1} className=\"flex gap-2 outline-none\">\n <MailCheck aria-hidden className=\"mt-0.5 size-4 shrink-0 text-[var(--success)]\" />\n <div className=\"min-w-0 space-y-1\">\n <p className=\"break-words text-sm\">{labels.pending(pending)}</p>\n <p className={CARD_DESCRIPTION_CLASS}>{labels.pendingHint(currentEmail)}</p>\n </div>\n </div>\n {(onResend || onCancel) && (\n <div className=\"flex flex-wrap items-center gap-2\">\n {onResend && (\n <Button\n type=\"button\"\n variant=\"secondary\"\n size=\"sm\"\n commit\n pending={busy === \"resend\"}\n disabled={busy === \"cancel\"}\n onClick={() => run(\"resend\", onResend)}\n >\n {labels.resend}\n </Button>\n )}\n {onCancel && (\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n commit\n pending={busy === \"cancel\"}\n disabled={busy === \"resend\"}\n onClick={() => run(\"cancel\", onCancel)}\n >\n {labels.cancel}\n </Button>\n )}\n {/* Always in the tree, so the \"sent again\" that appears in it is announced\n (VerifyEmailStatus's resend line). */}\n <span role=\"status\" className=\"text-xs text-[var(--success)]\">\n {resent ? labels.resent : null}\n </span>\n </div>\n )}\n {failure && (\n <AlertBanner tone=\"danger\" size=\"sm\" role=\"alert\">\n {failure.message}\n </AlertBanner>\n )}\n </Card>\n );\n }\n\n /* ── The form ── */\n const typed = newEmail.trim();\n const same = typed !== \"\" && typed.toLowerCase() === currentEmail.trim().toLowerCase();\n const working = busy !== null;\n const canSubmit = emailParts(newEmail) !== null && !same && password !== \"\";\n const suggestion = emailTag ? taggedEmail(newEmail, emailTag) : null;\n const emailError = same ? labels.sameAsCurrent : taken !== null && taken === typed ? labels.emailTaken : undefined;\n\n const submit = (e: FormEvent) => {\n e.preventDefault();\n if (!canSubmit || working) return;\n const values: EmailChangeValues = { newEmail: typed, password };\n setBusy(\"request\");\n setFailure(null);\n setTaken(null);\n setWrongPassword(false);\n settle(() => onRequest(values)).then(\n () => {\n if (!mounted.current) return;\n setBusy(null);\n // The password has done its work; nothing of the form stays in state.\n setNewEmail(\"\");\n setPassword(\"\");\n setResent(false);\n focusNext.current = \"pending\";\n setOwnPending(values.newEmail);\n },\n (error: unknown) => {\n if (!mounted.current) return;\n setBusy(null);\n const own = describeError?.(error, \"request\");\n if (hasMessage(own)) {\n setFailure({ action: \"request\", message: own });\n return;\n }\n if (isRateLimited(error)) {\n setFailure({ action: \"request\", message: labels.rateLimited(retryAfterSeconds(error)) });\n return;\n }\n const code = authErrorCode(error);\n if (code === \"email_taken\") {\n setTaken(values.newEmail);\n emailRef.current?.focus();\n return;\n }\n // `invalid_credentials` too, for a server that answered a wrong password so\n // before server-kit 0.4.0 named `password_incorrect`.\n if (code === \"password_incorrect\" || code === \"invalid_credentials\") {\n setWrongPassword(true);\n passwordRef.current?.focus();\n return;\n }\n setFailure({ action: \"request\", message: labels.failed });\n },\n );\n };\n\n return (\n <Card {...rest} data-state={confirmed ? \"confirmed\" : \"form\"} className={cn(\"p-4 space-y-3\", className)}>\n <div>\n <SettingsCardTitle id={titleId}>{labels.title}</SettingsCardTitle>\n <div className={cn(CARD_DESCRIPTION_CLASS, \"break-all\")}>{common.fieldValue(labels.current, currentEmail)}</div>\n </div>\n {confirmed && (\n <AlertBanner tone=\"success\" size=\"sm\">\n <span className=\"block\">{labels.confirmed(currentEmail)}</span>\n {passkeyNote && <span className=\"mt-1 block\">{labels.passkeyNote}</span>}\n </AlertBanner>\n )}\n <form className=\"space-y-3\" aria-labelledby={titleId} onSubmit={submit} noValidate>\n <div>\n <Input\n ref={emailRef}\n type=\"email\"\n name=\"email\"\n autoComplete=\"email\"\n label={labels.newEmail}\n value={newEmail}\n onChange={(e) => {\n setNewEmail(e.target.value);\n if (failure) setFailure(null);\n }}\n readOnly={working}\n error={emailError}\n required\n />\n {/* RegisterForm's offer (auth §4.5): one click, the exact address on the\n button, reversible by typing. */}\n {suggestion && (\n <p className=\"mt-1 text-xs text-[var(--text-muted)]\">\n <Button\n type=\"button\"\n variant=\"link\"\n size=\"sm\"\n className=\"h-auto p-0 align-baseline\"\n disabled={working}\n aria-describedby={tagHintId}\n onClick={() => setNewEmail(suggestion)}\n >\n {labels.emailTagUse(suggestion)}\n </Button>{\" \"}\n <span id={tagHintId}>{labels.emailTagHint}</span>\n </p>\n )}\n </div>\n <CurrentPasswordInput\n ref={passwordRef}\n name=\"password\"\n label={labels.password}\n value={password}\n onValueChange={(next) => {\n setPassword(next);\n setWrongPassword(false);\n if (failure) setFailure(null);\n }}\n hint={labels.passwordHint}\n error={wrongPassword ? labels.wrongPassword : undefined}\n busy={working}\n required\n />\n {failure && (\n <AlertBanner tone=\"danger\" size=\"sm\" role=\"alert\">\n {failure.message}\n </AlertBanner>\n )}\n <Button type=\"submit\" commit disabled={!working && !canSubmit} pending={working}>\n {labels.submit}\n </Button>\n </form>\n </Card>\n );\n}\n"],"mappings":";AAyQQ,SACE,KADF;AAzQR,SAAS,WAAW,OAAO,QAAQ,gBAAgB;AAEnD,SAAS,iBAAiB;AAE1B,SAAS,uBAAuB,oBAAoB;AACpD,SAAS,UAAU;AACnB,SAAS,mBAAmB;AAC5B,SAAS,kBAAkB;AAC3B,SAAS,4BAA4B;AACrC,SAAS,QAAQ,MAAM,aAAa;AACpC,SAAS,eAAe,oBAAoB,eAAe,yBAAyB;AACpF,SAAS,YAAY,mBAAmB;AACxC,SAAS,wBAAwB,QAAQ,kBAAkB;AAC3D,SAAS,yBAAyB;AAoD3B,MAAM,8BAAiD;AAAA,EAC5D,OAAO;AAAA,EACP,SAAS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,WAC5C;AAAA,SAEJ;AAAA,MACA;AAAA,QAAC;AAAA;AAAA,UACC,KAAK;AAAA,UACL,MAAK;AAAA,UACL,OAAO,OAAO;AAAA,UACd,OAAO;AAAA,UACP,eAAe,CAAC,SAAS;AACvB,wBAAY,IAAI;AAChB,6BAAiB,KAAK;AACtB,gBAAI,QAAS,YAAW,IAAI;AAAA,UAC9B;AAAA,UACA,MAAM,OAAO;AAAA,UACb,OAAO,gBAAgB,OAAO,gBAAgB;AAAA,UAC9C,MAAM;AAAA,UACN,UAAQ;AAAA;AAAA,MACV;AAAA,MACC,WACC,oBAAC,eAAY,MAAK,UAAS,MAAK,MAAK,MAAK,SACvC,kBAAQ,SACX;AAAA,MAEF,oBAAC,UAAO,MAAK,UAAS,QAAM,MAAC,UAAU,CAAC,WAAW,CAAC,WAAW,SAAS,SACrE,iBAAO,QACV;AAAA,OACF;AAAA,KACF;AAEJ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/account/email-change-setting.tsx"],"sourcesContent":["import { useEffect, useId, useRef, useState } from \"react\";\nimport type { ComponentPropsWithoutRef, FormEvent, ReactNode } from \"react\";\nimport { MailCheck } from \"lucide-react\";\n\nimport { DEFAULT_COMMON_LABELS, useKitLabels } from \"../i18n/kit-labels\";\nimport { cn } from \"../lib/cn\";\nimport { AlertBanner } from \"../components/alert-banner\";\nimport { hasMessage } from \"../components/choice-parts\";\nimport { CurrentPasswordInput } from \"../components/danger-confirm\";\nimport { Button, Card, Input } from \"../components/ui\";\nimport { authErrorCode, englishRateLimited, isRateLimited, retryAfterSeconds } from \"../auth/auth-errors\";\nimport { emailParts, taggedEmail } from \"../auth/email-tag\";\nimport { CARD_DESCRIPTION_CLASS, settle, useMounted } from \"./account-parts\";\nimport { SettingsCardTitle } from \"../settings/settings-heading\";\nimport { COMMIT_EXCEPT_BILLING } from \"../components/write-lock\";\n\n/* ── Labels ──────────────────────────────────────────────────────────────── */\n\n/** Every string {@link EmailChangeSetting} renders — the `emailChange` namespace of\n * `<UiKitProvider labels>`, overridable per instance through `labels`. */\nexport interface EmailChangeLabels {\n /** The card's title. */\n title: string;\n /** Names the address the account has now: \"Current address: ada@example.com\". */\n current: string;\n /** The new address's field. */\n newEmail: string;\n /** The password field. */\n password: string;\n /** Under the password field: why it is asked again. */\n passwordHint: string;\n /** The address-tag button (auth §4.5), given the exact address it would use. */\n emailTagUse: (address: string) => string;\n /** The line after the address-tag button. */\n emailTagHint: string;\n /** The submit button. */\n submit: string;\n /** Under the new address while it is the current one. */\n sameAsCurrent: string;\n /** `email_taken`, under the new address. */\n emailTaken: string;\n /** `password_incorrect`, under the password. */\n wrongPassword: string;\n /** The pending state, given the new address the link went to. */\n pending: (newEmail: string) => string;\n /** Under it, given the current address — which still signs in until the link is\n * confirmed. */\n pendingHint: (currentEmail: string) => string;\n /** Mails the link again. */\n resend: string;\n /** Said once it went. */\n resent: string;\n /** Drops the change; the current address stays. */\n cancel: string;\n /** The done state (`confirmed`), given the address the account has now. */\n confirmed: (email: string) => string;\n /** Under it (`passkeyNote`): a passkey's label in the authenticator keeps the old\n * address (§6.2). */\n passkeyNote: string;\n /** A request was throttled — HTTP 429 — given its `Retry-After` wait in seconds, or\n * `undefined` without one. */\n rateLimited: (seconds?: number) => string;\n /** Any other failure, of any of the three requests. */\n failed: string;\n}\n\nexport const DEFAULT_EMAIL_CHANGE_LABELS: EmailChangeLabels = {\n title: \"Email address\",\n current: \"Current address\",\n newEmail: \"New email address\",\n password: \"Current password\",\n passwordHint: \"Your address is how you sign in, so changing it takes your password.\",\n emailTagUse: (address) => `Use ${address}`,\n emailTagHint:\n \"Many providers deliver name+tag@… to the same inbox, so mail from this app is easy to filter and trace. Check yours does before you rely on it: you would sign in with the tagged address.\",\n submit: \"Change email address\",\n sameAsCurrent: \"This is already your address.\",\n emailTaken: \"An account with this email address already exists.\",\n wrongPassword: \"The password is incorrect.\",\n pending: (newEmail) => `Confirm the link we sent to ${newEmail}.`,\n pendingHint: (currentEmail) =>\n `Until you do, you keep signing in with ${currentEmail}. Check your spam folder too.`,\n resend: \"Send the link again\",\n resent: \"We sent the link again.\",\n cancel: \"Cancel the change\",\n confirmed: (email) => `Your email address is now ${email}.`,\n passkeyNote: \"Your passkeys keep working. Your device may still list them under your old address.\",\n rateLimited: englishRateLimited,\n failed: \"That didn’t work. Please try again.\",\n};\n\n/* ── Props ───────────────────────────────────────────────────────────────── */\n\n/** What {@link EmailChangeSettingProps.onRequest} gets: the `POST /auth/me/email` body. */\nexport interface EmailChangeValues {\n /** Trimmed. A `+tag` stays (auth §4.5); lower-casing is the server's. */\n newEmail: string;\n /** As typed. */\n password: string;\n}\n\n/** Which request failed — {@link EmailChangeSettingProps.describeError}'s second\n * argument. */\nexport type EmailChangeAction = \"request\" | \"resend\" | \"cancel\";\n\nexport interface EmailChangeSettingProps extends Omit<ComponentPropsWithoutRef<\"div\">, \"children\" | \"onSubmit\"> {\n /** The account's address now. */\n currentEmail: string;\n /**\n * The address a change waits on, from the app's server state — so a reload, or\n * another tab, shows the pending state. `null`: none, whatever the card did. Left out\n * (`undefined`), the card keeps its own: pending from a resolved `onRequest` until a\n * resolved `onCancel`.\n */\n pendingEmail?: string | null;\n /**\n * The form was submitted: send `POST /auth/me/email {new_email, password}` (§6.2).\n * Resolve once the link is mailed — refresh `pendingEmail` first if the app passes\n * it — and the card shows \"Confirm the link we sent to …\". Reject with the client's\n * error: `email_taken` shows under the new address, `password_incorrect` (server-kit's\n * `400` for a wrong current password; an older `invalid_credentials` too) under the\n * password, a 429 as `rateLimited`, anything else as `failed` unless `describeError`\n * has the app's words.\n */\n onRequest: (values: EmailChangeValues) => Promise<unknown> | void;\n /** Mail the link again. Left out, no button. */\n onResend?: () => Promise<unknown> | void;\n /** Drop the pending change. Left out, no button. */\n onCancel?: () => Promise<unknown> | void;\n /**\n * The change was just confirmed — the app's confirm route (`POST /auth/me/email/confirm`)\n * came back here. Says \"Your email address is now …\" over the form, with\n * `passkeyNote`.\n */\n confirmed?: boolean;\n /** With `confirmed`: say that a passkey's label keeps the old address (§6.2). Default\n * `true`; `false` for an account without passkeys. */\n passkeyNote?: boolean;\n /**\n * The app's address tag (`\"kastlan\"`, auth §4.5): once the new address is plausible a\n * button under it offers the tagged form — the rule of `RegisterForm`, since this is\n * the person's own address. Never applied on its own. Left out, no offer.\n */\n emailTag?: string;\n /** The app's own words for a failure, or `undefined` for the kit's. Asked first, for\n * every failure (a demo account's 403, the device offline). */\n describeError?: (error: unknown, action: EmailChangeAction) => ReactNode | undefined;\n labels?: Partial<EmailChangeLabels>;\n}\n\ninterface Failure {\n action: EmailChangeAction;\n message: ReactNode;\n}\n\n/**\n * Changing the account's email address (docs/user-admin-harmonization.md §6.2, §2.5):\n * the current address, the new one, the password — then a pending state until the new\n * address confirms its link.\n *\n * **The new address must confirm before it takes effect.** The server mails a one-time\n * link to the NEW address (and a notice to the old one); until it is opened, the account\n * keeps the old address and signs in with it. So the card's answer to a request is not\n * \"changed\" but \"Confirm the link we sent to …\", with \"Send the link again\" and \"Cancel\n * the change\". The state is the server's: pass `pendingEmail` and a reload shows it too.\n *\n * **The password is asked again** because the address is the identity: whoever holds the\n * session must not move the account to a mailbox of their own. It is a\n * {@link CurrentPasswordInput}, so a password manager fills it and offers no new one.\n *\n * **The `+tag` offer** (`emailTag`) is RegisterForm's: the address is the person's own,\n * so `you+kastlan@…` is offered under the field, applied only on a click.\n *\n * **It never sends a request** (auth §8): `onRequest`, `onResend` and `onCancel` are the\n * app's, and their refusals are read by code — `email_taken` and `password_incorrect`\n * under their fields, which take the focus; a 429 as \"Too many attempts\". A wrong\n * password is a `400 password_incorrect`, never a 401: an app's client reads a 401 on a\n * signed-in route as an ended session, and would sign the person out for a typo.\n *\n * **Done** (`confirmed`): \"Your email address is now …\" and, unless `passkeyNote` is\n * off, that a passkey keeps its old label in the device's list — the authenticator\n * stored the name it was given, and only a new passkey carries the new one.\n *\n * **Under a write lock** the request, \"Send the link again\" and \"Cancel the change\" are\n * `commit` controls exempt from billing (`COMMIT_EXCEPT_BILLING`, 0.33): the address is\n * the account's own settings, which a lapsed plan never locks\n * (docs/billing-harmonization.md §3.3, §12.36); a demo's lock still does.\n */\nexport function EmailChangeSetting({\n currentEmail,\n pendingEmail,\n onRequest,\n onResend,\n onCancel,\n confirmed,\n passkeyNote = true,\n emailTag,\n describeError,\n labels: labelsProp,\n className,\n ...rest\n}: EmailChangeSettingProps) {\n const labels = useKitLabels(\"emailChange\", DEFAULT_EMAIL_CHANGE_LABELS, labelsProp);\n const common = useKitLabels(\"common\", DEFAULT_COMMON_LABELS);\n const [newEmail, setNewEmail] = useState(\"\");\n const [password, setPassword] = useState(\"\");\n const [ownPending, setOwnPending] = useState<string | null>(null);\n const [busy, setBusy] = useState<EmailChangeAction | null>(null);\n const [failure, setFailure] = useState<Failure | null>(null);\n // `email_taken` belongs to the address it was answered for; another one clears it.\n const [taken, setTaken] = useState<string | null>(null);\n const [wrongPassword, setWrongPassword] = useState(false);\n const [resent, setResent] = useState(false);\n const mounted = useMounted();\n const titleId = useId();\n const tagHintId = useId();\n const emailRef = useRef<HTMLInputElement>(null);\n const passwordRef = useRef<HTMLInputElement>(null);\n const pendingRef = useRef<HTMLDivElement>(null);\n\n const pending = pendingEmail !== undefined ? pendingEmail : ownPending;\n const isPending = pending !== null && pending !== \"\";\n\n // The state swapped under the button that was pressed (the form for the pending\n // message, or back): the focus goes to what came in, never down to <body>. Only after\n // the person's own request — a pending state that arrives with the page takes nothing.\n const focusNext = useRef<\"pending\" | \"form\" | null>(null);\n useEffect(() => {\n const target = focusNext.current;\n if (target === \"pending\" && isPending) {\n focusNext.current = null;\n pendingRef.current?.focus();\n } else if (target === \"form\" && !isPending) {\n focusNext.current = null;\n emailRef.current?.focus();\n }\n }, [isPending]);\n\n const messageFor = (error: unknown, action: EmailChangeAction): ReactNode => {\n const own = describeError?.(error, action);\n if (hasMessage(own)) return own;\n return isRateLimited(error) ? labels.rateLimited(retryAfterSeconds(error)) : labels.failed;\n };\n\n /* ── The pending state ── */\n if (isPending) {\n const run = (action: \"resend\" | \"cancel\", call: () => unknown) => {\n if (busy) return;\n setBusy(action);\n setFailure(null);\n setResent(false);\n settle(call).then(\n () => {\n if (!mounted.current) return;\n setBusy(null);\n if (action === \"resend\") {\n setResent(true);\n return;\n }\n focusNext.current = \"form\";\n setOwnPending(null);\n },\n (error: unknown) => {\n if (!mounted.current) return;\n setBusy(null);\n setFailure({ action, message: messageFor(error, action) });\n },\n );\n };\n return (\n <Card {...rest} data-state=\"pending\" className={cn(\"p-4 space-y-3\", className)}>\n <div>\n <SettingsCardTitle id={titleId}>{labels.title}</SettingsCardTitle>\n <div className={cn(CARD_DESCRIPTION_CLASS, \"break-all\")}>{common.fieldValue(labels.current, currentEmail)}</div>\n </div>\n {/* Focusable, not a control: the request's answer is read out when it takes the\n focus from the submit that went with the form. */}\n <div ref={pendingRef} tabIndex={-1} className=\"flex gap-2 outline-none\">\n <MailCheck aria-hidden className=\"mt-0.5 size-4 shrink-0 text-[var(--success)]\" />\n <div className=\"min-w-0 space-y-1\">\n <p className=\"break-words text-sm\">{labels.pending(pending)}</p>\n <p className={CARD_DESCRIPTION_CLASS}>{labels.pendingHint(currentEmail)}</p>\n </div>\n </div>\n {(onResend || onCancel) && (\n <div className=\"flex flex-wrap items-center gap-2\">\n {onResend && (\n <Button\n type=\"button\"\n variant=\"secondary\"\n size=\"sm\"\n commit={COMMIT_EXCEPT_BILLING}\n pending={busy === \"resend\"}\n disabled={busy === \"cancel\"}\n onClick={() => run(\"resend\", onResend)}\n >\n {labels.resend}\n </Button>\n )}\n {onCancel && (\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n commit={COMMIT_EXCEPT_BILLING}\n pending={busy === \"cancel\"}\n disabled={busy === \"resend\"}\n onClick={() => run(\"cancel\", onCancel)}\n >\n {labels.cancel}\n </Button>\n )}\n {/* Always in the tree, so the \"sent again\" that appears in it is announced\n (VerifyEmailStatus's resend line). */}\n <span role=\"status\" className=\"text-xs text-[var(--success)]\">\n {resent ? labels.resent : null}\n </span>\n </div>\n )}\n {failure && (\n <AlertBanner tone=\"danger\" size=\"sm\" role=\"alert\">\n {failure.message}\n </AlertBanner>\n )}\n </Card>\n );\n }\n\n /* ── The form ── */\n const typed = newEmail.trim();\n const same = typed !== \"\" && typed.toLowerCase() === currentEmail.trim().toLowerCase();\n const working = busy !== null;\n const canSubmit = emailParts(newEmail) !== null && !same && password !== \"\";\n const suggestion = emailTag ? taggedEmail(newEmail, emailTag) : null;\n const emailError = same ? labels.sameAsCurrent : taken !== null && taken === typed ? labels.emailTaken : undefined;\n\n const submit = (e: FormEvent) => {\n e.preventDefault();\n if (!canSubmit || working) return;\n const values: EmailChangeValues = { newEmail: typed, password };\n setBusy(\"request\");\n setFailure(null);\n setTaken(null);\n setWrongPassword(false);\n settle(() => onRequest(values)).then(\n () => {\n if (!mounted.current) return;\n setBusy(null);\n // The password has done its work; nothing of the form stays in state.\n setNewEmail(\"\");\n setPassword(\"\");\n setResent(false);\n focusNext.current = \"pending\";\n setOwnPending(values.newEmail);\n },\n (error: unknown) => {\n if (!mounted.current) return;\n setBusy(null);\n const own = describeError?.(error, \"request\");\n if (hasMessage(own)) {\n setFailure({ action: \"request\", message: own });\n return;\n }\n if (isRateLimited(error)) {\n setFailure({ action: \"request\", message: labels.rateLimited(retryAfterSeconds(error)) });\n return;\n }\n const code = authErrorCode(error);\n if (code === \"email_taken\") {\n setTaken(values.newEmail);\n emailRef.current?.focus();\n return;\n }\n // `invalid_credentials` too, for a server that answered a wrong password so\n // before server-kit 0.4.0 named `password_incorrect`.\n if (code === \"password_incorrect\" || code === \"invalid_credentials\") {\n setWrongPassword(true);\n passwordRef.current?.focus();\n return;\n }\n setFailure({ action: \"request\", message: labels.failed });\n },\n );\n };\n\n return (\n <Card {...rest} data-state={confirmed ? \"confirmed\" : \"form\"} className={cn(\"p-4 space-y-3\", className)}>\n <div>\n <SettingsCardTitle id={titleId}>{labels.title}</SettingsCardTitle>\n <div className={cn(CARD_DESCRIPTION_CLASS, \"break-all\")}>{common.fieldValue(labels.current, currentEmail)}</div>\n </div>\n {confirmed && (\n <AlertBanner tone=\"success\" size=\"sm\">\n <span className=\"block\">{labels.confirmed(currentEmail)}</span>\n {passkeyNote && <span className=\"mt-1 block\">{labels.passkeyNote}</span>}\n </AlertBanner>\n )}\n <form className=\"space-y-3\" aria-labelledby={titleId} onSubmit={submit} noValidate>\n <div>\n <Input\n ref={emailRef}\n type=\"email\"\n name=\"email\"\n autoComplete=\"email\"\n label={labels.newEmail}\n value={newEmail}\n onChange={(e) => {\n setNewEmail(e.target.value);\n if (failure) setFailure(null);\n }}\n readOnly={working}\n error={emailError}\n required\n />\n {/* RegisterForm's offer (auth §4.5): one click, the exact address on the\n button, reversible by typing. */}\n {suggestion && (\n <p className=\"mt-1 text-xs text-[var(--text-muted)]\">\n <Button\n type=\"button\"\n variant=\"link\"\n size=\"sm\"\n className=\"h-auto p-0 align-baseline\"\n disabled={working}\n aria-describedby={tagHintId}\n onClick={() => setNewEmail(suggestion)}\n >\n {labels.emailTagUse(suggestion)}\n </Button>{\" \"}\n <span id={tagHintId}>{labels.emailTagHint}</span>\n </p>\n )}\n </div>\n <CurrentPasswordInput\n ref={passwordRef}\n name=\"password\"\n label={labels.password}\n value={password}\n onValueChange={(next) => {\n setPassword(next);\n setWrongPassword(false);\n if (failure) setFailure(null);\n }}\n hint={labels.passwordHint}\n error={wrongPassword ? labels.wrongPassword : undefined}\n busy={working}\n required\n />\n {failure && (\n <AlertBanner tone=\"danger\" size=\"sm\" role=\"alert\">\n {failure.message}\n </AlertBanner>\n )}\n <Button type=\"submit\" commit={COMMIT_EXCEPT_BILLING} disabled={!working && !canSubmit} pending={working}>\n {labels.submit}\n </Button>\n </form>\n </Card>\n );\n}\n"],"mappings":";AA+QQ,SACE,KADF;AA/QR,SAAS,WAAW,OAAO,QAAQ,gBAAgB;AAEnD,SAAS,iBAAiB;AAE1B,SAAS,uBAAuB,oBAAoB;AACpD,SAAS,UA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AAC,OAAE,WAAU,yCACX;AAAA;AAAA,YAAC;AAAA;AAAA,cACC,MAAK;AAAA,cACL,SAAQ;AAAA,cACR,MAAK;AAAA,cACL,WAAU;AAAA,cACV,UAAU;AAAA,cACV,oBAAkB;AAAA,cAClB,SAAS,MAAM,YAAY,UAAU;AAAA,cAEpC,iBAAO,YAAY,UAAU;AAAA;AAAA,UAChC;AAAA,UAAU;AAAA,UACV,oBAAC,UAAK,IAAI,WAAY,iBAAO,cAAa;AAAA,WAC5C;AAAA,SAEJ;AAAA,MACA;AAAA,QAAC;AAAA;AAAA,UACC,KAAK;AAAA,UACL,MAAK;AAAA,UACL,OAAO,OAAO;AAAA,UACd,OAAO;AAAA,UACP,eAAe,CAAC,SAAS;AACvB,wBAAY,IAAI;AAChB,6BAAiB,KAAK;AACtB,gBAAI,QAAS,YAAW,IAAI;AAAA,UAC9B;AAAA,UACA,MAAM,OAAO;AAAA,UACb,OAAO,gBAAgB,OAAO,gBAAgB;AAAA,UAC9C,MAAM;AAAA,UACN,UAAQ;AAAA;AAAA,MACV;AAAA,MACC,WACC,oBAAC,eAAY,MAAK,UAAS,MAAK,MAAK,MAAK,SACvC,kBAAQ,SACX;AAAA,MAEF,oBAAC,UAAO,MAAK,UAAS,QAAQ,uBAAuB,UAAU,CAAC,WAAW,CAAC,WAAW,SAAS,SAC7F,iBAAO,QACV;AAAA,OACF;AAAA,KACF;AAEJ;","names":[]}
|
|
@@ -104,6 +104,10 @@ interface SessionsSettingProps<Id extends SessionId = SessionId> extends Omit<Co
|
|
|
104
104
|
*
|
|
105
105
|
* Both requests are the app's; a failure is said under the card's action, in the app's
|
|
106
106
|
* words if `describeError` has them.
|
|
107
|
+
*
|
|
108
|
+
* **Under a write lock** both are `commit` controls exempt from billing
|
|
109
|
+
* (`COMMIT_EXCEPT_BILLING`, 0.33): a lapsed plan never keeps a person from ending their
|
|
110
|
+
* own sessions (docs/billing-harmonization.md §12.13, §12.36); a demo's lock still does.
|
|
107
111
|
*/
|
|
108
112
|
declare function SessionsSetting<Id extends SessionId = SessionId>({ onSignOutEverywhere, sessions, loading, onRevoke, describeError, formatLastActive, locale: localeProp, labels: labelsProp, className, ...rest }: SessionsSettingProps<Id>): react.JSX.Element;
|
|
109
113
|
|
|
@@ -13,6 +13,7 @@ import { Skeleton } from "../components/skeleton.js";
|
|
|
13
13
|
import { Button, Card } from "../components/ui.js";
|
|
14
14
|
import { CARD_DESCRIPTION_CLASS, settle, useMounted } from "./account-parts.js";
|
|
15
15
|
import { SettingsCardTitle } from "../settings/settings-heading.js";
|
|
16
|
+
import { COMMIT_EXCEPT_BILLING } from "../components/write-lock.js";
|
|
16
17
|
const DEFAULT_SESSIONS_LABELS = {
|
|
17
18
|
title: "Sessions",
|
|
18
19
|
description: "Signed in on a device you no longer use, or don\u2019t trust? Sign out everywhere.",
|
|
@@ -113,7 +114,7 @@ function SessionsSetting({
|
|
|
113
114
|
type: "button",
|
|
114
115
|
size: "sm",
|
|
115
116
|
variant: "ghost",
|
|
116
|
-
commit:
|
|
117
|
+
commit: COMMIT_EXCEPT_BILLING,
|
|
117
118
|
pending: busyId === session.id,
|
|
118
119
|
disabled: busyId !== null && busyId !== session.id,
|
|
119
120
|
"aria-label": labels.revokeItem(device),
|
|
@@ -130,7 +131,7 @@ function SessionsSetting({
|
|
|
130
131
|
DangerConfirm,
|
|
131
132
|
{
|
|
132
133
|
tone: "warning",
|
|
133
|
-
commit:
|
|
134
|
+
commit: COMMIT_EXCEPT_BILLING,
|
|
134
135
|
armLabel: labels.signOutEverywhere,
|
|
135
136
|
prompt: labels.signOutEverywherePrompt,
|
|
136
137
|
confirmLabel: labels.confirmSignOutEverywhere,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/account/sessions-setting.tsx"],"sourcesContent":["import { useState } from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode } from \"react\";\nimport { MonitorSmartphone } from \"lucide-react\";\n\nimport { useKitLabels, useKitLocale } from \"../i18n/kit-labels\";\nimport { cn } from \"../lib/cn\";\nimport { formatRelativeTime, toDate } from \"../lib/format\";\nimport type { DateInput } from \"../lib/format\";\nimport { AlertBanner } from \"../components/alert-banner\";\nimport { Chip } from \"../components/chip\";\nimport { hasMessage } from \"../components/choice-parts\";\nimport { DangerConfirm } from \"../components/danger-confirm\";\nimport { Skeleton } from \"../components/skeleton\";\nimport { Button, Card } from \"../components/ui\";\nimport { CARD_DESCRIPTION_CLASS, settle, useMounted } from \"./account-parts\";\nimport { SettingsCardTitle } from \"../settings/settings-heading\";\n\n/* ── Labels ──────────────────────────────────────────────────────────────── */\n\n/** Every string {@link SessionsSetting} renders — the `sessions` namespace of\n * `<UiKitProvider labels>`, overridable per instance through `labels`. The confirm's\n * Cancel is `dangerConfirm.cancel`. */\nexport interface SessionsLabels {\n /** The card's title. */\n title: string;\n /** The line under it: what \"sign out everywhere\" is for. */\n description: string;\n /** The button that asks first. */\n signOutEverywhere: string;\n /** The question it asks: every session ends, this one too. */\n signOutEverywherePrompt: string;\n /** The button that answers it. */\n confirmSignOutEverywhere: string;\n /** The device list's accessible name. */\n list: string;\n /** While the list loads. */\n loading: string;\n /** A list with no rows. */\n empty: string;\n /** The chip on the session this page runs in. */\n current: string;\n /** A session whose device the server could not name. */\n unknownDevice: string;\n /** Given the last activity, formatted (\"3 hours ago\", \"5 Oct 2026\"). */\n lastActive: (when: string) => string;\n /** Given the address the session was last seen from. */\n ip: (address: string) => string;\n /** A row's button, visible text. */\n revoke: string;\n /** The same button's accessible name, given the device — it starts with `revoke`,\n * the visible text, so voice control finds it by what it says. */\n revokeItem: (device: string) => string;\n /** A request failed. */\n failed: string;\n}\n\nexport const DEFAULT_SESSIONS_LABELS: SessionsLabels = {\n title: \"Sessions\",\n description: \"Signed in on a device you no longer use, or don’t trust? Sign out everywhere.\",\n signOutEverywhere: \"Sign out everywhere…\",\n signOutEverywherePrompt:\n \"This ends every session, including this one: you will be signed out on this device too, and sign in again from here.\",\n confirmSignOutEverywhere: \"Sign out everywhere\",\n list: \"Where you’re signed in\",\n loading: \"Loading sessions…\",\n empty: \"No sessions to show.\",\n current: \"This device\",\n unknownDevice: \"Unknown device\",\n lastActive: (when) => `Last active ${when}`,\n ip: (address) => `IP ${address}`,\n revoke: \"Sign out\",\n revokeItem: (device) => `Sign out ${device}`,\n failed: \"That didn’t work. Please try again.\",\n};\n\n/* ── Props ───────────────────────────────────────────────────────────────── */\n\n/** What a session's `id` may be: the app's own key type. */\nexport type SessionId = string | number;\n\n/** One stored session (kastlan's `GET /auth/sessions`). */\nexport interface SessionItem<Id extends SessionId = SessionId> {\n id: Id;\n /** The browser and system, as the server reads them (\"Firefox on Windows\"). Blank\n * reads as `labels.unknownDevice`. */\n device?: string | null;\n /** The address it was last seen from. */\n ip?: string | null;\n /** A `Date`, an ISO string or epoch ms. */\n lastActiveAt?: DateInput;\n /** The session this page runs in: marked, and offered no \"Sign out\" of its own — the\n * app's sign-out does that, and \"Sign out everywhere\" below. */\n current?: boolean;\n}\n\n/** Which request failed — {@link SessionsSettingProps.describeError}'s second argument. */\nexport type SessionsAction = \"sign-out-everywhere\" | \"revoke\";\n\nexport interface SessionsSettingProps<Id extends SessionId = SessionId>\n extends Omit<ComponentPropsWithoutRef<\"div\">, \"children\"> {\n /**\n * End every session (`POST /auth/logout`, auth §6.3) — this one included. Asked\n * first; resolve once the server answered, then sign this page out: the card says\n * that the device signs out too, and its own session is gone.\n */\n onSignOutEverywhere: () => Promise<unknown> | void;\n /**\n * The stored sessions, where the app keeps them (kastlan's `user_sessions`, §6.3).\n * Left out, the card is \"Sign out everywhere\" alone — keksdose and Kurvenschmiede keep\n * a cut-off (`sessions_invalid_before`), not rows. `undefined` with `loading` while the\n * first load runs.\n */\n sessions?: readonly SessionItem<Id>[];\n /** The list is loading. */\n loading?: boolean;\n /** End one other session (`DELETE /auth/sessions/{id}`). Left out, no row buttons.\n * The row is busy until it settles; refresh `sessions` then. */\n onRevoke?: (id: Id) => Promise<unknown> | void;\n /** The app's own words for a failure, or `undefined` for the kit's `failed`. */\n describeError?: (error: unknown, action: SessionsAction) => ReactNode | undefined;\n /** The \"Last active\" text. Default: how long ago, in the provider's locale, and the\n * date once it is more than a week back. */\n formatLastActive?: (date: Date) => string;\n /** Overrides the provider's locale for the default format. */\n locale?: string;\n labels?: Partial<SessionsLabels>;\n}\n\n/**\n * Where the account is signed in, and the way out of all of it\n * (docs/user-admin-harmonization.md §6.3, §2.6).\n *\n * **\"Sign out everywhere\", in every app.** It ends every session, THIS one included —\n * the server stamps a cut-off (`sessions_invalid_before`) that the page's own token is\n * older than — so the confirm says so before it is pressed, and the app signs out once it\n * resolves. A {@link DangerConfirm} in the warning tone: nothing is lost, but the person\n * has to sign in again on every device. keksdose kept its ordinary sign-out device-only\n * (its offline mirror is wiped on an explicit sign-out), which is why this is an action\n * of its own, not a mode of that one.\n *\n * **The device list, where sessions are stored** (kastlan): device, address, last\n * active, and \"This device\" on the current one, with \"Sign out\" on each other row — no\n * confirm, since a session ended is a sign-in away from coming back, not data lost.\n * Without `sessions` there is no list: the other apps keep a cut-off, not rows.\n *\n * Both requests are the app's; a failure is said under the card's action, in the app's\n * words if `describeError` has them.\n */\nexport function SessionsSetting<Id extends SessionId = SessionId>({\n onSignOutEverywhere,\n sessions,\n loading,\n onRevoke,\n describeError,\n formatLastActive,\n locale: localeProp,\n labels: labelsProp,\n className,\n ...rest\n}: SessionsSettingProps<Id>) {\n const labels = useKitLabels(\"sessions\", DEFAULT_SESSIONS_LABELS, labelsProp);\n const locale = useKitLocale(localeProp);\n const [busyId, setBusyId] = useState<Id | null>(null);\n const [failure, setFailure] = useState<ReactNode>(null);\n const mounted = useMounted();\n\n const describe = (error: unknown, action: SessionsAction): ReactNode => {\n const own = describeError?.(error, action);\n return hasMessage(own) ? own : labels.failed;\n };\n\n const lastActive = (value: DateInput): string | null => {\n const date = toDate(value);\n if (!date) return null;\n return formatLastActive\n ? formatLastActive(date)\n : formatRelativeTime(date, { locale, absoluteAfterDays: 7, absoluteStyle: \"medium\" });\n };\n\n const signOutEverywhere = () => {\n setFailure(null);\n // Rejected again after it is said, so the tile stays armed for a retry.\n return settle(onSignOutEverywhere).catch((error: unknown) => {\n if (mounted.current) setFailure(describe(error, \"sign-out-everywhere\"));\n throw error;\n });\n };\n\n const revoke = (id: Id) => {\n if (!onRevoke || busyId !== null) return;\n setBusyId(id);\n setFailure(null);\n settle(() => onRevoke(id)).then(\n () => {\n if (mounted.current) setBusyId(null);\n },\n (error: unknown) => {\n if (!mounted.current) return;\n setBusyId(null);\n setFailure(describe(error, \"revoke\"));\n },\n );\n };\n\n const showList = sessions !== undefined || loading;\n\n return (\n <Card {...rest} className={cn(\"p-4 space-y-3\", className)}>\n <div>\n <SettingsCardTitle>{labels.title}</SettingsCardTitle>\n <div className={CARD_DESCRIPTION_CLASS}>{labels.description}</div>\n </div>\n {showList &&\n (loading || sessions === undefined ? (\n <Skeleton lines={2} label={labels.loading} />\n ) : sessions.length === 0 ? (\n <p className={CARD_DESCRIPTION_CLASS}>{labels.empty}</p>\n ) : (\n <ul aria-label={labels.list} className=\"divide-y divide-[var(--border)]\">\n {sessions.map((session) => {\n const device = session.device?.trim() || labels.unknownDevice;\n const when = lastActive(session.lastActiveAt);\n const ip = session.ip?.trim();\n return (\n <li\n key={session.id}\n data-session-id={String(session.id)}\n data-current={session.current || undefined}\n className=\"flex items-center gap-3 py-2\"\n >\n <MonitorSmartphone aria-hidden className=\"size-4 shrink-0 text-[var(--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\">{device}</span>\n {session.current && (\n <Chip size=\"sm\" tone=\"brand\">\n {labels.current}\n </Chip>\n )}\n </div>\n {(when || ip) && (\n <div className={CARD_DESCRIPTION_CLASS}>\n {when && labels.lastActive(when)}\n {when && ip && \" · \"}\n {/* An address reads left to right in any page direction. */}\n {ip && <span dir=\"ltr\">{labels.ip(ip)}</span>}\n </div>\n )}\n </div>\n {onRevoke && !session.current && (\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"ghost\"\n commit\n pending={busyId === session.id}\n disabled={busyId !== null && busyId !== session.id}\n aria-label={labels.revokeItem(device)}\n onClick={() => revoke(session.id)}\n >\n {labels.revoke}\n </Button>\n )}\n </li>\n );\n })}\n </ul>\n ))}\n <DangerConfirm\n tone=\"warning\"\n commit\n armLabel={labels.signOutEverywhere}\n prompt={labels.signOutEverywherePrompt}\n confirmLabel={labels.confirmSignOutEverywhere}\n onConfirm={signOutEverywhere}\n />\n {hasMessage(failure) && (\n <AlertBanner tone=\"danger\" size=\"sm\" role=\"alert\">\n {failure}\n </AlertBanner>\n )}\n </Card>\n );\n}\n"],"mappings":";AAgNM,SACE,KADF;AAhNN,SAAS,gBAAgB;AAEzB,SAAS,yBAAyB;AAElC,SAAS,cAAc,oBAAoB;AAC3C,SAAS,UAAU;AACnB,SAAS,oBAAoB,cAAc;AAE3C,SAAS,mBAAmB;AAC5B,SAAS,YAAY;AACrB,SAAS,kBAAkB;AAC3B,SAAS,qBAAqB;AAC9B,SAAS,gBAAgB;AACzB,SAAS,QAAQ,YAAY;AAC7B,SAAS,wBAAwB,QAAQ,kBAAkB;AAC3D,SAAS,yBAAyB;AAyC3B,MAAM,0BAA0C;AAAA,EACrD,OAAO;AAAA,EACP,aAAa;AAAA,EACb,mBAAmB;AAAA,EACnB,yBACE;AAAA,EACF,0BAA0B;AAAA,EAC1B,MAAM;AAAA,EACN,SAAS;AAAA,EACT,OAAO;AAAA,EACP,SAAS;AAAA,EACT,eAAe;AAAA,EACf,YAAY,CAAC,SAAS,eAAe,IAAI;AAAA,EACzC,IAAI,CAAC,YAAY,MAAM,OAAO;AAAA,EAC9B,QAAQ;AAAA,EACR,YAAY,CAAC,WAAW,YAAY,MAAM;AAAA,EAC1C,QAAQ;AACV;AA2EO,SAAS,gBAAkD;AAAA,EAChE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;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AS,WAAW,QAAQ;AAAA,gBAC5B,UAAU,WAAW,QAAQ,WAAW,QAAQ;AAAA,gBAChD,cAAY,OAAO,WAAW,MAAM;AAAA,gBACpC,SAAS,MAAM,OAAO,QAAQ,EAAE;AAAA,gBAE/B,iBAAO;AAAA;AAAA,YACV;AAAA;AAAA;AAAA,QApCG,QAAQ;AAAA,MAsCf;AAAA,IAEJ,CAAC,GACH;AAAA,IAEJ;AAAA,MAAC;AAAA;AAAA,QACC,MAAK;AAAA,QACL,QAAM;AAAA,QACN,UAAU,OAAO;AAAA,QACjB,QAAQ,OAAO;AAAA,QACf,cAAc,OAAO;AAAA,QACrB,WAAW;AAAA;AAAA,IACb;AAAA,IACC,WAAW,OAAO,KACjB,oBAAC,eAAY,MAAK,UAAS,MAAK,MAAK,MAAK,SACvC,mBACH;AAAA,KAEJ;AAEJ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/account/sessions-setting.tsx"],"sourcesContent":["import { useState } from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode } from \"react\";\nimport { MonitorSmartphone } from \"lucide-react\";\n\nimport { useKitLabels, useKitLocale } from \"../i18n/kit-labels\";\nimport { cn } from \"../lib/cn\";\nimport { formatRelativeTime, toDate } from \"../lib/format\";\nimport type { DateInput } from \"../lib/format\";\nimport { AlertBanner } from \"../components/alert-banner\";\nimport { Chip } from \"../components/chip\";\nimport { hasMessage } from \"../components/choice-parts\";\nimport { DangerConfirm } from \"../components/danger-confirm\";\nimport { Skeleton } from \"../components/skeleton\";\nimport { Button, Card } from \"../components/ui\";\nimport { CARD_DESCRIPTION_CLASS, settle, useMounted } from \"./account-parts\";\nimport { SettingsCardTitle } from \"../settings/settings-heading\";\nimport { COMMIT_EXCEPT_BILLING } from \"../components/write-lock\";\n\n/* ── Labels ──────────────────────────────────────────────────────────────── */\n\n/** Every string {@link SessionsSetting} renders — the `sessions` namespace of\n * `<UiKitProvider labels>`, overridable per instance through `labels`. The confirm's\n * Cancel is `dangerConfirm.cancel`. */\nexport interface SessionsLabels {\n /** The card's title. */\n title: string;\n /** The line under it: what \"sign out everywhere\" is for. */\n description: string;\n /** The button that asks first. */\n signOutEverywhere: string;\n /** The question it asks: every session ends, this one too. */\n signOutEverywherePrompt: string;\n /** The button that answers it. */\n confirmSignOutEverywhere: string;\n /** The device list's accessible name. */\n list: string;\n /** While the list loads. */\n loading: string;\n /** A list with no rows. */\n empty: string;\n /** The chip on the session this page runs in. */\n current: string;\n /** A session whose device the server could not name. */\n unknownDevice: string;\n /** Given the last activity, formatted (\"3 hours ago\", \"5 Oct 2026\"). */\n lastActive: (when: string) => string;\n /** Given the address the session was last seen from. */\n ip: (address: string) => string;\n /** A row's button, visible text. */\n revoke: string;\n /** The same button's accessible name, given the device — it starts with `revoke`,\n * the visible text, so voice control finds it by what it says. */\n revokeItem: (device: string) => string;\n /** A request failed. */\n failed: string;\n}\n\nexport const DEFAULT_SESSIONS_LABELS: SessionsLabels = {\n title: \"Sessions\",\n description: \"Signed in on a device you no longer use, or don’t trust? Sign out everywhere.\",\n signOutEverywhere: \"Sign out everywhere…\",\n signOutEverywherePrompt:\n \"This ends every session, including this one: you will be signed out on this device too, and sign in again from here.\",\n confirmSignOutEverywhere: \"Sign out everywhere\",\n list: \"Where you’re signed in\",\n loading: \"Loading sessions…\",\n empty: \"No sessions to show.\",\n current: \"This device\",\n unknownDevice: \"Unknown device\",\n lastActive: (when) => `Last active ${when}`,\n ip: (address) => `IP ${address}`,\n revoke: \"Sign out\",\n revokeItem: (device) => `Sign out ${device}`,\n failed: \"That didn’t work. Please try again.\",\n};\n\n/* ── Props ───────────────────────────────────────────────────────────────── */\n\n/** What a session's `id` may be: the app's own key type. */\nexport type SessionId = string | number;\n\n/** One stored session (kastlan's `GET /auth/sessions`). */\nexport interface SessionItem<Id extends SessionId = SessionId> {\n id: Id;\n /** The browser and system, as the server reads them (\"Firefox on Windows\"). Blank\n * reads as `labels.unknownDevice`. */\n device?: string | null;\n /** The address it was last seen from. */\n ip?: string | null;\n /** A `Date`, an ISO string or epoch ms. */\n lastActiveAt?: DateInput;\n /** The session this page runs in: marked, and offered no \"Sign out\" of its own — the\n * app's sign-out does that, and \"Sign out everywhere\" below. */\n current?: boolean;\n}\n\n/** Which request failed — {@link SessionsSettingProps.describeError}'s second argument. */\nexport type SessionsAction = \"sign-out-everywhere\" | \"revoke\";\n\nexport interface SessionsSettingProps<Id extends SessionId = SessionId>\n extends Omit<ComponentPropsWithoutRef<\"div\">, \"children\"> {\n /**\n * End every session (`POST /auth/logout`, auth §6.3) — this one included. Asked\n * first; resolve once the server answered, then sign this page out: the card says\n * that the device signs out too, and its own session is gone.\n */\n onSignOutEverywhere: () => Promise<unknown> | void;\n /**\n * The stored sessions, where the app keeps them (kastlan's `user_sessions`, §6.3).\n * Left out, the card is \"Sign out everywhere\" alone — keksdose and Kurvenschmiede keep\n * a cut-off (`sessions_invalid_before`), not rows. `undefined` with `loading` while the\n * first load runs.\n */\n sessions?: readonly SessionItem<Id>[];\n /** The list is loading. */\n loading?: boolean;\n /** End one other session (`DELETE /auth/sessions/{id}`). Left out, no row buttons.\n * The row is busy until it settles; refresh `sessions` then. */\n onRevoke?: (id: Id) => Promise<unknown> | void;\n /** The app's own words for a failure, or `undefined` for the kit's `failed`. */\n describeError?: (error: unknown, action: SessionsAction) => ReactNode | undefined;\n /** The \"Last active\" text. Default: how long ago, in the provider's locale, and the\n * date once it is more than a week back. */\n formatLastActive?: (date: Date) => string;\n /** Overrides the provider's locale for the default format. */\n locale?: string;\n labels?: Partial<SessionsLabels>;\n}\n\n/**\n * Where the account is signed in, and the way out of all of it\n * (docs/user-admin-harmonization.md §6.3, §2.6).\n *\n * **\"Sign out everywhere\", in every app.** It ends every session, THIS one included —\n * the server stamps a cut-off (`sessions_invalid_before`) that the page's own token is\n * older than — so the confirm says so before it is pressed, and the app signs out once it\n * resolves. A {@link DangerConfirm} in the warning tone: nothing is lost, but the person\n * has to sign in again on every device. keksdose kept its ordinary sign-out device-only\n * (its offline mirror is wiped on an explicit sign-out), which is why this is an action\n * of its own, not a mode of that one.\n *\n * **The device list, where sessions are stored** (kastlan): device, address, last\n * active, and \"This device\" on the current one, with \"Sign out\" on each other row — no\n * confirm, since a session ended is a sign-in away from coming back, not data lost.\n * Without `sessions` there is no list: the other apps keep a cut-off, not rows.\n *\n * Both requests are the app's; a failure is said under the card's action, in the app's\n * words if `describeError` has them.\n *\n * **Under a write lock** both are `commit` controls exempt from billing\n * (`COMMIT_EXCEPT_BILLING`, 0.33): a lapsed plan never keeps a person from ending their\n * own sessions (docs/billing-harmonization.md §12.13, §12.36); a demo's lock still does.\n */\nexport function SessionsSetting<Id extends SessionId = SessionId>({\n onSignOutEverywhere,\n sessions,\n loading,\n onRevoke,\n describeError,\n formatLastActive,\n locale: localeProp,\n labels: labelsProp,\n className,\n ...rest\n}: SessionsSettingProps<Id>) {\n const labels = useKitLabels(\"sessions\", DEFAULT_SESSIONS_LABELS, labelsProp);\n const locale = useKitLocale(localeProp);\n const [busyId, setBusyId] = useState<Id | null>(null);\n const [failure, setFailure] = useState<ReactNode>(null);\n const mounted = useMounted();\n\n const describe = (error: unknown, action: SessionsAction): ReactNode => {\n const own = describeError?.(error, action);\n return hasMessage(own) ? own : labels.failed;\n };\n\n const lastActive = (value: DateInput): string | null => {\n const date = toDate(value);\n if (!date) return null;\n return formatLastActive\n ? formatLastActive(date)\n : formatRelativeTime(date, { locale, absoluteAfterDays: 7, absoluteStyle: \"medium\" });\n };\n\n const signOutEverywhere = () => {\n setFailure(null);\n // Rejected again after it is said, so the tile stays armed for a retry.\n return settle(onSignOutEverywhere).catch((error: unknown) => {\n if (mounted.current) setFailure(describe(error, \"sign-out-everywhere\"));\n throw error;\n });\n };\n\n const revoke = (id: Id) => {\n if (!onRevoke || busyId !== null) return;\n setBusyId(id);\n setFailure(null);\n settle(() => onRevoke(id)).then(\n () => {\n if (mounted.current) setBusyId(null);\n },\n (error: unknown) => {\n if (!mounted.current) return;\n setBusyId(null);\n setFailure(describe(error, \"revoke\"));\n },\n );\n };\n\n const showList = sessions !== undefined || loading;\n\n return (\n <Card {...rest} className={cn(\"p-4 space-y-3\", className)}>\n <div>\n <SettingsCardTitle>{labels.title}</SettingsCardTitle>\n <div className={CARD_DESCRIPTION_CLASS}>{labels.description}</div>\n </div>\n {showList &&\n (loading || sessions === undefined ? (\n <Skeleton lines={2} label={labels.loading} />\n ) : sessions.length === 0 ? (\n <p className={CARD_DESCRIPTION_CLASS}>{labels.empty}</p>\n ) : (\n <ul aria-label={labels.list} className=\"divide-y divide-[var(--border)]\">\n {sessions.map((session) => {\n const device = session.device?.trim() || labels.unknownDevice;\n const when = lastActive(session.lastActiveAt);\n const ip = session.ip?.trim();\n return (\n <li\n key={session.id}\n data-session-id={String(session.id)}\n data-current={session.current || undefined}\n className=\"flex items-center gap-3 py-2\"\n >\n <MonitorSmartphone aria-hidden className=\"size-4 shrink-0 text-[var(--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\">{device}</span>\n {session.current && (\n <Chip size=\"sm\" tone=\"brand\">\n {labels.current}\n </Chip>\n )}\n </div>\n {(when || ip) && (\n <div className={CARD_DESCRIPTION_CLASS}>\n {when && labels.lastActive(when)}\n {when && ip && \" · \"}\n {/* An address reads left to right in any page direction. */}\n {ip && <span dir=\"ltr\">{labels.ip(ip)}</span>}\n </div>\n )}\n </div>\n {onRevoke && !session.current && (\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"ghost\"\n commit={COMMIT_EXCEPT_BILLING}\n pending={busyId === session.id}\n disabled={busyId !== null && busyId !== session.id}\n aria-label={labels.revokeItem(device)}\n onClick={() => revoke(session.id)}\n >\n {labels.revoke}\n </Button>\n )}\n </li>\n );\n })}\n </ul>\n ))}\n <DangerConfirm\n tone=\"warning\"\n commit={COMMIT_EXCEPT_BILLING}\n armLabel={labels.signOutEverywhere}\n prompt={labels.signOutEverywherePrompt}\n confirmLabel={labels.confirmSignOutEverywhere}\n onConfirm={signOutEverywhere}\n />\n {hasMessage(failure) && (\n <AlertBanner tone=\"danger\" size=\"sm\" role=\"alert\">\n {failure}\n </AlertBanner>\n )}\n </Card>\n );\n}\n"],"mappings":";AAqNM,SACE,KADF;AArNN,SAAS,gBAAgB;AAEzB,SAAS,yBAAyB;AAElC,SAAS,cAAc,oBAAoB;AAC3C,SAAS,UAAU;AACnB,SAAS,oBAAoB,cAAc;AAE3C,SAAS,mBAAmB;AAC5B,SAAS,YAAY;AACrB,SAAS,kBAAkB;AAC3B,SAAS,qBAAqB;AAC9B,SAAS,gBAAgB;AACzB,SAAS,QAAQ,YAAY;AAC7B,SAAS,wBAAwB,QAAQ,kBAAkB;AAC3D,SAAS,yBAAyB;AAClC,SAAS,6BAA6B;AAyC/B,MAAM,0BAA0C;AAAA,EACrD,OAAO;AAAA,EACP,aAAa;AAAA,EACb,mBAAmB;AAAA,EACnB,yBACE;AAAA,EACF,0BAA0B;AAAA,EAC1B,MAAM;AAAA,EACN,SAAS;AAAA,EACT,OAAO;AAAA,EACP,SAAS;AAAA,EACT,eAAe;AAAA,EACf,YAAY,CAAC,SAAS,eAAe,IAAI;AAAA,EACzC,IAAI,CAAC,YAAY,MAAM,OAAO;AAAA,EAC9B,QAAQ;AAAA,EACR,YAAY,CAAC,WAAW,YAAY,MAAM;AAAA,EAC1C,QAAQ;AACV;AA+EO,SAAS,gBAAkD;AAAA,EAChE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR;AAAA,EACA,GAAG;AACL,GAA6B;AAC3B,QAAM,SAAS,aAAa,YAAY,yBAAyB,UAAU;AAC3E,QAAM,SAAS,aAAa,UAAU;AACtC,QAAM,CAAC,QAAQ,SAAS,IAAI,SAAoB,IAAI;AACpD,QAAM,CAAC,SAAS,UAAU,IAAI,SAAoB,IAAI;AACtD,QAAM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