@cosmicdrift/kumiko-samples 0.378.0 → 0.379.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/package.json +1 -1
- package/packages/bundled-features/package.json +18 -17
- package/packages/bundled-features/src/account-security/feature.ts +2 -2
- package/packages/bundled-features/src/account-security/index.ts +8 -8
- package/packages/bundled-features/src/account-security/{constants.ts → web/constants.ts} +0 -2
- package/packages/bundled-features/src/account-security/{i18n.ts → web/i18n.ts} +0 -1
- package/packages/bundled-features/src/admin-shell/feature.ts +10 -9
- package/packages/bundled-features/src/admin-shell/index.ts +8 -8
- package/packages/bundled-features/src/admin-shell/web/client-plugin.tsx +2 -3
- package/packages/bundled-features/src/admin-shell/{constants.ts → web/constants.ts} +0 -1
- package/packages/bundled-features/src/admin-shell/web/default-translations.ts +10 -0
- package/packages/bundled-features/src/admin-shell/web/i18n.ts +51 -9
- package/packages/bundled-features/src/admin-shell/web/index.ts +0 -1
- package/packages/bundled-features/src/audit/changes.json +7 -0
- package/packages/bundled-features/src/audit/feature.ts +72 -64
- package/packages/bundled-features/src/audit/handlers/audit-events.ts +153 -0
- package/packages/bundled-features/src/audit/handlers/audit-system-db.ts +13 -0
- package/packages/bundled-features/src/audit/handlers/details-all-tenants.query.ts +26 -0
- package/packages/bundled-features/src/audit/handlers/details.query.ts +11 -39
- package/packages/bundled-features/src/audit/handlers/list-all-tenants.query.ts +47 -0
- package/packages/bundled-features/src/audit/handlers/list.query.ts +16 -123
- package/packages/bundled-features/src/audit/handlers/resolve-audit-tenant.ts +21 -7
- package/packages/bundled-features/src/audit/index.ts +1 -1
- package/packages/bundled-features/src/audit/run-escape-hatch-retention.ts +4 -4
- package/packages/bundled-features/src/audit/screens.ts +82 -0
- package/packages/bundled-features/src/audit/web/client-plugin.tsx +2 -3
- package/packages/bundled-features/src/audit/{constants.ts → web/constants.ts} +11 -1
- package/packages/bundled-features/src/audit/web/default-translations.ts +7 -0
- package/packages/bundled-features/src/audit/web/i18n.ts +33 -7
- package/packages/bundled-features/src/audit/web/index.ts +0 -2
- package/packages/bundled-features/src/auth-email-password/bootstrap.ts +6 -6
- package/packages/bundled-features/src/auth-email-password/changes.json +6 -0
- package/packages/bundled-features/src/auth-email-password/errors.ts +1 -1
- package/packages/bundled-features/src/auth-email-password/feature.ts +2 -2
- package/packages/bundled-features/src/auth-email-password/handlers/confirm-account-unlock.write.ts +1 -1
- package/packages/bundled-features/src/auth-email-password/handlers/invite-accept-with-login.write.ts +4 -4
- package/packages/bundled-features/src/auth-email-password/handlers/invite-create.write.ts +3 -3
- package/packages/bundled-features/src/auth-email-password/handlers/invite-info.query.ts +1 -1
- package/packages/bundled-features/src/auth-email-password/handlers/login.write.ts +38 -4
- package/packages/bundled-features/src/auth-email-password/handlers/request-account-unlock.write.ts +1 -1
- package/packages/bundled-features/src/auth-email-password/handlers/request-email-verification.write.ts +1 -1
- package/packages/bundled-features/src/auth-email-password/handlers/request-password-reset.write.ts +1 -1
- package/packages/bundled-features/src/auth-email-password/handlers/reset-password.write.ts +1 -1
- package/packages/bundled-features/src/auth-email-password/handlers/verify-email.write.ts +1 -1
- package/packages/bundled-features/src/auth-email-password/index.ts +6 -1
- package/packages/bundled-features/src/auth-email-password/mail-notifications.ts +1 -1
- package/packages/bundled-features/src/auth-email-password/signup-activation.ts +1 -1
- package/packages/bundled-features/src/auth-email-password/web/auth-client.ts +0 -1
- package/packages/bundled-features/src/auth-email-password/web/auth-form-logic.ts +0 -1
- package/packages/bundled-features/src/auth-email-password/web/auth-form-primitives.tsx +0 -1
- package/packages/bundled-features/src/auth-email-password/web/auth-gate.tsx +0 -1
- package/packages/bundled-features/src/auth-email-password/web/auth-redirect.ts +0 -1
- package/packages/bundled-features/src/auth-email-password/web/client-actions.ts +0 -1
- package/packages/bundled-features/src/auth-email-password/web/client-plugin.ts +1 -2
- package/packages/bundled-features/src/auth-email-password/web/confirm-account-unlock-screen.tsx +0 -1
- package/packages/bundled-features/src/auth-email-password/{constants.ts → web/constants.ts} +3 -6
- package/packages/bundled-features/src/auth-email-password/web/default-topbar-actions.tsx +0 -1
- package/packages/bundled-features/src/auth-email-password/web/forgot-password-screen.tsx +0 -1
- package/packages/bundled-features/src/auth-email-password/{i18n.ts → web/i18n.ts} +3 -4
- package/packages/bundled-features/src/auth-email-password/web/index.ts +1 -2
- package/packages/bundled-features/src/auth-email-password/web/invite-accept-screen.tsx +2 -3
- package/packages/bundled-features/src/auth-email-password/web/login-screen.tsx +0 -1
- package/packages/bundled-features/src/auth-email-password/{mail-i18n.ts → web/mail-i18n.ts} +0 -1
- package/packages/bundled-features/src/auth-email-password/web/request-account-unlock-screen.tsx +0 -1
- package/packages/bundled-features/src/auth-email-password/web/reset-password-screen.tsx +0 -1
- package/packages/bundled-features/src/auth-email-password/web/session-bootstrap-error.tsx +0 -1
- package/packages/bundled-features/src/auth-email-password/web/session.tsx +0 -1
- package/packages/bundled-features/src/auth-email-password/web/signup-complete-screen.tsx +2 -3
- package/packages/bundled-features/src/auth-email-password/web/signup-screen.tsx +0 -1
- package/packages/bundled-features/src/auth-email-password/web/tenant-menu-items.tsx +0 -1
- package/packages/bundled-features/src/auth-email-password/web/tenant-switcher.tsx +0 -1
- package/packages/bundled-features/src/auth-email-password/web/use-shell-user.ts +0 -1
- package/packages/bundled-features/src/auth-email-password/web/user-menu.tsx +0 -1
- package/packages/bundled-features/src/auth-email-password/web/verify-email-screen.tsx +0 -1
- package/packages/bundled-features/src/auth-mfa/changes.json +6 -0
- package/packages/bundled-features/src/auth-mfa/errors.ts +2 -2
- package/packages/bundled-features/src/auth-mfa/handlers/enable-confirm-preauth.write.ts +1 -1
- package/packages/bundled-features/src/auth-mfa/handlers/enable-start-preauth.write.ts +1 -1
- package/packages/bundled-features/src/auth-mfa/handlers/enable-start.write.ts +1 -1
- package/packages/bundled-features/src/auth-mfa/handlers/verify.write.ts +1 -1
- package/packages/bundled-features/src/auth-mfa/index.ts +8 -8
- package/packages/bundled-features/src/auth-mfa/mfa-status-checker.ts +4 -4
- package/packages/bundled-features/src/auth-mfa/screens.ts +1 -1
- package/packages/bundled-features/src/auth-mfa/web/client-plugin.ts +0 -1
- package/packages/bundled-features/src/auth-mfa/{constants.ts → web/constants.ts} +0 -1
- package/packages/bundled-features/src/auth-mfa/web/i18n.ts +0 -1
- package/packages/bundled-features/src/auth-mfa/web/index.ts +0 -1
- package/packages/bundled-features/src/auth-mfa/web/mfa-client.ts +0 -1
- package/packages/bundled-features/src/auth-mfa/web/mfa-disable-dialog.tsx +1 -2
- package/packages/bundled-features/src/auth-mfa/web/mfa-recovery-codes-reveal.tsx +0 -1
- package/packages/bundled-features/src/auth-mfa/web/mfa-regenerate-recovery-dialog.tsx +1 -2
- package/packages/bundled-features/src/auth-mfa/web/mfa-setup-preauth-screen.tsx +21 -23
- package/packages/bundled-features/src/auth-mfa/web/mfa-verify-screen.tsx +0 -1
- package/packages/bundled-features/src/billing-foundation/changes.json +18 -0
- package/packages/bundled-features/src/billing-foundation/checkout-core.ts +3 -3
- package/packages/bundled-features/src/billing-foundation/consumer-protection/consent-text.ts +2 -2
- package/packages/bundled-features/src/billing-foundation/consumer-protection/issue-confirmation.ts +11 -3
- package/packages/bundled-features/src/billing-foundation/consumer-protection/mail-notifications.ts +11 -1
- package/packages/bundled-features/src/billing-foundation/consumer-protection/register-consent.ts +1 -1
- package/packages/bundled-features/src/billing-foundation/consumer-protection/register-termination.ts +12 -1
- package/packages/bundled-features/src/billing-foundation/consumer-protection/stored-user-email.ts +12 -0
- package/packages/bundled-features/src/billing-foundation/consumer-protection/termination-mail.ts +6 -1
- package/packages/bundled-features/src/billing-foundation/consumer-protection/termination-notify.ts +1 -1
- package/packages/bundled-features/src/billing-foundation/consumer-protection/termination-pages.ts +167 -28
- package/packages/bundled-features/src/billing-foundation/consumer-protection/termination-record.ts +102 -3
- package/packages/bundled-features/src/billing-foundation/consumer-protection/termination-request.ts +43 -12
- package/packages/bundled-features/src/billing-foundation/consumer-protection/termination-revoke.ts +202 -0
- package/packages/bundled-features/src/billing-foundation/consumer-protection/termination-texts.ts +70 -0
- package/packages/bundled-features/src/billing-foundation/events.ts +20 -2
- package/packages/bundled-features/src/billing-foundation/feature.ts +5 -5
- package/packages/bundled-features/src/billing-foundation/handlers/process-event.write.ts +82 -9
- package/packages/bundled-features/src/billing-foundation/handlers/switch-plan.write.ts +1 -1
- package/packages/bundled-features/src/billing-foundation/handlers/sync-subscription.write.ts +1 -1
- package/packages/bundled-features/src/billing-foundation/index.ts +27 -27
- package/packages/bundled-features/src/billing-foundation/plan-catalog.ts +7 -7
- package/packages/bundled-features/src/billing-foundation/screens.ts +1 -1
- package/packages/bundled-features/src/billing-foundation/subscription-tier-sync.ts +1 -1
- package/packages/bundled-features/src/billing-foundation/types.ts +17 -3
- package/packages/bundled-features/src/billing-foundation/validate-options.ts +3 -3
- package/packages/bundled-features/src/billing-foundation/web/billing-contact-plan.tsx +1 -3
- package/packages/bundled-features/src/billing-foundation/web/billing-plans-panel.tsx +5 -7
- package/packages/bundled-features/src/billing-foundation/web/cancel-contract-dialog.tsx +1 -3
- package/packages/bundled-features/src/billing-foundation/web/checkout-consent-dialog.tsx +1 -3
- package/packages/bundled-features/src/billing-foundation/web/client-plugin.tsx +1 -2
- package/packages/bundled-features/src/billing-foundation/{constants.ts → web/constants.ts} +37 -31
- package/packages/bundled-features/src/billing-foundation/{consumer-protection → web/consumer-protection}/consent-locale.ts +0 -1
- package/packages/bundled-features/src/billing-foundation/{contact-card.ts → web/contact-card.ts} +0 -2
- package/packages/bundled-features/src/billing-foundation/web/index.ts +14 -15
- package/packages/bundled-features/src/billing-foundation/web/localized-params.ts +0 -2
- package/packages/bundled-features/src/billing-foundation/webhook-handler.ts +5 -2
- package/packages/bundled-features/src/cap-overview/feature.ts +1 -1
- package/packages/bundled-features/src/cap-overview/handlers/caps-usage.query.ts +1 -1
- package/packages/bundled-features/src/cap-overview/handlers/tenant-caps-list.query.ts +2 -2
- package/packages/bundled-features/src/cap-overview/index.ts +9 -9
- package/packages/bundled-features/src/cap-overview/screens.ts +2 -2
- package/packages/bundled-features/src/cap-overview/web/cap-cards-panel.tsx +1 -2
- package/packages/bundled-features/src/cap-overview/web/cap-usage-bar.tsx +1 -2
- package/packages/bundled-features/src/cap-overview/web/cap-usage-cell.tsx +0 -2
- package/packages/bundled-features/src/cap-overview/web/client-plugin.tsx +3 -4
- package/packages/bundled-features/src/cap-overview/{constants.ts → web/constants.ts} +0 -1
- package/packages/bundled-features/src/cap-overview/web/index.ts +0 -1
- package/packages/bundled-features/src/cap-overview/{usage-math.ts → web/usage-math.ts} +1 -2
- package/packages/bundled-features/src/compliance-profiles/feature.ts +5 -5
- package/packages/bundled-features/src/compliance-profiles/index.ts +6 -6
- package/packages/bundled-features/src/compliance-profiles/web/client-plugin.tsx +2 -3
- package/packages/bundled-features/src/compliance-profiles/web/compliance-profile-catalog.tsx +1 -2
- package/packages/bundled-features/src/compliance-profiles/{constants.ts → web/constants.ts} +0 -1
- package/packages/bundled-features/src/compliance-profiles/web/i18n.ts +0 -1
- package/packages/bundled-features/src/compliance-profiles/web/index.ts +0 -1
- package/packages/bundled-features/src/config/index.ts +6 -6
- package/packages/bundled-features/src/config/web/client-plugin.ts +1 -2
- package/packages/bundled-features/src/config/{constants.ts → web/constants.ts} +0 -1
- package/packages/bundled-features/src/config/web/i18n.ts +0 -1
- package/packages/bundled-features/src/config/web/index.ts +1 -3
- package/packages/bundled-features/src/config/write-helpers.ts +1 -1
- package/packages/bundled-features/src/custom-fields/feature.ts +8 -8
- package/packages/bundled-features/src/custom-fields/handlers/clear-custom-field.write.ts +1 -1
- package/packages/bundled-features/src/custom-fields/handlers/define-tenant-field.write.ts +1 -1
- package/packages/bundled-features/src/custom-fields/handlers/delete-system-field.write.ts +1 -1
- package/packages/bundled-features/src/custom-fields/handlers/delete-tenant-field.write.ts +4 -4
- package/packages/bundled-features/src/custom-fields/handlers/set-custom-field.write.ts +1 -1
- package/packages/bundled-features/src/custom-fields/handlers/update-tenant-field.write.ts +1 -1
- package/packages/bundled-features/src/custom-fields/index.ts +8 -8
- package/packages/bundled-features/src/custom-fields/lib/value-schema.ts +1 -1
- package/packages/bundled-features/src/custom-fields/schemas.ts +1 -1
- package/packages/bundled-features/src/custom-fields/web/client-plugin.tsx +1 -2
- package/packages/bundled-features/src/custom-fields/{constants.ts → web/constants.ts} +18 -19
- package/packages/bundled-features/src/custom-fields/web/custom-fields-form-section.tsx +1 -2
- package/packages/bundled-features/src/custom-fields/web/i18n.ts +0 -1
- package/packages/bundled-features/src/custom-fields/web/index.ts +2 -3
- package/packages/bundled-features/src/custom-fields/wire-for-entity.ts +1 -2
- package/packages/bundled-features/src/delivery/address-opt-out.ts +1 -1
- package/packages/bundled-features/src/delivery/attempt-log-retention.ts +24 -8
- package/packages/bundled-features/src/delivery/changes.json +6 -0
- package/packages/bundled-features/src/delivery/constants.ts +2 -2
- package/packages/bundled-features/src/delivery/i18n.ts +1 -1
- package/packages/bundled-features/src/delivery/unsubscribe-page.ts +1 -1
- package/packages/bundled-features/src/delivery/web/client-plugin.tsx +6 -7
- package/packages/bundled-features/src/delivery/web/delivery-channel-cell.tsx +0 -1
- package/packages/bundled-features/src/delivery/web/delivery-error-cell.tsx +0 -1
- package/packages/bundled-features/src/delivery/web/delivery-status-cell.tsx +1 -2
- package/packages/bundled-features/src/delivery/web/delivery-time-cell.tsx +0 -1
- package/packages/bundled-features/src/delivery/web/delivery-type-cell.tsx +0 -1
- package/packages/bundled-features/src/delivery/web/index.ts +0 -1
- package/packages/bundled-features/src/delivery/{public-names.ts → web/public-names.ts} +0 -1
- package/packages/bundled-features/src/document-ingest-foundation/changes.json +6 -0
- package/packages/bundled-features/src/document-ingest-foundation/events.ts +4 -0
- package/packages/bundled-features/src/document-ingest-foundation/executor.ts +2 -1
- package/packages/bundled-features/src/document-ingest-foundation/feature.ts +18 -4
- package/packages/bundled-features/src/document-ingest-foundation/index.ts +1 -0
- package/packages/bundled-features/src/feature-toggles/feature.ts +7 -7
- package/packages/bundled-features/src/feature-toggles/handlers/list.query.ts +1 -1
- package/packages/bundled-features/src/feature-toggles/handlers/registered.query.ts +1 -1
- package/packages/bundled-features/src/feature-toggles/handlers/set.write.ts +3 -3
- package/packages/bundled-features/src/feature-toggles/index.ts +6 -6
- package/packages/bundled-features/src/feature-toggles/web/client-plugin.tsx +1 -2
- package/packages/bundled-features/src/feature-toggles/{constants.ts → web/constants.ts} +0 -1
- package/packages/bundled-features/src/feature-toggles/web/i18n.ts +0 -1
- package/packages/bundled-features/src/feature-toggles/web/index.ts +0 -1
- package/packages/bundled-features/src/files/changes.json +7 -0
- package/packages/bundled-features/src/folders/feature.ts +1 -1
- package/packages/bundled-features/src/folders/handlers/clear-folder.write.ts +1 -1
- package/packages/bundled-features/src/folders/handlers/delete-folder.write.ts +1 -1
- package/packages/bundled-features/src/folders/handlers/set-folder.write.ts +1 -1
- package/packages/bundled-features/src/folders/index.ts +8 -8
- package/packages/bundled-features/src/folders/web/client-plugin.tsx +1 -3
- package/packages/bundled-features/src/folders/{constants.ts → web/constants.ts} +0 -1
- package/packages/bundled-features/src/folders/web/folder-manager.tsx +1 -2
- package/packages/bundled-features/src/folders/web/folder-section.tsx +1 -2
- package/packages/bundled-features/src/folders/web/i18n.ts +0 -1
- package/packages/bundled-features/src/folders/web/index.ts +1 -2
- package/packages/bundled-features/src/folders/web/tree.ts +0 -1
- package/packages/bundled-features/src/form-draft/changes.json +7 -0
- package/packages/bundled-features/src/form-draft/db/queries/cleanup.ts +25 -11
- package/packages/bundled-features/src/form-draft/decrypt-draft.ts +24 -0
- package/packages/bundled-features/src/form-draft/entity.ts +6 -9
- package/packages/bundled-features/src/form-draft/feature.ts +1 -1
- package/packages/bundled-features/src/form-draft/handlers/cleanup.job.ts +26 -5
- package/packages/bundled-features/src/form-draft/handlers/discard.write.ts +1 -1
- package/packages/bundled-features/src/form-draft/handlers/get.query.ts +6 -7
- package/packages/bundled-features/src/form-draft/handlers/list.query.ts +13 -7
- package/packages/bundled-features/src/form-draft/handlers/save.write.ts +5 -5
- package/packages/bundled-features/src/form-draft/index.ts +8 -8
- package/packages/bundled-features/src/form-draft/lookup.ts +10 -4
- package/packages/bundled-features/src/form-draft/schemas.ts +1 -1
- package/packages/bundled-features/src/form-draft/{constants.ts → web/constants.ts} +0 -1
- package/packages/bundled-features/src/form-draft-user-data/hooks.ts +2 -2
- package/packages/bundled-features/src/inbound-mail-foundation/retention-sweep.ts +10 -10
- package/packages/bundled-features/src/jobs/feature.ts +7 -7
- package/packages/bundled-features/src/jobs/handlers/retry.write.ts +1 -1
- package/packages/bundled-features/src/jobs/handlers/trigger.write.ts +1 -1
- package/packages/bundled-features/src/jobs/index.ts +1 -1
- package/packages/bundled-features/src/jobs/web/client-plugin.tsx +2 -3
- package/packages/bundled-features/src/jobs/{constants.ts → web/constants.ts} +0 -1
- package/packages/bundled-features/src/jobs/web/default-translations.ts +7 -0
- package/packages/bundled-features/src/jobs/web/i18n.ts +53 -7
- package/packages/bundled-features/src/jobs/web/index.ts +0 -1
- package/packages/bundled-features/src/ledger/changes.json +7 -0
- package/packages/bundled-features/src/ledger/entity.ts +1 -1
- package/packages/bundled-features/src/ledger/feature.ts +1 -1
- package/packages/bundled-features/src/ledger/handlers/confirm-schedule-period.write.ts +2 -10
- package/packages/bundled-features/src/ledger/handlers/create-transaction.write.ts +1 -1
- package/packages/bundled-features/src/ledger/handlers/reports.query.ts +1 -1
- package/packages/bundled-features/src/ledger/handlers/reverse-transaction.write.ts +1 -1
- package/packages/bundled-features/src/ledger/index.ts +13 -13
- package/packages/bundled-features/src/ledger/recurring.ts +1 -1
- package/packages/bundled-features/src/ledger/reports.ts +1 -1
- package/packages/bundled-features/src/ledger/schemas.ts +1 -1
- package/packages/bundled-features/src/ledger/{constants.ts → web/constants.ts} +0 -1
- package/packages/bundled-features/src/ledger/web/index.ts +11 -12
- package/packages/bundled-features/src/legal-pages/README.md +1 -1
- package/packages/bundled-features/src/legal-pages/feature.ts +5 -5
- package/packages/bundled-features/src/legal-pages/index.ts +11 -11
- package/packages/bundled-features/src/legal-pages/lib/boot-check.ts +1 -1
- package/packages/bundled-features/src/legal-pages/lib/validate-routes.ts +1 -1
- package/packages/bundled-features/src/legal-pages/web/client-plugin.ts +1 -2
- package/packages/bundled-features/src/legal-pages/{constants.ts → web/constants.ts} +6 -8
- package/packages/bundled-features/src/legal-pages/web/index.ts +0 -1
- package/packages/bundled-features/src/managed-pages/feature.ts +1 -1
- package/packages/bundled-features/src/managed-pages/web/client-plugin.tsx +1 -2
- package/packages/bundled-features/src/managed-pages/web/default-translations.ts +17 -0
- package/packages/bundled-features/src/managed-pages/web/i18n.ts +59 -16
- package/packages/bundled-features/src/managed-pages/web/index.ts +1 -2
- package/packages/bundled-features/src/metrics/compute.ts +1 -1
- package/packages/bundled-features/src/metrics/feature.ts +6 -6
- package/packages/bundled-features/src/metrics/index.ts +8 -8
- package/packages/bundled-features/src/metrics/types.ts +1 -1
- package/packages/bundled-features/src/metrics/validate.ts +1 -1
- package/packages/bundled-features/src/metrics/{constants.ts → web/constants.ts} +0 -1
- package/packages/bundled-features/src/metrics/window.ts +1 -1
- package/packages/bundled-features/src/notes-history/feature.ts +1 -1
- package/packages/bundled-features/src/notes-history/handlers/add-note.write.ts +1 -1
- package/packages/bundled-features/src/notes-history/index.ts +8 -8
- package/packages/bundled-features/src/notes-history/web/client-plugin.tsx +1 -3
- package/packages/bundled-features/src/notes-history/{constants.ts → web/constants.ts} +0 -1
- package/packages/bundled-features/src/notes-history/web/i18n.ts +0 -1
- package/packages/bundled-features/src/notes-history/web/index.ts +2 -3
- package/packages/bundled-features/src/notes-history/web/notes-section.tsx +2 -3
- package/packages/bundled-features/src/personal-access-tokens/feature.ts +12 -10
- package/packages/bundled-features/src/personal-access-tokens/handlers/available-scopes.query.ts +1 -1
- package/packages/bundled-features/src/personal-access-tokens/handlers/create.write.ts +1 -1
- package/packages/bundled-features/src/personal-access-tokens/handlers/revoke.write.ts +1 -1
- package/packages/bundled-features/src/personal-access-tokens/hash.ts +1 -1
- package/packages/bundled-features/src/personal-access-tokens/i18n.ts +2 -2
- package/packages/bundled-features/src/personal-access-tokens/index.ts +5 -5
- package/packages/bundled-features/src/personal-access-tokens/resolver.ts +1 -1
- package/packages/bundled-features/src/personal-access-tokens/schema/api-token.ts +1 -1
- package/packages/bundled-features/src/personal-access-tokens/screens.ts +2 -2
- package/packages/bundled-features/src/personal-access-tokens/{constants.ts → web/constants.ts} +0 -1
- package/packages/bundled-features/src/personal-access-tokens/{scopes.ts → web/scopes.ts} +0 -1
- package/packages/bundled-features/src/presets/changes.json +7 -0
- package/packages/bundled-features/src/presets/index.ts +0 -1
- package/packages/bundled-features/src/presets/security-baseline.ts +1 -1
- package/packages/bundled-features/src/renderer-foundation/types.ts +1 -1
- package/packages/bundled-features/src/secrets/feature.ts +1 -1
- package/packages/bundled-features/src/secrets/handlers/delete.write.ts +1 -1
- package/packages/bundled-features/src/secrets/handlers/list.query.ts +1 -1
- package/packages/bundled-features/src/secrets/handlers/set.write.ts +1 -1
- package/packages/bundled-features/src/secrets/i18n.ts +1 -1
- package/packages/bundled-features/src/secrets/index.ts +8 -8
- package/packages/bundled-features/src/secrets/{constants.ts → web/constants.ts} +0 -1
- package/packages/bundled-features/src/secrets/write-gate.ts +1 -1
- package/packages/bundled-features/src/sessions/feature.ts +7 -4
- package/packages/bundled-features/src/sessions/{i18n.ts → web/i18n.ts} +0 -1
- package/packages/bundled-features/src/shared/index.ts +6 -1
- package/packages/bundled-features/src/shared/purge-files-reaching-subject.ts +10 -2
- package/packages/bundled-features/src/shared/web/translate-or-raw.ts +0 -1
- package/packages/bundled-features/src/subscription-stripe/feature.ts +2 -0
- package/packages/bundled-features/src/subscription-stripe/plugin-methods.ts +19 -0
- package/packages/bundled-features/src/subscription-stripe/verify-webhook.ts +1 -0
- package/packages/bundled-features/src/tags/changes.json +6 -0
- package/packages/bundled-features/src/tags/feature.ts +1 -1
- package/packages/bundled-features/src/tags/handlers/assign-tag.write.ts +11 -7
- package/packages/bundled-features/src/tags/handlers/create-tag.write.ts +1 -1
- package/packages/bundled-features/src/tags/handlers/delete-tag.write.ts +4 -1
- package/packages/bundled-features/src/tags/handlers/remove-tag.write.ts +1 -1
- package/packages/bundled-features/src/tags/handlers/update-tag.write.ts +1 -1
- package/packages/bundled-features/src/tags/index.ts +12 -12
- package/packages/bundled-features/src/tags/screens.ts +1 -1
- package/packages/bundled-features/src/tags/web/client-plugin.tsx +1 -3
- package/packages/bundled-features/src/tags/{constants.ts → web/constants.ts} +4 -1
- package/packages/bundled-features/src/tags/web/entity-tags.tsx +1 -2
- package/packages/bundled-features/src/tags/web/i18n.ts +2 -2
- package/packages/bundled-features/src/tags/web/index.ts +2 -3
- package/packages/bundled-features/src/tags/web/tag-chip.tsx +0 -1
- package/packages/bundled-features/src/tags/web/tag-filter.tsx +1 -2
- package/packages/bundled-features/src/tags/web/tag-manager.tsx +5 -4
- package/packages/bundled-features/src/tags/web/tag-picker.tsx +0 -1
- package/packages/bundled-features/src/tags/web/tag-section.tsx +1 -2
- package/packages/bundled-features/src/tags/web/tags-cell.tsx +1 -2
- package/packages/bundled-features/src/template-resolver/README.md +1 -1
- package/packages/bundled-features/src/template-resolver/api.ts +75 -28
- package/packages/bundled-features/src/template-resolver/changes.json +43 -0
- package/packages/bundled-features/src/template-resolver/compile-document-body.ts +1 -1
- package/packages/bundled-features/src/template-resolver/compile-steps-block.ts +2 -2
- package/packages/bundled-features/src/template-resolver/document-ops.ts +5 -5
- package/packages/bundled-features/src/template-resolver/document-sanitizer.ts +4 -4
- package/packages/bundled-features/src/template-resolver/feature.ts +13 -4
- package/packages/bundled-features/src/template-resolver/handlers/by-slug.query.ts +6 -1
- package/packages/bundled-features/src/template-resolver/handlers/by-tenant.query.ts +6 -2
- package/packages/bundled-features/src/template-resolver/handlers/collection-item.query.ts +1 -1
- package/packages/bundled-features/src/template-resolver/handlers/collection-list.query.ts +1 -1
- package/packages/bundled-features/src/template-resolver/handlers/collection-set.write.ts +19 -2
- package/packages/bundled-features/src/template-resolver/handlers/copy-locale.write.ts +2 -2
- package/packages/bundled-features/src/template-resolver/handlers/diff-to-system.query.ts +7 -1
- package/packages/bundled-features/src/template-resolver/handlers/discard-draft.write.ts +1 -1
- package/packages/bundled-features/src/template-resolver/handlers/document-base.ts +8 -2
- package/packages/bundled-features/src/template-resolver/handlers/document-blocks.query.ts +2 -2
- package/packages/bundled-features/src/template-resolver/handlers/export-bundle.query.ts +5 -2
- package/packages/bundled-features/src/template-resolver/handlers/find-by-id.query.ts +4 -2
- package/packages/bundled-features/src/template-resolver/handlers/layout-source.query.ts +10 -5
- package/packages/bundled-features/src/template-resolver/handlers/list.query.ts +5 -2
- package/packages/bundled-features/src/template-resolver/handlers/overview.query.ts +68 -10
- package/packages/bundled-features/src/template-resolver/handlers/patch-draft.write.ts +1 -1
- package/packages/bundled-features/src/template-resolver/handlers/resource-shared.ts +1 -1
- package/packages/bundled-features/src/template-resolver/handlers/resource-upload.write.ts +1 -1
- package/packages/bundled-features/src/template-resolver/handlers/send-test.write.ts +2 -2
- package/packages/bundled-features/src/template-resolver/handlers/set.write.ts +1 -1
- package/packages/bundled-features/src/template-resolver/handlers/shared.ts +1 -1
- package/packages/bundled-features/src/template-resolver/handlers/template-gates.ts +6 -6
- package/packages/bundled-features/src/template-resolver/handlers/template-write.ts +2 -2
- package/packages/bundled-features/src/template-resolver/handlers/usage.query.ts +8 -2
- package/packages/bundled-features/src/template-resolver/handlers/validate.query.ts +4 -2
- package/packages/bundled-features/src/template-resolver/i18n.ts +25 -0
- package/packages/bundled-features/src/template-resolver/index.ts +60 -59
- package/packages/bundled-features/src/template-resolver/layout-appearance.ts +1 -1
- package/packages/bundled-features/src/template-resolver/layout-regions.ts +1 -1
- package/packages/bundled-features/src/template-resolver/seeding.ts +16 -7
- package/packages/bundled-features/src/template-resolver/store-template-resource.ts +2 -2
- package/packages/bundled-features/src/template-resolver/table.ts +1 -1
- package/packages/bundled-features/src/template-resolver/template-bundle.ts +2 -2
- package/packages/bundled-features/src/template-resolver/template-delivery-policy.ts +82 -0
- package/packages/bundled-features/src/template-resolver/template-draft.ts +1 -1
- package/packages/bundled-features/src/template-resolver/template-edit-policy.ts +2 -2
- package/packages/bundled-features/src/template-resolver/template-meta.ts +2 -2
- package/packages/bundled-features/src/template-resolver/template-preview.ts +14 -10
- package/packages/bundled-features/src/template-resolver/template-usage.ts +1 -1
- package/packages/bundled-features/src/template-resolver/template-validation.ts +2 -2
- package/packages/bundled-features/src/template-resolver/testing.ts +2 -2
- package/packages/bundled-features/src/template-resolver/user-content-table.ts +1 -1
- package/packages/bundled-features/src/template-resolver/web/client-plugin.tsx +4 -5
- package/packages/bundled-features/src/template-resolver/{constants.ts → web/constants.ts} +7 -10
- package/packages/bundled-features/src/template-resolver/{document-blocks.ts → web/document-blocks.ts} +0 -1
- package/packages/bundled-features/src/template-resolver/web/document-editor-extensions.ts +2 -3
- package/packages/bundled-features/src/template-resolver/web/document-editor.tsx +0 -1
- package/packages/bundled-features/src/template-resolver/{document-images.ts → web/document-images.ts} +0 -1
- package/packages/bundled-features/src/template-resolver/{document-schema.ts → web/document-schema.ts} +0 -1
- package/packages/bundled-features/src/template-resolver/{document-steps.ts → web/document-steps.ts} +0 -1
- package/packages/bundled-features/src/template-resolver/web/document-tiptap-editor.tsx +6 -7
- package/packages/bundled-features/src/template-resolver/web/document-toolbar-blocks.ts +2 -3
- package/packages/bundled-features/src/template-resolver/web/editor-handle.ts +1 -2
- package/packages/bundled-features/src/template-resolver/web/i18n.ts +2 -1
- package/packages/bundled-features/src/template-resolver/web/index.ts +13 -14
- package/packages/bundled-features/src/template-resolver/{mail-constants.ts → web/mail-constants.ts} +0 -1
- package/packages/bundled-features/src/template-resolver/{pdf-constants.ts → web/pdf-constants.ts} +0 -1
- package/packages/bundled-features/src/template-resolver/web/placeholder-line-editor-lazy.tsx +0 -1
- package/packages/bundled-features/src/template-resolver/web/placeholder-line-editor.tsx +5 -4
- package/packages/bundled-features/src/template-resolver/{placeholder-text.ts → web/placeholder-text.ts} +0 -1
- package/packages/bundled-features/src/template-resolver/{qualified-names.ts → web/qualified-names.ts} +0 -1
- package/packages/bundled-features/src/template-resolver/web/use-stable-by-key.ts +0 -1
- package/packages/bundled-features/src/tenant/handlers/add-member.write.ts +1 -1
- package/packages/bundled-features/src/tenant/index.ts +7 -7
- package/packages/bundled-features/src/tenant/invitation-table.ts +1 -1
- package/packages/bundled-features/src/tenant/invited-membership.ts +1 -1
- package/packages/bundled-features/src/tenant/last-tenant-admin.ts +1 -1
- package/packages/bundled-features/src/tenant/member-role-options.ts +1 -1
- package/packages/bundled-features/src/tenant/screens.ts +2 -2
- package/packages/bundled-features/src/tenant/web/client-plugin.tsx +1 -2
- package/packages/bundled-features/src/tenant/{constants.ts → web/constants.ts} +3 -6
- package/packages/bundled-features/src/tenant/web/index.ts +0 -1
- package/packages/bundled-features/src/tenant/web/member-roles-cell.tsx +0 -1
- package/packages/bundled-features/src/tenant/web/member-status-cell.tsx +0 -1
- package/packages/bundled-features/src/tenant-lifecycle/stages.ts +2 -2
- package/packages/bundled-features/src/tier-engine/entity.ts +1 -1
- package/packages/bundled-features/src/tier-engine/feature.ts +7 -7
- package/packages/bundled-features/src/tier-engine/handlers/set-tenant-tier.write.ts +1 -1
- package/packages/bundled-features/src/tier-engine/index.ts +8 -8
- package/packages/bundled-features/src/tier-engine/web/client-plugin.tsx +2 -3
- package/packages/bundled-features/src/tier-engine/{constants.ts → web/constants.ts} +2 -3
- package/packages/bundled-features/src/tier-engine/{i18n.ts → web/i18n.ts} +0 -1
- package/packages/bundled-features/src/tier-engine/web/index.ts +0 -1
- package/packages/bundled-features/src/user/handlers/create.write.ts +1 -1
- package/packages/bundled-features/src/user/handlers/update-roles.ts +1 -1
- package/packages/bundled-features/src/user/handlers/update.write.ts +1 -1
- package/packages/bundled-features/src/user/index.ts +1 -1
- package/packages/bundled-features/src/user/invited-global-roles.ts +1 -1
- package/packages/bundled-features/src/user/schema/user.ts +1 -1
- package/packages/bundled-features/src/user/{constants.ts → web/constants.ts} +0 -1
- package/packages/bundled-features/src/user-data-rights/changes.json +14 -0
- package/packages/bundled-features/src/user-data-rights/env.ts +1 -1
- package/packages/bundled-features/src/user-data-rights/feature.ts +9 -9
- package/packages/bundled-features/src/user-data-rights/index.ts +1 -1
- package/packages/bundled-features/src/user-data-rights/lib/resolve-tenant-model.ts +1 -1
- package/packages/bundled-features/src/user-data-rights/mail-notifications.ts +1 -1
- package/packages/bundled-features/src/user-data-rights/web/client-plugin.tsx +2 -3
- package/packages/bundled-features/src/user-data-rights/web/confirm-deletion-screen.tsx +0 -1
- package/packages/bundled-features/src/user-data-rights/{constants.ts → web/constants.ts} +11 -12
- package/packages/bundled-features/src/user-data-rights/web/default-translations.ts +91 -0
- package/packages/bundled-features/src/user-data-rights/web/i18n.ts +41 -91
- package/packages/bundled-features/src/user-data-rights/web/index.ts +1 -2
- package/packages/bundled-features/src/user-data-rights/web/privacy-center-screen.tsx +1 -2
- package/packages/bundled-features/src/user-data-rights/web/public-deletion-gate.tsx +0 -1
- package/packages/bundled-features/src/user-data-rights/web/request-deletion-screen.tsx +0 -1
- package/packages/bundled-features/src/user-data-rights-defaults/hooks/file-ref.userdata-hook.ts +10 -1
- package/packages/bundled-features/src/user-profile/feature.ts +2 -2
- package/packages/bundled-features/src/user-profile/handlers/change-email.write.ts +1 -1
- package/packages/bundled-features/src/user-profile/index.ts +3 -2
- package/packages/bundled-features/src/user-profile/web/client-plugin.ts +2 -3
- package/packages/bundled-features/src/user-profile/{constants.ts → web/constants.ts} +0 -1
- package/packages/bundled-features/src/user-profile/{i18n.ts → web/i18n.ts} +0 -1
- package/packages/bundled-features/src/user-profile/web/profile-screen.tsx +2 -3
- package/packages/bundled-features/src/waitlist/changes.json +6 -0
- package/packages/bundled-features/src/waitlist/entity.ts +1 -1
- package/packages/bundled-features/src/waitlist/feature.ts +5 -5
- package/packages/bundled-features/src/waitlist/handlers/export-purge.write.ts +3 -3
- package/packages/bundled-features/src/waitlist/handlers/invite.write.ts +5 -1
- package/packages/bundled-features/src/waitlist/handlers/reject.write.ts +1 -1
- package/packages/bundled-features/src/waitlist/handlers/submit.write.ts +3 -3
- package/packages/bundled-features/src/waitlist/import.ts +1 -1
- package/packages/bundled-features/src/waitlist/index.ts +11 -11
- package/packages/bundled-features/src/waitlist/legacy-migrate.ts +1 -1
- package/packages/bundled-features/src/waitlist/link-on-signup.ts +1 -1
- package/packages/bundled-features/src/waitlist/mail.ts +7 -6
- package/packages/bundled-features/src/waitlist/payloads.ts +1 -1
- package/packages/bundled-features/src/waitlist/screens.ts +1 -1
- package/packages/bundled-features/src/waitlist/{constants.ts → web/constants.ts} +0 -1
- package/samples/apps/styleguide/src/features/content/web.tsx +0 -1
- package/samples/apps/ui-walkthrough/src/app/client.tsx +2 -0
- package/samples/apps/ui-walkthrough/src/app/seed-rental.ts +17 -1
- package/samples/apps/ui-walkthrough/src/app/seed-templates.ts +11 -0
- package/samples/apps/ui-walkthrough/src/app/server.ts +2 -1
- package/samples/apps/ui-walkthrough/src/features/billing/feature.ts +35 -7
- package/samples/apps/ui-walkthrough/src/features/billing/i18n.ts +6 -0
- package/samples/apps/ui-walkthrough/src/features/rental/entities.ts +27 -0
- package/samples/apps/ui-walkthrough/src/features/rental/feature.ts +61 -7
- package/samples/apps/ui-walkthrough/src/features/rental/i18n.ts +48 -24
- package/samples/apps/ui-walkthrough/src/features/rental/invoice-receive.ts +0 -1
- package/samples/apps/ui-walkthrough/src/features/rental/lease-support.ts +17 -1
- package/samples/apps/ui-walkthrough/src/features/rental/qualified-names.ts +3 -0
- package/samples/apps/ui-walkthrough/src/features/rental/receipts-upload.ts +70 -0
- package/samples/apps/ui-walkthrough/src/features/rental/screens.ts +90 -13
- package/samples/apps/ui-walkthrough/src/features/rental/web/index.ts +0 -2
- package/samples/apps/ui-walkthrough/src/features/subscription-plans/feature.ts +103 -0
- package/samples/apps/ui-walkthrough/src/features/subscription-plans/i18n.ts +36 -0
- package/samples/apps/ui-walkthrough/src/features/subscription-plans/index.ts +2 -0
- package/samples/apps/ui-walkthrough/src/features/subscription-plans/seed.ts +21 -0
- package/samples/apps/ui-walkthrough/src/run-config.ts +11 -0
- package/samples/apps/use-all-bundled/e2e-billing-gallery/server.ts +1 -1
- package/samples/apps/use-all-bundled/feature-manifest.json +4 -4
- package/samples/apps/use-all-bundled/scripts/check-coverage.ts +1 -1
- package/samples/apps/use-all-bundled/src/app/dev-app-options.ts +3 -1
- package/samples/recipes/compose-stacks/README.md +1 -2
- package/samples/recipes/embedded/README.md +5 -5
- package/samples/recipes/embedded/src/handlers/invoice-receive.write.ts +0 -1
- package/samples/recipes/embedded/src/screens/invoice-receive.screen.ts +9 -12
- package/samples/recipes/legal-pages/README.md +2 -2
- package/samples/recipes/legal-pages/src/feature.ts +1 -1
- package/samples/recipes/reference-data/src/feature.ts +3 -7
- package/packages/bundled-features/src/admin-shell/i18n.ts +0 -54
- package/packages/bundled-features/src/audit/i18n.ts +0 -25
- package/packages/bundled-features/src/auth-mfa/web/qrcode-browser.d.ts +0 -11
- package/packages/bundled-features/src/jobs/i18n.ts +0 -55
- package/packages/bundled-features/src/managed-pages/i18n.ts +0 -63
- package/packages/bundled-features/src/presets/dsgvo-self-service.ts +0 -35
- package/packages/bundled-features/src/user-data-rights/i18n.ts +0 -44
- package/samples/apps/ui-walkthrough/src/features/rental/web/upload-standard-layout.tsx +0 -61
package/packages/bundled-features/src/billing-foundation/consumer-protection/termination-pages.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { escapeHtml, escapeHtmlAttr } from "@cosmicdrift/kumiko-renderer/headles
|
|
|
6
6
|
import { isOneOf } from "@cosmicdrift/kumiko-types/type-guards";
|
|
7
7
|
import type { Context } from "hono";
|
|
8
8
|
import { getCookie } from "hono/cookie";
|
|
9
|
+
import * as z from "zod";
|
|
9
10
|
import {
|
|
10
11
|
type PublicPageWrapLayout,
|
|
11
12
|
redirectToCanonicalPath,
|
|
@@ -13,11 +14,16 @@ import {
|
|
|
13
14
|
slashVariantOf,
|
|
14
15
|
wrapInLayout,
|
|
15
16
|
} from "../../page-render/index.ts";
|
|
16
|
-
import { SubscriptionFoundationHandlers } from "../constants.ts";
|
|
17
17
|
import { CONTRACT_TERMINATION_DECLARATION_TYPES, CONTRACT_TERMINATION_KINDS } from "../events.ts";
|
|
18
|
+
import { SubscriptionFoundationHandlers } from "../web/constants.ts";
|
|
18
19
|
import type { ConsentLocale } from "./consent-text.ts";
|
|
19
20
|
import { formatReceivedAt } from "./termination-mail.ts";
|
|
20
21
|
import { requestContractTerminationSchema } from "./termination-request.ts";
|
|
22
|
+
import {
|
|
23
|
+
REVOCATION_PATHS,
|
|
24
|
+
type RevocationOutcome,
|
|
25
|
+
revokeContractTerminationSchema,
|
|
26
|
+
} from "./termination-revoke.ts";
|
|
21
27
|
import { type PageTexts, TERMINATION_TEXTS } from "./termination-texts.ts";
|
|
22
28
|
|
|
23
29
|
export type ContractTerminationRoutesOptions = {
|
|
@@ -77,6 +83,8 @@ function pageHeaders(): Record<string, string> {
|
|
|
77
83
|
...headers,
|
|
78
84
|
"content-security-policy": `${headers["content-security-policy"] ?? ""}; frame-ancestors 'none'; form-action 'self'`,
|
|
79
85
|
"x-frame-options": "DENY",
|
|
86
|
+
// The revoke link carries its token in the query string.
|
|
87
|
+
"referrer-policy": "no-referrer",
|
|
80
88
|
};
|
|
81
89
|
}
|
|
82
90
|
|
|
@@ -302,17 +310,19 @@ function reentryHeaders(c: Context): Headers {
|
|
|
302
310
|
return headers;
|
|
303
311
|
}
|
|
304
312
|
|
|
305
|
-
|
|
313
|
+
type PageApp = { fetch: (request: Request, env?: unknown) => Response | Promise<Response> };
|
|
314
|
+
|
|
315
|
+
async function dispatchAnonymousWrite(
|
|
306
316
|
c: Context,
|
|
307
|
-
app:
|
|
317
|
+
app: PageApp,
|
|
308
318
|
clientIp: string,
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
): Promise<
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
> {
|
|
319
|
+
type: string,
|
|
320
|
+
payload: Record<string, string>,
|
|
321
|
+
): Promise<{
|
|
322
|
+
readonly rateLimited: boolean;
|
|
323
|
+
readonly ok: boolean;
|
|
324
|
+
readonly data: WriteResponseBody["data"];
|
|
325
|
+
}> {
|
|
316
326
|
// deps.write only resolves a session user under /api/*; this page lives
|
|
317
327
|
// outside it, so it re-enters the dispatcher through the app like the
|
|
318
328
|
// user-export by-token route. The resolved clientIp as env keeps the
|
|
@@ -323,30 +333,158 @@ async function submitDeclaration(
|
|
|
323
333
|
new Request(`${new URL(c.req.url).origin}/api/write`, {
|
|
324
334
|
method: "POST",
|
|
325
335
|
headers: reentryHeaders(c),
|
|
326
|
-
body: JSON.stringify({
|
|
327
|
-
type: SubscriptionFoundationHandlers.requestContractTermination,
|
|
328
|
-
payload: payloadOf(values, locale),
|
|
329
|
-
}),
|
|
336
|
+
body: JSON.stringify({ type, payload }),
|
|
330
337
|
}),
|
|
331
338
|
clientIp,
|
|
332
339
|
);
|
|
333
340
|
const parsed: WriteResponseBody | null = await response.json().catch(() => null);
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
341
|
+
return {
|
|
342
|
+
rateLimited: response.status === 429 || parsed?.error?.code === RATE_LIMITED_CODE,
|
|
343
|
+
ok: response.ok && parsed?.isSuccess === true,
|
|
344
|
+
data: parsed?.data,
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
async function submitDeclaration(
|
|
349
|
+
c: Context,
|
|
350
|
+
app: PageApp,
|
|
351
|
+
clientIp: string,
|
|
352
|
+
values: FormValues,
|
|
353
|
+
locale: ConsentLocale,
|
|
354
|
+
): Promise<
|
|
355
|
+
| { readonly kind: "received"; readonly requestId: string; readonly receivedAtIso: string }
|
|
356
|
+
| { readonly kind: "rate-limited" }
|
|
357
|
+
| { readonly kind: "failed" }
|
|
358
|
+
> {
|
|
359
|
+
const response = await dispatchAnonymousWrite(
|
|
360
|
+
c,
|
|
361
|
+
app,
|
|
362
|
+
clientIp,
|
|
363
|
+
SubscriptionFoundationHandlers.requestContractTermination,
|
|
364
|
+
payloadOf(values, locale),
|
|
365
|
+
);
|
|
366
|
+
if (response.rateLimited) return { kind: "rate-limited" };
|
|
367
|
+
const requestId = response.data?.requestId;
|
|
368
|
+
const receivedAtIso = response.data?.receivedAtIso;
|
|
369
|
+
if (response.ok && typeof requestId === "string" && typeof receivedAtIso === "string") {
|
|
345
370
|
return { kind: "received", requestId, receivedAtIso };
|
|
346
371
|
}
|
|
347
372
|
return { kind: "failed" };
|
|
348
373
|
}
|
|
349
374
|
|
|
375
|
+
const revocationOutcomeSchema = z.object({
|
|
376
|
+
outcome: z.enum(["revoked", "already-revoked", "too-late", "invalid"]),
|
|
377
|
+
});
|
|
378
|
+
|
|
379
|
+
type RevocationLinkValues = z.infer<typeof revokeContractTerminationSchema>;
|
|
380
|
+
|
|
381
|
+
// Missing or malformed link parameters answer like a wrong token.
|
|
382
|
+
function revocationValuesOf(source: Record<string, unknown>): RevocationLinkValues | null {
|
|
383
|
+
const text = (key: string): string => {
|
|
384
|
+
const value = source[key];
|
|
385
|
+
return typeof value === "string" ? value : "";
|
|
386
|
+
};
|
|
387
|
+
const parsed = revokeContractTerminationSchema.safeParse({
|
|
388
|
+
requestId: text("r"),
|
|
389
|
+
token: text("t"),
|
|
390
|
+
tenantId: text("tenant"),
|
|
391
|
+
});
|
|
392
|
+
return parsed.success ? parsed.data : null;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
async function submitRevocation(
|
|
396
|
+
c: Context,
|
|
397
|
+
app: PageApp,
|
|
398
|
+
clientIp: string,
|
|
399
|
+
values: RevocationLinkValues,
|
|
400
|
+
): Promise<RevocationOutcome | "rate-limited"> {
|
|
401
|
+
const response = await dispatchAnonymousWrite(
|
|
402
|
+
c,
|
|
403
|
+
app,
|
|
404
|
+
clientIp,
|
|
405
|
+
SubscriptionFoundationHandlers.revokeContractTermination,
|
|
406
|
+
values,
|
|
407
|
+
);
|
|
408
|
+
if (response.rateLimited) return "rate-limited";
|
|
409
|
+
const outcome = revocationOutcomeSchema.safeParse(response.data);
|
|
410
|
+
return response.ok && outcome.success ? outcome.data.outcome : "invalid";
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
function revokeConfirmPage(
|
|
414
|
+
ctx: PageContext,
|
|
415
|
+
revokePath: string,
|
|
416
|
+
values: RevocationLinkValues,
|
|
417
|
+
): Response {
|
|
418
|
+
const { revoke } = TERMINATION_TEXTS[ctx.locale].page;
|
|
419
|
+
const hidden = (
|
|
420
|
+
[
|
|
421
|
+
["r", values.requestId],
|
|
422
|
+
["t", values.token],
|
|
423
|
+
["tenant", values.tenantId],
|
|
424
|
+
] as const
|
|
425
|
+
)
|
|
426
|
+
.map(
|
|
427
|
+
([name, value]) =>
|
|
428
|
+
`<input type="hidden" name="${escapeHtmlAttr(name)}" value="${escapeHtmlAttr(value ?? "")}">`,
|
|
429
|
+
)
|
|
430
|
+
.join("\n");
|
|
431
|
+
const body = `<h1>${escapeHtml(revoke.confirmTitle)}</h1>
|
|
432
|
+
<p>${escapeHtml(revoke.confirmLead)}</p>
|
|
433
|
+
<form method="post" action="${escapeHtmlAttr(revokePath)}" data-kumiko-form="contract-termination-revoke">
|
|
434
|
+
${hidden}
|
|
435
|
+
<button type="submit" data-kumiko-button="revoke">${escapeHtml(revoke.confirmButton)}</button>
|
|
436
|
+
</form>`;
|
|
437
|
+
return htmlResponse(ctx, revoke.confirmTitle, body, 200);
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
function revokeResultPage(ctx: PageContext, outcome: RevocationOutcome | "rate-limited"): Response {
|
|
441
|
+
const { page } = TERMINATION_TEXTS[ctx.locale];
|
|
442
|
+
const { revoke } = page;
|
|
443
|
+
const simple = (title: string, text: string, status: 200 | 400 | 429): Response =>
|
|
444
|
+
htmlResponse(ctx, title, `<h1>${escapeHtml(title)}</h1><p>${escapeHtml(text)}</p>`, status);
|
|
445
|
+
switch (outcome) {
|
|
446
|
+
case "revoked":
|
|
447
|
+
return simple(revoke.revokedTitle, revoke.revokedBody, 200);
|
|
448
|
+
case "already-revoked":
|
|
449
|
+
return simple(revoke.alreadyRevokedTitle, revoke.alreadyRevokedBody, 200);
|
|
450
|
+
case "too-late":
|
|
451
|
+
return simple(revoke.tooLateTitle, revoke.tooLateBody, 200);
|
|
452
|
+
case "rate-limited":
|
|
453
|
+
return simple(page.rateLimitedTitle, page.rateLimitedBody, 429);
|
|
454
|
+
case "invalid":
|
|
455
|
+
return simple(revoke.invalidTitle, revoke.invalidBody, 400);
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
// GET only renders the confirmation form: mail scanners prefetch links, so the
|
|
460
|
+
// state change waits for the POST.
|
|
461
|
+
function revokeRoutesFor(ctx: PageContext): AnonymousExtraRoute[] {
|
|
462
|
+
const revokePath = REVOCATION_PATHS[ctx.locale];
|
|
463
|
+
return [
|
|
464
|
+
{
|
|
465
|
+
method: "GET",
|
|
466
|
+
path: revokePath,
|
|
467
|
+
entry: "anonymous",
|
|
468
|
+
handler: (c) => {
|
|
469
|
+
const values = revocationValuesOf(c.req.query());
|
|
470
|
+
return values === null
|
|
471
|
+
? revokeResultPage(ctx, "invalid")
|
|
472
|
+
: revokeConfirmPage(ctx, revokePath, values);
|
|
473
|
+
},
|
|
474
|
+
},
|
|
475
|
+
{
|
|
476
|
+
method: "POST",
|
|
477
|
+
path: revokePath,
|
|
478
|
+
entry: "anonymous",
|
|
479
|
+
handler: async (c, deps) => {
|
|
480
|
+
const values = revocationValuesOf(await c.req.parseBody());
|
|
481
|
+
if (values === null) return revokeResultPage(ctx, "invalid");
|
|
482
|
+
return revokeResultPage(ctx, await submitRevocation(c, deps.app, deps.clientIp, values));
|
|
483
|
+
},
|
|
484
|
+
},
|
|
485
|
+
];
|
|
486
|
+
}
|
|
487
|
+
|
|
350
488
|
function routesFor(ctx: PageContext): AnonymousExtraRoute[] {
|
|
351
489
|
const { locale, path } = ctx;
|
|
352
490
|
const slashVariant = slashVariantOf(path);
|
|
@@ -409,7 +547,8 @@ export function createContractTerminationRoutes(
|
|
|
409
547
|
en: options.paths?.en ?? DEFAULT_PATHS.en,
|
|
410
548
|
};
|
|
411
549
|
const wrapLayout = options.wrapLayout ?? wrapInLayout;
|
|
412
|
-
return (["de", "en"] as const).flatMap((locale) =>
|
|
413
|
-
|
|
414
|
-
|
|
550
|
+
return (["de", "en"] as const).flatMap((locale) => {
|
|
551
|
+
const pageContext = { locale, path: alternates[locale], wrapLayout, alternates };
|
|
552
|
+
return [...routesFor(pageContext), ...revokeRoutesFor(pageContext)];
|
|
553
|
+
});
|
|
415
554
|
}
|
package/packages/bundled-features/src/billing-foundation/consumer-protection/termination-record.ts
CHANGED
|
@@ -14,25 +14,30 @@ import { UnprocessableError } from "@cosmicdrift/kumiko-framework/errors";
|
|
|
14
14
|
import * as z from "zod";
|
|
15
15
|
import { subscriptionAggregateId, terminationUnmatchedAggregateId } from "../aggregate-id.ts";
|
|
16
16
|
import { resolveProviderPlugin } from "../checkout-core.ts";
|
|
17
|
-
import { isTerminalSubscriptionStatus, SubscriptionCancelTimings } from "../constants.ts";
|
|
18
17
|
import {
|
|
19
18
|
CONTRACT_TERMINATION_CHANNELS,
|
|
20
19
|
CONTRACT_TERMINATION_DECLARATION_TYPES,
|
|
21
20
|
CONTRACT_TERMINATION_DECLARED_EVENT_QN,
|
|
22
21
|
CONTRACT_TERMINATION_KINDS,
|
|
23
22
|
CONTRACT_TERMINATION_REQUESTED_EVENT_QN,
|
|
23
|
+
CONTRACT_TERMINATION_REVOKED_EVENT_QN,
|
|
24
24
|
CONTRACT_TERMINATION_UNMATCHED_AGGREGATE_TYPE,
|
|
25
25
|
CONTRACT_TERMINATION_UNMATCHED_EVENT_QN,
|
|
26
26
|
type ContractTerminationDeclaredPayload,
|
|
27
27
|
type ContractTerminationRequestedPayload,
|
|
28
28
|
type ContractTerminationUnmatchedPayload,
|
|
29
29
|
contractTerminationRequestedPayloadSchema,
|
|
30
|
+
contractTerminationRevokedPayloadSchema,
|
|
30
31
|
type ProviderCancelOutcome,
|
|
31
32
|
SUBSCRIPTION_AGGREGATE_TYPE,
|
|
32
33
|
} from "../events.ts";
|
|
33
|
-
import { getSubscriptionForTenant } from "../get-subscription-for-tenant.ts";
|
|
34
|
+
import { getSubscriptionForTenant, type SubscriptionView } from "../get-subscription-for-tenant.ts";
|
|
34
35
|
import type { ConsumerProtectionOptions, ResolvedBillingFoundationOptions } from "../types.ts";
|
|
35
|
-
import {
|
|
36
|
+
import { isTerminalSubscriptionStatus, SubscriptionCancelTimings } from "../web/constants.ts";
|
|
37
|
+
import {
|
|
38
|
+
CONSENT_LOCALES,
|
|
39
|
+
FALLBACK_CONSENT_LOCALE,
|
|
40
|
+
} from "../web/consumer-protection/consent-locale.ts";
|
|
36
41
|
import { notifyOperator } from "./termination-notify.ts";
|
|
37
42
|
import type { OperatorNoticeReason } from "./termination-texts.ts";
|
|
38
43
|
import { isWithinWithdrawalPeriod } from "./withdrawal-period.ts";
|
|
@@ -64,6 +69,7 @@ export const declareContractTerminationSchema = z
|
|
|
64
69
|
terminationKind: z.enum(CONTRACT_TERMINATION_KINDS),
|
|
65
70
|
receivedAtIso: z.string().min(1),
|
|
66
71
|
locale: z.enum(CONSENT_LOCALES),
|
|
72
|
+
revocationTokenHash: z.string().length(64).optional(),
|
|
67
73
|
})
|
|
68
74
|
.strict();
|
|
69
75
|
|
|
@@ -170,6 +176,51 @@ export function createDeclareContractTerminationHandler(): WriteHandlerDef {
|
|
|
170
176
|
};
|
|
171
177
|
}
|
|
172
178
|
|
|
179
|
+
function revokedRecordResult(receivedAtIso: string) {
|
|
180
|
+
return {
|
|
181
|
+
isSuccess: true as const,
|
|
182
|
+
data: {
|
|
183
|
+
receivedAtIso,
|
|
184
|
+
effectiveAtIso: null,
|
|
185
|
+
providerCancel: "none",
|
|
186
|
+
noticeReason: null,
|
|
187
|
+
withdrawalPeriodExpired: false,
|
|
188
|
+
} satisfies RecordContractTerminationResult,
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// A revocation that landed during the provider cancel found nothing to take back yet.
|
|
193
|
+
async function takeBackLateRevokedCancel(
|
|
194
|
+
ctx: HandlerContext,
|
|
195
|
+
consumerProtection: ConsumerProtectionOptions,
|
|
196
|
+
args: {
|
|
197
|
+
readonly payload: z.infer<typeof recordContractTerminationSchema>;
|
|
198
|
+
readonly tenantId: string;
|
|
199
|
+
readonly receivedAtIso: string;
|
|
200
|
+
readonly providerCancel: ProviderCancelOutcome;
|
|
201
|
+
},
|
|
202
|
+
): Promise<void> {
|
|
203
|
+
const { payload, tenantId, receivedAtIso, providerCancel } = args;
|
|
204
|
+
// skip: nothing was cancelled at the provider, nothing to resume
|
|
205
|
+
if (providerCancel !== "period-end") return;
|
|
206
|
+
const reasons = await resumeAtProvider(ctx, await getSubscriptionForTenant(ctx, tenantId));
|
|
207
|
+
// skip: resumed cleanly, the revocation notice already tells the operator
|
|
208
|
+
if (reasons.length === 0) return;
|
|
209
|
+
await notifyOperator(ctx, consumerProtection, {
|
|
210
|
+
locale: payload.locale ?? FALLBACK_CONSENT_LOCALE,
|
|
211
|
+
requestId: payload.requestId,
|
|
212
|
+
receivedAtIso,
|
|
213
|
+
channel: "public",
|
|
214
|
+
declaration: {
|
|
215
|
+
declarationType: payload.declarationType,
|
|
216
|
+
terminationKind: payload.terminationKind,
|
|
217
|
+
},
|
|
218
|
+
reasons,
|
|
219
|
+
tenantId,
|
|
220
|
+
providerCancel,
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
|
|
173
224
|
export function createRecordContractTerminationHandler(
|
|
174
225
|
options: ResolvedBillingFoundationOptions,
|
|
175
226
|
consumerProtection: ConsumerProtectionOptions,
|
|
@@ -218,6 +269,11 @@ export function createRecordContractTerminationHandler(
|
|
|
218
269
|
};
|
|
219
270
|
}
|
|
220
271
|
|
|
272
|
+
// A revoked public declaration never reaches the provider.
|
|
273
|
+
if (hasRevocation(stream.events, payload.requestId)) {
|
|
274
|
+
return revokedRecordResult(receivedAtIso);
|
|
275
|
+
}
|
|
276
|
+
|
|
221
277
|
const withdrawalPeriodExpired =
|
|
222
278
|
payload.declarationType === "withdrawal" &&
|
|
223
279
|
payload.when === SubscriptionCancelTimings.immediately &&
|
|
@@ -245,6 +301,16 @@ export function createRecordContractTerminationHandler(
|
|
|
245
301
|
aggregateId: subscriptionAggregateId(tenantId),
|
|
246
302
|
aggregateType: SUBSCRIPTION_AGGREGATE_TYPE,
|
|
247
303
|
});
|
|
304
|
+
// A revocation that landed during the provider call found no cancel to take back.
|
|
305
|
+
if (hasRevocation(streamAfterProviderCall.events, payload.requestId)) {
|
|
306
|
+
await takeBackLateRevokedCancel(ctx, consumerProtection, {
|
|
307
|
+
payload,
|
|
308
|
+
tenantId,
|
|
309
|
+
receivedAtIso,
|
|
310
|
+
providerCancel,
|
|
311
|
+
});
|
|
312
|
+
return revokedRecordResult(receivedAtIso);
|
|
313
|
+
}
|
|
248
314
|
await streamAfterProviderCall.appendOne({
|
|
249
315
|
type: CONTRACT_TERMINATION_REQUESTED_EVENT_QN,
|
|
250
316
|
payload: recorded,
|
|
@@ -282,6 +348,39 @@ export function createRecordContractTerminationHandler(
|
|
|
282
348
|
};
|
|
283
349
|
}
|
|
284
350
|
|
|
351
|
+
export function hasRevocation(
|
|
352
|
+
events: readonly { type: string; payload: unknown }[],
|
|
353
|
+
requestId: string,
|
|
354
|
+
) {
|
|
355
|
+
return events.some(
|
|
356
|
+
(e) =>
|
|
357
|
+
e.type === CONTRACT_TERMINATION_REVOKED_EVENT_QN &&
|
|
358
|
+
contractTerminationRevokedPayloadSchema.safeParse(e.payload).data?.requestId === requestId,
|
|
359
|
+
);
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
export async function resumeAtProvider(
|
|
363
|
+
ctx: HandlerContext,
|
|
364
|
+
subscription: SubscriptionView | null,
|
|
365
|
+
): Promise<OperatorNoticeReason[]> {
|
|
366
|
+
if (subscription === null || isTerminalSubscriptionStatus(subscription.status)) {
|
|
367
|
+
return ["revocation_resume_manual"];
|
|
368
|
+
}
|
|
369
|
+
const plugin = findPlugin(ctx, subscription.providerName);
|
|
370
|
+
if (!plugin?.resumeSubscription) return ["revocation_resume_manual"];
|
|
371
|
+
try {
|
|
372
|
+
await plugin.resumeSubscription(ctx, {
|
|
373
|
+
providerSubscriptionId: subscription.providerSubscriptionId,
|
|
374
|
+
});
|
|
375
|
+
} catch (error) {
|
|
376
|
+
ctx.log?.warn(
|
|
377
|
+
`[billing-foundation:revoke-contract-termination] provider resume failed: ${error instanceof Error ? error.message : String(error)}`,
|
|
378
|
+
);
|
|
379
|
+
return ["revocation_resume_failed"];
|
|
380
|
+
}
|
|
381
|
+
return [];
|
|
382
|
+
}
|
|
383
|
+
|
|
285
384
|
function findPlugin(ctx: Parameters<typeof resolveProviderPlugin>[0], providerName: string) {
|
|
286
385
|
try {
|
|
287
386
|
return resolveProviderPlugin(ctx, providerName).plugin;
|
package/packages/bundled-features/src/billing-foundation/consumer-protection/termination-request.ts
CHANGED
|
@@ -15,12 +15,6 @@ import { generateId } from "@cosmicdrift/kumiko-framework/utils";
|
|
|
15
15
|
import * as z from "zod";
|
|
16
16
|
import { TenantQueries } from "../../tenant/index.ts";
|
|
17
17
|
import { UserQueries } from "../../user/index.ts";
|
|
18
|
-
import {
|
|
19
|
-
CONTRACT_TERMINATION_RECEIPT_NOTIFICATION_TYPE,
|
|
20
|
-
SubscriptionCancelTimings,
|
|
21
|
-
SubscriptionFoundationHandlers,
|
|
22
|
-
SubscriptionFoundationQueries,
|
|
23
|
-
} from "../constants.ts";
|
|
24
18
|
import {
|
|
25
19
|
CONTRACT_TERMINATION_DECLARATION_TYPES,
|
|
26
20
|
CONTRACT_TERMINATION_KINDS,
|
|
@@ -30,11 +24,19 @@ import {
|
|
|
30
24
|
} from "../events.ts";
|
|
31
25
|
import { purchaseRolesOf } from "../plan-catalog.ts";
|
|
32
26
|
import type { ConsumerProtectionOptions, ResolvedBillingFoundationOptions } from "../types.ts";
|
|
27
|
+
import {
|
|
28
|
+
CONTRACT_TERMINATION_RECEIPT_NOTIFICATION_TYPE,
|
|
29
|
+
SubscriptionCancelTimings,
|
|
30
|
+
SubscriptionFoundationHandlers,
|
|
31
|
+
SubscriptionFoundationQueries,
|
|
32
|
+
} from "../web/constants.ts";
|
|
33
33
|
import { resolveConsentLocale } from "./consent-text.ts";
|
|
34
|
+
import { openStoredUserEmail } from "./stored-user-email.ts";
|
|
34
35
|
import { type TerminationDeclaration, terminationReceiptVariables } from "./termination-mail.ts";
|
|
35
36
|
import { notifyOperator, type OperatorNoticePlan, requireNotify } from "./termination-notify.ts";
|
|
36
37
|
import { mayMailReceipt } from "./termination-receipt-limit.ts";
|
|
37
38
|
import type { RecordContractTerminationResult } from "./termination-record.ts";
|
|
39
|
+
import { createRevocationToken, revocationUrl } from "./termination-revoke.ts";
|
|
38
40
|
import type { OperatorNoticeReason } from "./termination-texts.ts";
|
|
39
41
|
|
|
40
42
|
const EXTRAORDINARY_REASON_MESSAGE = "reason is required for an extraordinary termination";
|
|
@@ -102,7 +104,10 @@ function needsOperatorNotice(declaration: {
|
|
|
102
104
|
];
|
|
103
105
|
}
|
|
104
106
|
|
|
105
|
-
type TerminationMailPlan = OperatorNoticePlan & {
|
|
107
|
+
type TerminationMailPlan = OperatorNoticePlan & {
|
|
108
|
+
readonly declaration: TerminationDeclaration;
|
|
109
|
+
readonly revokeUrl?: string;
|
|
110
|
+
};
|
|
106
111
|
|
|
107
112
|
async function sendTerminationMails(
|
|
108
113
|
ctx: HandlerContext,
|
|
@@ -122,6 +127,7 @@ async function sendTerminationMails(
|
|
|
122
127
|
terminationKind: plan.declaration.terminationKind,
|
|
123
128
|
},
|
|
124
129
|
operatorEmail: consumerProtection.operatorEmail,
|
|
130
|
+
...(plan.revokeUrl !== undefined && { revokeUrl: plan.revokeUrl }),
|
|
125
131
|
}),
|
|
126
132
|
locale: plan.locale,
|
|
127
133
|
priority: "critical",
|
|
@@ -132,7 +138,8 @@ async function sendTerminationMails(
|
|
|
132
138
|
: [...plan.reasons, "receipt_rate_limited" as const];
|
|
133
139
|
// skip: no operator notice needed for this declaration
|
|
134
140
|
if (reasons.length === 0) return;
|
|
135
|
-
|
|
141
|
+
const { revokeUrl: _revokeUrl, ...noticePlan } = plan;
|
|
142
|
+
await notifyOperator(ctx, consumerProtection, { ...noticePlan, reasons });
|
|
136
143
|
}
|
|
137
144
|
|
|
138
145
|
// Tenants the entered email can terminate a contract for: tenants where the
|
|
@@ -205,6 +212,7 @@ export function createRequestContractTerminationHandler(
|
|
|
205
212
|
const reasons: OperatorNoticeReason[] = [];
|
|
206
213
|
const locale = resolveConsentLocale(payload.locale);
|
|
207
214
|
let matchedTenantId: string | undefined;
|
|
215
|
+
let revokeUrl: string | undefined;
|
|
208
216
|
|
|
209
217
|
const candidates = await findTerminableTenantIds(
|
|
210
218
|
ctx,
|
|
@@ -215,12 +223,30 @@ export function createRequestContractTerminationHandler(
|
|
|
215
223
|
const [onlyCandidate] = candidates;
|
|
216
224
|
if (candidates.length === 1 && onlyCandidate !== undefined) {
|
|
217
225
|
matchedTenantId = onlyCandidate;
|
|
226
|
+
const revocation = createRevocationToken();
|
|
218
227
|
const declared = await ctx.writeAs(
|
|
219
228
|
createSystemUser(onlyCandidate),
|
|
220
229
|
SubscriptionFoundationHandlers.declareContractTermination,
|
|
221
|
-
{
|
|
230
|
+
{
|
|
231
|
+
requestId,
|
|
232
|
+
declarationType,
|
|
233
|
+
terminationKind,
|
|
234
|
+
receivedAtIso,
|
|
235
|
+
locale,
|
|
236
|
+
revocationTokenHash: revocation.tokenHash,
|
|
237
|
+
},
|
|
222
238
|
);
|
|
223
|
-
if (!declared.isSuccess)
|
|
239
|
+
if (!declared.isSuccess) {
|
|
240
|
+
reasons.push("recording_failed");
|
|
241
|
+
} else if (options.baseUrl !== undefined) {
|
|
242
|
+
revokeUrl = revocationUrl({
|
|
243
|
+
baseUrl: options.baseUrl,
|
|
244
|
+
locale,
|
|
245
|
+
requestId,
|
|
246
|
+
token: revocation.token,
|
|
247
|
+
tenantId: onlyCandidate,
|
|
248
|
+
});
|
|
249
|
+
}
|
|
224
250
|
} else {
|
|
225
251
|
reasons.push(candidates.length === 0 ? "unmatched" : "ambiguous");
|
|
226
252
|
const recorded = await ctx.writeAs(
|
|
@@ -255,6 +281,7 @@ export function createRequestContractTerminationHandler(
|
|
|
255
281
|
},
|
|
256
282
|
reasons,
|
|
257
283
|
...(matchedTenantId !== undefined && { tenantId: matchedTenantId }),
|
|
284
|
+
...(revokeUrl !== undefined && { revokeUrl }),
|
|
258
285
|
});
|
|
259
286
|
|
|
260
287
|
return {
|
|
@@ -291,7 +318,11 @@ export function createTerminateContractHandler(
|
|
|
291
318
|
id: event.user.id,
|
|
292
319
|
}),
|
|
293
320
|
);
|
|
294
|
-
|
|
321
|
+
const callerEmail =
|
|
322
|
+
caller.success && caller.data.email && caller.data.isDeleted !== true
|
|
323
|
+
? await openStoredUserEmail(caller.data.email, "billing-foundation:terminate-contract")
|
|
324
|
+
: null;
|
|
325
|
+
if (callerEmail === null) {
|
|
295
326
|
throw new InternalError({
|
|
296
327
|
message: "billing-foundation:terminate-contract: calling user has no email on record",
|
|
297
328
|
});
|
|
@@ -323,7 +354,7 @@ export function createTerminateContractHandler(
|
|
|
323
354
|
declaration: {
|
|
324
355
|
declarationType,
|
|
325
356
|
terminationKind,
|
|
326
|
-
email:
|
|
357
|
+
email: callerEmail,
|
|
327
358
|
...(payload.reason !== undefined && { reason: payload.reason }),
|
|
328
359
|
},
|
|
329
360
|
reasons: [
|