@cosmicdrift/kumiko-samples 0.409.0 → 0.411.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 +36 -1
- package/packages/bundled-features/src/auth-email-password/changes.json +24 -0
- package/packages/bundled-features/src/auth-email-password/handlers/login-options.query.ts +1 -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/seeding.ts +84 -6
- package/packages/bundled-features/src/auth-email-password/web/i18n.ts +1 -0
- package/packages/bundled-features/src/auth-email-password/web/signup-screen.tsx +48 -3
- package/packages/bundled-features/src/auth-email-password/web/static-account.ts +190 -0
- package/packages/bundled-features/src/auth-email-password/web/static-client.ts +226 -0
- package/packages/bundled-features/src/compliance-profiles/handlers/sub-processors.query.ts +4 -1
- package/packages/bundled-features/src/contact/changes.json +6 -0
- package/packages/bundled-features/src/contact/client/contact-website-client.ts +29 -0
- package/packages/bundled-features/src/contact/client/index.ts +9 -0
- package/packages/bundled-features/src/contact/feature.ts +3 -0
- package/packages/bundled-features/src/contact/handlers/access.ts +1 -1
- package/packages/bundled-features/src/contact/handlers/challenge.query.ts +1 -1
- package/packages/bundled-features/src/contact/handlers/submit.write.ts +1 -1
- package/packages/bundled-features/src/contact/i18n.ts +4 -1
- package/packages/bundled-features/src/contact/options.ts +1 -1
- package/packages/bundled-features/src/contact/screens.ts +1 -0
- 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/foundation-shared/demo-admin-env.ts +11 -0
- package/packages/bundled-features/src/foundation-shared/index.ts +5 -1
- package/packages/bundled-features/src/inbound-provider-imap/changes.json +6 -0
- package/packages/bundled-features/src/inbound-provider-imap/imap-client.ts +3 -1
- 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/presence/changes.json +8 -0
- package/packages/bundled-features/src/presence/feature.ts +25 -0
- package/packages/bundled-features/src/presence/handlers/heartbeat.write.ts +52 -0
- package/packages/bundled-features/src/presence/handlers/leave.write.ts +41 -0
- package/packages/bundled-features/src/presence/handlers/list.query.ts +39 -0
- package/packages/bundled-features/src/presence/index.ts +7 -0
- package/packages/bundled-features/src/presence/options.ts +30 -0
- package/packages/bundled-features/src/presence/payloads.ts +26 -0
- package/packages/bundled-features/src/presence/room.ts +65 -0
- package/packages/bundled-features/src/presence/store.ts +185 -0
- package/packages/bundled-features/src/seo/handlers/seo-config.query.ts +1 -1
- package/packages/bundled-features/src/sessions/feature.ts +6 -2
- package/packages/bundled-features/src/sessions/handlers/last-activity-probe.route.ts +19 -0
- package/packages/bundled-features/src/subscription-paddle/checkout-config.query.ts +1 -1
- 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/tenant-inactivity/changes.json +12 -0
- package/packages/bundled-features/src/tenant-inactivity/check-inactive-tenants.ts +14 -6
- package/packages/bundled-features/src/tenant-inactivity/constants.ts +4 -1
- package/packages/bundled-features/src/tenant-inactivity/handlers/inactivity-state.query.ts +2 -1
- package/packages/bundled-features/src/tenant-inactivity/handlers/keep-account.write.ts +5 -1
- package/packages/bundled-features/src/tenant-inactivity/options.ts +1 -0
- package/packages/bundled-features/src/tenant-inactivity/remote-activity.ts +6 -1
- package/packages/bundled-features/src/tenant-inactivity/static-keep-account.ts +37 -0
- package/packages/bundled-features/src/tenant-lifecycle/constants.ts +2 -0
- package/packages/bundled-features/src/tenant-lifecycle/handlers/cancel-destruction.write.ts +6 -2
- package/packages/bundled-features/src/tenant-lifecycle/handlers/request-destruction.write.ts +2 -1
- package/packages/bundled-features/src/tenant-lifecycle/index.ts +1 -0
- package/packages/bundled-features/src/user-data-rights/handlers/confirm-deletion-by-token.write.ts +4 -1
- package/packages/bundled-features/src/user-data-rights/handlers/download-by-token.query.ts +1 -0
- package/packages/bundled-features/src/user-data-rights/handlers/request-deletion-by-email.write.ts +4 -1
- package/packages/bundled-features/src/waitlist/changes.json +12 -0
- package/packages/bundled-features/src/waitlist/handlers/submit.write.ts +1 -2
- package/packages/bundled-features/src/waitlist/static-submit.ts +56 -0
- package/samples/apps/styleguide/src/features/widgets/i18n.ts +143 -0
- package/samples/apps/styleguide/src/features/widgets/web/VariantsDemo.tsx +276 -0
- package/samples/apps/styleguide/src/features/widgets/web/Widgets.tsx +3 -0
- package/samples/apps/styleguide/src/features/workboard/feature.ts +1 -0
- package/samples/apps/use-all-bundled/feature-manifest.json +26 -25
- package/samples/apps/use-all-bundled/playwright.config.ts +0 -2
- package/samples/apps/use-all-bundled/src/run-config.ts +6 -15
- package/samples/recipes/anonymous-access/README.md +2 -0
- package/samples/recipes/anonymous-access/src/feature.ts +7 -1
- package/samples/recipes/contact/README.md +10 -4
- package/samples/recipes/contact/src/feature.ts +1 -1
- package/samples/recipes/realtime-sse/README.md +1 -0
- package/samples/recipes/realtime-sse/package.json +1 -0
- package/samples/recipes/realtime-sse/src/feature.ts +9 -0
- package/samples/recipes/record-detail-layout/README.md +1 -0
- package/samples/recipes/record-detail-layout/src/feature.ts +10 -0
- package/samples/recipes/wizard-form/README.md +9 -0
- package/samples/recipes/wizard-form/src/feature.ts +13 -2
package/packages/bundled-features/src/tenant-lifecycle/handlers/request-destruction.write.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { defineWriteHandler } from "@cosmicdrift/kumiko-framework/engine";
|
|
2
2
|
import * as z from "zod";
|
|
3
|
+
import { TENANT_ACCOUNT_CLOSE_ROLES } from "../constants.ts";
|
|
3
4
|
import { requestTenantDestruction } from "../request-tenant-destruction.ts";
|
|
4
5
|
|
|
5
6
|
const REQUEST_DESTRUCTION_TENANT_ROW_REASON =
|
|
@@ -8,7 +9,7 @@ const REQUEST_DESTRUCTION_TENANT_ROW_REASON =
|
|
|
8
9
|
export const requestDestructionWrite = defineWriteHandler({
|
|
9
10
|
name: "request-destruction",
|
|
10
11
|
schema: z.object({}),
|
|
11
|
-
access: { roles:
|
|
12
|
+
access: { roles: TENANT_ACCOUNT_CLOSE_ROLES },
|
|
12
13
|
description:
|
|
13
14
|
"Puts the caller's own tenant into destroyRequested, starts the compliance-profile grace period after which its data is erased, and revokes every session in the tenant; use it when an account owner asks to close their account.",
|
|
14
15
|
agent: { risk: "high" },
|
package/packages/bundled-features/src/user-data-rights/handlers/confirm-deletion-by-token.write.ts
CHANGED
|
@@ -56,7 +56,10 @@ export function createConfirmDeletionByTokenHandler(opts: ConfirmDeletionByToken
|
|
|
56
56
|
return defineWriteHandler({
|
|
57
57
|
name: "confirm-deletion-by-token",
|
|
58
58
|
schema: z.object({ token: z.string().min(1) }),
|
|
59
|
-
access: {
|
|
59
|
+
access: {
|
|
60
|
+
roles: ["anonymous", "Member", "User", "TenantAdmin", "SystemAdmin"],
|
|
61
|
+
anySignedIn: true,
|
|
62
|
+
},
|
|
60
63
|
escapeHatch: {
|
|
61
64
|
reason:
|
|
62
65
|
"resolveGracePeriod reads the tenant compliance profile via ctx.dispatch.queryAs(SYSTEM, " +
|
|
@@ -79,6 +79,7 @@ export const downloadByTokenQuery = defineQueryHandler({
|
|
|
79
79
|
access: {
|
|
80
80
|
roles: ["anonymous", "Member", "User", "TenantAdmin", "SystemAdmin"],
|
|
81
81
|
personalData: "public-intake",
|
|
82
|
+
anySignedIn: true,
|
|
82
83
|
},
|
|
83
84
|
agent: { expose: false },
|
|
84
85
|
// Brute-force protection for token-hash probing. This anonymous endpoint uses a
|
package/packages/bundled-features/src/user-data-rights/handlers/request-deletion-by-email.write.ts
CHANGED
|
@@ -61,7 +61,10 @@ export function createRequestDeletionByEmailHandler(opts: RequestDeletionByEmail
|
|
|
61
61
|
return defineWriteHandler({
|
|
62
62
|
name: "request-deletion-by-email",
|
|
63
63
|
schema: z.object({ email: z.email() }),
|
|
64
|
-
access: {
|
|
64
|
+
access: {
|
|
65
|
+
roles: ["anonymous", "Member", "User", "TenantAdmin", "SystemAdmin"],
|
|
66
|
+
anySignedIn: true,
|
|
67
|
+
},
|
|
65
68
|
description:
|
|
66
69
|
"Mails an account-deletion verification link to the given address, for a user who wants to be erased but can no longer log in; it answers identically whether or not the address belongs to an active account and never returns the link.",
|
|
67
70
|
// Mails a deletion link to any address the caller names.
|
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"version": "0.411.0",
|
|
4
|
+
"type": "improvement",
|
|
5
|
+
"title": "waitlist/static-submit, a DOM-free waitlist sign-up client",
|
|
6
|
+
"detail": "`@cosmicdrift/kumiko-bundled-features/waitlist/static-submit` exports `submitToWaitlist(submission)` for plain Astro scripts: fetch plus pure logic, no renderer, React or `window` at import time. It posts `waitlist:write:submit` same-origin with name, email, optional company, portfolio and message, the page locale (also sent as `X-Locale`) and the honeypot field `website`. Blank optional fields are dropped. The result is a discriminated union `{ kind: \"success\"; data } | { kind: \"failure\"; reason; message?; retryAfterSeconds? }`; a network error is the reason `network`, a 429 is `rate_limited`."
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
"version": "0.410.0",
|
|
10
|
+
"type": "fix",
|
|
11
|
+
"title": "Signed-in visitors can join the waitlist whatever their roles",
|
|
12
|
+
"detail": "`waitlist:write:submit` used to answer 403 when the browser sent the session cookie of a user without one of the listed roles. It now admits every signed-in caller through `anySignedIn`."
|
|
13
|
+
},
|
|
2
14
|
{
|
|
3
15
|
"version": "0.389.0",
|
|
4
16
|
"type": "fix",
|
|
@@ -33,7 +33,6 @@ const SUBMIT_LOCK_NAMESPACE = 0x776c7374;
|
|
|
33
33
|
const SUBMIT_LOCK_REASON =
|
|
34
34
|
"takes the per-email advisory lock so parallel submits cannot both pass the duplicate check and wraps the admin-recipient resolver in a savepoint so a failing statement cannot abort the submit transaction; TenantDb has neither API";
|
|
35
35
|
|
|
36
|
-
// Logged-in callers carry no anonymous role, so every signed-in role must be listed.
|
|
37
36
|
const SUBMIT_ROLES = access.roles(
|
|
38
37
|
...access.anonymous,
|
|
39
38
|
...access.authenticated,
|
|
@@ -132,7 +131,7 @@ export function createSubmitHandler(opts: WaitlistOptions) {
|
|
|
132
131
|
return defineWriteHandler<"submit", typeof WaitlistSubmitSchema, WaitlistSubmitData>({
|
|
133
132
|
name: "submit",
|
|
134
133
|
schema: WaitlistSubmitSchema,
|
|
135
|
-
access: { roles: SUBMIT_ROLES, personalData: "public-intake" },
|
|
134
|
+
access: { roles: SUBMIT_ROLES, personalData: "public-intake", anySignedIn: true },
|
|
136
135
|
rateLimit: opts.rateLimit ?? DEFAULT_SUBMIT_RATE_LIMIT,
|
|
137
136
|
// An empty array means "disabled"; boot validation rejects an empty additionalRateLimits.
|
|
138
137
|
...(emailRateLimits.length > 0 && { additionalRateLimits: emailRateLimits }),
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// DOM-free waitlist sign-up for static sites: fetch plus pure logic only.
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
dispatchWrite,
|
|
5
|
+
type StaticResult,
|
|
6
|
+
staticSuccess,
|
|
7
|
+
} from "@cosmicdrift/kumiko-bundled-features/auth-email-password/static-client";
|
|
8
|
+
import { WaitlistHandlers } from "./web/constants.ts";
|
|
9
|
+
|
|
10
|
+
export {
|
|
11
|
+
STATIC_NETWORK_REASON,
|
|
12
|
+
STATIC_RATE_LIMITED_REASON,
|
|
13
|
+
type StaticFailure,
|
|
14
|
+
type StaticResult,
|
|
15
|
+
type StaticSuccess,
|
|
16
|
+
} from "@cosmicdrift/kumiko-bundled-features/auth-email-password/static-client";
|
|
17
|
+
|
|
18
|
+
export type WaitlistSubmission = {
|
|
19
|
+
readonly name: string;
|
|
20
|
+
readonly email: string;
|
|
21
|
+
readonly company?: string;
|
|
22
|
+
readonly portfolio?: string;
|
|
23
|
+
readonly message?: string;
|
|
24
|
+
/** BCP 47 tag of the page language; also picks the language of the confirmation mail. */
|
|
25
|
+
readonly locale: string;
|
|
26
|
+
/** Honeypot: render it as a hidden field named `website` and pass its value through unchanged. */
|
|
27
|
+
readonly website?: string;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
function nonBlank(value: string | undefined): string | undefined {
|
|
31
|
+
return value === undefined || value.trim() === "" ? undefined : value;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** Success reads the same for a new and an already listed address. */
|
|
35
|
+
export async function submitToWaitlist(
|
|
36
|
+
submission: WaitlistSubmission,
|
|
37
|
+
): Promise<StaticResult<undefined>> {
|
|
38
|
+
const { name, email, locale, website } = submission;
|
|
39
|
+
const company = nonBlank(submission.company);
|
|
40
|
+
const portfolio = nonBlank(submission.portfolio);
|
|
41
|
+
const message = nonBlank(submission.message);
|
|
42
|
+
const result = await dispatchWrite(
|
|
43
|
+
WaitlistHandlers.submit,
|
|
44
|
+
{
|
|
45
|
+
name,
|
|
46
|
+
email,
|
|
47
|
+
locale,
|
|
48
|
+
...(company !== undefined && { company }),
|
|
49
|
+
...(portfolio !== undefined && { portfolio }),
|
|
50
|
+
...(message !== undefined && { message }),
|
|
51
|
+
...(website !== undefined && { website }),
|
|
52
|
+
},
|
|
53
|
+
{ locale },
|
|
54
|
+
);
|
|
55
|
+
return result.kind === "success" ? staticSuccess(undefined) : result;
|
|
56
|
+
}
|
|
@@ -275,4 +275,147 @@ export const WIDGETS_I18N = {
|
|
|
275
275
|
"widgets:catalog:plan-contact-sales": { de: "Vertrieb kontaktieren", en: "Contact sales" },
|
|
276
276
|
"widgets:catalog:plan-credits": { de: "Credit-Paket", en: "Credit pack" },
|
|
277
277
|
"widgets:catalog:plan-buy": { de: "Kaufen", en: "Buy" },
|
|
278
|
+
"widgets:catalog:variants-title": { de: "Neue Varianten", en: "New variants" },
|
|
279
|
+
"widgets:catalog:variants-heading-group": { de: "Gruppen-Überschrift", en: "Group heading" },
|
|
280
|
+
"widgets:catalog:variants-heading-section": {
|
|
281
|
+
de: "Abschnitts-Überschrift",
|
|
282
|
+
en: "Section heading",
|
|
283
|
+
},
|
|
284
|
+
"widgets:catalog:variants-detail-normal": {
|
|
285
|
+
de: "Details mit normalen Werten",
|
|
286
|
+
en: "Details with normal-weight values",
|
|
287
|
+
},
|
|
288
|
+
"widgets:catalog:variants-detail-sidebar": {
|
|
289
|
+
de: "Details in der Seitenspalte",
|
|
290
|
+
en: "Details in a side column",
|
|
291
|
+
},
|
|
292
|
+
"widgets:catalog:variants-label-owner": { de: "Inhaber", en: "Owner" },
|
|
293
|
+
"widgets:catalog:variants-value-owner": { de: "Jamie Rivera", en: "Jamie Rivera" },
|
|
294
|
+
"widgets:catalog:variants-label-region": { de: "Region", en: "Region" },
|
|
295
|
+
"widgets:catalog:variants-value-region": { de: "Frankfurt", en: "Frankfurt" },
|
|
296
|
+
"widgets:catalog:variants-label-plan": { de: "Tarif", en: "Plan" },
|
|
297
|
+
"widgets:catalog:variants-value-plan": { de: "Team", en: "Team" },
|
|
298
|
+
"widgets:catalog:variants-composer": { de: "Chat-Eingabe", en: "Chat composer" },
|
|
299
|
+
"widgets:catalog:variants-composer-placeholder": {
|
|
300
|
+
de: "Nachricht schreiben",
|
|
301
|
+
en: "Write a message",
|
|
302
|
+
},
|
|
303
|
+
"widgets:catalog:variants-composer-send": { de: "Senden", en: "Send" },
|
|
304
|
+
"widgets:catalog:variants-textarea-placeholder": {
|
|
305
|
+
de: "Notiz mit Platzhalter",
|
|
306
|
+
en: "Note with placeholder",
|
|
307
|
+
},
|
|
308
|
+
"widgets:catalog:variants-textarea-hint": {
|
|
309
|
+
de: "Beschreibe kurz, was zu tun ist",
|
|
310
|
+
en: "Describe briefly what needs doing",
|
|
311
|
+
},
|
|
312
|
+
"widgets:catalog:variants-mode-switch": {
|
|
313
|
+
de: "Modus mit gesperrter und markierter Option",
|
|
314
|
+
en: "Mode switch with disabled and flagged option",
|
|
315
|
+
},
|
|
316
|
+
"widgets:catalog:variants-mode-a": { de: "Automatisch", en: "Automatic" },
|
|
317
|
+
"widgets:catalog:variants-mode-b": { de: "Manuell", en: "Manual" },
|
|
318
|
+
"widgets:catalog:variants-mode-c": { de: "Offene Fragen", en: "Open questions" },
|
|
319
|
+
"widgets:catalog:variants-mode-d": { de: "Gesperrt", en: "Locked" },
|
|
320
|
+
"widgets:catalog:variants-section-nav": {
|
|
321
|
+
de: "Abschnittsnavigation für eigene Screens",
|
|
322
|
+
en: "Section navigation for custom screens",
|
|
323
|
+
},
|
|
324
|
+
"widgets:catalog:variants-nav-profile": { de: "Profil", en: "Profile" },
|
|
325
|
+
"widgets:catalog:variants-nav-billing": { de: "Abrechnung", en: "Billing" },
|
|
326
|
+
"widgets:catalog:variants-nav-security": { de: "Sicherheit", en: "Security" },
|
|
327
|
+
"widgets:catalog:variants-nav-body": {
|
|
328
|
+
de: "Die Liste rechts springt zum Abschnitt und folgt dem Scrollen.",
|
|
329
|
+
en: "The list on the right jumps to the section and follows the scroll position.",
|
|
330
|
+
},
|
|
331
|
+
"widgets:catalog:variants-banner": {
|
|
332
|
+
de: "Hinweis mit Symbol und Hervorhebung",
|
|
333
|
+
en: "Banner with icon and emphasis",
|
|
334
|
+
},
|
|
335
|
+
"widgets:catalog:variants-banner-lead": {
|
|
336
|
+
de: "Vor dem Löschen bitte ",
|
|
337
|
+
en: "Before deleting, please ",
|
|
338
|
+
},
|
|
339
|
+
"widgets:catalog:variants-banner-strong": { de: "ein Backup anlegen", en: "create a backup" },
|
|
340
|
+
"widgets:catalog:variants-banner-tail": {
|
|
341
|
+
de: ". Das Löschen ist endgültig.",
|
|
342
|
+
en: ". Deleting is permanent.",
|
|
343
|
+
},
|
|
344
|
+
"widgets:catalog:variants-round2-title": {
|
|
345
|
+
de: "Studio-Varianten, zweite Runde",
|
|
346
|
+
en: "Studio variants, round two",
|
|
347
|
+
},
|
|
348
|
+
"widgets:catalog:variants-choice": {
|
|
349
|
+
de: "Auswahlkarten, drei Spalten, Radio",
|
|
350
|
+
en: "Choice cards, three columns, radio",
|
|
351
|
+
},
|
|
352
|
+
"widgets:catalog:variants-choice-label": { de: "Womit beginnen?", en: "Where to start?" },
|
|
353
|
+
"widgets:catalog:variants-choice-empty": { de: "Leer beginnen", en: "Start empty" },
|
|
354
|
+
"widgets:catalog:variants-choice-empty-desc": {
|
|
355
|
+
de: "Nur Anmeldung und Benutzer",
|
|
356
|
+
en: "Sign-in and users only",
|
|
357
|
+
},
|
|
358
|
+
"widgets:catalog:variants-choice-service": {
|
|
359
|
+
de: "Wartung und Prüfung",
|
|
360
|
+
en: "Service and checks",
|
|
361
|
+
},
|
|
362
|
+
"widgets:catalog:variants-choice-service-desc": {
|
|
363
|
+
de: "Vorlage: Anlagen, Intervalle, Prüfprotokolle",
|
|
364
|
+
en: "Template: assets, intervals, inspection reports",
|
|
365
|
+
},
|
|
366
|
+
"widgets:catalog:variants-choice-guests": { de: "Gästeliste", en: "Guest list" },
|
|
367
|
+
"widgets:catalog:variants-choice-guests-desc": {
|
|
368
|
+
de: "Vorlage: Veranstaltung, Zusage per Link",
|
|
369
|
+
en: "Template: event, RSVP by link",
|
|
370
|
+
},
|
|
371
|
+
"widgets:catalog:variants-mode-wide": {
|
|
372
|
+
de: "Modus mit breiten Segmenten, Warnrahmen um den ganzen Schalter",
|
|
373
|
+
en: "Mode switch with wide segments, warning frame around the whole switch",
|
|
374
|
+
},
|
|
375
|
+
"widgets:catalog:variants-compare": {
|
|
376
|
+
de: "Vergleichstabelle, Zeilenköpfe in Textfarbe",
|
|
377
|
+
en: "Comparison table, row headers in text colour",
|
|
378
|
+
},
|
|
379
|
+
"widgets:catalog:variants-compare-field": { de: "Angabe", en: "Item" },
|
|
380
|
+
"widgets:catalog:variants-compare-left": { de: "Aus dem Dokument", en: "From the document" },
|
|
381
|
+
"widgets:catalog:variants-compare-right": { de: "Im Bestand", en: "In stock" },
|
|
382
|
+
"widgets:catalog:variants-compare-name": { de: "Name", en: "Name" },
|
|
383
|
+
"widgets:catalog:variants-compare-city": { de: "Ort", en: "City" },
|
|
384
|
+
"widgets:catalog:variants-docked": {
|
|
385
|
+
de: "Angedockte Chat-Eingabe",
|
|
386
|
+
en: "Docked chat composer",
|
|
387
|
+
},
|
|
388
|
+
"widgets:catalog:variants-docked-message": {
|
|
389
|
+
de: "Der Verlauf scrollt, die Eingabe bleibt unten sichtbar.",
|
|
390
|
+
en: "The thread scrolls, the composer stays visible at the bottom.",
|
|
391
|
+
},
|
|
392
|
+
"widgets:catalog:variants-banner-below": {
|
|
393
|
+
de: "Hinweis mit Aktion unter dem Text",
|
|
394
|
+
en: "Banner with the action below the text",
|
|
395
|
+
},
|
|
396
|
+
"widgets:catalog:variants-banner-below-title": {
|
|
397
|
+
de: "Veröffentlichen gescheitert",
|
|
398
|
+
en: "Publishing failed",
|
|
399
|
+
},
|
|
400
|
+
"widgets:catalog:variants-banner-below-body": {
|
|
401
|
+
de: "Die Prüfung ist fehlgeschlagen. Bitte erneut versuchen.",
|
|
402
|
+
en: "The check failed. Please try again.",
|
|
403
|
+
},
|
|
404
|
+
"widgets:catalog:variants-banner-below-action": { de: "Erneut versuchen", en: "Try again" },
|
|
405
|
+
"widgets:catalog:variants-rail": {
|
|
406
|
+
de: "Wizard-Leiste: Schritt ohne Untertitel, Hinweis im Kasten",
|
|
407
|
+
en: "Wizard rail: active step without subtitle, hint in the box",
|
|
408
|
+
},
|
|
409
|
+
"widgets:catalog:variants-rail-heading": { de: "Schritt 1 von 2", en: "Step 1 of 2" },
|
|
410
|
+
"widgets:catalog:variants-rail-step-one": { de: "Beschreiben", en: "Describe" },
|
|
411
|
+
"widgets:catalog:variants-rail-step-two": { de: "Steckbrief", en: "Profile" },
|
|
412
|
+
"widgets:catalog:variants-rail-subtitle": {
|
|
413
|
+
de: "Rollen, Funktionen, Personendaten und noch ein langer Zusatz, der umbricht",
|
|
414
|
+
en: "Roles, features, personal data and a long addition that wraps",
|
|
415
|
+
},
|
|
416
|
+
"widgets:catalog:variants-rail-up-next": { de: "Als Nächstes", en: "Up next" },
|
|
417
|
+
"widgets:catalog:variants-rail-hint": {
|
|
418
|
+
de: "Die KI fragt nur nach, was offen ist",
|
|
419
|
+
en: "The AI only asks about what is open",
|
|
420
|
+
},
|
|
278
421
|
} as const;
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
// Opt-in widget variants, one block each, for screenshot review.
|
|
2
|
+
|
|
3
|
+
import { usePrimitives, useTranslation } from "@cosmicdrift/kumiko-renderer";
|
|
4
|
+
import {
|
|
5
|
+
ChoiceCards,
|
|
6
|
+
Composer,
|
|
7
|
+
DetailList,
|
|
8
|
+
ModeSwitch,
|
|
9
|
+
PageSection,
|
|
10
|
+
SectionCard,
|
|
11
|
+
SectionNavLayout,
|
|
12
|
+
SideBySideTable,
|
|
13
|
+
StepBar,
|
|
14
|
+
TextareaField,
|
|
15
|
+
} from "@cosmicdrift/kumiko-renderer/web";
|
|
16
|
+
import { type ReactNode, useState } from "react";
|
|
17
|
+
|
|
18
|
+
type DemoMode = "auto" | "manual" | "questions" | "locked";
|
|
19
|
+
|
|
20
|
+
type DemoChoice = "empty" | "service" | "guests";
|
|
21
|
+
|
|
22
|
+
export function VariantsRoundTwoDemo(): ReactNode {
|
|
23
|
+
const t = useTranslation();
|
|
24
|
+
const { Heading, Banner, Button, Text } = usePrimitives();
|
|
25
|
+
const [choice, setChoice] = useState<DemoChoice | null>("service");
|
|
26
|
+
const [mode, setMode] = useState<DemoMode>("manual");
|
|
27
|
+
const [message, setMessage] = useState("");
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<SectionCard title={t("widgets:catalog:variants-round2-title")} testId="variants-round2-demo">
|
|
31
|
+
<div className="flex flex-col gap-6">
|
|
32
|
+
<div className="flex flex-col gap-2" data-testid="variants-choice">
|
|
33
|
+
<Heading variant="group">{t("widgets:catalog:variants-choice")}</Heading>
|
|
34
|
+
<ChoiceCards
|
|
35
|
+
value={choice}
|
|
36
|
+
onChange={setChoice}
|
|
37
|
+
columns={3}
|
|
38
|
+
variant="radio"
|
|
39
|
+
label={t("widgets:catalog:variants-choice-label")}
|
|
40
|
+
options={[
|
|
41
|
+
{
|
|
42
|
+
value: "empty",
|
|
43
|
+
title: t("widgets:catalog:variants-choice-empty"),
|
|
44
|
+
description: t("widgets:catalog:variants-choice-empty-desc"),
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
value: "service",
|
|
48
|
+
title: t("widgets:catalog:variants-choice-service"),
|
|
49
|
+
description: t("widgets:catalog:variants-choice-service-desc"),
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
value: "guests",
|
|
53
|
+
title: t("widgets:catalog:variants-choice-guests"),
|
|
54
|
+
description: t("widgets:catalog:variants-choice-guests-desc"),
|
|
55
|
+
},
|
|
56
|
+
]}
|
|
57
|
+
/>
|
|
58
|
+
</div>
|
|
59
|
+
|
|
60
|
+
<div className="flex flex-col gap-2" data-testid="variants-mode-wide">
|
|
61
|
+
<Heading variant="group">{t("widgets:catalog:variants-mode-wide")}</Heading>
|
|
62
|
+
<ModeSwitch
|
|
63
|
+
value={mode}
|
|
64
|
+
onChange={setMode}
|
|
65
|
+
segmentWidth="wide"
|
|
66
|
+
className="w-fit"
|
|
67
|
+
options={[
|
|
68
|
+
{ value: "auto", label: t("widgets:catalog:variants-mode-a") },
|
|
69
|
+
{ value: "manual", label: t("widgets:catalog:variants-mode-b") },
|
|
70
|
+
{ value: "questions", label: t("widgets:catalog:variants-mode-c"), tone: "warning" },
|
|
71
|
+
]}
|
|
72
|
+
/>
|
|
73
|
+
</div>
|
|
74
|
+
|
|
75
|
+
<div className="flex flex-col gap-2" data-testid="variants-compare">
|
|
76
|
+
<Heading variant="group">{t("widgets:catalog:variants-compare")}</Heading>
|
|
77
|
+
<SideBySideTable
|
|
78
|
+
caption={t("widgets:catalog:variants-compare")}
|
|
79
|
+
rowHeaderLabel={t("widgets:catalog:variants-compare-field")}
|
|
80
|
+
rowHeaderTone="foreground"
|
|
81
|
+
columns={[
|
|
82
|
+
{ id: "doc", label: t("widgets:catalog:variants-compare-left") },
|
|
83
|
+
{ id: "stock", label: t("widgets:catalog:variants-compare-right") },
|
|
84
|
+
]}
|
|
85
|
+
rows={[
|
|
86
|
+
{
|
|
87
|
+
id: "name",
|
|
88
|
+
header: t("widgets:catalog:variants-compare-name"),
|
|
89
|
+
cells: [{ content: t("widgets:catalog:variants-value-owner"), colSpan: 2 }],
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
id: "city",
|
|
93
|
+
header: t("widgets:catalog:variants-compare-city"),
|
|
94
|
+
cells: [{ content: "Frankfurt" }, { content: "Hamburg" }],
|
|
95
|
+
},
|
|
96
|
+
]}
|
|
97
|
+
/>
|
|
98
|
+
</div>
|
|
99
|
+
|
|
100
|
+
<div className="flex flex-col gap-2" data-testid="variants-docked">
|
|
101
|
+
<Heading variant="group">{t("widgets:catalog:variants-docked")}</Heading>
|
|
102
|
+
<div className="h-64 overflow-y-auto rounded-md border border-border">
|
|
103
|
+
<PageSection className="flex min-h-full flex-col">
|
|
104
|
+
{Array.from({ length: 12 }, (_, index) => (
|
|
105
|
+
<Text key={`line-${index.toString()}`} variant="muted">
|
|
106
|
+
{t("widgets:catalog:variants-docked-message")}
|
|
107
|
+
</Text>
|
|
108
|
+
))}
|
|
109
|
+
<Composer
|
|
110
|
+
docked
|
|
111
|
+
value={message}
|
|
112
|
+
onChange={setMessage}
|
|
113
|
+
onSubmit={() => setMessage("")}
|
|
114
|
+
placeholder={t("widgets:catalog:variants-composer-placeholder")}
|
|
115
|
+
submitLabel={t("widgets:catalog:variants-composer-send")}
|
|
116
|
+
testId="variants-docked-composer"
|
|
117
|
+
/>
|
|
118
|
+
</PageSection>
|
|
119
|
+
</div>
|
|
120
|
+
</div>
|
|
121
|
+
|
|
122
|
+
<div className="flex flex-col gap-2" data-testid="variants-banner-below">
|
|
123
|
+
<Heading variant="group">{t("widgets:catalog:variants-banner-below")}</Heading>
|
|
124
|
+
<Banner
|
|
125
|
+
variant="error"
|
|
126
|
+
icon="alert-triangle"
|
|
127
|
+
title={t("widgets:catalog:variants-banner-below-title")}
|
|
128
|
+
actionsPlacement="below"
|
|
129
|
+
actions={
|
|
130
|
+
<Button variant="secondary" size="sm">
|
|
131
|
+
{t("widgets:catalog:variants-banner-below-action")}
|
|
132
|
+
</Button>
|
|
133
|
+
}
|
|
134
|
+
>
|
|
135
|
+
{t("widgets:catalog:variants-banner-below-body")}
|
|
136
|
+
</Banner>
|
|
137
|
+
</div>
|
|
138
|
+
|
|
139
|
+
<div className="flex flex-col gap-2" data-testid="variants-rail">
|
|
140
|
+
<Heading variant="group">{t("widgets:catalog:variants-rail")}</Heading>
|
|
141
|
+
<div className="flex h-96 border border-border">
|
|
142
|
+
<StepBar
|
|
143
|
+
orientation="vertical"
|
|
144
|
+
steps={[
|
|
145
|
+
t("widgets:catalog:variants-rail-step-one"),
|
|
146
|
+
t("widgets:catalog:variants-rail-step-two"),
|
|
147
|
+
]}
|
|
148
|
+
currentIndex={0}
|
|
149
|
+
compactLabel={t("widgets:catalog:variants-rail-heading")}
|
|
150
|
+
heading={t("widgets:catalog:variants-rail-heading")}
|
|
151
|
+
subtitles={[undefined, t("widgets:catalog:variants-rail-subtitle")]}
|
|
152
|
+
upNext={{
|
|
153
|
+
heading: t("widgets:catalog:variants-rail-up-next"),
|
|
154
|
+
title: t("widgets:catalog:variants-rail-step-two"),
|
|
155
|
+
subtitle: t("widgets:catalog:variants-rail-hint"),
|
|
156
|
+
}}
|
|
157
|
+
testId="variants-rail-steps"
|
|
158
|
+
/>
|
|
159
|
+
</div>
|
|
160
|
+
</div>
|
|
161
|
+
</div>
|
|
162
|
+
</SectionCard>
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export function VariantsDemo(): ReactNode {
|
|
167
|
+
const t = useTranslation();
|
|
168
|
+
const { Heading, Banner } = usePrimitives();
|
|
169
|
+
const [mode, setMode] = useState<DemoMode>("auto");
|
|
170
|
+
const [note, setNote] = useState("");
|
|
171
|
+
const [message, setMessage] = useState("");
|
|
172
|
+
|
|
173
|
+
const detailRows = [
|
|
174
|
+
{
|
|
175
|
+
label: t("widgets:catalog:variants-label-owner"),
|
|
176
|
+
value: t("widgets:catalog:variants-value-owner"),
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
label: t("widgets:catalog:variants-label-region"),
|
|
180
|
+
value: t("widgets:catalog:variants-value-region"),
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
label: t("widgets:catalog:variants-label-plan"),
|
|
184
|
+
value: t("widgets:catalog:variants-value-plan"),
|
|
185
|
+
},
|
|
186
|
+
];
|
|
187
|
+
|
|
188
|
+
const navSections = ["profile", "billing", "security"].map((id) => ({
|
|
189
|
+
id: `variants-nav-${id}`,
|
|
190
|
+
title: t(`widgets:catalog:variants-nav-${id}`),
|
|
191
|
+
}));
|
|
192
|
+
|
|
193
|
+
return (
|
|
194
|
+
<SectionCard title={t("widgets:catalog:variants-title")} testId="variants-demo">
|
|
195
|
+
<div className="flex flex-col gap-6">
|
|
196
|
+
<div className="flex flex-col gap-2" data-testid="variants-heading">
|
|
197
|
+
<Heading variant="group">{t("widgets:catalog:variants-heading-group")}</Heading>
|
|
198
|
+
<Heading variant="section">{t("widgets:catalog:variants-heading-section")}</Heading>
|
|
199
|
+
</div>
|
|
200
|
+
|
|
201
|
+
<div className="grid gap-6 md:grid-cols-[1fr_280px]">
|
|
202
|
+
<div data-testid="variants-detail-normal">
|
|
203
|
+
<Heading variant="group">{t("widgets:catalog:variants-detail-normal")}</Heading>
|
|
204
|
+
<DetailList rows={detailRows} valueWeight="normal" />
|
|
205
|
+
</div>
|
|
206
|
+
<div data-testid="variants-detail-sidebar">
|
|
207
|
+
<Heading variant="group">{t("widgets:catalog:variants-detail-sidebar")}</Heading>
|
|
208
|
+
<DetailList rows={detailRows} valueWeight="normal" layout="sidebar" />
|
|
209
|
+
</div>
|
|
210
|
+
</div>
|
|
211
|
+
|
|
212
|
+
<div className="flex flex-col gap-2" data-testid="variants-mode-switch">
|
|
213
|
+
<Heading variant="group">{t("widgets:catalog:variants-mode-switch")}</Heading>
|
|
214
|
+
<ModeSwitch
|
|
215
|
+
value={mode}
|
|
216
|
+
onChange={setMode}
|
|
217
|
+
options={[
|
|
218
|
+
{ value: "auto", label: t("widgets:catalog:variants-mode-a") },
|
|
219
|
+
{ value: "manual", label: t("widgets:catalog:variants-mode-b") },
|
|
220
|
+
{ value: "questions", label: t("widgets:catalog:variants-mode-c"), tone: "warning" },
|
|
221
|
+
{ value: "locked", label: t("widgets:catalog:variants-mode-d"), disabled: true },
|
|
222
|
+
]}
|
|
223
|
+
/>
|
|
224
|
+
</div>
|
|
225
|
+
|
|
226
|
+
<div data-testid="variants-banner">
|
|
227
|
+
<Banner
|
|
228
|
+
variant="warning"
|
|
229
|
+
icon="alert-triangle"
|
|
230
|
+
parts={[
|
|
231
|
+
{ text: t("widgets:catalog:variants-banner-lead") },
|
|
232
|
+
{ text: t("widgets:catalog:variants-banner-strong"), strong: true },
|
|
233
|
+
{ text: t("widgets:catalog:variants-banner-tail") },
|
|
234
|
+
]}
|
|
235
|
+
/>
|
|
236
|
+
</div>
|
|
237
|
+
|
|
238
|
+
<TextareaField
|
|
239
|
+
label={t("widgets:catalog:variants-textarea-placeholder")}
|
|
240
|
+
id="variants-textarea"
|
|
241
|
+
name="variants-textarea"
|
|
242
|
+
value={note}
|
|
243
|
+
onChange={setNote}
|
|
244
|
+
placeholder={t("widgets:catalog:variants-textarea-hint")}
|
|
245
|
+
testId="variants-textarea"
|
|
246
|
+
/>
|
|
247
|
+
|
|
248
|
+
<div className="flex min-h-40 flex-col" data-testid="variants-composer-host">
|
|
249
|
+
<Heading variant="group">{t("widgets:catalog:variants-composer")}</Heading>
|
|
250
|
+
<Composer
|
|
251
|
+
value={message}
|
|
252
|
+
onChange={setMessage}
|
|
253
|
+
onSubmit={() => setMessage("")}
|
|
254
|
+
placeholder={t("widgets:catalog:variants-composer-placeholder")}
|
|
255
|
+
submitLabel={t("widgets:catalog:variants-composer-send")}
|
|
256
|
+
testId="variants-composer"
|
|
257
|
+
/>
|
|
258
|
+
</div>
|
|
259
|
+
|
|
260
|
+
<div className="flex flex-col gap-2" data-testid="variants-section-nav">
|
|
261
|
+
<Heading variant="group">{t("widgets:catalog:variants-section-nav")}</Heading>
|
|
262
|
+
<SectionNavLayout items={navSections} testId="variants-section-nav-layout">
|
|
263
|
+
{navSections.map((section) => (
|
|
264
|
+
<section key={section.id} id={section.id} className="flex flex-col gap-1">
|
|
265
|
+
<Heading variant="group">{section.title}</Heading>
|
|
266
|
+
<p className="text-sm text-muted-foreground">
|
|
267
|
+
{t("widgets:catalog:variants-nav-body")}
|
|
268
|
+
</p>
|
|
269
|
+
</section>
|
|
270
|
+
))}
|
|
271
|
+
</SectionNavLayout>
|
|
272
|
+
</div>
|
|
273
|
+
</div>
|
|
274
|
+
</SectionCard>
|
|
275
|
+
);
|
|
276
|
+
}
|
|
@@ -42,6 +42,7 @@ import { Wallet } from "lucide-react";
|
|
|
42
42
|
import { type ReactNode, useEffect, useMemo, useState } from "react";
|
|
43
43
|
import { euro, percent } from "../lib/format";
|
|
44
44
|
import { InboxReaderExamples } from "./InboxReaderExamples";
|
|
45
|
+
import { VariantsDemo, VariantsRoundTwoDemo } from "./VariantsDemo";
|
|
45
46
|
|
|
46
47
|
const RESPONSE_TIMES = Array.from({ length: 48 }, (_, i) => ({
|
|
47
48
|
atMs: i * 30 * 60 * 1000,
|
|
@@ -329,6 +330,8 @@ export function Widgets(): ReactNode {
|
|
|
329
330
|
<ComparisonDemo />
|
|
330
331
|
<AiTextDemo />
|
|
331
332
|
<PlanCatalogDemo />
|
|
333
|
+
<VariantsDemo />
|
|
334
|
+
<VariantsRoundTwoDemo />
|
|
332
335
|
</div>
|
|
333
336
|
);
|
|
334
337
|
}
|
|
@@ -133,6 +133,7 @@ export const workboardFeature = defineFeature("workboard", (r) => {
|
|
|
133
133
|
searchable: true,
|
|
134
134
|
facets: { estimateHours: { display: "range" } },
|
|
135
135
|
table: {
|
|
136
|
+
compactHeader: true,
|
|
136
137
|
grouping: { field: "status", collapsedWhen: "done", userChoice: true, fields: ["priority"] },
|
|
137
138
|
totals: [{ field: "estimateHours", kind: "sum" }],
|
|
138
139
|
},
|