@cosmicdrift/kumiko-samples 0.413.1 → 0.414.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 +16 -1
- package/packages/bundled-features/src/admin-shell/changes.json +6 -0
- package/packages/bundled-features/src/admin-shell/feature.ts +8 -7
- package/packages/bundled-features/src/agent-tools/agent-doc-lint.ts +5 -1
- package/packages/bundled-features/src/agent-tools/agent-manifest.ts +36 -27
- package/packages/bundled-features/src/agent-tools/api-docs/collect-events.ts +8 -1
- package/packages/bundled-features/src/agent-tools/api-docs/collect.ts +3 -2
- package/packages/bundled-features/src/agent-tools/api-docs/generate.ts +6 -0
- package/packages/bundled-features/src/agent-tools/api-docs/index.ts +1 -0
- package/packages/bundled-features/src/agent-tools/api-docs/problems.ts +38 -1
- package/packages/bundled-features/src/agent-tools/api-docs/render-openapi.ts +1 -0
- package/packages/bundled-features/src/agent-tools/api-docs/resolve-config.ts +17 -0
- package/packages/bundled-features/src/agent-tools/api-docs/scope-slug-collisions.ts +17 -0
- package/packages/bundled-features/src/agent-tools/api-docs/translation-gaps.ts +42 -0
- package/packages/bundled-features/src/agent-tools/api-docs/webhook-example-problems.ts +30 -0
- package/packages/bundled-features/src/agent-tools/changes.json +12 -0
- package/packages/bundled-features/src/agent-tools/index.ts +1 -0
- package/packages/bundled-features/src/agent-tools/labels.ts +19 -6
- package/packages/bundled-features/src/agent-tools/tool-catalog.ts +18 -7
- package/packages/bundled-features/src/agent-tools/tool-dispatch.ts +14 -1
- package/packages/bundled-features/src/agent-tools/types.ts +4 -0
- package/packages/bundled-features/src/audit/event-classification.ts +6 -0
- package/packages/bundled-features/src/audit/web/i18n.ts +1 -0
- package/packages/bundled-features/src/auth-email-password/changes.json +18 -0
- package/packages/bundled-features/src/auth-email-password/errors.ts +0 -13
- package/packages/bundled-features/src/auth-email-password/handlers/invite-signup-complete.write.ts +147 -121
- package/packages/bundled-features/src/auth-email-password/handlers/login-options.query.ts +1 -1
- 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 +0 -1
- package/packages/bundled-features/src/auth-email-password/handlers/request-password-reset.write.ts +0 -1
- package/packages/bundled-features/src/auth-email-password/handlers/self-registration-status.query.ts +1 -1
- package/packages/bundled-features/src/auth-email-password/reset-token.ts +0 -2
- package/packages/bundled-features/src/auth-email-password/seeding.ts +39 -7
- package/packages/bundled-features/src/auth-email-password/unlock-token.ts +0 -2
- package/packages/bundled-features/src/auth-email-password/verification-token.ts +0 -2
- package/packages/bundled-features/src/auth-email-password/web/auth-form-primitives.tsx +2 -2
- package/packages/bundled-features/src/auth-email-password/web/auth-gate.tsx +2 -2
- package/packages/bundled-features/src/auth-email-password/web/auth-redirect.ts +5 -0
- package/packages/bundled-features/src/auth-email-password/web/forgot-password-screen.tsx +1 -6
- package/packages/bundled-features/src/auth-email-password/web/invite-accept-screen.tsx +1 -1
- package/packages/bundled-features/src/auth-email-password/web/return-path.ts +2 -1
- package/packages/bundled-features/src/auth-email-password/web/session.tsx +10 -12
- package/packages/bundled-features/src/auth-email-password/web/signup-screen.tsx +1 -6
- package/packages/bundled-features/src/auth-email-password/web/static-account.ts +6 -1
- package/packages/bundled-features/src/auth-email-password/web/tenant-switcher.tsx +1 -1
- package/packages/bundled-features/src/auth-email-password/web/token-confirm-screen.tsx +4 -5
- package/packages/bundled-features/src/auth-email-password/web/user-menu.tsx +1 -1
- package/packages/bundled-features/src/auth-mfa/web/mfa-code-or-recovery-field.tsx +17 -1
- package/packages/bundled-features/src/auth-mfa/web/mfa-disable-dialog.tsx +1 -1
- package/packages/bundled-features/src/auth-mfa/web/mfa-regenerate-recovery-dialog.tsx +1 -1
- package/packages/bundled-features/src/auth-mfa/web/mfa-setup-preauth-screen.tsx +1 -1
- package/packages/bundled-features/src/auth-mfa/web/mfa-verify-screen.tsx +16 -47
- package/packages/bundled-features/src/auth-mfa-user-data/index.ts +5 -6
- package/packages/bundled-features/src/billing-foundation/aggregate-id.ts +0 -4
- package/packages/bundled-features/src/billing-foundation/changes.json +37 -0
- package/packages/bundled-features/src/billing-foundation/checkout-core.ts +8 -1
- package/packages/bundled-features/src/billing-foundation/checkout-ledger.ts +59 -0
- package/packages/bundled-features/src/billing-foundation/consumer-protection/consent-gate.ts +2 -1
- package/packages/bundled-features/src/billing-foundation/consumer-protection/consent-text.ts +49 -2
- package/packages/bundled-features/src/billing-foundation/consumer-protection/termination-open-cancels.ts +5 -0
- package/packages/bundled-features/src/billing-foundation/consumer-protection/termination-provider-timeout.ts +23 -0
- package/packages/bundled-features/src/billing-foundation/consumer-protection/termination-record.ts +12 -7
- package/packages/bundled-features/src/billing-foundation/consumer-protection/termination-revoke.ts +1 -1
- package/packages/bundled-features/src/billing-foundation/events.ts +49 -10
- package/packages/bundled-features/src/billing-foundation/feature.ts +15 -1
- package/packages/bundled-features/src/billing-foundation/handlers/billing-plans.query.ts +47 -14
- package/packages/bundled-features/src/billing-foundation/handlers/create-checkout-session.write.ts +7 -1
- package/packages/bundled-features/src/billing-foundation/handlers/process-event.write.ts +124 -10
- package/packages/bundled-features/src/billing-foundation/handlers/process-payment-event.write.ts +33 -9
- package/packages/bundled-features/src/billing-foundation/handlers/record-checkout-opened.write.ts +25 -0
- package/packages/bundled-features/src/billing-foundation/handlers/start-plan-checkout.write.ts +7 -1
- package/packages/bundled-features/src/billing-foundation/handlers/switch-plan.write.ts +16 -4
- package/packages/bundled-features/src/billing-foundation/i18n.ts +3 -0
- package/packages/bundled-features/src/billing-foundation/pending-plan-switch.ts +80 -0
- package/packages/bundled-features/src/billing-foundation/scrub-raw-payload-headers.ts +50 -0
- package/packages/bundled-features/src/billing-foundation/types.ts +47 -30
- package/packages/bundled-features/src/billing-foundation/validate-options.ts +18 -0
- package/packages/bundled-features/src/billing-foundation/web/billing-plans-panel.tsx +10 -5
- package/packages/bundled-features/src/billing-foundation/web/cancel-contract-dialog.tsx +1 -1
- package/packages/bundled-features/src/billing-foundation/web/checkout-consent-dialog.tsx +1 -1
- package/packages/bundled-features/src/billing-foundation/web/constants.ts +5 -2
- package/packages/bundled-features/src/billing-foundation/web/plan-switch-confirm-dialog.tsx +1 -1
- package/packages/bundled-features/src/billing-foundation/webhook-handler.ts +65 -17
- package/packages/bundled-features/src/cap-counter/aggregate-id.ts +0 -2
- package/packages/bundled-features/src/cap-counter/changes.json +6 -0
- package/packages/bundled-features/src/cap-counter/stock-cap-guard.ts +19 -4
- package/packages/bundled-features/src/cap-overview/changes.json +6 -0
- package/packages/bundled-features/src/cap-overview/handlers/tenant-caps-list.query.ts +22 -6
- package/packages/bundled-features/src/cap-overview/i18n.ts +1 -0
- package/packages/bundled-features/src/cap-overview/index.ts +1 -0
- package/packages/bundled-features/src/cap-overview/types.ts +11 -1
- package/packages/bundled-features/src/cap-overview/web/cap-cards-panel.tsx +6 -2
- package/packages/bundled-features/src/cap-overview/web/cap-usage-bar.tsx +10 -1
- package/packages/bundled-features/src/cap-overview/web/usage-math.ts +5 -0
- package/packages/bundled-features/src/channel-in-app/changes.json +6 -0
- package/packages/bundled-features/src/channel-in-app/handlers/read-state-by-keys.query.ts +2 -2
- package/packages/bundled-features/src/channel-whatsapp/aggregate-id.ts +29 -0
- package/packages/bundled-features/src/channel-whatsapp/changes.json +8 -0
- package/packages/bundled-features/src/channel-whatsapp/constants.ts +46 -0
- package/packages/bundled-features/src/channel-whatsapp/events.ts +93 -0
- package/packages/bundled-features/src/channel-whatsapp/feature.ts +72 -0
- package/packages/bundled-features/src/channel-whatsapp/graph-client.ts +398 -0
- package/packages/bundled-features/src/channel-whatsapp/in-memory-meta.ts +300 -0
- package/packages/bundled-features/src/channel-whatsapp/inbound-handlers.ts +189 -0
- package/packages/bundled-features/src/channel-whatsapp/index.ts +66 -0
- package/packages/bundled-features/src/channel-whatsapp/meta-signature.ts +26 -0
- package/packages/bundled-features/src/channel-whatsapp/options.ts +149 -0
- package/packages/bundled-features/src/channel-whatsapp/pii.ts +109 -0
- package/packages/bundled-features/src/channel-whatsapp/webhook-normalize.ts +226 -0
- package/packages/bundled-features/src/channel-whatsapp/webhook-routes.ts +185 -0
- package/packages/bundled-features/src/compliance-profiles/handlers/sub-processors.query.ts +1 -1
- package/packages/bundled-features/src/config/changes.json +12 -0
- package/packages/bundled-features/src/config/handlers/set.write.ts +7 -0
- package/packages/bundled-features/src/config/handlers/values.query.ts +8 -1
- package/packages/bundled-features/src/config/index.ts +1 -0
- package/packages/bundled-features/src/config/read-redaction.ts +6 -3
- package/packages/bundled-features/src/config/table.ts +1 -0
- package/packages/bundled-features/src/config/write-helpers.ts +3 -2
- package/packages/bundled-features/src/crypto-shredding/changes.json +18 -0
- package/packages/bundled-features/src/crypto-shredding/constants.ts +2 -0
- package/packages/bundled-features/src/crypto-shredding/handlers/forget-subject.write.ts +38 -18
- package/packages/bundled-features/src/crypto-shredding/index.ts +4 -0
- package/packages/bundled-features/src/crypto-shredding/subject-forget-after-delete-hook.ts +49 -0
- package/packages/bundled-features/src/custom-fields/aggregate-id.ts +0 -1
- package/packages/bundled-features/src/custom-fields/entity.ts +1 -0
- package/packages/bundled-features/src/custom-fields/wire-for-entity.ts +0 -1
- package/packages/bundled-features/src/data-retention/changes.json +12 -0
- package/packages/bundled-features/src/data-retention/erase-notes-of-deleted-row.ts +23 -0
- package/packages/bundled-features/src/data-retention/feature.ts +1 -5
- package/packages/bundled-features/src/data-retention/run-retention-cleanup.ts +38 -18
- package/packages/bundled-features/src/data-retention/tenant-destruction-hold.ts +9 -0
- package/packages/bundled-features/src/delivery/attempt-log-factory.ts +11 -0
- package/packages/bundled-features/src/delivery/attempt-log.ts +3 -3
- package/packages/bundled-features/src/delivery/changes.json +6 -0
- package/packages/bundled-features/src/delivery/channel-context.ts +6 -3
- package/packages/bundled-features/src/delivery/db/queries/preferences.ts +0 -1
- package/packages/bundled-features/src/delivery/delivery-service.ts +3 -0
- package/packages/bundled-features/src/delivery/feature.ts +4 -13
- package/packages/bundled-features/src/delivery/handlers/opted-in-user-ids.query.ts +45 -0
- package/packages/bundled-features/src/delivery/handlers/preferences.query.ts +2 -20
- package/packages/bundled-features/src/delivery/handlers/resubscribe-user.write.ts +2 -25
- package/packages/bundled-features/src/delivery/handlers/unsubscribe-page-chrome.query.ts +2 -0
- package/packages/bundled-features/src/delivery/handlers/unsubscribe-user.write.ts +2 -27
- package/packages/bundled-features/src/delivery/index.ts +3 -1
- package/packages/bundled-features/src/delivery/options.ts +11 -0
- package/packages/bundled-features/src/delivery/preference-rows.ts +33 -0
- package/packages/bundled-features/src/delivery/set-preference-enabled.ts +40 -0
- package/packages/bundled-features/src/delivery/testing.ts +3 -1
- package/packages/bundled-features/src/delivery/types.ts +1 -0
- package/packages/bundled-features/src/delivery/unsubscribe-page.ts +7 -1
- package/packages/bundled-features/src/delivery/upsert-preference.ts +0 -1
- package/packages/bundled-features/src/delivery/web/public-names.ts +1 -0
- package/packages/bundled-features/src/derivatives-sharp/render.ts +9 -9
- package/packages/bundled-features/src/document-ingest-foundation/aggregate-id.ts +0 -1
- package/packages/bundled-features/src/document-ingest-foundation/append-missing-extract-event.ts +37 -25
- package/packages/bundled-features/src/document-ingest-foundation/report-ingest-progress.ts +32 -14
- package/packages/bundled-features/src/documents/aggregate-id.ts +0 -2
- package/packages/bundled-features/src/documents/changes.json +18 -0
- package/packages/bundled-features/src/documents/constants.ts +10 -2
- package/packages/bundled-features/src/documents/ensure-link.ts +3 -4
- package/packages/bundled-features/src/documents/feature.ts +28 -6
- package/packages/bundled-features/src/documents/handlers/import.write.ts +2 -2
- package/packages/bundled-features/src/documents/queries/expiry-overview.query.ts +2 -1
- package/packages/bundled-features/src/documents/queries/for-record.query.ts +3 -4
- package/packages/bundled-features/src/documents/queries/list-page.ts +11 -3
- package/packages/bundled-features/src/documents/queries/overview.query.ts +2 -2
- package/packages/bundled-features/src/documents/screens.ts +8 -3
- package/packages/bundled-features/src/documents/tab.ts +1 -1
- package/packages/bundled-features/src/feature-toggles/toggle-sync-signal.ts +6 -3
- package/packages/bundled-features/src/file-derivatives/handlers/public-variant-by-file-ref.query.ts +1 -1
- package/packages/bundled-features/src/file-derivatives/handlers/public-variant.query.ts +1 -1
- package/packages/bundled-features/src/file-foundation/probe.ts +9 -3
- package/packages/bundled-features/src/file-foundation/read-file-ref-content.ts +24 -11
- package/packages/bundled-features/src/file-provider-inmemory/feature.ts +1 -1
- package/packages/bundled-features/src/file-provider-s3/changes.json +14 -0
- package/packages/bundled-features/src/file-provider-s3/env-feature.ts +1 -1
- package/packages/bundled-features/src/file-provider-s3/env-named-feature.ts +1 -1
- package/packages/bundled-features/src/file-provider-s3/env-schema.ts +24 -7
- package/packages/bundled-features/src/file-provider-s3/feature.ts +1 -1
- package/packages/bundled-features/src/file-provider-s3/index.ts +7 -1
- package/packages/bundled-features/src/file-provider-s3/lib/env-helper.ts +21 -13
- package/packages/bundled-features/src/file-provider-s3/lib/s3-provider.ts +8 -1
- package/packages/bundled-features/src/files/changes.json +7 -0
- package/packages/bundled-features/src/folders/aggregate-id.ts +0 -1
- package/packages/bundled-features/src/folders/web/folder-manager.tsx +6 -6
- package/packages/bundled-features/src/folders-user-data/index.ts +12 -14
- package/packages/bundled-features/src/helpdesk/changes.json +50 -0
- package/packages/bundled-features/src/helpdesk/entity.ts +4 -1
- package/packages/bundled-features/src/helpdesk/feature.ts +41 -0
- package/packages/bundled-features/src/helpdesk/handlers/access.ts +0 -10
- package/packages/bundled-features/src/helpdesk/handlers/attempts.ts +7 -14
- package/packages/bundled-features/src/helpdesk/handlers/challenge.query.ts +1 -2
- package/packages/bundled-features/src/helpdesk/handlers/reply.write.ts +2 -9
- package/packages/bundled-features/src/helpdesk/handlers/report.write.ts +2 -9
- package/packages/bundled-features/src/helpdesk/handlers/submit.write.ts +3 -11
- package/packages/bundled-features/src/helpdesk/index.ts +1 -0
- package/packages/bundled-features/src/helpdesk/legacy-contact-config.ts +61 -0
- package/packages/bundled-features/src/helpdesk/legacy-contact-erasure.ts +45 -0
- package/packages/bundled-features/src/helpdesk/legacy-contact-retention.ts +65 -0
- package/packages/bundled-features/src/helpdesk/legacy-contact-streams.ts +185 -0
- package/packages/bundled-features/src/helpdesk/legacy-contact-user-data.ts +84 -0
- package/packages/bundled-features/src/helpdesk/lib.ts +47 -34
- package/packages/bundled-features/src/helpdesk/user-data-hooks.ts +89 -48
- package/packages/bundled-features/src/helpdesk/web/constants.ts +0 -1
- package/packages/bundled-features/src/inbound-mail-foundation/account-health.ts +1 -1
- package/packages/bundled-features/src/inbound-mail-foundation/account-poll.ts +5 -1
- package/packages/bundled-features/src/inbound-mail-foundation/aggregate-id.ts +0 -2
- package/packages/bundled-features/src/inbound-mail-foundation/changes.json +48 -0
- package/packages/bundled-features/src/inbound-mail-foundation/constants.ts +6 -0
- package/packages/bundled-features/src/inbound-mail-foundation/content-refetch.ts +15 -1
- package/packages/bundled-features/src/inbound-mail-foundation/entities.ts +64 -15
- package/packages/bundled-features/src/inbound-mail-foundation/events.ts +15 -16
- package/packages/bundled-features/src/inbound-mail-foundation/feature.ts +3 -1
- package/packages/bundled-features/src/inbound-mail-foundation/handlers/account-address.ts +16 -2
- package/packages/bundled-features/src/inbound-mail-foundation/handlers/attach-message-content.write.ts +10 -3
- package/packages/bundled-features/src/inbound-mail-foundation/handlers/connect-account.write.ts +21 -8
- package/packages/bundled-features/src/inbound-mail-foundation/handlers/forget-message.write.ts +73 -0
- package/packages/bundled-features/src/inbound-mail-foundation/i18n.ts +3 -0
- package/packages/bundled-features/src/inbound-mail-foundation/index.ts +1 -0
- package/packages/bundled-features/src/inbound-mail-foundation/oauth-access-token.ts +1 -1
- package/packages/bundled-features/src/inbound-mail-foundation/outbound-mail.ts +2 -0
- package/packages/bundled-features/src/inbound-mail-foundation/personal-address.ts +20 -0
- package/packages/bundled-features/src/inbound-mail-foundation/purge-messages.ts +54 -0
- package/packages/bundled-features/src/inbound-mail-foundation/quarantine.ts +15 -5
- package/packages/bundled-features/src/inbound-mail-foundation/retention-job.ts +1 -5
- package/packages/bundled-features/src/inbound-mail-foundation/retention-sweep.ts +21 -34
- package/packages/bundled-features/src/inbound-mail-foundation/send-from-account.ts +9 -1
- package/packages/bundled-features/src/inbound-mail-foundation/supervisor-ingest.ts +7 -1
- package/packages/bundled-features/src/inbound-mail-foundation/sync-account-now.ts +1 -1
- package/packages/bundled-features/src/inbound-mail-foundation/tenant-destroy-hook.ts +14 -17
- package/packages/bundled-features/src/inbound-mail-foundation/watch-supervisor.ts +1 -1
- package/packages/bundled-features/src/inbound-provider-imap/byte-budget.ts +80 -0
- package/packages/bundled-features/src/inbound-provider-imap/changes.json +13 -0
- package/packages/bundled-features/src/inbound-provider-imap/connect-mailbox.ts +8 -4
- package/packages/bundled-features/src/inbound-provider-imap/connect-my-mailbox.ts +23 -6
- package/packages/bundled-features/src/inbound-provider-imap/connect-target-rate-limit.ts +46 -0
- package/packages/bundled-features/src/inbound-provider-imap/download-batch.ts +47 -10
- package/packages/bundled-features/src/inbound-provider-imap/feature.ts +7 -4
- package/packages/bundled-features/src/inbound-provider-imap/fetch-content.ts +43 -29
- package/packages/bundled-features/src/inbound-provider-imap/i18n.ts +2 -2
- package/packages/bundled-features/src/inbound-provider-imap/parse-message.ts +14 -0
- package/packages/bundled-features/src/inbound-provider-imap/reconnect-mailbox.ts +5 -4
- package/packages/bundled-features/src/inbound-provider-imap/send-mail.ts +39 -7
- package/packages/bundled-features/src/inbound-provider-imap/smtp-client.ts +19 -4
- package/packages/bundled-features/src/inbound-provider-imap/watch-mailbox.ts +8 -23
- package/packages/bundled-features/src/inbound-provider-inmemory/feature.ts +1 -1
- package/packages/bundled-features/src/jobs/events.ts +10 -0
- package/packages/bundled-features/src/jobs/feature.ts +2 -0
- package/packages/bundled-features/src/jobs/handlers/consumer.write.ts +41 -16
- package/packages/bundled-features/src/jobs/web/constants.ts +4 -0
- package/packages/bundled-features/src/mail-foundation/changes.json +6 -0
- package/packages/bundled-features/src/mail-transport-inmemory/feature.ts +1 -1
- package/packages/bundled-features/src/mail-transport-smtp/feature.ts +3 -2
- package/packages/bundled-features/src/managed-pages/changes.json +12 -0
- package/packages/bundled-features/src/managed-pages/handlers/branding.query.ts +1 -1
- package/packages/bundled-features/src/managed-pages/handlers/by-slug.query.ts +1 -1
- package/packages/bundled-features/src/managed-pages/handlers/by-tenant-published.query.ts +1 -1
- package/packages/bundled-features/src/managed-pages/render-page-body.ts +18 -10
- package/packages/bundled-features/src/managed-pages/screens/page-screens.ts +18 -38
- package/packages/bundled-features/src/managed-pages/table.ts +1 -0
- package/packages/bundled-features/src/managed-pages/web/client-plugin.tsx +8 -6
- package/packages/bundled-features/src/managed-pages/web/constants.ts +8 -1
- package/packages/bundled-features/src/managed-pages/web/i18n.ts +11 -3
- package/packages/bundled-features/src/managed-pages/web/markdown-to-document.ts +1 -1
- package/packages/bundled-features/src/managed-pages/web/page-edit-draft.ts +108 -0
- package/packages/bundled-features/src/managed-pages/web/page-edit-screen.tsx +198 -0
- package/packages/bundled-features/src/managed-pages/web/page-settings-rail.tsx +117 -0
- package/packages/bundled-features/src/notes-history-user-data/index.ts +8 -14
- package/packages/bundled-features/src/personal-access-tokens/boot-rules.ts +5 -0
- package/packages/bundled-features/src/personal-access-tokens/handlers/create.write.ts +0 -1
- package/packages/bundled-features/src/personal-access-tokens/scope-events-check.ts +31 -5
- package/packages/bundled-features/src/presence/changes.json +6 -0
- package/packages/bundled-features/src/presence/handlers/list.query.ts +28 -11
- package/packages/bundled-features/src/presence/room.ts +21 -7
- package/packages/bundled-features/src/presence/store.ts +79 -21
- package/packages/bundled-features/src/readiness/changes.json +25 -0
- package/packages/bundled-features/src/readiness/handlers/latest-summary.query.ts +11 -6
- package/packages/bundled-features/src/readiness/handlers/run-probes.write.ts +35 -5
- package/packages/bundled-features/src/readiness/handlers/run-tone.ts +3 -2
- package/packages/bundled-features/src/readiness/handlers/status.query.ts +15 -1
- package/packages/bundled-features/src/readiness/probe-context.ts +11 -10
- package/packages/bundled-features/src/readiness/screens.ts +4 -4
- package/packages/bundled-features/src/readiness/visible-results.ts +5 -3
- package/packages/bundled-features/src/renderer-foundation/api.ts +6 -13
- package/packages/bundled-features/src/renderer-foundation/types.ts +2 -2
- package/packages/bundled-features/src/secrets/changes.json +7 -0
- package/packages/bundled-features/src/secrets/db/queries/read.ts +18 -4
- package/packages/bundled-features/src/secrets/handlers/list.query.ts +8 -2
- package/packages/bundled-features/src/secrets/secret-scope.ts +2 -3
- package/packages/bundled-features/src/secrets/secrets-context.ts +6 -4
- package/packages/bundled-features/src/secrets/write-gate.ts +4 -2
- package/packages/bundled-features/src/seo/handlers/seo-config.query.ts +1 -1
- package/packages/bundled-features/src/shared/acknowledged-system-db.ts +20 -0
- package/packages/bundled-features/src/shared/assert-billing-live.ts +9 -2
- package/packages/bundled-features/src/shared/changes.json +6 -0
- package/packages/bundled-features/src/shared/index.ts +6 -1
- package/packages/bundled-features/src/shared/parent-visibility.ts +25 -1
- package/packages/bundled-features/src/shared/password-hashing.ts +0 -1
- package/packages/bundled-features/src/shared/price-env-shape.ts +1 -4
- package/packages/bundled-features/src/shared/register-user-data-hooks.ts +29 -0
- package/packages/bundled-features/src/shared/require-bootstrap-extension.ts +26 -0
- package/packages/bundled-features/src/shared/send-best-effort.ts +19 -0
- package/packages/bundled-features/src/shared/stream-tenant-backfill.ts +22 -1
- package/packages/bundled-features/src/shared/stream-tenant-derived-state.ts +31 -1
- package/packages/bundled-features/src/step-dispatcher/changes.json +12 -0
- package/packages/bundled-features/src/step-dispatcher/constants.ts +13 -0
- package/packages/bundled-features/src/step-dispatcher/deliver-dispatch-request.ts +47 -2
- package/packages/bundled-features/src/step-dispatcher/feature.ts +28 -1
- package/packages/bundled-features/src/step-dispatcher/mail-runner.ts +0 -1
- package/packages/bundled-features/src/step-dispatcher/sweep-abandoned.ts +57 -0
- package/packages/bundled-features/src/subscription-mollie/changes.json +7 -0
- package/packages/bundled-features/src/subscription-mollie/plugin-methods.ts +5 -3
- package/packages/bundled-features/src/subscription-mollie/verify-webhook.ts +5 -5
- package/packages/bundled-features/src/subscription-paddle/backfill-checkout-ledger.ts +159 -0
- package/packages/bundled-features/src/subscription-paddle/changes.json +13 -0
- package/packages/bundled-features/src/subscription-paddle/checkout-config.query.ts +1 -1
- package/packages/bundled-features/src/subscription-paddle/checkout-methods.ts +2 -8
- package/packages/bundled-features/src/subscription-paddle/constants.ts +1 -2
- package/packages/bundled-features/src/subscription-paddle/feature.ts +26 -24
- package/packages/bundled-features/src/subscription-paddle/ledger-backfill-marker.ts +70 -0
- package/packages/bundled-features/src/subscription-paddle/plan-switch-methods.ts +2 -8
- package/packages/bundled-features/src/subscription-paddle/redeliver-legacy-checkout.ts +36 -0
- package/packages/bundled-features/src/subscription-paddle/runtime.ts +13 -24
- package/packages/bundled-features/src/subscription-paddle/subscription-state.ts +1 -0
- package/packages/bundled-features/src/subscription-paddle/webhook-events.ts +68 -21
- package/packages/bundled-features/src/subscription-stripe/changes.json +7 -0
- package/packages/bundled-features/src/subscription-stripe/feature.ts +5 -0
- package/packages/bundled-features/src/subscription-stripe/plugin-methods.ts +6 -6
- package/packages/bundled-features/src/subscription-stripe/runtime.ts +8 -7
- package/packages/bundled-features/src/subscription-stripe/verify-webhook.ts +24 -6
- package/packages/bundled-features/src/tags/aggregate-id.ts +0 -1
- package/packages/bundled-features/src/tags/web/tag-chip.tsx +4 -5
- package/packages/bundled-features/src/tags/web/tag-manager.tsx +2 -1
- package/packages/bundled-features/src/template-resolver/api.ts +6 -13
- package/packages/bundled-features/src/template-resolver/changes.json +36 -0
- package/packages/bundled-features/src/template-resolver/document-sanitizer.ts +25 -0
- package/packages/bundled-features/src/template-resolver/feature.ts +2 -0
- package/packages/bundled-features/src/template-resolver/handlers/body-preview.query.ts +41 -0
- package/packages/bundled-features/src/template-resolver/handlers/by-slug.query.ts +1 -1
- package/packages/bundled-features/src/template-resolver/handlers/by-tenant.query.ts +1 -1
- package/packages/bundled-features/src/template-resolver/handlers/collection-shared.ts +5 -11
- package/packages/bundled-features/src/template-resolver/handlers/overview.query.ts +3 -2
- package/packages/bundled-features/src/template-resolver/handlers/send-test.write.ts +37 -8
- package/packages/bundled-features/src/template-resolver/linked-resources.ts +2 -5
- package/packages/bundled-features/src/template-resolver/seeding.ts +77 -0
- package/packages/bundled-features/src/template-resolver/table.ts +1 -0
- package/packages/bundled-features/src/template-resolver/template-draft.ts +2 -1
- package/packages/bundled-features/src/template-resolver/template-preview.ts +14 -3
- package/packages/bundled-features/src/template-resolver/testing.ts +0 -2
- package/packages/bundled-features/src/template-resolver/web/client-plugin.tsx +3 -0
- package/packages/bundled-features/src/template-resolver/web/collection-entry-create-form.tsx +33 -33
- package/packages/bundled-features/src/template-resolver/web/constants.ts +7 -0
- package/packages/bundled-features/src/template-resolver/web/content-tree-provider.ts +0 -1
- package/packages/bundled-features/src/template-resolver/web/content-workbench.tsx +142 -0
- package/packages/bundled-features/src/template-resolver/web/document-insert-model.ts +3 -8
- package/packages/bundled-features/src/template-resolver/web/document-link-policy.ts +58 -0
- package/packages/bundled-features/src/template-resolver/web/document-schema.ts +11 -57
- package/packages/bundled-features/src/template-resolver/web/document-tiptap-bubble.tsx +2 -4
- package/packages/bundled-features/src/template-resolver/web/document-tiptap-context.ts +4 -5
- package/packages/bundled-features/src/template-resolver/web/document-tiptap-editor.tsx +2 -2
- package/packages/bundled-features/src/template-resolver/web/document-tiptap-helpers.ts +6 -3
- package/packages/bundled-features/src/template-resolver/web/document-tiptap-toolbar-groups.tsx +2 -3
- package/packages/bundled-features/src/template-resolver/web/editor-handle.ts +1 -0
- package/packages/bundled-features/src/template-resolver/web/fill-document-variables.ts +24 -0
- package/packages/bundled-features/src/template-resolver/web/i18n.ts +14 -0
- package/packages/bundled-features/src/template-resolver/web/index.ts +3 -0
- package/packages/bundled-features/src/template-resolver/web/preview-targets.ts +25 -0
- package/packages/bundled-features/src/template-resolver/web/qualified-names.ts +1 -0
- package/packages/bundled-features/src/template-resolver/web/snippet-preview-renderer.tsx +24 -0
- package/packages/bundled-features/src/template-resolver/web/string-values.ts +7 -0
- package/packages/bundled-features/src/template-resolver/web/text-block-editor.tsx +38 -50
- package/packages/bundled-features/src/template-resolver/web/use-collection-entry-create.ts +7 -0
- package/packages/bundled-features/src/template-resolver/web/use-content-write.ts +1 -3
- package/packages/bundled-features/src/template-resolver/web/use-document-tiptap-model.ts +1 -2
- package/packages/bundled-features/src/template-resolver/web/use-text-block-editor.ts +28 -7
- package/packages/bundled-features/src/template-resolver/web/web-preview-renderer.tsx +126 -0
- package/packages/bundled-features/src/template-resolver-user-data/index.ts +11 -10
- package/packages/bundled-features/src/tenant/changes.json +6 -0
- package/packages/bundled-features/src/tenant/handlers/create.write.ts +7 -8
- package/packages/bundled-features/src/tenant/handlers/list.query.ts +7 -9
- package/packages/bundled-features/src/tenant/handlers/member-directory.query.ts +10 -4
- package/packages/bundled-features/src/tenant/handlers/toggle-enabled.write.ts +1 -1
- package/packages/bundled-features/src/tenant/invited-membership.ts +10 -1
- package/packages/bundled-features/src/tenant/seeding.ts +4 -2
- package/packages/bundled-features/src/tenant/stream-tenant-backfill.ts +5 -1
- package/packages/bundled-features/src/tenant/testing.ts +1 -1
- package/packages/bundled-features/src/tenant-inactivity/check-inactive-tenants.ts +4 -3
- package/packages/bundled-features/src/tenant-inactivity/constants.ts +1 -2
- package/packages/bundled-features/src/tenant-inactivity/handlers/keep-account.write.ts +1 -2
- package/packages/bundled-features/src/tenant-inactivity/state-store.ts +10 -1
- package/packages/bundled-features/src/tenant-lifecycle/changes.json +18 -0
- package/packages/bundled-features/src/tenant-lifecycle/constants.ts +4 -0
- package/packages/bundled-features/src/tenant-lifecycle/run-tenant-destroy.ts +43 -6
- package/packages/bundled-features/src/tenant-lifecycle/stages.ts +15 -2
- package/packages/bundled-features/src/tier-engine/aggregate-id.ts +0 -1
- package/packages/bundled-features/src/tier-engine/changes.json +6 -0
- package/packages/bundled-features/src/tier-engine/feature.ts +8 -2
- package/packages/bundled-features/src/user/changes.json +6 -0
- package/packages/bundled-features/src/user/db/queries/stream-tenant-backfill.ts +2 -1
- package/packages/bundled-features/src/user/handlers/me.query.ts +3 -1
- package/packages/bundled-features/src/user/index.ts +1 -0
- package/packages/bundled-features/src/user/resolve-verified-user-email.ts +17 -0
- package/packages/bundled-features/src/user-data-rights/db/queries/export-jobs.ts +0 -1
- package/packages/bundled-features/src/user-data-rights/handlers/confirm-deletion-by-token.write.ts +1 -1
- package/packages/bundled-features/src/user-data-rights/handlers/download-by-token.query.ts +1 -1
- package/packages/bundled-features/src/user-data-rights/handlers/request-deletion-by-email.write.ts +1 -1
- package/packages/bundled-features/src/user-data-rights/run-export-jobs.ts +0 -2
- package/packages/bundled-features/src/user-data-rights/run-forget-cleanup.ts +3 -3
- package/packages/bundled-features/src/user-data-rights/schema/download-attempt.ts +3 -2
- package/packages/bundled-features/src/user-data-rights/web/confirm-deletion-screen.tsx +1 -1
- package/packages/bundled-features/src/user-data-rights/web/privacy-center-screen.tsx +1 -1
- package/packages/bundled-features/src/user-data-rights/web/request-deletion-screen.tsx +1 -1
- package/packages/bundled-features/src/user-data-rights-defaults/hooks/api-token.userdata-hook.ts +5 -5
- package/packages/bundled-features/src/user-data-rights-defaults/hooks/hard-delete-own-rows-hook.ts +17 -0
- package/packages/bundled-features/src/user-data-rights-defaults/hooks/in-app-message.userdata-hook.ts +5 -5
- package/packages/bundled-features/src/user-data-rights-defaults/hooks/job-run.userdata-hook.ts +2 -1
- package/packages/bundled-features/src/user-data-rights-defaults/hooks/user-session.userdata-hook.ts +5 -5
- package/packages/bundled-features/src/user-profile/handlers/change-email.write.ts +0 -1
- package/packages/bundled-features/src/waitlist/changes.json +6 -0
- package/packages/bundled-features/src/waitlist/handlers/submit.write.ts +4 -28
- package/packages/bundled-features/src/waitlist/lib.ts +2 -7
- package/packages/bundled-features/src/waitlist/user-data-hooks.ts +6 -19
- package/packages/bundled-features/src/workflow-runner/aggregate-id.ts +0 -1
- package/packages/bundled-features/src/workflow-runner/event-trigger.ts +6 -2
- package/packages/bundled-features/src/workflow-runner/feature.ts +1 -5
- package/packages/bundled-features/src/workflow-runner/handlers/resume-run.write.ts +5 -4
- package/packages/bundled-features/src/workflow-runner/runner.ts +2 -0
- package/samples/apps/showcase/src/features/demos/web/pages/dialog.tsx +0 -1
- package/samples/apps/showcase/src/features/demos/web/pages/layout.tsx +1 -1
- package/samples/apps/showcase/src/features/demos/web/pages/sidebar-panel.tsx +0 -1
- package/samples/apps/styleguide/src/features/gallery/web/Gallery.tsx +1 -4
- package/samples/apps/ui-walkthrough/src/features/subscription-plans/feature.ts +6 -2
- package/samples/apps/use-all-bundled/e2e-billing-gallery/gallery-features.ts +12 -14
- package/samples/apps/use-all-bundled/feature-manifest.json +60 -29
- package/samples/apps/use-all-bundled/playwright.billing-docs.config.ts +1 -1
- package/samples/apps/use-all-bundled/playwright.config.ts +1 -0
- package/samples/apps/use-all-bundled/src/app/seed.ts +1 -1
- package/samples/apps/use-all-bundled/src/run-config.ts +2 -1
- package/samples/recipes/auth-mfa/src/web/confirmation-code-step.tsx +32 -10
- package/samples/recipes/chat-channels/README.md +2 -0
- package/samples/recipes/currencies-global/src/entities/currency.ts +1 -0
- package/samples/recipes/managed-pages/README.md +5 -1
- package/samples/recipes/managed-pages/package.json +3 -2
- package/samples/recipes/managed-pages/src/web/branded-preview.tsx +21 -0
- package/samples/recipes/managed-pages/tsconfig.json +8 -0
- package/samples/recipes/pwa-shell/README.md +52 -0
- package/samples/recipes/pwa-shell/bin/server.ts +12 -0
- package/samples/recipes/pwa-shell/package.json +13 -0
- package/samples/recipes/pwa-shell/src/app.ts +34 -0
- package/samples/recipes/rate-limiting/README.md +3 -3
- package/samples/recipes/record-detail-layout/README.md +33 -0
- package/samples/recipes/record-detail-layout/src/feature.ts +525 -44
- package/samples/recipes/record-detail-layout/src/order-board.ts +521 -0
- package/packages/bundled-features/src/managed-pages/web/page-body-section.tsx +0 -72
- package/packages/bundled-features/src/subscription-paddle/tenant-binding.ts +0 -34
- package/packages/bundled-features/src/template-resolver/web/content-field.tsx +0 -61
|
@@ -35,8 +35,9 @@ export const downloadAttemptEntity = createEntity({
|
|
|
35
35
|
jobId: createTextField({ personal: false, reason: "technical_reference" }),
|
|
36
36
|
// User ID for the authenticated job path; NULL for anonymous token-path requests.
|
|
37
37
|
attemptedByUserId: createTextField({ personal: false, reason: "pseudonymous_fk" }),
|
|
38
|
-
//
|
|
39
|
-
//
|
|
38
|
+
// Token-path rows stay on the tenant key even when the job owner is known: ip and user agent
|
|
39
|
+
// come from whoever holds the link, possibly someone other than the owner, and they expire by
|
|
40
|
+
// retention. find "exact" on ip because list-download-attempts filters by IP.
|
|
40
41
|
ip: createTextField({
|
|
41
42
|
maxLength: 64,
|
|
42
43
|
personal: { of: "attemptedByUserId", whenAbsent: "tenant" },
|
|
@@ -44,7 +44,7 @@ export function ConfirmAccountDeletionScreen({
|
|
|
44
44
|
|
|
45
45
|
return (
|
|
46
46
|
<Card
|
|
47
|
-
//
|
|
47
|
+
// biome-ignore lint/plugin: narrow centered confirmation card, not a screen container
|
|
48
48
|
className="w-full max-w-sm mx-auto"
|
|
49
49
|
options={{ padded: false }}
|
|
50
50
|
slots={{
|
|
@@ -100,7 +100,7 @@ export function ExportSection(): ReactNode {
|
|
|
100
100
|
|
|
101
101
|
// While the job is running: poll until Done/Failed, then auto-stop.
|
|
102
102
|
const refetch = statusQuery.refetch;
|
|
103
|
-
//
|
|
103
|
+
// biome-ignore lint/plugin: not yet converted to the framework hook set
|
|
104
104
|
useEffect(() => {
|
|
105
105
|
if (!inProgress || !refetch) return;
|
|
106
106
|
const id = setInterval(() => void refetch(), EXPORT_POLL_MS);
|
|
@@ -50,7 +50,7 @@ export function RequestAccountDeletionScreen({
|
|
|
50
50
|
|
|
51
51
|
return (
|
|
52
52
|
<Card
|
|
53
|
-
//
|
|
53
|
+
// biome-ignore lint/plugin: narrow centered confirmation card, not a screen container
|
|
54
54
|
className="w-full max-w-sm mx-auto"
|
|
55
55
|
options={{ padded: false }}
|
|
56
56
|
slots={{
|
package/packages/bundled-features/src/user-data-rights-defaults/hooks/api-token.userdata-hook.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { UserDataDeleteHook, UserDataExportHook } from "@cosmicdrift/kumiko-framework/engine";
|
|
2
2
|
import { apiTokenTable } from "../../personal-access-tokens/index.ts";
|
|
3
3
|
import { featureMounted } from "./feature-mounted.ts";
|
|
4
|
+
import { hardDeleteOwnRowsDeleteHook } from "./hard-delete-own-rows-hook.ts";
|
|
4
5
|
|
|
5
6
|
// userData-Hooks for personal-access-tokens rows. Same shape as user-session:
|
|
6
7
|
// unmanaged direct-write store (no event stream, rebuild-safe DELETE), and a
|
|
@@ -29,8 +30,7 @@ export const apiTokenExportHook: UserDataExportHook = async (ctx) => {
|
|
|
29
30
|
};
|
|
30
31
|
};
|
|
31
32
|
|
|
32
|
-
export const apiTokenDeleteHook: UserDataDeleteHook =
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
};
|
|
33
|
+
export const apiTokenDeleteHook: UserDataDeleteHook = hardDeleteOwnRowsDeleteHook({
|
|
34
|
+
featureName: "personal-access-tokens",
|
|
35
|
+
table: apiTokenTable,
|
|
36
|
+
});
|
package/packages/bundled-features/src/user-data-rights-defaults/hooks/hard-delete-own-rows-hook.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { UserDataDeleteHook, UserDataHookCtx } from "@cosmicdrift/kumiko-framework/engine";
|
|
2
|
+
import { featureMounted } from "./feature-mounted.ts";
|
|
3
|
+
|
|
4
|
+
type OwnRowsTable = Parameters<UserDataHookCtx["db"]["deleteMany"]>[0];
|
|
5
|
+
|
|
6
|
+
// Unmanaged direct-write stores (no event stream): a direct DELETE is rebuild-safe.
|
|
7
|
+
export function hardDeleteOwnRowsDeleteHook(source: {
|
|
8
|
+
readonly featureName: string;
|
|
9
|
+
readonly table: OwnRowsTable;
|
|
10
|
+
}): UserDataDeleteHook {
|
|
11
|
+
const { featureName, table } = source;
|
|
12
|
+
return async (ctx) => {
|
|
13
|
+
// skip: source feature not mounted — its table doesn't exist, nothing to erase.
|
|
14
|
+
if (!featureMounted(ctx, featureName)) return;
|
|
15
|
+
await ctx.db.deleteMany(table, { userId: ctx.userId, tenantId: ctx.tenantId });
|
|
16
|
+
};
|
|
17
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { UserDataDeleteHook, UserDataExportHook } from "@cosmicdrift/kumiko-framework/engine";
|
|
2
2
|
import { inAppMessagesTable } from "../../channel-in-app/index.ts";
|
|
3
3
|
import { featureMounted } from "./feature-mounted.ts";
|
|
4
|
+
import { hardDeleteOwnRowsDeleteHook } from "./hard-delete-own-rows-hook.ts";
|
|
4
5
|
|
|
5
6
|
// userData-Hooks for channel-in-app's in_app_messages. Plain SQL table (no
|
|
6
7
|
// r.entity, no event stream — see channel-in-app/tables.ts), written by
|
|
@@ -30,8 +31,7 @@ export const inAppMessageExportHook: UserDataExportHook = async (ctx) => {
|
|
|
30
31
|
};
|
|
31
32
|
};
|
|
32
33
|
|
|
33
|
-
export const inAppMessageDeleteHook: UserDataDeleteHook =
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
};
|
|
34
|
+
export const inAppMessageDeleteHook: UserDataDeleteHook = hardDeleteOwnRowsDeleteHook({
|
|
35
|
+
featureName: "channel-in-app",
|
|
36
|
+
table: inAppMessagesTable,
|
|
37
|
+
});
|
package/packages/bundled-features/src/user-data-rights-defaults/hooks/job-run.userdata-hook.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { UserDataDeleteHook, UserDataExportHook } from "@cosmicdrift/kumiko-framework/engine";
|
|
2
|
+
import { systemTenantReadDb } from "@cosmicdrift/kumiko-framework/internal/row-level-security";
|
|
2
3
|
import { jobRunsTable } from "../../jobs/index.ts";
|
|
3
4
|
import { featureMounted } from "./feature-mounted.ts";
|
|
4
5
|
|
|
@@ -10,7 +11,7 @@ import { featureMounted } from "./feature-mounted.ts";
|
|
|
10
11
|
|
|
11
12
|
export const jobRunExportHook: UserDataExportHook = async (ctx) => {
|
|
12
13
|
if (!featureMounted(ctx, "jobs")) return null;
|
|
13
|
-
const rows = await ctx.db.selectMany<Record<string, unknown>>(jobRunsTable, {
|
|
14
|
+
const rows = await systemTenantReadDb(ctx.db).selectMany<Record<string, unknown>>(jobRunsTable, {
|
|
14
15
|
triggeredById: ctx.userId,
|
|
15
16
|
});
|
|
16
17
|
if (rows.length === 0) return null;
|
package/packages/bundled-features/src/user-data-rights-defaults/hooks/user-session.userdata-hook.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { UserDataDeleteHook, UserDataExportHook } from "@cosmicdrift/kumiko-framework/engine";
|
|
2
2
|
import { userSessionTable } from "../../sessions/index.ts";
|
|
3
3
|
import { featureMounted } from "./feature-mounted.ts";
|
|
4
|
+
import { hardDeleteOwnRowsDeleteHook } from "./hard-delete-own-rows-hook.ts";
|
|
4
5
|
|
|
5
6
|
// userData-Hooks for the sessions feature's user-session rows (ip, userAgent).
|
|
6
7
|
//
|
|
@@ -34,8 +35,7 @@ export const userSessionExportHook: UserDataExportHook = async (ctx) => {
|
|
|
34
35
|
};
|
|
35
36
|
};
|
|
36
37
|
|
|
37
|
-
export const userSessionDeleteHook: UserDataDeleteHook =
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
};
|
|
38
|
+
export const userSessionDeleteHook: UserDataDeleteHook = hardDeleteOwnRowsDeleteHook({
|
|
39
|
+
featureName: "sessions",
|
|
40
|
+
table: userSessionTable,
|
|
41
|
+
});
|
|
@@ -13,7 +13,6 @@ import { UserProfileErrors } from "../web/constants.ts";
|
|
|
13
13
|
// Same failure shape as auth-email-password (anti-enumeration):
|
|
14
14
|
// its errors.ts is not part of the feature barrel, but the reason code
|
|
15
15
|
// and i18nKey are stable public API.
|
|
16
|
-
// @wrapper-known error-helper
|
|
17
16
|
function invalidCredentials() {
|
|
18
17
|
return unprocessable(AuthErrors.invalidCredentials, "auth.errors.invalidCredentials");
|
|
19
18
|
}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"version": "0.414.0",
|
|
4
|
+
"type": "fix",
|
|
5
|
+
"title": "Public handlers declare only the anonymous role",
|
|
6
|
+
"detail": "Handlers declaring access.anySignedIn next to the anonymous role list only anonymous in roles (the dropped signed-in roles never had an effect); the SUBMIT_ROLES constant of waitlist is removed."
|
|
7
|
+
},
|
|
2
8
|
{
|
|
3
9
|
"version": "0.411.0",
|
|
4
10
|
"type": "improvement",
|
|
@@ -5,7 +5,6 @@ import {
|
|
|
5
5
|
runInSavepointIfSupported,
|
|
6
6
|
} from "@cosmicdrift/kumiko-framework/db";
|
|
7
7
|
import {
|
|
8
|
-
access,
|
|
9
8
|
defineWriteHandler,
|
|
10
9
|
type HandlerContext,
|
|
11
10
|
type TenantId,
|
|
@@ -13,6 +12,7 @@ import {
|
|
|
13
12
|
} from "@cosmicdrift/kumiko-framework/engine";
|
|
14
13
|
import { InternalError } from "@cosmicdrift/kumiko-framework/errors";
|
|
15
14
|
import { Temporal } from "@cosmicdrift/kumiko-types/temporal";
|
|
15
|
+
import { sendBestEffort } from "../../shared/index.ts";
|
|
16
16
|
import { normalizeEmail, platformActor, waitlistDb, waitlistExecutor } from "../lib.ts";
|
|
17
17
|
import {
|
|
18
18
|
resolveWaitlistMailLocale,
|
|
@@ -33,13 +33,6 @@ const SUBMIT_LOCK_NAMESPACE = 0x776c7374;
|
|
|
33
33
|
const SUBMIT_LOCK_REASON =
|
|
34
34
|
"takes the per-email advisory lock so parallel submits cannot both pass the duplicate check and wraps the admin-recipient resolver in a savepoint so a failing statement cannot abort the submit transaction; TenantDb has neither API";
|
|
35
35
|
|
|
36
|
-
const SUBMIT_ROLES = access.roles(
|
|
37
|
-
...access.anonymous,
|
|
38
|
-
...access.authenticated,
|
|
39
|
-
"Member",
|
|
40
|
-
"TenantAdmin",
|
|
41
|
-
);
|
|
42
|
-
|
|
43
36
|
const OPEN_STATUSES = [WAITLIST_STATUS.Pending, WAITLIST_STATUS.Invited];
|
|
44
37
|
|
|
45
38
|
export type WaitlistSubmitData = { readonly kind: "submitted" };
|
|
@@ -109,29 +102,12 @@ async function resolveAdminRecipient(
|
|
|
109
102
|
}
|
|
110
103
|
}
|
|
111
104
|
|
|
112
|
-
async function sendBestEffort(
|
|
113
|
-
ctx: HandlerContext,
|
|
114
|
-
label: string,
|
|
115
|
-
send: (notify: NonNullable<HandlerContext["notify"]>) => Promise<unknown>,
|
|
116
|
-
): Promise<void> {
|
|
117
|
-
try {
|
|
118
|
-
if (!ctx.notify) {
|
|
119
|
-
throw new InternalError({ message: "ctx.notify unavailable — mount the delivery feature" });
|
|
120
|
-
}
|
|
121
|
-
await send(ctx.notify);
|
|
122
|
-
} catch (err) {
|
|
123
|
-
ctx.obs.log?.warn(`[waitlist:submit] ${label} mail failed`, {
|
|
124
|
-
error: err instanceof Error ? err.message : String(err),
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
105
|
export function createSubmitHandler(opts: WaitlistOptions) {
|
|
130
106
|
const emailRateLimits = opts.emailRateLimits ?? DEFAULT_SUBMIT_EMAIL_RATE_LIMITS;
|
|
131
107
|
return defineWriteHandler<"submit", typeof WaitlistSubmitSchema, WaitlistSubmitData>({
|
|
132
108
|
name: "submit",
|
|
133
109
|
schema: WaitlistSubmitSchema,
|
|
134
|
-
access: { roles:
|
|
110
|
+
access: { roles: ["anonymous"], personalData: "public-intake", anySignedIn: true },
|
|
135
111
|
rateLimit: opts.rateLimit ?? DEFAULT_SUBMIT_RATE_LIMIT,
|
|
136
112
|
// An empty array means "disabled"; boot validation rejects an empty additionalRateLimits.
|
|
137
113
|
...(emailRateLimits.length > 0 && { additionalRateLimits: emailRateLimits }),
|
|
@@ -175,7 +151,7 @@ export function createSubmitHandler(opts: WaitlistOptions) {
|
|
|
175
151
|
);
|
|
176
152
|
if (!created.isSuccess) return created;
|
|
177
153
|
|
|
178
|
-
await sendBestEffort(ctx, "confirmation", (notify) =>
|
|
154
|
+
await sendBestEffort(ctx, "[waitlist:submit] confirmation mail failed", (notify) =>
|
|
179
155
|
notify(WAITLIST_NOTIFICATION_TYPES.confirmation, {
|
|
180
156
|
route: { email },
|
|
181
157
|
data: waitlistConfirmationVariables({
|
|
@@ -187,7 +163,7 @@ export function createSubmitHandler(opts: WaitlistOptions) {
|
|
|
187
163
|
}),
|
|
188
164
|
);
|
|
189
165
|
|
|
190
|
-
await sendBestEffort(ctx, "admin notice", async (notify) => {
|
|
166
|
+
await sendBestEffort(ctx, "[waitlist:submit] admin notice mail failed", async (notify) => {
|
|
191
167
|
// skip: no admin recipient configured
|
|
192
168
|
if (!adminRecipient) return;
|
|
193
169
|
await notify(WAITLIST_NOTIFICATION_TYPES.adminNotice, {
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
SYSTEM_TENANT_ID,
|
|
12
12
|
type TenantId,
|
|
13
13
|
} from "@cosmicdrift/kumiko-framework/engine";
|
|
14
|
-
import {
|
|
14
|
+
import { acknowledgedSystemDb } from "../shared/index.ts";
|
|
15
15
|
import { tenantMembershipsTable } from "../tenant/index.ts";
|
|
16
16
|
import { userTable } from "../user/index.ts";
|
|
17
17
|
import { waitlistEntryEntity, waitlistEntryTable } from "./entity.ts";
|
|
@@ -29,12 +29,7 @@ export function normalizeEmail(email: string): string {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
export function waitlistDb(ctx: Pick<AppContext, "systemDb">): TenantDb {
|
|
32
|
-
|
|
33
|
-
throw new InternalError({
|
|
34
|
-
message: "waitlist requires ctx.systemDb — is r.systemScope() set on the feature?",
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
return ctx.systemDb.acknowledgeCrossTenant(WAITLIST_CROSS_TENANT_REASON);
|
|
32
|
+
return acknowledgedSystemDb(ctx, "waitlist", WAITLIST_CROSS_TENANT_REASON);
|
|
38
33
|
}
|
|
39
34
|
|
|
40
35
|
// Entries are systemStream rows, so every write targets the system tenant's stream.
|
|
@@ -4,29 +4,16 @@ import type {
|
|
|
4
4
|
UserDataExportHook,
|
|
5
5
|
UserDataHookCtx,
|
|
6
6
|
} from "@cosmicdrift/kumiko-framework/engine";
|
|
7
|
-
import { collectErasureFailure,
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
7
|
+
import { collectErasureFailure, throwIfErasureFailed } from "../shared/index.ts";
|
|
8
|
+
import { resolveVerifiedUserEmail } from "../user/index.ts";
|
|
9
|
+
import { platformActor, waitlistExecutor } from "./lib.ts";
|
|
10
10
|
|
|
11
11
|
const PII_DECRYPT_REASON = "waitlist:user-data";
|
|
12
12
|
const ERASE_REASON = "waitlist:user-data-forget";
|
|
13
13
|
const ENTRY_LOOKUP_LIMIT = 100;
|
|
14
14
|
|
|
15
|
-
// Entries are matched by email, so the user must have proven they own it:
|
|
16
|
-
// otherwise registering with someone else's address would expose or erase that
|
|
17
|
-
// person's entries. The forget anonymization leaves emailVerified untouched,
|
|
18
|
-
// so the live row stays a reliable source; only the email needs the pre-tx
|
|
19
|
-
// copy because the user hook has already rewritten it by now.
|
|
20
|
-
async function resolveVerifiedUserEmail(ctx: UserDataHookCtx): Promise<string | null> {
|
|
21
|
-
const row = await ctx.db.fetchOne<{ email: string; emailVerified: boolean }>(userTable, {
|
|
22
|
-
id: ctx.userId,
|
|
23
|
-
});
|
|
24
|
-
if (row?.emailVerified !== true) return null;
|
|
25
|
-
if (ctx.userEmailBeforeDelete) return normalizeEmail(ctx.userEmailBeforeDelete);
|
|
26
|
-
return normalizeEmail(await decryptStoredPii(row.email, "email", PII_DECRYPT_REASON));
|
|
27
|
-
}
|
|
28
|
-
|
|
29
15
|
// Entries are decrypted by the executor's list (subject-encrypted name/email/message).
|
|
16
|
+
// guard:dup-ok executor and foreign-key field differ; a generic executor abstraction would obscure row types.
|
|
30
17
|
async function findEntriesByEmail(ctx: UserDataHookCtx, email: string) {
|
|
31
18
|
const found = await waitlistExecutor.list(
|
|
32
19
|
{ filter: { field: "email", op: "eq", value: email }, limit: ENTRY_LOOKUP_LIMIT },
|
|
@@ -37,7 +24,7 @@ async function findEntriesByEmail(ctx: UserDataHookCtx, email: string) {
|
|
|
37
24
|
}
|
|
38
25
|
|
|
39
26
|
export const waitlistEntryExportHook: UserDataExportHook = async (ctx) => {
|
|
40
|
-
const email = await resolveVerifiedUserEmail(ctx);
|
|
27
|
+
const email = await resolveVerifiedUserEmail(ctx, PII_DECRYPT_REASON);
|
|
41
28
|
// skip: unverified or missing email must not be matched against waitlist entries
|
|
42
29
|
if (!email) return null;
|
|
43
30
|
const rows = await findEntriesByEmail(ctx, email);
|
|
@@ -61,7 +48,7 @@ export const waitlistEntryExportHook: UserDataExportHook = async (ctx) => {
|
|
|
61
48
|
// is purged through the executor (replays on rebuild) and its record subject
|
|
62
49
|
// key is shredded so the event log's ciphertext becomes unreadable.
|
|
63
50
|
export const waitlistEntryDeleteHook: UserDataDeleteHook = async (ctx) => {
|
|
64
|
-
const email = await resolveVerifiedUserEmail(ctx);
|
|
51
|
+
const email = await resolveVerifiedUserEmail(ctx, PII_DECRYPT_REASON);
|
|
65
52
|
// skip: unverified or missing email must not be matched against waitlist entries
|
|
66
53
|
if (!email) return;
|
|
67
54
|
const kms = configuredPiiSubjectKms();
|
|
@@ -14,7 +14,6 @@ const WORKFLOW_RUN_NAMESPACE = "1f8a6c3e-7d2b-4a91-9e3f-5c8b2a41d6f0";
|
|
|
14
14
|
* re-triggers of the same key — those land as version 2, 3, ... on the same
|
|
15
15
|
* stream and each starts its own run; that's out of scope.
|
|
16
16
|
*/
|
|
17
|
-
// @wrapper-known uuid-domain
|
|
18
17
|
export function workflowRunAggregateId(workflowName: string, key: string): string {
|
|
19
18
|
return uuidv5(`${workflowName}|${key}`, WORKFLOW_RUN_NAMESPACE);
|
|
20
19
|
}
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
// the pipeline are not atomic. A throw from startAndRunWorkflow is recorded
|
|
10
10
|
// as `workflow.run-failed` and swallowed, so the dispatcher moves on.
|
|
11
11
|
|
|
12
|
+
import { queryDatabaseNow } from "@cosmicdrift/kumiko-framework/db";
|
|
12
13
|
import type {
|
|
13
14
|
FeatureRegistrar,
|
|
14
15
|
MultiStreamProjectionDefinition,
|
|
@@ -107,7 +108,7 @@ export function registerEventTrigger(r: FeatureRegistrar, workflow: WorkflowDefi
|
|
|
107
108
|
// replay the historical log and fire every side-effect step retroactively.
|
|
108
109
|
startFrom: "now",
|
|
109
110
|
apply: {
|
|
110
|
-
[eventType]: async (event,
|
|
111
|
+
[eventType]: async (event, tx, ctx) => {
|
|
111
112
|
// skip: unreachable — the guard above already established this, but the
|
|
112
113
|
// closure does not carry that narrowing, and re-narrowing here keeps
|
|
113
114
|
// `trigger.filter` below typed without a cast.
|
|
@@ -145,7 +146,10 @@ export function registerEventTrigger(r: FeatureRegistrar, workflow: WorkflowDefi
|
|
|
145
146
|
},
|
|
146
147
|
...(idempotencyKey && { idempotencyKey }),
|
|
147
148
|
// The MSP context is still flat; the runner reads the namespaced shape.
|
|
148
|
-
handlerCtx: {
|
|
149
|
+
handlerCtx: {
|
|
150
|
+
events: { unsafeAppend: ctx.unsafeAppendEvent },
|
|
151
|
+
db: { databaseNow: () => queryDatabaseNow(tx) },
|
|
152
|
+
},
|
|
149
153
|
});
|
|
150
154
|
} catch (error) {
|
|
151
155
|
// Failures outside the step loop (run-started append) have no step yet, so 0.
|
|
@@ -64,11 +64,7 @@ export function createWorkflowRunnerFeature() {
|
|
|
64
64
|
if (!ctx.systemDb) {
|
|
65
65
|
throw new Error("resume-due-runs: ctx.systemDb required (r.systemScope() feature)");
|
|
66
66
|
}
|
|
67
|
-
const tenantId = ctx.systemUser
|
|
68
|
-
if (tenantId === undefined) {
|
|
69
|
-
// skip: cron fired without a perTenant fan-out tenant — nothing scoped
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
67
|
+
const tenantId = ctx.systemUser.tenantId;
|
|
72
68
|
|
|
73
69
|
const dueRows = await selectDueWorkflowRunPending(
|
|
74
70
|
ctx.systemDb.assertTenantMatch(tenantId),
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
// resultKey on steps/wait-for-event.ts) — pre-seeded into stepsAcc below so
|
|
31
31
|
// a subsequent step's resolver can read `ctx.steps[awaits.someKey]`.
|
|
32
32
|
|
|
33
|
-
import { fetchOne } from "@cosmicdrift/kumiko-framework/db";
|
|
33
|
+
import { fetchOne, type TenantDb } from "@cosmicdrift/kumiko-framework/db";
|
|
34
34
|
import {
|
|
35
35
|
buildPipelineSteps,
|
|
36
36
|
computeDefinitionFingerprint,
|
|
@@ -334,7 +334,7 @@ type ResumedPipelineInput = {
|
|
|
334
334
|
};
|
|
335
335
|
};
|
|
336
336
|
|
|
337
|
-
async function runResumedPipeline(ctx: HandlerContext, input: ResumedPipelineInput) {
|
|
337
|
+
async function runResumedPipeline(ctx: HandlerContext, db: TenantDb, input: ResumedPipelineInput) {
|
|
338
338
|
const {
|
|
339
339
|
workflow,
|
|
340
340
|
workflowName,
|
|
@@ -362,10 +362,11 @@ async function runResumedPipeline(ctx: HandlerContext, input: ResumedPipelineInp
|
|
|
362
362
|
stepIndex,
|
|
363
363
|
);
|
|
364
364
|
|
|
365
|
+
// The handler is system-scoped, so ctx.db is unusable; the steps still read the database clock.
|
|
365
366
|
const outcome = await runStepList(
|
|
366
367
|
steps,
|
|
367
368
|
triggerEvent,
|
|
368
|
-
ctx,
|
|
369
|
+
{ ...ctx, db: { ...db, outsideTransaction: undefined } },
|
|
369
370
|
stepsAcc,
|
|
370
371
|
{},
|
|
371
372
|
workflowCtx,
|
|
@@ -514,7 +515,7 @@ export const resumeRunHandler: WriteHandlerDef = {
|
|
|
514
515
|
const resumeFrom =
|
|
515
516
|
pending.suspensionEventType === WORKFLOW_RETRY_SCHEDULED_TYPE ? stepIndex : stepIndex + 1;
|
|
516
517
|
|
|
517
|
-
return runResumedPipeline(ctx, {
|
|
518
|
+
return runResumedPipeline(ctx, db, {
|
|
518
519
|
workflow,
|
|
519
520
|
workflowName,
|
|
520
521
|
runId,
|
|
@@ -77,6 +77,8 @@ export type WorkflowRunFailedPayload = {
|
|
|
77
77
|
|
|
78
78
|
export type WorkflowRunContext = {
|
|
79
79
|
readonly events: Pick<HandlerContext["events"], "unsafeAppend">;
|
|
80
|
+
// wait, waitForEvent and retry derive their wake time from the database clock.
|
|
81
|
+
readonly db: Pick<HandlerContext["db"], "databaseNow">;
|
|
80
82
|
};
|
|
81
83
|
|
|
82
84
|
export class WorkflowSuspensionUnsupportedError extends Error {
|
|
@@ -62,7 +62,6 @@ export function DialogDemo(): ReactNode {
|
|
|
62
62
|
</DemoSection>
|
|
63
63
|
|
|
64
64
|
<DemoSection title="Lightbox">
|
|
65
|
-
{/* kumiko-lint-ignore primitives-discipline clickable image thumbnail (lightbox trigger) — not a text button, <Button> cannot wrap a full-bleed <img> */}
|
|
66
65
|
<button
|
|
67
66
|
type="button"
|
|
68
67
|
onClick={() => setLightboxOpen(true)}
|
|
@@ -31,7 +31,7 @@ function Slot({
|
|
|
31
31
|
readonly className?: string;
|
|
32
32
|
}): ReactNode {
|
|
33
33
|
const toneClass =
|
|
34
|
-
tone === "muted" ? "bg-muted/40" : tone === "actionBar" ? "bg-muted/30" : "bg-card";
|
|
34
|
+
tone === "muted" ? "bg-muted/40" : tone === "actionBar" ? "bg-muted/30" : "bg-card";
|
|
35
35
|
return (
|
|
36
36
|
<div
|
|
37
37
|
className={`flex flex-col items-start justify-center px-3 py-2 ${toneClass} ${className ?? ""}`}
|
|
@@ -104,7 +104,6 @@ export function SidebarPanelDemo(): ReactNode {
|
|
|
104
104
|
</div>
|
|
105
105
|
<div className="flex min-h-0 flex-1 flex-col overflow-y-auto">
|
|
106
106
|
{MAILS.map((mail) => (
|
|
107
|
-
// kumiko-lint-ignore primitives-discipline multi-line clickable row (from/subject/teaser stacked) — the core Button primitive is a single-line inline control
|
|
108
107
|
<button
|
|
109
108
|
type="button"
|
|
110
109
|
key={mail.subject}
|
|
@@ -12,7 +12,7 @@ import type { ReactNode } from "react";
|
|
|
12
12
|
const SWATCHES: ReadonlyArray<readonly [string, string]> = [
|
|
13
13
|
["background", "bg-background"],
|
|
14
14
|
["foreground", "bg-foreground"],
|
|
15
|
-
["card", "bg-card"],
|
|
15
|
+
["card", "bg-card"],
|
|
16
16
|
["primary", "bg-primary"],
|
|
17
17
|
["secondary", "bg-secondary"],
|
|
18
18
|
["muted", "bg-muted"],
|
|
@@ -359,7 +359,6 @@ export function Gallery(): ReactNode {
|
|
|
359
359
|
<div className="flex items-center gap-3 p-2">
|
|
360
360
|
<div className="relative min-w-0 flex-1">
|
|
361
361
|
<Search className="text-muted-foreground absolute left-3 top-1/2 size-4 -translate-y-1/2" />
|
|
362
|
-
{/* kumiko-lint-ignore primitives-discipline readOnly search-pill visual (rounded-full with inset icon) — pattern demo, not a form field */}
|
|
363
362
|
<input
|
|
364
363
|
className="bg-muted/50 placeholder:text-muted-foreground focus-visible:ring-ring h-10 w-full rounded-full border-none pl-9 pr-4 text-sm outline-none focus-visible:ring-2"
|
|
365
364
|
placeholder="Search holdings or tickers…"
|
|
@@ -780,7 +779,6 @@ export function Gallery(): ReactNode {
|
|
|
780
779
|
<Block id="nav" title="Navigation">
|
|
781
780
|
{/* ponytail: static replica of the nav standard — the LIVE nav is
|
|
782
781
|
the sidebar on the left (NavTree), isolated here for the docs. */}
|
|
783
|
-
{/* kumiko-lint-ignore primitives-discipline nav-surface demo (navigation surface, not a card) */}
|
|
784
782
|
<div className="bg-card w-60 rounded-lg border p-3 text-sm shadow-sm">
|
|
785
783
|
<div className="text-muted-foreground/70 px-2 pb-1 pt-2 text-[11px] font-medium uppercase tracking-wider">
|
|
786
784
|
Workspace
|
|
@@ -815,7 +813,6 @@ export function Gallery(): ReactNode {
|
|
|
815
813
|
<div className="flex flex-wrap items-end gap-6">
|
|
816
814
|
{SHADOWS.map(([name, cls]) => (
|
|
817
815
|
<div key={name} className="flex flex-col items-center gap-2">
|
|
818
|
-
{/* kumiko-lint-ignore primitives-discipline elevation-swatch (Foundation-Token-Demo, kein Card) */}
|
|
819
816
|
<div className={`bg-card size-16 rounded-lg ${cls}`} />
|
|
820
817
|
<span className="text-muted-foreground text-xs">{name}</span>
|
|
821
818
|
</div>
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
type SubscriptionProviderPlugin,
|
|
5
5
|
} from "@cosmicdrift/kumiko-bundled-features/billing-foundation";
|
|
6
6
|
import { defineFeature, i18nKey } from "@cosmicdrift/kumiko-framework/engine";
|
|
7
|
+
import { parseJsonOrThrow } from "@cosmicdrift/kumiko-framework/utils";
|
|
7
8
|
import { toKeyFirst } from "../translations";
|
|
8
9
|
import { subscriptionPlansTranslations } from "./i18n";
|
|
9
10
|
|
|
@@ -36,10 +37,13 @@ const PRICES: readonly ProviderPrice[] = [
|
|
|
36
37
|
|
|
37
38
|
// The sample talks to no payment provider: prices are fixed and checkout just returns to the plans screen.
|
|
38
39
|
const mockProvider: SubscriptionProviderPlugin = {
|
|
39
|
-
verifyAndParseWebhook: async (rawBody) =>
|
|
40
|
+
verifyAndParseWebhook: async (rawBody) => parseJsonOrThrow(rawBody, "mock provider webhook body"),
|
|
40
41
|
priceToTier: { [PRICE_IDS.starter]: "starter", [PRICE_IDS.pro]: "pro" },
|
|
41
42
|
retrievePrices: async (_ctx, priceIds) => PRICES.filter((p) => priceIds.includes(p.priceId)),
|
|
42
|
-
createCheckoutSession: async (_ctx, options) => ({
|
|
43
|
+
createCheckoutSession: async (_ctx, options) => ({
|
|
44
|
+
url: options.successUrl,
|
|
45
|
+
providerCheckoutId: `cs_sample_${options.tenantId}`,
|
|
46
|
+
}),
|
|
43
47
|
cancelSubscription: async () => {},
|
|
44
48
|
};
|
|
45
49
|
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
// provider (the only fake — real handlers, real dispatcher), the catalog and
|
|
5
5
|
// the nav entry that makes billing-foundation's dormant plans screen reachable.
|
|
6
6
|
|
|
7
|
+
import { randomUUID } from "node:crypto";
|
|
7
8
|
import {
|
|
8
9
|
createBillingFoundationFeature,
|
|
9
10
|
type ProviderPrice,
|
|
@@ -145,8 +146,8 @@ export function createGalleryEmailFeature(): FeatureDefinition {
|
|
|
145
146
|
});
|
|
146
147
|
}
|
|
147
148
|
|
|
148
|
-
// The page URL carries the
|
|
149
|
-
//
|
|
149
|
+
// The page URL carries the checkout id so the spec can echo it on the webhook, exactly as a real
|
|
150
|
+
// provider names its checkout in the created event.
|
|
150
151
|
const galleryProviderPlugin: SubscriptionProviderPlugin = {
|
|
151
152
|
displayName: "Stripe",
|
|
152
153
|
verifyAndParseWebhook: async (rawBody) => JSON.parse(rawBody),
|
|
@@ -156,17 +157,17 @@ const galleryProviderPlugin: SubscriptionProviderPlugin = {
|
|
|
156
157
|
},
|
|
157
158
|
retrievePrices: async (_ctx, priceIds) => PRICES.filter((p) => priceIds.includes(p.priceId)),
|
|
158
159
|
createCheckoutSession: async (_ctx, options) => {
|
|
160
|
+
const providerCheckoutId = `cs_gallery_${randomUUID()}`;
|
|
159
161
|
const url = new URL(options.successUrl);
|
|
160
|
-
|
|
161
|
-
return { url: url.toString() };
|
|
162
|
+
url.searchParams.set("providerCheckoutId", providerCheckoutId);
|
|
163
|
+
return { url: url.toString(), providerCheckoutId };
|
|
162
164
|
},
|
|
163
165
|
cancelSubscription: async () => {},
|
|
164
166
|
};
|
|
165
167
|
|
|
166
168
|
// Merchant-of-record stand-in: switches plans in the app with fixed figures
|
|
167
|
-
// (Starter to Pro: 6.67 EUR due now, 1.06 EUR of it VAT).
|
|
168
|
-
//
|
|
169
|
-
// through.
|
|
169
|
+
// (Starter to Pro: 6.67 EUR due now, 1.06 EUR of it VAT). The consent of the switch
|
|
170
|
+
// is recorded by billing-foundation before this mock runs.
|
|
170
171
|
const galleryMorProviderPlugin: SubscriptionProviderPlugin = {
|
|
171
172
|
displayName: "Paddle",
|
|
172
173
|
isBillingEnabled: async (ctx) => morEnabledTenants.has(ctx.user.tenantId),
|
|
@@ -179,8 +180,9 @@ const galleryMorProviderPlugin: SubscriptionProviderPlugin = {
|
|
|
179
180
|
createCheckoutSession: async (_ctx, options) => {
|
|
180
181
|
const url = new URL(options.successUrl);
|
|
181
182
|
url.searchParams.set("provider", "mor");
|
|
182
|
-
|
|
183
|
-
|
|
183
|
+
const providerCheckoutId = `txn_gallery_${randomUUID()}`;
|
|
184
|
+
url.searchParams.set("providerCheckoutId", providerCheckoutId);
|
|
185
|
+
return { url: url.toString(), providerCheckoutId };
|
|
184
186
|
},
|
|
185
187
|
cancelSubscription: async () => {},
|
|
186
188
|
previewPlanSwitch: async () => ({
|
|
@@ -191,11 +193,7 @@ const galleryMorProviderPlugin: SubscriptionProviderPlugin = {
|
|
|
191
193
|
...(isDocsVariant && { recurringAmount: 2368, recurringTax: 378 }),
|
|
192
194
|
effectiveAt: "2027-01-15T00:00:00Z",
|
|
193
195
|
}),
|
|
194
|
-
applyPlanSwitch: async (
|
|
195
|
-
if (options.consentId === undefined) {
|
|
196
|
-
throw new Error("gallery MoR mock: plan switch applied without a consent id");
|
|
197
|
-
}
|
|
198
|
-
},
|
|
196
|
+
applyPlanSwitch: async () => {},
|
|
199
197
|
};
|
|
200
198
|
|
|
201
199
|
export const galleryProviderFeature: FeatureDefinition = defineFeature(
|