@cosmicdrift/kumiko-samples 0.411.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 (182) 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/agent-doc-lint.ts +64 -3
  5. package/packages/bundled-features/src/agent-tools/agent-manifest.ts +13 -130
  6. package/packages/bundled-features/src/agent-tools/api-docs/anchors.ts +60 -0
  7. package/packages/bundled-features/src/agent-tools/api-docs/check.ts +25 -0
  8. package/packages/bundled-features/src/agent-tools/api-docs/collect-events.ts +140 -0
  9. package/packages/bundled-features/src/agent-tools/api-docs/collect.ts +175 -0
  10. package/packages/bundled-features/src/agent-tools/api-docs/curl.ts +28 -0
  11. package/packages/bundled-features/src/agent-tools/api-docs/error-table.ts +45 -0
  12. package/packages/bundled-features/src/agent-tools/api-docs/examples.ts +43 -0
  13. package/packages/bundled-features/src/agent-tools/api-docs/generate.ts +179 -0
  14. package/packages/bundled-features/src/agent-tools/api-docs/index-json.ts +29 -0
  15. package/packages/bundled-features/src/agent-tools/api-docs/index.ts +21 -0
  16. package/packages/bundled-features/src/agent-tools/api-docs/list-parameters.ts +38 -0
  17. package/packages/bundled-features/src/agent-tools/api-docs/markdown.ts +70 -0
  18. package/packages/bundled-features/src/agent-tools/api-docs/menu-path.ts +82 -0
  19. package/packages/bundled-features/src/agent-tools/api-docs/model.ts +83 -0
  20. package/packages/bundled-features/src/agent-tools/api-docs/problems.ts +58 -0
  21. package/packages/bundled-features/src/agent-tools/api-docs/render-events.ts +76 -0
  22. package/packages/bundled-features/src/agent-tools/api-docs/render-openapi.ts +216 -0
  23. package/packages/bundled-features/src/agent-tools/api-docs/render-overview.ts +86 -0
  24. package/packages/bundled-features/src/agent-tools/api-docs/render-reference.ts +79 -0
  25. package/packages/bundled-features/src/agent-tools/api-docs/render-tokens.ts +136 -0
  26. package/packages/bundled-features/src/agent-tools/api-docs/schema-fields.ts +167 -0
  27. package/packages/bundled-features/src/agent-tools/api-docs/section-ids.ts +28 -0
  28. package/packages/bundled-features/src/agent-tools/api-docs/system-only.ts +11 -0
  29. package/packages/bundled-features/src/agent-tools/api-docs/texts/de.ts +166 -0
  30. package/packages/bundled-features/src/agent-tools/api-docs/texts/en.ts +159 -0
  31. package/packages/bundled-features/src/agent-tools/api-docs/texts/es.ts +162 -0
  32. package/packages/bundled-features/src/agent-tools/api-docs/texts/fr.ts +169 -0
  33. package/packages/bundled-features/src/agent-tools/api-docs/texts/index.ts +67 -0
  34. package/packages/bundled-features/src/agent-tools/api-docs/texts/it.ts +165 -0
  35. package/packages/bundled-features/src/agent-tools/api-docs/texts/types.ts +130 -0
  36. package/packages/bundled-features/src/agent-tools/api-docs/ui-writes.ts +81 -0
  37. package/packages/bundled-features/src/agent-tools/changes.json +24 -0
  38. package/packages/bundled-features/src/agent-tools/handler-schema.ts +45 -0
  39. package/packages/bundled-features/src/agent-tools/index.ts +24 -0
  40. package/packages/bundled-features/src/agent-tools/labels.ts +181 -0
  41. package/packages/bundled-features/src/auth-email-password/boot-rules.ts +9 -0
  42. package/packages/bundled-features/src/auth-email-password/feature.ts +6 -19
  43. package/packages/bundled-features/src/auth-email-password/validate-options.ts +20 -0
  44. package/packages/bundled-features/src/billing-foundation/boot-rules.ts +26 -0
  45. package/packages/bundled-features/src/billing-foundation/validate-options.ts +59 -46
  46. package/packages/bundled-features/src/cap-overview/boot-rules.ts +14 -0
  47. package/packages/bundled-features/src/cap-overview/feature.ts +12 -5
  48. package/packages/bundled-features/src/documents/boot-rules.ts +14 -0
  49. package/packages/bundled-features/src/documents/feature.ts +8 -4
  50. package/packages/bundled-features/src/file-derivatives/boot-rules.ts +9 -0
  51. package/packages/bundled-features/src/file-derivatives/feature.ts +6 -3
  52. package/packages/bundled-features/src/folders/boot-rules.ts +9 -0
  53. package/packages/bundled-features/src/folders/feature.ts +6 -3
  54. package/packages/bundled-features/src/helpdesk/boot-rules.ts +9 -0
  55. package/packages/bundled-features/src/{contact → helpdesk}/challenge.ts +2 -2
  56. package/packages/bundled-features/src/{contact → helpdesk}/changes.json +6 -0
  57. package/packages/bundled-features/src/{contact/client/contact-client-source.ts → helpdesk/client/helpdesk-client-source.ts} +4 -4
  58. package/packages/bundled-features/src/helpdesk/client/helpdesk-website-client.ts +29 -0
  59. package/packages/bundled-features/src/helpdesk/client/index.ts +9 -0
  60. package/packages/bundled-features/src/{contact → helpdesk}/entity.ts +35 -31
  61. package/packages/bundled-features/src/{contact → helpdesk}/feature.ts +56 -52
  62. package/packages/bundled-features/src/{contact → helpdesk}/handlers/attempts.ts +3 -3
  63. package/packages/bundled-features/src/{contact → helpdesk}/handlers/challenge.query.ts +10 -10
  64. package/packages/bundled-features/src/{contact → helpdesk}/handlers/forward-request.write.ts +25 -23
  65. package/packages/bundled-features/src/{contact → helpdesk}/handlers/mark-done.write.ts +11 -11
  66. package/packages/bundled-features/src/{contact → helpdesk}/handlers/notify-reporter-in-app.write.ts +14 -14
  67. package/packages/bundled-features/src/{contact → helpdesk}/handlers/open-count.query.ts +4 -4
  68. package/packages/bundled-features/src/{contact → helpdesk}/handlers/open-count.ts +2 -2
  69. package/packages/bundled-features/src/{contact → helpdesk}/handlers/replies.query.ts +6 -6
  70. package/packages/bundled-features/src/{contact → helpdesk}/handlers/reply.write.ts +30 -30
  71. package/packages/bundled-features/src/{contact → helpdesk}/handlers/report.write.ts +29 -29
  72. package/packages/bundled-features/src/{contact → helpdesk}/handlers/request-delivery.query.ts +40 -40
  73. package/packages/bundled-features/src/{contact → helpdesk}/handlers/request-detail.query.ts +15 -15
  74. package/packages/bundled-features/src/{contact → helpdesk}/handlers/request-list.query.ts +2 -2
  75. package/packages/bundled-features/src/{contact → helpdesk}/handlers/send-reply-mail.write.ts +24 -24
  76. package/packages/bundled-features/src/{contact → helpdesk}/handlers/send-test.write.ts +18 -14
  77. package/packages/bundled-features/src/{contact → helpdesk}/handlers/submit.write.ts +32 -31
  78. package/packages/bundled-features/src/{contact → helpdesk}/handlers/take-over-uploads.ts +5 -5
  79. package/packages/bundled-features/src/{contact → helpdesk}/i18n.ts +78 -75
  80. package/packages/bundled-features/src/helpdesk/index.ts +29 -0
  81. package/packages/bundled-features/src/{contact → helpdesk}/lib.ts +32 -28
  82. package/packages/bundled-features/src/{contact → helpdesk}/mail.ts +56 -56
  83. package/packages/bundled-features/src/{contact → helpdesk}/options.ts +18 -16
  84. package/packages/bundled-features/src/helpdesk/panels.ts +28 -0
  85. package/packages/bundled-features/src/{contact → helpdesk}/payloads.ts +33 -33
  86. package/packages/bundled-features/src/{contact → helpdesk}/screens.ts +104 -104
  87. package/packages/bundled-features/src/{contact → helpdesk}/subject.ts +3 -3
  88. package/packages/bundled-features/src/{contact → helpdesk}/user-data-hooks.ts +17 -17
  89. package/packages/bundled-features/src/helpdesk/web/constants.ts +160 -0
  90. package/packages/bundled-features/src/helpdesk/web/index.ts +29 -0
  91. package/packages/bundled-features/src/host-routing/boot-rules.ts +27 -0
  92. package/packages/bundled-features/src/host-routing/validate-options.ts +36 -27
  93. package/packages/bundled-features/src/inbound-mail-foundation/changes.json +6 -0
  94. package/packages/bundled-features/src/inbound-mail-foundation/entities.ts +99 -71
  95. package/packages/bundled-features/src/inbound-mail-foundation/feature.ts +2 -2
  96. package/packages/bundled-features/src/jobs/boot-rules.ts +9 -0
  97. package/packages/bundled-features/src/jobs/feature.ts +9 -4
  98. package/packages/bundled-features/src/legal-pages/boot-rules.ts +19 -0
  99. package/packages/bundled-features/src/legal-pages/feature.ts +6 -3
  100. package/packages/bundled-features/src/legal-pages/lib/validate-routes.ts +11 -5
  101. package/packages/bundled-features/src/metrics/boot-rules.ts +15 -0
  102. package/packages/bundled-features/src/metrics/validate.ts +8 -2
  103. package/packages/bundled-features/src/notes-history/boot-rules.ts +9 -0
  104. package/packages/bundled-features/src/notes-history/feature.ts +6 -3
  105. package/packages/bundled-features/src/personal-access-tokens/boot-rules.ts +9 -0
  106. package/packages/bundled-features/src/personal-access-tokens/changes.json +6 -0
  107. package/packages/bundled-features/src/personal-access-tokens/feature.ts +5 -2
  108. package/packages/bundled-features/src/personal-access-tokens/handlers/create.write.ts +7 -2
  109. package/packages/bundled-features/src/personal-access-tokens/i18n.ts +6 -1
  110. package/packages/bundled-features/src/personal-access-tokens/index.ts +37 -2
  111. package/packages/bundled-features/src/personal-access-tokens/scope-events-check.ts +31 -0
  112. package/packages/bundled-features/src/personal-access-tokens/screens.ts +9 -1
  113. package/packages/bundled-features/src/personal-access-tokens/web/constants.ts +1 -0
  114. package/packages/bundled-features/src/personal-access-tokens/web/scopes.ts +14 -0
  115. package/packages/bundled-features/src/presence/boot-rules.ts +9 -0
  116. package/packages/bundled-features/src/presence/options.ts +5 -1
  117. package/packages/bundled-features/src/readiness/boot-rules.ts +14 -0
  118. package/packages/bundled-features/src/readiness/probe-boot-check.ts +8 -6
  119. package/packages/bundled-features/src/shared/assert-no-where-rule-in-ownership-write.ts +6 -4
  120. package/packages/bundled-features/src/shared/boot-rules.ts +9 -0
  121. package/packages/bundled-features/src/subscription-mollie/boot-rules.ts +19 -0
  122. package/packages/bundled-features/src/subscription-mollie/feature.ts +18 -10
  123. package/packages/bundled-features/src/tags/boot-rules.ts +9 -0
  124. package/packages/bundled-features/src/tags/feature.ts +6 -3
  125. package/packages/bundled-features/src/template-resolver/boot-rules.ts +19 -0
  126. package/packages/bundled-features/src/template-resolver/feature.ts +14 -10
  127. package/packages/bundled-features/src/tenant/boot-rules.ts +9 -0
  128. package/packages/bundled-features/src/tenant/feature.ts +5 -3
  129. package/samples/apps/marketing-demo/README.md +1 -1
  130. package/samples/apps/marketing-demo/playwright.config.ts +1 -1
  131. package/samples/apps/marketing-demo/src/app/client.tsx +3 -3
  132. package/samples/apps/marketing-demo/src/app/seed-data.ts +1 -1
  133. package/samples/apps/marketing-demo/src/app/seed.ts +4 -4
  134. package/samples/apps/marketing-demo/src/app/server.ts +3 -3
  135. package/samples/apps/marketing-demo/src/features/{helpdesk → ticketing}/feature.ts +15 -12
  136. package/samples/apps/marketing-demo/src/features/ticketing/i18n.ts +100 -0
  137. package/samples/apps/marketing-demo/src/features/{helpdesk → ticketing}/schema/ticket.ts +4 -4
  138. package/samples/apps/marketing-demo/src/features/ticketing/web/index.ts +7 -0
  139. package/samples/apps/use-all-bundled/feature-manifest.json +67 -67
  140. package/samples/apps/use-all-bundled/kumiko/migrations/0064_helpdesk-rename.rebuild.json +4 -0
  141. package/samples/apps/use-all-bundled/package.json +1 -1
  142. package/samples/apps/use-all-bundled/src/app/client.tsx +1 -1
  143. package/samples/apps/use-all-bundled/src/app/screens-feature.ts +10 -10
  144. package/samples/apps/use-all-bundled/src/run-config.ts +6 -6
  145. package/samples/recipes/api-docs/README.md +52 -0
  146. package/samples/recipes/api-docs/api-docs/de/events.md +62 -0
  147. package/samples/recipes/api-docs/api-docs/de/overview.md +100 -0
  148. package/samples/recipes/api-docs/api-docs/de/reference/tickets.md +305 -0
  149. package/samples/recipes/api-docs/api-docs/de/tokens.md +66 -0
  150. package/samples/recipes/api-docs/api-docs/en/events.md +62 -0
  151. package/samples/recipes/api-docs/api-docs/en/overview.md +100 -0
  152. package/samples/recipes/api-docs/api-docs/en/reference/tickets.md +305 -0
  153. package/samples/recipes/api-docs/api-docs/en/tokens.md +66 -0
  154. package/samples/recipes/api-docs/api-docs/index.json +371 -0
  155. package/samples/recipes/api-docs/api-docs/openapi.json +982 -0
  156. package/samples/recipes/api-docs/api-examples/ticket-close.json +21 -0
  157. package/samples/recipes/api-docs/api-examples/ticket-create.json +42 -0
  158. package/samples/recipes/api-docs/api-examples/ticket-detail.json +28 -0
  159. package/samples/recipes/api-docs/api-examples/ticket-list.json +31 -0
  160. package/samples/recipes/api-docs/api-examples/ticket-update.json +54 -0
  161. package/samples/recipes/api-docs/api-examples/webhooks/ticket-closed.json +8 -0
  162. package/samples/recipes/api-docs/api-examples/webhooks/ticket-created.json +10 -0
  163. package/samples/recipes/api-docs/kumiko.config.ts +33 -0
  164. package/samples/recipes/api-docs/package.json +14 -0
  165. package/samples/recipes/api-docs/src/feature.ts +218 -0
  166. package/samples/recipes/api-docs/tsconfig.json +22 -0
  167. package/samples/recipes/golden-path/src/feature.ts +1 -1
  168. package/samples/recipes/{contact → helpdesk}/README.md +16 -16
  169. package/samples/recipes/{contact → helpdesk}/package.json +2 -2
  170. package/samples/recipes/{contact → helpdesk}/src/feature.ts +6 -6
  171. package/packages/bundled-features/src/contact/client/contact-website-client.ts +0 -29
  172. package/packages/bundled-features/src/contact/client/index.ts +0 -9
  173. package/packages/bundled-features/src/contact/index.ts +0 -29
  174. package/packages/bundled-features/src/contact/panels.ts +0 -28
  175. package/packages/bundled-features/src/contact/web/constants.ts +0 -160
  176. package/packages/bundled-features/src/contact/web/index.ts +0 -29
  177. package/samples/apps/marketing-demo/src/features/helpdesk/i18n.ts +0 -100
  178. package/samples/apps/marketing-demo/src/features/helpdesk/web/index.ts +0 -7
  179. /package/packages/bundled-features/src/{contact → helpdesk}/handlers/access.ts +0 -0
  180. /package/packages/bundled-features/src/{contact → helpdesk}/pow.ts +0 -0
  181. /package/packages/bundled-features/src/{contact → helpdesk}/user-agent.ts +0 -0
  182. /package/samples/apps/marketing-demo/src/features/{helpdesk → ticketing}/schema/index.ts +0 -0
@@ -1,35 +1,35 @@
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.ts";
4
- import { ContactMarkDoneSchema } from "../payloads.ts";
5
- import { CONTACT_REQUEST_ENTITY, CONTACT_STATUS } from "../web/constants.ts";
3
+ import { adminAccess, helpdeskDb, platformActor, requestExecutor } from "../lib.ts";
4
+ import { HelpdeskMarkDoneSchema } from "../payloads.ts";
5
+ import { HELPDESK_REQUEST_ENTITY, HELPDESK_STATUS } from "../web/constants.ts";
6
6
 
7
- export type ContactMarkDoneData = { readonly kind: "marked"; readonly changed: number };
7
+ export type HelpdeskMarkDoneData = { readonly kind: "marked"; readonly changed: number };
8
8
 
9
9
  export const markDoneHandler = defineWriteHandler<
10
10
  "mark-done",
11
- typeof ContactMarkDoneSchema,
12
- ContactMarkDoneData
11
+ typeof HelpdeskMarkDoneSchema,
12
+ HelpdeskMarkDoneData
13
13
  >({
14
14
  name: "mark-done",
15
- schema: ContactMarkDoneSchema,
15
+ schema: HelpdeskMarkDoneSchema,
16
16
  access: adminAccess,
17
17
  agent: { expose: false },
18
18
  description:
19
19
  "Marks one contact request as done without sending a reply; a finished request is left as it is.",
20
20
  handler: async (event, ctx) => {
21
- const db = contactDb(ctx);
21
+ const db = helpdeskDb(ctx);
22
22
  const { id } = event.payload;
23
23
  const request = await requestExecutor.detail({ id }, platformActor(), db);
24
- if (!request) return writeFailure(new NotFoundError(CONTACT_REQUEST_ENTITY, id));
25
- if (request.status === CONTACT_STATUS.Done) {
24
+ if (!request) return writeFailure(new NotFoundError(HELPDESK_REQUEST_ENTITY, id));
25
+ if (request.status === HELPDESK_STATUS.Done) {
26
26
  return { isSuccess: true, data: { kind: "marked", changed: 0 } };
27
27
  }
28
28
  const updated = await requestExecutor.update(
29
29
  {
30
30
  id,
31
31
  version: request.version,
32
- changes: { status: CONTACT_STATUS.Done, closedAt: ctx.tz.now() },
32
+ changes: { status: HELPDESK_STATUS.Done, closedAt: ctx.tz.now() },
33
33
  },
34
34
  platformActor(),
35
35
  db,
@@ -1,12 +1,12 @@
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.ts";
4
- import { contactDb, IN_APP_FEATURE, internalAccess, sendBestEffort } from "../lib.ts";
5
- import { contactReplyInAppData, resolveContactMailLocale } from "../mail.ts";
6
- import { ContactNotifyReporterInAppSchema } from "../payloads.ts";
7
- import { CONTACT_NOTIFICATION_TYPES, contactIdempotencyKeys } from "../web/constants.ts";
4
+ import { helpdeskDb, IN_APP_FEATURE, internalAccess, sendBestEffort } from "../lib.ts";
5
+ import { helpdeskReplyInAppData, resolveHelpdeskMailLocale } from "../mail.ts";
6
+ import { HelpdeskNotifyReporterInAppSchema } from "../payloads.ts";
7
+ import { HELPDESK_NOTIFICATION_TYPES, helpdeskIdempotencyKeys } from "../web/constants.ts";
8
8
 
9
- export type ContactNotifyReporterData = {
9
+ export type HelpdeskNotifyReporterData = {
10
10
  readonly kind: "notified" | "skipped";
11
11
  };
12
12
 
@@ -14,33 +14,33 @@ export type ContactNotifyReporterData = {
14
14
  // tenant's inbox. The note names the author only; the answer itself goes by mail.
15
15
  export const notifyReporterInAppHandler = defineWriteHandler<
16
16
  "notify-reporter-in-app",
17
- typeof ContactNotifyReporterInAppSchema,
18
- ContactNotifyReporterData
17
+ typeof HelpdeskNotifyReporterInAppSchema,
18
+ HelpdeskNotifyReporterData
19
19
  >({
20
20
  name: "notify-reporter-in-app",
21
- schema: ContactNotifyReporterInAppSchema,
21
+ schema: HelpdeskNotifyReporterInAppSchema,
22
22
  access: internalAccess,
23
23
  agent: { expose: false },
24
24
  description:
25
- "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.",
25
+ "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.",
26
26
  handler: async (event, ctx) => {
27
27
  const { userId, replyId, authorName, locale } = event.payload;
28
28
  if (!(await ctx.hasFeature(IN_APP_FEATURE)))
29
29
  return { isSuccess: true, data: { kind: "skipped" } };
30
- const membership = await fetchOne(contactDb(ctx), tenantMembershipsTable, {
30
+ const membership = await fetchOne(helpdeskDb(ctx), tenantMembershipsTable, {
31
31
  userId,
32
32
  tenantId: event.user.tenantId,
33
33
  });
34
34
  if (!membership) return { isSuccess: true, data: { kind: "skipped" } };
35
35
 
36
36
  await sendBestEffort(ctx, "reply in-app note", (notify) =>
37
- notify(CONTACT_NOTIFICATION_TYPES.replyInApp, {
37
+ notify(HELPDESK_NOTIFICATION_TYPES.replyInApp, {
38
38
  route: { inApp: userId },
39
39
  recipientId: userId,
40
- data: contactReplyInAppData({ authorName, locale }),
41
- idempotencyKey: contactIdempotencyKeys.replyInApp(replyId),
40
+ data: helpdeskReplyInAppData({ authorName, locale }),
41
+ idempotencyKey: helpdeskIdempotencyKeys.replyInApp(replyId),
42
42
  priority: "normal",
43
- locale: resolveContactMailLocale(locale),
43
+ locale: resolveHelpdeskMailLocale(locale),
44
44
  }),
45
45
  );
46
46
  return { isSuccess: true, data: { kind: "notified" } };
@@ -1,15 +1,15 @@
1
1
  import { defineQueryHandler } from "@cosmicdrift/kumiko-framework/engine";
2
- import { adminAccess, contactDb } from "../lib.ts";
3
- import { ContactEmptySchema } from "../payloads.ts";
2
+ import { adminAccess, helpdeskDb } from "../lib.ts";
3
+ import { HelpdeskEmptySchema } from "../payloads.ts";
4
4
  import { countOpenRequests } from "./open-count.ts";
5
5
 
6
6
  export const openCountQuery = defineQueryHandler({
7
7
  name: "open-count",
8
- schema: ContactEmptySchema,
8
+ schema: HelpdeskEmptySchema,
9
9
  access: adminAccess,
10
10
  description:
11
11
  "Counts the contact requests that still wait for a first answer, for the dashboard tile.",
12
12
  handler: async (_event, ctx) => {
13
- return { count: await countOpenRequests(contactDb(ctx)) };
13
+ return { count: await countOpenRequests(helpdeskDb(ctx)) };
14
14
  },
15
15
  });
@@ -1,12 +1,12 @@
1
1
  import type { TenantDb } from "@cosmicdrift/kumiko-framework/db";
2
2
  import { platformActor, requestExecutor } from "../lib.ts";
3
- import { CONTACT_STATUS } from "../web/constants.ts";
3
+ import { HELPDESK_STATUS } from "../web/constants.ts";
4
4
 
5
5
  // Open means no answer yet; an answered request counts as handled even before it is marked done.
6
6
  export async function countOpenRequests(db: TenantDb): Promise<number> {
7
7
  const found = await requestExecutor.list(
8
8
  {
9
- filter: { field: "status", op: "eq", value: CONTACT_STATUS.Open },
9
+ filter: { field: "status", op: "eq", value: HELPDESK_STATUS.Open },
10
10
  limit: 1,
11
11
  totalCount: true,
12
12
  },
@@ -1,20 +1,20 @@
1
1
  import { defineQueryHandler } from "@cosmicdrift/kumiko-framework/engine";
2
2
  import { NotFoundError } from "@cosmicdrift/kumiko-framework/errors";
3
- import { adminAccess, contactDb, listRepliesOf, platformActor, requestExecutor } from "../lib.ts";
4
- import { ContactIdSchema } from "../payloads.ts";
5
- import { CONTACT_REQUEST_ENTITY } from "../web/constants.ts";
3
+ import { adminAccess, helpdeskDb, listRepliesOf, platformActor, requestExecutor } from "../lib.ts";
4
+ import { HelpdeskIdSchema } from "../payloads.ts";
5
+ import { HELPDESK_REQUEST_ENTITY } from "../web/constants.ts";
6
6
 
7
7
  export const repliesQuery = defineQueryHandler({
8
8
  name: "replies",
9
- schema: ContactIdSchema,
9
+ schema: HelpdeskIdSchema,
10
10
  access: adminAccess,
11
11
  description:
12
12
  "Returns the answers SystemAdmins sent to one contact request (id, sent time, author name, message), oldest first, as flat rows for a related list; the request itself is not part of it.",
13
13
  handler: async (event, ctx) => {
14
- const db = contactDb(ctx);
14
+ const db = helpdeskDb(ctx);
15
15
  const { id } = event.payload;
16
16
  const request = await requestExecutor.detail({ id }, platformActor(), db);
17
- if (!request) throw new NotFoundError(CONTACT_REQUEST_ENTITY, id);
17
+ if (!request) throw new NotFoundError(HELPDESK_REQUEST_ENTITY, id);
18
18
  const replies = await listRepliesOf(db, id);
19
19
  return {
20
20
  rows: replies.map((reply) => ({
@@ -12,7 +12,7 @@ import { generateId } from "@cosmicdrift/kumiko-framework/utils";
12
12
  import { parseTenantId } from "@cosmicdrift/kumiko-types/identifiers";
13
13
  import {
14
14
  adminAccess,
15
- contactDb,
15
+ helpdeskDb,
16
16
  loadUserLabel,
17
17
  pickReplyChannels,
18
18
  platformActor,
@@ -20,23 +20,23 @@ import {
20
20
  requestExecutor,
21
21
  sendBestEffort,
22
22
  } from "../lib.ts";
23
- import { ContactReplySchema } from "../payloads.ts";
23
+ import { HelpdeskReplySchema } from "../payloads.ts";
24
24
  import {
25
- CONTACT_REPLY_CHANNELS,
26
- CONTACT_REPLY_ENTITY,
27
- CONTACT_REQUEST_ENTITY,
28
- CONTACT_STATUS,
29
- ContactErrors,
30
- ContactHandlers,
31
- type ContactReplyChannels,
32
- ContactScreens,
25
+ HELPDESK_REPLY_CHANNELS,
26
+ HELPDESK_REPLY_ENTITY,
27
+ HELPDESK_REQUEST_ENTITY,
28
+ HELPDESK_STATUS,
29
+ HelpdeskErrors,
30
+ HelpdeskHandlers,
31
+ type HelpdeskReplyChannels,
32
+ HelpdeskScreens,
33
33
  } from "../web/constants.ts";
34
34
  import { takeOverUploads } from "./take-over-uploads.ts";
35
35
 
36
- export type ContactReplyData = {
36
+ export type HelpdeskReplyData = {
37
37
  readonly kind: "replied";
38
38
  readonly id: string;
39
- readonly status: typeof CONTACT_STATUS.Answered | typeof CONTACT_STATUS.Done;
39
+ readonly status: typeof HELPDESK_STATUS.Answered | typeof HELPDESK_STATUS.Done;
40
40
  };
41
41
 
42
42
  type InAppNoteArgs = {
@@ -58,7 +58,7 @@ async function noteReporterInApp(ctx: HandlerContext, args: InAppNoteArgs): Prom
58
58
  await sendBestEffort(ctx, "reply in-app note", async () => {
59
59
  const noted = await ctx.dispatch.writeAs(
60
60
  createSystemUser(tenantId),
61
- ContactHandlers.notifyReporterInApp,
61
+ HelpdeskHandlers.notifyReporterInApp,
62
62
  {
63
63
  replyId: args.replyId,
64
64
  requestId: request.id,
@@ -83,14 +83,14 @@ type PersistReplyArgs = {
83
83
  readonly authorUserId: string;
84
84
  readonly authorName: string;
85
85
  readonly fileIds: readonly string[];
86
- readonly channels: ContactReplyChannels;
87
- readonly status: ContactReplyData["status"];
86
+ readonly channels: HelpdeskReplyChannels;
87
+ readonly status: HelpdeskReplyData["status"];
88
88
  };
89
89
 
90
90
  // Returns the failing write result, or null when reply and request update both succeeded.
91
91
  async function persistReply(
92
92
  ctx: HandlerContext,
93
- db: ReturnType<typeof contactDb>,
93
+ db: ReturnType<typeof helpdeskDb>,
94
94
  args: PersistReplyArgs,
95
95
  ) {
96
96
  const { request } = args;
@@ -118,7 +118,7 @@ async function persistReply(
118
118
  changes: {
119
119
  status: args.status,
120
120
  answeredAt: sentAt,
121
- ...(args.status === CONTACT_STATUS.Done && { closedAt: sentAt }),
121
+ ...(args.status === HELPDESK_STATUS.Done && { closedAt: sentAt }),
122
122
  replyCount: (request.replyCount ?? 0) + 1,
123
123
  },
124
124
  },
@@ -129,16 +129,16 @@ async function persistReply(
129
129
  }
130
130
 
131
131
  // The drawer variant the admin used is chosen by the reply channels, and pending uploads hang under that screen.
132
- function replyScreenFor(channels: ContactReplyChannels): string {
133
- return channels === CONTACT_REPLY_CHANNELS.EmailAndInApp
134
- ? ContactScreens.reply
135
- : ContactScreens.replyMail;
132
+ function replyScreenFor(channels: HelpdeskReplyChannels): string {
133
+ return channels === HELPDESK_REPLY_CHANNELS.EmailAndInApp
134
+ ? HelpdeskScreens.reply
135
+ : HelpdeskScreens.replyMail;
136
136
  }
137
137
 
138
138
  export function createReplyHandler() {
139
- return defineWriteHandler<"reply", typeof ContactReplySchema, ContactReplyData>({
139
+ return defineWriteHandler<"reply", typeof HelpdeskReplySchema, HelpdeskReplyData>({
140
140
  name: "reply",
141
- schema: ContactReplySchema,
141
+ schema: HelpdeskReplySchema,
142
142
  access: adminAccess,
143
143
  description:
144
144
  "A SystemAdmin answers a contact request: stores the reply (uploaded files are taken over into the system tenant), mails it to the reporter (Reply-To set, optional attachments, quoting the original request) and, for a signed-in reporter, adds an in-app note in the reporter's tenant. Marks the request answered, or done when markDone is set.",
@@ -146,9 +146,9 @@ export function createReplyHandler() {
146
146
  agent: { expose: false },
147
147
  handler: async (event, ctx) => {
148
148
  const { requestId, message, markDone } = event.payload;
149
- const db = contactDb(ctx);
149
+ const db = helpdeskDb(ctx);
150
150
  const request = await requestExecutor.detail({ id: requestId }, platformActor(), db);
151
- if (!request) return writeFailure(new NotFoundError(CONTACT_REQUEST_ENTITY, requestId));
151
+ if (!request) return writeFailure(new NotFoundError(HELPDESK_REQUEST_ENTITY, requestId));
152
152
 
153
153
  const replyId = generateId();
154
154
  const reporterUserId = request.reporterUserId ?? undefined;
@@ -156,18 +156,18 @@ export function createReplyHandler() {
156
156
  const uploaded = await takeOverUploads(ctx, {
157
157
  user: event.user,
158
158
  screen: replyScreenFor(channels),
159
- entityType: CONTACT_REPLY_ENTITY,
159
+ entityType: HELPDESK_REPLY_ENTITY,
160
160
  entityId: replyId,
161
161
  fileIds: event.payload.fileIds ?? [],
162
162
  });
163
163
  if (!uploaded.isSuccess) {
164
- return writeFailure(new UnprocessableError(ContactErrors.attachmentNotFound));
164
+ return writeFailure(new UnprocessableError(HelpdeskErrors.attachmentNotFound));
165
165
  }
166
166
  const fileIds = uploaded.data;
167
167
  const author = await loadUserLabel(db, event.user.id);
168
168
  const authorName = author?.name ?? event.user.id;
169
169
 
170
- const status = markDone ? CONTACT_STATUS.Done : CONTACT_STATUS.Answered;
170
+ const status = markDone ? HELPDESK_STATUS.Done : HELPDESK_STATUS.Answered;
171
171
  const failed = await persistReply(ctx, db, {
172
172
  replyId,
173
173
  request,
@@ -181,13 +181,13 @@ export function createReplyHandler() {
181
181
  if (failed !== null) return failed;
182
182
 
183
183
  await sendBestEffort(ctx, "reply mail", async () => {
184
- const sent = await ctx.dispatch.writeAs(platformActor(), ContactHandlers.sendReplyMail, {
184
+ const sent = await ctx.dispatch.writeAs(platformActor(), HelpdeskHandlers.sendReplyMail, {
185
185
  replyId,
186
186
  });
187
187
  if (!sent.isSuccess) throw new Error(sent.error.message);
188
188
  });
189
189
 
190
- if (channels === CONTACT_REPLY_CHANNELS.EmailAndInApp) {
190
+ if (channels === HELPDESK_REPLY_CHANNELS.EmailAndInApp) {
191
191
  await noteReporterInApp(ctx, { replyId, request, authorName });
192
192
  }
193
193
 
@@ -3,7 +3,7 @@ import { defineWriteHandler } from "@cosmicdrift/kumiko-framework/engine";
3
3
  import { UnprocessableError, writeFailure } from "@cosmicdrift/kumiko-framework/errors";
4
4
  import { generateId } from "@cosmicdrift/kumiko-framework/utils";
5
5
  import {
6
- contactDb,
6
+ helpdeskDb,
7
7
  loadTenantName,
8
8
  loadTenantPlan,
9
9
  loadUserLabel,
@@ -13,30 +13,30 @@ import {
13
13
  requestExecutor,
14
14
  sendBestEffort,
15
15
  } from "../lib.ts";
16
- import { contactConfirmationVariables, resolveContactMailLocale } from "../mail.ts";
17
- import { type ContactOptions, type ContactSettings, REPORT_RATE_LIMIT } from "../options.ts";
18
- import { ContactReportSchema } from "../payloads.ts";
16
+ import { helpdeskConfirmationVariables, resolveHelpdeskMailLocale } from "../mail.ts";
17
+ import { type HelpdeskOptions, type HelpdeskSettings, REPORT_RATE_LIMIT } from "../options.ts";
18
+ import { HelpdeskReportSchema } from "../payloads.ts";
19
19
  import { summarizeUserAgent } from "../user-agent.ts";
20
20
  import {
21
- CONTACT_NOTIFICATION_TYPES,
22
- CONTACT_REQUEST_ENTITY,
23
- CONTACT_SOURCE,
24
- CONTACT_STATUS,
25
- CONTACT_UPLOAD_FIELD,
26
- ContactErrors,
27
- ContactHandlers,
28
- ContactScreens,
29
- contactIdempotencyKeys,
21
+ HELPDESK_NOTIFICATION_TYPES,
22
+ HELPDESK_REQUEST_ENTITY,
23
+ HELPDESK_SOURCE,
24
+ HELPDESK_STATUS,
25
+ HELPDESK_UPLOAD_FIELD,
26
+ HelpdeskErrors,
27
+ HelpdeskHandlers,
28
+ HelpdeskScreens,
29
+ helpdeskIdempotencyKeys,
30
30
  } from "../web/constants.ts";
31
31
  import { REPORT_ACCESS } from "./access.ts";
32
32
  import { takeOverUploads } from "./take-over-uploads.ts";
33
33
 
34
- export type ContactReportData = { readonly kind: "reported"; readonly id: string };
34
+ export type HelpdeskReportData = { readonly kind: "reported"; readonly id: string };
35
35
 
36
- export function createReportHandler(opts: ContactOptions, settings: ContactSettings) {
37
- return defineWriteHandler<"report", typeof ContactReportSchema, ContactReportData>({
36
+ export function createReportHandler(opts: HelpdeskOptions, settings: HelpdeskSettings) {
37
+ return defineWriteHandler<"report", typeof HelpdeskReportSchema, HelpdeskReportData>({
38
38
  name: "report",
39
- schema: ContactReportSchema,
39
+ schema: HelpdeskReportSchema,
40
40
  access: REPORT_ACCESS,
41
41
  rateLimit: REPORT_RATE_LIMIT,
42
42
  agent: { expose: false },
@@ -47,10 +47,10 @@ export function createReportHandler(opts: ContactOptions, settings: ContactSetti
47
47
  const phoneIssue = phoneProblem(settings.phone, payload.phone);
48
48
  if (phoneIssue !== null) return writeFailure(new UnprocessableError(phoneIssue));
49
49
 
50
- const db = contactDb(ctx);
50
+ const db = helpdeskDb(ctx);
51
51
  const reporter = await loadUserLabel(db, event.user.id);
52
52
  if (!reporter?.email) {
53
- return writeFailure(new UnprocessableError(ContactErrors.reporterEmailMissing));
53
+ return writeFailure(new UnprocessableError(HelpdeskErrors.reporterEmailMissing));
54
54
  }
55
55
  const tenantName = await loadTenantName(db, event.user.tenantId);
56
56
  const email = normalizeEmail(reporter.email);
@@ -61,8 +61,8 @@ export function createReportHandler(opts: ContactOptions, settings: ContactSetti
61
61
  const requestId = generateId();
62
62
  const uploaded = await takeOverUploads(ctx, {
63
63
  user: event.user,
64
- screen: ContactScreens.report,
65
- entityType: CONTACT_REQUEST_ENTITY,
64
+ screen: HelpdeskScreens.report,
65
+ entityType: HELPDESK_REQUEST_ENTITY,
66
66
  entityId: requestId,
67
67
  fileIds: payload.fileIds ?? [],
68
68
  });
@@ -72,8 +72,8 @@ export function createReportHandler(opts: ContactOptions, settings: ContactSetti
72
72
  {
73
73
  id: requestId,
74
74
  kind: payload.kind,
75
- status: CONTACT_STATUS.Open,
76
- source: CONTACT_SOURCE.Admin,
75
+ status: HELPDESK_STATUS.Open,
76
+ source: HELPDESK_SOURCE.Admin,
77
77
  subject: payload.subject,
78
78
  message: payload.message,
79
79
  name: reporter.name,
@@ -87,7 +87,7 @@ export function createReportHandler(opts: ContactOptions, settings: ContactSetti
87
87
  ...(opts.appVersion !== undefined && { appVersion: opts.appVersion }),
88
88
  ...(browser !== null && { browser }),
89
89
  submittedAt: ctx.tz.now(),
90
- ...(fileIds.length > 0 && { [CONTACT_UPLOAD_FIELD]: fileIds }),
90
+ ...(fileIds.length > 0 && { [HELPDESK_UPLOAD_FIELD]: fileIds }),
91
91
  fileCount: fileIds.length,
92
92
  replyCount: 0,
93
93
  },
@@ -99,24 +99,24 @@ export function createReportHandler(opts: ContactOptions, settings: ContactSetti
99
99
  await sendBestEffort(ctx, "forward request", async () => {
100
100
  const forwarded = await ctx.dispatch.writeAs(
101
101
  platformActor(),
102
- ContactHandlers.forwardRequest,
102
+ HelpdeskHandlers.forwardRequest,
103
103
  { requestId },
104
104
  );
105
105
  if (!forwarded.isSuccess) throw new Error(forwarded.error.message);
106
106
  });
107
107
 
108
108
  await sendBestEffort(ctx, "confirmation mail", (notify) =>
109
- notify(CONTACT_NOTIFICATION_TYPES.confirmation, {
109
+ notify(HELPDESK_NOTIFICATION_TYPES.confirmation, {
110
110
  route: { email },
111
111
  recipientId: requestId,
112
- data: contactConfirmationVariables({
112
+ data: helpdeskConfirmationVariables({
113
113
  appName: opts.appName,
114
114
  message: payload.message,
115
115
  locale: ctx.locale,
116
116
  }),
117
- idempotencyKey: contactIdempotencyKeys.confirmation(requestId),
117
+ idempotencyKey: helpdeskIdempotencyKeys.confirmation(requestId),
118
118
  priority: "normal",
119
- locale: resolveContactMailLocale(ctx.locale),
119
+ locale: resolveHelpdeskMailLocale(ctx.locale),
120
120
  }),
121
121
  );
122
122
 
@@ -5,53 +5,53 @@ import { parseTenantId } from "@cosmicdrift/kumiko-types/identifiers";
5
5
  import type { Temporal } from "@cosmicdrift/kumiko-types/temporal";
6
6
  import {
7
7
  adminAccess,
8
- contactDb,
8
+ helpdeskDb,
9
9
  listRepliesOf,
10
10
  loadUserLabel,
11
11
  platformActor,
12
12
  requestExecutor,
13
13
  } from "../lib.ts";
14
- import type { ContactOptions } from "../options.ts";
15
- import { ContactIdSchema } from "../payloads.ts";
14
+ import type { HelpdeskOptions } from "../options.ts";
15
+ import { HelpdeskIdSchema } from "../payloads.ts";
16
16
  import {
17
- CONTACT_DELIVERY_CHANNEL,
18
- CONTACT_DELIVERY_STATUS,
19
- CONTACT_REQUEST_ENTITY,
20
- ContactConfigKeys,
21
- type ContactDeliveryChannel,
22
- type ContactDeliveryStatus,
23
- contactIdempotencyKeys,
17
+ HELPDESK_DELIVERY_CHANNEL,
18
+ HELPDESK_DELIVERY_STATUS,
19
+ HELPDESK_REQUEST_ENTITY,
20
+ HelpdeskConfigKeys,
21
+ type HelpdeskDeliveryChannel,
22
+ type HelpdeskDeliveryStatus,
23
+ helpdeskIdempotencyKeys,
24
24
  } from "../web/constants.ts";
25
- import { type ContactAttempt, loadAttemptsByKey, loadReadAtByKey } from "./attempts.ts";
25
+ import { type HelpdeskAttempt, loadAttemptsByKey, loadReadAtByKey } from "./attempts.ts";
26
26
 
27
27
  type DeliveryRow = {
28
28
  readonly id: string;
29
- readonly channel: ContactDeliveryChannel;
29
+ readonly channel: HelpdeskDeliveryChannel;
30
30
  readonly recipient: string;
31
31
  readonly at: string;
32
- readonly status: ContactDeliveryStatus;
32
+ readonly status: HelpdeskDeliveryStatus;
33
33
  };
34
34
 
35
- function displayStatus(attemptStatus: string): ContactDeliveryStatus {
35
+ function displayStatus(attemptStatus: string): HelpdeskDeliveryStatus {
36
36
  switch (attemptStatus) {
37
37
  case "sent":
38
- return CONTACT_DELIVERY_STATUS.Delivered;
38
+ return HELPDESK_DELIVERY_STATUS.Delivered;
39
39
  case "failed":
40
- return CONTACT_DELIVERY_STATUS.Failed;
40
+ return HELPDESK_DELIVERY_STATUS.Failed;
41
41
  case "skipped":
42
- return CONTACT_DELIVERY_STATUS.Skipped;
42
+ return HELPDESK_DELIVERY_STATUS.Skipped;
43
43
  default:
44
- return CONTACT_DELIVERY_STATUS.Pending;
44
+ return HELPDESK_DELIVERY_STATUS.Pending;
45
45
  }
46
46
  }
47
47
 
48
- function attemptsOf(attempts: readonly ContactAttempt[], key: string): readonly ContactAttempt[] {
48
+ function attemptsOf(attempts: readonly HelpdeskAttempt[], key: string): readonly HelpdeskAttempt[] {
49
49
  return attempts.filter((attempt) => attempt.key === key);
50
50
  }
51
51
 
52
52
  function rowOf(
53
- attempt: ContactAttempt,
54
- channel: ContactDeliveryChannel,
53
+ attempt: HelpdeskAttempt,
54
+ channel: HelpdeskDeliveryChannel,
55
55
  recipient: string,
56
56
  readAt: Temporal.Instant | null | undefined,
57
57
  ): DeliveryRow {
@@ -61,43 +61,43 @@ function rowOf(
61
61
  channel,
62
62
  recipient,
63
63
  at: (read ? readAt : attempt.createdAt).toString(),
64
- status: read ? CONTACT_DELIVERY_STATUS.Read : displayStatus(attempt.status),
64
+ status: read ? HELPDESK_DELIVERY_STATUS.Read : displayStatus(attempt.status),
65
65
  };
66
66
  }
67
67
 
68
68
  async function adminRows(
69
69
  db: TenantDb,
70
- attempts: readonly ContactAttempt[],
70
+ attempts: readonly HelpdeskAttempt[],
71
71
  requestId: string,
72
72
  ): Promise<readonly DeliveryRow[]> {
73
73
  const rows: DeliveryRow[] = [];
74
- for (const attempt of attemptsOf(attempts, contactIdempotencyKeys.admins(requestId))) {
74
+ for (const attempt of attemptsOf(attempts, helpdeskIdempotencyKeys.admins(requestId))) {
75
75
  const admin = attempt.recipientId ? await loadUserLabel(db, attempt.recipientId) : null;
76
76
  rows.push(
77
- rowOf(attempt, CONTACT_DELIVERY_CHANNEL.Email, `${admin?.name ?? "?"} (SystemAdmin)`, null),
77
+ rowOf(attempt, HELPDESK_DELIVERY_CHANNEL.Email, `${admin?.name ?? "?"} (SystemAdmin)`, null),
78
78
  );
79
79
  }
80
80
  return rows;
81
81
  }
82
82
 
83
- export function createRequestDeliveryQuery(opts: ContactOptions) {
83
+ export function createRequestDeliveryQuery(opts: HelpdeskOptions) {
84
84
  return defineQueryHandler({
85
85
  name: "request-delivery",
86
- schema: ContactIdSchema,
86
+ schema: HelpdeskIdSchema,
87
87
  access: adminAccess,
88
88
  description:
89
89
  "Returns where one contact request went and how: the admin mails, the Telegram message and each answer as mail and in-app note, each with channel, recipient, time and delivery status (an in-app note shows as read with the time it was opened), as flat rows for a related list.",
90
90
  handler: async (event, ctx) => {
91
- const db = contactDb(ctx);
91
+ const db = helpdeskDb(ctx);
92
92
  const { id } = event.payload;
93
93
  const request = await requestExecutor.detail({ id }, platformActor(), db);
94
- if (!request) throw new NotFoundError(CONTACT_REQUEST_ENTITY, id);
94
+ if (!request) throw new NotFoundError(HELPDESK_REQUEST_ENTITY, id);
95
95
  const replies = await listRepliesOf(db, id);
96
- const replyInAppKeys = replies.map((reply) => contactIdempotencyKeys.replyInApp(reply.id));
96
+ const replyInAppKeys = replies.map((reply) => helpdeskIdempotencyKeys.replyInApp(reply.id));
97
97
  const attempts = await loadAttemptsByKey(ctx, event.user, [
98
- contactIdempotencyKeys.admins(id),
99
- contactIdempotencyKeys.telegram(id),
100
- ...replies.map((reply) => contactIdempotencyKeys.reply(reply.id)),
98
+ helpdeskIdempotencyKeys.admins(id),
99
+ helpdeskIdempotencyKeys.telegram(id),
100
+ ...replies.map((reply) => helpdeskIdempotencyKeys.reply(reply.id)),
101
101
  ...replyInAppKeys,
102
102
  ]);
103
103
  const reporterTenantId = parseTenantId(request.reporterTenantId);
@@ -108,12 +108,12 @@ export function createRequestDeliveryQuery(opts: ContactOptions) {
108
108
 
109
109
  const rows: DeliveryRow[] = [...(await adminRows(db, attempts, id))];
110
110
  if (opts.telegram) {
111
- const chat = await ctx.config?.(ContactConfigKeys.telegramChat);
112
- for (const attempt of attemptsOf(attempts, contactIdempotencyKeys.telegram(id))) {
111
+ const chat = await ctx.config?.(HelpdeskConfigKeys.telegramChat);
112
+ for (const attempt of attemptsOf(attempts, helpdeskIdempotencyKeys.telegram(id))) {
113
113
  rows.push(
114
114
  rowOf(
115
115
  attempt,
116
- CONTACT_DELIVERY_CHANNEL.Telegram,
116
+ HELPDESK_DELIVERY_CHANNEL.Telegram,
117
117
  typeof chat === "string" ? chat : "",
118
118
  null,
119
119
  ),
@@ -121,16 +121,16 @@ export function createRequestDeliveryQuery(opts: ContactOptions) {
121
121
  }
122
122
  }
123
123
  for (const reply of replies) {
124
- const mailKey = contactIdempotencyKeys.reply(reply.id);
124
+ const mailKey = helpdeskIdempotencyKeys.reply(reply.id);
125
125
  for (const attempt of attemptsOf(attempts, mailKey)) {
126
- rows.push(rowOf(attempt, CONTACT_DELIVERY_CHANNEL.ReplyEmail, request.name, null));
126
+ rows.push(rowOf(attempt, HELPDESK_DELIVERY_CHANNEL.ReplyEmail, request.name, null));
127
127
  }
128
- const inAppKey = contactIdempotencyKeys.replyInApp(reply.id);
128
+ const inAppKey = helpdeskIdempotencyKeys.replyInApp(reply.id);
129
129
  for (const attempt of attemptsOf(attempts, inAppKey)) {
130
130
  rows.push(
131
131
  rowOf(
132
132
  attempt,
133
- CONTACT_DELIVERY_CHANNEL.ReplyInApp,
133
+ HELPDESK_DELIVERY_CHANNEL.ReplyInApp,
134
134
  request.name,
135
135
  readAtByKey.get(inAppKey),
136
136
  ),