@cosmicdrift/kumiko-bundled-features 0.412.0 → 0.413.1

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 (168) hide show
  1. package/dist/admin-shell/feature.d.ts +1 -1
  2. package/dist/agent-tools/api-docs/anchors.js +1 -1
  3. package/dist/auth-email-password/boot-rules.d.ts +7 -0
  4. package/dist/auth-email-password/boot-rules.js +7 -0
  5. package/dist/auth-email-password/feature.js +6 -13
  6. package/dist/auth-email-password/validate-options.d.ts +5 -0
  7. package/dist/auth-email-password/validate-options.js +15 -0
  8. package/dist/billing-foundation/boot-rules.d.ts +22 -0
  9. package/dist/billing-foundation/boot-rules.js +22 -0
  10. package/dist/billing-foundation/validate-options.js +56 -18
  11. package/dist/cap-overview/boot-rules.d.ts +12 -0
  12. package/dist/cap-overview/boot-rules.js +12 -0
  13. package/dist/cap-overview/feature.js +8 -3
  14. package/dist/data-retention/feature.js +3 -2
  15. package/dist/documents/boot-rules.d.ts +12 -0
  16. package/dist/documents/boot-rules.js +12 -0
  17. package/dist/documents/feature.js +8 -3
  18. package/dist/file-derivatives/boot-rules.d.ts +7 -0
  19. package/dist/file-derivatives/boot-rules.js +7 -0
  20. package/dist/file-derivatives/feature.js +5 -2
  21. package/dist/folders/boot-rules.d.ts +7 -0
  22. package/dist/folders/boot-rules.js +7 -0
  23. package/dist/folders/feature.js +8 -5
  24. package/dist/helpdesk/boot-rules.d.ts +7 -0
  25. package/dist/helpdesk/boot-rules.js +7 -0
  26. package/dist/{contact → helpdesk}/challenge.js +2 -2
  27. package/dist/helpdesk/client/helpdesk-client-source.d.ts +1 -0
  28. package/dist/{contact/client/contact-client-source.js → helpdesk/client/helpdesk-client-source.js} +4 -4
  29. package/dist/helpdesk/client/helpdesk-website-client.d.ts +26 -0
  30. package/dist/helpdesk/client/index.d.ts +2 -0
  31. package/dist/helpdesk/client/index.js +1 -0
  32. package/dist/{contact → helpdesk}/entity.d.ts +6 -6
  33. package/dist/{contact → helpdesk}/entity.js +31 -27
  34. package/dist/helpdesk/feature.d.ts +3 -0
  35. package/dist/{contact → helpdesk}/feature.js +43 -39
  36. package/dist/{contact → helpdesk}/handlers/attempts.d.ts +2 -2
  37. package/dist/helpdesk/handlers/challenge.query.d.ts +9 -0
  38. package/dist/{contact → helpdesk}/handlers/challenge.query.js +5 -5
  39. package/dist/helpdesk/handlers/forward-request.write.d.ts +9 -0
  40. package/dist/{contact → helpdesk}/handlers/forward-request.write.js +17 -15
  41. package/dist/{contact → helpdesk}/handlers/mark-done.write.d.ts +2 -2
  42. package/dist/{contact → helpdesk}/handlers/mark-done.write.js +8 -8
  43. package/dist/{contact → helpdesk}/handlers/notify-reporter-in-app.write.d.ts +2 -2
  44. package/dist/{contact → helpdesk}/handlers/notify-reporter-in-app.write.js +11 -11
  45. package/dist/{contact → helpdesk}/handlers/open-count.js +2 -2
  46. package/dist/{contact → helpdesk}/handlers/open-count.query.js +4 -4
  47. package/dist/{contact → helpdesk}/handlers/replies.query.js +6 -6
  48. package/dist/{contact → helpdesk}/handlers/reply.write.d.ts +4 -4
  49. package/dist/{contact → helpdesk}/handlers/reply.write.js +16 -16
  50. package/dist/helpdesk/handlers/report.write.d.ts +16 -0
  51. package/dist/{contact → helpdesk}/handlers/report.write.js +17 -17
  52. package/dist/helpdesk/handlers/request-delivery.query.d.ts +16 -0
  53. package/dist/{contact → helpdesk}/handlers/request-delivery.query.js +24 -24
  54. package/dist/{contact → helpdesk}/handlers/request-detail.query.d.ts +3 -3
  55. package/dist/{contact → helpdesk}/handlers/request-detail.query.js +10 -10
  56. package/dist/{contact → helpdesk}/handlers/request-list.query.js +2 -2
  57. package/dist/helpdesk/handlers/send-reply-mail.write.d.ts +8 -0
  58. package/dist/{contact → helpdesk}/handlers/send-reply-mail.write.js +15 -15
  59. package/dist/helpdesk/handlers/send-test.write.d.ts +5 -0
  60. package/dist/{contact → helpdesk}/handlers/send-test.write.js +10 -10
  61. package/dist/{contact → helpdesk}/handlers/submit.write.d.ts +4 -4
  62. package/dist/{contact → helpdesk}/handlers/submit.write.js +17 -17
  63. package/dist/{contact → helpdesk}/handlers/take-over-uploads.js +5 -5
  64. package/dist/{contact → helpdesk}/i18n.d.ts +1 -1
  65. package/dist/{contact → helpdesk}/i18n.js +78 -75
  66. package/dist/helpdesk/index.d.ts +5 -0
  67. package/dist/helpdesk/index.js +4 -0
  68. package/dist/{contact → helpdesk}/lib.d.ts +5 -5
  69. package/dist/{contact → helpdesk}/lib.js +16 -16
  70. package/dist/{contact → helpdesk}/mail.d.ts +20 -20
  71. package/dist/{contact → helpdesk}/mail.js +47 -47
  72. package/dist/{contact → helpdesk}/options.d.ts +6 -6
  73. package/dist/helpdesk/options.js +36 -0
  74. package/dist/helpdesk/panels.d.ts +2 -0
  75. package/dist/helpdesk/panels.js +21 -0
  76. package/dist/{contact → helpdesk}/payloads.d.ts +11 -11
  77. package/dist/{contact → helpdesk}/payloads.js +28 -28
  78. package/dist/helpdesk/screens.d.ts +5 -0
  79. package/dist/{contact → helpdesk}/screens.js +87 -87
  80. package/dist/{contact → helpdesk}/subject.js +3 -3
  81. package/dist/helpdesk/user-data-hooks.d.ts +3 -0
  82. package/dist/{contact → helpdesk}/user-data-hooks.js +15 -15
  83. package/dist/helpdesk/web/constants.d.ts +127 -0
  84. package/dist/helpdesk/web/constants.js +126 -0
  85. package/dist/helpdesk/web/index.d.ts +1 -0
  86. package/dist/helpdesk/web/index.js +1 -0
  87. package/dist/host-routing/boot-rules.d.ts +22 -0
  88. package/dist/host-routing/boot-rules.js +22 -0
  89. package/dist/host-routing/validate-options.js +35 -11
  90. package/dist/jobs/boot-rules.d.ts +7 -0
  91. package/dist/jobs/boot-rules.js +7 -0
  92. package/dist/jobs/feature.js +5 -2
  93. package/dist/legal-pages/boot-rules.d.ts +17 -0
  94. package/dist/legal-pages/boot-rules.js +17 -0
  95. package/dist/legal-pages/feature.js +5 -2
  96. package/dist/legal-pages/lib/validate-routes.js +11 -3
  97. package/dist/metrics/boot-rules.d.ts +12 -0
  98. package/dist/metrics/boot-rules.js +12 -0
  99. package/dist/metrics/validate.js +8 -2
  100. package/dist/notes-history/boot-rules.d.ts +7 -0
  101. package/dist/notes-history/boot-rules.js +7 -0
  102. package/dist/notes-history/feature.js +7 -4
  103. package/dist/personal-access-tokens/boot-rules.d.ts +7 -0
  104. package/dist/personal-access-tokens/boot-rules.js +7 -0
  105. package/dist/personal-access-tokens/scope-events-check.js +7 -4
  106. package/dist/presence/boot-rules.d.ts +7 -0
  107. package/dist/presence/boot-rules.js +7 -0
  108. package/dist/presence/options.js +5 -1
  109. package/dist/readiness/boot-rules.d.ts +12 -0
  110. package/dist/readiness/boot-rules.js +12 -0
  111. package/dist/readiness/probe-boot-check.js +8 -3
  112. package/dist/shared/assert-no-where-rule-in-ownership-write.d.ts +1 -1
  113. package/dist/shared/assert-no-where-rule-in-ownership-write.js +11 -7
  114. package/dist/shared/boot-rules.d.ts +7 -0
  115. package/dist/shared/boot-rules.js +7 -0
  116. package/dist/subscription-mollie/boot-rules.d.ts +17 -0
  117. package/dist/subscription-mollie/boot-rules.js +17 -0
  118. package/dist/subscription-mollie/feature.js +13 -6
  119. package/dist/tags/boot-rules.d.ts +7 -0
  120. package/dist/tags/boot-rules.js +7 -0
  121. package/dist/tags/feature.js +8 -5
  122. package/dist/template-resolver/boot-rules.d.ts +17 -0
  123. package/dist/template-resolver/boot-rules.js +17 -0
  124. package/dist/template-resolver/feature.js +14 -5
  125. package/dist/tenant/boot-rules.d.ts +7 -0
  126. package/dist/tenant/boot-rules.js +7 -0
  127. package/dist/tenant/feature.js +5 -2
  128. package/kumiko-es-tables.json +4 -4
  129. package/package.json +29 -29
  130. package/src/data-retention/changes.json +6 -0
  131. package/src/{contact → helpdesk}/changes.json +18 -0
  132. package/dist/contact/client/contact-client-source.d.ts +0 -1
  133. package/dist/contact/client/contact-website-client.d.ts +0 -26
  134. package/dist/contact/client/index.d.ts +0 -2
  135. package/dist/contact/client/index.js +0 -1
  136. package/dist/contact/feature.d.ts +0 -3
  137. package/dist/contact/handlers/challenge.query.d.ts +0 -9
  138. package/dist/contact/handlers/forward-request.write.d.ts +0 -9
  139. package/dist/contact/handlers/report.write.d.ts +0 -16
  140. package/dist/contact/handlers/request-delivery.query.d.ts +0 -16
  141. package/dist/contact/handlers/send-reply-mail.write.d.ts +0 -8
  142. package/dist/contact/handlers/send-test.write.d.ts +0 -5
  143. package/dist/contact/index.d.ts +0 -5
  144. package/dist/contact/index.js +0 -4
  145. package/dist/contact/options.js +0 -32
  146. package/dist/contact/panels.d.ts +0 -2
  147. package/dist/contact/panels.js +0 -21
  148. package/dist/contact/screens.d.ts +0 -5
  149. package/dist/contact/user-data-hooks.d.ts +0 -3
  150. package/dist/contact/web/constants.d.ts +0 -127
  151. package/dist/contact/web/constants.js +0 -126
  152. package/dist/contact/web/index.d.ts +0 -1
  153. package/dist/contact/web/index.js +0 -1
  154. /package/dist/{contact → helpdesk}/challenge.d.ts +0 -0
  155. /package/dist/{contact/client/contact-website-client.js → helpdesk/client/helpdesk-website-client.js} +0 -0
  156. /package/dist/{contact → helpdesk}/handlers/access.d.ts +0 -0
  157. /package/dist/{contact → helpdesk}/handlers/access.js +0 -0
  158. /package/dist/{contact → helpdesk}/handlers/attempts.js +0 -0
  159. /package/dist/{contact → helpdesk}/handlers/open-count.d.ts +0 -0
  160. /package/dist/{contact → helpdesk}/handlers/open-count.query.d.ts +0 -0
  161. /package/dist/{contact → helpdesk}/handlers/replies.query.d.ts +0 -0
  162. /package/dist/{contact → helpdesk}/handlers/request-list.query.d.ts +0 -0
  163. /package/dist/{contact → helpdesk}/handlers/take-over-uploads.d.ts +0 -0
  164. /package/dist/{contact → helpdesk}/pow.d.ts +0 -0
  165. /package/dist/{contact → helpdesk}/pow.js +0 -0
  166. /package/dist/{contact → helpdesk}/subject.d.ts +0 -0
  167. /package/dist/{contact → helpdesk}/user-agent.d.ts +0 -0
  168. /package/dist/{contact → helpdesk}/user-agent.js +0 -0
@@ -1,11 +1,11 @@
1
1
  import { templateVariable, } from "@cosmicdrift/kumiko-framework/engine";
2
2
  import { mailHeading, mailParagraph, mailParagraphWithLink, mailRepeatedRows, } from "../shared/index.js";
3
- import { CONTACT_KIND } from "./web/constants.js";
3
+ import { HELPDESK_KIND } from "./web/constants.js";
4
4
  const QUOTE_MAX_CHARS = 280;
5
5
  function languageOf(locale) {
6
6
  return (locale ?? "").split("-")[0]?.toLowerCase() ?? "";
7
7
  }
8
- export function resolveContactMailLocale(locale) {
8
+ export function resolveHelpdeskMailLocale(locale) {
9
9
  return languageOf(locale) === "de" ? "de" : "en";
10
10
  }
11
11
  export function truncateText(text, maxChars) {
@@ -19,24 +19,24 @@ export function truncateText(text, maxChars) {
19
19
  }
20
20
  const KIND_LABELS = {
21
21
  en: {
22
- [CONTACT_KIND.Question]: "Question",
23
- [CONTACT_KIND.Contact]: "Contact request",
24
- [CONTACT_KIND.Bug]: "Problem",
25
- [CONTACT_KIND.Wish]: "Wish",
22
+ [HELPDESK_KIND.Question]: "Question",
23
+ [HELPDESK_KIND.Contact]: "Contact request",
24
+ [HELPDESK_KIND.Bug]: "Problem",
25
+ [HELPDESK_KIND.Wish]: "Wish",
26
26
  },
27
27
  de: {
28
- [CONTACT_KIND.Question]: "Frage",
29
- [CONTACT_KIND.Contact]: "Kontaktwunsch",
30
- [CONTACT_KIND.Bug]: "Problem",
31
- [CONTACT_KIND.Wish]: "Wunsch",
28
+ [HELPDESK_KIND.Question]: "Frage",
29
+ [HELPDESK_KIND.Contact]: "Kontaktwunsch",
30
+ [HELPDESK_KIND.Bug]: "Problem",
31
+ [HELPDESK_KIND.Wish]: "Wunsch",
32
32
  },
33
33
  };
34
- export function contactKindLabel(kind, locale) {
35
- const labels = KIND_LABELS[resolveContactMailLocale(locale)];
34
+ export function helpdeskKindLabel(kind, locale) {
35
+ const labels = KIND_LABELS[resolveHelpdeskMailLocale(locale)];
36
36
  return labels[kind] ?? kind;
37
37
  }
38
- export function formatContactDate(atEpochMs, locale) {
39
- return new Intl.DateTimeFormat(resolveContactMailLocale(locale), {
38
+ export function formatHelpdeskDate(atEpochMs, locale) {
39
+ return new Intl.DateTimeFormat(resolveHelpdeskMailLocale(locale), {
40
40
  dateStyle: "long",
41
41
  timeZone: "UTC",
42
42
  }).format(atEpochMs);
@@ -54,10 +54,10 @@ const NEW_REQUEST_STRINGS = {
54
54
  linkIntro: "Open it in the admin:",
55
55
  linkLabel: "Show request",
56
56
  title: {
57
- [CONTACT_KIND.Question]: (app) => `New question on ${app}`,
58
- [CONTACT_KIND.Contact]: (app) => `New contact request on ${app}`,
59
- [CONTACT_KIND.Bug]: (app) => `New problem report on ${app}`,
60
- [CONTACT_KIND.Wish]: (app) => `New wish on ${app}`,
57
+ [HELPDESK_KIND.Question]: (app) => `New question on ${app}`,
58
+ [HELPDESK_KIND.Contact]: (app) => `New contact request on ${app}`,
59
+ [HELPDESK_KIND.Bug]: (app) => `New problem report on ${app}`,
60
+ [HELPDESK_KIND.Wish]: (app) => `New wish on ${app}`,
61
61
  },
62
62
  },
63
63
  de: {
@@ -65,21 +65,21 @@ const NEW_REQUEST_STRINGS = {
65
65
  linkIntro: "Im Admin öffnen:",
66
66
  linkLabel: "Meldung anzeigen",
67
67
  title: {
68
- [CONTACT_KIND.Question]: (app) => `Neue Frage auf ${app}`,
69
- [CONTACT_KIND.Contact]: (app) => `Neuer Kontaktwunsch auf ${app}`,
70
- [CONTACT_KIND.Bug]: (app) => `Neue Problemmeldung auf ${app}`,
71
- [CONTACT_KIND.Wish]: (app) => `Neuer Wunsch auf ${app}`,
68
+ [HELPDESK_KIND.Question]: (app) => `Neue Frage auf ${app}`,
69
+ [HELPDESK_KIND.Contact]: (app) => `Neuer Kontaktwunsch auf ${app}`,
70
+ [HELPDESK_KIND.Bug]: (app) => `Neue Problemmeldung auf ${app}`,
71
+ [HELPDESK_KIND.Wish]: (app) => `Neuer Wunsch auf ${app}`,
72
72
  },
73
73
  },
74
74
  };
75
- export const CONTACT_NEW_REQUEST_VARIABLES = {
75
+ export const HELPDESK_NEW_REQUEST_VARIABLES = {
76
76
  subject: templateVariable.text({ required: true }),
77
77
  intro: templateVariable.text({ required: true }),
78
78
  requestUrl: templateVariable.link(),
79
79
  };
80
- export function contactNewRequestVariables(args) {
81
- const titles = NEW_REQUEST_STRINGS[resolveContactMailLocale(args.locale)].title;
82
- const title = (titles[args.kind] ?? titles[CONTACT_KIND.Question])?.(args.appName) ?? args.appName;
80
+ export function helpdeskNewRequestVariables(args) {
81
+ const titles = NEW_REQUEST_STRINGS[resolveHelpdeskMailLocale(args.locale)].title;
82
+ const title = (titles[args.kind] ?? titles[HELPDESK_KIND.Question])?.(args.appName) ?? args.appName;
83
83
  return {
84
84
  subject: title,
85
85
  intro: title,
@@ -90,7 +90,7 @@ export function contactNewRequestVariables(args) {
90
90
  telegramBody: args.link ?? args.appName,
91
91
  };
92
92
  }
93
- export function contactNewRequestTemplate() {
93
+ export function helpdeskNewRequestTemplate() {
94
94
  return Object.fromEntries(Object.entries(NEW_REQUEST_STRINGS).map(([locale, t]) => [
95
95
  locale,
96
96
  {
@@ -129,14 +129,14 @@ const ACKNOWLEDGEMENT_STRINGS = {
129
129
  intro: (appName) => `Deine Nachricht ist beim ${appName}-Team angekommen, wir melden uns persönlich bei dir.`,
130
130
  },
131
131
  };
132
- export const CONTACT_CONFIRMATION_VARIABLES = {
132
+ export const HELPDESK_CONFIRMATION_VARIABLES = {
133
133
  appName: templateVariable.text({ required: true }),
134
134
  intro: templateVariable.text({ required: true }),
135
135
  quoteIntro: templateVariable.text({ required: true }),
136
136
  paragraphs: templateVariable.list({ text: templateVariable.text({ required: true }) }, { required: true }),
137
137
  };
138
- export function contactConfirmationVariables(args) {
139
- const t = CONFIRMATION_STRINGS[resolveContactMailLocale(args.locale)];
138
+ export function helpdeskConfirmationVariables(args) {
139
+ const t = CONFIRMATION_STRINGS[resolveHelpdeskMailLocale(args.locale)];
140
140
  return {
141
141
  appName: args.appName,
142
142
  intro: t.intro(args.appName),
@@ -146,15 +146,15 @@ export function contactConfirmationVariables(args) {
146
146
  }
147
147
  // Website senders are unverified addresses: the mail must not echo anything they typed, or the
148
148
  // form becomes a mail relay. Only the signed-in admin report gets the copy above.
149
- export const CONTACT_ACKNOWLEDGEMENT_VARIABLES = {
149
+ export const HELPDESK_ACKNOWLEDGEMENT_VARIABLES = {
150
150
  appName: templateVariable.text({ required: true }),
151
151
  intro: templateVariable.text({ required: true }),
152
152
  };
153
- export function contactAcknowledgementVariables(args) {
154
- const t = ACKNOWLEDGEMENT_STRINGS[resolveContactMailLocale(args.locale)];
153
+ export function helpdeskAcknowledgementVariables(args) {
154
+ const t = ACKNOWLEDGEMENT_STRINGS[resolveHelpdeskMailLocale(args.locale)];
155
155
  return { appName: args.appName, intro: t.intro(args.appName) };
156
156
  }
157
- export function contactAcknowledgementTemplate() {
157
+ export function helpdeskAcknowledgementTemplate() {
158
158
  return Object.fromEntries(Object.entries(ACKNOWLEDGEMENT_STRINGS).map(([locale, t]) => [
159
159
  locale,
160
160
  {
@@ -163,7 +163,7 @@ export function contactAcknowledgementTemplate() {
163
163
  },
164
164
  ]));
165
165
  }
166
- export function contactConfirmationTemplate() {
166
+ export function helpdeskConfirmationTemplate() {
167
167
  return Object.fromEntries(Object.entries(CONFIRMATION_STRINGS).map(([locale, t]) => [
168
168
  locale,
169
169
  {
@@ -187,7 +187,7 @@ const REPLY_STRINGS = {
187
187
  quoteIntro: (date) => `Deine Meldung vom ${date}:`,
188
188
  },
189
189
  };
190
- export const CONTACT_REPLY_VARIABLES = {
190
+ export const HELPDESK_REPLY_VARIABLES = {
191
191
  subject: templateVariable.text({ required: true }),
192
192
  paragraphs: templateVariable.list({ text: templateVariable.text({ required: true }) }, { required: true }),
193
193
  signedBy: templateVariable.text({ required: true }),
@@ -195,18 +195,18 @@ export const CONTACT_REPLY_VARIABLES = {
195
195
  quote: templateVariable.text({ required: true }),
196
196
  footer: templateVariable.text({ required: true }),
197
197
  };
198
- export function contactReplyVariables(args) {
199
- const t = REPLY_STRINGS[resolveContactMailLocale(args.locale)];
198
+ export function helpdeskReplyVariables(args) {
199
+ const t = REPLY_STRINGS[resolveHelpdeskMailLocale(args.locale)];
200
200
  return {
201
201
  subject: `Re: ${args.requestSubject}`,
202
202
  paragraphs: toParagraphRows(args.replyMessage),
203
203
  signedBy: `${args.authorName}, ${args.appName}`,
204
- quoteIntro: t.quoteIntro(formatContactDate(args.requestSubmittedAt, args.locale)),
204
+ quoteIntro: t.quoteIntro(formatHelpdeskDate(args.requestSubmittedAt, args.locale)),
205
205
  quote: truncateText(args.requestMessage.replace(/\s+/g, " "), QUOTE_MAX_CHARS),
206
206
  footer: t.footer,
207
207
  };
208
208
  }
209
- export function contactReplyTemplate() {
209
+ export function helpdeskReplyTemplate() {
210
210
  return Object.fromEntries(Object.keys(REPLY_STRINGS).map((locale) => [
211
211
  locale,
212
212
  {
@@ -225,7 +225,7 @@ const TEST_STRINGS = {
225
225
  en: {
226
226
  subject: "Test message from {{appName}}",
227
227
  header: "Test message",
228
- intro: "This is a test message of the contact forwarding.",
228
+ intro: "This is a test message of the helpdesk forwarding.",
229
229
  },
230
230
  de: {
231
231
  subject: "Testnachricht von {{appName}}",
@@ -233,18 +233,18 @@ const TEST_STRINGS = {
233
233
  intro: "Das ist eine Testnachricht der Weiterleitung von Meldungen.",
234
234
  },
235
235
  };
236
- export const CONTACT_TEST_VARIABLES = {
236
+ export const HELPDESK_TEST_VARIABLES = {
237
237
  appName: templateVariable.text({ required: true }),
238
238
  };
239
- export function contactTestVariables(args) {
240
- const t = TEST_STRINGS[resolveContactMailLocale(args.locale)];
239
+ export function helpdeskTestVariables(args) {
240
+ const t = TEST_STRINGS[resolveHelpdeskMailLocale(args.locale)];
241
241
  return {
242
242
  appName: args.appName,
243
243
  telegramTitle: t.subject.replace("{{appName}}", args.appName),
244
244
  telegramBody: t.intro,
245
245
  };
246
246
  }
247
- export function contactTestTemplate() {
247
+ export function helpdeskTestTemplate() {
248
248
  return Object.fromEntries(Object.entries(TEST_STRINGS).map(([locale, t]) => [
249
249
  locale,
250
250
  {
@@ -263,8 +263,8 @@ const REPLY_IN_APP_STRINGS = {
263
263
  body: `${authorName} hat geantwortet. Die Antwort liegt in deinem Postfach.`,
264
264
  }),
265
265
  };
266
- export function contactReplyInAppData(args) {
267
- const copy = REPLY_IN_APP_STRINGS[resolveContactMailLocale(args.locale)](args.authorName);
266
+ export function helpdeskReplyInAppData(args) {
267
+ const copy = REPLY_IN_APP_STRINGS[resolveHelpdeskMailLocale(args.locale)](args.authorName);
268
268
  return { inAppTitle: copy.title, inAppBody: copy.body };
269
269
  }
270
270
  function stringField(data, key) {
@@ -1,11 +1,11 @@
1
1
  import type { PayloadRateLimitOption, RateLimitDeclaration, RateLimitOption } from "@cosmicdrift/kumiko-types/handlers";
2
- import { type ContactPhoneMode } from "./web/constants.ts";
3
- export type ContactOptions = {
2
+ import { type HelpdeskPhoneMode } from "./web/constants.ts";
3
+ export type HelpdeskOptions = {
4
4
  /** Name shown in the notification mails ("Testnachricht von <appName>") and in the hint of the report form. */
5
5
  readonly appName: string;
6
6
  /** Default { phone: "off" }. Controls both the public form (challenge query reports it) and the admin report form. */
7
7
  readonly fields?: {
8
- readonly phone?: ContactPhoneMode;
8
+ readonly phone?: HelpdeskPhoneMode;
9
9
  };
10
10
  /** Shown as "Version" in the request origin; omitted when unset. */
11
11
  readonly appVersion?: string;
@@ -42,10 +42,10 @@ export declare const REPORT_RATE_LIMIT: RateLimitOption;
42
42
  export declare const CHALLENGE_RATE_LIMIT: RateLimitOption;
43
43
  export declare const DEFAULT_SUBMIT_EMAIL_RATE_LIMITS: readonly PayloadRateLimitOption[];
44
44
  export declare const DEFAULT_RETENTION_KEEP_FOR = "365d";
45
- export type ContactSettings = {
46
- readonly phone: ContactPhoneMode;
45
+ export type HelpdeskSettings = {
46
+ readonly phone: HelpdeskPhoneMode;
47
47
  readonly proofOfWorkBits: number;
48
48
  readonly minSubmitMs: number;
49
49
  readonly challengeTtlSeconds: number;
50
50
  };
51
- export declare function resolveContactSettings(opts: ContactOptions): ContactSettings;
51
+ export declare function resolveHelpdeskSettings(opts: HelpdeskOptions): HelpdeskSettings;
@@ -0,0 +1,36 @@
1
+ import { bootRuleError } from "@cosmicdrift/kumiko-framework/engine";
2
+ import { HELPDESK_BOOT_RULES } from "./boot-rules.js";
3
+ import { HELPDESK_DEFAULT_CHALLENGE_TTL_MINUTES, HELPDESK_DEFAULT_MIN_SUBMIT_SECONDS, HELPDESK_POW_BITS, } from "./web/constants.js";
4
+ export const DEFAULT_SUBMIT_RATE_LIMIT = {
5
+ per: "ip+handler",
6
+ limit: 5,
7
+ windowSeconds: 10 * 60,
8
+ };
9
+ export const REPORT_RATE_LIMIT = {
10
+ per: "user+handler",
11
+ limit: 10,
12
+ windowSeconds: 60 * 60,
13
+ };
14
+ export const CHALLENGE_RATE_LIMIT = {
15
+ per: "ip+handler",
16
+ limit: 30,
17
+ windowSeconds: 10 * 60,
18
+ };
19
+ export const DEFAULT_SUBMIT_EMAIL_RATE_LIMITS = [
20
+ { per: { payloadField: "email" }, limit: 3, windowSeconds: 24 * 60 * 60, normalize: "email" },
21
+ ];
22
+ export const DEFAULT_RETENTION_KEEP_FOR = "365d";
23
+ export function resolveHelpdeskSettings(opts) {
24
+ const bits = opts.spamProtection?.proofOfWorkBits ?? HELPDESK_POW_BITS.default;
25
+ if (!Number.isInteger(bits) || bits < HELPDESK_POW_BITS.min || bits > HELPDESK_POW_BITS.max) {
26
+ throw bootRuleError(HELPDESK_BOOT_RULES.invalidProofOfWorkBits, {
27
+ message: `helpdesk: spamProtection.proofOfWorkBits must be an integer between ${HELPDESK_POW_BITS.min} and ${HELPDESK_POW_BITS.max}, got ${bits}`,
28
+ });
29
+ }
30
+ return {
31
+ phone: opts.fields?.phone ?? "off",
32
+ proofOfWorkBits: bits,
33
+ minSubmitMs: (opts.spamProtection?.minSubmitSeconds ?? HELPDESK_DEFAULT_MIN_SUBMIT_SECONDS) * 1000,
34
+ challengeTtlSeconds: (opts.spamProtection?.challengeTtlMinutes ?? HELPDESK_DEFAULT_CHALLENGE_TTL_MINUTES) * 60,
35
+ };
36
+ }
@@ -0,0 +1,2 @@
1
+ import type { DashboardStatPanel } from "@cosmicdrift/kumiko-framework/ui-types";
2
+ export declare function helpdeskOpenRequestsPanels(): readonly DashboardStatPanel[];
@@ -0,0 +1,21 @@
1
+ import { HELPDESK_FEATURE, HELPDESK_STATUS, HelpdeskQueries, HelpdeskScreens, } from "./web/constants.js";
2
+ // Stat tile for a dashboard: how many contact requests still wait for a first answer.
3
+ export function helpdeskOpenRequestsPanels() {
4
+ return [
5
+ {
6
+ kind: "stat",
7
+ id: `${HELPDESK_FEATURE}-open-requests`,
8
+ label: "helpdesk:overview.open",
9
+ query: HelpdeskQueries.requestList,
10
+ params: {
11
+ filters: [{ field: "status", op: "eq", value: HELPDESK_STATUS.Open }],
12
+ limit: 1,
13
+ totalCount: true,
14
+ },
15
+ ignoreScreenFilter: true,
16
+ valueField: "total",
17
+ tone: "warn",
18
+ navigate: { screen: HelpdeskScreens.requestList },
19
+ },
20
+ ];
21
+ }
@@ -1,5 +1,5 @@
1
1
  import * as z from "zod";
2
- export declare const ContactSubmitSchema: z.ZodObject<{
2
+ export declare const HelpdeskSubmitSchema: z.ZodObject<{
3
3
  kind: z.ZodEnum<{
4
4
  bug: "bug";
5
5
  contact: "contact";
@@ -15,8 +15,8 @@ export declare const ContactSubmitSchema: z.ZodObject<{
15
15
  nonce: z.ZodString;
16
16
  page: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
17
17
  }, z.core.$strict>;
18
- export type ContactSubmitInput = z.infer<typeof ContactSubmitSchema>;
19
- export declare const ContactReportSchema: z.ZodObject<{
18
+ export type HelpdeskSubmitInput = z.infer<typeof HelpdeskSubmitSchema>;
19
+ export declare const HelpdeskReportSchema: z.ZodObject<{
20
20
  kind: z.ZodEnum<{
21
21
  bug: "bug";
22
22
  question: "question";
@@ -27,30 +27,30 @@ export declare const ContactReportSchema: z.ZodObject<{
27
27
  phone: z.ZodOptional<z.ZodString>;
28
28
  fileIds: z.ZodOptional<z.ZodArray<z.ZodUUID>>;
29
29
  }, z.core.$strict>;
30
- export type ContactReportInput = z.infer<typeof ContactReportSchema>;
31
- export declare const ContactIdSchema: z.ZodObject<{
30
+ export type HelpdeskReportInput = z.infer<typeof HelpdeskReportSchema>;
31
+ export declare const HelpdeskIdSchema: z.ZodObject<{
32
32
  id: z.ZodUUID;
33
33
  }, z.core.$strict>;
34
- export declare const ContactReplySchema: z.ZodObject<{
34
+ export declare const HelpdeskReplySchema: z.ZodObject<{
35
35
  requestId: z.ZodUUID;
36
36
  message: z.ZodString;
37
37
  fileIds: z.ZodOptional<z.ZodArray<z.ZodUUID>>;
38
38
  markDone: z.ZodDefault<z.ZodBoolean>;
39
39
  }, z.core.$strict>;
40
- export declare const ContactMarkDoneSchema: z.ZodObject<{
40
+ export declare const HelpdeskMarkDoneSchema: z.ZodObject<{
41
41
  id: z.ZodUUID;
42
42
  }, z.core.$strict>;
43
- export declare const ContactForwardRequestSchema: z.ZodObject<{
43
+ export declare const HelpdeskForwardRequestSchema: z.ZodObject<{
44
44
  requestId: z.ZodUUID;
45
45
  }, z.core.$strict>;
46
- export declare const ContactSendReplyMailSchema: z.ZodObject<{
46
+ export declare const HelpdeskSendReplyMailSchema: z.ZodObject<{
47
47
  replyId: z.ZodUUID;
48
48
  }, z.core.$strict>;
49
- export declare const ContactNotifyReporterInAppSchema: z.ZodObject<{
49
+ export declare const HelpdeskNotifyReporterInAppSchema: z.ZodObject<{
50
50
  replyId: z.ZodUUID;
51
51
  requestId: z.ZodUUID;
52
52
  userId: z.ZodUUID;
53
53
  authorName: z.ZodString;
54
54
  locale: z.ZodOptional<z.ZodString>;
55
55
  }, z.core.$strict>;
56
- export declare const ContactEmptySchema: z.ZodObject<{}, z.core.$strict>;
56
+ export declare const HelpdeskEmptySchema: z.ZodObject<{}, z.core.$strict>;
@@ -1,6 +1,6 @@
1
1
  import { canonicalizeLocaleTag, isValidLocaleTag } from "@cosmicdrift/kumiko-framework/i18n";
2
2
  import * as z from "zod";
3
- import { CONTACT_ADMIN_KINDS, CONTACT_FIELD_LIMITS, CONTACT_MAX_FILES, CONTACT_WEBSITE_KINDS, } from "./web/constants.js";
3
+ import { HELPDESK_ADMIN_KINDS, HELPDESK_FIELD_LIMITS, HELPDESK_MAX_FILES, HELPDESK_WEBSITE_KINDS, } from "./web/constants.js";
4
4
  // Submitted text lands in mail subjects; CR/LF there would allow header injection.
5
5
  const NO_CONTROL_CHARS = /^\P{Cc}*$/u;
6
6
  const NO_CONTROL_CHARS_EXCEPT_WHITESPACE = /^(?:[^\p{Cc}]|[\n\r\t])*$/u;
@@ -17,13 +17,13 @@ const multiLine = (max) => z
17
17
  const phone = z
18
18
  .string()
19
19
  .trim()
20
- .max(CONTACT_FIELD_LIMITS.phone)
20
+ .max(HELPDESK_FIELD_LIMITS.phone)
21
21
  .refine(noControlChars, CONTROL_CHARS_MESSAGE)
22
22
  .optional();
23
23
  const pagePath = z
24
24
  .string()
25
25
  .trim()
26
- .max(CONTACT_FIELD_LIMITS.page)
26
+ .max(HELPDESK_FIELD_LIMITS.page)
27
27
  .refine(noControlChars, CONTROL_CHARS_MESSAGE)
28
28
  // Query strings and fragments carry tokens and ids (reset links, session hints) that must not
29
29
  // end up in an inbox that is kept for a year.
@@ -31,52 +31,52 @@ const pagePath = z
31
31
  .optional();
32
32
  const locale = z
33
33
  .string()
34
- .max(CONTACT_FIELD_LIMITS.locale)
34
+ .max(HELPDESK_FIELD_LIMITS.locale)
35
35
  .refine(isValidLocaleTag, "invalid locale tag")
36
36
  .transform(canonicalizeLocaleTag);
37
- export const ContactSubmitSchema = z
37
+ export const HelpdeskSubmitSchema = z
38
38
  .object({
39
- kind: z.enum(CONTACT_WEBSITE_KINDS),
40
- name: singleLine(CONTACT_FIELD_LIMITS.name),
41
- email: z.email().max(CONTACT_FIELD_LIMITS.email),
39
+ kind: z.enum(HELPDESK_WEBSITE_KINDS),
40
+ name: singleLine(HELPDESK_FIELD_LIMITS.name),
41
+ email: z.email().max(HELPDESK_FIELD_LIMITS.email),
42
42
  phone,
43
- message: multiLine(CONTACT_FIELD_LIMITS.message),
43
+ message: multiLine(HELPDESK_FIELD_LIMITS.message),
44
44
  locale,
45
45
  // Honeypot: bots fill it, humans leave it empty.
46
- website: z.string().max(CONTACT_FIELD_LIMITS.honeypot).optional(),
47
- challenge: z.string().max(CONTACT_FIELD_LIMITS.challenge),
48
- nonce: z.string().max(CONTACT_FIELD_LIMITS.nonce),
46
+ website: z.string().max(HELPDESK_FIELD_LIMITS.honeypot).optional(),
47
+ challenge: z.string().max(HELPDESK_FIELD_LIMITS.challenge),
48
+ nonce: z.string().max(HELPDESK_FIELD_LIMITS.nonce),
49
49
  page: pagePath,
50
50
  })
51
51
  .strict();
52
- export const ContactReportSchema = z
52
+ export const HelpdeskReportSchema = z
53
53
  .object({
54
- kind: z.enum(CONTACT_ADMIN_KINDS),
55
- subject: singleLine(CONTACT_FIELD_LIMITS.subject),
56
- message: multiLine(CONTACT_FIELD_LIMITS.message),
54
+ kind: z.enum(HELPDESK_ADMIN_KINDS),
55
+ subject: singleLine(HELPDESK_FIELD_LIMITS.subject),
56
+ message: multiLine(HELPDESK_FIELD_LIMITS.message),
57
57
  phone,
58
- fileIds: z.array(z.uuid()).max(CONTACT_MAX_FILES).optional(),
58
+ fileIds: z.array(z.uuid()).max(HELPDESK_MAX_FILES).optional(),
59
59
  })
60
60
  .strict();
61
- export const ContactIdSchema = z.object({ id: z.uuid() }).strict();
62
- export const ContactReplySchema = z
61
+ export const HelpdeskIdSchema = z.object({ id: z.uuid() }).strict();
62
+ export const HelpdeskReplySchema = z
63
63
  .object({
64
64
  requestId: z.uuid(),
65
- message: multiLine(CONTACT_FIELD_LIMITS.message),
66
- fileIds: z.array(z.uuid()).max(CONTACT_MAX_FILES).optional(),
65
+ message: multiLine(HELPDESK_FIELD_LIMITS.message),
66
+ fileIds: z.array(z.uuid()).max(HELPDESK_MAX_FILES).optional(),
67
67
  markDone: z.boolean().default(false),
68
68
  })
69
69
  .strict();
70
- export const ContactMarkDoneSchema = ContactIdSchema;
71
- export const ContactForwardRequestSchema = z.object({ requestId: z.uuid() }).strict();
72
- export const ContactSendReplyMailSchema = z.object({ replyId: z.uuid() }).strict();
73
- export const ContactNotifyReporterInAppSchema = z
70
+ export const HelpdeskMarkDoneSchema = HelpdeskIdSchema;
71
+ export const HelpdeskForwardRequestSchema = z.object({ requestId: z.uuid() }).strict();
72
+ export const HelpdeskSendReplyMailSchema = z.object({ replyId: z.uuid() }).strict();
73
+ export const HelpdeskNotifyReporterInAppSchema = z
74
74
  .object({
75
75
  replyId: z.uuid(),
76
76
  requestId: z.uuid(),
77
77
  userId: z.uuid(),
78
- authorName: z.string().max(CONTACT_FIELD_LIMITS.name),
79
- locale: z.string().max(CONTACT_FIELD_LIMITS.locale).optional(),
78
+ authorName: z.string().max(HELPDESK_FIELD_LIMITS.name),
79
+ locale: z.string().max(HELPDESK_FIELD_LIMITS.locale).optional(),
80
80
  })
81
81
  .strict();
82
- export const ContactEmptySchema = z.object({}).strict();
82
+ export const HelpdeskEmptySchema = z.object({}).strict();
@@ -0,0 +1,5 @@
1
+ import type { ScreenDefinition } from "@cosmicdrift/kumiko-framework/ui-types";
2
+ import type { HelpdeskOptions, HelpdeskSettings } from "./options.ts";
3
+ export declare const REPORT_FIELD_LABEL: string;
4
+ export declare const REPLY_FIELD_LABEL: string;
5
+ export declare function createHelpdeskScreens(opts: HelpdeskOptions, settings: HelpdeskSettings): readonly ScreenDefinition[];