@cosmicdrift/kumiko-bundled-features 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 (166) 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/documents/boot-rules.d.ts +12 -0
  15. package/dist/documents/boot-rules.js +12 -0
  16. package/dist/documents/feature.js +8 -3
  17. package/dist/file-derivatives/boot-rules.d.ts +7 -0
  18. package/dist/file-derivatives/boot-rules.js +7 -0
  19. package/dist/file-derivatives/feature.js +5 -2
  20. package/dist/folders/boot-rules.d.ts +7 -0
  21. package/dist/folders/boot-rules.js +7 -0
  22. package/dist/folders/feature.js +8 -5
  23. package/dist/helpdesk/boot-rules.d.ts +7 -0
  24. package/dist/helpdesk/boot-rules.js +7 -0
  25. package/dist/{contact → helpdesk}/challenge.js +2 -2
  26. package/dist/helpdesk/client/helpdesk-client-source.d.ts +1 -0
  27. package/dist/{contact/client/contact-client-source.js → helpdesk/client/helpdesk-client-source.js} +4 -4
  28. package/dist/helpdesk/client/helpdesk-website-client.d.ts +26 -0
  29. package/dist/helpdesk/client/index.d.ts +2 -0
  30. package/dist/helpdesk/client/index.js +1 -0
  31. package/dist/{contact → helpdesk}/entity.d.ts +6 -6
  32. package/dist/{contact → helpdesk}/entity.js +31 -27
  33. package/dist/helpdesk/feature.d.ts +3 -0
  34. package/dist/{contact → helpdesk}/feature.js +43 -39
  35. package/dist/{contact → helpdesk}/handlers/attempts.d.ts +2 -2
  36. package/dist/helpdesk/handlers/challenge.query.d.ts +9 -0
  37. package/dist/{contact → helpdesk}/handlers/challenge.query.js +5 -5
  38. package/dist/helpdesk/handlers/forward-request.write.d.ts +9 -0
  39. package/dist/{contact → helpdesk}/handlers/forward-request.write.js +17 -15
  40. package/dist/{contact → helpdesk}/handlers/mark-done.write.d.ts +2 -2
  41. package/dist/{contact → helpdesk}/handlers/mark-done.write.js +8 -8
  42. package/dist/{contact → helpdesk}/handlers/notify-reporter-in-app.write.d.ts +2 -2
  43. package/dist/{contact → helpdesk}/handlers/notify-reporter-in-app.write.js +11 -11
  44. package/dist/{contact → helpdesk}/handlers/open-count.js +2 -2
  45. package/dist/{contact → helpdesk}/handlers/open-count.query.js +4 -4
  46. package/dist/{contact → helpdesk}/handlers/replies.query.js +6 -6
  47. package/dist/{contact → helpdesk}/handlers/reply.write.d.ts +4 -4
  48. package/dist/{contact → helpdesk}/handlers/reply.write.js +16 -16
  49. package/dist/helpdesk/handlers/report.write.d.ts +16 -0
  50. package/dist/{contact → helpdesk}/handlers/report.write.js +17 -17
  51. package/dist/helpdesk/handlers/request-delivery.query.d.ts +16 -0
  52. package/dist/{contact → helpdesk}/handlers/request-delivery.query.js +24 -24
  53. package/dist/{contact → helpdesk}/handlers/request-detail.query.d.ts +3 -3
  54. package/dist/{contact → helpdesk}/handlers/request-detail.query.js +10 -10
  55. package/dist/{contact → helpdesk}/handlers/request-list.query.js +2 -2
  56. package/dist/helpdesk/handlers/send-reply-mail.write.d.ts +8 -0
  57. package/dist/{contact → helpdesk}/handlers/send-reply-mail.write.js +15 -15
  58. package/dist/helpdesk/handlers/send-test.write.d.ts +5 -0
  59. package/dist/{contact → helpdesk}/handlers/send-test.write.js +10 -10
  60. package/dist/{contact → helpdesk}/handlers/submit.write.d.ts +4 -4
  61. package/dist/{contact → helpdesk}/handlers/submit.write.js +17 -17
  62. package/dist/{contact → helpdesk}/handlers/take-over-uploads.js +5 -5
  63. package/dist/{contact → helpdesk}/i18n.d.ts +1 -1
  64. package/dist/{contact → helpdesk}/i18n.js +78 -75
  65. package/dist/helpdesk/index.d.ts +5 -0
  66. package/dist/helpdesk/index.js +4 -0
  67. package/dist/{contact → helpdesk}/lib.d.ts +5 -5
  68. package/dist/{contact → helpdesk}/lib.js +16 -16
  69. package/dist/{contact → helpdesk}/mail.d.ts +20 -20
  70. package/dist/{contact → helpdesk}/mail.js +47 -47
  71. package/dist/{contact → helpdesk}/options.d.ts +6 -6
  72. package/dist/helpdesk/options.js +36 -0
  73. package/dist/helpdesk/panels.d.ts +2 -0
  74. package/dist/helpdesk/panels.js +21 -0
  75. package/dist/{contact → helpdesk}/payloads.d.ts +11 -11
  76. package/dist/{contact → helpdesk}/payloads.js +28 -28
  77. package/dist/helpdesk/screens.d.ts +5 -0
  78. package/dist/{contact → helpdesk}/screens.js +87 -87
  79. package/dist/{contact → helpdesk}/subject.js +3 -3
  80. package/dist/helpdesk/user-data-hooks.d.ts +3 -0
  81. package/dist/{contact → helpdesk}/user-data-hooks.js +15 -15
  82. package/dist/helpdesk/web/constants.d.ts +127 -0
  83. package/dist/helpdesk/web/constants.js +126 -0
  84. package/dist/helpdesk/web/index.d.ts +1 -0
  85. package/dist/helpdesk/web/index.js +1 -0
  86. package/dist/host-routing/boot-rules.d.ts +22 -0
  87. package/dist/host-routing/boot-rules.js +22 -0
  88. package/dist/host-routing/validate-options.js +35 -11
  89. package/dist/jobs/boot-rules.d.ts +7 -0
  90. package/dist/jobs/boot-rules.js +7 -0
  91. package/dist/jobs/feature.js +5 -2
  92. package/dist/legal-pages/boot-rules.d.ts +17 -0
  93. package/dist/legal-pages/boot-rules.js +17 -0
  94. package/dist/legal-pages/feature.js +5 -2
  95. package/dist/legal-pages/lib/validate-routes.js +11 -3
  96. package/dist/metrics/boot-rules.d.ts +12 -0
  97. package/dist/metrics/boot-rules.js +12 -0
  98. package/dist/metrics/validate.js +8 -2
  99. package/dist/notes-history/boot-rules.d.ts +7 -0
  100. package/dist/notes-history/boot-rules.js +7 -0
  101. package/dist/notes-history/feature.js +7 -4
  102. package/dist/personal-access-tokens/boot-rules.d.ts +7 -0
  103. package/dist/personal-access-tokens/boot-rules.js +7 -0
  104. package/dist/personal-access-tokens/scope-events-check.js +7 -4
  105. package/dist/presence/boot-rules.d.ts +7 -0
  106. package/dist/presence/boot-rules.js +7 -0
  107. package/dist/presence/options.js +5 -1
  108. package/dist/readiness/boot-rules.d.ts +12 -0
  109. package/dist/readiness/boot-rules.js +12 -0
  110. package/dist/readiness/probe-boot-check.js +8 -3
  111. package/dist/shared/assert-no-where-rule-in-ownership-write.d.ts +1 -1
  112. package/dist/shared/assert-no-where-rule-in-ownership-write.js +11 -7
  113. package/dist/shared/boot-rules.d.ts +7 -0
  114. package/dist/shared/boot-rules.js +7 -0
  115. package/dist/subscription-mollie/boot-rules.d.ts +17 -0
  116. package/dist/subscription-mollie/boot-rules.js +17 -0
  117. package/dist/subscription-mollie/feature.js +13 -6
  118. package/dist/tags/boot-rules.d.ts +7 -0
  119. package/dist/tags/boot-rules.js +7 -0
  120. package/dist/tags/feature.js +8 -5
  121. package/dist/template-resolver/boot-rules.d.ts +17 -0
  122. package/dist/template-resolver/boot-rules.js +17 -0
  123. package/dist/template-resolver/feature.js +14 -5
  124. package/dist/tenant/boot-rules.d.ts +7 -0
  125. package/dist/tenant/boot-rules.js +7 -0
  126. package/dist/tenant/feature.js +5 -2
  127. package/kumiko-es-tables.json +4 -4
  128. package/package.json +29 -29
  129. package/src/{contact → helpdesk}/changes.json +6 -0
  130. package/dist/contact/client/contact-client-source.d.ts +0 -1
  131. package/dist/contact/client/contact-website-client.d.ts +0 -26
  132. package/dist/contact/client/index.d.ts +0 -2
  133. package/dist/contact/client/index.js +0 -1
  134. package/dist/contact/feature.d.ts +0 -3
  135. package/dist/contact/handlers/challenge.query.d.ts +0 -9
  136. package/dist/contact/handlers/forward-request.write.d.ts +0 -9
  137. package/dist/contact/handlers/report.write.d.ts +0 -16
  138. package/dist/contact/handlers/request-delivery.query.d.ts +0 -16
  139. package/dist/contact/handlers/send-reply-mail.write.d.ts +0 -8
  140. package/dist/contact/handlers/send-test.write.d.ts +0 -5
  141. package/dist/contact/index.d.ts +0 -5
  142. package/dist/contact/index.js +0 -4
  143. package/dist/contact/options.js +0 -32
  144. package/dist/contact/panels.d.ts +0 -2
  145. package/dist/contact/panels.js +0 -21
  146. package/dist/contact/screens.d.ts +0 -5
  147. package/dist/contact/user-data-hooks.d.ts +0 -3
  148. package/dist/contact/web/constants.d.ts +0 -127
  149. package/dist/contact/web/constants.js +0 -126
  150. package/dist/contact/web/index.d.ts +0 -1
  151. package/dist/contact/web/index.js +0 -1
  152. /package/dist/{contact → helpdesk}/challenge.d.ts +0 -0
  153. /package/dist/{contact/client/contact-website-client.js → helpdesk/client/helpdesk-website-client.js} +0 -0
  154. /package/dist/{contact → helpdesk}/handlers/access.d.ts +0 -0
  155. /package/dist/{contact → helpdesk}/handlers/access.js +0 -0
  156. /package/dist/{contact → helpdesk}/handlers/attempts.js +0 -0
  157. /package/dist/{contact → helpdesk}/handlers/open-count.d.ts +0 -0
  158. /package/dist/{contact → helpdesk}/handlers/open-count.query.d.ts +0 -0
  159. /package/dist/{contact → helpdesk}/handlers/replies.query.d.ts +0 -0
  160. /package/dist/{contact → helpdesk}/handlers/request-list.query.d.ts +0 -0
  161. /package/dist/{contact → helpdesk}/handlers/take-over-uploads.d.ts +0 -0
  162. /package/dist/{contact → helpdesk}/pow.d.ts +0 -0
  163. /package/dist/{contact → helpdesk}/pow.js +0 -0
  164. /package/dist/{contact → helpdesk}/subject.d.ts +0 -0
  165. /package/dist/{contact → helpdesk}/user-agent.d.ts +0 -0
  166. /package/dist/{contact → helpdesk}/user-agent.js +0 -0
@@ -0,0 +1,2 @@
1
+ export { HELPDESK_CLIENT_SOURCE } from "./helpdesk-client-source.ts";
2
+ export type { HelpdeskWebsiteClient, HelpdeskWebsiteFormOptions, HelpdeskWebsiteKind, HelpdeskWebsiteSubmitFields, HelpdeskWebsiteSubmitResult, HelpdeskWebsiteWindow, } from "./helpdesk-website-client.ts";
@@ -0,0 +1 @@
1
+ export { HELPDESK_CLIENT_SOURCE } from "./helpdesk-client-source.js";
@@ -1,4 +1,4 @@
1
- export declare function createContactRequestEntity(retentionKeepFor?: string): import("@cosmicdrift/kumiko-types/fields").EntityDefinition<{
1
+ export declare function createHelpdeskRequestEntity(retentionKeepFor?: string): import("@cosmicdrift/kumiko-types/fields").EntityDefinition<{
2
2
  readonly kind: {
3
3
  readonly type: "select";
4
4
  readonly description?: string;
@@ -200,7 +200,7 @@ export declare function createContactRequestEntity(retentionKeepFor?: string): i
200
200
  required: false;
201
201
  };
202
202
  }, "global">;
203
- export declare function createContactReplyEntity(retentionKeepFor?: string): import("@cosmicdrift/kumiko-types/fields").EntityDefinition<{
203
+ export declare function createHelpdeskReplyEntity(retentionKeepFor?: string): import("@cosmicdrift/kumiko-types/fields").EntityDefinition<{
204
204
  readonly requestId: import("@cosmicdrift/kumiko-types/fields").EntityTextFieldDef & {
205
205
  required: true;
206
206
  };
@@ -257,7 +257,7 @@ export declare function createContactReplyEntity(retentionKeepFor?: string): imp
257
257
  required: true;
258
258
  };
259
259
  }, "global">;
260
- export declare const contactRequestEntity: import("@cosmicdrift/kumiko-types/fields").EntityDefinition<{
260
+ export declare const helpdeskRequestEntity: import("@cosmicdrift/kumiko-types/fields").EntityDefinition<{
261
261
  readonly kind: {
262
262
  readonly type: "select";
263
263
  readonly description?: string;
@@ -459,7 +459,7 @@ export declare const contactRequestEntity: import("@cosmicdrift/kumiko-types/fie
459
459
  required: false;
460
460
  };
461
461
  }, "global">;
462
- export declare const contactReplyEntity: import("@cosmicdrift/kumiko-types/fields").EntityDefinition<{
462
+ export declare const helpdeskReplyEntity: import("@cosmicdrift/kumiko-types/fields").EntityDefinition<{
463
463
  readonly requestId: import("@cosmicdrift/kumiko-types/fields").EntityTextFieldDef & {
464
464
  required: true;
465
465
  };
@@ -516,7 +516,7 @@ export declare const contactReplyEntity: import("@cosmicdrift/kumiko-types/field
516
516
  required: true;
517
517
  };
518
518
  }, "global">;
519
- export declare const contactRequestTable: import("@cosmicdrift/kumiko-framework/db").EntityTable<import("@cosmicdrift/kumiko-types/fields").EntityDefinition<{
519
+ export declare const helpdeskRequestTable: import("@cosmicdrift/kumiko-framework/db").EntityTable<import("@cosmicdrift/kumiko-types/fields").EntityDefinition<{
520
520
  readonly kind: {
521
521
  readonly type: "select";
522
522
  readonly description?: string;
@@ -718,7 +718,7 @@ export declare const contactRequestTable: import("@cosmicdrift/kumiko-framework/
718
718
  required: false;
719
719
  };
720
720
  }, "global">>;
721
- export declare const contactReplyTable: import("@cosmicdrift/kumiko-framework/db").EntityTable<import("@cosmicdrift/kumiko-types/fields").EntityDefinition<{
721
+ export declare const helpdeskReplyTable: import("@cosmicdrift/kumiko-framework/db").EntityTable<import("@cosmicdrift/kumiko-types/fields").EntityDefinition<{
722
722
  readonly requestId: import("@cosmicdrift/kumiko-types/fields").EntityTextFieldDef & {
723
723
  required: true;
724
724
  };
@@ -1,26 +1,30 @@
1
1
  import { buildEntityTable } from "@cosmicdrift/kumiko-framework/db";
2
2
  import { createEntity, createFilesField, createLongTextField, createNumberField, createSelectField, createTextField, createTimestampField, } from "@cosmicdrift/kumiko-framework/engine";
3
3
  import { DEFAULT_RETENTION_KEEP_FOR } from "./options.js";
4
- import { CONTACT_KIND, CONTACT_MAX_FILES, CONTACT_REPLY_CHANNELS, CONTACT_SOURCE, CONTACT_STATUS, } from "./web/constants.js";
4
+ import { HELPDESK_KIND, HELPDESK_MAX_FILES, HELPDESK_REPLY_CHANNELS, HELPDESK_SOURCE, HELPDESK_STATUS, } from "./web/constants.js";
5
5
  const KIND_OPTIONS = [
6
- CONTACT_KIND.Question,
7
- CONTACT_KIND.Contact,
8
- CONTACT_KIND.Bug,
9
- CONTACT_KIND.Wish,
6
+ HELPDESK_KIND.Question,
7
+ HELPDESK_KIND.Contact,
8
+ HELPDESK_KIND.Bug,
9
+ HELPDESK_KIND.Wish,
10
10
  ];
11
- const STATUS_OPTIONS = [CONTACT_STATUS.Open, CONTACT_STATUS.Answered, CONTACT_STATUS.Done];
12
- const SOURCE_OPTIONS = [CONTACT_SOURCE.Website, CONTACT_SOURCE.Admin];
11
+ const STATUS_OPTIONS = [
12
+ HELPDESK_STATUS.Open,
13
+ HELPDESK_STATUS.Answered,
14
+ HELPDESK_STATUS.Done,
15
+ ];
16
+ const SOURCE_OPTIONS = [HELPDESK_SOURCE.Website, HELPDESK_SOURCE.Admin];
13
17
  const REPLY_CHANNEL_OPTIONS = [
14
- CONTACT_REPLY_CHANNELS.Email,
15
- CONTACT_REPLY_CHANNELS.EmailAndInApp,
18
+ HELPDESK_REPLY_CHANNELS.Email,
19
+ HELPDESK_REPLY_CHANNELS.EmailAndInApp,
16
20
  ];
17
21
  // A signed-in reporter is the data subject; an anonymous reporter has no user id, so the row
18
22
  // itself is the crypto-shredding subject.
19
23
  const REPORTER_SUBJECT = { of: "reporterUserId", whenAbsent: "self" };
20
24
  const MAX_FILE_SIZE = "10MB";
21
- export function createContactRequestEntity(retentionKeepFor = DEFAULT_RETENTION_KEEP_FOR) {
25
+ export function createHelpdeskRequestEntity(retentionKeepFor = DEFAULT_RETENTION_KEEP_FOR) {
22
26
  return createEntity({
23
- table: "read_contact_requests",
27
+ table: "read_helpdesk_requests",
24
28
  description: "A message from a website visitor or a signed-in user to the platform operators (question, contact request, bug report or wish), tracked through open, answered and done as SystemAdmins process it; name, email, phone, subject and message are the reporter's personal data.",
25
29
  systemStream: true,
26
30
  tenancy: "global",
@@ -32,22 +36,22 @@ export function createContactRequestEntity(retentionKeepFor = DEFAULT_RETENTION_
32
36
  filterable: true,
33
37
  sortable: true,
34
38
  optionTones: {
35
- [CONTACT_KIND.Bug]: "bad",
36
- [CONTACT_KIND.Question]: "accent",
37
- [CONTACT_KIND.Contact]: "accent",
38
- [CONTACT_KIND.Wish]: "neutral",
39
+ [HELPDESK_KIND.Bug]: "bad",
40
+ [HELPDESK_KIND.Question]: "accent",
41
+ [HELPDESK_KIND.Contact]: "accent",
42
+ [HELPDESK_KIND.Wish]: "neutral",
39
43
  },
40
44
  }),
41
45
  status: createSelectField({
42
46
  options: STATUS_OPTIONS,
43
47
  required: true,
44
- default: CONTACT_STATUS.Open,
48
+ default: HELPDESK_STATUS.Open,
45
49
  filterable: true,
46
50
  sortable: true,
47
51
  optionTones: {
48
- [CONTACT_STATUS.Open]: "warn",
49
- [CONTACT_STATUS.Answered]: "accent",
50
- [CONTACT_STATUS.Done]: "ok",
52
+ [HELPDESK_STATUS.Open]: "warn",
53
+ [HELPDESK_STATUS.Answered]: "accent",
54
+ [HELPDESK_STATUS.Done]: "ok",
51
55
  },
52
56
  }),
53
57
  source: createSelectField({
@@ -85,7 +89,7 @@ export function createContactRequestEntity(retentionKeepFor = DEFAULT_RETENTION_
85
89
  browser: createTextField({ personal: false, reason: "is_browser_summary" }),
86
90
  locale: createTextField({ personal: false, reason: "is_ui_language_preference" }),
87
91
  fileIds: createFilesField({
88
- maxCount: CONTACT_MAX_FILES,
92
+ maxCount: HELPDESK_MAX_FILES,
89
93
  maxSize: MAX_FILE_SIZE,
90
94
  personal: REPORTER_SUBJECT,
91
95
  }),
@@ -102,9 +106,9 @@ export function createContactRequestEntity(retentionKeepFor = DEFAULT_RETENTION_
102
106
  },
103
107
  });
104
108
  }
105
- export function createContactReplyEntity(retentionKeepFor = DEFAULT_RETENTION_KEEP_FOR) {
109
+ export function createHelpdeskReplyEntity(retentionKeepFor = DEFAULT_RETENTION_KEEP_FOR) {
106
110
  return createEntity({
107
- table: "read_contact_replies",
111
+ table: "read_helpdesk_replies",
108
112
  description: "A SystemAdmin's answer to a contact request, with the channels it went out on; the message is the reporter's personal data because it quotes and addresses them.",
109
113
  systemStream: true,
110
114
  tenancy: "global",
@@ -124,7 +128,7 @@ export function createContactReplyEntity(retentionKeepFor = DEFAULT_RETENTION_KE
124
128
  }),
125
129
  authorName: createTextField({ required: true, personal: false, reason: "is_admin_label" }),
126
130
  fileIds: createFilesField({
127
- maxCount: CONTACT_MAX_FILES,
131
+ maxCount: HELPDESK_MAX_FILES,
128
132
  maxSize: MAX_FILE_SIZE,
129
133
  personal: false,
130
134
  reason: "is_business_data",
@@ -139,7 +143,7 @@ export function createContactReplyEntity(retentionKeepFor = DEFAULT_RETENTION_KE
139
143
  },
140
144
  });
141
145
  }
142
- export const contactRequestEntity = createContactRequestEntity();
143
- export const contactReplyEntity = createContactReplyEntity();
144
- export const contactRequestTable = buildEntityTable("contact-request", contactRequestEntity);
145
- export const contactReplyTable = buildEntityTable("contact-reply", contactReplyEntity);
146
+ export const helpdeskRequestEntity = createHelpdeskRequestEntity();
147
+ export const helpdeskReplyEntity = createHelpdeskReplyEntity();
148
+ export const helpdeskRequestTable = buildEntityTable("helpdesk-request", helpdeskRequestEntity);
149
+ export const helpdeskReplyTable = buildEntityTable("helpdesk-reply", helpdeskReplyEntity);
@@ -0,0 +1,3 @@
1
+ import { type FeatureDefinition } from "@cosmicdrift/kumiko-framework/engine";
2
+ import { type HelpdeskOptions } from "./options.ts";
3
+ export declare function createHelpdeskFeature(opts: HelpdeskOptions): FeatureDefinition;
@@ -1,6 +1,6 @@
1
1
  import { access, createSystemConfig, defineFeature, EXT_USER_DATA, } from "@cosmicdrift/kumiko-framework/engine";
2
- import { CONTACT_CLIENT_SOURCE } from "./client/contact-client-source.js";
3
- import { contactReplyEntity, contactRequestEntity, createContactReplyEntity, createContactRequestEntity, } from "./entity.js";
2
+ import { HELPDESK_CLIENT_SOURCE } from "./client/helpdesk-client-source.js";
3
+ import { createHelpdeskReplyEntity, createHelpdeskRequestEntity, helpdeskReplyEntity, helpdeskRequestEntity, } from "./entity.js";
4
4
  import { createChallengeQuery } from "./handlers/challenge.query.js";
5
5
  import { createForwardRequestHandler } from "./handlers/forward-request.write.js";
6
6
  import { markDoneHandler } from "./handlers/mark-done.write.js";
@@ -15,25 +15,27 @@ import { createRequestListQuery } from "./handlers/request-list.query.js";
15
15
  import { createSendReplyMailHandler } from "./handlers/send-reply-mail.write.js";
16
16
  import { createSendTestHandler } from "./handlers/send-test.write.js";
17
17
  import { createSubmitHandler } from "./handlers/submit.write.js";
18
- import { createContactI18n } from "./i18n.js";
18
+ import { createHelpdeskI18n } from "./i18n.js";
19
19
  import { TELEGRAM_FEATURE } from "./lib.js";
20
- import { CONTACT_ACKNOWLEDGEMENT_VARIABLES, CONTACT_CONFIRMATION_VARIABLES, CONTACT_NEW_REQUEST_VARIABLES, CONTACT_REPLY_VARIABLES, CONTACT_TEST_VARIABLES, contactAcknowledgementTemplate, contactConfirmationTemplate, contactNewRequestTemplate, contactReplyTemplate, contactTestTemplate, inAppTemplate, telegramTemplate, } from "./mail.js";
21
- import { DEFAULT_RETENTION_KEEP_FOR, resolveContactSettings, } from "./options.js";
22
- import { createContactScreens } from "./screens.js";
23
- import { contactDeleteHook, contactExportHook } from "./user-data-hooks.js";
24
- import { CONTACT_FEATURE } from "./web/constants.js";
20
+ import { HELPDESK_ACKNOWLEDGEMENT_VARIABLES, HELPDESK_CONFIRMATION_VARIABLES, HELPDESK_NEW_REQUEST_VARIABLES, HELPDESK_REPLY_VARIABLES, HELPDESK_TEST_VARIABLES, helpdeskAcknowledgementTemplate, helpdeskConfirmationTemplate, helpdeskNewRequestTemplate, helpdeskReplyTemplate, helpdeskTestTemplate, inAppTemplate, telegramTemplate, } from "./mail.js";
21
+ import { DEFAULT_RETENTION_KEEP_FOR, resolveHelpdeskSettings, } from "./options.js";
22
+ import { createHelpdeskScreens } from "./screens.js";
23
+ import { helpdeskDeleteHook, helpdeskExportHook } from "./user-data-hooks.js";
24
+ import { HELPDESK_FEATURE } from "./web/constants.js";
25
25
  const REPLY_CONTEXT_FIELDS = ["name", "email", "replyTo"];
26
- export function createContactFeature(opts) {
27
- const settings = resolveContactSettings(opts);
26
+ export function createHelpdeskFeature(opts) {
27
+ const settings = resolveHelpdeskSettings(opts);
28
28
  const telegram = opts.telegram === true;
29
29
  const keepFor = opts.retentionKeepFor ?? DEFAULT_RETENTION_KEEP_FOR;
30
30
  const requestEntity = keepFor === DEFAULT_RETENTION_KEEP_FOR
31
- ? contactRequestEntity
32
- : createContactRequestEntity(keepFor);
33
- const replyEntity = keepFor === DEFAULT_RETENTION_KEEP_FOR ? contactReplyEntity : createContactReplyEntity(keepFor);
34
- return defineFeature(CONTACT_FEATURE, (r) => {
35
- r.describe("Contact inbox: an anonymous browser client (GET /contact/client.js) submits questions, contact requests, bug reports and wishes behind a honeypot, a minimum submit time and a single-use proof-of-work challenge; signed-in users file reports from the admin. Every request is stored platform-wide and every SystemAdmin is notified by mail, optionally also in a Telegram chat (option `telegram`, off by default); the notification names only the kind, the app and a link, never name, address, phone, subject or message, because mail and Telegram cannot be shredded. SystemAdmins reply by mail (Reply-To set, attachments, quoting the original) and mark requests done; a website sender gets a fixed acknowledgement, a signed-in reporter a copy and an in-app note. Personal data is crypto-shredding-ready and the EXT_USER_DATA hooks export and erase a user's requests.");
36
- r.uiHints({ displayLabel: "Contact", category: "communication", recommended: false });
31
+ ? helpdeskRequestEntity
32
+ : createHelpdeskRequestEntity(keepFor);
33
+ const replyEntity = keepFor === DEFAULT_RETENTION_KEEP_FOR
34
+ ? helpdeskReplyEntity
35
+ : createHelpdeskReplyEntity(keepFor);
36
+ return defineFeature(HELPDESK_FEATURE, (r) => {
37
+ r.describe("Helpdesk inbox: an anonymous browser client (GET /helpdesk/client.js) submits questions, contact requests, bug reports and wishes behind a honeypot, a minimum submit time and a single-use proof-of-work challenge; signed-in users file reports from the admin. Every request is stored platform-wide and every SystemAdmin is notified by mail, optionally also in a Telegram chat (option `telegram`, off by default); the notification names only the kind, the app and a link, never name, address, phone, subject or message, because mail and Telegram cannot be shredded. SystemAdmins reply by mail (Reply-To set, attachments, quoting the original) and mark requests done; a website sender gets a fixed acknowledgement, a signed-in reporter a copy and an in-app note. Personal data is crypto-shredding-ready and the EXT_USER_DATA hooks export and erase a user's requests.");
38
+ r.uiHints({ displayLabel: "Helpdesk", category: "communication", recommended: false });
37
39
  r.systemScope();
38
40
  r.requires({ features: ["config", "delivery", "user-data-rights", "files", "notes-history"] });
39
41
  // The feature manifest and reference are built from one mounted instance, so the off
@@ -43,7 +45,7 @@ export function createContactFeature(opts) {
43
45
  else
44
46
  r.optionalRequires(TELEGRAM_FEATURE);
45
47
  r.adoptsBundledLists();
46
- r.translations({ keys: createContactI18n() });
48
+ r.translations({ keys: createHelpdeskI18n() });
47
49
  r.config({
48
50
  keys: {
49
51
  replyTo: createSystemConfig("text", {
@@ -67,32 +69,34 @@ export function createContactFeature(opts) {
67
69
  });
68
70
  }
69
71
  r.notification("new-request", {
70
- variables: CONTACT_NEW_REQUEST_VARIABLES,
71
- localizedTemplate: contactNewRequestTemplate,
72
+ variables: HELPDESK_NEW_REQUEST_VARIABLES,
73
+ localizedTemplate: helpdeskNewRequestTemplate,
72
74
  ...(telegram && { templates: { telegram: telegramTemplate } }),
73
75
  });
74
76
  r.notification("confirmation", {
75
- variables: CONTACT_CONFIRMATION_VARIABLES,
76
- localizedTemplate: contactConfirmationTemplate,
77
+ variables: HELPDESK_CONFIRMATION_VARIABLES,
78
+ localizedTemplate: helpdeskConfirmationTemplate,
77
79
  });
78
80
  r.notification("acknowledgement", {
79
- variables: CONTACT_ACKNOWLEDGEMENT_VARIABLES,
80
- localizedTemplate: contactAcknowledgementTemplate,
81
+ variables: HELPDESK_ACKNOWLEDGEMENT_VARIABLES,
82
+ localizedTemplate: helpdeskAcknowledgementTemplate,
81
83
  });
82
84
  r.notification("reply", {
83
- variables: CONTACT_REPLY_VARIABLES,
84
- localizedTemplate: contactReplyTemplate,
85
+ variables: HELPDESK_REPLY_VARIABLES,
86
+ localizedTemplate: helpdeskReplyTemplate,
87
+ });
88
+ r.notification("reply-in-app", {
89
+ templates: { inApp: inAppTemplate },
85
90
  });
86
- r.notification("reply-in-app", { templates: { inApp: inAppTemplate } });
87
91
  if (telegram) {
88
92
  r.notification("test", {
89
- variables: CONTACT_TEST_VARIABLES,
90
- localizedTemplate: contactTestTemplate,
93
+ variables: HELPDESK_TEST_VARIABLES,
94
+ localizedTemplate: helpdeskTestTemplate,
91
95
  templates: { telegram: telegramTemplate },
92
96
  });
93
97
  }
94
- r.entity({ name: "contact-request", ...requestEntity });
95
- r.entity({ name: "contact-reply", ...replyEntity });
98
+ r.entity({ name: "helpdesk-request", ...requestEntity });
99
+ r.entity({ name: "helpdesk-reply", ...replyEntity });
96
100
  r.writeHandler(createSubmitHandler(opts, settings));
97
101
  r.writeHandler(createReportHandler(opts, settings));
98
102
  r.writeHandler(createForwardRequestHandler(opts));
@@ -109,24 +113,24 @@ export function createContactFeature(opts) {
109
113
  r.queryHandler(createRequestDetailQuery(opts));
110
114
  r.queryHandler(repliesQuery);
111
115
  r.queryHandler(createRequestDeliveryQuery(opts));
112
- for (const screen of createContactScreens(opts, settings))
116
+ for (const screen of createHelpdeskScreens(opts, settings))
113
117
  r.screen(screen);
114
118
  r.httpRoute({
115
119
  method: "GET",
116
- // A literal, not CONTACT_CLIENT_PATH: the feature-AST extractor only reads string literals.
117
- path: "/contact/client.js",
120
+ // A literal, not HELPDESK_CLIENT_PATH: the feature-AST extractor only reads string literals.
121
+ path: "/helpdesk/client.js",
118
122
  anonymous: true,
119
- handler: async (c) => c.body(CONTACT_CLIENT_SOURCE, 200, {
123
+ handler: async (c) => c.body(HELPDESK_CLIENT_SOURCE, 200, {
120
124
  "content-type": "application/javascript; charset=utf-8",
121
125
  "cache-control": "public, max-age=300",
122
126
  }),
123
127
  });
124
- r.useExtension(EXT_USER_DATA, "contact-request", {
125
- export: contactExportHook,
126
- delete: contactDeleteHook,
128
+ r.useExtension(EXT_USER_DATA, "helpdesk-request", {
129
+ export: helpdeskExportHook,
130
+ delete: helpdeskDeleteHook,
127
131
  });
128
- // Replies are exported nested under their request and erased with it (contactDeleteHook).
129
- r.useExtension(EXT_USER_DATA, "contact-reply", {
132
+ // Replies are exported nested under their request and erased with it (helpdeskDeleteHook).
133
+ r.useExtension(EXT_USER_DATA, "helpdesk-reply", {
130
134
  export: async () => null,
131
135
  delete: async () => { },
132
136
  });
@@ -8,7 +8,7 @@ declare const attemptSchema: z.ZodObject<{
8
8
  status: z.ZodString;
9
9
  createdAt: z.ZodCustom<globalThis.Temporal.Instant, globalThis.Temporal.Instant>;
10
10
  }, z.core.$strip>;
11
- export type ContactAttempt = z.infer<typeof attemptSchema>;
12
- export declare function loadAttemptsByKey(ctx: Pick<HandlerContext, "dispatch">, user: SessionUser, keys: readonly string[]): Promise<readonly ContactAttempt[]>;
11
+ export type HelpdeskAttempt = z.infer<typeof attemptSchema>;
12
+ export declare function loadAttemptsByKey(ctx: Pick<HandlerContext, "dispatch">, user: SessionUser, keys: readonly string[]): Promise<readonly HelpdeskAttempt[]>;
13
13
  export declare function loadReadAtByKey(ctx: Pick<HandlerContext, "dispatch" | "registry">, reporterTenantId: TenantId, keys: readonly string[]): Promise<ReadonlyMap<string, Temporal.Instant | null>>;
14
14
  export {};
@@ -0,0 +1,9 @@
1
+ import { type HelpdeskSettings } from "../options.ts";
2
+ import { type HelpdeskPhoneMode } from "../web/constants.ts";
3
+ export type HelpdeskChallengeData = {
4
+ readonly challenge: string;
5
+ readonly bits: number;
6
+ readonly phone: HelpdeskPhoneMode;
7
+ readonly kinds: readonly string[];
8
+ };
9
+ export declare function createChallengeQuery(settings: HelpdeskSettings): import("@cosmicdrift/kumiko-types/define-handler").QueryHandlerDefinition<"challenge", import("zod").ZodObject<{}, import("zod/v4/core").$strict>, HelpdeskChallengeData, import("@cosmicdrift/kumiko-types/event-type-map").KumikoEventTypeMap>;
@@ -2,13 +2,13 @@ import { defineQueryHandler } from "@cosmicdrift/kumiko-framework/engine";
2
2
  import { InternalError } from "@cosmicdrift/kumiko-framework/errors";
3
3
  import { issueChallenge } from "../challenge.js";
4
4
  import { CHALLENGE_RATE_LIMIT } from "../options.js";
5
- import { ContactEmptySchema } from "../payloads.js";
6
- import { CONTACT_WEBSITE_KINDS } from "../web/constants.js";
5
+ import { HelpdeskEmptySchema } from "../payloads.js";
6
+ import { HELPDESK_WEBSITE_KINDS } from "../web/constants.js";
7
7
  import { SUBMIT_ROLES } from "./access.js";
8
8
  export function createChallengeQuery(settings) {
9
9
  return defineQueryHandler({
10
10
  name: "challenge",
11
- schema: ContactEmptySchema,
11
+ schema: HelpdeskEmptySchema,
12
12
  access: { roles: SUBMIT_ROLES, personalData: "public-intake", anySignedIn: true },
13
13
  rateLimit: CHALLENGE_RATE_LIMIT,
14
14
  agent: { expose: false },
@@ -16,7 +16,7 @@ export function createChallengeQuery(settings) {
16
16
  handler: async (_event, ctx) => {
17
17
  if (!ctx.services.redis) {
18
18
  throw new InternalError({
19
- message: "contact:challenge requires ctx.services.redis for the challenge store",
19
+ message: "helpdesk:challenge requires ctx.services.redis for the challenge store",
20
20
  });
21
21
  }
22
22
  const challenge = await issueChallenge(ctx.services.redis, {
@@ -28,7 +28,7 @@ export function createChallengeQuery(settings) {
28
28
  challenge,
29
29
  bits: settings.proofOfWorkBits,
30
30
  phone: settings.phone,
31
- kinds: CONTACT_WEBSITE_KINDS,
31
+ kinds: HELPDESK_WEBSITE_KINDS,
32
32
  };
33
33
  },
34
34
  });
@@ -0,0 +1,9 @@
1
+ import type { HelpdeskOptions } from "../options.ts";
2
+ export type HelpdeskForwardData = {
3
+ readonly kind: "forwarded";
4
+ readonly adminCount: number;
5
+ readonly telegram: boolean;
6
+ };
7
+ export declare function createForwardRequestHandler(opts: HelpdeskOptions): import("@cosmicdrift/kumiko-types/define-handler").WriteHandlerDefinition<"forward-request", import("zod").ZodObject<{
8
+ requestId: import("zod").ZodUUID;
9
+ }, import("zod/v4/core").$strict>, HelpdeskForwardData, import("@cosmicdrift/kumiko-types/event-type-map").KumikoEventTypeMap, undefined, undefined>;
@@ -1,29 +1,29 @@
1
1
  import { defineWriteHandler } from "@cosmicdrift/kumiko-framework/engine";
2
2
  import { NotFoundError, writeFailure } from "@cosmicdrift/kumiko-framework/errors";
3
- import { contactDb, internalAccess, listSystemAdminIds, platformActor, requestExecutor, sendBestEffort, } from "../lib.js";
4
- import { contactNewRequestVariables, resolveContactMailLocale } from "../mail.js";
5
- import { ContactForwardRequestSchema } from "../payloads.js";
6
- import { CONTACT_NOTIFICATION_TYPES, CONTACT_REQUEST_ENTITY, ContactConfigKeys, contactIdempotencyKeys, } from "../web/constants.js";
3
+ import { helpdeskDb, internalAccess, listSystemAdminIds, platformActor, requestExecutor, sendBestEffort, } from "../lib.js";
4
+ import { helpdeskNewRequestVariables, resolveHelpdeskMailLocale } from "../mail.js";
5
+ import { HelpdeskForwardRequestSchema } from "../payloads.js";
6
+ import { HELPDESK_NOTIFICATION_TYPES, HELPDESK_REQUEST_ENTITY, HelpdeskConfigKeys, helpdeskIdempotencyKeys, } from "../web/constants.js";
7
7
  const EMAIL_CHANNEL = "email";
8
8
  // Runs as the platform identity so the notification, the config and the bot token secret are
9
9
  // read in the system tenant, whoever filed the request.
10
10
  export function createForwardRequestHandler(opts) {
11
11
  return defineWriteHandler({
12
12
  name: "forward-request",
13
- schema: ContactForwardRequestSchema,
13
+ schema: HelpdeskForwardRequestSchema,
14
14
  access: internalAccess,
15
15
  agent: { expose: false },
16
16
  description: "Internal: forwards a stored contact request to every SystemAdmin by mail and, when a Telegram chat is configured, to that chat. Only the platform identity can call it.",
17
17
  handler: async (event, ctx) => {
18
- const db = contactDb(ctx);
18
+ const db = helpdeskDb(ctx);
19
19
  const request = await requestExecutor.detail({ id: event.payload.requestId }, platformActor(), db);
20
20
  if (!request) {
21
- return writeFailure(new NotFoundError(CONTACT_REQUEST_ENTITY, event.payload.requestId));
21
+ return writeFailure(new NotFoundError(HELPDESK_REQUEST_ENTITY, event.payload.requestId));
22
22
  }
23
23
  const requestId = event.payload.requestId;
24
24
  const adminLocale = opts.adminLocale;
25
25
  const link = opts.requestLink?.(requestId);
26
- const data = contactNewRequestVariables({
26
+ const data = helpdeskNewRequestVariables({
27
27
  kind: request.kind,
28
28
  appName: opts.appName,
29
29
  link,
@@ -31,25 +31,27 @@ export function createForwardRequestHandler(opts) {
31
31
  });
32
32
  const adminIds = await listSystemAdminIds(db);
33
33
  if (adminIds.length > 0) {
34
- await sendBestEffort(ctx, "admin mail", (notify) => notify(CONTACT_NOTIFICATION_TYPES.newRequest, {
34
+ await sendBestEffort(ctx, "admin mail", (notify) => notify(HELPDESK_NOTIFICATION_TYPES.newRequest, {
35
35
  to: adminIds,
36
36
  channels: [EMAIL_CHANNEL],
37
37
  data,
38
- idempotencyKey: contactIdempotencyKeys.admins(requestId),
38
+ idempotencyKey: helpdeskIdempotencyKeys.admins(requestId),
39
39
  priority: "normal",
40
- locale: resolveContactMailLocale(adminLocale),
40
+ locale: resolveHelpdeskMailLocale(adminLocale),
41
41
  }));
42
42
  }
43
- const chatId = opts.telegram ? await ctx.config?.(ContactConfigKeys.telegramChat) : undefined;
43
+ const chatId = opts.telegram
44
+ ? await ctx.config?.(HelpdeskConfigKeys.telegramChat)
45
+ : undefined;
44
46
  const telegram = opts.telegram === true && typeof chatId === "string" && chatId.trim() !== "";
45
47
  if (telegram) {
46
- await sendBestEffort(ctx, "telegram", (notify) => notify(CONTACT_NOTIFICATION_TYPES.newRequest, {
48
+ await sendBestEffort(ctx, "telegram", (notify) => notify(HELPDESK_NOTIFICATION_TYPES.newRequest, {
47
49
  route: { telegram: chatId.trim() },
48
50
  recipientId: requestId,
49
51
  data,
50
- idempotencyKey: contactIdempotencyKeys.telegram(requestId),
52
+ idempotencyKey: helpdeskIdempotencyKeys.telegram(requestId),
51
53
  priority: "normal",
52
- locale: resolveContactMailLocale(adminLocale),
54
+ locale: resolveHelpdeskMailLocale(adminLocale),
53
55
  }));
54
56
  }
55
57
  return {
@@ -1,7 +1,7 @@
1
- export type ContactMarkDoneData = {
1
+ export type HelpdeskMarkDoneData = {
2
2
  readonly kind: "marked";
3
3
  readonly changed: number;
4
4
  };
5
5
  export declare const markDoneHandler: import("@cosmicdrift/kumiko-types/define-handler").WriteHandlerDefinition<"mark-done", import("zod").ZodObject<{
6
6
  id: import("zod").ZodUUID;
7
- }, import("zod/v4/core").$strict>, ContactMarkDoneData, import("@cosmicdrift/kumiko-types/event-type-map").KumikoEventTypeMap, undefined, undefined>;
7
+ }, import("zod/v4/core").$strict>, HelpdeskMarkDoneData, import("@cosmicdrift/kumiko-types/event-type-map").KumikoEventTypeMap, undefined, undefined>;
@@ -1,27 +1,27 @@
1
1
  import { defineWriteHandler } from "@cosmicdrift/kumiko-framework/engine";
2
2
  import { NotFoundError, writeFailure } from "@cosmicdrift/kumiko-framework/errors";
3
- import { adminAccess, contactDb, platformActor, requestExecutor } from "../lib.js";
4
- import { ContactMarkDoneSchema } from "../payloads.js";
5
- import { CONTACT_REQUEST_ENTITY, CONTACT_STATUS } from "../web/constants.js";
3
+ import { adminAccess, helpdeskDb, platformActor, requestExecutor } from "../lib.js";
4
+ import { HelpdeskMarkDoneSchema } from "../payloads.js";
5
+ import { HELPDESK_REQUEST_ENTITY, HELPDESK_STATUS } from "../web/constants.js";
6
6
  export const markDoneHandler = defineWriteHandler({
7
7
  name: "mark-done",
8
- schema: ContactMarkDoneSchema,
8
+ schema: HelpdeskMarkDoneSchema,
9
9
  access: adminAccess,
10
10
  agent: { expose: false },
11
11
  description: "Marks one contact request as done without sending a reply; a finished request is left as it is.",
12
12
  handler: async (event, ctx) => {
13
- const db = contactDb(ctx);
13
+ const db = helpdeskDb(ctx);
14
14
  const { id } = event.payload;
15
15
  const request = await requestExecutor.detail({ id }, platformActor(), db);
16
16
  if (!request)
17
- return writeFailure(new NotFoundError(CONTACT_REQUEST_ENTITY, id));
18
- if (request.status === CONTACT_STATUS.Done) {
17
+ return writeFailure(new NotFoundError(HELPDESK_REQUEST_ENTITY, id));
18
+ if (request.status === HELPDESK_STATUS.Done) {
19
19
  return { isSuccess: true, data: { kind: "marked", changed: 0 } };
20
20
  }
21
21
  const updated = await requestExecutor.update({
22
22
  id,
23
23
  version: request.version,
24
- changes: { status: CONTACT_STATUS.Done, closedAt: ctx.tz.now() },
24
+ changes: { status: HELPDESK_STATUS.Done, closedAt: ctx.tz.now() },
25
25
  }, platformActor(), db);
26
26
  if (!updated.isSuccess)
27
27
  return updated;
@@ -1,4 +1,4 @@
1
- export type ContactNotifyReporterData = {
1
+ export type HelpdeskNotifyReporterData = {
2
2
  readonly kind: "notified" | "skipped";
3
3
  };
4
4
  export declare const notifyReporterInAppHandler: import("@cosmicdrift/kumiko-types/define-handler").WriteHandlerDefinition<"notify-reporter-in-app", import("zod").ZodObject<{
@@ -7,4 +7,4 @@ export declare const notifyReporterInAppHandler: import("@cosmicdrift/kumiko-typ
7
7
  userId: import("zod").ZodUUID;
8
8
  authorName: import("zod").ZodString;
9
9
  locale: import("zod").ZodOptional<import("zod").ZodString>;
10
- }, import("zod/v4/core").$strict>, ContactNotifyReporterData, import("@cosmicdrift/kumiko-types/event-type-map").KumikoEventTypeMap, undefined, undefined>;
10
+ }, import("zod/v4/core").$strict>, HelpdeskNotifyReporterData, import("@cosmicdrift/kumiko-types/event-type-map").KumikoEventTypeMap, undefined, undefined>;
@@ -1,35 +1,35 @@
1
1
  import { fetchOne } from "@cosmicdrift/kumiko-framework/db";
2
2
  import { defineWriteHandler } from "@cosmicdrift/kumiko-framework/engine";
3
3
  import { tenantMembershipsTable } from "../../tenant/index.js";
4
- import { contactDb, IN_APP_FEATURE, internalAccess, sendBestEffort } from "../lib.js";
5
- import { contactReplyInAppData, resolveContactMailLocale } from "../mail.js";
6
- import { ContactNotifyReporterInAppSchema } from "../payloads.js";
7
- import { CONTACT_NOTIFICATION_TYPES, contactIdempotencyKeys } from "../web/constants.js";
4
+ import { helpdeskDb, IN_APP_FEATURE, internalAccess, sendBestEffort } from "../lib.js";
5
+ import { helpdeskReplyInAppData, resolveHelpdeskMailLocale } from "../mail.js";
6
+ import { HelpdeskNotifyReporterInAppSchema } from "../payloads.js";
7
+ import { HELPDESK_NOTIFICATION_TYPES, helpdeskIdempotencyKeys } from "../web/constants.js";
8
8
  // Runs as the platform identity of the reporter's tenant, so the in-app note lands in that
9
9
  // tenant's inbox. The note names the author only; the answer itself goes by mail.
10
10
  export const notifyReporterInAppHandler = defineWriteHandler({
11
11
  name: "notify-reporter-in-app",
12
- schema: ContactNotifyReporterInAppSchema,
12
+ schema: HelpdeskNotifyReporterInAppSchema,
13
13
  access: internalAccess,
14
14
  agent: { expose: false },
15
- description: "Internal: adds an in-app note about a contact reply to a signed-in reporter in the reporter's own tenant; skipped when the reporter is no longer a member or in-app delivery is not mounted.",
15
+ description: "Internal: adds an in-app note about a helpdesk reply to a signed-in reporter in the reporter's own tenant; skipped when the reporter is no longer a member or in-app delivery is not mounted.",
16
16
  handler: async (event, ctx) => {
17
17
  const { userId, replyId, authorName, locale } = event.payload;
18
18
  if (!(await ctx.hasFeature(IN_APP_FEATURE)))
19
19
  return { isSuccess: true, data: { kind: "skipped" } };
20
- const membership = await fetchOne(contactDb(ctx), tenantMembershipsTable, {
20
+ const membership = await fetchOne(helpdeskDb(ctx), tenantMembershipsTable, {
21
21
  userId,
22
22
  tenantId: event.user.tenantId,
23
23
  });
24
24
  if (!membership)
25
25
  return { isSuccess: true, data: { kind: "skipped" } };
26
- await sendBestEffort(ctx, "reply in-app note", (notify) => notify(CONTACT_NOTIFICATION_TYPES.replyInApp, {
26
+ await sendBestEffort(ctx, "reply in-app note", (notify) => notify(HELPDESK_NOTIFICATION_TYPES.replyInApp, {
27
27
  route: { inApp: userId },
28
28
  recipientId: userId,
29
- data: contactReplyInAppData({ authorName, locale }),
30
- idempotencyKey: contactIdempotencyKeys.replyInApp(replyId),
29
+ data: helpdeskReplyInAppData({ authorName, locale }),
30
+ idempotencyKey: helpdeskIdempotencyKeys.replyInApp(replyId),
31
31
  priority: "normal",
32
- locale: resolveContactMailLocale(locale),
32
+ locale: resolveHelpdeskMailLocale(locale),
33
33
  }));
34
34
  return { isSuccess: true, data: { kind: "notified" } };
35
35
  },
@@ -1,9 +1,9 @@
1
1
  import { platformActor, requestExecutor } from "../lib.js";
2
- import { CONTACT_STATUS } from "../web/constants.js";
2
+ import { HELPDESK_STATUS } from "../web/constants.js";
3
3
  // Open means no answer yet; an answered request counts as handled even before it is marked done.
4
4
  export async function countOpenRequests(db) {
5
5
  const found = await requestExecutor.list({
6
- filter: { field: "status", op: "eq", value: CONTACT_STATUS.Open },
6
+ filter: { field: "status", op: "eq", value: HELPDESK_STATUS.Open },
7
7
  limit: 1,
8
8
  totalCount: true,
9
9
  }, platformActor(), db);
@@ -1,13 +1,13 @@
1
1
  import { defineQueryHandler } from "@cosmicdrift/kumiko-framework/engine";
2
- import { adminAccess, contactDb } from "../lib.js";
3
- import { ContactEmptySchema } from "../payloads.js";
2
+ import { adminAccess, helpdeskDb } from "../lib.js";
3
+ import { HelpdeskEmptySchema } from "../payloads.js";
4
4
  import { countOpenRequests } from "./open-count.js";
5
5
  export const openCountQuery = defineQueryHandler({
6
6
  name: "open-count",
7
- schema: ContactEmptySchema,
7
+ schema: HelpdeskEmptySchema,
8
8
  access: adminAccess,
9
9
  description: "Counts the contact requests that still wait for a first answer, for the dashboard tile.",
10
10
  handler: async (_event, ctx) => {
11
- return { count: await countOpenRequests(contactDb(ctx)) };
11
+ return { count: await countOpenRequests(helpdeskDb(ctx)) };
12
12
  },
13
13
  });