@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
@@ -0,0 +1,26 @@
1
+ import { createSignatureFeature } from "@cosmicdrift/kumiko-bundled-features/signature";
2
+ import { PDFDocument } from "pdf-lib";
3
+
4
+ // In an app `deliverLink` sends a mail to the signer. The recipe keeps the links in a map so the
5
+ // test can open them: the link is never part of a handler result.
6
+ export const deliveredLinks = new Map<string, string>();
7
+
8
+ // In an app this is `renderHtmlToPdf` from @cosmicdrift/kumiko-renderer-puppeteer-client, which
9
+ // needs the print service; the recipe prints a blank page instead.
10
+ async function printSignaturePage(): Promise<Uint8Array> {
11
+ const pdf = await PDFDocument.create();
12
+ pdf.addPage();
13
+ return pdf.save();
14
+ }
15
+
16
+ export const SIGNATURE_LINK_SECRET = "signature-recipe-link-secret-0123456789";
17
+
18
+ export const signatureFeature = createSignatureFeature({
19
+ retention: { keepFor: "10y" },
20
+ linkSecret: SIGNATURE_LINK_SECRET,
21
+ renderHtmlToPdf: printSignaturePage,
22
+ signaturePageUrl: "https://app.example/sign",
23
+ deliverLink: async (_ctx, { signerId, url }) => {
24
+ deliveredLinks.set(signerId, url);
25
+ },
26
+ });
@@ -12,6 +12,10 @@ shared chrome (footer, submit button) can be compared side by side.
12
12
  - `note-detail`, a `projectionDetail` screen whose only section is
13
13
  `kind: "writeForm"` with the identical field set, dispatching its own
14
14
  `note-desk:write:note:comment` handler on submit
15
+ - `note-triage`, an `actionForm`: `infoBand` draws the `assist` banner; the layout field
16
+ options `badge` (`{ label, tone }`) and `hintField` (a value field as muted hint) and a
17
+ `suffix` behind the number field. `FormProps.topBanner` is not shown: no screen
18
+ declaration reaches it
15
19
  - an e2e layout-parity spec (`e2e/writeform-parity.spec.ts`) proving both
16
20
  submit buttons render the same width, sit right-aligned in their form's
17
21
  footer, and never stretch full-width — the regression this recipe guards
@@ -52,11 +52,21 @@ const commentPayloadSchema = z.object({
52
52
  priority: z.number().optional(),
53
53
  });
54
54
 
55
+ const approvePayloadSchema = z.object({
56
+ noteId: z.string(),
57
+ title: z.string().optional(),
58
+ body: z.string().optional(),
59
+ });
60
+
55
61
  export const noteDeskFeature = defineFeature("note-desk", (r) => {
56
62
  r.translations({
57
63
  keys: {
58
64
  "screen:note-edit.title": { en: "Edit note" },
59
65
  "screen:note-detail.title": { en: "Note" },
66
+ "screen:note-triage.title": { en: "Triage note" },
67
+ "note-desk:triage.info-band": { en: "Check the category, then send the note on." },
68
+ "note-desk:triage.badge-review": { en: "Needs review" },
69
+ "note-desk:triage.priority-suffix": { en: "pts" },
60
70
  "note-desk:entity:note:field:title": { en: "Title" },
61
71
  "note-desk:entity:note:field:body": { en: "Body" },
62
72
  "note-desk:entity:note:field:category": { en: "Category" },
@@ -120,4 +130,91 @@ export const noteDeskFeature = defineFeature("note-desk", (r) => {
120
130
  },
121
131
  access: open.access,
122
132
  });
133
+
134
+ // An actionForm reaches the "assist" banner through `infoBand`; the layout field options
135
+ // `badge`, `hintField` and `suffix` work on any form layout.
136
+ r.screen({
137
+ id: "note-triage",
138
+ type: "actionForm",
139
+ handler: "note-desk:write:note:comment",
140
+ dormant: true,
141
+ infoBand: "note-desk:triage.info-band",
142
+ fields: {
143
+ title: NOTE_FIELDS.title,
144
+ body: NOTE_FIELDS.body,
145
+ category: NOTE_FIELDS.category,
146
+ priority: NOTE_FIELDS.priority,
147
+ },
148
+ layout: {
149
+ sections: [
150
+ {
151
+ columns: 1,
152
+ fields: [
153
+ { field: "title", badge: { label: "note-desk:triage.badge-review", tone: "warn" } },
154
+ { field: "category" },
155
+ { field: "body", hintField: "category" },
156
+ { field: "priority", suffix: "note-desk:triage.priority-suffix" },
157
+ ],
158
+ },
159
+ ],
160
+ },
161
+ access: open.access,
162
+ });
163
+
164
+ r.writeHandler({
165
+ name: "note:approve",
166
+ schema: approvePayloadSchema,
167
+ handler: async () => ({ isSuccess: true as const, data: null }),
168
+ ...open,
169
+ });
170
+
171
+ // The footer action "approve" submits the form: one write with its own payload (noteId)
172
+ // plus the form values, after form validation. The tab strip is phone-free; the "Review"
173
+ // section stands above the "History" section there.
174
+ r.screen({
175
+ id: "note-approval",
176
+ type: "projectionDetail",
177
+ query: "note-desk:query:note:summary",
178
+ layout: {
179
+ mode: "tabs",
180
+ narrowTabs: false,
181
+ sections: [
182
+ {
183
+ id: "review",
184
+ tabLabel: "Review",
185
+ kind: "writeForm",
186
+ title: "Decision",
187
+ description: "Confirm the note and leave a reason.",
188
+ descriptionNarrow: "Leave a reason.",
189
+ columns: 1,
190
+ fieldDefs: {
191
+ title: NOTE_FIELDS.title,
192
+ body: NOTE_FIELDS.body,
193
+ },
194
+ fields: ["title", { field: "body", hideOnNarrow: true }],
195
+ handler: "note-desk:write:note:approve",
196
+ submitWith: "approve",
197
+ },
198
+ {
199
+ id: "history",
200
+ tabLabel: "History",
201
+ title: "History",
202
+ titleOnNarrow: false,
203
+ fields: ["category", "priority"],
204
+ },
205
+ ],
206
+ },
207
+ actions: [
208
+ {
209
+ id: "approve",
210
+ label: "Approve",
211
+ handler: "note-desk:write:note:approve",
212
+ payload: { map: { noteId: "id" } },
213
+ // Tabs layout: only the tab that mounts the form may show the action.
214
+ showOnTabs: ["review"],
215
+ },
216
+ ],
217
+ footerActions: ["approve"],
218
+ access: open.access,
219
+ });
123
220
  });