@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,10 +1,10 @@
1
1
  import { canonicalizeLocaleTag, isValidLocaleTag } from "@cosmicdrift/kumiko-framework/i18n";
2
2
  import * as z from "zod";
3
3
  import {
4
- CONTACT_ADMIN_KINDS,
5
- CONTACT_FIELD_LIMITS,
6
- CONTACT_MAX_FILES,
7
- CONTACT_WEBSITE_KINDS,
4
+ HELPDESK_ADMIN_KINDS,
5
+ HELPDESK_FIELD_LIMITS,
6
+ HELPDESK_MAX_FILES,
7
+ HELPDESK_WEBSITE_KINDS,
8
8
  } from "./web/constants.ts";
9
9
 
10
10
  // Submitted text lands in mail subjects; CR/LF there would allow header injection.
@@ -28,14 +28,14 @@ const multiLine = (max: number) =>
28
28
  const phone = z
29
29
  .string()
30
30
  .trim()
31
- .max(CONTACT_FIELD_LIMITS.phone)
31
+ .max(HELPDESK_FIELD_LIMITS.phone)
32
32
  .refine(noControlChars, CONTROL_CHARS_MESSAGE)
33
33
  .optional();
34
34
 
35
35
  const pagePath = z
36
36
  .string()
37
37
  .trim()
38
- .max(CONTACT_FIELD_LIMITS.page)
38
+ .max(HELPDESK_FIELD_LIMITS.page)
39
39
  .refine(noControlChars, CONTROL_CHARS_MESSAGE)
40
40
  // Query strings and fragments carry tokens and ids (reset links, session hints) that must not
41
41
  // end up in an inbox that is kept for a year.
@@ -44,63 +44,63 @@ const pagePath = z
44
44
 
45
45
  const locale = z
46
46
  .string()
47
- .max(CONTACT_FIELD_LIMITS.locale)
47
+ .max(HELPDESK_FIELD_LIMITS.locale)
48
48
  .refine(isValidLocaleTag, "invalid locale tag")
49
49
  .transform(canonicalizeLocaleTag);
50
50
 
51
- export const ContactSubmitSchema = z
51
+ export const HelpdeskSubmitSchema = z
52
52
  .object({
53
- kind: z.enum(CONTACT_WEBSITE_KINDS),
54
- name: singleLine(CONTACT_FIELD_LIMITS.name),
55
- email: z.email().max(CONTACT_FIELD_LIMITS.email),
53
+ kind: z.enum(HELPDESK_WEBSITE_KINDS),
54
+ name: singleLine(HELPDESK_FIELD_LIMITS.name),
55
+ email: z.email().max(HELPDESK_FIELD_LIMITS.email),
56
56
  phone,
57
- message: multiLine(CONTACT_FIELD_LIMITS.message),
57
+ message: multiLine(HELPDESK_FIELD_LIMITS.message),
58
58
  locale,
59
59
  // Honeypot: bots fill it, humans leave it empty.
60
- website: z.string().max(CONTACT_FIELD_LIMITS.honeypot).optional(),
61
- challenge: z.string().max(CONTACT_FIELD_LIMITS.challenge),
62
- nonce: z.string().max(CONTACT_FIELD_LIMITS.nonce),
60
+ website: z.string().max(HELPDESK_FIELD_LIMITS.honeypot).optional(),
61
+ challenge: z.string().max(HELPDESK_FIELD_LIMITS.challenge),
62
+ nonce: z.string().max(HELPDESK_FIELD_LIMITS.nonce),
63
63
  page: pagePath,
64
64
  })
65
65
  .strict();
66
- export type ContactSubmitInput = z.infer<typeof ContactSubmitSchema>;
66
+ export type HelpdeskSubmitInput = z.infer<typeof HelpdeskSubmitSchema>;
67
67
 
68
- export const ContactReportSchema = z
68
+ export const HelpdeskReportSchema = z
69
69
  .object({
70
- kind: z.enum(CONTACT_ADMIN_KINDS),
71
- subject: singleLine(CONTACT_FIELD_LIMITS.subject),
72
- message: multiLine(CONTACT_FIELD_LIMITS.message),
70
+ kind: z.enum(HELPDESK_ADMIN_KINDS),
71
+ subject: singleLine(HELPDESK_FIELD_LIMITS.subject),
72
+ message: multiLine(HELPDESK_FIELD_LIMITS.message),
73
73
  phone,
74
- fileIds: z.array(z.uuid()).max(CONTACT_MAX_FILES).optional(),
74
+ fileIds: z.array(z.uuid()).max(HELPDESK_MAX_FILES).optional(),
75
75
  })
76
76
  .strict();
77
- export type ContactReportInput = z.infer<typeof ContactReportSchema>;
77
+ export type HelpdeskReportInput = z.infer<typeof HelpdeskReportSchema>;
78
78
 
79
- export const ContactIdSchema = z.object({ id: z.uuid() }).strict();
79
+ export const HelpdeskIdSchema = z.object({ id: z.uuid() }).strict();
80
80
 
81
- export const ContactReplySchema = z
81
+ export const HelpdeskReplySchema = z
82
82
  .object({
83
83
  requestId: z.uuid(),
84
- message: multiLine(CONTACT_FIELD_LIMITS.message),
85
- fileIds: z.array(z.uuid()).max(CONTACT_MAX_FILES).optional(),
84
+ message: multiLine(HELPDESK_FIELD_LIMITS.message),
85
+ fileIds: z.array(z.uuid()).max(HELPDESK_MAX_FILES).optional(),
86
86
  markDone: z.boolean().default(false),
87
87
  })
88
88
  .strict();
89
89
 
90
- export const ContactMarkDoneSchema = ContactIdSchema;
90
+ export const HelpdeskMarkDoneSchema = HelpdeskIdSchema;
91
91
 
92
- export const ContactForwardRequestSchema = z.object({ requestId: z.uuid() }).strict();
92
+ export const HelpdeskForwardRequestSchema = z.object({ requestId: z.uuid() }).strict();
93
93
 
94
- export const ContactSendReplyMailSchema = z.object({ replyId: z.uuid() }).strict();
94
+ export const HelpdeskSendReplyMailSchema = z.object({ replyId: z.uuid() }).strict();
95
95
 
96
- export const ContactNotifyReporterInAppSchema = z
96
+ export const HelpdeskNotifyReporterInAppSchema = z
97
97
  .object({
98
98
  replyId: z.uuid(),
99
99
  requestId: z.uuid(),
100
100
  userId: z.uuid(),
101
- authorName: z.string().max(CONTACT_FIELD_LIMITS.name),
102
- locale: z.string().max(CONTACT_FIELD_LIMITS.locale).optional(),
101
+ authorName: z.string().max(HELPDESK_FIELD_LIMITS.name),
102
+ locale: z.string().max(HELPDESK_FIELD_LIMITS.locale).optional(),
103
103
  })
104
104
  .strict();
105
105
 
106
- export const ContactEmptySchema = z.object({}).strict();
106
+ export const HelpdeskEmptySchema = z.object({}).strict();
@@ -8,34 +8,34 @@ import type {
8
8
  } from "@cosmicdrift/kumiko-framework/ui-types";
9
9
  import { DELIVERY_LOG_SCREEN_ID } from "../delivery/index.ts";
10
10
  import { REPORT_ACCESS } from "./handlers/access.ts";
11
- import type { ContactOptions, ContactSettings } from "./options.ts";
11
+ import type { HelpdeskOptions, HelpdeskSettings } from "./options.ts";
12
12
  import {
13
- CONTACT_ADMIN_KINDS,
14
- CONTACT_DELIVERY_STATUS,
15
- CONTACT_FEATURE,
16
- CONTACT_MAX_FILES,
17
- CONTACT_ORIGIN,
18
- CONTACT_REPLY_CHANNELS,
19
- CONTACT_STATUS,
20
- CONTACT_UPLOAD_FIELD,
21
- ContactConfigKeys,
22
- ContactHandlers,
23
- ContactQueries,
13
+ HELPDESK_ADMIN_KINDS,
14
+ HELPDESK_DELIVERY_STATUS,
15
+ HELPDESK_FEATURE,
16
+ HELPDESK_MAX_FILES,
17
+ HELPDESK_ORIGIN,
18
+ HELPDESK_REPLY_CHANNELS,
19
+ HELPDESK_STATUS,
20
+ HELPDESK_UPLOAD_FIELD,
21
+ HelpdeskConfigKeys,
22
+ HelpdeskHandlers,
23
+ HelpdeskQueries,
24
24
  } from "./web/constants.ts";
25
25
 
26
26
  const MAX_FILE_SIZE = "10MB";
27
- const REQUEST_FIELD = `${CONTACT_FEATURE}:entity:contact-request:field`;
28
- const DELIVERY_FIELD = `${CONTACT_FEATURE}:entity:contact-delivery:field`;
27
+ const REQUEST_FIELD = `${HELPDESK_FEATURE}:entity:helpdesk-request:field`;
28
+ const DELIVERY_FIELD = `${HELPDESK_FEATURE}:entity:helpdesk-delivery:field`;
29
29
  const TELEGRAM_BOT_TOKEN_SECRET = "channel-telegram:secret:bot-token";
30
30
 
31
- export const REPORT_FIELD_LABEL = `${CONTACT_FEATURE}:report.field`;
32
- export const REPLY_FIELD_LABEL = `${CONTACT_FEATURE}:reply.field`;
31
+ export const REPORT_FIELD_LABEL = `${HELPDESK_FEATURE}:report.field`;
32
+ export const REPLY_FIELD_LABEL = `${HELPDESK_FEATURE}:reply.field`;
33
33
 
34
34
  function attachmentsField() {
35
35
  return createFilesField({
36
36
  personal: false,
37
37
  reason: "is_business_data",
38
- maxCount: CONTACT_MAX_FILES,
38
+ maxCount: HELPDESK_MAX_FILES,
39
39
  maxSize: MAX_FILE_SIZE,
40
40
  display: "dropzone",
41
41
  });
@@ -44,40 +44,40 @@ function attachmentsField() {
44
44
  // The files the form uploads stay pending under this screen's QN until the handler takes them
45
45
  // over (copyPendingFileRefsToTenant).
46
46
  function createReportScreen(
47
- opts: ContactOptions,
48
- settings: ContactSettings,
47
+ opts: HelpdeskOptions,
48
+ settings: HelpdeskSettings,
49
49
  ): ActionFormScreenDefinition {
50
50
  const withPhone = settings.phone !== "off";
51
51
  return {
52
52
  id: "report",
53
53
  type: "actionForm",
54
54
  dormant: true,
55
- handler: ContactHandlers.report,
55
+ handler: HelpdeskHandlers.report,
56
56
  summary: {
57
- title: `${CONTACT_FEATURE}:report.hint`,
58
- subtitle: `${CONTACT_FEATURE}:report.summary`,
57
+ title: `${HELPDESK_FEATURE}:report.hint`,
58
+ subtitle: `${HELPDESK_FEATURE}:report.summary`,
59
59
  params: { appName: opts.appName },
60
60
  },
61
61
  fields: {
62
- kind: { type: "select", options: CONTACT_ADMIN_KINDS, required: true, display: "radio" },
62
+ kind: { type: "select", options: HELPDESK_ADMIN_KINDS, required: true, display: "radio" },
63
63
  ...(withPhone && {
64
64
  phone: { type: "text", format: "phone", required: settings.phone === "required" },
65
65
  }),
66
66
  subject: { type: "text", required: true },
67
67
  message: { type: "longText", required: true },
68
- [CONTACT_UPLOAD_FIELD]: attachmentsField(),
68
+ [HELPDESK_UPLOAD_FIELD]: attachmentsField(),
69
69
  },
70
70
  layout: {
71
71
  sections: [
72
72
  {
73
- title: `${CONTACT_FEATURE}:report.section`,
74
- description: `${CONTACT_FEATURE}:report.section.description`,
73
+ title: `${HELPDESK_FEATURE}:report.section`,
74
+ description: `${HELPDESK_FEATURE}:report.section.description`,
75
75
  fields: [
76
76
  "kind",
77
77
  ...(withPhone ? ["phone"] : []),
78
78
  { field: "subject", span: 2 },
79
79
  "message",
80
- CONTACT_UPLOAD_FIELD,
80
+ HELPDESK_UPLOAD_FIELD,
81
81
  ],
82
82
  },
83
83
  ],
@@ -87,11 +87,11 @@ function createReportScreen(
87
87
  phone: `${REPORT_FIELD_LABEL}.phone`,
88
88
  subject: `${REPORT_FIELD_LABEL}.subject`,
89
89
  message: `${REPORT_FIELD_LABEL}.message`,
90
- [CONTACT_UPLOAD_FIELD]: `${REPORT_FIELD_LABEL}.files`,
90
+ [HELPDESK_UPLOAD_FIELD]: `${REPORT_FIELD_LABEL}.files`,
91
91
  },
92
- submitLabel: `${CONTACT_FEATURE}:report.submit`,
92
+ submitLabel: `${HELPDESK_FEATURE}:report.submit`,
93
93
  ...(opts.reportCancelTarget !== undefined && { cancelTarget: opts.reportCancelTarget }),
94
- successMessage: `${CONTACT_FEATURE}:report.success`,
94
+ successMessage: `${HELPDESK_FEATURE}:report.success`,
95
95
  access: REPORT_ACCESS,
96
96
  };
97
97
  }
@@ -103,12 +103,12 @@ function createReplyScreen(id: string, summarySubtitle: string): ActionFormScree
103
103
  id,
104
104
  type: "actionForm",
105
105
  dormant: true,
106
- handler: ContactHandlers.reply,
107
- summary: { title: `${CONTACT_FEATURE}:reply.title`, subtitle: summarySubtitle },
106
+ handler: HelpdeskHandlers.reply,
107
+ summary: { title: `${HELPDESK_FEATURE}:reply.title`, subtitle: summarySubtitle },
108
108
  fields: {
109
109
  requestId: { type: "text", required: true },
110
110
  message: { type: "longText", required: true },
111
- [CONTACT_UPLOAD_FIELD]: attachmentsField(),
111
+ [HELPDESK_UPLOAD_FIELD]: attachmentsField(),
112
112
  markDone: { type: "boolean" },
113
113
  name: { type: "text" },
114
114
  email: { type: "text" },
@@ -117,15 +117,15 @@ function createReplyScreen(id: string, summarySubtitle: string): ActionFormScree
117
117
  layout: {
118
118
  sections: [
119
119
  {
120
- title: `${CONTACT_FEATURE}:reply.section`,
121
- description: `${CONTACT_FEATURE}:reply.section.description`,
120
+ title: `${HELPDESK_FEATURE}:reply.section`,
121
+ description: `${HELPDESK_FEATURE}:reply.section.description`,
122
122
  fields: [
123
123
  { field: "requestId", visible: false },
124
124
  { field: "name", visible: false },
125
125
  { field: "email", visible: false },
126
126
  { field: "replyTo", visible: false },
127
127
  "message",
128
- CONTACT_UPLOAD_FIELD,
128
+ HELPDESK_UPLOAD_FIELD,
129
129
  "markDone",
130
130
  ],
131
131
  },
@@ -133,10 +133,10 @@ function createReplyScreen(id: string, summarySubtitle: string): ActionFormScree
133
133
  },
134
134
  fieldLabels: {
135
135
  message: `${REPLY_FIELD_LABEL}.message`,
136
- [CONTACT_UPLOAD_FIELD]: `${REPLY_FIELD_LABEL}.files`,
136
+ [HELPDESK_UPLOAD_FIELD]: `${REPLY_FIELD_LABEL}.files`,
137
137
  markDone: `${REPLY_FIELD_LABEL}.mark-done`,
138
138
  },
139
- submitLabel: `${CONTACT_FEATURE}:reply.submit`,
139
+ submitLabel: `${HELPDESK_FEATURE}:reply.submit`,
140
140
  access: { roles: access.systemAdmin },
141
141
  };
142
142
  }
@@ -144,14 +144,14 @@ function createReplyScreen(id: string, summarySubtitle: string): ActionFormScree
144
144
  const requestListScreen: EntityListScreenDefinition = {
145
145
  id: "request-list",
146
146
  type: "entityList",
147
- entity: "contact-request",
147
+ entity: "helpdesk-request",
148
148
  dormant: true,
149
149
  allowCreate: false,
150
150
  searchable: true,
151
151
  columns: [
152
152
  { field: "submittedAt", display: "datetime" },
153
153
  "kind",
154
- { field: "name", label: `${CONTACT_FEATURE}:list.from` },
154
+ { field: "name", label: `${HELPDESK_FEATURE}:list.from` },
155
155
  { field: "reporterTenantName", label: `${REQUEST_FIELD}:reporterTenantName` },
156
156
  { field: "subject", hideOnNarrow: true },
157
157
  {
@@ -167,19 +167,19 @@ const requestListScreen: EntityListScreenDefinition = {
167
167
  display: "chips",
168
168
  showCounts: true,
169
169
  extraOptions: [
170
- { id: "all", label: `${CONTACT_FEATURE}:filter.all`, values: [], position: "start" },
170
+ { id: "all", label: `${HELPDESK_FEATURE}:filter.all`, values: [], position: "start" },
171
171
  ],
172
172
  },
173
173
  kind: { display: "select" },
174
174
  source: { display: "select" },
175
175
  },
176
- defaultFilters: { status: [CONTACT_STATUS.Open] },
176
+ defaultFilters: { status: [HELPDESK_STATUS.Open] },
177
177
  defaultSort: { field: "submittedAt", dir: "desc" },
178
178
  rowActions: [
179
179
  {
180
180
  kind: "navigate",
181
181
  id: "open",
182
- label: `${CONTACT_FEATURE}:action.open`,
182
+ label: `${HELPDESK_FEATURE}:action.open`,
183
183
  screen: "request-detail",
184
184
  entityId: "id",
185
185
  rowClick: true,
@@ -187,10 +187,10 @@ const requestListScreen: EntityListScreenDefinition = {
187
187
  {
188
188
  kind: "writeHandler",
189
189
  id: "mark-done",
190
- label: `${CONTACT_FEATURE}:action.mark-done`,
191
- handler: ContactHandlers.markDone,
190
+ label: `${HELPDESK_FEATURE}:action.mark-done`,
191
+ handler: HelpdeskHandlers.markDone,
192
192
  payload: { pick: ["id"] },
193
- visible: { field: "status", ne: CONTACT_STATUS.Done },
193
+ visible: { field: "status", ne: HELPDESK_STATUS.Done },
194
194
  },
195
195
  ],
196
196
  bulkActions: [{ id: "mark-done", rowAction: "mark-done" }],
@@ -198,11 +198,11 @@ const requestListScreen: EntityListScreenDefinition = {
198
198
  };
199
199
 
200
200
  const deliveryStatusTones = {
201
- [CONTACT_DELIVERY_STATUS.Pending]: "warn",
202
- [CONTACT_DELIVERY_STATUS.Delivered]: "ok",
203
- [CONTACT_DELIVERY_STATUS.Failed]: "bad",
204
- [CONTACT_DELIVERY_STATUS.Skipped]: "neutral",
205
- [CONTACT_DELIVERY_STATUS.Read]: "accent",
201
+ [HELPDESK_DELIVERY_STATUS.Pending]: "warn",
202
+ [HELPDESK_DELIVERY_STATUS.Delivered]: "ok",
203
+ [HELPDESK_DELIVERY_STATUS.Failed]: "bad",
204
+ [HELPDESK_DELIVERY_STATUS.Skipped]: "neutral",
205
+ [HELPDESK_DELIVERY_STATUS.Read]: "accent",
206
206
  } as const;
207
207
 
208
208
  function detailLinkTarget(
@@ -214,8 +214,8 @@ function detailLinkTarget(
214
214
  }
215
215
 
216
216
  function createRequestDetailScreen(
217
- opts: ContactOptions,
218
- settings: ContactSettings,
217
+ opts: HelpdeskOptions,
218
+ settings: HelpdeskSettings,
219
219
  ): ProjectionDetailScreenDefinition {
220
220
  const userScreen = detailLinkTarget(opts.detailLinks?.user, "user-edit");
221
221
  const tenantScreen = detailLinkTarget(opts.detailLinks?.tenant, "tenant-edit");
@@ -223,7 +223,7 @@ function createRequestDetailScreen(
223
223
  id: "request-detail",
224
224
  type: "projectionDetail",
225
225
  dormant: true,
226
- query: ContactQueries.requestDetail,
226
+ query: HelpdeskQueries.requestDetail,
227
227
  listScreenId: "request-list",
228
228
  header: {
229
229
  title: "subject",
@@ -252,50 +252,50 @@ function createRequestDetailScreen(
252
252
  status: "status",
253
253
  statusFormat: { format: "enumOption", keyPrefix: `${REQUEST_FIELD}:status:option:` },
254
254
  statusTones: {
255
- [CONTACT_STATUS.Open]: "warn",
256
- [CONTACT_STATUS.Answered]: "accent",
257
- [CONTACT_STATUS.Done]: "ok",
255
+ [HELPDESK_STATUS.Open]: "warn",
256
+ [HELPDESK_STATUS.Answered]: "accent",
257
+ [HELPDESK_STATUS.Done]: "ok",
258
258
  },
259
259
  },
260
260
  actions: [
261
261
  {
262
262
  kind: "writeHandler",
263
263
  id: "mark-done",
264
- label: `${CONTACT_FEATURE}:action.mark-done`,
265
- handler: ContactHandlers.markDone,
264
+ label: `${HELPDESK_FEATURE}:action.mark-done`,
265
+ handler: HelpdeskHandlers.markDone,
266
266
  icon: "check-circle",
267
267
  style: "secondary",
268
268
  payload: { pick: ["id"] },
269
- visible: { field: "status", ne: CONTACT_STATUS.Done },
269
+ visible: { field: "status", ne: HELPDESK_STATUS.Done },
270
270
  },
271
271
  {
272
272
  kind: "drawer",
273
273
  id: "reply",
274
274
  icon: "mail",
275
275
  style: "primary",
276
- label: `${CONTACT_FEATURE}:action.reply`,
276
+ label: `${HELPDESK_FEATURE}:action.reply`,
277
277
  screen: "reply",
278
278
  params: { map: { requestId: "id", name: "name", email: "email", replyTo: "replyTo" } },
279
279
  title: "screen:reply.title",
280
- visible: { field: "replyChannels", eq: CONTACT_REPLY_CHANNELS.EmailAndInApp },
280
+ visible: { field: "replyChannels", eq: HELPDESK_REPLY_CHANNELS.EmailAndInApp },
281
281
  },
282
282
  {
283
283
  kind: "drawer",
284
284
  id: "reply-mail",
285
285
  icon: "mail",
286
286
  style: "primary",
287
- label: `${CONTACT_FEATURE}:action.reply`,
287
+ label: `${HELPDESK_FEATURE}:action.reply`,
288
288
  screen: "reply-mail",
289
289
  params: { map: { requestId: "id", name: "name", email: "email", replyTo: "replyTo" } },
290
290
  title: "screen:reply-mail.title",
291
- visible: { field: "replyChannels", eq: CONTACT_REPLY_CHANNELS.Email },
291
+ visible: { field: "replyChannels", eq: HELPDESK_REPLY_CHANNELS.Email },
292
292
  },
293
293
  ],
294
294
  primaryAction: "reply",
295
295
  inlineActions: ["mark-done"],
296
296
  fieldLabels: {
297
297
  message: `${REQUEST_FIELD}:message`,
298
- fileIds: `${CONTACT_FEATURE}:detail.attachments`,
298
+ fileIds: `${HELPDESK_FEATURE}:detail.attachments`,
299
299
  name: `${REQUEST_FIELD}:name`,
300
300
  email: `${REQUEST_FIELD}:email`,
301
301
  phone: `${REQUEST_FIELD}:phone`,
@@ -307,37 +307,37 @@ function createRequestDetailScreen(
307
307
  },
308
308
  layout: {
309
309
  sections: [
310
- { title: `${CONTACT_FEATURE}:detail.section.message`, fields: ["message"] },
310
+ { title: `${HELPDESK_FEATURE}:detail.section.message`, fields: ["message"] },
311
311
  {
312
312
  kind: "relatedList",
313
313
  readOnly: true,
314
- title: `${CONTACT_FEATURE}:detail.section.replies`,
315
- query: ContactQueries.replies,
314
+ title: `${HELPDESK_FEATURE}:detail.section.replies`,
315
+ query: HelpdeskQueries.replies,
316
316
  columns: [
317
317
  {
318
318
  field: "sentAt",
319
319
  renderer: { format: "timestamp", dateStyle: "medium", timeStyle: "short" },
320
- label: `${CONTACT_FEATURE}:entity:contact-reply:field:sentAt`,
320
+ label: `${HELPDESK_FEATURE}:entity:helpdesk-reply:field:sentAt`,
321
321
  },
322
322
  {
323
323
  field: "authorName",
324
- label: `${CONTACT_FEATURE}:entity:contact-reply:field:authorName`,
324
+ label: `${HELPDESK_FEATURE}:entity:helpdesk-reply:field:authorName`,
325
325
  },
326
- { field: "message", label: `${CONTACT_FEATURE}:entity:contact-reply:field:message` },
326
+ { field: "message", label: `${HELPDESK_FEATURE}:entity:helpdesk-reply:field:message` },
327
327
  ],
328
328
  },
329
329
  {
330
- title: `${CONTACT_FEATURE}:detail.section.files`,
330
+ title: `${HELPDESK_FEATURE}:detail.section.files`,
331
331
  fields: [
332
332
  {
333
- field: CONTACT_UPLOAD_FIELD,
333
+ field: HELPDESK_UPLOAD_FIELD,
334
334
  renderer: { format: "file" },
335
335
  visible: { field: "fileCount", ne: 0 },
336
336
  },
337
337
  ],
338
338
  },
339
339
  {
340
- title: `${CONTACT_FEATURE}:detail.section.sender`,
340
+ title: `${HELPDESK_FEATURE}:detail.section.sender`,
341
341
  fields: [
342
342
  "name",
343
343
  { field: "email", format: "email" },
@@ -354,13 +354,13 @@ function createRequestDetailScreen(
354
354
  ],
355
355
  },
356
356
  {
357
- title: `${CONTACT_FEATURE}:detail.section.origin`,
357
+ title: `${HELPDESK_FEATURE}:detail.section.origin`,
358
358
  fields: [
359
359
  {
360
360
  field: "origin",
361
361
  renderer: { format: "enumOption", keyPrefix: `${REQUEST_FIELD}:origin:option:` },
362
362
  },
363
- { field: "page", visible: { field: "origin", eq: CONTACT_ORIGIN.Website } },
363
+ { field: "page", visible: { field: "origin", eq: HELPDESK_ORIGIN.Website } },
364
364
  "versionLabel",
365
365
  "browser",
366
366
  ],
@@ -368,13 +368,13 @@ function createRequestDetailScreen(
368
368
  {
369
369
  kind: "relatedList",
370
370
  readOnly: true,
371
- title: `${CONTACT_FEATURE}:detail.section.delivery`,
372
- query: ContactQueries.requestDelivery,
371
+ title: `${HELPDESK_FEATURE}:detail.section.delivery`,
372
+ query: HelpdeskQueries.requestDelivery,
373
373
  toolbarActions: [
374
374
  {
375
375
  kind: "navigate",
376
376
  id: "delivery-log",
377
- label: `${CONTACT_FEATURE}:detail.delivery-log`,
377
+ label: `${HELPDESK_FEATURE}:detail.delivery-log`,
378
378
  screen: DELIVERY_LOG_SCREEN_ID,
379
379
  },
380
380
  ],
@@ -403,9 +403,9 @@ function createRequestDetailScreen(
403
403
  },
404
404
  {
405
405
  kind: "extension",
406
- title: `${CONTACT_FEATURE}:detail.section.notes`,
406
+ title: `${HELPDESK_FEATURE}:detail.section.notes`,
407
407
  component: { react: { __component: "NotesSection" } },
408
- entityName: "contact-request",
408
+ entityName: "helpdesk-request",
409
409
  },
410
410
  ],
411
411
  },
@@ -420,8 +420,8 @@ function createForwardingScreen(telegram: boolean): ConfigEditScreenDefinition {
420
420
  dormant: true,
421
421
  scope: "system",
422
422
  configKeys: {
423
- replyTo: ContactConfigKeys.replyTo,
424
- ...(telegram && { telegramChat: ContactConfigKeys.telegramChat }),
423
+ replyTo: HelpdeskConfigKeys.replyTo,
424
+ ...(telegram && { telegramChat: HelpdeskConfigKeys.telegramChat }),
425
425
  },
426
426
  ...(telegram && { secretKeys: { botToken: TELEGRAM_BOT_TOKEN_SECRET } }),
427
427
  fields: {
@@ -449,15 +449,15 @@ function createForwardingScreen(telegram: boolean): ConfigEditScreenDefinition {
449
449
  variant: "settings-list",
450
450
  sections: [
451
451
  {
452
- title: `${CONTACT_FEATURE}:forwarding.email`,
453
- description: `${CONTACT_FEATURE}:forwarding.email.description`,
452
+ title: `${HELPDESK_FEATURE}:forwarding.email`,
453
+ description: `${HELPDESK_FEATURE}:forwarding.email.description`,
454
454
  fields: ["replyTo"],
455
455
  },
456
456
  ...(telegram
457
457
  ? [
458
458
  {
459
- title: `${CONTACT_FEATURE}:forwarding.telegram`,
460
- description: `${CONTACT_FEATURE}:forwarding.telegram.description`,
459
+ title: `${HELPDESK_FEATURE}:forwarding.telegram`,
460
+ description: `${HELPDESK_FEATURE}:forwarding.telegram.description`,
461
461
  fields: ["telegramChat", "botToken"],
462
462
  },
463
463
  ]
@@ -465,26 +465,26 @@ function createForwardingScreen(telegram: boolean): ConfigEditScreenDefinition {
465
465
  ],
466
466
  },
467
467
  fieldLabels: {
468
- replyTo: `${CONTACT_FEATURE}:config.reply-to.label`,
469
- telegramChat: `${CONTACT_FEATURE}:config.telegram-chat.label`,
470
- botToken: `${CONTACT_FEATURE}:config.bot-token.label`,
468
+ replyTo: `${HELPDESK_FEATURE}:config.reply-to.label`,
469
+ telegramChat: `${HELPDESK_FEATURE}:config.telegram-chat.label`,
470
+ botToken: `${HELPDESK_FEATURE}:config.bot-token.label`,
471
471
  },
472
472
  fieldDescriptions: {
473
- replyTo: `${CONTACT_FEATURE}:config.reply-to.description`,
474
- telegramChat: `${CONTACT_FEATURE}:config.telegram-chat.description`,
475
- botToken: `${CONTACT_FEATURE}:config.bot-token.description`,
473
+ replyTo: `${HELPDESK_FEATURE}:config.reply-to.description`,
474
+ telegramChat: `${HELPDESK_FEATURE}:config.telegram-chat.description`,
475
+ botToken: `${HELPDESK_FEATURE}:config.bot-token.description`,
476
476
  },
477
- submitLabel: `${CONTACT_FEATURE}:forwarding.submit`,
477
+ submitLabel: `${HELPDESK_FEATURE}:forwarding.submit`,
478
478
  ...(telegram && {
479
479
  actions: [
480
480
  {
481
481
  id: "send-test",
482
- handler: ContactHandlers.sendTest,
483
- label: `${CONTACT_FEATURE}:config.send-test.label`,
484
- description: `${CONTACT_FEATURE}:config.send-test.description`,
485
- buttonLabel: `${CONTACT_FEATURE}:config.send-test.button`,
482
+ handler: HelpdeskHandlers.sendTest,
483
+ label: `${HELPDESK_FEATURE}:config.send-test.label`,
484
+ description: `${HELPDESK_FEATURE}:config.send-test.description`,
485
+ buttonLabel: `${HELPDESK_FEATURE}:config.send-test.button`,
486
486
  afterField: "botToken",
487
- successMessage: `${CONTACT_FEATURE}:config.send-test.success`,
487
+ successMessage: `${HELPDESK_FEATURE}:config.send-test.success`,
488
488
  },
489
489
  ],
490
490
  }),
@@ -492,16 +492,16 @@ function createForwardingScreen(telegram: boolean): ConfigEditScreenDefinition {
492
492
  };
493
493
  }
494
494
 
495
- export function createContactScreens(
496
- opts: ContactOptions,
497
- settings: ContactSettings,
495
+ export function createHelpdeskScreens(
496
+ opts: HelpdeskOptions,
497
+ settings: HelpdeskSettings,
498
498
  ): readonly ScreenDefinition[] {
499
499
  return [
500
500
  createReportScreen(opts, settings),
501
501
  requestListScreen,
502
502
  createRequestDetailScreen(opts, settings),
503
- createReplyScreen("reply", `${CONTACT_FEATURE}:reply.summary.in-app`),
504
- createReplyScreen("reply-mail", `${CONTACT_FEATURE}:reply.summary.mail`),
503
+ createReplyScreen("reply", `${HELPDESK_FEATURE}:reply.summary.in-app`),
504
+ createReplyScreen("reply-mail", `${HELPDESK_FEATURE}:reply.summary.mail`),
505
505
  createForwardingScreen(opts.telegram === true),
506
506
  ];
507
507
  }
@@ -1,13 +1,13 @@
1
- import { CONTACT_SUBJECT_MAX_CHARS } from "./web/constants.ts";
1
+ import { HELPDESK_SUBJECT_MAX_CHARS } from "./web/constants.ts";
2
2
 
3
3
  // The website form has no subject field; the first non-empty line of the message stands in for it.
4
4
  export function deriveSubjectFromMessage(message: string): string {
5
5
  const firstLine = message.split(/[\r\n]/).find((line) => line.trim() !== "") ?? "";
6
6
  const trimmed = firstLine.trim();
7
7
  const chars = [...trimmed];
8
- if (chars.length <= CONTACT_SUBJECT_MAX_CHARS) return trimmed;
8
+ if (chars.length <= HELPDESK_SUBJECT_MAX_CHARS) return trimmed;
9
9
  return `${chars
10
- .slice(0, CONTACT_SUBJECT_MAX_CHARS - 1)
10
+ .slice(0, HELPDESK_SUBJECT_MAX_CHARS - 1)
11
11
  .join("")
12
12
  .trimEnd()}…`;
13
13
  }