@cosmicdrift/kumiko-samples 0.406.0 → 0.409.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 +26 -4
- package/packages/bundled-features/src/account-security/feature.ts +9 -1
- package/packages/bundled-features/src/admin-shell/changes.json +6 -0
- package/packages/bundled-features/src/admin-shell/feature.ts +4 -1
- package/packages/bundled-features/src/agent-tools/agent-manifest.ts +1 -0
- package/packages/bundled-features/src/agent-tools/changes.json +6 -0
- package/packages/bundled-features/src/agent-tools/tool-catalog.ts +1 -0
- package/packages/bundled-features/src/agent-tools/types.ts +4 -0
- package/packages/bundled-features/src/audit/event-classification.ts +1 -0
- package/packages/bundled-features/src/auth-email-password/bootstrap.ts +1 -0
- package/packages/bundled-features/src/auth-email-password/errors.ts +18 -66
- package/packages/bundled-features/src/auth-email-password/web/auth-client.ts +30 -64
- package/packages/bundled-features/src/auth-email-password/web/auth-redirect.ts +2 -2
- package/packages/bundled-features/src/auth-email-password/web/confirm-account-unlock-screen.tsx +20 -66
- package/packages/bundled-features/src/auth-email-password/web/index.ts +1 -0
- package/packages/bundled-features/src/auth-email-password/web/read-path-param.ts +8 -0
- package/packages/bundled-features/src/auth-email-password/web/return-path.ts +3 -2
- package/packages/bundled-features/src/auth-email-password/web/token-confirm-screen.tsx +97 -0
- package/packages/bundled-features/src/auth-email-password/web/verify-email-screen.tsx +20 -68
- package/packages/bundled-features/src/auth-foundation/boot-checks.ts +22 -15
- package/packages/bundled-features/src/auth-foundation/boot-rules.ts +33 -0
- package/packages/bundled-features/src/auth-mfa/errors.ts +12 -42
- package/packages/bundled-features/src/auth-mfa/feature-exports.ts +6 -45
- package/packages/bundled-features/src/auth-mfa/feature.ts +8 -19
- package/packages/bundled-features/src/auth-mfa/web/mfa-client.ts +19 -33
- package/packages/bundled-features/src/billing-foundation/consumer-protection/termination-notify.ts +1 -0
- package/packages/bundled-features/src/billing-foundation/web/plan-price.ts +20 -7
- package/packages/bundled-features/src/cap-counter/stock-cap-guard.ts +1 -0
- package/packages/bundled-features/src/channel-in-app/changes.json +7 -0
- package/packages/bundled-features/src/channel-in-app/feature.ts +2 -0
- package/packages/bundled-features/src/channel-in-app/handlers/read-state-by-keys.query.ts +35 -0
- package/packages/bundled-features/src/channel-in-app/in-app-channel.ts +1 -0
- package/packages/bundled-features/src/channel-in-app/tables.ts +5 -1
- package/packages/bundled-features/src/contact/challenge.ts +41 -0
- package/packages/bundled-features/src/contact/changes.json +27 -0
- package/packages/bundled-features/src/contact/client/contact-client-source.ts +203 -0
- package/packages/bundled-features/src/contact/entity.ts +168 -0
- package/packages/bundled-features/src/contact/feature.ts +171 -0
- package/packages/bundled-features/src/contact/handlers/access.ts +17 -0
- package/packages/bundled-features/src/contact/handlers/attempts.ts +76 -0
- package/packages/bundled-features/src/contact/handlers/challenge.query.ts +44 -0
- package/packages/bundled-features/src/contact/handlers/forward-request.write.ts +98 -0
- package/packages/bundled-features/src/contact/handlers/mark-done.write.ts +40 -0
- package/packages/bundled-features/src/contact/handlers/notify-reporter-in-app.write.ts +48 -0
- package/packages/bundled-features/src/contact/handlers/open-count.query.ts +15 -0
- package/packages/bundled-features/src/contact/handlers/open-count.ts +17 -0
- package/packages/bundled-features/src/contact/handlers/replies.query.ts +29 -0
- package/packages/bundled-features/src/contact/handlers/reply.write.ts +197 -0
- package/packages/bundled-features/src/contact/handlers/report.write.ts +126 -0
- package/packages/bundled-features/src/contact/handlers/request-delivery.query.ts +143 -0
- package/packages/bundled-features/src/contact/handlers/request-detail.query.ts +50 -0
- package/packages/bundled-features/src/contact/handlers/request-list.query.ts +14 -0
- package/packages/bundled-features/src/contact/handlers/send-reply-mail.write.ts +124 -0
- package/packages/bundled-features/src/contact/handlers/send-test.write.ts +45 -0
- package/packages/bundled-features/src/contact/handlers/submit.write.ts +194 -0
- package/packages/bundled-features/src/contact/handlers/take-over-uploads.ts +47 -0
- package/packages/bundled-features/src/contact/i18n.ts +189 -0
- package/packages/bundled-features/src/contact/index.ts +29 -0
- package/packages/bundled-features/src/contact/lib.ts +176 -0
- package/packages/bundled-features/src/contact/mail.ts +401 -0
- package/packages/bundled-features/src/contact/options.ts +95 -0
- package/packages/bundled-features/src/contact/panels.ts +28 -0
- package/packages/bundled-features/src/contact/payloads.ts +106 -0
- package/packages/bundled-features/src/contact/pow.ts +22 -0
- package/packages/bundled-features/src/contact/screens.ts +506 -0
- package/packages/bundled-features/src/contact/subject.ts +13 -0
- package/packages/bundled-features/src/contact/user-agent.ts +39 -0
- package/packages/bundled-features/src/contact/user-data-hooks.ts +180 -0
- package/packages/bundled-features/src/contact/web/constants.ts +160 -0
- package/packages/bundled-features/src/contact/web/index.ts +29 -0
- package/packages/bundled-features/src/crypto-shredding/handlers/forget-subject.write.ts +5 -16
- package/packages/bundled-features/src/data-retention/changes.json +6 -0
- package/packages/bundled-features/src/data-retention/feature.ts +16 -2
- package/packages/bundled-features/src/data-retention/index.ts +5 -0
- package/packages/bundled-features/src/data-retention/run-retention-cleanup.ts +138 -41
- package/packages/bundled-features/src/data-retention/tenant-destruction-hold.ts +196 -0
- package/packages/bundled-features/src/delivery/address-opt-out.ts +1 -0
- package/packages/bundled-features/src/delivery/changes.json +7 -0
- package/packages/bundled-features/src/delivery/channel-context.ts +2 -0
- package/packages/bundled-features/src/delivery/delivery-service.ts +29 -5
- package/packages/bundled-features/src/delivery/events.ts +2 -0
- package/packages/bundled-features/src/delivery/feature.ts +3 -2
- package/packages/bundled-features/src/delivery/handlers/attempts-by-keys.query.ts +55 -0
- package/packages/bundled-features/src/delivery/handlers/log.query.ts +1 -1
- package/packages/bundled-features/src/delivery/jobs.ts +5 -0
- package/packages/bundled-features/src/delivery/tables.ts +13 -2
- package/packages/bundled-features/src/delivery/types.ts +3 -0
- package/packages/bundled-features/src/delivery/unsubscribe-page.ts +2 -0
- package/packages/bundled-features/src/delivery/web/delivery-channel-cell.tsx +1 -1
- package/packages/bundled-features/src/delivery/web/delivery-error-cell.tsx +1 -1
- package/packages/bundled-features/src/delivery/web/delivery-status-cell.tsx +1 -1
- package/packages/bundled-features/src/delivery/web/delivery-time-cell.tsx +3 -2
- package/packages/bundled-features/src/delivery/web/delivery-type-cell.tsx +1 -1
- package/packages/bundled-features/src/delivery/web/public-names.ts +1 -0
- package/packages/bundled-features/src/document-ingest-foundation/boot-checks.ts +14 -9
- package/packages/bundled-features/src/document-ingest-foundation/boot-rules.ts +22 -0
- package/packages/bundled-features/src/document-ingest-foundation/changes.json +6 -0
- package/packages/bundled-features/src/document-ingest-foundation/events.ts +17 -0
- package/packages/bundled-features/src/document-ingest-foundation/feature.ts +39 -1
- package/packages/bundled-features/src/document-ingest-foundation/index.ts +10 -0
- package/packages/bundled-features/src/document-ingest-foundation/report-ingest-progress.ts +43 -0
- package/packages/bundled-features/src/document-ingest-foundation/tables.ts +43 -0
- package/packages/bundled-features/src/files-tenant-data/changes.json +6 -0
- package/packages/bundled-features/src/files-tenant-data/hooks.ts +4 -1
- package/packages/bundled-features/src/folders/web/folder-manager.tsx +8 -9
- package/packages/bundled-features/src/folders/web/folder-section.tsx +1 -1
- package/packages/bundled-features/src/form-draft-user-data/index.ts +2 -0
- package/packages/bundled-features/src/inbound-mail-foundation/changes.json +13 -0
- package/packages/bundled-features/src/inbound-mail-foundation/entities.ts +2 -0
- package/packages/bundled-features/src/inbound-mail-foundation/events.ts +2 -0
- package/packages/bundled-features/src/inbound-mail-foundation/feature.ts +6 -6
- package/packages/bundled-features/src/inbound-mail-foundation/handlers/attach-message-content.write.ts +7 -0
- package/packages/bundled-features/src/inbound-mail-foundation/handlers/ingest-message.write.ts +6 -0
- package/packages/bundled-features/src/inbound-mail-foundation/handlers/list-messages.query.ts +6 -2
- package/packages/bundled-features/src/inbound-mail-foundation/handlers/message-content.query.ts +3 -0
- package/packages/bundled-features/src/inbound-mail-foundation/handlers/message-content.ts +19 -0
- package/packages/bundled-features/src/inbound-mail-foundation/projection.ts +2 -0
- package/packages/bundled-features/src/inbound-mail-foundation/sanitize-inbound-html.ts +150 -0
- package/packages/bundled-features/src/inbound-mail-foundation/types.ts +1 -0
- package/packages/bundled-features/src/jobs/job-run-logger.ts +24 -25
- package/packages/bundled-features/src/ledger/handlers/reports.query.ts +46 -31
- package/packages/bundled-features/src/ledger/recurring.ts +1 -0
- package/packages/bundled-features/src/notes-history/web/notes-section.tsx +3 -1
- package/packages/bundled-features/src/personal-access-tokens/feature.ts +9 -17
- package/packages/bundled-features/src/personal-access-tokens/handlers/create.write.ts +2 -7
- package/packages/bundled-features/src/secrets/changes.json +6 -0
- package/packages/bundled-features/src/secrets/handlers/delete.write.ts +8 -4
- package/packages/bundled-features/src/secrets/handlers/list.query.ts +6 -3
- package/packages/bundled-features/src/secrets/handlers/set.write.ts +9 -4
- package/packages/bundled-features/src/secrets/secret-scope.ts +33 -0
- package/packages/bundled-features/src/sessions/changes.json +6 -0
- package/packages/bundled-features/src/sessions/feature.ts +21 -18
- package/packages/bundled-features/src/sessions/handlers/last-activity-probe.query.ts +53 -0
- package/packages/bundled-features/src/sessions/handlers/last-activity-probe.route.ts +39 -0
- package/packages/bundled-features/src/sessions/screens.ts +1 -0
- package/packages/bundled-features/src/sessions/session-callbacks.ts +13 -12
- package/packages/bundled-features/src/sessions/web/i18n.ts +4 -1
- package/packages/bundled-features/src/shared/assert-billing-live.ts +14 -0
- package/packages/bundled-features/src/shared/collect-extension-options.ts +12 -0
- package/packages/bundled-features/src/shared/index.ts +16 -0
- package/packages/bundled-features/src/shared/late-bound-slot.ts +19 -0
- package/packages/bundled-features/src/shared/mail-locale-templates.ts +7 -1
- package/packages/bundled-features/src/shared/price-env-shape.ts +44 -0
- package/packages/bundled-features/src/shared/purge-row-file-refs.ts +1 -1
- package/packages/bundled-features/src/shared/read-feature-export-fn.ts +16 -0
- package/packages/bundled-features/src/shared/signup-handover.ts +3 -4
- package/packages/bundled-features/src/shared/tenant-destruction-hold.ts +49 -0
- package/packages/bundled-features/src/shared/unprocessable.ts +19 -0
- package/packages/bundled-features/src/shared/web/index.ts +3 -0
- package/packages/bundled-features/src/subscription-paddle/feature.ts +7 -15
- package/packages/bundled-features/src/subscription-paddle/runtime.ts +4 -7
- package/packages/bundled-features/src/subscription-stripe/feature.ts +7 -15
- package/packages/bundled-features/src/subscription-stripe/runtime.ts +4 -7
- package/packages/bundled-features/src/tags/entity.ts +1 -0
- package/packages/bundled-features/src/tags/web/tag-chip.tsx +14 -0
- package/packages/bundled-features/src/tags/web/tag-filter.tsx +4 -5
- package/packages/bundled-features/src/tags/web/tag-manager.tsx +1 -1
- package/packages/bundled-features/src/tags/web/tag-section.tsx +3 -6
- package/packages/bundled-features/src/tags/web/tags-cell.tsx +4 -5
- package/packages/bundled-features/src/template-resolver/compile-document-body.ts +27 -15
- package/packages/bundled-features/src/template-resolver/handlers/by-tenant.query.ts +11 -8
- package/packages/bundled-features/src/template-resolver/handlers/discard-draft.write.ts +1 -0
- package/packages/bundled-features/src/template-resolver/handlers/overview.query.ts +1 -0
- package/packages/bundled-features/src/template-resolver/handlers/send-test.write.ts +5 -5
- package/packages/bundled-features/src/template-resolver/handlers/toggle-status.write.ts +3 -0
- package/packages/bundled-features/src/template-resolver/linked-resources.ts +11 -6
- package/packages/bundled-features/src/template-resolver/store-template-resource.ts +15 -12
- package/packages/bundled-features/src/template-resolver/web/document-images.ts +6 -6
- package/packages/bundled-features/src/template-resolver/web/document-insert-fields.tsx +41 -36
- package/packages/bundled-features/src/template-resolver/web/document-schema.ts +11 -12
- package/packages/bundled-features/src/template-resolver/web/tiptap-attribute-parse-rule.ts +19 -0
- package/packages/bundled-features/src/tenant/i18n.ts +3 -0
- package/packages/bundled-features/src/tenant/schema/tenant.ts +1 -0
- package/packages/bundled-features/src/tenant/web/member-roles-cell.tsx +1 -1
- package/packages/bundled-features/src/tenant/web/member-status-cell.tsx +1 -1
- package/packages/bundled-features/src/tenant-inactivity/changes.json +8 -0
- package/packages/bundled-features/src/tenant-inactivity/check-inactive-tenants.ts +260 -0
- package/packages/bundled-features/src/tenant-inactivity/constants.ts +12 -0
- package/packages/bundled-features/src/tenant-inactivity/email-templates.ts +24 -0
- package/packages/bundled-features/src/tenant-inactivity/feature.ts +66 -0
- package/packages/bundled-features/src/tenant-inactivity/handlers/inactivity-state.query.ts +49 -0
- package/packages/bundled-features/src/tenant-inactivity/handlers/keep-account.write.ts +56 -0
- package/packages/bundled-features/src/tenant-inactivity/inactivity-plan.ts +187 -0
- package/packages/bundled-features/src/tenant-inactivity/index.ts +5 -0
- package/packages/bundled-features/src/tenant-inactivity/keep-token.ts +44 -0
- package/packages/bundled-features/src/tenant-inactivity/mail-notifications.ts +62 -0
- package/packages/bundled-features/src/tenant-inactivity/options.ts +38 -0
- package/packages/bundled-features/src/tenant-inactivity/remote-activity.ts +32 -0
- package/packages/bundled-features/src/tenant-inactivity/state-store.ts +71 -0
- package/packages/bundled-features/src/tenant-inactivity/state-table.ts +50 -0
- package/packages/bundled-features/src/tenant-lifecycle/boot-checks.ts +8 -6
- package/packages/bundled-features/src/tenant-lifecycle/boot-rules.ts +16 -0
- package/packages/bundled-features/src/tenant-lifecycle/changes.json +18 -0
- package/packages/bundled-features/src/tenant-lifecycle/feature.ts +24 -1
- package/packages/bundled-features/src/tenant-lifecycle/handlers/request-destruction.write.ts +12 -87
- package/packages/bundled-features/src/tenant-lifecycle/index.ts +4 -0
- package/packages/bundled-features/src/tenant-lifecycle/request-tenant-destruction.ts +108 -0
- package/packages/bundled-features/src/tenant-lifecycle/retention-config-destroy-hooks.ts +62 -0
- package/packages/bundled-features/src/tenant-lifecycle/run-tenant-destroy.ts +58 -5
- package/packages/bundled-features/src/tenant-lifecycle/stages.ts +31 -2
- package/packages/bundled-features/src/tenant-lifecycle/testing.ts +1 -1
- package/packages/bundled-features/src/tier-engine/caps-for-tier-from-map.ts +16 -0
- package/packages/bundled-features/src/tier-engine/changes.json +6 -0
- package/packages/bundled-features/src/tier-engine/compose-app.ts +21 -20
- package/packages/bundled-features/src/tier-engine/index.ts +1 -0
- package/packages/bundled-features/src/user-data-rights/feature.ts +2 -0
- package/packages/bundled-features/src/user-data-rights/run-forget-cleanup.ts +2 -0
- package/packages/bundled-features/src/user-data-rights/web/privacy-center-screen.tsx +1 -1
- package/packages/bundled-features/src/user-data-rights/zip-path.ts +1 -0
- package/packages/bundled-features/src/user-data-rights-defaults/hooks/config-value.userdata-hook.ts +8 -27
- package/packages/bundled-features/src/user-data-rights-defaults/hooks/delivery-attempt.userdata-hook.ts +11 -8
- package/packages/bundled-features/src/user-data-rights-defaults/hooks/forget-own-rows-delete-hook.ts +42 -0
- package/packages/bundled-features/src/user-data-rights-defaults/hooks/notification-preference.userdata-hook.ts +8 -27
- package/packages/bundled-features/src/user-profile/handlers/change-email.write.ts +2 -6
- package/packages/bundled-features/src/user-profile/web/profile-screen.tsx +2 -3
- package/samples/apps/styleguide/src/features/widgets/i18n.ts +6 -0
- package/samples/apps/styleguide/src/features/widgets/web/InboxReaderExamples.tsx +158 -0
- package/samples/apps/styleguide/src/features/widgets/web/Widgets.tsx +2 -0
- package/samples/apps/styleguide/src/features/widgets/web/sample-pdf.ts +28 -0
- package/samples/apps/use-all-bundled/feature-manifest.json +134 -2
- package/samples/apps/use-all-bundled/kumiko/migrations/0063_contact.rebuild.json +4 -0
- package/samples/apps/use-all-bundled/package.json +1 -0
- package/samples/apps/use-all-bundled/playwright.config.ts +2 -0
- package/samples/apps/use-all-bundled/src/app/client.tsx +3 -0
- package/samples/apps/use-all-bundled/src/app/screens-feature.ts +46 -2
- package/samples/apps/use-all-bundled/src/run-config.ts +38 -4
- package/samples/recipes/contact/README.md +46 -0
- package/samples/recipes/contact/package.json +12 -0
- package/samples/recipes/contact/src/feature.ts +27 -0
- package/samples/recipes/delivery-notifications/src/feature.ts +3 -0
- package/samples/recipes/record-detail-layout/src/feature.ts +9 -1
- package/samples/recipes/search/README.md +2 -0
- package/samples/recipes/search/src/feature.ts +27 -2
- package/samples/recipes/secrets-demo/README.md +1 -0
- package/samples/recipes/secrets-demo/src/feature.ts +56 -0
- package/samples/recipes/tenant-inactivity/README.md +21 -0
- package/samples/recipes/tenant-inactivity/package.json +12 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** Caps lookup for `TierResolverDeps.capsForTier`: an unknown tier name falls back to the default
|
|
2
|
+
* tier (least-privileged by convention), a name missing from the map is a wiring bug and throws. */
|
|
3
|
+
export function capsForTierFromMap<TTier extends string, TCaps>(
|
|
4
|
+
tierMap: Readonly<Record<TTier, { readonly caps: TCaps }>>,
|
|
5
|
+
isTierName: (value: string) => value is TTier,
|
|
6
|
+
defaultTier: TTier,
|
|
7
|
+
): (tier: string) => TCaps {
|
|
8
|
+
return (tier) => {
|
|
9
|
+
const name = isTierName(tier) ? tier : defaultTier;
|
|
10
|
+
const def = tierMap[name];
|
|
11
|
+
if (!def) {
|
|
12
|
+
throw new Error(`tier-map: tier "${name}" not in tier map`);
|
|
13
|
+
}
|
|
14
|
+
return def.caps;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"version": "0.408.0",
|
|
4
|
+
"type": "improvement",
|
|
5
|
+
"title": "capsForTierFromMap",
|
|
6
|
+
"detail": "capsForTierFromMap(tierMap, isTierName, defaultTier) returns a capsForTier function for createTierResolver. An unknown tier name falls back to defaultTier; if the map has no entry for the resolved name it throws. Apps with a hand-written capsForTier over their tier map can switch to it."
|
|
7
|
+
},
|
|
2
8
|
{
|
|
3
9
|
"version": "0.395.0",
|
|
4
10
|
"type": "fix",
|
|
@@ -88,6 +88,21 @@ export type ComposedApp<TCaps extends Readonly<Record<string, unknown>>> = {
|
|
|
88
88
|
* **No production callers, and that is not rot** — see
|
|
89
89
|
* docs/reference/tier-composition-boot-vs-runtime.md for why.
|
|
90
90
|
*/
|
|
91
|
+
function lookupOrThrow<TValue>(
|
|
92
|
+
map: Readonly<Record<string, TValue>>,
|
|
93
|
+
name: string,
|
|
94
|
+
kind: string,
|
|
95
|
+
knownLabel: string,
|
|
96
|
+
): TValue {
|
|
97
|
+
const value = map[name];
|
|
98
|
+
if (!value) {
|
|
99
|
+
throw new Error(
|
|
100
|
+
`composeApp: unknown ${kind} "${name}". ${knownLabel}: ${Object.keys(map).join(", ")}`,
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
return value;
|
|
104
|
+
}
|
|
105
|
+
|
|
91
106
|
export function composeApp<TCaps extends Readonly<Record<string, unknown>>>(
|
|
92
107
|
input: ComposeAppInput<TCaps>,
|
|
93
108
|
): ComposedApp<TCaps> {
|
|
@@ -99,31 +114,17 @@ export function composeApp<TCaps extends Readonly<Record<string, unknown>>>(
|
|
|
99
114
|
);
|
|
100
115
|
}
|
|
101
116
|
|
|
102
|
-
const addOnDefs = input.addOns.map((name) =>
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
throw new Error(
|
|
106
|
-
`composeApp: unknown add-on "${name}". Known add-ons: ` +
|
|
107
|
-
`${Object.keys(input.addOnMap).join(", ")}`,
|
|
108
|
-
);
|
|
109
|
-
}
|
|
110
|
-
return def;
|
|
111
|
-
});
|
|
117
|
+
const addOnDefs = input.addOns.map((name) =>
|
|
118
|
+
lookupOrThrow(input.addOnMap, name, "add-on", "Known add-ons"),
|
|
119
|
+
);
|
|
112
120
|
|
|
113
121
|
const tierFeatureNames = tierDef.features;
|
|
114
122
|
const addOnFeatureNames = addOnDefs.flatMap((d) => d.features);
|
|
115
123
|
const allFeatureNames = [...tierFeatureNames, ...addOnFeatureNames];
|
|
116
124
|
|
|
117
|
-
const additionalFeatures = allFeatureNames.map((name) =>
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
throw new Error(
|
|
121
|
-
`composeApp: unknown feature "${name}". Registered features: ` +
|
|
122
|
-
`${Object.keys(input.featureRegistry).join(", ")}`,
|
|
123
|
-
);
|
|
124
|
-
}
|
|
125
|
-
return feature;
|
|
126
|
-
});
|
|
125
|
+
const additionalFeatures = allFeatureNames.map((name) =>
|
|
126
|
+
lookupOrThrow(input.featureRegistry, name, "feature", "Registered features"),
|
|
127
|
+
);
|
|
127
128
|
|
|
128
129
|
// Dedupe — a feature listed in both the tier and an add-on should only
|
|
129
130
|
// mount once. Order-preserving: first occurrence wins.
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
// - `TierEngineHandlers` / `TierEngineQueries` — qualified handler names
|
|
9
9
|
|
|
10
10
|
export { tierAssignmentAggregateId } from "./aggregate-id.ts";
|
|
11
|
+
export { capsForTierFromMap } from "./caps-for-tier-from-map.ts";
|
|
11
12
|
export {
|
|
12
13
|
type AddOnDefinition,
|
|
13
14
|
type AddOnMap,
|
|
@@ -510,6 +510,7 @@ export function createUserDataRightsFeature(opts: UserDataRightsOptions = {}): F
|
|
|
510
510
|
// Entry point of the emailed download link; cheap static page, but
|
|
511
511
|
// anonymous and token-bearing, so bound per-IP probing.
|
|
512
512
|
rateLimit: { per: "ip+handler", limit: 30, windowSeconds: 60 },
|
|
513
|
+
// guard:dup-ok the few-shot corpus extractor reads httpRoute handlers only when they are inline
|
|
513
514
|
handler: async (c) => {
|
|
514
515
|
return c.body(TOKEN_EXCHANGE_PAGE_HTML, 200, {
|
|
515
516
|
"content-type": "text/html; charset=utf-8",
|
|
@@ -525,6 +526,7 @@ export function createUserDataRightsFeature(opts: UserDataRightsOptions = {}): F
|
|
|
525
526
|
method: "GET",
|
|
526
527
|
path: "/user-export/by-token.js",
|
|
527
528
|
anonymous: true,
|
|
529
|
+
// guard:dup-ok the few-shot corpus extractor reads httpRoute handlers only when they are inline
|
|
528
530
|
handler: async (c) => {
|
|
529
531
|
return c.body(TOKEN_EXCHANGE_PAGE_JS, 200, {
|
|
530
532
|
"content-type": "application/javascript; charset=utf-8",
|
|
@@ -220,6 +220,7 @@ export function sanitizeReasonForLog(reason: string): string {
|
|
|
220
220
|
|
|
221
221
|
// Cross-tenant by design: the due-user and membership reads on the given runner and raw hook
|
|
222
222
|
// statements must see every tenant, whatever RLS scope the caller (job, operator handler) runs in.
|
|
223
|
+
// guard:dup-ok the single runInSystemRowLevelSecurityScope call with this entry point's own reason
|
|
223
224
|
export function runForgetCleanup(args: RunForgetCleanupArgs): Promise<RunForgetCleanupResult> {
|
|
224
225
|
return runInSystemRowLevelSecurityScope(
|
|
225
226
|
"forget cleanup anonymizes users across all tenants",
|
|
@@ -427,6 +428,7 @@ async function processUser(args: {
|
|
|
427
428
|
resolveDeleteBytes: resolveForgetFileBytesDeleter(buildStorageProvider),
|
|
428
429
|
missingStorage: {
|
|
429
430
|
mode: "skip",
|
|
431
|
+
// guard:dup-ok a one-message log callback; only the shape matches other log callbacks
|
|
430
432
|
warn: (tenantId) =>
|
|
431
433
|
// biome-ignore lint/suspicious/noConsole: misconfiguration visibility, same as the fileRef delete hook
|
|
432
434
|
console.warn(
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
import { postWithDownload } from "@cosmicdrift/kumiko-renderer/web";
|
|
20
20
|
import { propertyOf } from "@cosmicdrift/kumiko-types/type-guards";
|
|
21
21
|
import { type ReactNode, useEffect, useState } from "react";
|
|
22
|
-
import { type SectionStatus, StatusBanner } from "../../shared/web/
|
|
22
|
+
import { type SectionStatus, StatusBanner } from "../../shared/web/index.ts";
|
|
23
23
|
import {
|
|
24
24
|
EXPORT_JOB_STATUS,
|
|
25
25
|
type ExportJobStatus,
|
|
@@ -85,6 +85,7 @@ function collapseUnsafe(s: string): string {
|
|
|
85
85
|
* tenantId and fileRefId have UUID shapes and are safe; fileName is passed
|
|
86
86
|
* through sanitizeZipFilename. Path traversal is guaranteed to be excluded.
|
|
87
87
|
*/
|
|
88
|
+
// guard:dup-ok one sanitized template-literal path; only the shape matches unrelated string builders
|
|
88
89
|
export function buildFileRefZipPath(args: {
|
|
89
90
|
readonly tenantId: TenantId;
|
|
90
91
|
readonly fileRefId: string;
|
package/packages/bundled-features/src/user-data-rights-defaults/hooks/config-value.userdata-hook.ts
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import { createEventStoreExecutor } from "@cosmicdrift/kumiko-framework/db";
|
|
2
|
-
import {
|
|
3
|
-
createSystemUser,
|
|
4
|
-
type UserDataDeleteHook,
|
|
5
|
-
type UserDataExportHook,
|
|
6
|
-
} from "@cosmicdrift/kumiko-framework/engine";
|
|
2
|
+
import type { UserDataDeleteHook, UserDataExportHook } from "@cosmicdrift/kumiko-framework/engine";
|
|
7
3
|
import { configValueEntity, configValuesTable } from "../../config/index.ts";
|
|
8
|
-
import { collectErasureFailure, throwIfErasureFailed } from "../../shared/index.ts";
|
|
9
4
|
import { featureMounted } from "./feature-mounted.ts";
|
|
5
|
+
import { forgetOwnRowsDeleteHook } from "./forget-own-rows-delete-hook.ts";
|
|
10
6
|
|
|
11
7
|
// userData-Hooks for config's USER-scoped rows (userId set). Tenant-/system-
|
|
12
8
|
// scope rows carry no per-user subject and stay untouched. Event-sourced
|
|
@@ -34,24 +30,9 @@ export const configValueExportHook: UserDataExportHook = async (ctx) => {
|
|
|
34
30
|
};
|
|
35
31
|
};
|
|
36
32
|
|
|
37
|
-
export const configValueDeleteHook: UserDataDeleteHook =
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
userId: ctx.userId,
|
|
44
|
-
});
|
|
45
|
-
const failures: string[] = [];
|
|
46
|
-
for (const row of rows) {
|
|
47
|
-
const id = row["id"]; // @cast-boundary db-row
|
|
48
|
-
if (typeof id !== "string") continue;
|
|
49
|
-
collectErasureFailure(
|
|
50
|
-
await crud.forget({ id }, systemUser, ctx.db),
|
|
51
|
-
"config-value",
|
|
52
|
-
id,
|
|
53
|
-
failures,
|
|
54
|
-
);
|
|
55
|
-
}
|
|
56
|
-
throwIfErasureFailed(failures);
|
|
57
|
-
};
|
|
33
|
+
export const configValueDeleteHook: UserDataDeleteHook = forgetOwnRowsDeleteHook({
|
|
34
|
+
featureName: "config",
|
|
35
|
+
entityName: "config-value",
|
|
36
|
+
table: configValuesTable,
|
|
37
|
+
executor: crud,
|
|
38
|
+
});
|
|
@@ -22,14 +22,17 @@ export const deliveryAttemptExportHook: UserDataExportHook = async (ctx) => {
|
|
|
22
22
|
if (rows.length === 0) return null;
|
|
23
23
|
return {
|
|
24
24
|
entity: "delivery-attempt",
|
|
25
|
-
rows: rows.map(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
25
|
+
rows: rows.map(
|
|
26
|
+
// guard:dup-ok export field selection for this entity; only the object-literal shape matches other mappers
|
|
27
|
+
(r) => ({
|
|
28
|
+
notificationType: r["notificationType"],
|
|
29
|
+
channel: r["channel"],
|
|
30
|
+
status: r["status"],
|
|
31
|
+
recipientAddress: r["recipientAddress"],
|
|
32
|
+
priority: r["priority"],
|
|
33
|
+
createdAt: r["createdAt"],
|
|
34
|
+
}),
|
|
35
|
+
),
|
|
33
36
|
};
|
|
34
37
|
};
|
|
35
38
|
|
package/packages/bundled-features/src/user-data-rights-defaults/hooks/forget-own-rows-delete-hook.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { EventStoreExecutor } from "@cosmicdrift/kumiko-framework/db";
|
|
2
|
+
import {
|
|
3
|
+
createSystemUser,
|
|
4
|
+
type UserDataDeleteHook,
|
|
5
|
+
type UserDataHookCtx,
|
|
6
|
+
} from "@cosmicdrift/kumiko-framework/engine";
|
|
7
|
+
import { collectErasureFailure, throwIfErasureFailed } from "../../shared/index.ts";
|
|
8
|
+
import { featureMounted } from "./feature-mounted.ts";
|
|
9
|
+
|
|
10
|
+
type OwnRowsTable = Parameters<UserDataHookCtx["db"]["selectMany"]>[0];
|
|
11
|
+
|
|
12
|
+
// Event-sourced rows owned by the user: forgetting goes through the executor so a rebuild replays
|
|
13
|
+
// the erasure.
|
|
14
|
+
export function forgetOwnRowsDeleteHook(source: {
|
|
15
|
+
readonly featureName: string;
|
|
16
|
+
readonly entityName: string;
|
|
17
|
+
readonly table: OwnRowsTable;
|
|
18
|
+
readonly executor: Pick<EventStoreExecutor, "forget">;
|
|
19
|
+
}): UserDataDeleteHook {
|
|
20
|
+
const { featureName, entityName, table, executor } = source;
|
|
21
|
+
return async (ctx) => {
|
|
22
|
+
// skip: source feature not mounted — its table doesn't exist, nothing to erase.
|
|
23
|
+
if (!featureMounted(ctx, featureName)) return;
|
|
24
|
+
const systemUser = createSystemUser(ctx.tenantId);
|
|
25
|
+
const rows = await ctx.db.selectMany<Record<string, unknown>>(table, {
|
|
26
|
+
tenantId: ctx.tenantId,
|
|
27
|
+
userId: ctx.userId,
|
|
28
|
+
});
|
|
29
|
+
const failures: string[] = [];
|
|
30
|
+
for (const row of rows) {
|
|
31
|
+
const id = row["id"]; // @cast-boundary db-row
|
|
32
|
+
if (typeof id !== "string") continue;
|
|
33
|
+
collectErasureFailure(
|
|
34
|
+
await executor.forget({ id }, systemUser, ctx.db),
|
|
35
|
+
entityName,
|
|
36
|
+
id,
|
|
37
|
+
failures,
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
throwIfErasureFailed(failures);
|
|
41
|
+
};
|
|
42
|
+
}
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
import { createEventStoreExecutor } from "@cosmicdrift/kumiko-framework/db";
|
|
2
|
-
import {
|
|
3
|
-
createSystemUser,
|
|
4
|
-
type UserDataDeleteHook,
|
|
5
|
-
type UserDataExportHook,
|
|
6
|
-
} from "@cosmicdrift/kumiko-framework/engine";
|
|
2
|
+
import type { UserDataDeleteHook, UserDataExportHook } from "@cosmicdrift/kumiko-framework/engine";
|
|
7
3
|
import {
|
|
8
4
|
notificationPreferenceEntity,
|
|
9
5
|
notificationPreferencesTable,
|
|
10
6
|
} from "../../delivery/index.ts";
|
|
11
|
-
import { collectErasureFailure, throwIfErasureFailed } from "../../shared/index.ts";
|
|
12
7
|
import { featureMounted } from "./feature-mounted.ts";
|
|
8
|
+
import { forgetOwnRowsDeleteHook } from "./forget-own-rows-delete-hook.ts";
|
|
13
9
|
|
|
14
10
|
// userData-Hooks for delivery's notification-preference rows. Event-sourced
|
|
15
11
|
// entity → forget goes through the executor so a rebuild replays the erasure.
|
|
@@ -40,24 +36,9 @@ export const notificationPreferenceExportHook: UserDataExportHook = async (ctx)
|
|
|
40
36
|
};
|
|
41
37
|
};
|
|
42
38
|
|
|
43
|
-
export const notificationPreferenceDeleteHook: UserDataDeleteHook =
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
userId: ctx.userId,
|
|
50
|
-
});
|
|
51
|
-
const failures: string[] = [];
|
|
52
|
-
for (const row of rows) {
|
|
53
|
-
const id = row["id"]; // @cast-boundary db-row
|
|
54
|
-
if (typeof id !== "string") continue;
|
|
55
|
-
collectErasureFailure(
|
|
56
|
-
await crud.forget({ id }, systemUser, ctx.db),
|
|
57
|
-
"notification-preference",
|
|
58
|
-
id,
|
|
59
|
-
failures,
|
|
60
|
-
);
|
|
61
|
-
}
|
|
62
|
-
throwIfErasureFailed(failures);
|
|
63
|
-
};
|
|
39
|
+
export const notificationPreferenceDeleteHook: UserDataDeleteHook = forgetOwnRowsDeleteHook({
|
|
40
|
+
featureName: "delivery",
|
|
41
|
+
entityName: "notification-preference",
|
|
42
|
+
table: notificationPreferencesTable,
|
|
43
|
+
executor: crud,
|
|
44
|
+
});
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
import { UnprocessableError, writeFailure } from "@cosmicdrift/kumiko-framework/errors";
|
|
7
7
|
import * as z from "zod";
|
|
8
8
|
import { AuthErrors } from "../../auth-email-password/index.ts";
|
|
9
|
-
import { decryptStoredPii, verifyPassword } from "../../shared/index.ts";
|
|
9
|
+
import { decryptStoredPii, unprocessable, verifyPassword } from "../../shared/index.ts";
|
|
10
10
|
import { UserErrors, UserHandlers, UserQueries } from "../../user/index.ts";
|
|
11
11
|
import { UserProfileErrors } from "../web/constants.ts";
|
|
12
12
|
|
|
@@ -15,11 +15,7 @@ import { UserProfileErrors } from "../web/constants.ts";
|
|
|
15
15
|
// and i18nKey are stable public API.
|
|
16
16
|
// @wrapper-known error-helper
|
|
17
17
|
function invalidCredentials() {
|
|
18
|
-
return
|
|
19
|
-
new UnprocessableError(AuthErrors.invalidCredentials, {
|
|
20
|
-
i18nKey: "auth.errors.invalidCredentials",
|
|
21
|
-
}),
|
|
22
|
-
);
|
|
18
|
+
return unprocessable(AuthErrors.invalidCredentials, "auth.errors.invalidCredentials");
|
|
23
19
|
}
|
|
24
20
|
|
|
25
21
|
// Change-email — authenticated, self-only. The user confirms with their
|
|
@@ -14,9 +14,8 @@ import {
|
|
|
14
14
|
} from "@cosmicdrift/kumiko-renderer";
|
|
15
15
|
import { propertyOf } from "@cosmicdrift/kumiko-types/type-guards";
|
|
16
16
|
import { type ReactNode, useState } from "react";
|
|
17
|
-
import { AuthHandlers } from "../../auth-email-password/web/
|
|
18
|
-
import {
|
|
19
|
-
import { type SectionStatus, StatusBanner } from "../../shared/web/status-banner.tsx";
|
|
17
|
+
import { AuthHandlers, requestEmailVerification } from "../../auth-email-password/web/index.ts";
|
|
18
|
+
import { type SectionStatus, StatusBanner } from "../../shared/web/index.ts";
|
|
20
19
|
import { UserProfileHandlers } from "./constants.ts";
|
|
21
20
|
|
|
22
21
|
// Dispatcher failures carry an i18nKey only when the handler sets one —
|
|
@@ -191,6 +191,12 @@ export const WIDGETS_I18N = {
|
|
|
191
191
|
de: "Zeile links anklicken.",
|
|
192
192
|
en: "Click a row on the left.",
|
|
193
193
|
},
|
|
194
|
+
"widgets:catalog:inbox-reader": { de: "Posteingang: Leser", en: "Inbox: reader" },
|
|
195
|
+
"widgets:catalog:inbox-reader-subtitle": {
|
|
196
|
+
de: "Mail-Verlauf mit Anhängen, Original-Betrachter und Plan der KI",
|
|
197
|
+
en: "Mail thread with attachments, original viewer and the AI plan",
|
|
198
|
+
},
|
|
199
|
+
"widgets:catalog:inbox-plan-title": { de: "Vorschlag der KI", en: "AI proposal" },
|
|
194
200
|
"widgets:catalog:ai-text": { de: "AI-Text", en: "AI text" },
|
|
195
201
|
"widgets:catalog:ai-text-subtitle": {
|
|
196
202
|
de: "Ghost-Text-Completion, Correct, Translate, Rewrite",
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
// Inbox reader building blocks with a rent-management case: tenant reports a cold
|
|
2
|
+
// heating system, the property manager answers, the AI proposes follow-up steps.
|
|
3
|
+
|
|
4
|
+
import { useTranslation } from "@cosmicdrift/kumiko-renderer";
|
|
5
|
+
import {
|
|
6
|
+
AiSurface,
|
|
7
|
+
MessageReader,
|
|
8
|
+
PdfPreview,
|
|
9
|
+
SectionCard,
|
|
10
|
+
StepList,
|
|
11
|
+
type StepListItem,
|
|
12
|
+
type ThreadMessage,
|
|
13
|
+
} from "@cosmicdrift/kumiko-renderer/web";
|
|
14
|
+
import { type ReactNode, useMemo, useState } from "react";
|
|
15
|
+
import { buildSamplePdfBase64 } from "./sample-pdf";
|
|
16
|
+
|
|
17
|
+
const HEATING_THREAD: readonly ThreadMessage[] = [
|
|
18
|
+
{
|
|
19
|
+
id: "tenant-first",
|
|
20
|
+
author: "Anna Schneider",
|
|
21
|
+
address: "a.schneider@mieter.test",
|
|
22
|
+
direction: "incoming",
|
|
23
|
+
timeLabel: "Mo 08:14",
|
|
24
|
+
body: {
|
|
25
|
+
kind: "text",
|
|
26
|
+
text: "Guten Morgen,\nseit gestern Abend ist meine Heizung komplett kalt. Können Sie jemanden schicken?",
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
id: "manager-reply",
|
|
31
|
+
author: "Du",
|
|
32
|
+
direction: "outgoing",
|
|
33
|
+
timeLabel: "Mo 09:02",
|
|
34
|
+
body: {
|
|
35
|
+
kind: "text",
|
|
36
|
+
text: "Der Monteur kommt am Dienstag zwischen 8 und 10 Uhr. Bitte sorgen Sie für Zugang zur Wohnung.",
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
id: "tenant-second",
|
|
41
|
+
author: "Anna Schneider",
|
|
42
|
+
address: "a.schneider@mieter.test",
|
|
43
|
+
direction: "incoming",
|
|
44
|
+
timeLabel: "Heute 09:41",
|
|
45
|
+
body: {
|
|
46
|
+
kind: "text",
|
|
47
|
+
text: [
|
|
48
|
+
"Guten Tag,",
|
|
49
|
+
"der Monteur ist am Dienstag nicht gekommen, ich habe den ganzen Vormittag gewartet. Die Heizung ist weiter kalt, im Kinderzimmer sind es 15 Grad.",
|
|
50
|
+
"Ich erwarte heute einen neuen Termin. Ab sofort mindere ich die Miete um 20 Prozent, bis die Heizung wieder läuft.",
|
|
51
|
+
"",
|
|
52
|
+
"Am Mo., 9:02 schrieb Du <verwaltung@hausverwaltung.test>:",
|
|
53
|
+
"> Der Monteur kommt am Dienstag zwischen 8 und 10 Uhr.",
|
|
54
|
+
"> Bitte sorgen Sie für Zugang zur Wohnung.",
|
|
55
|
+
].join("\n"),
|
|
56
|
+
},
|
|
57
|
+
attachments: [
|
|
58
|
+
{
|
|
59
|
+
id: "thermometer",
|
|
60
|
+
name: "thermometer-kinderzimmer.jpg",
|
|
61
|
+
meta: "Foto, 1,2 MB",
|
|
62
|
+
kind: "image",
|
|
63
|
+
onOpen: () => {},
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
id: "contract",
|
|
67
|
+
name: "Mietvertrag-Goethestr-12.pdf",
|
|
68
|
+
meta: "PDF, 2 Seiten",
|
|
69
|
+
kind: "pdf",
|
|
70
|
+
onOpen: () => {},
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
},
|
|
74
|
+
];
|
|
75
|
+
|
|
76
|
+
const HEATING_PLAN: readonly StepListItem[] = [
|
|
77
|
+
{
|
|
78
|
+
id: "case",
|
|
79
|
+
title: "Vorgang „Heizungsausfall Whg. 3“",
|
|
80
|
+
status: "done",
|
|
81
|
+
meta: "Angelegt von dir, Mo 09:05",
|
|
82
|
+
link: { label: "Öffnen", href: "#vorgang" },
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
id: "order",
|
|
86
|
+
title: "Neuer Auftrag an Heizung Schulz GmbH",
|
|
87
|
+
description: "Notdienst heute, Zugang über Hausmeister. Der alte Auftrag wird storniert.",
|
|
88
|
+
status: "open",
|
|
89
|
+
tags: [{ label: "Sendet eine Mail", tone: "accent" }],
|
|
90
|
+
actions: [
|
|
91
|
+
{ id: "review", label: "Prüfen", variant: "primary", onClick: () => {} },
|
|
92
|
+
{ id: "reject", label: "Ablehnen", variant: "ghost", onClick: () => {} },
|
|
93
|
+
],
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
id: "reply",
|
|
97
|
+
title: "Antwort an Anna Schneider",
|
|
98
|
+
description: "Neuer Termin, Minderung erst nach Prüfung des Mangels.",
|
|
99
|
+
status: "locked",
|
|
100
|
+
lockedReason: "Auftrag",
|
|
101
|
+
tags: [{ label: "Sendet eine Mail", tone: "accent" }],
|
|
102
|
+
},
|
|
103
|
+
];
|
|
104
|
+
|
|
105
|
+
export function InboxReaderExamples(): ReactNode {
|
|
106
|
+
const t = useTranslation();
|
|
107
|
+
const [activeTabId, setActiveTabId] = useState("mail");
|
|
108
|
+
const contractPdf = useMemo(
|
|
109
|
+
() => buildSamplePdfBase64(["Mietvertrag Goethestrasse 12, Whg. 3", "Heizung und Nebenkosten"]),
|
|
110
|
+
[],
|
|
111
|
+
);
|
|
112
|
+
return (
|
|
113
|
+
<SectionCard
|
|
114
|
+
title={t("widgets:catalog:inbox-reader")}
|
|
115
|
+
subtitle={t("widgets:catalog:inbox-reader-subtitle")}
|
|
116
|
+
>
|
|
117
|
+
<div className="grid gap-4 lg:grid-cols-[1fr_340px]" data-testid="inbox-reader-demo">
|
|
118
|
+
<MessageReader
|
|
119
|
+
thread={{ messages: HEATING_THREAD }}
|
|
120
|
+
activeTabId={activeTabId}
|
|
121
|
+
onTabChange={setActiveTabId}
|
|
122
|
+
attachmentTabs={[
|
|
123
|
+
{
|
|
124
|
+
id: "contract",
|
|
125
|
+
label: "Anhang 1: Mietvertrag-Goethestr-12.pdf",
|
|
126
|
+
render: () => (
|
|
127
|
+
<div className="h-[560px]">
|
|
128
|
+
<PdfPreview
|
|
129
|
+
variant="viewer"
|
|
130
|
+
source={{ base64: contractPdf }}
|
|
131
|
+
searchTerm="Heizung"
|
|
132
|
+
testId="inbox-reader-pdf"
|
|
133
|
+
/>
|
|
134
|
+
</div>
|
|
135
|
+
),
|
|
136
|
+
},
|
|
137
|
+
]}
|
|
138
|
+
/>
|
|
139
|
+
<div className="flex flex-col gap-4">
|
|
140
|
+
<AiSurface title="Einordnung der KI" label="Einordnung der KI">
|
|
141
|
+
<p className="m-0 text-sm leading-normal">
|
|
142
|
+
Die Heizung ist seit Montag kalt. Der vereinbarte Monteur ist nicht gekommen. Frau
|
|
143
|
+
Schneider kündigt eine Mietminderung an und will heute einen neuen Termin.
|
|
144
|
+
</p>
|
|
145
|
+
</AiSurface>
|
|
146
|
+
<StepList
|
|
147
|
+
title={t("widgets:catalog:inbox-plan-title")}
|
|
148
|
+
steps={HEATING_PLAN}
|
|
149
|
+
footerActions={[
|
|
150
|
+
{ id: "reject-all", label: "Alle ablehnen", variant: "ghost", onClick: () => {} },
|
|
151
|
+
{ id: "next", label: "Nächsten prüfen", variant: "primary", onClick: () => {} },
|
|
152
|
+
]}
|
|
153
|
+
/>
|
|
154
|
+
</div>
|
|
155
|
+
</div>
|
|
156
|
+
</SectionCard>
|
|
157
|
+
);
|
|
158
|
+
}
|
|
@@ -41,6 +41,7 @@ import {
|
|
|
41
41
|
import { Wallet } from "lucide-react";
|
|
42
42
|
import { type ReactNode, useEffect, useMemo, useState } from "react";
|
|
43
43
|
import { euro, percent } from "../lib/format";
|
|
44
|
+
import { InboxReaderExamples } from "./InboxReaderExamples";
|
|
44
45
|
|
|
45
46
|
const RESPONSE_TIMES = Array.from({ length: 48 }, (_, i) => ({
|
|
46
47
|
atMs: i * 30 * 60 * 1000,
|
|
@@ -322,6 +323,7 @@ export function Widgets(): ReactNode {
|
|
|
322
323
|
)}
|
|
323
324
|
|
|
324
325
|
<InboxDemo />
|
|
326
|
+
<InboxReaderExamples />
|
|
325
327
|
<FinancingCalculatorDemo />
|
|
326
328
|
<FormFieldsDemo />
|
|
327
329
|
<ComparisonDemo />
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// Minimal text-only PDF so the viewer example needs no binary asset; xref offsets are computed.
|
|
2
|
+
function pageObjects(text: string, firstObjectNumber: number): readonly string[] {
|
|
3
|
+
const stream = `BT /F1 14 Tf 56 760 Td (${text}) Tj ET`;
|
|
4
|
+
return [
|
|
5
|
+
`<< /Type /Page /Parent 2 0 R /MediaBox [0 0 595 842] /Resources << /Font << /F1 << /Type /Font /Subtype /Type1 /BaseFont /Helvetica >> >> >> /Contents ${firstObjectNumber + 1} 0 R >>`,
|
|
6
|
+
`<< /Length ${stream.length} >>\nstream\n${stream}\nendstream`,
|
|
7
|
+
];
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function buildSamplePdfBase64(pageTexts: readonly string[]): string {
|
|
11
|
+
const pageObjectNumbers = pageTexts.map((_, index) => 3 + index * 2);
|
|
12
|
+
const objects = [
|
|
13
|
+
"<< /Type /Catalog /Pages 2 0 R >>",
|
|
14
|
+
`<< /Type /Pages /Kids [${pageObjectNumbers.map((n) => `${n} 0 R`).join(" ")}] /Count ${pageTexts.length} >>`,
|
|
15
|
+
...pageTexts.flatMap((text, index) => pageObjects(text, pageObjectNumbers[index] ?? 3)),
|
|
16
|
+
];
|
|
17
|
+
let body = "%PDF-1.4\n";
|
|
18
|
+
const offsets: number[] = [];
|
|
19
|
+
objects.forEach((object, index) => {
|
|
20
|
+
offsets.push(body.length);
|
|
21
|
+
body += `${index + 1} 0 obj\n${object}\nendobj\n`;
|
|
22
|
+
});
|
|
23
|
+
const xrefOffset = body.length;
|
|
24
|
+
const entries = offsets.map((offset) => `${String(offset).padStart(10, "0")} 00000 n \n`);
|
|
25
|
+
body += `xref\n0 ${objects.length + 1}\n0000000000 65535 f \n${entries.join("")}`;
|
|
26
|
+
body += `trailer\n<< /Size ${objects.length + 1} /Root 1 0 R >>\nstartxref\n${xrefOffset}\n%%EOF`;
|
|
27
|
+
return btoa(body);
|
|
28
|
+
}
|