@cosmicdrift/kumiko-samples 0.416.0 → 0.418.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 +1 -1
- package/packages/bundled-features/src/agent-tools/api-docs/schema-fields.ts +14 -0
- package/packages/bundled-features/src/agent-tools/changes.json +6 -0
- package/packages/bundled-features/src/auth-email-password/index.ts +1 -1
- package/packages/bundled-features/src/auth-email-password/signup-activation.ts +2 -5
- package/packages/bundled-features/src/auth-email-password/signup-token-store.ts +0 -6
- package/packages/bundled-features/src/cap-counter/changes.json +6 -0
- package/packages/bundled-features/src/cap-counter/stock-cap-guard.ts +46 -13
- package/packages/bundled-features/src/channel-whatsapp/changes.json +1 -1
- package/packages/bundled-features/src/document-ingest-foundation/changes.json +6 -0
- package/packages/bundled-features/src/document-ingest-foundation/feature.ts +13 -1
- package/packages/bundled-features/src/document-ingest-foundation/report-ingest-progress.ts +23 -6
- package/packages/bundled-features/src/helpdesk/screens.ts +5 -1
- package/packages/bundled-features/src/signature/README.md +10 -3
- package/packages/bundled-features/src/signature/changes.json +25 -0
- package/packages/bundled-features/src/signature/entity.ts +3 -1
- package/packages/bundled-features/src/signature/feature.ts +41 -28
- package/packages/bundled-features/src/signature/handlers/cancel.write.ts +11 -3
- package/packages/bundled-features/src/signature/handlers/issue-link.write.ts +5 -0
- package/packages/bundled-features/src/signature/handlers/lifecycle.write.ts +33 -1
- package/packages/bundled-features/src/signature/handlers/request.write.ts +37 -3
- package/packages/bundled-features/src/signature/handlers/revoke-link.write.ts +15 -1
- package/packages/bundled-features/src/signature/handlers/sign-in-person.write.ts +5 -1
- package/packages/bundled-features/src/signature/i18n.ts +1 -0
- package/packages/bundled-features/src/signature/index.ts +2 -0
- package/packages/bundled-features/src/signature/list-cursor-seal.ts +59 -0
- package/packages/bundled-features/src/signature/options.ts +16 -1
- package/packages/bundled-features/src/signature/payloads.ts +14 -2
- package/packages/bundled-features/src/signature/png.ts +25 -4
- package/packages/bundled-features/src/signature/screens.ts +2 -0
- package/packages/bundled-features/src/signature/static-sign.ts +2 -1
- package/packages/bundled-features/src/signature/subject-queries.ts +184 -0
- package/packages/bundled-features/src/signature/subject-scope.ts +43 -0
- package/packages/bundled-features/src/signature/sweep.ts +32 -8
- package/packages/bundled-features/src/signature/web/constants.ts +12 -0
- package/packages/bundled-features/src/subscription-paddle/changes.json +1 -1
- package/packages/bundled-features/src/subscription-stripe/changes.json +6 -0
- package/packages/bundled-features/src/subscription-stripe/plugin-methods.ts +2 -0
- package/packages/bundled-features/src/subscription-stripe/verify-webhook.ts +21 -16
- package/packages/bundled-features/src/tenant-inactivity/handlers/keep-account.write.ts +7 -3
- package/packages/bundled-features/src/tenant-lifecycle/changes.json +6 -0
- package/packages/bundled-features/src/tenant-lifecycle/run-tenant-destroy.ts +90 -42
- package/samples/apps/use-all-bundled/feature-manifest.json +2 -1
- package/samples/recipes/crypto-shredding-hr/README.md +1 -1
- package/samples/recipes/crypto-shredding-hr/src/feature.ts +1 -1
- package/samples/recipes/dashboard-stats/README.md +4 -0
- package/samples/recipes/dashboard-stats/src/feature.ts +47 -0
- package/samples/recipes/event-sourcing/src/feature.ts +31 -0
- package/samples/recipes/list-table-options/README.md +18 -3
- package/samples/recipes/list-table-options/src/feature.ts +170 -5
- package/samples/recipes/managed-config/src/feature.ts +9 -1
- package/samples/recipes/record-detail-layout/README.md +7 -0
- package/samples/recipes/record-detail-layout/src/feature.ts +40 -2
- package/samples/recipes/record-detail-layout/src/order-board.ts +1 -0
- package/samples/recipes/secrets-demo/README.md +1 -1
- package/samples/recipes/secrets-demo/src/feature.ts +2 -0
- package/samples/recipes/writeform-section/README.md +4 -0
- package/samples/recipes/writeform-section/src/feature.ts +97 -0
|
@@ -4,16 +4,19 @@ 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,
|
|
15
17
|
} from "@cosmicdrift/kumiko-framework/engine";
|
|
16
|
-
import
|
|
18
|
+
import { failNotFound, NotFoundError } from "@cosmicdrift/kumiko-framework/errors";
|
|
19
|
+
import { type ListTableOptions, MAX_BULK_SELECTION } from "@cosmicdrift/kumiko-framework/ui-types";
|
|
17
20
|
import { z } from "zod";
|
|
18
21
|
|
|
19
22
|
export const taskEntity = createEntity({
|
|
@@ -41,6 +44,14 @@ export const taskEntity = createEntity({
|
|
|
41
44
|
dueDate: createDateField({ sortable: true }),
|
|
42
45
|
assignee: createTextField({ personal: false, reason: "is_business_data", sortable: true }),
|
|
43
46
|
estimateHours: createNumberField({ sortable: true, filterable: true }),
|
|
47
|
+
parked: createBooleanField({ default: false }),
|
|
48
|
+
note: createTextField({ personal: false, reason: "is_business_data" }),
|
|
49
|
+
team: createTextField({ personal: false, reason: "is_business_data" }),
|
|
50
|
+
teamTone: createSelectField({
|
|
51
|
+
options: ["positive", "warn", "negative", "neutral"] as const,
|
|
52
|
+
default: "neutral",
|
|
53
|
+
}),
|
|
54
|
+
lastUpdate: createTimestampField({ sortable: true }),
|
|
44
55
|
},
|
|
45
56
|
});
|
|
46
57
|
|
|
@@ -50,6 +61,39 @@ export const openAccess = {
|
|
|
50
61
|
},
|
|
51
62
|
} as const;
|
|
52
63
|
|
|
64
|
+
const setStatusInput = z.object({
|
|
65
|
+
taskIds: z.array(z.uuid()).min(1).max(MAX_BULK_SELECTION),
|
|
66
|
+
status: z.enum(taskEntity.fields.status.options),
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
type StatusPlanRow = {
|
|
70
|
+
readonly id: string;
|
|
71
|
+
readonly version: number;
|
|
72
|
+
readonly title: string;
|
|
73
|
+
readonly before: string;
|
|
74
|
+
readonly after: string;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
// The one rule behind the status form: the write handler applies it and the preview query shows it.
|
|
78
|
+
async function planStatusChanges(
|
|
79
|
+
taskIds: readonly string[],
|
|
80
|
+
status: string,
|
|
81
|
+
loadTask: (id: string) => Promise<Readonly<Record<string, unknown>> | null | undefined>,
|
|
82
|
+
): Promise<{ readonly rows: readonly StatusPlanRow[] } | { readonly missingId: string }> {
|
|
83
|
+
const rows: StatusPlanRow[] = [];
|
|
84
|
+
for (const id of taskIds) {
|
|
85
|
+
const task = await loadTask(id);
|
|
86
|
+
if (!task) return { missingId: id };
|
|
87
|
+
rows.push({
|
|
88
|
+
id,
|
|
89
|
+
version: Number(task["version"]),
|
|
90
|
+
title: String(task["title"]),
|
|
91
|
+
before: String(task["status"]),
|
|
92
|
+
after: status,
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
return { rows };
|
|
96
|
+
}
|
|
53
97
|
// Overridable so a test can feed the boot validator a block that must be rejected.
|
|
54
98
|
export function createTaskBoardFeature(
|
|
55
99
|
taskTable: ListTableOptions = {
|
|
@@ -76,9 +120,29 @@ export function createTaskBoardFeature(
|
|
|
76
120
|
// Starts pinned left; width and minWidth are start values for resizing.
|
|
77
121
|
{ field: "title", pinned: "left", width: 280, minWidth: 160 },
|
|
78
122
|
"status",
|
|
79
|
-
|
|
123
|
+
// The phone card shows the priority as its outlined pill instead of the first select column.
|
|
124
|
+
{ field: "priority", cardBadge: true },
|
|
80
125
|
{ field: "dueDate", hideOnNarrow: true },
|
|
81
|
-
|
|
126
|
+
// The team pill sits beside the assignee name; its tone comes from the row.
|
|
127
|
+
{
|
|
128
|
+
field: "assignee",
|
|
129
|
+
hideOnNarrow: true,
|
|
130
|
+
pillField: "team",
|
|
131
|
+
pillToneField: "teamTone",
|
|
132
|
+
emptyPlaceholder: "Unassigned",
|
|
133
|
+
},
|
|
134
|
+
// One truncated line in the table; a line break starts a new line on the phone card.
|
|
135
|
+
{
|
|
136
|
+
field: "note",
|
|
137
|
+
ellipsis: true,
|
|
138
|
+
multiline: true,
|
|
139
|
+
tone: "muted",
|
|
140
|
+
cardAbove: true,
|
|
141
|
+
hideWhenDocked: true,
|
|
142
|
+
emptyPlaceholder: false,
|
|
143
|
+
},
|
|
144
|
+
// Recent edits show date and time, older ones the date only.
|
|
145
|
+
{ field: "lastUpdate", dateOnlyAfterDays: 7, hideOnNarrow: true },
|
|
82
146
|
// Starts hidden; the user can add it back in the view menu.
|
|
83
147
|
{ field: "estimateHours", hidden: true, hideOnNarrow: true },
|
|
84
148
|
],
|
|
@@ -86,7 +150,22 @@ export function createTaskBoardFeature(
|
|
|
86
150
|
defaultSort: { field: "dueDate", dir: "asc" },
|
|
87
151
|
searchable: true,
|
|
88
152
|
table: taskTable,
|
|
153
|
+
mutedRowField: "parked",
|
|
154
|
+
toolbarSort: true,
|
|
155
|
+
sortOptions: [
|
|
156
|
+
{ field: "dueDate", dir: "asc", label: "Due date" },
|
|
157
|
+
{ field: "priority", dir: "desc", label: "Priority" },
|
|
158
|
+
],
|
|
89
159
|
rowActions: [
|
|
160
|
+
// A closed state as muted text instead of a button.
|
|
161
|
+
{
|
|
162
|
+
kind: "navigate",
|
|
163
|
+
id: "closed",
|
|
164
|
+
label: "Closed",
|
|
165
|
+
screen: "task-edit",
|
|
166
|
+
display: "text",
|
|
167
|
+
visible: { field: "status", eq: "done" },
|
|
168
|
+
},
|
|
90
169
|
{ kind: "navigate", id: "open", label: "Open", screen: "task-edit", rowClick: true },
|
|
91
170
|
{
|
|
92
171
|
kind: "writeHandler",
|
|
@@ -98,8 +177,17 @@ export function createTaskBoardFeature(
|
|
|
98
177
|
visible: { field: "status", ne: "done" },
|
|
99
178
|
},
|
|
100
179
|
],
|
|
101
|
-
// Row checkboxes and a selection bar;
|
|
102
|
-
bulkActions: [
|
|
180
|
+
// Row checkboxes and a selection bar; delete writes once per row, set-status once for all.
|
|
181
|
+
bulkActions: [
|
|
182
|
+
{ id: "delete", rowAction: "delete" },
|
|
183
|
+
{
|
|
184
|
+
id: "set-status",
|
|
185
|
+
label: "Set status",
|
|
186
|
+
icon: "pencil",
|
|
187
|
+
screen: "task-set-status",
|
|
188
|
+
idsField: "taskIds",
|
|
189
|
+
},
|
|
190
|
+
],
|
|
103
191
|
access: openAccess.access,
|
|
104
192
|
});
|
|
105
193
|
|
|
@@ -195,6 +283,83 @@ export function createTaskBoardFeature(
|
|
|
195
283
|
},
|
|
196
284
|
});
|
|
197
285
|
|
|
286
|
+
// One write for the whole selection: the bulk action below opens this form and `taskIds`
|
|
287
|
+
// arrives as a string array. The client cap is no protection, so the schema bounds the list
|
|
288
|
+
// and every id is read through the tenant-scoped executor before anything is written.
|
|
289
|
+
r.writeHandler({
|
|
290
|
+
name: "task:set-status",
|
|
291
|
+
schema: setStatusInput.extend({ note: z.string().optional() }),
|
|
292
|
+
access: openAccess.access,
|
|
293
|
+
handler: async (event, ctx) => {
|
|
294
|
+
const { taskIds, status, note } = event.payload;
|
|
295
|
+
const plan = await planStatusChanges(taskIds, status, (id) =>
|
|
296
|
+
taskExecutor.detail({ id }, event.user, ctx.db),
|
|
297
|
+
);
|
|
298
|
+
if ("missingId" in plan) return failNotFound("task", plan.missingId);
|
|
299
|
+
const changed = plan.rows.filter((row) => row.before !== row.after);
|
|
300
|
+
for (const row of changed) {
|
|
301
|
+
const result = await taskExecutor.update(
|
|
302
|
+
{ id: row.id, version: row.version, changes: { status, note } },
|
|
303
|
+
event.user,
|
|
304
|
+
ctx.db,
|
|
305
|
+
);
|
|
306
|
+
if (!result.isSuccess) return result;
|
|
307
|
+
}
|
|
308
|
+
return { isSuccess: true as const, data: { count: changed.length } };
|
|
309
|
+
},
|
|
310
|
+
});
|
|
311
|
+
|
|
312
|
+
// The preview runs the same plan the write handler runs, so the two cannot drift apart.
|
|
313
|
+
r.queryHandler({
|
|
314
|
+
name: "task:set-status-preview",
|
|
315
|
+
schema: setStatusInput,
|
|
316
|
+
access: openAccess.access,
|
|
317
|
+
handler: async (query, ctx) => {
|
|
318
|
+
const { taskIds, status } = query.payload;
|
|
319
|
+
const plan = await planStatusChanges(taskIds, status, (id) =>
|
|
320
|
+
taskExecutor.detail({ id }, query.user, ctx.db),
|
|
321
|
+
);
|
|
322
|
+
if ("missingId" in plan) throw new NotFoundError("task");
|
|
323
|
+
return {
|
|
324
|
+
count: plan.rows.filter((row) => row.before !== row.after).length,
|
|
325
|
+
tasks: plan.rows.map(({ title, before, after }) => ({ title, before, after })),
|
|
326
|
+
};
|
|
327
|
+
},
|
|
328
|
+
});
|
|
329
|
+
|
|
330
|
+
r.screen({
|
|
331
|
+
id: "task-set-status",
|
|
332
|
+
type: "actionForm",
|
|
333
|
+
dormant: true,
|
|
334
|
+
handler: "task-board:write:task:set-status",
|
|
335
|
+
listScreenId: "task-list",
|
|
336
|
+
redirect: "task-list",
|
|
337
|
+
fields: {
|
|
338
|
+
taskIds: { type: "multiSelect", options: [], display: "count" },
|
|
339
|
+
status: createSelectField({
|
|
340
|
+
options: ["open", "inProgress", "blocked", "done"] as const,
|
|
341
|
+
required: true,
|
|
342
|
+
}),
|
|
343
|
+
note: createTextField({ personal: false, reason: "is_business_data" }),
|
|
344
|
+
},
|
|
345
|
+
layout: { sections: [{ fields: ["taskIds", "status", "note"] }] },
|
|
346
|
+
// Which tasks change and from what to what, shown before the user submits.
|
|
347
|
+
preview: {
|
|
348
|
+
query: "task-board:query:task:set-status-preview",
|
|
349
|
+
fields: ["taskIds", "status"],
|
|
350
|
+
title: "Preview",
|
|
351
|
+
facts: [{ field: "count", label: "Tasks that change" }],
|
|
352
|
+
list: {
|
|
353
|
+
field: "tasks",
|
|
354
|
+
columns: [
|
|
355
|
+
{ field: "title", label: "Task" },
|
|
356
|
+
{ field: "before", label: "Now" },
|
|
357
|
+
{ field: "after", label: "New" },
|
|
358
|
+
],
|
|
359
|
+
},
|
|
360
|
+
},
|
|
361
|
+
});
|
|
362
|
+
|
|
198
363
|
r.nav({ id: "tasks", label: "task-board:nav.tasks", icon: "list", order: 10 });
|
|
199
364
|
r.nav({
|
|
200
365
|
id: "task-list",
|
|
@@ -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
|
-
|
|
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: "
|
|
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: [
|
|
@@ -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
|
});
|