@cosmicdrift/kumiko-samples 0.413.0 → 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 +18 -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 +4 -7
- 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 +62 -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/helpdesk/README.md +9 -5
- package/samples/recipes/helpdesk/src/feature.ts +6 -3
- 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
|
@@ -23,7 +23,7 @@ export const byTenantPublishedQuery = defineQueryHandler({
|
|
|
23
23
|
* logic in by-slug.query. */
|
|
24
24
|
tenantIdOverride: z.string().min(1).optional(),
|
|
25
25
|
}),
|
|
26
|
-
access: { roles: ["anonymous"
|
|
26
|
+
access: { roles: ["anonymous"], anySignedIn: true },
|
|
27
27
|
rateLimit: { per: "ip+handler", limit: 60, windowSeconds: 60 },
|
|
28
28
|
description:
|
|
29
29
|
"Lists every published page of a tenant with slug, language, title and last-change time but no body; use it to enumerate the public pages for sitemap.xml or llms.txt, rather than by-slug which fetches one page's content.",
|
|
@@ -37,19 +37,17 @@ function cacheKeyOf(page: RenderablePageBody): string {
|
|
|
37
37
|
);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
export type UncachedPageBody = Pick<RenderablePageBody, "slug" | "body" | "bodyFormat">;
|
|
41
|
+
|
|
40
42
|
// Writes store the rebuilt, sanitized HTML, but rows can predate that validation
|
|
41
|
-
// or arrive through other writers, so a render still sanitizes
|
|
42
|
-
//
|
|
43
|
-
|
|
44
|
-
export function createPageBodyRenderer(
|
|
43
|
+
// or arrive through other writers, so a render still sanitizes. A rejected document
|
|
44
|
+
// renders as an empty body (never the raw HTML) and is logged.
|
|
45
|
+
export function createUncachedPageBodyRenderer(
|
|
45
46
|
deps: PageBodyRendererDeps = {},
|
|
46
|
-
): (page:
|
|
47
|
+
): (page: UncachedPageBody, log?: WarnLogger) => string {
|
|
47
48
|
const sanitizeDocument = deps.sanitizeDocument ?? sanitizeDocumentHtml;
|
|
48
49
|
const renderMarkdown = deps.renderMarkdown ?? renderSafeMarkdown;
|
|
49
|
-
|
|
50
|
-
const cache = createLruCache<string, string>({ maxEntries });
|
|
51
|
-
|
|
52
|
-
function renderUncached(page: RenderablePageBody, log: WarnLogger): string {
|
|
50
|
+
return (page, log = defaultLog) => {
|
|
53
51
|
if (page.bodyFormat === "markdown") return renderMarkdown(page.body);
|
|
54
52
|
const result = sanitizeDocument(page.body);
|
|
55
53
|
if (result.ok) return result.html;
|
|
@@ -58,7 +56,17 @@ export function createPageBodyRenderer(
|
|
|
58
56
|
violations: result.violations.map((violation) => violation.code),
|
|
59
57
|
});
|
|
60
58
|
return "";
|
|
61
|
-
}
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Sanitizes once per page version instead of once per request; the empty result of a
|
|
63
|
+
// rejected document is cached too.
|
|
64
|
+
export function createPageBodyRenderer(
|
|
65
|
+
deps: PageBodyRendererDeps = {},
|
|
66
|
+
): (page: RenderablePageBody, log?: WarnLogger) => string {
|
|
67
|
+
const renderUncached = createUncachedPageBodyRenderer(deps);
|
|
68
|
+
const maxEntries = deps.maxEntries ?? MAX_CACHED_BODIES;
|
|
69
|
+
const cache = createLruCache<string, string>({ maxEntries });
|
|
62
70
|
|
|
63
71
|
return (page, log = defaultLog) => {
|
|
64
72
|
const key = cacheKeyOf(page);
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
} from "@cosmicdrift/kumiko-framework/engine";
|
|
5
|
-
import { PAGE_BODY_EXTENSION_NAME } from "../web/constants.ts";
|
|
1
|
+
import type { EntityListScreenDefinition } from "@cosmicdrift/kumiko-framework/engine";
|
|
2
|
+
import type { CustomScreenDefinition } from "@cosmicdrift/kumiko-framework/ui-types";
|
|
3
|
+
import { PAGE_EDIT_SCREEN_ID, PAGE_LIST_SCREEN_ID } from "../web/constants.ts";
|
|
6
4
|
|
|
7
5
|
// Admin authoring screens for the `page` entity. These are JSON-safe data only —
|
|
8
6
|
// the generic DataTable/form renderer mounts them, so no React component is
|
|
@@ -16,7 +14,7 @@ import { PAGE_BODY_EXTENSION_NAME } from "../web/constants.ts";
|
|
|
16
14
|
const ADMIN_ROLES = ["TenantAdmin", "SystemAdmin"] as const;
|
|
17
15
|
|
|
18
16
|
export const pageListScreen: EntityListScreenDefinition = {
|
|
19
|
-
id:
|
|
17
|
+
id: PAGE_LIST_SCREEN_ID,
|
|
20
18
|
type: "entityList",
|
|
21
19
|
entity: "page",
|
|
22
20
|
columns: [
|
|
@@ -34,13 +32,16 @@ export const pageListScreen: EntityListScreenDefinition = {
|
|
|
34
32
|
],
|
|
35
33
|
defaultSort: { field: "slug", dir: "asc" },
|
|
36
34
|
searchable: true,
|
|
35
|
+
createScreen: PAGE_EDIT_SCREEN_ID,
|
|
37
36
|
rowActions: [
|
|
38
37
|
{
|
|
39
38
|
kind: "navigate",
|
|
40
39
|
id: "edit",
|
|
41
40
|
label: "managed-pages:actions.edit",
|
|
42
|
-
screen:
|
|
41
|
+
screen: PAGE_EDIT_SCREEN_ID,
|
|
43
42
|
entityId: "id",
|
|
43
|
+
// The generated list opened the entityEdit form on a row click; the custom mask has to say so.
|
|
44
|
+
rowClick: true,
|
|
44
45
|
},
|
|
45
46
|
{
|
|
46
47
|
kind: "writeHandler",
|
|
@@ -58,36 +59,15 @@ export const pageListScreen: EntityListScreenDefinition = {
|
|
|
58
59
|
dormant: true,
|
|
59
60
|
};
|
|
60
61
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
fields: [
|
|
71
|
-
{ field: "slug", span: 1 },
|
|
72
|
-
{ field: "lang", span: 1 },
|
|
73
|
-
{ field: "title", span: 2 },
|
|
74
|
-
{ field: "description", span: 2 },
|
|
75
|
-
{ field: "ogImage", span: 2 },
|
|
76
|
-
// Publish/Unpublish: the `published` toggle here IS the publishing
|
|
77
|
-
// mechanism (there is no separate one-click list action —
|
|
78
|
-
// rowAction-payload cannot inject constants).
|
|
79
|
-
{ field: "published", span: 1 },
|
|
80
|
-
],
|
|
81
|
-
},
|
|
82
|
-
// Not a plain field: the body is edited as a document and a Markdown
|
|
83
|
-
// body is converted on open, so the section also patches `bodyFormat`.
|
|
84
|
-
{
|
|
85
|
-
kind: "extension",
|
|
86
|
-
title: "managed-pages:section.body",
|
|
87
|
-
component: { react: { __component: PAGE_BODY_EXTENSION_NAME } },
|
|
88
|
-
entityName: "page",
|
|
89
|
-
},
|
|
90
|
-
],
|
|
91
|
-
},
|
|
62
|
+
// The page mask sits on the shared editor workbench (settings rail beside an edit/preview body),
|
|
63
|
+
// which no generated form screen offers; the client plugin mounts it under this id.
|
|
64
|
+
export const pageEditScreen: CustomScreenDefinition = {
|
|
65
|
+
id: PAGE_EDIT_SCREEN_ID,
|
|
66
|
+
type: "custom",
|
|
67
|
+
renderer: { react: { __component: PAGE_EDIT_SCREEN_ID } },
|
|
68
|
+
description:
|
|
69
|
+
"Edit or create one managed page: body with live preview as visitors see it (desktop and mobile width) beside the page settings, saved in one step.",
|
|
70
|
+
listScreenId: PAGE_LIST_SCREEN_ID,
|
|
92
71
|
access: { roles: ADMIN_ROLES },
|
|
72
|
+
dormant: true,
|
|
93
73
|
};
|
|
@@ -16,6 +16,7 @@ import { BODY_FORMATS, type BodyFormat, DEFAULT_BODY_FORMAT } from "./constants.
|
|
|
16
16
|
// host via resolveApexTenant during rendering.
|
|
17
17
|
export const pageEntity = createEntity({
|
|
18
18
|
table: "read_pages",
|
|
19
|
+
systemRowsReadable: true,
|
|
19
20
|
description:
|
|
20
21
|
"One tenant-editable public web page, unique per slug and language, holding a markdown or document (HTML) body plus the title, SEO description and OG image, with a published flag that decides whether anonymous visitors are served it or get a 404.",
|
|
21
22
|
fields: {
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
// Client feature factory for managed-pages: translations
|
|
2
|
-
//
|
|
3
|
-
//
|
|
1
|
+
// Client feature factory for managed-pages: translations, the page-edit workbench screen and
|
|
2
|
+
// the "web" preview renderer (the template-resolver one, mounted here too because an app can run
|
|
3
|
+
// the page mask without `textBlocksClient`). Apps mount it in createKumikoApp({ clientFeatures:
|
|
4
4
|
// [managedPagesClient()] }) so the admin labels render translated.
|
|
5
5
|
|
|
6
6
|
import { mergeTranslations, type TranslationsByLocale } from "@cosmicdrift/kumiko-renderer";
|
|
7
7
|
import type { ClientFeatureDefinition } from "@cosmicdrift/kumiko-renderer/web";
|
|
8
|
-
import {
|
|
8
|
+
import { WebPreviewRenderer } from "../../template-resolver/web/index.ts";
|
|
9
|
+
import { PAGE_EDIT_SCREEN_ID } from "./constants.ts";
|
|
9
10
|
import { defaultTranslations } from "./default-translations.ts";
|
|
10
|
-
import {
|
|
11
|
+
import { PageEditScreen } from "./page-edit-screen.tsx";
|
|
11
12
|
|
|
12
13
|
export type ManagedPagesClientOptions = {
|
|
13
14
|
/** Key-wise overrides of the default bundles (de/en). */
|
|
@@ -18,6 +19,7 @@ export function managedPagesClient(options?: ManagedPagesClientOptions): ClientF
|
|
|
18
19
|
return {
|
|
19
20
|
name: "managed-pages",
|
|
20
21
|
translations: mergeTranslations(defaultTranslations, options?.translations ?? {}),
|
|
21
|
-
|
|
22
|
+
contentPreviews: { web: WebPreviewRenderer },
|
|
23
|
+
components: { [PAGE_EDIT_SCREEN_ID]: PageEditScreen },
|
|
22
24
|
};
|
|
23
25
|
}
|
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
import { isOneOf } from "@cosmicdrift/kumiko-types/type-guards";
|
|
2
2
|
|
|
3
3
|
// Pure data shared by the server (screen, handlers, render) and the client plugin.
|
|
4
|
-
|
|
4
|
+
|
|
5
|
+
export const PAGE_CREATE_HANDLER = "managed-pages:write:page:create";
|
|
6
|
+
export const PAGE_UPDATE_HANDLER = "managed-pages:write:page:update";
|
|
7
|
+
export const PAGE_DETAIL_QUERY = "managed-pages:query:page:detail";
|
|
8
|
+
|
|
9
|
+
// Same id for the list's `navigate` row action, the apps' navs and the custom screen component.
|
|
10
|
+
export const PAGE_EDIT_SCREEN_ID = "page-edit";
|
|
11
|
+
export const PAGE_LIST_SCREEN_ID = "page-list";
|
|
5
12
|
|
|
6
13
|
export const BODY_FORMATS = ["markdown", "document"] as const;
|
|
7
14
|
export type BodyFormat = (typeof BODY_FORMATS)[number];
|
|
@@ -45,9 +45,17 @@ export const MANAGED_PAGES_I18N: Readonly<Record<string, LocalizedString>> = {
|
|
|
45
45
|
"managed-pages:entity:__config-edit__:field:logoFile": { en: "Logo file" },
|
|
46
46
|
"managed-pages:entity:__config-edit__:field:layoutPreset": { en: "Layout" },
|
|
47
47
|
|
|
48
|
-
//
|
|
49
|
-
"managed-pages:
|
|
50
|
-
"managed-pages:
|
|
48
|
+
// Page workbench
|
|
49
|
+
"managed-pages:editor.noValue": { en: "Not set" },
|
|
50
|
+
"managed-pages:editor.infoEdit": {
|
|
51
|
+
en: "Edit the page on the left; the right side holds its address and settings.",
|
|
52
|
+
},
|
|
53
|
+
"managed-pages:editor.infoPreview": {
|
|
54
|
+
en: "Preview of the unsaved draft, as visitors will see it.",
|
|
55
|
+
},
|
|
56
|
+
"managed-pages:editor.railPage": { en: "Page" },
|
|
57
|
+
"managed-pages:editor.create": { en: "Create page" },
|
|
58
|
+
"managed-pages:editor.loadFailed": { en: "The page could not be loaded." },
|
|
51
59
|
"managed-pages:branding.section.identity": { en: "Identity" },
|
|
52
60
|
|
|
53
61
|
// Document body: write-time rejection and the Markdown conversion warning
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isAllowedDocumentLinkHref } from "@cosmicdrift/kumiko-bundled-features/template-resolver/document-
|
|
1
|
+
import { isAllowedDocumentLinkHref } from "@cosmicdrift/kumiko-bundled-features/template-resolver/document-link-policy";
|
|
2
2
|
import { escapeHtml } from "@cosmicdrift/kumiko-renderer/headless";
|
|
3
3
|
import { Marked } from "marked";
|
|
4
4
|
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { propertyOf } from "@cosmicdrift/kumiko-types/type-guards";
|
|
2
|
+
import { effectiveBodyFormat } from "./constants.ts";
|
|
3
|
+
import { detectLossyMarkdown, type LossyMarkdownFeature } from "./lossy-markdown.ts";
|
|
4
|
+
import { markdownToDocumentHtml } from "./markdown-to-document.ts";
|
|
5
|
+
|
|
6
|
+
export type PageDraft = {
|
|
7
|
+
readonly slug: string;
|
|
8
|
+
readonly lang: string;
|
|
9
|
+
readonly title: string;
|
|
10
|
+
readonly description: string;
|
|
11
|
+
readonly ogImage: string;
|
|
12
|
+
readonly published: boolean;
|
|
13
|
+
/** The body as the editor shows it: always a document, a Markdown page is converted on open. */
|
|
14
|
+
readonly bodyHtml: string;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export type PageRecord = {
|
|
18
|
+
readonly id: string;
|
|
19
|
+
readonly version: number;
|
|
20
|
+
readonly slug: string;
|
|
21
|
+
readonly lang: string;
|
|
22
|
+
readonly title: string;
|
|
23
|
+
readonly description: string | null;
|
|
24
|
+
readonly ogImage: string | null;
|
|
25
|
+
readonly published: boolean;
|
|
26
|
+
readonly body: string | null;
|
|
27
|
+
readonly bodyFormat: string | null;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const EMPTY_PAGE_DRAFT: PageDraft = {
|
|
31
|
+
slug: "",
|
|
32
|
+
lang: "en",
|
|
33
|
+
title: "",
|
|
34
|
+
description: "",
|
|
35
|
+
ogImage: "",
|
|
36
|
+
published: false,
|
|
37
|
+
bodyHtml: "",
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export function draftOfRecord(record: PageRecord): PageDraft {
|
|
41
|
+
const body = record.body ?? "";
|
|
42
|
+
return {
|
|
43
|
+
slug: record.slug,
|
|
44
|
+
lang: record.lang,
|
|
45
|
+
title: record.title,
|
|
46
|
+
description: record.description ?? "",
|
|
47
|
+
ogImage: record.ogImage ?? "",
|
|
48
|
+
published: record.published,
|
|
49
|
+
bodyHtml:
|
|
50
|
+
effectiveBodyFormat(record.bodyFormat) === "markdown" ? markdownToDocumentHtml(body) : body,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// What opening a Markdown page would lose; nothing is converted in storage until the user saves.
|
|
55
|
+
export function lossyFeaturesOfRecord(record: PageRecord): readonly LossyMarkdownFeature[] {
|
|
56
|
+
return effectiveBodyFormat(record.bodyFormat) === "markdown"
|
|
57
|
+
? detectLossyMarkdown(record.body ?? "")
|
|
58
|
+
: [];
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export function isDraftDirty(draft: PageDraft, initial: PageDraft): boolean {
|
|
62
|
+
return (
|
|
63
|
+
draft.slug !== initial.slug ||
|
|
64
|
+
draft.lang !== initial.lang ||
|
|
65
|
+
draft.title !== initial.title ||
|
|
66
|
+
draft.description !== initial.description ||
|
|
67
|
+
draft.ogImage !== initial.ogImage ||
|
|
68
|
+
draft.published !== initial.published ||
|
|
69
|
+
draft.bodyHtml !== initial.bodyHtml
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function nullable(value: string): string | null {
|
|
74
|
+
return value === "" ? null : value;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** Create payload: every field. Update payload: only what differs, as the update handler expects. */
|
|
78
|
+
export function createPayloadOf(draft: PageDraft): Readonly<Record<string, unknown>> {
|
|
79
|
+
return {
|
|
80
|
+
slug: draft.slug,
|
|
81
|
+
lang: draft.lang,
|
|
82
|
+
title: draft.title,
|
|
83
|
+
description: nullable(draft.description),
|
|
84
|
+
ogImage: nullable(draft.ogImage),
|
|
85
|
+
published: draft.published,
|
|
86
|
+
body: nullable(draft.bodyHtml),
|
|
87
|
+
bodyFormat: "document",
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export function changesOf(draft: PageDraft, initial: PageDraft): Readonly<Record<string, unknown>> {
|
|
92
|
+
const all = createPayloadOf(draft);
|
|
93
|
+
const before = createPayloadOf(initial);
|
|
94
|
+
const changes: Record<string, unknown> = {};
|
|
95
|
+
for (const [field, value] of Object.entries(all)) {
|
|
96
|
+
if (field === "bodyFormat") continue;
|
|
97
|
+
if (value !== before[field]) changes[field] = value;
|
|
98
|
+
}
|
|
99
|
+
// The body of a Markdown page is stored as a document once it is edited or converted on save.
|
|
100
|
+
if ("body" in changes) changes["bodyFormat"] = "document";
|
|
101
|
+
return changes;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/** The create handler answers `{ id }`; anything else means the id is unknown and the list opens. */
|
|
105
|
+
export function createdIdOf(data: unknown): string | undefined {
|
|
106
|
+
const id = propertyOf(data, "id");
|
|
107
|
+
return typeof id === "string" ? id : undefined;
|
|
108
|
+
}
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import {
|
|
2
|
+
dispatcherErrorTextWithFieldIssues,
|
|
3
|
+
PreviewPane,
|
|
4
|
+
useMutation,
|
|
5
|
+
useNav,
|
|
6
|
+
usePrimitives,
|
|
7
|
+
useQuery,
|
|
8
|
+
useTranslation,
|
|
9
|
+
useUnsavedInputSource,
|
|
10
|
+
} from "@cosmicdrift/kumiko-renderer";
|
|
11
|
+
import { EditorWorkbench, LoadingState, StatusBadge } from "@cosmicdrift/kumiko-renderer/web";
|
|
12
|
+
import { type ReactNode, useState } from "react";
|
|
13
|
+
import { DocumentContentEditor } from "../../template-resolver/web/index.ts";
|
|
14
|
+
import {
|
|
15
|
+
PAGE_CREATE_HANDLER,
|
|
16
|
+
PAGE_DETAIL_QUERY,
|
|
17
|
+
PAGE_EDIT_SCREEN_ID,
|
|
18
|
+
PAGE_LIST_SCREEN_ID,
|
|
19
|
+
PAGE_UPDATE_HANDLER,
|
|
20
|
+
} from "./constants.ts";
|
|
21
|
+
import type { LossyMarkdownFeature } from "./lossy-markdown.ts";
|
|
22
|
+
import {
|
|
23
|
+
changesOf,
|
|
24
|
+
createdIdOf,
|
|
25
|
+
createPayloadOf,
|
|
26
|
+
draftOfRecord,
|
|
27
|
+
EMPTY_PAGE_DRAFT,
|
|
28
|
+
isDraftDirty,
|
|
29
|
+
lossyFeaturesOfRecord,
|
|
30
|
+
type PageDraft,
|
|
31
|
+
type PageRecord,
|
|
32
|
+
} from "./page-edit-draft.ts";
|
|
33
|
+
import { PageSettingsFields, PageSettingsSummary } from "./page-settings-rail.tsx";
|
|
34
|
+
|
|
35
|
+
const LOSSY_LABEL_KEYS: Readonly<Record<LossyMarkdownFeature, string>> = {
|
|
36
|
+
image: "managed-pages:body.lossy.image",
|
|
37
|
+
blockquote: "managed-pages:body.lossy.blockquote",
|
|
38
|
+
code: "managed-pages:body.lossy.code",
|
|
39
|
+
deepHeading: "managed-pages:body.lossy.deepHeading",
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const BODY_EDITOR_ID = "managed-pages-page-body";
|
|
43
|
+
const TEST_ID = "page-workbench";
|
|
44
|
+
|
|
45
|
+
function PageEditor({
|
|
46
|
+
record,
|
|
47
|
+
onSaved,
|
|
48
|
+
}: {
|
|
49
|
+
readonly record: PageRecord | null;
|
|
50
|
+
readonly onSaved: (id: string | undefined) => void;
|
|
51
|
+
}): ReactNode {
|
|
52
|
+
const t = useTranslation();
|
|
53
|
+
const { Banner } = usePrimitives();
|
|
54
|
+
const initial = record === null ? EMPTY_PAGE_DRAFT : draftOfRecord(record);
|
|
55
|
+
const lossyOnOpen = record === null ? [] : lossyFeaturesOfRecord(record);
|
|
56
|
+
const [draft, setDraft] = useState<PageDraft>(initial);
|
|
57
|
+
const [bodyEdited, setBodyEdited] = useState(false);
|
|
58
|
+
const [resetCount, setResetCount] = useState(0);
|
|
59
|
+
const [saveError, setSaveError] = useState<string | null>(null);
|
|
60
|
+
const create = useMutation<{ readonly id?: string }>(PAGE_CREATE_HANDLER);
|
|
61
|
+
const update = useMutation(PAGE_UPDATE_HANDLER);
|
|
62
|
+
const dirty = isDraftDirty(draft, initial);
|
|
63
|
+
useUnsavedInputSource(() => dirty);
|
|
64
|
+
|
|
65
|
+
const patch = (changes: Partial<PageDraft>): void =>
|
|
66
|
+
setDraft((current) => ({ ...current, ...changes }));
|
|
67
|
+
const canSave = dirty && draft.slug !== "" && draft.title !== "";
|
|
68
|
+
|
|
69
|
+
const save = async (): Promise<void> => {
|
|
70
|
+
setSaveError(null);
|
|
71
|
+
const result =
|
|
72
|
+
record === null
|
|
73
|
+
? await create.mutate(createPayloadOf(draft))
|
|
74
|
+
: await update.mutate({
|
|
75
|
+
id: record.id,
|
|
76
|
+
version: record.version,
|
|
77
|
+
changes: changesOf(draft, initial),
|
|
78
|
+
});
|
|
79
|
+
if (!result.isSuccess) {
|
|
80
|
+
setSaveError(dispatcherErrorTextWithFieldIssues(result.error, t));
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
onSaved(record === null ? createdIdOf(result.data) : record.id);
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
const discard = (): void => {
|
|
87
|
+
setDraft(initial);
|
|
88
|
+
setBodyEdited(false);
|
|
89
|
+
setSaveError(null);
|
|
90
|
+
setResetCount((count) => count + 1);
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
const showLossy = lossyOnOpen.length > 0 && !bodyEdited;
|
|
94
|
+
const title =
|
|
95
|
+
record === null
|
|
96
|
+
? t("screen:page-edit.createTitle")
|
|
97
|
+
: draft.title === ""
|
|
98
|
+
? t("screen:page-edit.title")
|
|
99
|
+
: draft.title;
|
|
100
|
+
const publishedLabel = t(
|
|
101
|
+
`managed-pages:entity:page:field:published:option:${draft.published ? "true" : "false"}`,
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
return (
|
|
105
|
+
<EditorWorkbench
|
|
106
|
+
testId={TEST_ID}
|
|
107
|
+
title={title}
|
|
108
|
+
status={
|
|
109
|
+
<StatusBadge tone={draft.published ? "ok" : "muted"} testId={`${TEST_ID}-status`}>
|
|
110
|
+
{publishedLabel}
|
|
111
|
+
</StatusBadge>
|
|
112
|
+
}
|
|
113
|
+
info={{
|
|
114
|
+
edit: t("managed-pages:editor.infoEdit"),
|
|
115
|
+
preview: t("managed-pages:editor.infoPreview"),
|
|
116
|
+
}}
|
|
117
|
+
banners={
|
|
118
|
+
showLossy && (
|
|
119
|
+
<Banner variant="warning">
|
|
120
|
+
{t("managed-pages:body.lossy.warning", {
|
|
121
|
+
features: lossyOnOpen.map((feature) => t(LOSSY_LABEL_KEYS[feature])).join(", "),
|
|
122
|
+
})}
|
|
123
|
+
</Banner>
|
|
124
|
+
)
|
|
125
|
+
}
|
|
126
|
+
edit={
|
|
127
|
+
<div className="min-h-0 flex-1 overflow-y-auto px-8 py-6">
|
|
128
|
+
<DocumentContentEditor
|
|
129
|
+
key={resetCount}
|
|
130
|
+
id={BODY_EDITOR_ID}
|
|
131
|
+
value={draft.bodyHtml}
|
|
132
|
+
onChange={(bodyHtml) => {
|
|
133
|
+
setBodyEdited(true);
|
|
134
|
+
patch({ bodyHtml });
|
|
135
|
+
}}
|
|
136
|
+
variables={[]}
|
|
137
|
+
readOnly={false}
|
|
138
|
+
/>
|
|
139
|
+
</div>
|
|
140
|
+
}
|
|
141
|
+
preview={
|
|
142
|
+
<PreviewPane
|
|
143
|
+
target="web"
|
|
144
|
+
content={draft.bodyHtml}
|
|
145
|
+
editFormat="document"
|
|
146
|
+
variables={{}}
|
|
147
|
+
subject={{ kind: "body" }}
|
|
148
|
+
/>
|
|
149
|
+
}
|
|
150
|
+
rail={{
|
|
151
|
+
edit: <PageSettingsFields draft={draft} onPatch={patch} testId={`${TEST_ID}-rail`} />,
|
|
152
|
+
preview: <PageSettingsSummary draft={draft} testId={`${TEST_ID}-rail-preview`} />,
|
|
153
|
+
}}
|
|
154
|
+
save={{
|
|
155
|
+
busy: create.pending || update.pending,
|
|
156
|
+
canSave,
|
|
157
|
+
dirty,
|
|
158
|
+
onSave: () => void save(),
|
|
159
|
+
onDiscard: discard,
|
|
160
|
+
saveError,
|
|
161
|
+
...(record === null && { saveLabel: t("managed-pages:editor.create") }),
|
|
162
|
+
}}
|
|
163
|
+
/>
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// Replaces the generated entityEdit form: one submit writes the settings and the body together.
|
|
168
|
+
export function PageEditScreen(): ReactNode {
|
|
169
|
+
const t = useTranslation();
|
|
170
|
+
const { Banner } = usePrimitives();
|
|
171
|
+
const nav = useNav();
|
|
172
|
+
const entityId = nav.route?.entityId;
|
|
173
|
+
const detail = useQuery<PageRecord | null>(
|
|
174
|
+
PAGE_DETAIL_QUERY,
|
|
175
|
+
{ id: entityId ?? "" },
|
|
176
|
+
{ enabled: entityId !== undefined },
|
|
177
|
+
);
|
|
178
|
+
const goAfterSave = (id: string | undefined): void => {
|
|
179
|
+
if (entityId === undefined) {
|
|
180
|
+
if (id === undefined) nav.navigate({ screenId: PAGE_LIST_SCREEN_ID });
|
|
181
|
+
else nav.replace({ screenId: PAGE_EDIT_SCREEN_ID, entityId: id });
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
void detail.refetch();
|
|
185
|
+
};
|
|
186
|
+
if (entityId === undefined) return <PageEditor record={null} onSaved={goAfterSave} />;
|
|
187
|
+
if (detail.error !== null) {
|
|
188
|
+
return <Banner variant="error">{t("managed-pages:editor.loadFailed")}</Banner>;
|
|
189
|
+
}
|
|
190
|
+
if (detail.data === null) return <LoadingState />;
|
|
191
|
+
return (
|
|
192
|
+
<PageEditor
|
|
193
|
+
key={`${detail.data.id}:${detail.data.version}`}
|
|
194
|
+
record={detail.data}
|
|
195
|
+
onSaved={goAfterSave}
|
|
196
|
+
/>
|
|
197
|
+
);
|
|
198
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { usePrimitives, useTranslation } from "@cosmicdrift/kumiko-renderer";
|
|
2
|
+
import { RailField, RailRow, RailSection } from "@cosmicdrift/kumiko-renderer/web";
|
|
3
|
+
import type { ReactNode } from "react";
|
|
4
|
+
import type { PageDraft } from "./page-edit-draft.ts";
|
|
5
|
+
|
|
6
|
+
export function PageSettingsFields({
|
|
7
|
+
draft,
|
|
8
|
+
onPatch: patch,
|
|
9
|
+
testId,
|
|
10
|
+
}: {
|
|
11
|
+
readonly draft: PageDraft;
|
|
12
|
+
readonly onPatch: (changes: Partial<PageDraft>) => void;
|
|
13
|
+
readonly testId: string;
|
|
14
|
+
}): ReactNode {
|
|
15
|
+
const t = useTranslation();
|
|
16
|
+
const { Field, Input } = usePrimitives();
|
|
17
|
+
return (
|
|
18
|
+
<RailSection title={t("managed-pages:editor.railPage")} testId={testId}>
|
|
19
|
+
<RailField>
|
|
20
|
+
<Field id="page-slug" label={t("managed-pages:entity:page:field:slug")} required>
|
|
21
|
+
<Input
|
|
22
|
+
kind="text"
|
|
23
|
+
id="page-slug"
|
|
24
|
+
name="slug"
|
|
25
|
+
value={draft.slug}
|
|
26
|
+
onChange={(slug) => patch({ slug })}
|
|
27
|
+
required
|
|
28
|
+
/>
|
|
29
|
+
</Field>
|
|
30
|
+
<Field id="page-lang" label={t("managed-pages:entity:page:field:lang")} required>
|
|
31
|
+
<Input
|
|
32
|
+
kind="text"
|
|
33
|
+
id="page-lang"
|
|
34
|
+
name="lang"
|
|
35
|
+
value={draft.lang}
|
|
36
|
+
onChange={(lang) => patch({ lang })}
|
|
37
|
+
required
|
|
38
|
+
/>
|
|
39
|
+
</Field>
|
|
40
|
+
<Field id="page-title" label={t("managed-pages:entity:page:field:title")} required>
|
|
41
|
+
<Input
|
|
42
|
+
kind="text"
|
|
43
|
+
id="page-title"
|
|
44
|
+
name="title"
|
|
45
|
+
value={draft.title}
|
|
46
|
+
onChange={(next) => patch({ title: next })}
|
|
47
|
+
required
|
|
48
|
+
/>
|
|
49
|
+
</Field>
|
|
50
|
+
<Field id="page-description" label={t("managed-pages:entity:page:field:description")}>
|
|
51
|
+
<Input
|
|
52
|
+
kind="textarea"
|
|
53
|
+
id="page-description"
|
|
54
|
+
name="description"
|
|
55
|
+
rows={3}
|
|
56
|
+
value={draft.description}
|
|
57
|
+
onChange={(description) => patch({ description })}
|
|
58
|
+
/>
|
|
59
|
+
</Field>
|
|
60
|
+
<Field id="page-og-image" label={t("managed-pages:entity:page:field:ogImage")}>
|
|
61
|
+
<Input
|
|
62
|
+
kind="text"
|
|
63
|
+
id="page-og-image"
|
|
64
|
+
name="ogImage"
|
|
65
|
+
value={draft.ogImage}
|
|
66
|
+
onChange={(ogImage) => patch({ ogImage })}
|
|
67
|
+
/>
|
|
68
|
+
</Field>
|
|
69
|
+
<Field id="page-published" label={t("managed-pages:entity:page:field:published")}>
|
|
70
|
+
<Input
|
|
71
|
+
kind="boolean"
|
|
72
|
+
id="page-published"
|
|
73
|
+
name="published"
|
|
74
|
+
value={draft.published}
|
|
75
|
+
onChange={(published) => patch({ published })}
|
|
76
|
+
/>
|
|
77
|
+
</Field>
|
|
78
|
+
</RailField>
|
|
79
|
+
</RailSection>
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export function PageSettingsSummary({
|
|
84
|
+
draft,
|
|
85
|
+
testId,
|
|
86
|
+
}: {
|
|
87
|
+
readonly draft: PageDraft;
|
|
88
|
+
readonly testId: string;
|
|
89
|
+
}): ReactNode {
|
|
90
|
+
const t = useTranslation();
|
|
91
|
+
const missing = t("managed-pages:editor.noValue");
|
|
92
|
+
const publishedLabel = t(
|
|
93
|
+
`managed-pages:entity:page:field:published:option:${draft.published ? "true" : "false"}`,
|
|
94
|
+
);
|
|
95
|
+
return (
|
|
96
|
+
<RailSection title={t("managed-pages:editor.railPage")} testId={testId}>
|
|
97
|
+
<RailRow
|
|
98
|
+
label={t("managed-pages:entity:page:field:slug")}
|
|
99
|
+
trailing={draft.slug === "" ? missing : `/${draft.slug}`}
|
|
100
|
+
/>
|
|
101
|
+
<RailRow label={t("managed-pages:entity:page:field:lang")} trailing={draft.lang} />
|
|
102
|
+
<RailRow
|
|
103
|
+
label={t("managed-pages:entity:page:field:title")}
|
|
104
|
+
trailing={draft.title === "" ? missing : draft.title}
|
|
105
|
+
/>
|
|
106
|
+
<RailRow
|
|
107
|
+
label={t("managed-pages:entity:page:field:description")}
|
|
108
|
+
trailing={draft.description === "" ? missing : draft.description}
|
|
109
|
+
/>
|
|
110
|
+
<RailRow
|
|
111
|
+
label={t("managed-pages:entity:page:field:ogImage")}
|
|
112
|
+
trailing={draft.ogImage === "" ? missing : draft.ogImage}
|
|
113
|
+
/>
|
|
114
|
+
<RailRow label={t("managed-pages:entity:page:field:published")} trailing={publishedLabel} />
|
|
115
|
+
</RailSection>
|
|
116
|
+
);
|
|
117
|
+
}
|