@cosmicdrift/kumiko-samples 0.415.0 → 0.417.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.
Files changed (78) hide show
  1. package/package.json +1 -1
  2. package/packages/bundled-features/package.json +21 -1
  3. package/packages/bundled-features/src/agent-tools/changes.json +6 -0
  4. package/packages/bundled-features/src/agent-tools/tool-catalog.ts +20 -1
  5. package/packages/bundled-features/src/agent-tools/tool-dispatch.ts +19 -5
  6. package/packages/bundled-features/src/channel-whatsapp/changes.json +6 -0
  7. package/packages/bundled-features/src/channel-whatsapp/constants.ts +1 -0
  8. package/packages/bundled-features/src/channel-whatsapp/graph-client.ts +37 -1
  9. package/packages/bundled-features/src/handbook-knowledge/README.md +64 -0
  10. package/packages/bundled-features/src/handbook-knowledge/changes.json +8 -0
  11. package/packages/bundled-features/src/handbook-knowledge/constants.ts +8 -0
  12. package/packages/bundled-features/src/handbook-knowledge/feature.ts +34 -0
  13. package/packages/bundled-features/src/handbook-knowledge/handbook-index.ts +66 -0
  14. package/packages/bundled-features/src/handbook-knowledge/handlers.ts +77 -0
  15. package/packages/bundled-features/src/handbook-knowledge/index.ts +10 -0
  16. package/packages/bundled-features/src/helpdesk/screens.ts +5 -1
  17. package/packages/bundled-features/src/signature/README.md +66 -0
  18. package/packages/bundled-features/src/signature/changes.json +22 -0
  19. package/packages/bundled-features/src/signature/entity.ts +192 -0
  20. package/packages/bundled-features/src/signature/feature.ts +125 -0
  21. package/packages/bundled-features/src/signature/files.ts +107 -0
  22. package/packages/bundled-features/src/signature/grant.ts +79 -0
  23. package/packages/bundled-features/src/signature/handlers/anonymous.write.ts +88 -0
  24. package/packages/bundled-features/src/signature/handlers/cancel.write.ts +48 -0
  25. package/packages/bundled-features/src/signature/handlers/issue-link.write.ts +77 -0
  26. package/packages/bundled-features/src/signature/handlers/lifecycle.write.ts +99 -0
  27. package/packages/bundled-features/src/signature/handlers/link-internal.write.ts +261 -0
  28. package/packages/bundled-features/src/signature/handlers/request.write.ts +120 -0
  29. package/packages/bundled-features/src/signature/handlers/revoke-link.write.ts +37 -0
  30. package/packages/bundled-features/src/signature/handlers/sign-in-person.write.ts +73 -0
  31. package/packages/bundled-features/src/signature/i18n.ts +52 -0
  32. package/packages/bundled-features/src/signature/index.ts +35 -0
  33. package/packages/bundled-features/src/signature/lib.ts +125 -0
  34. package/packages/bundled-features/src/signature/options.ts +64 -0
  35. package/packages/bundled-features/src/signature/payloads.ts +71 -0
  36. package/packages/bundled-features/src/signature/png.ts +169 -0
  37. package/packages/bundled-features/src/signature/screens.ts +117 -0
  38. package/packages/bundled-features/src/signature/signature-page.ts +93 -0
  39. package/packages/bundled-features/src/signature/signing.ts +77 -0
  40. package/packages/bundled-features/src/signature/static-sign.ts +99 -0
  41. package/packages/bundled-features/src/signature/subject-queries.ts +144 -0
  42. package/packages/bundled-features/src/signature/subject-scope.ts +43 -0
  43. package/packages/bundled-features/src/signature/sweep.ts +161 -0
  44. package/packages/bundled-features/src/signature/user-data.ts +159 -0
  45. package/packages/bundled-features/src/signature/web/constants.ts +92 -0
  46. package/packages/bundled-features/src/signature/web/index.ts +31 -0
  47. package/packages/bundled-features/src/signature/web/pad.ts +147 -0
  48. package/packages/bundled-features/src/signature/web/signature-pad.tsx +82 -0
  49. package/packages/bundled-features/src/subscription-stripe/changes.json +6 -0
  50. package/packages/bundled-features/src/subscription-stripe/feature.ts +9 -0
  51. package/packages/bundled-features/src/subscription-stripe/plugin-methods.ts +7 -1
  52. package/samples/apps/use-all-bundled/feature-manifest.json +63 -1
  53. package/samples/apps/use-all-bundled/kumiko/migrations/0068_signature.rebuild.json +4 -0
  54. package/samples/apps/use-all-bundled/src/run-config.ts +35 -1
  55. package/samples/recipes/dashboard-stats/README.md +4 -0
  56. package/samples/recipes/dashboard-stats/src/feature.ts +47 -0
  57. package/samples/recipes/embedded/README.md +4 -0
  58. package/samples/recipes/embedded/src/entities/invoice.ts +6 -0
  59. package/samples/recipes/embedded/src/feature.ts +7 -1
  60. package/samples/recipes/embedded/src/handlers/invoice-receive.write.ts +1 -0
  61. package/samples/recipes/embedded/src/screens/invoice-receive.screen.ts +2 -0
  62. package/samples/recipes/event-sourcing/src/feature.ts +31 -0
  63. package/samples/recipes/handbook-knowledge/README.md +22 -0
  64. package/samples/recipes/handbook-knowledge/package.json +12 -0
  65. package/samples/recipes/handbook-knowledge/src/feature.ts +42 -0
  66. package/samples/recipes/list-table-options/README.md +9 -0
  67. package/samples/recipes/list-table-options/src/feature.ts +47 -2
  68. package/samples/recipes/managed-config/src/feature.ts +9 -1
  69. package/samples/recipes/record-detail-layout/README.md +7 -0
  70. package/samples/recipes/record-detail-layout/src/feature.ts +40 -2
  71. package/samples/recipes/record-detail-layout/src/order-board.ts +1 -0
  72. package/samples/recipes/secrets-demo/README.md +1 -1
  73. package/samples/recipes/secrets-demo/src/feature.ts +2 -0
  74. package/samples/recipes/signature/README.md +21 -0
  75. package/samples/recipes/signature/package.json +13 -0
  76. package/samples/recipes/signature/src/feature.ts +26 -0
  77. package/samples/recipes/writeform-section/README.md +4 -0
  78. package/samples/recipes/writeform-section/src/feature.ts +97 -0
@@ -55,6 +55,7 @@ import { createFoldersFeature } from "@cosmicdrift/kumiko-bundled-features/folde
55
55
  import { createFoldersUserDataFeature } from "@cosmicdrift/kumiko-bundled-features/folders-user-data";
56
56
  import { createFormDraftFeature } from "@cosmicdrift/kumiko-bundled-features/form-draft";
57
57
  import { createFormDraftUserDataFeature } from "@cosmicdrift/kumiko-bundled-features/form-draft-user-data";
58
+ import { createHandbookKnowledgeFeature } from "@cosmicdrift/kumiko-bundled-features/handbook-knowledge";
58
59
  import {
59
60
  createHelpdeskFeature,
60
61
  helpdeskOpenRequestsPanels,
@@ -81,6 +82,7 @@ import { createRendererFoundationFeature } from "@cosmicdrift/kumiko-bundled-fea
81
82
  import { createRendererPdfFeature } from "@cosmicdrift/kumiko-bundled-features/renderer-pdf";
82
83
  import { createSecretsFeature } from "@cosmicdrift/kumiko-bundled-features/secrets";
83
84
  import { createSeoFeature } from "@cosmicdrift/kumiko-bundled-features/seo";
85
+ import { createSignatureFeature } from "@cosmicdrift/kumiko-bundled-features/signature";
84
86
  import { createStepDispatcherFeature } from "@cosmicdrift/kumiko-bundled-features/step-dispatcher";
85
87
  import { createSubscriptionMollieFeature } from "@cosmicdrift/kumiko-bundled-features/subscription-mollie";
86
88
  import { createSubscriptionPaddleFeature } from "@cosmicdrift/kumiko-bundled-features/subscription-paddle";
@@ -106,7 +108,10 @@ import {
106
108
  import { createDocumentDesignerFeature } from "@cosmicdrift/kumiko-document-designer";
107
109
  import type { TenantId } from "@cosmicdrift/kumiko-framework/engine";
108
110
  import { localeDe } from "@cosmicdrift/kumiko-locale-de";
109
- import { createRendererPuppeteerClientFeature } from "@cosmicdrift/kumiko-renderer-puppeteer-client";
111
+ import {
112
+ createRendererPuppeteerClientFeature,
113
+ renderHtmlToPdf,
114
+ } from "@cosmicdrift/kumiko-renderer-puppeteer-client";
110
115
  import { ADMIN_NAV_QN, ADMIN_NAV_WORKSPACES, adminNavFeature } from "./app/admin-nav-feature";
111
116
  import { DEV_TENANT_ID } from "./app/auth-constants";
112
117
  import { CAP_OVERVIEW_CAPS } from "./app/cap-overview-caps";
@@ -374,6 +379,35 @@ export const APP_FEATURES = [
374
379
  // PDF printing for document templates; the print service is reached through
375
380
  // PUPPETEER_SERVICE_URL + PUPPETEER_AUTH_TOKEN and only asked when a PDF is generated.
376
381
  createRendererPuppeteerClientFeature(),
382
+ // signature: needs files; the print function is the real client, asked only when a request completes.
383
+ // deliverLink is smoke-only: boot never sends a link.
384
+ createSignatureFeature({
385
+ retention: { keepFor: "10y" },
386
+ renderHtmlToPdf,
387
+ linkSecret: SMOKE_HMAC_SECRET,
388
+ signaturePageUrl: "https://use-all-bundled.example/sign",
389
+ deliverLink: async () => {
390
+ /* smoke-only */
391
+ },
392
+ }),
393
+ createHandbookKnowledgeFeature({
394
+ pages: {
395
+ defaultLocale: "en",
396
+ locales: {
397
+ en: [
398
+ {
399
+ id: "sign-a-document",
400
+ kind: "process",
401
+ title: "Sign a document",
402
+ questions: ["How do I get a document signed?"],
403
+ screens: [],
404
+ bodyMd: "Create a signature request, add the signers and send each a link.",
405
+ },
406
+ ],
407
+ },
408
+ },
409
+ access: { roles: ["TenantAdmin", "TenantMember", "SystemAdmin"] },
410
+ }),
377
411
 
378
412
  // managed-pages: requires config (auto-bundled). Every host resolves to the
379
413
  // dev tenant so the document-editor e2e can read a saved page back from the
@@ -20,6 +20,10 @@ query and the fields to read, the query does the counting.
20
20
  `list` with `filter`, `limit: 1` and `totalCount: true`. The total is counted
21
21
  over the whole WHERE clause, so no rows are loaded just to be counted.
22
22
  - **Labels are translation keys**: declared with `r.translations`.
23
+ - **`progress-list` head from the answer**: `labelParams` fills the `{month}` of the
24
+ label from the query answer and `subtitleField` shows the period muted at the head's right.
25
+ - **List footer without a link**: `footerLink` with only `moreText` (no `label`)
26
+ shows the muted "k more" count under the list.
23
27
  - **Record-bound dashboard**: `ticket-record-dashboard` binds to a record with `record`
24
28
  and embeds the `ticket-card` projectionDetail as a screen panel; the record id
25
29
  becomes its entityId.
@@ -99,8 +99,33 @@ export const ticketFeature = defineFeature("tickets", (r) => {
99
99
  access: readerRoles,
100
100
  });
101
101
 
102
+ // Three newest rows plus the total, so the panel can say how many more exist.
103
+ r.queryHandler({
104
+ name: "ticket:recent",
105
+ schema: z.object({}),
106
+ handler: async (query, ctx) => {
107
+ const page = await ticketExecutor.list({ limit: 3, totalCount: true }, query.user, ctx.db);
108
+ return { rows: page.rows, nextCursor: null, total: page.total ?? page.rows.length };
109
+ },
110
+ access: readerRoles,
111
+ });
112
+
113
+ r.queryHandler({
114
+ name: "ticket:quota",
115
+ schema: z.object({}),
116
+ handler: async () => ({
117
+ month: "November",
118
+ period: "01.11. - 30.11.",
119
+ rows: [{ label: "Tickets handled", used: 18, limit: 25, sub: "7 left" }],
120
+ }),
121
+ access: readerRoles,
122
+ });
123
+
102
124
  r.translations({
103
125
  keys: {
126
+ "tickets.dashboard.recent": { en: "Recent tickets" },
127
+ "tickets.dashboard.recent-more": { en: "{count} more tickets" },
128
+ "tickets.dashboard.quota": { en: "Quota {month}" },
104
129
  "screen:ticket-list.title": { en: "Tickets" },
105
130
  "screen:ticket-card.title": { en: "Ticket" },
106
131
  "screen:ticket-record-dashboard.title": { en: "Ticket overview" },
@@ -114,6 +139,7 @@ export const ticketFeature = defineFeature("tickets", (r) => {
114
139
  "tickets.dashboard.open": { en: "Open" },
115
140
  "tickets.dashboard.closed": { en: "Closed" },
116
141
  "tickets.dashboard.total": { en: "All tickets" },
142
+ "tickets.dashboard.total-narrow": { en: { one: "{count} ticket", other: "{count} tickets" } },
117
143
  "tickets.dashboard.open-work": { en: "Open work" },
118
144
  "tickets.filter.open-work": { en: "Open work" },
119
145
  "screen:ticket-queue.title": { en: "Ticket queue" },
@@ -149,6 +175,8 @@ export const ticketFeature = defineFeature("tickets", (r) => {
149
175
  kind: "stat",
150
176
  id: "total",
151
177
  label: "tickets.dashboard.total",
178
+ // Below sm the label is replaced by this plural key, resolved with { count: <value> }.
179
+ labelNarrow: "tickets.dashboard.total-narrow",
152
180
  query: TICKET_STATS_QUERY,
153
181
  valueField: "total",
154
182
  },
@@ -162,6 +190,25 @@ export const ticketFeature = defineFeature("tickets", (r) => {
162
190
  params: { namedFilter: "open-work", limit: 1, totalCount: true },
163
191
  navigate: { screen: "ticket-queue", namedFilter: "open-work" },
164
192
  },
193
+ // Without `label` the footer is only the muted "k more" count, no link.
194
+ {
195
+ kind: "list",
196
+ id: "recent",
197
+ label: "tickets.dashboard.recent",
198
+ query: "tickets:query:ticket:recent",
199
+ // `badgeIcon: "sparkles"` draws an AI-prepared value as the soft blue AI pill with an icon.
200
+ columns: ["title", { field: "status", display: "badge", badgeIcon: "sparkles" }],
201
+ footerLink: { moreText: "tickets.dashboard.recent-more", screen: "ticket-queue" },
202
+ },
203
+ // The title takes its month from the answer and the period shows muted at the head's right.
204
+ {
205
+ kind: "progress-list",
206
+ id: "quota",
207
+ label: "tickets.dashboard.quota",
208
+ labelParams: { month: "month" },
209
+ subtitleField: "period",
210
+ query: "tickets:query:ticket:quota",
211
+ },
165
212
  ],
166
213
  access: readerRoles,
167
214
  });
@@ -26,6 +26,10 @@ object and an embedded list rendered by a declarative `entityEdit` screen.
26
26
  entries (`{ label, from }`). The handler wraps its schema with
27
27
  `withFormDerivations(schema, screen)` (`src/handlers/invoice-receive.write.ts`),
28
28
  so totals sent by the client are replaced on the server.
29
+ - **Redirect with search params**: after submit, `invoice-receive` redirects to
30
+ `invoice-list` with `searchParams: { "invoice-list.q": "invoiceNumber" }`, so the list opens
31
+ with the number the handler returns in its search box. The receive handler stores nothing in
32
+ this recipe; the search finds invoices saved through `invoice-edit` with that number.
29
33
 
30
34
  ## When to reach for it
31
35
 
@@ -13,6 +13,12 @@ export const invoiceEntity = createEntity({
13
13
  table: "read_sample_invoices",
14
14
  fields: {
15
15
  customer: createTextField({ personal: { of: "id" }, find: "none", required: true }),
16
+ // Business data, so the list can search it: invoice-receive redirects here by number.
17
+ invoiceNumber: createTextField({
18
+ personal: false,
19
+ reason: "is_business_data",
20
+ searchable: true,
21
+ }),
16
22
  lines: createEmbeddedListField(
17
23
  {
18
24
  product: { type: "reference", entity: "product", required: true },
@@ -58,9 +58,15 @@ export const embeddedFeature = defineFeature("contacts", (r) => {
58
58
  type: "entityEdit",
59
59
  entity: "invoice",
60
60
  layout: {
61
- sections: [{ columns: 1, fields: ["customer", "lines"] }],
61
+ sections: [{ columns: 1, fields: ["invoiceNumber", "customer", "lines"] }],
62
62
  },
63
63
  });
64
64
 
65
+ r.screen({
66
+ id: "invoice-list",
67
+ type: "entityList",
68
+ entity: "invoice",
69
+ columns: ["invoiceNumber", "customer"],
70
+ });
65
71
  r.screen(invoiceReceiveScreen);
66
72
  });
@@ -29,6 +29,7 @@ export const invoiceReceive = defineWriteHandler({
29
29
  handler: async (event) => ({
30
30
  isSuccess: true,
31
31
  data: {
32
+ invoiceNumber: event.payload.invoiceNumber,
32
33
  netTotal: event.payload.netTotal,
33
34
  vatTotal: event.payload.vatTotal,
34
35
  grossTotal: event.payload.grossTotal,
@@ -30,6 +30,8 @@ export const invoiceReceiveScreen: ActionFormScreenDefinition = {
30
30
  id: "invoice-receive",
31
31
  type: "actionForm",
32
32
  handler: "contacts:write:invoice:receive",
33
+ // Lands on the invoice list with its search box filled from the result.
34
+ redirect: { screen: "invoice-list", searchParams: { "invoice-list.q": "invoiceNumber" } },
33
35
  fields: {
34
36
  supplier: createTextField({ required: true, personal: "tenant", find: "none" }),
35
37
  invoiceNumber: createTextField({
@@ -10,6 +10,7 @@
10
10
  // - r.projection — single-stream read model (inline in the write TX)
11
11
  // - r.multiStreamProjection — cross-aggregate async read model
12
12
  // - ctx.events.load with { asOf } — point-in-time aggregate state
13
+ // - ctx.events.loadByTypes — events of many aggregates, filtered by type, in one query
13
14
  // - ctx.events.archive / ctx.events.restore — Marten ArchiveStream
14
15
  // - ctx.dispatch.queryProjection — tenant-scoped read of a projection table
15
16
  // - ctx.events.snapshot + ctx.events.loadWithSnapshot — perf path
@@ -398,6 +399,36 @@ export const invoiceFeature = defineFeature("showcase", (r) => {
398
399
  },
399
400
  });
400
401
 
402
+ // List page over many invoices: ONE query for just the approved/paid events of the
403
+ // requested aggregates instead of ctx.events.load per invoice.
404
+ r.queryHandler({
405
+ name: "invoice:payment-statuses",
406
+ schema: z.object({ ids: z.array(z.uuid()).max(200) }),
407
+ handler: async (query, ctx) => {
408
+ const events = await ctx.events.loadByTypes({
409
+ aggregateIds: query.payload.ids,
410
+ eventTypes: [approved.name, paid.name],
411
+ });
412
+ const lastEventByInvoice = new Map<string, string>();
413
+ for (const evt of events) {
414
+ lastEventByInvoice.set(evt.aggregateId, evt.type);
415
+ }
416
+ return {
417
+ statuses: [...lastEventByInvoice].map(([id, lastEventType]) => ({
418
+ id,
419
+ status: lastEventType === paid.name ? "paid" : "approved",
420
+ })),
421
+ };
422
+ },
423
+ access: {
424
+ openToAll: {
425
+ reason:
426
+ "demo recipe: any signed-in user may read invoice payment statuses; " +
427
+ "there is no per-user invoice ownership in this sample",
428
+ },
429
+ },
430
+ });
431
+
401
432
  // Snapshot-aware fast path. Uses the latest snapshot if available and
402
433
  // only replays delta events past it. Identical state shape to
403
434
  // invoice:state — the two are interchangeable modulo the perf profile.
@@ -0,0 +1,22 @@
1
+ # Handbook knowledge
2
+
3
+ Serves the app's handbook to the AI assistant. `kumiko handbuch knowledge` exports
4
+ the pages per locale as JSON; the `handbook-knowledge` bundled feature mounts them
5
+ as two query tools, so the assistant can answer how-do-I questions from the real
6
+ handbook text.
7
+
8
+ ## What it shows
9
+
10
+ - **Feature** — `createHandbookKnowledgeFeature({ pages, access, publicPath })`.
11
+ No entity, no migration; `access` decides which roles see the tools.
12
+ - **list-pages** — catalog of id, kind, title and questions in the caller's language.
13
+ - **read-page** — one page body; the language falls back to the handbook's default
14
+ language, long pages are cut with a visible notice, unknown ids are `not_found`.
15
+ - **Test** — `setupTestStack` and HTTP with an `X-Locale` header.
16
+
17
+ ## Files
18
+
19
+ ```
20
+ src/feature.ts fixed handbook JSON and the feature
21
+ src/__tests__/feature.integration.test.ts list-pages, read-page, fallback, not found
22
+ ```
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "@cosmicdrift/kumiko-sample-handbook-knowledge",
3
+ "description": "The handbook-knowledge bundled feature: a fixed handbook JSON served to the AI assistant as list-pages and read-page query tools.",
4
+ "private": true,
5
+ "dependencies": {
6
+ "@cosmicdrift/kumiko-bundled-features": "workspace:*",
7
+ "@cosmicdrift/kumiko-framework": "workspace:*"
8
+ },
9
+ "devDependencies": {
10
+ "@cosmicdrift/kumiko-testing": "workspace:*"
11
+ }
12
+ }
@@ -0,0 +1,42 @@
1
+ import { createHandbookKnowledgeFeature } from "@cosmicdrift/kumiko-bundled-features/handbook-knowledge";
2
+
3
+ // In an app this object is the output of `kumiko handbuch knowledge <config> --out <file>`.
4
+ const handbook = {
5
+ defaultLocale: "en",
6
+ locales: {
7
+ en: [
8
+ {
9
+ id: "prozess-add-tenant",
10
+ kind: "process" as const,
11
+ title: "Add a tenant",
12
+ questions: ["How do I add a tenant?"],
13
+ screens: [],
14
+ bodyMd: "Open the lease, choose Add tenant and confirm the change.",
15
+ },
16
+ {
17
+ id: "lease-detail",
18
+ kind: "screen" as const,
19
+ title: "Lease",
20
+ questions: [],
21
+ screens: [],
22
+ bodyMd: "The lease screen shows tenants, rent and documents.",
23
+ },
24
+ ],
25
+ de: [
26
+ {
27
+ id: "prozess-add-tenant",
28
+ kind: "process" as const,
29
+ title: "Mieter hinzufügen",
30
+ questions: ["Wie füge ich einen Mieter hinzu?"],
31
+ screens: [],
32
+ bodyMd: "Vertrag öffnen, Mieter hinzufügen wählen und die Änderung bestätigen.",
33
+ },
34
+ ],
35
+ },
36
+ };
37
+
38
+ export const handbookKnowledgeFeature = createHandbookKnowledgeFeature({
39
+ pages: handbook,
40
+ access: { roles: ["User"] },
41
+ publicPath: "/handbuch",
42
+ });
@@ -27,6 +27,15 @@ the `table` block renders and behaves as before.
27
27
  offers grouping by priority or none.
28
28
  - `table.totals`: a footer row with the estimate sum over the filtered list.
29
29
  - `facets.estimateHours: { display: "range" }`: from/to inputs for a number field.
30
+ - `mutedRowField: "parked"`: a parked task is drawn entirely in the muted colour.
31
+ - `toolbarSort: true`: the desktop "Sorted by" select in the filter row (opt-in).
32
+ - Column options: `ellipsis` (one truncated line), `multiline` (line breaks stay),
33
+ `tone: "muted"`, `cardAbove` (phone card line above the title), `hideWhenDocked`,
34
+ `emptyPlaceholder` (`false` keeps the cell blank, a string shows muted text),
35
+ `cardBadge` (phone-card pill), `dateOnlyAfterDays` on a timestamp column,
36
+ `pillField` / `pillToneField` (a second pill beside the cell value).
37
+ - Row action `display: "text"`: muted text without a button, shown for done tasks.
38
+ - `hideCountFooter` is not set here: no screen declaration reaches it (relatedList sets it itself).
30
39
  - The same block on a `projectionList`, and `task:workload`, a hand-written list
31
40
  query that keeps grouping and totals by accepting `aggregate`
32
41
  (`entityListSchema`) and answering it with `answerListAggregate`.
@@ -4,11 +4,13 @@ import {
4
4
  createEventStoreExecutor,
5
5
  } from "@cosmicdrift/kumiko-framework/db";
6
6
  import {
7
+ createBooleanField,
7
8
  createDateField,
8
9
  createEntity,
9
10
  createNumberField,
10
11
  createSelectField,
11
12
  createTextField,
13
+ createTimestampField,
12
14
  defineFeature,
13
15
  entityListSchema,
14
16
  type FeatureDefinition,
@@ -41,6 +43,14 @@ export const taskEntity = createEntity({
41
43
  dueDate: createDateField({ sortable: true }),
42
44
  assignee: createTextField({ personal: false, reason: "is_business_data", sortable: true }),
43
45
  estimateHours: createNumberField({ sortable: true, filterable: true }),
46
+ parked: createBooleanField({ default: false }),
47
+ note: createTextField({ personal: false, reason: "is_business_data" }),
48
+ team: createTextField({ personal: false, reason: "is_business_data" }),
49
+ teamTone: createSelectField({
50
+ options: ["positive", "warn", "negative", "neutral"] as const,
51
+ default: "neutral",
52
+ }),
53
+ lastUpdate: createTimestampField({ sortable: true }),
44
54
  },
45
55
  });
46
56
 
@@ -76,9 +86,29 @@ export function createTaskBoardFeature(
76
86
  // Starts pinned left; width and minWidth are start values for resizing.
77
87
  { field: "title", pinned: "left", width: 280, minWidth: 160 },
78
88
  "status",
79
- "priority",
89
+ // The phone card shows the priority as its outlined pill instead of the first select column.
90
+ { field: "priority", cardBadge: true },
80
91
  { field: "dueDate", hideOnNarrow: true },
81
- { field: "assignee", hideOnNarrow: true },
92
+ // The team pill sits beside the assignee name; its tone comes from the row.
93
+ {
94
+ field: "assignee",
95
+ hideOnNarrow: true,
96
+ pillField: "team",
97
+ pillToneField: "teamTone",
98
+ emptyPlaceholder: "Unassigned",
99
+ },
100
+ // One truncated line in the table; a line break starts a new line on the phone card.
101
+ {
102
+ field: "note",
103
+ ellipsis: true,
104
+ multiline: true,
105
+ tone: "muted",
106
+ cardAbove: true,
107
+ hideWhenDocked: true,
108
+ emptyPlaceholder: false,
109
+ },
110
+ // Recent edits show date and time, older ones the date only.
111
+ { field: "lastUpdate", dateOnlyAfterDays: 7, hideOnNarrow: true },
82
112
  // Starts hidden; the user can add it back in the view menu.
83
113
  { field: "estimateHours", hidden: true, hideOnNarrow: true },
84
114
  ],
@@ -86,7 +116,22 @@ export function createTaskBoardFeature(
86
116
  defaultSort: { field: "dueDate", dir: "asc" },
87
117
  searchable: true,
88
118
  table: taskTable,
119
+ mutedRowField: "parked",
120
+ toolbarSort: true,
121
+ sortOptions: [
122
+ { field: "dueDate", dir: "asc", label: "Due date" },
123
+ { field: "priority", dir: "desc", label: "Priority" },
124
+ ],
89
125
  rowActions: [
126
+ // A closed state as muted text instead of a button.
127
+ {
128
+ kind: "navigate",
129
+ id: "closed",
130
+ label: "Closed",
131
+ screen: "task-edit",
132
+ display: "text",
133
+ visible: { field: "status", eq: "done" },
134
+ },
90
135
  { kind: "navigate", id: "open", label: "Open", screen: "task-edit", rowClick: true },
91
136
  {
92
137
  kind: "writeHandler",
@@ -61,7 +61,14 @@ export const integrationsFeature = defineFeature(FEATURE, (r) => {
61
61
  default: "smtp.platform.example",
62
62
  write: access.roles("SystemAdmin", "Admin"),
63
63
  read: access.admin,
64
- mask: { title: "integrations.smtp-host", icon: "mail", order: 2 },
64
+ // compact: the generated screen drops origin icons and accent bars; section: groups the key under its own titled section.
65
+ mask: {
66
+ title: "integrations.smtp-host",
67
+ icon: "mail",
68
+ order: 2,
69
+ compact: true,
70
+ section: "integrations.mail",
71
+ },
65
72
  }),
66
73
  },
67
74
  });
@@ -83,6 +90,7 @@ export const integrationsFeature = defineFeature(FEATURE, (r) => {
83
90
  "integrations.settings": { de: "Integrationen", en: "Integrations" },
84
91
  "integrations.payment-api-key": { de: "Zahlungs-API-Schlüssel", en: "Payment API Key" },
85
92
  "integrations.smtp-host": { de: "SMTP-Server", en: "SMTP Host" },
93
+ "integrations.mail": { de: "E-Mail-Versand", en: "Mail delivery" },
86
94
  },
87
95
  });
88
96
  });
@@ -43,6 +43,13 @@ header, a metrics band, and a tabbed layout instead of one long stacked form.
43
43
  - round 6 (board gaps): `rowLink.screenField` / `paramsField` (target screen from a query field),
44
44
  list panel `icon`, `narrow.moreText`, `narrow.field` as any query output field,
45
45
  `footerLink.narrowOnly`, `narrow.titleField` on cards and `rowToneMarker: "dot"`
46
+ - round 7 (board look): `header.narrowTitle` (short phone top-bar title), banner `iconless`,
47
+ `metricsPlacement: { narrow: "before-steps" }`, `mobileSummary` (one line instead of the
48
+ metrics below `sm`), `MetricSpec.visibleWhen`, field option `concealed` (muted value with a lock),
49
+ section `hideOnNarrow` and `after` (a registered component under the items tab card), and a
50
+ second screen `order-facts` with a stacked layout and `pageNavigation: false`
51
+ - not shown: `photosBeside` (needs a stored image file for `photoGrid`) and `recordSections.omitFirstTitle`
52
+ (a renderer prop, not reachable from a screen declaration)
46
53
  - boot-validator catching two common author mistakes: a `metrics` entry
47
54
  with an empty `label`, and a `tabs` layout with fewer than two
48
55
  sections
@@ -230,6 +230,10 @@ export function createOrderDeskFeature(): FeatureDefinition {
230
230
  "order-desk.metric.outstandingAmount": { en: "Outstanding" },
231
231
  "order-desk.metric.itemCount": { en: "Items" },
232
232
  "order-desk.metric.placedAt": { en: "Placed" },
233
+ "order-desk.header.narrow-title": { en: "Order" },
234
+ "screen:order-facts.title": { en: "Order facts" },
235
+ "order-desk.facts.contact": { en: "Contact" },
236
+ "order-desk.facts.address": { en: "Address" },
233
237
  "order-desk.tab.items": { en: "Items" },
234
238
  "order-desk.tab.payments": { en: "Payments" },
235
239
  "order-desk.tab.details": { en: "Details" },
@@ -282,6 +286,7 @@ export function createOrderDeskFeature(): FeatureDefinition {
282
286
  },
283
287
  ],
284
288
  defaultSort: { field: "urgency", dir: "desc" },
289
+ toolbarSort: true,
285
290
  sortOptions: [
286
291
  { field: "urgency", dir: "desc", label: "order-desk.sort.urgency" },
287
292
  { field: "customerName", dir: "asc", label: "order-desk.sort.customer" },
@@ -523,6 +528,7 @@ export function createOrderDeskFeature(): FeatureDefinition {
523
528
  header: {
524
529
  title: "customerName",
525
530
  shortTitle: "shortTitle",
531
+ narrowTitle: "order-desk.header.narrow-title",
526
532
  // Parts are joined by a separator; `format` formats the raw field value.
527
533
  narrowSubtitle: "narrowSubtitle",
528
534
  subtitle: [
@@ -535,6 +541,7 @@ export function createOrderDeskFeature(): FeatureDefinition {
535
541
  summary: { field: "summaryLine", narrowField: "summaryShort", toneField: "summaryTone" },
536
542
  banner: {
537
543
  field: "notice",
544
+ iconless: true,
538
545
  actions: [
539
546
  {
540
547
  kind: "navigate",
@@ -572,8 +579,9 @@ export function createOrderDeskFeature(): FeatureDefinition {
572
579
  },
573
580
  ],
574
581
  },
582
+ mobileSummary: "mobileLine",
575
583
  metricsStyle: "tiles",
576
- metricsPlacement: { narrow: "after-guidance" },
584
+ metricsPlacement: { narrow: "before-steps" },
577
585
  metrics: [
578
586
  {
579
587
  field: "totalAmount",
@@ -587,6 +595,7 @@ export function createOrderDeskFeature(): FeatureDefinition {
587
595
  subField: "outstandingNote",
588
596
  tone: "warn",
589
597
  toneField: "outstandingTone",
598
+ visibleWhen: { field: "status", ne: "delivered" },
590
599
  navigate: { tab: "payments" },
591
600
  },
592
601
  {
@@ -604,6 +613,7 @@ export function createOrderDeskFeature(): FeatureDefinition {
604
613
  kind: "relatedList",
605
614
  title: "order-desk.tab.items",
606
615
  countField: "itemsCount",
616
+ after: { react: { __component: "OrderItemsFooter" } },
607
617
  query: "order-desk:query:order:items",
608
618
  columns: [
609
619
  { field: "sku", label: "order-desk.col.sku" },
@@ -646,11 +656,12 @@ export function createOrderDeskFeature(): FeatureDefinition {
646
656
  id: "details",
647
657
  kind: "fields",
648
658
  title: "order-desk.tab.details",
649
- fields: ["shippingAddress", "billingAddress", "salesRep"],
659
+ fields: ["shippingAddress", { field: "billingAddress", concealed: true }, "salesRep"],
650
660
  },
651
661
  {
652
662
  id: "internal-note",
653
663
  kind: "extension",
664
+ hideOnNarrow: true,
654
665
  title: "order-desk.tab.internalNote",
655
666
  component: { react: { __component: "OrderInternalNote" } },
656
667
  entityName: "order",
@@ -684,5 +695,32 @@ export function createOrderDeskFeature(): FeatureDefinition {
684
695
  inlineActions: ["download-invoice"],
685
696
  access: accessRoles,
686
697
  });
698
+
699
+ r.screen({
700
+ id: "order-facts",
701
+ type: "projectionDetail",
702
+ query: "order-desk:query:order:detail",
703
+ listScreenId: "orders",
704
+ header: { title: "customerName" },
705
+ // Two short stacked sections need no "On this page" index.
706
+ pageNavigation: false,
707
+ layout: {
708
+ sections: [
709
+ {
710
+ id: "contact",
711
+ kind: "fields",
712
+ title: "order-desk.facts.contact",
713
+ fields: ["salesRep"],
714
+ },
715
+ {
716
+ id: "address",
717
+ kind: "fields",
718
+ title: "order-desk.facts.address",
719
+ fields: ["shippingAddress", "billingAddress"],
720
+ },
721
+ ],
722
+ },
723
+ access: accessRoles,
724
+ });
687
725
  });
688
726
  }
@@ -494,6 +494,7 @@ export function answerOrderDetail(id: string) {
494
494
  path: [{ label: "Orders" }, { label: "Aiko Tanaka" }, { label: "SO-10482" }],
495
495
  summaryLine: "Waiting for the second payment",
496
496
  summaryShort: "Second payment open.",
497
+ mobileLine: "€ 312.00 open of € 1,248.00",
497
498
  summaryTone: "warn",
498
499
  narrowSubtitle: "SO-10482 · placed 21 Aug",
499
500
  notice: { title: "Payment overdue", text: "312 EUR is 14 days overdue", tone: "bad" },
@@ -6,7 +6,7 @@ Tenant-owned secrets with envelope encryption, DEK cache, and KEK rotation.
6
6
 
7
7
  - `r.secret` + `ctx.services.secrets.get` (audited reads)
8
8
  - Charge-style handler that never returns the plaintext key
9
- - A system-scope secret edited on a `configEdit` screen (`secretKeys`) with a handler button row (`actions`)
9
+ - A system-scope secret edited on a `configEdit` screen (`secretKeys`) with a handler button row (`actions`) and `compact: true` (no origin icon, reset link or accent bar)
10
10
 
11
11
  ## Source
12
12
 
@@ -130,6 +130,8 @@ export function createBillingFeature(): FeatureDefinition {
130
130
  }),
131
131
  },
132
132
  layout: { variant: "settings-list", sections: [{ fields: ["signingKey"] }] },
133
+ // One write-only field needs no origin icon, reset link or accent bar.
134
+ compact: true,
133
135
  // A button row calls a handler with {} on the stored values; it is disabled while the
134
136
  // form has unsaved changes.
135
137
  actions: [
@@ -0,0 +1,21 @@
1
+ # Signature
2
+
3
+ Several people sign one PDF of the tenant, in person on a display or through a link. The last
4
+ signature moves the request to `all-signed`; a job renders a signature page, appends it to the
5
+ unchanged original and completes the request.
6
+
7
+ ## What it shows
8
+
9
+ - **Feature** - `createSignatureFeature({ retention, linkSecret, renderHtmlToPdf, deliverLink, signaturePageUrl })`.
10
+ Needs `files` and `user-data-rights` (exports and erases signer data); the test mounts user-data-rights with its own dependencies.
11
+ - **deliverLink** - `issue-link` hands the signing link to the app (mail) and returns only
12
+ `{ signerId, linkSentAt }`: whoever may issue a link must not be able to sign with it.
13
+ - **renderHtmlToPdf** - injected; in an app it is the client of `@cosmicdrift/kumiko-renderer-puppeteer-client`.
14
+ - **Test** - `setupTestStack` and HTTP: request, issue-link, anonymous sign-by-link, sweep job, completed.
15
+
16
+ ## Files
17
+
18
+ ```
19
+ src/feature.ts the feature with a link outbox and a stand-in printer
20
+ src/__tests__/feature.integration.test.ts request to completed request over HTTP
21
+ ```
@@ -0,0 +1,13 @@
1
+ {
2
+ "name": "@cosmicdrift/kumiko-sample-signature",
3
+ "description": "The signature bundled feature: a request for several signers, a signing link that is delivered by the app, and a completed PDF with a signature page.",
4
+ "private": true,
5
+ "dependencies": {
6
+ "@cosmicdrift/kumiko-bundled-features": "workspace:*",
7
+ "@cosmicdrift/kumiko-framework": "workspace:*",
8
+ "pdf-lib": "^1.17.1"
9
+ },
10
+ "devDependencies": {
11
+ "@cosmicdrift/kumiko-testing": "workspace:*"
12
+ }
13
+ }