@eifi1/ui-kit 0.32.2 → 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/phone-input.d.ts +10 -10
- package/dist/components/row-actions.d.ts +5 -5
- package/dist/components/row-actions.js +130 -32
- 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 +47 -27
- 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-Dy4kJgUm.d.ts → delete-account-setting-DiPX4Vue.d.ts} +355 -41
- 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/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/row-actions.tsx +208 -58
- 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 +92 -43
- 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/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
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import { fJ as UiKitLabels } from '../delete-account-setting-DiPX4Vue.js';
|
|
2
|
+
import 'react';
|
|
3
|
+
import '../components/tooltip.js';
|
|
4
|
+
import '../hooks/use-anchored-rect.js';
|
|
5
|
+
import '../lib/clipping.js';
|
|
6
|
+
import '../data-table-labels-BJ5JE_X2.js';
|
|
7
|
+
import '../components/data-table-sort.js';
|
|
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';
|
|
17
|
+
import '../components/mini-calendar.js';
|
|
18
|
+
import '../components/calendar-heatmap.js';
|
|
19
|
+
import '../components/popover.js';
|
|
20
|
+
import '../hooks/use-breakpoint.js';
|
|
21
|
+
import '../components/field-sync.js';
|
|
22
|
+
import '../wizard/types.js';
|
|
23
|
+
import '../tour/tour.js';
|
|
24
|
+
import '../search/command-palette.js';
|
|
25
|
+
import '../search/global-search.js';
|
|
26
|
+
import '../search/search-index.js';
|
|
27
|
+
import '../components/month-picker.js';
|
|
28
|
+
import '../components/page-contents.js';
|
|
29
|
+
import '../components/series-chart-labels.js';
|
|
30
|
+
import '../components/pie-chart-labels.js';
|
|
31
|
+
import '../components/sparkline.js';
|
|
32
|
+
import '../components/signature-pad.js';
|
|
33
|
+
import '../components/password-strength.js';
|
|
34
|
+
import '../components/swatch-picker.js';
|
|
35
|
+
import '../components/tile-radio.js';
|
|
36
|
+
import '../components/icon-picker.js';
|
|
37
|
+
import '../components/dialog-frame.js';
|
|
38
|
+
import '../components/modal.js';
|
|
39
|
+
import '../hooks/use-search-param-state.js';
|
|
40
|
+
import '../components/measured-grid.js';
|
|
41
|
+
import '../components/user-avatar.js';
|
|
42
|
+
import '../lib/person-name.js';
|
|
43
|
+
import '../shell/topbar-action-menu.js';
|
|
44
|
+
import '../components/menu-item.js';
|
|
45
|
+
import '../components/floating-panel.js';
|
|
46
|
+
import '../hooks/use-authed-src.js';
|
|
47
|
+
import '../components/account-settings-labels.js';
|
|
48
|
+
import '../components/bulk-action-bar.js';
|
|
49
|
+
import '../components/list.js';
|
|
50
|
+
import '../components/breadcrumbs.js';
|
|
51
|
+
import '../components/toast.js';
|
|
52
|
+
import '../components/description-list.js';
|
|
53
|
+
import '../components/line-items.js';
|
|
54
|
+
import '../components/error-boundary.js';
|
|
55
|
+
import '../components/authed-image.js';
|
|
56
|
+
import '../components/image-grid.js';
|
|
57
|
+
import '../components/lightbox.js';
|
|
58
|
+
import '../auth/sign-in-form.js';
|
|
59
|
+
import '../landing/access.js';
|
|
60
|
+
import '../landing/landing-labels.js';
|
|
61
|
+
import '../shell/topbar-controls.js';
|
|
62
|
+
import '../theme/palette-presets.js';
|
|
63
|
+
import '../theme/chart-palette.js';
|
|
64
|
+
import '../theme/theme-store.js';
|
|
65
|
+
import 'zustand/middleware';
|
|
66
|
+
import 'zustand';
|
|
67
|
+
import '../auth/complete-name-dialog.js';
|
|
68
|
+
import '../auth/forgot-password-form.js';
|
|
69
|
+
import '../auth/status-parts.js';
|
|
70
|
+
import '../auth/reset-password-form.js';
|
|
71
|
+
import '../auth/verify-email.js';
|
|
72
|
+
import '../auth/not-found-page.js';
|
|
73
|
+
import '../auth/accept-invitation.js';
|
|
74
|
+
import '../shell/company-switcher.js';
|
|
75
|
+
import '../account/email-change-setting.js';
|
|
76
|
+
import '../account/sessions-setting.js';
|
|
77
|
+
import '../lib/format.js';
|
|
78
|
+
import '../account/data-export-setting.js';
|
|
79
|
+
import '../components/account-chips.js';
|
|
80
|
+
import '../admin/admin-parts.js';
|
|
81
|
+
import '../admin/admin-action-log.js';
|
|
82
|
+
import '../settings/settings-labels.js';
|
|
83
|
+
import '../demo/demo-labels.js';
|
|
84
|
+
import '../components/appearance-labels.js';
|
|
85
|
+
import '../theme/contrast.js';
|
|
86
|
+
import '../theme/text-size.js';
|
|
87
|
+
import '../components/reauth-dialog.js';
|
|
88
|
+
import '../components/server-wake.js';
|
|
89
|
+
import '../lib/server-wake.js';
|
|
90
|
+
import '../components/translation-review-labels.js';
|
|
91
|
+
import '../lib/translation-review.js';
|
|
92
|
+
import '../components/country-select.js';
|
|
93
|
+
import '../components/inline-edit-field.js';
|
|
94
|
+
import '../lib/iban.js';
|
|
95
|
+
import '../lib/phone.js';
|
|
96
|
+
import '../components/sign-chip.js';
|
|
97
|
+
import '../components/column-mapper.js';
|
|
98
|
+
import '../lib/column-mapping.js';
|
|
99
|
+
import '../lib/table-text.js';
|
|
100
|
+
import '../components/focus-ring.js';
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* The kit's pay page (docs/billing-harmonization.md §14.4, decision 19 as amended): a
|
|
104
|
+
* standalone static page that ui-kit ships as `dist/pay/`, and that each app serves on
|
|
105
|
+
* its own pay host, `pay.<app domain>` — a separate origin, approved in Paddle, where
|
|
106
|
+
* Paddle.js shares the origin with nothing: no sign-in, no app code, no storage.
|
|
107
|
+
*
|
|
108
|
+
* Paddle's create-transaction answers `checkout.url`: the pay page's URL plus
|
|
109
|
+
* `?_ptxn=<txn>`, and Paddle.js on that page opens the transaction by itself. The app
|
|
110
|
+
* sends the buyer there with {@link payPageUrl}, which adds the buyer's language; the
|
|
111
|
+
* page maps it to Paddle's checkout locale ({@link paddleLocale}). Everything else the
|
|
112
|
+
* page needs — the client-side token, sandbox or live, the way back — is the app's
|
|
113
|
+
* `pay-config.json`, written at its web build by the `eifi1-pay-page` script.
|
|
114
|
+
*
|
|
115
|
+
* Pure, and React-free: the page's own script (`pay-page/pay.ts`) and that build script
|
|
116
|
+
* bundle this module. The exports below the barrel's four are theirs.
|
|
117
|
+
*/
|
|
118
|
+
/** Paddle's two environments: the sandbox's client-side tokens start `test_`, live
|
|
119
|
+
* ones `live_`. */
|
|
120
|
+
type PaddleEnvironment = "sandbox" | "live";
|
|
121
|
+
/** The pay page's language parameter: `?lang=<kit locale>`. */
|
|
122
|
+
declare const PAY_PAGE_LANG_PARAM = "lang";
|
|
123
|
+
/** The kit's seven languages (`KitLanguageCode`), as the page reads them. */
|
|
124
|
+
declare const PAY_PAGE_LANGUAGES: readonly ["de-CH", "en", "es", "fr", "it", "hu", "zh"];
|
|
125
|
+
/** One of the kit's languages, as the page speaks it. */
|
|
126
|
+
type PayPageLanguage = (typeof PAY_PAGE_LANGUAGES)[number];
|
|
127
|
+
/** Paddle's transaction parameter on a pay page link. @internal */
|
|
128
|
+
declare const PAY_PAGE_TRANSACTION_PARAM = "_ptxn";
|
|
129
|
+
/**
|
|
130
|
+
* The kit's locale → Paddle's checkout locale: `de-CH` → `de`, `zh` → `zh-Hans`, `hu` →
|
|
131
|
+
* `en` (Paddle has no Hungarian), the others as they are. Any tag is read as the kit
|
|
132
|
+
* reads it (`de-AT` is the one German, `zh-TW` the one Chinese); one the kit doesn't
|
|
133
|
+
* ship is English.
|
|
134
|
+
*/
|
|
135
|
+
declare function paddleLocale(kitLocale: string): string;
|
|
136
|
+
/**
|
|
137
|
+
* The checkout's `{url}` with the buyer's language: `lang=<kit locale>` on a pay page
|
|
138
|
+
* link (one that carries `_ptxn`); any other URL — a hosted checkout's, which takes its
|
|
139
|
+
* own `locale` — unchanged, as is a locale the kit doesn't ship.
|
|
140
|
+
*
|
|
141
|
+
* const { url } = await api.checkout({ plan, interval, currency });
|
|
142
|
+
* noteCheckoutStarted(user.id, overview);
|
|
143
|
+
* window.location.assign(payPageUrl(url, i18n.language));
|
|
144
|
+
*
|
|
145
|
+
* A wrong `lang` costs nothing but the language: the page falls back to the browser's.
|
|
146
|
+
*/
|
|
147
|
+
declare function payPageUrl(checkoutUrl: string, locale: string): string;
|
|
148
|
+
/**
|
|
149
|
+
* The language the page speaks: its `lang` parameter, else the browser's languages in
|
|
150
|
+
* their order, each matched to the kit's; else English. @internal
|
|
151
|
+
*/
|
|
152
|
+
declare function payPageLanguage(lang: string | null | undefined, browserLanguages?: readonly string[]): PayPageLanguage;
|
|
153
|
+
/**
|
|
154
|
+
* The page's words in one language — built into `pay.js` at the kit's build from the
|
|
155
|
+
* seven catalogues, since the page has no React and no provider. @internal
|
|
156
|
+
*/
|
|
157
|
+
interface PayPageStrings {
|
|
158
|
+
/** `billing.payOpening`, while the checkout opens. */
|
|
159
|
+
opening: string;
|
|
160
|
+
/** `billing.payNothing`: no `_ptxn`, or no token (billing off). */
|
|
161
|
+
nothing: string;
|
|
162
|
+
/** `billing.payFailed`: Paddle.js didn't load, or the configuration is wrong. */
|
|
163
|
+
failed: string;
|
|
164
|
+
/** `billing.payBack`: the buyer closed the checkout. */
|
|
165
|
+
closed: string;
|
|
166
|
+
/** `common.back`: the link to the app's subscription page. */
|
|
167
|
+
back: string;
|
|
168
|
+
/** `legal.links.terms` and `legal.links.privacy`: the footer's links. */
|
|
169
|
+
terms: string;
|
|
170
|
+
privacy: string;
|
|
171
|
+
/** `legal.navLabel`: the footer's `<nav>`. */
|
|
172
|
+
legal: string;
|
|
173
|
+
}
|
|
174
|
+
/** The page's words, read from one of the kit's catalogues. @internal */
|
|
175
|
+
declare function payPageStrings(labels: UiKitLabels): PayPageStrings;
|
|
176
|
+
/** The configuration file beside the page, written at each app's web build. @internal */
|
|
177
|
+
declare const PAY_CONFIG_FILE = "pay-config.json";
|
|
178
|
+
/**
|
|
179
|
+
* `pay-config.json`: what the page needs that differs per app and deployment. Read by
|
|
180
|
+
* the page from its own origin — never from the query, where Paddle's own links (it
|
|
181
|
+
* puts only `_ptxn` there) would lack it and a return URL would be an open redirect on
|
|
182
|
+
* an approved payment domain. @internal
|
|
183
|
+
*/
|
|
184
|
+
interface PayPageConfig {
|
|
185
|
+
/** Paddle's client-side token (`test_…` for the sandbox, `live_…` for live); null
|
|
186
|
+
* while billing is off, and the page says `payNothing`. */
|
|
187
|
+
token: string | null;
|
|
188
|
+
environment: PaddleEnvironment | null;
|
|
189
|
+
/** The app's subscription page. Paddle.js's `successUrl` is
|
|
190
|
+
* `checkoutReturnUrl(returnUrl)`; "Back" goes here. */
|
|
191
|
+
returnUrl: string;
|
|
192
|
+
appName: string;
|
|
193
|
+
termsUrl: string;
|
|
194
|
+
privacyUrl: string;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* What is wrong with a `pay-config.json`, one line each — `[]` when nothing is. The
|
|
198
|
+
* build script refuses to write a file with any (so a wrong pairing fails the build,
|
|
199
|
+
* not a buyer), and the page says `payFailed` for one it reads:
|
|
200
|
+
*
|
|
201
|
+
* - a token whose prefix disagrees with the environment (`test_` ↔ sandbox, `live_` ↔
|
|
202
|
+
* live), or a token without an environment;
|
|
203
|
+
* - a return, terms or privacy URL that isn't `https://` (`http://` for localhost only);
|
|
204
|
+
* - no app name. @internal
|
|
205
|
+
*/
|
|
206
|
+
declare function payPageConfigProblems(config: unknown): string[];
|
|
207
|
+
/** Paddle.js's `successUrl` for a configuration: the way back, `?checkout=done`. @internal */
|
|
208
|
+
declare function paySuccessUrl(config: Pick<PayPageConfig, "returnUrl">): string;
|
|
209
|
+
|
|
210
|
+
export { PAY_CONFIG_FILE, PAY_PAGE_LANG_PARAM, PAY_PAGE_TRANSACTION_PARAM, type PaddleEnvironment, type PayPageConfig, type PayPageLanguage, type PayPageStrings, paddleLocale, payPageConfigProblems, payPageLanguage, payPageStrings, payPageUrl, paySuccessUrl };
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { checkoutReturnUrl } from "./checkout-return.js";
|
|
3
|
+
const PAY_PAGE_LANG_PARAM = "lang";
|
|
4
|
+
const PAY_PAGE_LANGUAGES = ["de-CH", "en", "es", "fr", "it", "hu", "zh"];
|
|
5
|
+
const PADDLE_LOCALES = {
|
|
6
|
+
en: "en",
|
|
7
|
+
"de-CH": "de",
|
|
8
|
+
fr: "fr",
|
|
9
|
+
it: "it",
|
|
10
|
+
es: "es",
|
|
11
|
+
zh: "zh-Hans",
|
|
12
|
+
hu: "en"
|
|
13
|
+
};
|
|
14
|
+
const PAY_PAGE_TRANSACTION_PARAM = "_ptxn";
|
|
15
|
+
function kitLanguageOf(tag) {
|
|
16
|
+
if (typeof tag !== "string") return void 0;
|
|
17
|
+
const clean = tag.trim().replace(/_/g, "-");
|
|
18
|
+
if (!clean) return void 0;
|
|
19
|
+
const lower = clean.toLowerCase();
|
|
20
|
+
const exact = PAY_PAGE_LANGUAGES.find((code) => code.toLowerCase() === lower);
|
|
21
|
+
if (exact) return exact;
|
|
22
|
+
const language = lower.split("-")[0];
|
|
23
|
+
return PAY_PAGE_LANGUAGES.find((code) => code.split("-")[0].toLowerCase() === language);
|
|
24
|
+
}
|
|
25
|
+
function paddleLocale(kitLocale) {
|
|
26
|
+
return PADDLE_LOCALES[kitLanguageOf(kitLocale) ?? "en"];
|
|
27
|
+
}
|
|
28
|
+
function payPageUrl(checkoutUrl, locale) {
|
|
29
|
+
const language = kitLanguageOf(locale);
|
|
30
|
+
if (!language) return checkoutUrl;
|
|
31
|
+
let url;
|
|
32
|
+
try {
|
|
33
|
+
url = new URL(checkoutUrl);
|
|
34
|
+
} catch {
|
|
35
|
+
return checkoutUrl;
|
|
36
|
+
}
|
|
37
|
+
if (!url.searchParams.has(PAY_PAGE_TRANSACTION_PARAM)) return checkoutUrl;
|
|
38
|
+
url.searchParams.set(PAY_PAGE_LANG_PARAM, language);
|
|
39
|
+
return url.toString();
|
|
40
|
+
}
|
|
41
|
+
function payPageLanguage(lang, browserLanguages = []) {
|
|
42
|
+
for (const candidate of [lang, ...browserLanguages]) {
|
|
43
|
+
const found = kitLanguageOf(candidate);
|
|
44
|
+
if (found) return found;
|
|
45
|
+
}
|
|
46
|
+
return "en";
|
|
47
|
+
}
|
|
48
|
+
function payPageStrings(labels) {
|
|
49
|
+
return {
|
|
50
|
+
opening: labels.billing.payOpening,
|
|
51
|
+
nothing: labels.billing.payNothing,
|
|
52
|
+
failed: labels.billing.payFailed,
|
|
53
|
+
closed: labels.billing.payBack,
|
|
54
|
+
back: labels.common.back,
|
|
55
|
+
terms: labels.legal.links.terms,
|
|
56
|
+
privacy: labels.legal.links.privacy,
|
|
57
|
+
legal: labels.legal.navLabel
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
const PAY_CONFIG_FILE = "pay-config.json";
|
|
61
|
+
const TOKEN_PREFIX = { sandbox: "test_", live: "live_" };
|
|
62
|
+
function isPageUrl(value) {
|
|
63
|
+
if (typeof value !== "string") return false;
|
|
64
|
+
let url;
|
|
65
|
+
try {
|
|
66
|
+
url = new URL(value);
|
|
67
|
+
} catch {
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
if (url.protocol === "https:") return true;
|
|
71
|
+
return url.protocol === "http:" && ["localhost", "127.0.0.1", "[::1]"].includes(url.hostname);
|
|
72
|
+
}
|
|
73
|
+
function payPageConfigProblems(config) {
|
|
74
|
+
if (typeof config !== "object" || config === null) return ["the configuration is not an object"];
|
|
75
|
+
const c = config;
|
|
76
|
+
const problems = [];
|
|
77
|
+
const { token, environment } = c;
|
|
78
|
+
if (environment !== null && environment !== void 0 && environment !== "sandbox" && environment !== "live") {
|
|
79
|
+
problems.push(`environment must be "sandbox" or "live", not ${JSON.stringify(environment)}`);
|
|
80
|
+
}
|
|
81
|
+
if (token !== null && token !== void 0) {
|
|
82
|
+
if (typeof token !== "string" || token === "") {
|
|
83
|
+
problems.push("token must be Paddle's client-side token, or null while billing is off");
|
|
84
|
+
} else if (environment !== "sandbox" && environment !== "live") {
|
|
85
|
+
problems.push("a token needs its environment: sandbox or live");
|
|
86
|
+
} else if (!token.startsWith(TOKEN_PREFIX[environment]) || token.length === TOKEN_PREFIX[environment].length) {
|
|
87
|
+
const other = environment === "sandbox" ? "live" : "sandbox";
|
|
88
|
+
problems.push(
|
|
89
|
+
token.startsWith(TOKEN_PREFIX[other]) ? `the token is a ${other} token (${TOKEN_PREFIX[other]}\u2026), but the environment is ${environment}` : `a ${environment} token starts with ${TOKEN_PREFIX[environment]}`
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
for (const key of ["returnUrl", "termsUrl", "privacyUrl"]) {
|
|
94
|
+
if (!isPageUrl(c[key])) problems.push(`${key} must be an https:// URL (http:// for localhost only)`);
|
|
95
|
+
}
|
|
96
|
+
if (typeof c.appName !== "string" || c.appName.trim() === "") problems.push("appName is missing");
|
|
97
|
+
return problems;
|
|
98
|
+
}
|
|
99
|
+
function paySuccessUrl(config) {
|
|
100
|
+
return checkoutReturnUrl(config.returnUrl);
|
|
101
|
+
}
|
|
102
|
+
export {
|
|
103
|
+
PAY_CONFIG_FILE,
|
|
104
|
+
PAY_PAGE_LANG_PARAM,
|
|
105
|
+
PAY_PAGE_TRANSACTION_PARAM,
|
|
106
|
+
paddleLocale,
|
|
107
|
+
payPageConfigProblems,
|
|
108
|
+
payPageLanguage,
|
|
109
|
+
payPageStrings,
|
|
110
|
+
payPageUrl,
|
|
111
|
+
paySuccessUrl
|
|
112
|
+
};
|
|
113
|
+
//# sourceMappingURL=pay-page.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/billing/pay-page.ts"],"sourcesContent":["import type { UiKitLabels } from \"../i18n/kit-labels\";\nimport { checkoutReturnUrl } from \"./checkout-return\";\n\n/**\n * The kit's pay page (docs/billing-harmonization.md §14.4, decision 19 as amended): a\n * standalone static page that ui-kit ships as `dist/pay/`, and that each app serves on\n * its own pay host, `pay.<app domain>` — a separate origin, approved in Paddle, where\n * Paddle.js shares the origin with nothing: no sign-in, no app code, no storage.\n *\n * Paddle's create-transaction answers `checkout.url`: the pay page's URL plus\n * `?_ptxn=<txn>`, and Paddle.js on that page opens the transaction by itself. The app\n * sends the buyer there with {@link payPageUrl}, which adds the buyer's language; the\n * page maps it to Paddle's checkout locale ({@link paddleLocale}). Everything else the\n * page needs — the client-side token, sandbox or live, the way back — is the app's\n * `pay-config.json`, written at its web build by the `eifi1-pay-page` script.\n *\n * Pure, and React-free: the page's own script (`pay-page/pay.ts`) and that build script\n * bundle this module. The exports below the barrel's four are theirs.\n */\n\n/** Paddle's two environments: the sandbox's client-side tokens start `test_`, live\n * ones `live_`. */\nexport type PaddleEnvironment = \"sandbox\" | \"live\";\n\n/** The pay page's language parameter: `?lang=<kit locale>`. */\nexport const PAY_PAGE_LANG_PARAM = \"lang\";\n\n/** The kit's seven languages (`KitLanguageCode`), as the page reads them. */\nconst PAY_PAGE_LANGUAGES = [\"de-CH\", \"en\", \"es\", \"fr\", \"it\", \"hu\", \"zh\"] as const;\n\n/** One of the kit's languages, as the page speaks it. */\nexport type PayPageLanguage = (typeof PAY_PAGE_LANGUAGES)[number];\n\n/**\n * The kit's language → Paddle's checkout locale (`Paddle.Checkout.open`,\n * `settings.locale`, read 2026-10-09: ar, zh-Hans, zh-TW, da, nl, en, fr, de, it, ja, ko,\n * no, pl, pt, pt-BR, tr, ru, es, sv). Paddle has no Hungarian: a Hungarian buyer gets\n * English always, not Paddle's guess from the browser. The page's own lines stay in the\n * kit's language, Hungarian included.\n */\nconst PADDLE_LOCALES: Readonly<Record<PayPageLanguage, string>> = {\n en: \"en\",\n \"de-CH\": \"de\",\n fr: \"fr\",\n it: \"it\",\n es: \"es\",\n zh: \"zh-Hans\",\n hu: \"en\",\n};\n\n/** Paddle's transaction parameter on a pay page link. @internal */\nexport const PAY_PAGE_TRANSACTION_PARAM = \"_ptxn\";\n\n/**\n * The kit language one tag names, or undefined — `resolveLanguage`'s rule\n * (src/i18n/languages.ts), restated here because that module loads the seven catalogues\n * and the page must stay a few kilobytes: exact first, ignoring case and reading `_` as\n * `-`; then by language, so every German is `de-CH`, every Chinese `zh` (Simplified),\n * and any regional form its base (`fr-CA` → `fr`).\n */\nfunction kitLanguageOf(tag: unknown): PayPageLanguage | undefined {\n if (typeof tag !== \"string\") return undefined;\n const clean = tag.trim().replace(/_/g, \"-\");\n if (!clean) return undefined;\n const lower = clean.toLowerCase();\n const exact = PAY_PAGE_LANGUAGES.find((code) => code.toLowerCase() === lower);\n if (exact) return exact;\n const language = lower.split(\"-\")[0];\n return PAY_PAGE_LANGUAGES.find((code) => code.split(\"-\")[0].toLowerCase() === language);\n}\n\n/**\n * The kit's locale → Paddle's checkout locale: `de-CH` → `de`, `zh` → `zh-Hans`, `hu` →\n * `en` (Paddle has no Hungarian), the others as they are. Any tag is read as the kit\n * reads it (`de-AT` is the one German, `zh-TW` the one Chinese); one the kit doesn't\n * ship is English.\n */\nexport function paddleLocale(kitLocale: string): string {\n return PADDLE_LOCALES[kitLanguageOf(kitLocale) ?? \"en\"];\n}\n\n/**\n * The checkout's `{url}` with the buyer's language: `lang=<kit locale>` on a pay page\n * link (one that carries `_ptxn`); any other URL — a hosted checkout's, which takes its\n * own `locale` — unchanged, as is a locale the kit doesn't ship.\n *\n * const { url } = await api.checkout({ plan, interval, currency });\n * noteCheckoutStarted(user.id, overview);\n * window.location.assign(payPageUrl(url, i18n.language));\n *\n * A wrong `lang` costs nothing but the language: the page falls back to the browser's.\n */\nexport function payPageUrl(checkoutUrl: string, locale: string): string {\n const language = kitLanguageOf(locale);\n if (!language) return checkoutUrl;\n let url: URL;\n try {\n url = new URL(checkoutUrl);\n } catch {\n return checkoutUrl;\n }\n if (!url.searchParams.has(PAY_PAGE_TRANSACTION_PARAM)) return checkoutUrl;\n url.searchParams.set(PAY_PAGE_LANG_PARAM, language);\n return url.toString();\n}\n\n/**\n * The language the page speaks: its `lang` parameter, else the browser's languages in\n * their order, each matched to the kit's; else English. @internal\n */\nexport function payPageLanguage(\n lang: string | null | undefined,\n browserLanguages: readonly string[] = [],\n): PayPageLanguage {\n for (const candidate of [lang, ...browserLanguages]) {\n const found = kitLanguageOf(candidate);\n if (found) return found;\n }\n return \"en\";\n}\n\n/* ── The page's words ──────────────────────────────────────────────────────── */\n\n/**\n * The page's words in one language — built into `pay.js` at the kit's build from the\n * seven catalogues, since the page has no React and no provider. @internal\n */\nexport interface PayPageStrings {\n /** `billing.payOpening`, while the checkout opens. */\n opening: string;\n /** `billing.payNothing`: no `_ptxn`, or no token (billing off). */\n nothing: string;\n /** `billing.payFailed`: Paddle.js didn't load, or the configuration is wrong. */\n failed: string;\n /** `billing.payBack`: the buyer closed the checkout. */\n closed: string;\n /** `common.back`: the link to the app's subscription page. */\n back: string;\n /** `legal.links.terms` and `legal.links.privacy`: the footer's links. */\n terms: string;\n privacy: string;\n /** `legal.navLabel`: the footer's `<nav>`. */\n legal: string;\n}\n\n/** The page's words, read from one of the kit's catalogues. @internal */\nexport function payPageStrings(labels: UiKitLabels): PayPageStrings {\n return {\n opening: labels.billing.payOpening,\n nothing: labels.billing.payNothing,\n failed: labels.billing.payFailed,\n closed: labels.billing.payBack,\n back: labels.common.back,\n terms: labels.legal.links.terms,\n privacy: labels.legal.links.privacy,\n legal: labels.legal.navLabel,\n };\n}\n\n/* ── pay-config.json ───────────────────────────────────────────────────────── */\n\n/** The configuration file beside the page, written at each app's web build. @internal */\nexport const PAY_CONFIG_FILE = \"pay-config.json\";\n\n/**\n * `pay-config.json`: what the page needs that differs per app and deployment. Read by\n * the page from its own origin — never from the query, where Paddle's own links (it\n * puts only `_ptxn` there) would lack it and a return URL would be an open redirect on\n * an approved payment domain. @internal\n */\nexport interface PayPageConfig {\n /** Paddle's client-side token (`test_…` for the sandbox, `live_…` for live); null\n * while billing is off, and the page says `payNothing`. */\n token: string | null;\n environment: PaddleEnvironment | null;\n /** The app's subscription page. Paddle.js's `successUrl` is\n * `checkoutReturnUrl(returnUrl)`; \"Back\" goes here. */\n returnUrl: string;\n appName: string;\n termsUrl: string;\n privacyUrl: string;\n}\n\n/** Paddle's client-side token prefixes, per environment. */\nconst TOKEN_PREFIX: Readonly<Record<PaddleEnvironment, string>> = { sandbox: \"test_\", live: \"live_\" };\n\n/** `https://`, or `http://` on this machine only (`localhost`, `127.0.0.1`, `[::1]`). */\nfunction isPageUrl(value: unknown): boolean {\n if (typeof value !== \"string\") return false;\n let url: URL;\n try {\n url = new URL(value);\n } catch {\n return false;\n }\n if (url.protocol === \"https:\") return true;\n return url.protocol === \"http:\" && [\"localhost\", \"127.0.0.1\", \"[::1]\"].includes(url.hostname);\n}\n\n/**\n * What is wrong with a `pay-config.json`, one line each — `[]` when nothing is. The\n * build script refuses to write a file with any (so a wrong pairing fails the build,\n * not a buyer), and the page says `payFailed` for one it reads:\n *\n * - a token whose prefix disagrees with the environment (`test_` ↔ sandbox, `live_` ↔\n * live), or a token without an environment;\n * - a return, terms or privacy URL that isn't `https://` (`http://` for localhost only);\n * - no app name. @internal\n */\nexport function payPageConfigProblems(config: unknown): string[] {\n if (typeof config !== \"object\" || config === null) return [\"the configuration is not an object\"];\n const c = config as Record<string, unknown>;\n const problems: string[] = [];\n const { token, environment } = c;\n if (environment !== null && environment !== undefined && environment !== \"sandbox\" && environment !== \"live\") {\n problems.push(`environment must be \"sandbox\" or \"live\", not ${JSON.stringify(environment)}`);\n }\n if (token !== null && token !== undefined) {\n if (typeof token !== \"string\" || token === \"\") {\n problems.push(\"token must be Paddle's client-side token, or null while billing is off\");\n } else if (environment !== \"sandbox\" && environment !== \"live\") {\n problems.push(\"a token needs its environment: sandbox or live\");\n } else if (!token.startsWith(TOKEN_PREFIX[environment]) || token.length === TOKEN_PREFIX[environment].length) {\n const other = environment === \"sandbox\" ? \"live\" : \"sandbox\";\n problems.push(\n token.startsWith(TOKEN_PREFIX[other])\n ? `the token is a ${other} token (${TOKEN_PREFIX[other]}…), but the environment is ${environment}`\n : `a ${environment} token starts with ${TOKEN_PREFIX[environment]}`,\n );\n }\n }\n for (const key of [\"returnUrl\", \"termsUrl\", \"privacyUrl\"] as const) {\n if (!isPageUrl(c[key])) problems.push(`${key} must be an https:// URL (http:// for localhost only)`);\n }\n if (typeof c.appName !== \"string\" || c.appName.trim() === \"\") problems.push(\"appName is missing\");\n return problems;\n}\n\n/** Paddle.js's `successUrl` for a configuration: the way back, `?checkout=done`. @internal */\nexport function paySuccessUrl(config: Pick<PayPageConfig, \"returnUrl\">): string {\n return checkoutReturnUrl(config.returnUrl);\n}\n"],"mappings":"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","names":[]}
|
|
@@ -1,21 +1,26 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { e5 as LabelOverride, bH as BillingLabels } from '../delete-account-setting-DiPX4Vue.js';
|
|
4
4
|
import { ChoiceCardProps } from '../components/choice-card.js';
|
|
5
5
|
import { PlanPrices, BillingCurrency, BillingInterval } from './plan-price.js';
|
|
6
6
|
import '../components/tooltip.js';
|
|
7
7
|
import '../hooks/use-anchored-rect.js';
|
|
8
8
|
import '../lib/clipping.js';
|
|
9
|
-
import '../data-table-labels-
|
|
9
|
+
import '../data-table-labels-BJ5JE_X2.js';
|
|
10
10
|
import '../components/data-table-sort.js';
|
|
11
11
|
import '../components/swipeable-row.js';
|
|
12
|
+
import '../components/status-dot.js';
|
|
13
|
+
import '../components/progress-bar.js';
|
|
14
|
+
import '../components/signed-amount.js';
|
|
15
|
+
import '../components/stat-tile.js';
|
|
16
|
+
import '../components/chip.js';
|
|
17
|
+
import 'lucide-react';
|
|
18
|
+
import '../components/field-parts.js';
|
|
19
|
+
import '../components/write-lock.js';
|
|
12
20
|
import '../components/mini-calendar.js';
|
|
13
21
|
import '../components/calendar-heatmap.js';
|
|
14
22
|
import '../components/popover.js';
|
|
15
23
|
import '../hooks/use-breakpoint.js';
|
|
16
|
-
import '../components/chip.js';
|
|
17
|
-
import 'lucide-react';
|
|
18
|
-
import '../components/field-parts.js';
|
|
19
24
|
import '../components/field-sync.js';
|
|
20
25
|
import '../wizard/types.js';
|
|
21
26
|
import '../tour/tour.js';
|
|
@@ -27,7 +32,6 @@ import '../components/page-contents.js';
|
|
|
27
32
|
import '../components/series-chart-labels.js';
|
|
28
33
|
import '../components/pie-chart-labels.js';
|
|
29
34
|
import '../components/sparkline.js';
|
|
30
|
-
import '../components/stat-tile.js';
|
|
31
35
|
import '../components/signature-pad.js';
|
|
32
36
|
import '../components/password-strength.js';
|
|
33
37
|
import '../components/swatch-picker.js';
|
|
@@ -39,9 +43,6 @@ import '../hooks/use-search-param-state.js';
|
|
|
39
43
|
import '../components/measured-grid.js';
|
|
40
44
|
import '../components/user-avatar.js';
|
|
41
45
|
import '../lib/person-name.js';
|
|
42
|
-
import '../components/status-dot.js';
|
|
43
|
-
import '../components/progress-bar.js';
|
|
44
|
-
import '../components/signed-amount.js';
|
|
45
46
|
import '../shell/topbar-action-menu.js';
|
|
46
47
|
import '../components/menu-item.js';
|
|
47
48
|
import '../components/floating-panel.js';
|
|
@@ -57,7 +58,6 @@ import '../components/error-boundary.js';
|
|
|
57
58
|
import '../components/authed-image.js';
|
|
58
59
|
import '../components/image-grid.js';
|
|
59
60
|
import '../components/lightbox.js';
|
|
60
|
-
import '../components/write-lock.js';
|
|
61
61
|
import '../auth/sign-in-form.js';
|
|
62
62
|
import '../landing/access.js';
|
|
63
63
|
import '../landing/landing-labels.js';
|
|
@@ -1,20 +1,25 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ComponentPropsWithoutRef } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { e5 as LabelOverride, bH as BillingLabels } from '../delete-account-setting-DiPX4Vue.js';
|
|
4
4
|
import { AlertTone } from '../components/alert-banner.js';
|
|
5
5
|
import '../components/tooltip.js';
|
|
6
6
|
import '../hooks/use-anchored-rect.js';
|
|
7
7
|
import '../lib/clipping.js';
|
|
8
|
-
import '../data-table-labels-
|
|
8
|
+
import '../data-table-labels-BJ5JE_X2.js';
|
|
9
9
|
import '../components/data-table-sort.js';
|
|
10
10
|
import '../components/swipeable-row.js';
|
|
11
|
+
import '../components/status-dot.js';
|
|
12
|
+
import '../components/progress-bar.js';
|
|
13
|
+
import '../components/signed-amount.js';
|
|
14
|
+
import '../components/stat-tile.js';
|
|
15
|
+
import '../components/chip.js';
|
|
16
|
+
import 'lucide-react';
|
|
17
|
+
import '../components/field-parts.js';
|
|
18
|
+
import '../components/write-lock.js';
|
|
11
19
|
import '../components/mini-calendar.js';
|
|
12
20
|
import '../components/calendar-heatmap.js';
|
|
13
21
|
import '../components/popover.js';
|
|
14
22
|
import '../hooks/use-breakpoint.js';
|
|
15
|
-
import '../components/chip.js';
|
|
16
|
-
import 'lucide-react';
|
|
17
|
-
import '../components/field-parts.js';
|
|
18
23
|
import '../components/field-sync.js';
|
|
19
24
|
import '../wizard/types.js';
|
|
20
25
|
import '../tour/tour.js';
|
|
@@ -26,7 +31,6 @@ import '../components/page-contents.js';
|
|
|
26
31
|
import '../components/series-chart-labels.js';
|
|
27
32
|
import '../components/pie-chart-labels.js';
|
|
28
33
|
import '../components/sparkline.js';
|
|
29
|
-
import '../components/stat-tile.js';
|
|
30
34
|
import '../components/signature-pad.js';
|
|
31
35
|
import '../components/password-strength.js';
|
|
32
36
|
import '../components/swatch-picker.js';
|
|
@@ -38,9 +42,6 @@ import '../hooks/use-search-param-state.js';
|
|
|
38
42
|
import '../components/measured-grid.js';
|
|
39
43
|
import '../components/user-avatar.js';
|
|
40
44
|
import '../lib/person-name.js';
|
|
41
|
-
import '../components/status-dot.js';
|
|
42
|
-
import '../components/progress-bar.js';
|
|
43
|
-
import '../components/signed-amount.js';
|
|
44
45
|
import '../shell/topbar-action-menu.js';
|
|
45
46
|
import '../components/menu-item.js';
|
|
46
47
|
import '../components/floating-panel.js';
|
|
@@ -56,7 +57,6 @@ import '../components/error-boundary.js';
|
|
|
56
57
|
import '../components/authed-image.js';
|
|
57
58
|
import '../components/image-grid.js';
|
|
58
59
|
import '../components/lightbox.js';
|
|
59
|
-
import '../components/write-lock.js';
|
|
60
60
|
import '../auth/sign-in-form.js';
|
|
61
61
|
import '../landing/access.js';
|
|
62
62
|
import '../landing/landing-labels.js';
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { e5 as LabelOverride, bH as BillingLabels } from '../delete-account-setting-DiPX4Vue.js';
|
|
2
|
+
import { ToastId } from '../components/toast.js';
|
|
3
|
+
import { PlanLimitRefusal } from './plan-limit.js';
|
|
4
|
+
import 'react';
|
|
5
|
+
import '../components/tooltip.js';
|
|
6
|
+
import '../hooks/use-anchored-rect.js';
|
|
7
|
+
import '../lib/clipping.js';
|
|
8
|
+
import '../data-table-labels-BJ5JE_X2.js';
|
|
9
|
+
import '../components/data-table-sort.js';
|
|
10
|
+
import '../components/swipeable-row.js';
|
|
11
|
+
import '../components/status-dot.js';
|
|
12
|
+
import '../components/progress-bar.js';
|
|
13
|
+
import '../components/signed-amount.js';
|
|
14
|
+
import '../components/stat-tile.js';
|
|
15
|
+
import '../components/chip.js';
|
|
16
|
+
import 'lucide-react';
|
|
17
|
+
import '../components/field-parts.js';
|
|
18
|
+
import '../components/write-lock.js';
|
|
19
|
+
import '../components/mini-calendar.js';
|
|
20
|
+
import '../components/calendar-heatmap.js';
|
|
21
|
+
import '../components/popover.js';
|
|
22
|
+
import '../hooks/use-breakpoint.js';
|
|
23
|
+
import '../components/field-sync.js';
|
|
24
|
+
import '../wizard/types.js';
|
|
25
|
+
import '../tour/tour.js';
|
|
26
|
+
import '../search/command-palette.js';
|
|
27
|
+
import '../search/global-search.js';
|
|
28
|
+
import '../search/search-index.js';
|
|
29
|
+
import '../components/month-picker.js';
|
|
30
|
+
import '../components/page-contents.js';
|
|
31
|
+
import '../components/series-chart-labels.js';
|
|
32
|
+
import '../components/pie-chart-labels.js';
|
|
33
|
+
import '../components/sparkline.js';
|
|
34
|
+
import '../components/signature-pad.js';
|
|
35
|
+
import '../components/password-strength.js';
|
|
36
|
+
import '../components/swatch-picker.js';
|
|
37
|
+
import '../components/tile-radio.js';
|
|
38
|
+
import '../components/icon-picker.js';
|
|
39
|
+
import '../components/dialog-frame.js';
|
|
40
|
+
import '../components/modal.js';
|
|
41
|
+
import '../hooks/use-search-param-state.js';
|
|
42
|
+
import '../components/measured-grid.js';
|
|
43
|
+
import '../components/user-avatar.js';
|
|
44
|
+
import '../lib/person-name.js';
|
|
45
|
+
import '../shell/topbar-action-menu.js';
|
|
46
|
+
import '../components/menu-item.js';
|
|
47
|
+
import '../components/floating-panel.js';
|
|
48
|
+
import '../hooks/use-authed-src.js';
|
|
49
|
+
import '../components/account-settings-labels.js';
|
|
50
|
+
import '../components/bulk-action-bar.js';
|
|
51
|
+
import '../components/list.js';
|
|
52
|
+
import '../components/breadcrumbs.js';
|
|
53
|
+
import '../components/description-list.js';
|
|
54
|
+
import '../components/line-items.js';
|
|
55
|
+
import '../components/error-boundary.js';
|
|
56
|
+
import '../components/authed-image.js';
|
|
57
|
+
import '../components/image-grid.js';
|
|
58
|
+
import '../components/lightbox.js';
|
|
59
|
+
import '../auth/sign-in-form.js';
|
|
60
|
+
import '../landing/access.js';
|
|
61
|
+
import '../landing/landing-labels.js';
|
|
62
|
+
import '../shell/topbar-controls.js';
|
|
63
|
+
import '../theme/palette-presets.js';
|
|
64
|
+
import '../theme/chart-palette.js';
|
|
65
|
+
import '../theme/theme-store.js';
|
|
66
|
+
import 'zustand/middleware';
|
|
67
|
+
import 'zustand';
|
|
68
|
+
import '../auth/complete-name-dialog.js';
|
|
69
|
+
import '../auth/forgot-password-form.js';
|
|
70
|
+
import '../auth/status-parts.js';
|
|
71
|
+
import '../auth/reset-password-form.js';
|
|
72
|
+
import '../auth/verify-email.js';
|
|
73
|
+
import '../auth/not-found-page.js';
|
|
74
|
+
import '../auth/accept-invitation.js';
|
|
75
|
+
import '../shell/company-switcher.js';
|
|
76
|
+
import '../account/email-change-setting.js';
|
|
77
|
+
import '../account/sessions-setting.js';
|
|
78
|
+
import '../lib/format.js';
|
|
79
|
+
import '../account/data-export-setting.js';
|
|
80
|
+
import '../components/account-chips.js';
|
|
81
|
+
import '../admin/admin-parts.js';
|
|
82
|
+
import '../admin/admin-action-log.js';
|
|
83
|
+
import '../settings/settings-labels.js';
|
|
84
|
+
import '../demo/demo-labels.js';
|
|
85
|
+
import '../components/appearance-labels.js';
|
|
86
|
+
import '../theme/contrast.js';
|
|
87
|
+
import '../theme/text-size.js';
|
|
88
|
+
import '../components/reauth-dialog.js';
|
|
89
|
+
import '../components/server-wake.js';
|
|
90
|
+
import '../lib/server-wake.js';
|
|
91
|
+
import '../components/translation-review-labels.js';
|
|
92
|
+
import '../lib/translation-review.js';
|
|
93
|
+
import '../components/country-select.js';
|
|
94
|
+
import '../components/inline-edit-field.js';
|
|
95
|
+
import '../lib/iban.js';
|
|
96
|
+
import '../lib/phone.js';
|
|
97
|
+
import '../components/sign-chip.js';
|
|
98
|
+
import '../components/column-mapper.js';
|
|
99
|
+
import '../lib/column-mapping.js';
|
|
100
|
+
import '../lib/table-text.js';
|
|
101
|
+
import '../components/focus-ring.js';
|
|
102
|
+
|
|
103
|
+
interface PlanLimitToastOptions {
|
|
104
|
+
/** `upgrade`: plans are bought — "Choose a plan". `contact`: the operator grants them
|
|
105
|
+
* by hand — "Ask for more", a mail to support. */
|
|
106
|
+
mode: "upgrade" | "contact";
|
|
107
|
+
/** `upgrade`: the app's navigation to its subscription page (the kit has no router).
|
|
108
|
+
* Left out, the toast has no action. */
|
|
109
|
+
onChoosePlan?: () => void;
|
|
110
|
+
/** `contact`: support@ the app's domain, opened as `planLimitMailto(email,
|
|
111
|
+
* contactSubject(name))`. Left out, the toast has no action. */
|
|
112
|
+
email?: string;
|
|
113
|
+
/** The app's word per dimension: `{ budgets: "Budgets", scans: "Scans this month" }`.
|
|
114
|
+
* A dimension without one is named by its key. */
|
|
115
|
+
dimensionLabels?: Readonly<Record<string, string>>;
|
|
116
|
+
/** How a figure is written — kastlan's storage limit is bytes. Default: a number in
|
|
117
|
+
* the kit's locale. */
|
|
118
|
+
formatValue?: (dimension: string, value: number) => string;
|
|
119
|
+
/** Prop > `<UiKitProvider labels={{ billing }}>` > English. */
|
|
120
|
+
labels?: LabelOverride<BillingLabels>;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* `PlanLimitNotice`'s words as a toast (docs/billing-harmonization.md §14.11), for a
|
|
124
|
+
* refused create with no room for the notice — a row's button, a share target: "Plan
|
|
125
|
+
* limit reached", what to do, the figure when the refusal has one ("Budgets: 3 of 3"),
|
|
126
|
+
* and the mode's action.
|
|
127
|
+
*
|
|
128
|
+
* const showLimit = usePlanLimitToast({
|
|
129
|
+
* mode: "upgrade",
|
|
130
|
+
* onChoosePlan: () => navigate("/settings/subscription"),
|
|
131
|
+
* dimensionLabels: { budgets: t("billing.dim_budgets") },
|
|
132
|
+
* });
|
|
133
|
+
* catch (err) { const hit = isPlanLimit(err); if (hit) showLimit(hit); }
|
|
134
|
+
*
|
|
135
|
+
* One toast per dimension: its id is `plan-limit:<dimension>`, so a repeat replaces it
|
|
136
|
+
* in place instead of stacking a second (keksdose's own hook stacked). Called with no
|
|
137
|
+
* hit, it says the words without a figure, under `plan-limit`. No `limit` in the
|
|
138
|
+
* refusal, no figure line; keksdose's legacy `plan_budget_limit` reads as `budgets`
|
|
139
|
+
* (`isPlanLimit`, §12.16). Returns the toast's id.
|
|
140
|
+
*/
|
|
141
|
+
declare function usePlanLimitToast(options: PlanLimitToastOptions): (hit?: PlanLimitRefusal) => ToastId;
|
|
142
|
+
|
|
143
|
+
export { type PlanLimitToastOptions, usePlanLimitToast };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useCallback } from "react";
|
|
4
|
+
import { useKitLocale } from "../i18n/kit-labels.js";
|
|
5
|
+
import { documentNavigation } from "../lib/document-navigation.js";
|
|
6
|
+
import { formatNumber } from "../lib/format.js";
|
|
7
|
+
import { toast } from "../components/toast.js";
|
|
8
|
+
import { useBillingLabels } from "./billing-labels.js";
|
|
9
|
+
import { planLimitMailto } from "./plan-limit-notice.js";
|
|
10
|
+
function usePlanLimitToast(options) {
|
|
11
|
+
const { mode, onChoosePlan, email, dimensionLabels, formatValue, labels: labelsProp } = options;
|
|
12
|
+
const labels = useBillingLabels(labelsProp);
|
|
13
|
+
const locale = useKitLocale();
|
|
14
|
+
return useCallback(
|
|
15
|
+
(hit) => {
|
|
16
|
+
const dimension = hit?.dimension ?? "";
|
|
17
|
+
const name = dimensionLabels?.[dimension] ?? dimension;
|
|
18
|
+
const figure = (value) => formatValue ? formatValue(dimension, value) : formatNumber(value, { locale });
|
|
19
|
+
const usage = hit?.limit !== void 0 ? labels.limitUsageLine(name, figure(hit.used ?? hit.limit), figure(hit.limit)) : void 0;
|
|
20
|
+
const action = mode === "upgrade" ? onChoosePlan && { label: labels.choosePlan, onClick: () => onChoosePlan() } : email ? {
|
|
21
|
+
label: labels.askForMore,
|
|
22
|
+
// A mailto: hands the address to the reader's mail client; the page stays.
|
|
23
|
+
onClick: () => documentNavigation.replace(planLimitMailto(email, labels.contactSubject(name)))
|
|
24
|
+
} : void 0;
|
|
25
|
+
return toast.warning(labels.limitReached, {
|
|
26
|
+
id: dimension ? `plan-limit:${dimension}` : "plan-limit",
|
|
27
|
+
description: /* @__PURE__ */ jsxs("span", { "data-plan-limit-mode": mode, "data-dimension": dimension || void 0, children: [
|
|
28
|
+
/* @__PURE__ */ jsx("span", { className: "block", children: mode === "upgrade" ? labels.limitUpgrade : labels.limitContact }),
|
|
29
|
+
usage !== void 0 && /* @__PURE__ */ jsx("span", { className: "block tabular-nums", children: usage })
|
|
30
|
+
] }),
|
|
31
|
+
action
|
|
32
|
+
});
|
|
33
|
+
},
|
|
34
|
+
[mode, onChoosePlan, email, dimensionLabels, formatValue, labels, locale]
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
export {
|
|
38
|
+
usePlanLimitToast
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=plan-limit-toast.js.map
|