@cosmicdrift/kumiko-samples 0.412.0 → 0.413.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 (132) hide show
  1. package/package.json +1 -1
  2. package/packages/bundled-features/package.json +13 -13
  3. package/packages/bundled-features/src/admin-shell/feature.ts +1 -1
  4. package/packages/bundled-features/src/agent-tools/api-docs/anchors.ts +1 -1
  5. package/packages/bundled-features/src/auth-email-password/boot-rules.ts +9 -0
  6. package/packages/bundled-features/src/auth-email-password/feature.ts +6 -19
  7. package/packages/bundled-features/src/auth-email-password/validate-options.ts +20 -0
  8. package/packages/bundled-features/src/billing-foundation/boot-rules.ts +26 -0
  9. package/packages/bundled-features/src/billing-foundation/validate-options.ts +59 -46
  10. package/packages/bundled-features/src/cap-overview/boot-rules.ts +14 -0
  11. package/packages/bundled-features/src/cap-overview/feature.ts +12 -5
  12. package/packages/bundled-features/src/documents/boot-rules.ts +14 -0
  13. package/packages/bundled-features/src/documents/feature.ts +8 -4
  14. package/packages/bundled-features/src/file-derivatives/boot-rules.ts +9 -0
  15. package/packages/bundled-features/src/file-derivatives/feature.ts +6 -3
  16. package/packages/bundled-features/src/folders/boot-rules.ts +9 -0
  17. package/packages/bundled-features/src/folders/feature.ts +6 -3
  18. package/packages/bundled-features/src/helpdesk/boot-rules.ts +9 -0
  19. package/packages/bundled-features/src/{contact → helpdesk}/challenge.ts +2 -2
  20. package/packages/bundled-features/src/{contact → helpdesk}/changes.json +6 -0
  21. package/packages/bundled-features/src/{contact/client/contact-client-source.ts → helpdesk/client/helpdesk-client-source.ts} +4 -4
  22. package/packages/bundled-features/src/helpdesk/client/helpdesk-website-client.ts +29 -0
  23. package/packages/bundled-features/src/helpdesk/client/index.ts +9 -0
  24. package/packages/bundled-features/src/{contact → helpdesk}/entity.ts +35 -31
  25. package/packages/bundled-features/src/{contact → helpdesk}/feature.ts +56 -52
  26. package/packages/bundled-features/src/{contact → helpdesk}/handlers/attempts.ts +3 -3
  27. package/packages/bundled-features/src/{contact → helpdesk}/handlers/challenge.query.ts +10 -10
  28. package/packages/bundled-features/src/{contact → helpdesk}/handlers/forward-request.write.ts +25 -23
  29. package/packages/bundled-features/src/{contact → helpdesk}/handlers/mark-done.write.ts +11 -11
  30. package/packages/bundled-features/src/{contact → helpdesk}/handlers/notify-reporter-in-app.write.ts +14 -14
  31. package/packages/bundled-features/src/{contact → helpdesk}/handlers/open-count.query.ts +4 -4
  32. package/packages/bundled-features/src/{contact → helpdesk}/handlers/open-count.ts +2 -2
  33. package/packages/bundled-features/src/{contact → helpdesk}/handlers/replies.query.ts +6 -6
  34. package/packages/bundled-features/src/{contact → helpdesk}/handlers/reply.write.ts +30 -30
  35. package/packages/bundled-features/src/{contact → helpdesk}/handlers/report.write.ts +29 -29
  36. package/packages/bundled-features/src/{contact → helpdesk}/handlers/request-delivery.query.ts +40 -40
  37. package/packages/bundled-features/src/{contact → helpdesk}/handlers/request-detail.query.ts +15 -15
  38. package/packages/bundled-features/src/{contact → helpdesk}/handlers/request-list.query.ts +2 -2
  39. package/packages/bundled-features/src/{contact → helpdesk}/handlers/send-reply-mail.write.ts +24 -24
  40. package/packages/bundled-features/src/{contact → helpdesk}/handlers/send-test.write.ts +18 -14
  41. package/packages/bundled-features/src/{contact → helpdesk}/handlers/submit.write.ts +32 -31
  42. package/packages/bundled-features/src/{contact → helpdesk}/handlers/take-over-uploads.ts +5 -5
  43. package/packages/bundled-features/src/{contact → helpdesk}/i18n.ts +78 -75
  44. package/packages/bundled-features/src/helpdesk/index.ts +29 -0
  45. package/packages/bundled-features/src/{contact → helpdesk}/lib.ts +32 -28
  46. package/packages/bundled-features/src/{contact → helpdesk}/mail.ts +56 -56
  47. package/packages/bundled-features/src/{contact → helpdesk}/options.ts +18 -16
  48. package/packages/bundled-features/src/helpdesk/panels.ts +28 -0
  49. package/packages/bundled-features/src/{contact → helpdesk}/payloads.ts +33 -33
  50. package/packages/bundled-features/src/{contact → helpdesk}/screens.ts +104 -104
  51. package/packages/bundled-features/src/{contact → helpdesk}/subject.ts +3 -3
  52. package/packages/bundled-features/src/{contact → helpdesk}/user-data-hooks.ts +17 -17
  53. package/packages/bundled-features/src/helpdesk/web/constants.ts +160 -0
  54. package/packages/bundled-features/src/helpdesk/web/index.ts +29 -0
  55. package/packages/bundled-features/src/host-routing/boot-rules.ts +27 -0
  56. package/packages/bundled-features/src/host-routing/validate-options.ts +36 -27
  57. package/packages/bundled-features/src/jobs/boot-rules.ts +9 -0
  58. package/packages/bundled-features/src/jobs/feature.ts +9 -4
  59. package/packages/bundled-features/src/legal-pages/boot-rules.ts +19 -0
  60. package/packages/bundled-features/src/legal-pages/feature.ts +6 -3
  61. package/packages/bundled-features/src/legal-pages/lib/validate-routes.ts +11 -5
  62. package/packages/bundled-features/src/metrics/boot-rules.ts +15 -0
  63. package/packages/bundled-features/src/metrics/validate.ts +8 -2
  64. package/packages/bundled-features/src/notes-history/boot-rules.ts +9 -0
  65. package/packages/bundled-features/src/notes-history/feature.ts +6 -3
  66. package/packages/bundled-features/src/personal-access-tokens/boot-rules.ts +9 -0
  67. package/packages/bundled-features/src/personal-access-tokens/scope-events-check.ts +6 -3
  68. package/packages/bundled-features/src/presence/boot-rules.ts +9 -0
  69. package/packages/bundled-features/src/presence/options.ts +5 -1
  70. package/packages/bundled-features/src/readiness/boot-rules.ts +14 -0
  71. package/packages/bundled-features/src/readiness/probe-boot-check.ts +8 -6
  72. package/packages/bundled-features/src/shared/assert-no-where-rule-in-ownership-write.ts +6 -4
  73. package/packages/bundled-features/src/shared/boot-rules.ts +9 -0
  74. package/packages/bundled-features/src/subscription-mollie/boot-rules.ts +19 -0
  75. package/packages/bundled-features/src/subscription-mollie/feature.ts +18 -10
  76. package/packages/bundled-features/src/tags/boot-rules.ts +9 -0
  77. package/packages/bundled-features/src/tags/feature.ts +6 -3
  78. package/packages/bundled-features/src/template-resolver/boot-rules.ts +19 -0
  79. package/packages/bundled-features/src/template-resolver/feature.ts +14 -10
  80. package/packages/bundled-features/src/tenant/boot-rules.ts +9 -0
  81. package/packages/bundled-features/src/tenant/feature.ts +5 -3
  82. package/samples/apps/marketing-demo/README.md +1 -1
  83. package/samples/apps/marketing-demo/playwright.config.ts +1 -1
  84. package/samples/apps/marketing-demo/src/app/client.tsx +3 -3
  85. package/samples/apps/marketing-demo/src/app/seed-data.ts +1 -1
  86. package/samples/apps/marketing-demo/src/app/seed.ts +4 -4
  87. package/samples/apps/marketing-demo/src/app/server.ts +3 -3
  88. package/samples/apps/marketing-demo/src/features/{helpdesk → ticketing}/feature.ts +15 -12
  89. package/samples/apps/marketing-demo/src/features/ticketing/i18n.ts +100 -0
  90. package/samples/apps/marketing-demo/src/features/{helpdesk → ticketing}/schema/ticket.ts +4 -4
  91. package/samples/apps/marketing-demo/src/features/ticketing/web/index.ts +7 -0
  92. package/samples/apps/use-all-bundled/feature-manifest.json +67 -67
  93. package/samples/apps/use-all-bundled/kumiko/migrations/0064_helpdesk-rename.rebuild.json +4 -0
  94. package/samples/apps/use-all-bundled/package.json +1 -1
  95. package/samples/apps/use-all-bundled/src/app/client.tsx +1 -1
  96. package/samples/apps/use-all-bundled/src/app/screens-feature.ts +10 -10
  97. package/samples/apps/use-all-bundled/src/run-config.ts +6 -6
  98. package/samples/recipes/api-docs/README.md +3 -3
  99. package/samples/recipes/api-docs/api-docs/de/events.md +14 -14
  100. package/samples/recipes/api-docs/api-docs/de/overview.md +3 -3
  101. package/samples/recipes/api-docs/api-docs/de/reference/tickets.md +10 -10
  102. package/samples/recipes/api-docs/api-docs/de/tokens.md +4 -4
  103. package/samples/recipes/api-docs/api-docs/en/events.md +14 -14
  104. package/samples/recipes/api-docs/api-docs/en/overview.md +3 -3
  105. package/samples/recipes/api-docs/api-docs/en/reference/tickets.md +10 -10
  106. package/samples/recipes/api-docs/api-docs/en/tokens.md +4 -4
  107. package/samples/recipes/api-docs/api-docs/index.json +22 -22
  108. package/samples/recipes/api-docs/api-docs/openapi.json +67 -67
  109. package/samples/recipes/api-docs/api-examples/ticket-close.json +1 -1
  110. package/samples/recipes/api-docs/api-examples/ticket-create.json +1 -1
  111. package/samples/recipes/api-docs/api-examples/ticket-detail.json +1 -1
  112. package/samples/recipes/api-docs/api-examples/ticket-list.json +1 -1
  113. package/samples/recipes/api-docs/api-examples/ticket-update.json +1 -1
  114. package/samples/recipes/api-docs/api-examples/webhooks/ticket-closed.json +1 -1
  115. package/samples/recipes/api-docs/kumiko.config.ts +4 -4
  116. package/samples/recipes/api-docs/src/feature.ts +44 -44
  117. package/samples/recipes/golden-path/src/feature.ts +1 -1
  118. package/samples/recipes/{contact → helpdesk}/README.md +16 -16
  119. package/samples/recipes/{contact → helpdesk}/package.json +2 -2
  120. package/samples/recipes/{contact → helpdesk}/src/feature.ts +6 -6
  121. package/packages/bundled-features/src/contact/client/contact-website-client.ts +0 -29
  122. package/packages/bundled-features/src/contact/client/index.ts +0 -9
  123. package/packages/bundled-features/src/contact/index.ts +0 -29
  124. package/packages/bundled-features/src/contact/panels.ts +0 -28
  125. package/packages/bundled-features/src/contact/web/constants.ts +0 -160
  126. package/packages/bundled-features/src/contact/web/index.ts +0 -29
  127. package/samples/apps/marketing-demo/src/features/helpdesk/i18n.ts +0 -100
  128. package/samples/apps/marketing-demo/src/features/helpdesk/web/index.ts +0 -7
  129. /package/packages/bundled-features/src/{contact → helpdesk}/handlers/access.ts +0 -0
  130. /package/packages/bundled-features/src/{contact → helpdesk}/pow.ts +0 -0
  131. /package/packages/bundled-features/src/{contact → helpdesk}/user-agent.ts +0 -0
  132. /package/samples/apps/marketing-demo/src/features/{helpdesk → ticketing}/schema/index.ts +0 -0
@@ -1,4 +1,4 @@
1
- // API docs sample: a helpdesk whose ticket handlers are reachable with a personal access token.
1
+ // API docs sample: a ticketing app whose ticket handlers are reachable with a personal access token.
2
2
  // Every handler a token scope reaches needs a description and, per locale, a title, description
3
3
  // and field labels; `kumiko api-docs` turns them into the pages under api-docs/.
4
4
 
@@ -28,7 +28,7 @@ export const ticketEntity = createEntity({
28
28
 
29
29
  const ticketAccess = { roles: ["Admin", "User"] } as const;
30
30
 
31
- export const helpdeskFeature = defineFeature("helpdesk", (r) => {
31
+ export const ticketingFeature = defineFeature("ticketing", (r) => {
32
32
  const { table: ticketTable, executor: ticketExecutor } = createEntityExecutor(
33
33
  "ticket",
34
34
  ticketEntity,
@@ -106,93 +106,93 @@ export const helpdeskFeature = defineFeature("helpdesk", (r) => {
106
106
  id: "ticket-edit",
107
107
  type: "entityEdit",
108
108
  entity: "ticket",
109
- layout: { sections: [{ title: "helpdesk:section.ticket", fields: ["title", "priority"] }] },
109
+ layout: { sections: [{ title: "ticketing:section.ticket", fields: ["title", "priority"] }] },
110
110
  });
111
111
  r.screen({
112
112
  id: "close-ticket",
113
113
  type: "actionForm",
114
- handler: "helpdesk:write:ticket:close",
114
+ handler: "ticketing:write:ticket:close",
115
115
  fields: { resolution: createTextField({ personal: false, reason: "is_business_data" }) },
116
- layout: { sections: [{ title: "helpdesk:section.close", fields: ["resolution"] }] },
116
+ layout: { sections: [{ title: "ticketing:section.close", fields: ["resolution"] }] },
117
117
  });
118
118
  r.screen({
119
119
  id: "purge-tickets",
120
120
  type: "actionForm",
121
- handler: "helpdesk:write:ticket:purge",
121
+ handler: "ticketing:write:ticket:purge",
122
122
  fields: {},
123
123
  layout: { sections: [] },
124
124
  });
125
125
 
126
- r.nav({ id: "tickets", label: "helpdesk:nav:tickets", screen: "helpdesk:screen:ticket-list" });
127
- r.nav({ id: "settings", label: "helpdesk:nav:settings" });
126
+ r.nav({ id: "tickets", label: "ticketing:nav:tickets", screen: "ticketing:screen:ticket-list" });
127
+ r.nav({ id: "settings", label: "ticketing:nav:settings" });
128
128
  r.nav({
129
129
  id: "api-tokens",
130
- label: "helpdesk:nav:api-tokens",
131
- parent: "helpdesk:nav:settings",
130
+ label: "ticketing:nav:api-tokens",
131
+ parent: "ticketing:nav:settings",
132
132
  screen: "personal-access-tokens:screen:api-tokens",
133
133
  });
134
134
 
135
135
  r.translations({
136
136
  keys: {
137
- "helpdesk:nav:tickets": { en: "Tickets", de: "Tickets" },
138
- "helpdesk:nav:settings": { en: "Settings", de: "Einstellungen" },
139
- "helpdesk:nav:api-tokens": { en: "API tokens", de: "API-Tokens" },
140
- "helpdesk:section.ticket": { en: "Ticket", de: "Ticket" },
141
- "helpdesk:section.close": { en: "Close ticket", de: "Ticket schließen" },
142
- "helpdesk:entity:ticket:field:title": { en: "Title", de: "Titel" },
143
- "helpdesk:entity:ticket:field:status": { en: "Status", de: "Status" },
144
- "helpdesk:entity:ticket:field:priority": { en: "Priority", de: "Priorität" },
145
- "helpdesk:write:ticket:create:title": { en: "Create ticket", de: "Ticket anlegen" },
146
- "helpdesk:write:ticket:create:description": {
137
+ "ticketing:nav:tickets": { en: "Tickets", de: "Tickets" },
138
+ "ticketing:nav:settings": { en: "Settings", de: "Einstellungen" },
139
+ "ticketing:nav:api-tokens": { en: "API tokens", de: "API-Tokens" },
140
+ "ticketing:section.ticket": { en: "Ticket", de: "Ticket" },
141
+ "ticketing:section.close": { en: "Close ticket", de: "Ticket schließen" },
142
+ "ticketing:entity:ticket:field:title": { en: "Title", de: "Titel" },
143
+ "ticketing:entity:ticket:field:status": { en: "Status", de: "Status" },
144
+ "ticketing:entity:ticket:field:priority": { en: "Priority", de: "Priorität" },
145
+ "ticketing:write:ticket:create:title": { en: "Create ticket", de: "Ticket anlegen" },
146
+ "ticketing:write:ticket:create:description": {
147
147
  en: "Opens a new ticket.",
148
148
  de: "Legt ein neues Ticket an.",
149
149
  },
150
- "helpdesk:write:ticket:update:title": { en: "Update ticket", de: "Ticket ändern" },
151
- "helpdesk:write:ticket:update:description": {
150
+ "ticketing:write:ticket:update:title": { en: "Update ticket", de: "Ticket ändern" },
151
+ "ticketing:write:ticket:update:description": {
152
152
  en: "Changes the title or the priority of a ticket.",
153
153
  de: "Ändert Titel oder Priorität eines Tickets.",
154
154
  },
155
- "helpdesk:query:ticket:list:title": { en: "List tickets", de: "Tickets auflisten" },
156
- "helpdesk:query:ticket:list:description": {
155
+ "ticketing:query:ticket:list:title": { en: "List tickets", de: "Tickets auflisten" },
156
+ "ticketing:query:ticket:list:description": {
157
157
  en: "Lists tickets, newest first.",
158
158
  de: "Listet Tickets, neueste zuerst.",
159
159
  },
160
- "helpdesk:query:ticket:detail:title": { en: "Show ticket", de: "Ticket anzeigen" },
161
- "helpdesk:query:ticket:detail:description": {
160
+ "ticketing:query:ticket:detail:title": { en: "Show ticket", de: "Ticket anzeigen" },
161
+ "ticketing:query:ticket:detail:description": {
162
162
  en: "Returns one ticket.",
163
163
  de: "Liefert ein Ticket.",
164
164
  },
165
- "helpdesk:write:ticket:close:title": { en: "Close ticket", de: "Ticket schließen" },
166
- "helpdesk:write:ticket:close:description": {
165
+ "ticketing:write:ticket:close:title": { en: "Close ticket", de: "Ticket schließen" },
166
+ "ticketing:write:ticket:close:description": {
167
167
  en: "Closes a ticket and records how it was resolved.",
168
168
  de: "Schließt ein Ticket und hält fest, wie es gelöst wurde.",
169
169
  },
170
- "helpdesk:write:ticket:close:field:id": { en: "Ticket", de: "Ticket" },
171
- "helpdesk:write:ticket:close:field:resolution": { en: "Resolution", de: "Lösung" },
172
- "helpdesk:write:ticket:purge:title": { en: "Purge tickets", de: "Tickets bereinigen" },
173
- "helpdesk:write:ticket:purge:description": {
170
+ "ticketing:write:ticket:close:field:id": { en: "Ticket", de: "Ticket" },
171
+ "ticketing:write:ticket:close:field:resolution": { en: "Resolution", de: "Lösung" },
172
+ "ticketing:write:ticket:purge:title": { en: "Purge tickets", de: "Tickets bereinigen" },
173
+ "ticketing:write:ticket:purge:description": {
174
174
  en: "Removes tickets that were closed long ago.",
175
175
  de: "Entfernt Tickets, die lange geschlossen sind.",
176
176
  },
177
- "helpdesk:write:ticket:purge:field:olderThanDays": {
177
+ "ticketing:write:ticket:purge:field:olderThanDays": {
178
178
  en: "Closed longer than (days)",
179
179
  de: "Länger geschlossen als (Tage)",
180
180
  },
181
- "helpdesk:entity:ticket": { en: "ticket", de: "Ticket" },
182
- "helpdesk:entity:ticket:field:id": { en: "Ticket ID", de: "Ticket-ID" },
183
- "helpdesk:webhook:ticket-closed:description": {
181
+ "ticketing:entity:ticket": { en: "ticket", de: "Ticket" },
182
+ "ticketing:entity:ticket:field:id": { en: "Ticket ID", de: "Ticket-ID" },
183
+ "ticketing:webhook:ticket-closed:description": {
184
184
  en: "A ticket was closed and its resolution recorded.",
185
185
  de: "Ein Ticket wurde geschlossen und seine Lösung festgehalten.",
186
186
  },
187
- "helpdesk:webhook:ticket-closed:field:id": {
187
+ "ticketing:webhook:ticket-closed:field:id": {
188
188
  en: "ID of the closed ticket",
189
189
  de: "ID des geschlossenen Tickets",
190
190
  },
191
- "helpdesk:webhook:ticket-closed:field:resolution": {
191
+ "ticketing:webhook:ticket-closed:field:resolution": {
192
192
  en: "How the ticket was resolved",
193
193
  de: "Wie das Ticket gelöst wurde",
194
194
  },
195
- "helpdesk:entity:__action-form__:field:resolution": { en: "Resolution", de: "Lösung" },
195
+ "ticketing:entity:__action-form__:field:resolution": { en: "Resolution", de: "Lösung" },
196
196
  },
197
197
  });
198
198
  });
@@ -204,12 +204,12 @@ export function patFeature() {
204
204
  scopes: {
205
205
  tickets: {
206
206
  label: "Tickets",
207
- events: ["ticket.created", "helpdesk:ticket-closed"],
208
- read: ["helpdesk:query:ticket:*"],
207
+ events: ["ticket.created", "ticketing:ticket-closed"],
208
+ read: ["ticketing:query:ticket:*"],
209
209
  write: [
210
- "helpdesk:write:ticket:create",
211
- "helpdesk:write:ticket:update",
212
- "helpdesk:write:ticket:close",
210
+ "ticketing:write:ticket:create",
211
+ "ticketing:write:ticket:update",
212
+ "ticketing:write:ticket:close",
213
213
  ],
214
214
  },
215
215
  },
@@ -18,7 +18,7 @@ export const ticketEntity = createEntity({
18
18
  },
19
19
  });
20
20
 
21
- export const helpdeskFeature = defineFeature("helpdesk", (r) => {
21
+ export const ticketingFeature = defineFeature("ticketing", (r) => {
22
22
  const { table: ticketTable, executor: ticketExecutor } = createEntityExecutor(
23
23
  "ticket",
24
24
  ticketEntity,
@@ -1,6 +1,6 @@
1
- # Recipe: contact
1
+ # Recipe: helpdesk
2
2
 
3
- Public contact form backend. The `contact` bundled feature stores questions, contact
3
+ Public contact form backend. The `helpdesk` bundled feature stores questions, contact
4
4
  requests and problem reports from website visitors and notifies every SystemAdmin (mail,
5
5
  Telegram only when the app turns it on). The notification names only the kind, the app and a link into the inbox:
6
6
  no name, address, phone, subject or message. Telegram is a third party where nothing can be
@@ -10,43 +10,43 @@ SystemAdmins reply from the admin. Phone is off and Telegram is not mounted unle
10
10
  turns them on (`fields.phone`, `telegram: true`).
11
11
 
12
12
  **What the recipe demonstrates:**
13
- - Mounting `createContactFeature` with its companions (delivery, user-data-rights, files)
14
- - The anonymous flow: `contact:query:challenge` hands out a proof-of-work challenge,
15
- `contact:write:submit` verifies it; spam gets the same 200 body and stores nothing
16
- - The browser client at `GET /contact/client.js` (`window.KumikoContact.load()` / `submit()`)
13
+ - Mounting `createHelpdeskFeature` with its companions (delivery, user-data-rights, files)
14
+ - The anonymous flow: `helpdesk:query:challenge` hands out a proof-of-work challenge,
15
+ `helpdesk:write:submit` verifies it; spam gets the same 200 body and stores nothing
16
+ - The browser client at `GET /helpdesk/client.js` (`window.KumikoHelpdesk.load()` / `submit()`)
17
17
 
18
18
  ## Layout
19
19
 
20
20
  ```
21
- samples/recipes/contact/
21
+ samples/recipes/helpdesk/
22
22
  ├── package.json
23
23
  ├── README.md
24
24
  └── src/
25
- ├── feature.ts # createContactFeature options
25
+ ├── feature.ts # createHelpdeskFeature options
26
26
  └── __tests__/
27
27
  └── feature.integration.test.ts # challenge query + client route
28
28
  ```
29
29
 
30
30
  The behavior (submit, silent drops, replies, Telegram, GDPR export and erasure, retention) is
31
31
  covered by the integration tests next to the feature in
32
- `packages/bundled-features/src/contact/__tests__/`.
32
+ `packages/bundled-features/src/helpdesk/__tests__/`.
33
33
 
34
34
  ## Run tests
35
35
 
36
36
  ```bash
37
- bun test --config=bunfig.integration.toml samples/recipes/contact
37
+ bun test --config=bunfig.integration.toml samples/recipes/helpdesk
38
38
  ```
39
39
 
40
40
  ## Integration into a real app
41
41
 
42
- 1. Mount `createContactFeature({ appName })` plus delivery, a mail channel, `user-data-rights`,
42
+ 1. Mount `createHelpdeskFeature({ appName })` plus delivery, a mail channel, `user-data-rights`,
43
43
  `files` with a file provider and `config`.
44
44
  2. Run `kumiko schema generate` (new tables, plus the delivery `idempotency_key` column).
45
- 3. SystemAdmins set `contact:config:reply-to` in the admin.
46
- 4. Embed `/contact/client.js` on the website; the form is yours. A website served by another
47
- server can serve the same script from `CONTACT_CLIENT_SOURCE` and type its calls with
48
- `ContactWebsiteClient`, both from `@cosmicdrift/kumiko-bundled-features/contact/client`.
45
+ 3. SystemAdmins set `helpdesk:config:reply-to` in the admin.
46
+ 4. Embed `/helpdesk/client.js` on the website; the form is yours. A website served by another
47
+ server can serve the same script from `HELPDESK_CLIENT_SOURCE` and type its calls with
48
+ `HelpdeskWebsiteClient`, both from `@cosmicdrift/kumiko-bundled-features/helpdesk/client`.
49
49
 
50
50
  Telegram is optional and off by default: notifications go by mail to SystemAdmins only. An app
51
51
  that turns it on (`telegram: true`) also mounts `channel-telegram` and `secrets` for the bot
52
- token, and SystemAdmins set `contact:config:telegram-chat`.
52
+ token, and SystemAdmins set `helpdesk:config:telegram-chat`.
@@ -1,6 +1,6 @@
1
1
  {
2
- "name": "@cosmicdrift/kumiko-sample-contact",
3
- "description": "Public contact form backend: the contact bundled feature with its required companions (delivery, user-data-rights, files) and the anonymous browser client.",
2
+ "name": "@cosmicdrift/kumiko-sample-helpdesk",
3
+ "description": "Public contact form backend: the helpdesk bundled feature with its required companions (delivery, user-data-rights, files) and the anonymous browser client.",
4
4
  "private": true,
5
5
  "dependencies": {
6
6
  "@cosmicdrift/kumiko-bundled-features": "workspace:*",
@@ -1,4 +1,4 @@
1
- // Contact sample
1
+ // Helpdesk sample
2
2
  //
3
3
  // A public website form (question, contact request, problem report) that lands with the
4
4
  // SystemAdmins: mail, optional Telegram, a copy to the sender. Spam is handled without a
@@ -6,9 +6,9 @@
6
6
  // and per-email rate limits. Rejected submits answer 200 with the normal body.
7
7
  //
8
8
  // The website embeds the anonymous client the feature serves itself:
9
- // <script src="https://api.example.com/contact/client.js"></script>
10
- // const { kinds, phone } = await window.KumikoContact.load();
11
- // const result = await window.KumikoContact.submit({ kind, name, email, message, locale });
9
+ // <script src="https://api.example.com/helpdesk/client.js"></script>
10
+ // const { kinds, phone } = await window.KumikoHelpdesk.load();
11
+ // const result = await window.KumikoHelpdesk.submit({ kind, name, email, message, locale });
12
12
  // // result.kind: "sent" | "rate-limited" (retryAfterSeconds) | "failed"
13
13
  //
14
14
  // Prerequisites the app wires itself:
@@ -17,9 +17,9 @@
17
17
  // - a file provider, because the entities carry file fields
18
18
  // - `kumiko schema generate` for the new tables
19
19
 
20
- import { createContactFeature } from "@cosmicdrift/kumiko-bundled-features/contact";
20
+ import { createHelpdeskFeature } from "@cosmicdrift/kumiko-bundled-features/helpdesk";
21
21
 
22
- export const contactFeature = createContactFeature({
22
+ export const helpdeskFeature = createHelpdeskFeature({
23
23
  appName: "Sample App",
24
24
  fields: { phone: "optional" },
25
25
  // Lowered only to keep the sample test fast; the default (19 bits, 3 seconds) suits production.
@@ -1,29 +0,0 @@
1
- import type * as z from "zod";
2
- import type { ContactSubmitSchema } from "../payloads.ts";
3
- import type { CONTACT_WEBSITE_KINDS, ContactPhoneMode } from "../web/constants.ts";
4
-
5
- export type ContactWebsiteKind = (typeof CONTACT_WEBSITE_KINDS)[number];
6
-
7
- export type ContactWebsiteFormOptions = {
8
- readonly phone: ContactPhoneMode;
9
- readonly kinds: readonly ContactWebsiteKind[];
10
- };
11
-
12
- // The client adds challenge and nonce itself and falls back to the page language for locale.
13
- export type ContactWebsiteSubmitFields = Omit<
14
- z.input<typeof ContactSubmitSchema>,
15
- "challenge" | "nonce" | "locale"
16
- > & { readonly locale?: z.input<typeof ContactSubmitSchema>["locale"] };
17
-
18
- export type ContactWebsiteSubmitResult =
19
- | { readonly kind: "sent" }
20
- | { readonly kind: "rate-limited"; readonly retryAfterSeconds?: number }
21
- | { readonly kind: "failed" };
22
-
23
- export type ContactWebsiteClient = {
24
- load(): Promise<ContactWebsiteFormOptions>;
25
- submit(fields: ContactWebsiteSubmitFields): Promise<ContactWebsiteSubmitResult>;
26
- };
27
-
28
- // Registered by CONTACT_CLIENT_SOURCE as window.KumikoContact.
29
- export type ContactWebsiteWindow = { readonly KumikoContact?: ContactWebsiteClient };
@@ -1,9 +0,0 @@
1
- export { CONTACT_CLIENT_SOURCE } from "./contact-client-source.ts";
2
- export type {
3
- ContactWebsiteClient,
4
- ContactWebsiteFormOptions,
5
- ContactWebsiteKind,
6
- ContactWebsiteSubmitFields,
7
- ContactWebsiteSubmitResult,
8
- ContactWebsiteWindow,
9
- } from "./contact-website-client.ts";
@@ -1,29 +0,0 @@
1
- export {
2
- contactReplyEntity,
3
- contactReplyTable,
4
- contactRequestEntity,
5
- contactRequestTable,
6
- } from "./entity.ts";
7
- export { createContactFeature } from "./feature.ts";
8
- export type { ContactOptions } from "./options.ts";
9
- export { contactOpenRequestsPanels } from "./panels.ts";
10
- export {
11
- CONTACT_ADMIN_KINDS,
12
- CONTACT_CLIENT_PATH,
13
- CONTACT_DELIVERY_CHANNEL,
14
- CONTACT_DELIVERY_STATUS,
15
- CONTACT_FEATURE,
16
- CONTACT_FIELD_LIMITS,
17
- CONTACT_KIND,
18
- CONTACT_NOTIFICATION_TYPES,
19
- CONTACT_ORIGIN,
20
- CONTACT_REPLY_CHANNELS,
21
- CONTACT_SOURCE,
22
- CONTACT_STATUS,
23
- CONTACT_WEBSITE_KINDS,
24
- ContactConfigKeys,
25
- ContactErrors,
26
- ContactHandlers,
27
- ContactQueries,
28
- ContactScreens,
29
- } from "./web/constants.ts";
@@ -1,28 +0,0 @@
1
- import type { DashboardStatPanel } from "@cosmicdrift/kumiko-framework/ui-types";
2
- import {
3
- CONTACT_FEATURE,
4
- CONTACT_STATUS,
5
- ContactQueries,
6
- ContactScreens,
7
- } from "./web/constants.ts";
8
-
9
- // Stat tile for a dashboard: how many contact requests still wait for a first answer.
10
- export function contactOpenRequestsPanels(): readonly DashboardStatPanel[] {
11
- return [
12
- {
13
- kind: "stat",
14
- id: `${CONTACT_FEATURE}-open-requests`,
15
- label: "contact:overview.open",
16
- query: ContactQueries.requestList,
17
- params: {
18
- filters: [{ field: "status", op: "eq", value: CONTACT_STATUS.Open }],
19
- limit: 1,
20
- totalCount: true,
21
- },
22
- ignoreScreenFilter: true,
23
- valueField: "total",
24
- tone: "warn",
25
- navigate: { screen: ContactScreens.requestList },
26
- },
27
- ];
28
- }
@@ -1,160 +0,0 @@
1
- // Pure string constants, safe for browser code (see waitlist/web/constants.ts).
2
- export const CONTACT_FEATURE = "contact" as const;
3
-
4
- export const CONTACT_KIND = {
5
- Question: "question",
6
- Contact: "contact",
7
- Bug: "bug",
8
- Wish: "wish",
9
- } as const;
10
- export type ContactKind = (typeof CONTACT_KIND)[keyof typeof CONTACT_KIND];
11
-
12
- export const CONTACT_WEBSITE_KINDS = [
13
- CONTACT_KIND.Question,
14
- CONTACT_KIND.Contact,
15
- CONTACT_KIND.Bug,
16
- ] as const;
17
- export const CONTACT_ADMIN_KINDS = [
18
- CONTACT_KIND.Question,
19
- CONTACT_KIND.Bug,
20
- CONTACT_KIND.Wish,
21
- ] as const;
22
-
23
- export const CONTACT_STATUS = {
24
- Open: "open",
25
- Answered: "answered",
26
- Done: "done",
27
- } as const;
28
- export type ContactStatus = (typeof CONTACT_STATUS)[keyof typeof CONTACT_STATUS];
29
-
30
- export const CONTACT_SOURCE = {
31
- Website: "website",
32
- Admin: "admin",
33
- } as const;
34
- export type ContactSource = (typeof CONTACT_SOURCE)[keyof typeof CONTACT_SOURCE];
35
-
36
- export const CONTACT_REPLY_CHANNELS = {
37
- Email: "email",
38
- EmailAndInApp: "email+inApp",
39
- } as const;
40
- export type ContactReplyChannels =
41
- (typeof CONTACT_REPLY_CHANNELS)[keyof typeof CONTACT_REPLY_CHANNELS];
42
-
43
- export const CONTACT_ORIGIN = {
44
- Website: "website",
45
- AdminReport: "admin-report",
46
- } as const;
47
- export type ContactOrigin = (typeof CONTACT_ORIGIN)[keyof typeof CONTACT_ORIGIN];
48
-
49
- export const CONTACT_DELIVERY_CHANNEL = {
50
- Email: "email",
51
- Telegram: "telegram",
52
- ReplyEmail: "reply-email",
53
- ReplyInApp: "reply-in-app",
54
- } as const;
55
- export type ContactDeliveryChannel =
56
- (typeof CONTACT_DELIVERY_CHANNEL)[keyof typeof CONTACT_DELIVERY_CHANNEL];
57
-
58
- export const CONTACT_DELIVERY_STATUS = {
59
- Pending: "pending",
60
- Delivered: "delivered",
61
- Failed: "failed",
62
- Skipped: "skipped",
63
- Read: "read",
64
- } as const;
65
- export type ContactDeliveryStatus =
66
- (typeof CONTACT_DELIVERY_STATUS)[keyof typeof CONTACT_DELIVERY_STATUS];
67
-
68
- export type ContactPhoneMode = "off" | "optional" | "required";
69
-
70
- export const ContactHandlers = {
71
- submit: "contact:write:submit",
72
- report: "contact:write:report",
73
- reply: "contact:write:reply",
74
- markDone: "contact:write:mark-done",
75
- sendTest: "contact:write:send-test",
76
- forwardRequest: "contact:write:forward-request",
77
- sendReplyMail: "contact:write:send-reply-mail",
78
- notifyReporterInApp: "contact:write:notify-reporter-in-app",
79
- } as const;
80
-
81
- export const ContactQueries = {
82
- challenge: "contact:query:challenge",
83
- openCount: "contact:query:open-count",
84
- requestDetail: "contact:query:request-detail",
85
- replies: "contact:query:replies",
86
- requestDelivery: "contact:query:request-delivery",
87
- // Entity-convention list QN: entityList screens resolve their query by this shape.
88
- requestList: "contact:query:contact-request:list",
89
- } as const;
90
-
91
- export const ContactScreens = {
92
- requestList: "contact:screen:request-list",
93
- requestDetail: "contact:screen:request-detail",
94
- report: "contact:screen:report",
95
- reply: "contact:screen:reply",
96
- replyMail: "contact:screen:reply-mail",
97
- forwarding: "contact:screen:forwarding",
98
- } as const;
99
-
100
- // Files field of both upload forms (report, reply); the uploads are pending under the screen QN.
101
- export const CONTACT_UPLOAD_FIELD = "fileIds" as const;
102
-
103
- export const ContactConfigKeys = {
104
- replyTo: "contact:config:reply-to",
105
- telegramChat: "contact:config:telegram-chat",
106
- } as const;
107
-
108
- export const ContactErrors = {
109
- telegramChatMissing: "telegram_chat_missing",
110
- telegramTestFailed: "telegram_test_failed",
111
- notFound: "contact_request_not_found",
112
- phoneNotAllowed: "contact_phone_not_allowed",
113
- phoneRequired: "contact_phone_required",
114
- reporterEmailMissing: "contact_reporter_email_missing",
115
- attachmentNotFound: "contact_attachment_not_found",
116
- } as const;
117
-
118
- export const CONTACT_NOTIFICATION_TYPES = {
119
- newRequest: "contact:notify:new-request",
120
- confirmation: "contact:notify:confirmation",
121
- acknowledgement: "contact:notify:acknowledgement",
122
- reply: "contact:notify:reply",
123
- replyInApp: "contact:notify:reply-in-app",
124
- test: "contact:notify:test",
125
- } as const;
126
-
127
- export const CONTACT_CLIENT_PATH = "/contact/client.js" as const;
128
-
129
- export const CONTACT_FIELD_LIMITS = {
130
- name: 120,
131
- email: 254,
132
- phone: 40,
133
- subject: 200,
134
- message: 5000,
135
- locale: 35,
136
- honeypot: 500,
137
- page: 300,
138
- challenge: 64,
139
- nonce: 32,
140
- } as const;
141
-
142
- export const CONTACT_MAX_FILES = 5;
143
-
144
- export const CONTACT_SUBJECT_MAX_CHARS = 80;
145
-
146
- export const CONTACT_POW_BITS = { min: 8, max: 26, default: 19 } as const;
147
- export const CONTACT_DEFAULT_MIN_SUBMIT_SECONDS = 3;
148
- export const CONTACT_DEFAULT_CHALLENGE_TTL_MINUTES = 30;
149
- export const CONTACT_CHALLENGE_REDIS_PREFIX = "contact:challenge:" as const;
150
-
151
- export const CONTACT_REQUEST_ENTITY = "contact-request" as const;
152
- export const CONTACT_REPLY_ENTITY = "contact-reply" as const;
153
-
154
- export const contactIdempotencyKeys = {
155
- admins: (requestId: string) => `contact:request:${requestId}:admins`,
156
- telegram: (requestId: string) => `contact:request:${requestId}:telegram`,
157
- confirmation: (requestId: string) => `contact:request:${requestId}:confirmation`,
158
- reply: (replyId: string) => `contact:reply:${replyId}`,
159
- replyInApp: (replyId: string) => `contact:reply:${replyId}:in-app`,
160
- } as const;
@@ -1,29 +0,0 @@
1
- export {
2
- CONTACT_ADMIN_KINDS,
3
- CONTACT_CLIENT_PATH,
4
- CONTACT_DELIVERY_CHANNEL,
5
- CONTACT_DELIVERY_STATUS,
6
- CONTACT_FEATURE,
7
- CONTACT_FIELD_LIMITS,
8
- CONTACT_KIND,
9
- CONTACT_NOTIFICATION_TYPES,
10
- CONTACT_ORIGIN,
11
- CONTACT_REPLY_CHANNELS,
12
- CONTACT_SOURCE,
13
- CONTACT_STATUS,
14
- CONTACT_SUBJECT_MAX_CHARS,
15
- CONTACT_WEBSITE_KINDS,
16
- ContactConfigKeys,
17
- type ContactDeliveryChannel,
18
- type ContactDeliveryStatus,
19
- ContactErrors,
20
- ContactHandlers,
21
- type ContactKind,
22
- type ContactOrigin,
23
- type ContactPhoneMode,
24
- ContactQueries,
25
- type ContactReplyChannels,
26
- ContactScreens,
27
- type ContactSource,
28
- type ContactStatus,
29
- } from "./constants.ts";