@cosmicdrift/kumiko-bundled-features 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.
- package/dist/admin-shell/feature.d.ts +1 -1
- package/dist/agent-tools/agent-doc-lint.d.ts +9 -0
- package/dist/agent-tools/agent-doc-lint.js +42 -5
- package/dist/agent-tools/agent-manifest.d.ts +0 -1
- package/dist/agent-tools/agent-manifest.js +9 -99
- package/dist/agent-tools/api-docs/anchors.d.ts +14 -0
- package/dist/agent-tools/api-docs/anchors.js +49 -0
- package/dist/agent-tools/api-docs/check.d.ts +7 -0
- package/dist/agent-tools/api-docs/check.js +15 -0
- package/dist/agent-tools/api-docs/collect-events.d.ts +10 -0
- package/dist/agent-tools/api-docs/collect-events.js +90 -0
- package/dist/agent-tools/api-docs/collect.d.ts +15 -0
- package/dist/agent-tools/api-docs/collect.js +108 -0
- package/dist/agent-tools/api-docs/curl.d.ts +5 -0
- package/dist/agent-tools/api-docs/curl.js +24 -0
- package/dist/agent-tools/api-docs/error-table.d.ts +9 -0
- package/dist/agent-tools/api-docs/error-table.js +31 -0
- package/dist/agent-tools/api-docs/examples.d.ts +16 -0
- package/dist/agent-tools/api-docs/examples.js +25 -0
- package/dist/agent-tools/api-docs/generate.d.ts +19 -0
- package/dist/agent-tools/api-docs/generate.js +104 -0
- package/dist/agent-tools/api-docs/index-json.d.ts +15 -0
- package/dist/agent-tools/api-docs/index-json.js +6 -0
- package/dist/agent-tools/api-docs/index.d.ts +9 -0
- package/dist/agent-tools/api-docs/index.js +6 -0
- package/dist/agent-tools/api-docs/list-parameters.d.ts +61 -0
- package/dist/agent-tools/api-docs/list-parameters.js +28 -0
- package/dist/agent-tools/api-docs/markdown.d.ts +29 -0
- package/dist/agent-tools/api-docs/markdown.js +48 -0
- package/dist/agent-tools/api-docs/menu-path.d.ts +8 -0
- package/dist/agent-tools/api-docs/menu-path.js +60 -0
- package/dist/agent-tools/api-docs/model.d.ts +76 -0
- package/dist/agent-tools/api-docs/problems.d.ts +32 -0
- package/dist/agent-tools/api-docs/problems.js +28 -0
- package/dist/agent-tools/api-docs/render-events.d.ts +12 -0
- package/dist/agent-tools/api-docs/render-events.js +55 -0
- package/dist/agent-tools/api-docs/render-openapi.d.ts +10 -0
- package/dist/agent-tools/api-docs/render-openapi.js +170 -0
- package/dist/agent-tools/api-docs/render-overview.d.ts +11 -0
- package/dist/agent-tools/api-docs/render-overview.js +60 -0
- package/dist/agent-tools/api-docs/render-reference.d.ts +14 -0
- package/dist/agent-tools/api-docs/render-reference.js +50 -0
- package/dist/agent-tools/api-docs/render-tokens.d.ts +12 -0
- package/dist/agent-tools/api-docs/render-tokens.js +101 -0
- package/dist/agent-tools/api-docs/schema-fields.d.ts +16 -0
- package/dist/agent-tools/api-docs/schema-fields.js +141 -0
- package/dist/agent-tools/api-docs/section-ids.d.ts +25 -0
- package/dist/agent-tools/api-docs/section-ids.js +26 -0
- package/dist/agent-tools/api-docs/system-only.d.ts +5 -0
- package/dist/agent-tools/api-docs/system-only.js +7 -0
- package/dist/agent-tools/api-docs/texts/de.d.ts +123 -0
- package/dist/agent-tools/api-docs/texts/de.js +123 -0
- package/dist/agent-tools/api-docs/texts/en.d.ts +123 -0
- package/dist/agent-tools/api-docs/texts/en.js +123 -0
- package/dist/agent-tools/api-docs/texts/es.d.ts +123 -0
- package/dist/agent-tools/api-docs/texts/es.js +123 -0
- package/dist/agent-tools/api-docs/texts/fr.d.ts +123 -0
- package/dist/agent-tools/api-docs/texts/fr.js +123 -0
- package/dist/agent-tools/api-docs/texts/index.d.ts +14 -0
- package/dist/agent-tools/api-docs/texts/index.js +55 -0
- package/dist/agent-tools/api-docs/texts/it.d.ts +123 -0
- package/dist/agent-tools/api-docs/texts/it.js +123 -0
- package/dist/agent-tools/api-docs/texts/types.d.ts +18 -0
- package/dist/agent-tools/api-docs/texts/types.js +104 -0
- package/dist/agent-tools/api-docs/ui-writes.d.ts +12 -0
- package/dist/agent-tools/api-docs/ui-writes.js +73 -0
- package/dist/agent-tools/handler-schema.d.ts +5 -0
- package/dist/agent-tools/handler-schema.js +37 -0
- package/dist/agent-tools/index.d.ts +2 -1
- package/dist/agent-tools/index.js +2 -1
- package/dist/agent-tools/labels.d.ts +26 -0
- package/dist/agent-tools/labels.js +131 -0
- package/dist/auth-email-password/boot-rules.d.ts +7 -0
- package/dist/auth-email-password/boot-rules.js +7 -0
- package/dist/auth-email-password/feature.js +6 -13
- package/dist/auth-email-password/validate-options.d.ts +5 -0
- package/dist/auth-email-password/validate-options.js +15 -0
- package/dist/billing-foundation/boot-rules.d.ts +22 -0
- package/dist/billing-foundation/boot-rules.js +22 -0
- package/dist/billing-foundation/validate-options.js +56 -18
- package/dist/cap-overview/boot-rules.d.ts +12 -0
- package/dist/cap-overview/boot-rules.js +12 -0
- package/dist/cap-overview/feature.js +8 -3
- package/dist/documents/boot-rules.d.ts +12 -0
- package/dist/documents/boot-rules.js +12 -0
- package/dist/documents/feature.js +8 -3
- package/dist/file-derivatives/boot-rules.d.ts +7 -0
- package/dist/file-derivatives/boot-rules.js +7 -0
- package/dist/file-derivatives/feature.js +5 -2
- package/dist/folders/boot-rules.d.ts +7 -0
- package/dist/folders/boot-rules.js +7 -0
- package/dist/folders/feature.js +8 -5
- package/dist/helpdesk/boot-rules.d.ts +7 -0
- package/dist/helpdesk/boot-rules.js +7 -0
- package/dist/{contact → helpdesk}/challenge.js +2 -2
- package/dist/helpdesk/client/helpdesk-client-source.d.ts +1 -0
- package/dist/{contact/client/contact-client-source.js → helpdesk/client/helpdesk-client-source.js} +4 -4
- package/dist/helpdesk/client/helpdesk-website-client.d.ts +26 -0
- package/dist/helpdesk/client/helpdesk-website-client.js +1 -0
- package/dist/helpdesk/client/index.d.ts +2 -0
- package/dist/helpdesk/client/index.js +1 -0
- package/dist/{contact → helpdesk}/entity.d.ts +6 -6
- package/dist/{contact → helpdesk}/entity.js +31 -27
- package/dist/helpdesk/feature.d.ts +3 -0
- package/dist/{contact → helpdesk}/feature.js +43 -39
- package/dist/{contact → helpdesk}/handlers/attempts.d.ts +2 -2
- package/dist/helpdesk/handlers/challenge.query.d.ts +9 -0
- package/dist/{contact → helpdesk}/handlers/challenge.query.js +5 -5
- package/dist/helpdesk/handlers/forward-request.write.d.ts +9 -0
- package/dist/{contact → helpdesk}/handlers/forward-request.write.js +17 -15
- package/dist/{contact → helpdesk}/handlers/mark-done.write.d.ts +2 -2
- package/dist/{contact → helpdesk}/handlers/mark-done.write.js +8 -8
- package/dist/{contact → helpdesk}/handlers/notify-reporter-in-app.write.d.ts +2 -2
- package/dist/{contact → helpdesk}/handlers/notify-reporter-in-app.write.js +11 -11
- package/dist/{contact → helpdesk}/handlers/open-count.js +2 -2
- package/dist/{contact → helpdesk}/handlers/open-count.query.js +4 -4
- package/dist/{contact → helpdesk}/handlers/replies.query.js +6 -6
- package/dist/{contact → helpdesk}/handlers/reply.write.d.ts +4 -4
- package/dist/{contact → helpdesk}/handlers/reply.write.js +16 -16
- package/dist/helpdesk/handlers/report.write.d.ts +16 -0
- package/dist/{contact → helpdesk}/handlers/report.write.js +17 -17
- package/dist/helpdesk/handlers/request-delivery.query.d.ts +16 -0
- package/dist/{contact → helpdesk}/handlers/request-delivery.query.js +24 -24
- package/dist/{contact → helpdesk}/handlers/request-detail.query.d.ts +3 -3
- package/dist/{contact → helpdesk}/handlers/request-detail.query.js +10 -10
- package/dist/{contact → helpdesk}/handlers/request-list.query.js +2 -2
- package/dist/helpdesk/handlers/send-reply-mail.write.d.ts +8 -0
- package/dist/{contact → helpdesk}/handlers/send-reply-mail.write.js +15 -15
- package/dist/helpdesk/handlers/send-test.write.d.ts +5 -0
- package/dist/{contact → helpdesk}/handlers/send-test.write.js +10 -10
- package/dist/{contact → helpdesk}/handlers/submit.write.d.ts +4 -4
- package/dist/{contact → helpdesk}/handlers/submit.write.js +17 -17
- package/dist/{contact → helpdesk}/handlers/take-over-uploads.js +5 -5
- package/dist/{contact → helpdesk}/i18n.d.ts +1 -1
- package/dist/{contact → helpdesk}/i18n.js +78 -75
- package/dist/helpdesk/index.d.ts +5 -0
- package/dist/helpdesk/index.js +4 -0
- package/dist/{contact → helpdesk}/lib.d.ts +5 -5
- package/dist/{contact → helpdesk}/lib.js +16 -16
- package/dist/{contact → helpdesk}/mail.d.ts +20 -20
- package/dist/{contact → helpdesk}/mail.js +47 -47
- package/dist/{contact → helpdesk}/options.d.ts +6 -6
- package/dist/helpdesk/options.js +36 -0
- package/dist/helpdesk/panels.d.ts +2 -0
- package/dist/helpdesk/panels.js +21 -0
- package/dist/{contact → helpdesk}/payloads.d.ts +11 -11
- package/dist/{contact → helpdesk}/payloads.js +28 -28
- package/dist/helpdesk/screens.d.ts +5 -0
- package/dist/{contact → helpdesk}/screens.js +87 -87
- package/dist/{contact → helpdesk}/subject.js +3 -3
- package/dist/helpdesk/user-data-hooks.d.ts +3 -0
- package/dist/{contact → helpdesk}/user-data-hooks.js +15 -15
- package/dist/helpdesk/web/constants.d.ts +127 -0
- package/dist/helpdesk/web/constants.js +126 -0
- package/dist/helpdesk/web/index.d.ts +1 -0
- package/dist/helpdesk/web/index.js +1 -0
- package/dist/host-routing/boot-rules.d.ts +22 -0
- package/dist/host-routing/boot-rules.js +22 -0
- package/dist/host-routing/validate-options.js +35 -11
- package/dist/inbound-mail-foundation/entities.d.ts +84 -0
- package/dist/inbound-mail-foundation/entities.js +96 -71
- package/dist/inbound-mail-foundation/feature.js +2 -2
- package/dist/jobs/boot-rules.d.ts +7 -0
- package/dist/jobs/boot-rules.js +7 -0
- package/dist/jobs/feature.js +5 -2
- package/dist/legal-pages/boot-rules.d.ts +17 -0
- package/dist/legal-pages/boot-rules.js +17 -0
- package/dist/legal-pages/feature.js +5 -2
- package/dist/legal-pages/lib/validate-routes.js +11 -3
- package/dist/metrics/boot-rules.d.ts +12 -0
- package/dist/metrics/boot-rules.js +12 -0
- package/dist/metrics/validate.js +8 -2
- package/dist/notes-history/boot-rules.d.ts +7 -0
- package/dist/notes-history/boot-rules.js +7 -0
- package/dist/notes-history/feature.js +7 -4
- package/dist/personal-access-tokens/boot-rules.d.ts +7 -0
- package/dist/personal-access-tokens/boot-rules.js +7 -0
- package/dist/personal-access-tokens/feature.d.ts +1 -0
- package/dist/personal-access-tokens/feature.js +4 -2
- package/dist/personal-access-tokens/handlers/create.write.js +2 -2
- package/dist/personal-access-tokens/i18n.js +5 -1
- package/dist/personal-access-tokens/index.d.ts +4 -2
- package/dist/personal-access-tokens/index.js +29 -2
- package/dist/personal-access-tokens/scope-events-check.d.ts +3 -0
- package/dist/personal-access-tokens/scope-events-check.js +21 -0
- package/dist/personal-access-tokens/screens.js +8 -2
- package/dist/personal-access-tokens/web/constants.d.ts +1 -0
- package/dist/personal-access-tokens/web/constants.js +1 -0
- package/dist/personal-access-tokens/web/scopes.d.ts +2 -0
- package/dist/personal-access-tokens/web/scopes.js +12 -0
- package/dist/presence/boot-rules.d.ts +7 -0
- package/dist/presence/boot-rules.js +7 -0
- package/dist/presence/options.js +5 -1
- package/dist/readiness/boot-rules.d.ts +12 -0
- package/dist/readiness/boot-rules.js +12 -0
- package/dist/readiness/probe-boot-check.js +8 -3
- package/dist/shared/assert-no-where-rule-in-ownership-write.d.ts +1 -1
- package/dist/shared/assert-no-where-rule-in-ownership-write.js +11 -7
- package/dist/shared/boot-rules.d.ts +7 -0
- package/dist/shared/boot-rules.js +7 -0
- package/dist/subscription-mollie/boot-rules.d.ts +17 -0
- package/dist/subscription-mollie/boot-rules.js +17 -0
- package/dist/subscription-mollie/feature.js +13 -6
- package/dist/tags/boot-rules.d.ts +7 -0
- package/dist/tags/boot-rules.js +7 -0
- package/dist/tags/feature.js +8 -5
- package/dist/template-resolver/boot-rules.d.ts +17 -0
- package/dist/template-resolver/boot-rules.js +17 -0
- package/dist/template-resolver/feature.js +14 -5
- package/dist/tenant/boot-rules.d.ts +7 -0
- package/dist/tenant/boot-rules.js +7 -0
- package/dist/tenant/feature.js +5 -2
- package/kumiko-es-tables.json +4 -4
- package/package.json +29 -29
- package/src/agent-tools/changes.json +24 -0
- package/src/{contact → helpdesk}/changes.json +6 -0
- package/src/inbound-mail-foundation/changes.json +6 -0
- package/src/personal-access-tokens/changes.json +6 -0
- package/dist/contact/client/contact-client-source.d.ts +0 -1
- package/dist/contact/client/contact-website-client.d.ts +0 -26
- package/dist/contact/client/index.d.ts +0 -2
- package/dist/contact/client/index.js +0 -1
- package/dist/contact/feature.d.ts +0 -3
- package/dist/contact/handlers/challenge.query.d.ts +0 -9
- package/dist/contact/handlers/forward-request.write.d.ts +0 -9
- package/dist/contact/handlers/report.write.d.ts +0 -16
- package/dist/contact/handlers/request-delivery.query.d.ts +0 -16
- package/dist/contact/handlers/send-reply-mail.write.d.ts +0 -8
- package/dist/contact/handlers/send-test.write.d.ts +0 -5
- package/dist/contact/index.d.ts +0 -5
- package/dist/contact/index.js +0 -4
- package/dist/contact/options.js +0 -32
- package/dist/contact/panels.d.ts +0 -2
- package/dist/contact/panels.js +0 -21
- package/dist/contact/screens.d.ts +0 -5
- package/dist/contact/user-data-hooks.d.ts +0 -3
- package/dist/contact/web/constants.d.ts +0 -127
- package/dist/contact/web/constants.js +0 -126
- package/dist/contact/web/index.d.ts +0 -1
- package/dist/contact/web/index.js +0 -1
- /package/dist/{contact/client/contact-website-client.js → agent-tools/api-docs/model.js} +0 -0
- /package/dist/{contact → helpdesk}/challenge.d.ts +0 -0
- /package/dist/{contact → helpdesk}/handlers/access.d.ts +0 -0
- /package/dist/{contact → helpdesk}/handlers/access.js +0 -0
- /package/dist/{contact → helpdesk}/handlers/attempts.js +0 -0
- /package/dist/{contact → helpdesk}/handlers/open-count.d.ts +0 -0
- /package/dist/{contact → helpdesk}/handlers/open-count.query.d.ts +0 -0
- /package/dist/{contact → helpdesk}/handlers/replies.query.d.ts +0 -0
- /package/dist/{contact → helpdesk}/handlers/request-list.query.d.ts +0 -0
- /package/dist/{contact → helpdesk}/handlers/take-over-uploads.d.ts +0 -0
- /package/dist/{contact → helpdesk}/pow.d.ts +0 -0
- /package/dist/{contact → helpdesk}/pow.js +0 -0
- /package/dist/{contact → helpdesk}/subject.d.ts +0 -0
- /package/dist/{contact → helpdesk}/user-agent.d.ts +0 -0
- /package/dist/{contact → helpdesk}/user-agent.js +0 -0
|
@@ -3,13 +3,13 @@ import { defineWriteHandler, SYSTEM_TENANT_ID, } from "@cosmicdrift/kumiko-frame
|
|
|
3
3
|
import { NotFoundError, writeFailure } from "@cosmicdrift/kumiko-framework/errors";
|
|
4
4
|
import { fileRefsTable } from "@cosmicdrift/kumiko-framework/files";
|
|
5
5
|
import { decryptStoredPii } from "../../shared/index.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
const ATTACHMENT_LOOKUP_REASON = "
|
|
6
|
+
import { helpdeskDb, internalAccess, loadUserLabel, platformActor, replyExecutor, requestExecutor, sendBestEffort, } from "../lib.js";
|
|
7
|
+
import { helpdeskReplyVariables, resolveHelpdeskMailLocale } from "../mail.js";
|
|
8
|
+
import { HelpdeskSendReplyMailSchema } from "../payloads.js";
|
|
9
|
+
import { HELPDESK_NOTIFICATION_TYPES, HELPDESK_REPLY_ENTITY, HELPDESK_REQUEST_ENTITY, HelpdeskConfigKeys, helpdeskIdempotencyKeys, } from "../web/constants.js";
|
|
10
|
+
const ATTACHMENT_LOOKUP_REASON = "helpdesk:reply-attachment";
|
|
11
11
|
async function resolveAttachments(ctx, fileIds) {
|
|
12
|
-
const db =
|
|
12
|
+
const db = helpdeskDb(ctx);
|
|
13
13
|
const attachments = [];
|
|
14
14
|
for (const fileRefId of fileIds) {
|
|
15
15
|
const row = await fetchOne(db, fileRefsTable, {
|
|
@@ -25,7 +25,7 @@ async function resolveAttachments(ctx, fileIds) {
|
|
|
25
25
|
return attachments;
|
|
26
26
|
}
|
|
27
27
|
async function resolveReplyTo(ctx, authorEmail) {
|
|
28
|
-
const configured = await ctx.config?.(
|
|
28
|
+
const configured = await ctx.config?.(HelpdeskConfigKeys.replyTo);
|
|
29
29
|
return typeof configured === "string" && configured.trim() !== ""
|
|
30
30
|
? configured.trim()
|
|
31
31
|
: authorEmail;
|
|
@@ -35,19 +35,19 @@ async function resolveReplyTo(ctx, authorEmail) {
|
|
|
35
35
|
export function createSendReplyMailHandler(opts) {
|
|
36
36
|
return defineWriteHandler({
|
|
37
37
|
name: "send-reply-mail",
|
|
38
|
-
schema:
|
|
38
|
+
schema: HelpdeskSendReplyMailSchema,
|
|
39
39
|
access: internalAccess,
|
|
40
40
|
agent: { expose: false },
|
|
41
41
|
description: "Internal: mails a stored reply to the reporter with Reply-To, the quoted request and the reply files attached. Only the platform identity can call it.",
|
|
42
42
|
handler: async (event, ctx) => {
|
|
43
|
-
const db =
|
|
43
|
+
const db = helpdeskDb(ctx);
|
|
44
44
|
const { replyId } = event.payload;
|
|
45
45
|
const reply = await replyExecutor.detail({ id: replyId }, platformActor(), db);
|
|
46
46
|
if (!reply)
|
|
47
|
-
return writeFailure(new NotFoundError(
|
|
47
|
+
return writeFailure(new NotFoundError(HELPDESK_REPLY_ENTITY, replyId));
|
|
48
48
|
const request = await requestExecutor.detail({ id: reply.requestId }, platformActor(), db);
|
|
49
49
|
if (!request) {
|
|
50
|
-
return writeFailure(new NotFoundError(
|
|
50
|
+
return writeFailure(new NotFoundError(HELPDESK_REQUEST_ENTITY, reply.requestId));
|
|
51
51
|
}
|
|
52
52
|
const author = await loadUserLabel(db, reply.authorUserId);
|
|
53
53
|
const reporterUserId = request.reporterUserId ?? undefined;
|
|
@@ -56,11 +56,11 @@ export function createSendReplyMailHandler(opts) {
|
|
|
56
56
|
const replyTo = await resolveReplyTo(ctx, author?.email ?? undefined);
|
|
57
57
|
const attachments = await resolveAttachments(ctx, reply.fileIds ?? []);
|
|
58
58
|
const locale = request.locale ?? undefined;
|
|
59
|
-
await sendBestEffort(ctx, "reply mail", (notify) => notify(
|
|
59
|
+
await sendBestEffort(ctx, "reply mail", (notify) => notify(HELPDESK_NOTIFICATION_TYPES.reply, {
|
|
60
60
|
route: { email: recipientEmail },
|
|
61
61
|
recipientId: request.id,
|
|
62
62
|
data: {
|
|
63
|
-
...
|
|
63
|
+
...helpdeskReplyVariables({
|
|
64
64
|
requestSubject: request.subject,
|
|
65
65
|
requestMessage: request.message,
|
|
66
66
|
requestSubmittedAt: Number(request.submittedAt.epochMilliseconds),
|
|
@@ -72,9 +72,9 @@ export function createSendReplyMailHandler(opts) {
|
|
|
72
72
|
...(replyTo !== undefined && { replyTo }),
|
|
73
73
|
...(attachments.length > 0 && { attachments }),
|
|
74
74
|
},
|
|
75
|
-
idempotencyKey:
|
|
75
|
+
idempotencyKey: helpdeskIdempotencyKeys.reply(replyId),
|
|
76
76
|
priority: "normal",
|
|
77
|
-
locale:
|
|
77
|
+
locale: resolveHelpdeskMailLocale(locale),
|
|
78
78
|
}));
|
|
79
79
|
return { isSuccess: true, data: { kind: "sent", attachmentCount: attachments.length } };
|
|
80
80
|
},
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { HelpdeskOptions } from "../options.ts";
|
|
2
|
+
export type HelpdeskSendTestData = {
|
|
3
|
+
readonly kind: "sent";
|
|
4
|
+
};
|
|
5
|
+
export declare function createSendTestHandler(opts: HelpdeskOptions): import("@cosmicdrift/kumiko-types/define-handler").WriteHandlerDefinition<"send-test", import("zod").ZodObject<{}, import("zod/v4/core").$strict>, HelpdeskSendTestData, import("@cosmicdrift/kumiko-types/event-type-map").KumikoEventTypeMap, undefined, undefined>;
|
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
import { defineWriteHandler } from "@cosmicdrift/kumiko-framework/engine";
|
|
2
2
|
import { InternalError, UnprocessableError, writeFailure, } from "@cosmicdrift/kumiko-framework/errors";
|
|
3
3
|
import { adminAccess } from "../lib.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import { helpdeskTestVariables, resolveHelpdeskMailLocale } from "../mail.js";
|
|
5
|
+
import { HelpdeskEmptySchema } from "../payloads.js";
|
|
6
|
+
import { HELPDESK_NOTIFICATION_TYPES, HelpdeskConfigKeys, HelpdeskErrors, } from "../web/constants.js";
|
|
7
7
|
export function createSendTestHandler(opts) {
|
|
8
8
|
return defineWriteHandler({
|
|
9
9
|
name: "send-test",
|
|
10
|
-
schema:
|
|
10
|
+
schema: HelpdeskEmptySchema,
|
|
11
11
|
access: adminAccess,
|
|
12
12
|
agent: { expose: false },
|
|
13
13
|
description: "Sends a test message to the configured Telegram chat; fails with a typed error when no chat is configured or the provider does not accept the message, so a SystemAdmin can verify bot token and chat id.",
|
|
14
14
|
handler: async (event, ctx) => {
|
|
15
|
-
const chatId = await ctx.config?.(
|
|
15
|
+
const chatId = await ctx.config?.(HelpdeskConfigKeys.telegramChat);
|
|
16
16
|
if (typeof chatId !== "string" || chatId.trim() === "") {
|
|
17
|
-
return writeFailure(new UnprocessableError(
|
|
17
|
+
return writeFailure(new UnprocessableError(HelpdeskErrors.telegramChatMissing));
|
|
18
18
|
}
|
|
19
19
|
if (!ctx.notify) {
|
|
20
20
|
throw new InternalError({ message: "ctx.notify unavailable — mount the delivery feature" });
|
|
21
21
|
}
|
|
22
22
|
const locale = opts.adminLocale ?? "en";
|
|
23
|
-
const result = await ctx.notify(
|
|
23
|
+
const result = await ctx.notify(HELPDESK_NOTIFICATION_TYPES.test, {
|
|
24
24
|
route: { telegram: chatId.trim() },
|
|
25
25
|
recipientId: event.user.id,
|
|
26
|
-
data:
|
|
26
|
+
data: helpdeskTestVariables({ appName: opts.appName, locale }),
|
|
27
27
|
immediate: true,
|
|
28
|
-
locale:
|
|
28
|
+
locale: resolveHelpdeskMailLocale(locale),
|
|
29
29
|
});
|
|
30
30
|
if (result.deliveries.some((d) => d.status === "failed")) {
|
|
31
|
-
return writeFailure(new UnprocessableError(
|
|
31
|
+
return writeFailure(new UnprocessableError(HelpdeskErrors.telegramTestFailed));
|
|
32
32
|
}
|
|
33
33
|
return { isSuccess: true, data: { kind: "sent" } };
|
|
34
34
|
},
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
export type
|
|
1
|
+
import { type HelpdeskOptions, type HelpdeskSettings } from "../options.ts";
|
|
2
|
+
export type HelpdeskSubmitData = {
|
|
3
3
|
readonly kind: "submitted";
|
|
4
4
|
};
|
|
5
|
-
export declare function createSubmitHandler(opts:
|
|
5
|
+
export declare function createSubmitHandler(opts: HelpdeskOptions, settings: HelpdeskSettings): import("@cosmicdrift/kumiko-types/define-handler").WriteHandlerDefinition<"submit", import("zod").ZodObject<{
|
|
6
6
|
kind: import("zod").ZodEnum<{
|
|
7
7
|
bug: "bug";
|
|
8
8
|
contact: "contact";
|
|
@@ -17,4 +17,4 @@ export declare function createSubmitHandler(opts: ContactOptions, settings: Cont
|
|
|
17
17
|
challenge: import("zod").ZodString;
|
|
18
18
|
nonce: import("zod").ZodString;
|
|
19
19
|
page: import("zod").ZodOptional<import("zod").ZodPipe<import("zod").ZodString, import("zod").ZodTransform<string, string>>>;
|
|
20
|
-
}, import("zod/v4/core").$strict>,
|
|
20
|
+
}, import("zod/v4/core").$strict>, HelpdeskSubmitData, import("@cosmicdrift/kumiko-types/event-type-map").KumikoEventTypeMap, undefined, undefined>;
|
|
@@ -4,14 +4,14 @@ import { InternalError, isKumikoError, UnprocessableError, writeFailure, } from
|
|
|
4
4
|
import { normalizePayloadBucketValue } from "@cosmicdrift/kumiko-framework/pipeline";
|
|
5
5
|
import { generateId } from "@cosmicdrift/kumiko-framework/utils";
|
|
6
6
|
import { consumeChallenge } from "../challenge.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { helpdeskDb, normalizeEmail, phoneProblem, platformActor, requestExecutor, sendBestEffort, } from "../lib.js";
|
|
8
|
+
import { helpdeskAcknowledgementVariables, resolveHelpdeskMailLocale } from "../mail.js";
|
|
9
9
|
import { DEFAULT_SUBMIT_EMAIL_RATE_LIMITS, DEFAULT_SUBMIT_RATE_LIMIT, } from "../options.js";
|
|
10
|
-
import {
|
|
10
|
+
import { HelpdeskSubmitSchema } from "../payloads.js";
|
|
11
11
|
import { verifyProofOfWork } from "../pow.js";
|
|
12
12
|
import { deriveSubjectFromMessage } from "../subject.js";
|
|
13
13
|
import { summarizeUserAgent } from "../user-agent.js";
|
|
14
|
-
import {
|
|
14
|
+
import { HELPDESK_NOTIFICATION_TYPES, HELPDESK_SOURCE, HELPDESK_STATUS, HelpdeskHandlers, helpdeskIdempotencyKeys, } from "../web/constants.js";
|
|
15
15
|
import { SUBMIT_ROLES } from "./access.js";
|
|
16
16
|
// Identical body for stored and silently dropped submits, so a bot learns nothing from it.
|
|
17
17
|
const SUBMITTED = {
|
|
@@ -31,7 +31,7 @@ async function findDropReason(payload, ctx, settings) {
|
|
|
31
31
|
const redis = ctx.services.redis;
|
|
32
32
|
if (!redis) {
|
|
33
33
|
throw new InternalError({
|
|
34
|
-
message: "
|
|
34
|
+
message: "helpdesk:submit requires ctx.services.redis for the challenge store",
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
37
|
const issued = await consumeChallenge(redis, payload.challenge);
|
|
@@ -53,11 +53,11 @@ async function enforceEmailLimits(ctx, payload, limits) {
|
|
|
53
53
|
const { rateLimit } = ctx.services;
|
|
54
54
|
if (!rateLimit || !ctx.rateLimitDigest) {
|
|
55
55
|
throw new InternalError({
|
|
56
|
-
message: "
|
|
56
|
+
message: "helpdesk:submit declares an email rate limit but no rate limiter or digest is wired",
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
59
|
const requests = limits.map(({ per, limit, windowSeconds, cost, normalize }) => ({
|
|
60
|
-
bucket: `
|
|
60
|
+
bucket: `helpdesk-submit:${per.payloadField}:${ctx.rateLimitDigest?.(normalizePayloadBucketValue(payload.email, normalize))}`,
|
|
61
61
|
config: { limit, windowSeconds, ...(cost !== undefined && { cost }) },
|
|
62
62
|
}));
|
|
63
63
|
try {
|
|
@@ -74,7 +74,7 @@ export function createSubmitHandler(opts, settings) {
|
|
|
74
74
|
const emailRateLimits = opts.emailRateLimits ?? DEFAULT_SUBMIT_EMAIL_RATE_LIMITS;
|
|
75
75
|
return defineWriteHandler({
|
|
76
76
|
name: "submit",
|
|
77
|
-
schema:
|
|
77
|
+
schema: HelpdeskSubmitSchema,
|
|
78
78
|
access: { roles: SUBMIT_ROLES, personalData: "public-intake", anySignedIn: true },
|
|
79
79
|
rateLimit: opts.rateLimit ?? DEFAULT_SUBMIT_RATE_LIMIT,
|
|
80
80
|
agent: { expose: false },
|
|
@@ -83,7 +83,7 @@ export function createSubmitHandler(opts, settings) {
|
|
|
83
83
|
const payload = event.payload;
|
|
84
84
|
const dropReason = await findDropReason(payload, ctx, settings);
|
|
85
85
|
if (dropReason !== null) {
|
|
86
|
-
ctx.obs.log?.info("[
|
|
86
|
+
ctx.obs.log?.info("[helpdesk:submit] dropped", { reason: dropReason });
|
|
87
87
|
return SUBMITTED;
|
|
88
88
|
}
|
|
89
89
|
// Before the email limit, so a mistyped phone number does not use up the sender's quota.
|
|
@@ -99,8 +99,8 @@ export function createSubmitHandler(opts, settings) {
|
|
|
99
99
|
const created = await requestExecutor.create({
|
|
100
100
|
id: requestId,
|
|
101
101
|
kind: payload.kind,
|
|
102
|
-
status:
|
|
103
|
-
source:
|
|
102
|
+
status: HELPDESK_STATUS.Open,
|
|
103
|
+
source: HELPDESK_SOURCE.Website,
|
|
104
104
|
subject: deriveSubjectFromMessage(payload.message),
|
|
105
105
|
message: payload.message,
|
|
106
106
|
name: payload.name,
|
|
@@ -112,24 +112,24 @@ export function createSubmitHandler(opts, settings) {
|
|
|
112
112
|
submittedAt: ctx.tz.now(),
|
|
113
113
|
fileCount: 0,
|
|
114
114
|
replyCount: 0,
|
|
115
|
-
}, platformActor(),
|
|
115
|
+
}, platformActor(), helpdeskDb(ctx));
|
|
116
116
|
if (!created.isSuccess)
|
|
117
117
|
return created;
|
|
118
118
|
await sendBestEffort(ctx, "forward request", async () => {
|
|
119
|
-
const forwarded = await ctx.dispatch.writeAs(platformActor(),
|
|
119
|
+
const forwarded = await ctx.dispatch.writeAs(platformActor(), HelpdeskHandlers.forwardRequest, { requestId });
|
|
120
120
|
if (!forwarded.isSuccess)
|
|
121
121
|
throw new Error(forwarded.error.message);
|
|
122
122
|
});
|
|
123
|
-
await sendBestEffort(ctx, "confirmation mail", (notify) => notify(
|
|
123
|
+
await sendBestEffort(ctx, "confirmation mail", (notify) => notify(HELPDESK_NOTIFICATION_TYPES.acknowledgement, {
|
|
124
124
|
route: { email },
|
|
125
125
|
recipientId: requestId,
|
|
126
|
-
data:
|
|
126
|
+
data: helpdeskAcknowledgementVariables({
|
|
127
127
|
appName: opts.appName,
|
|
128
128
|
locale: payload.locale,
|
|
129
129
|
}),
|
|
130
|
-
idempotencyKey:
|
|
130
|
+
idempotencyKey: helpdeskIdempotencyKeys.confirmation(requestId),
|
|
131
131
|
priority: "normal",
|
|
132
|
-
locale:
|
|
132
|
+
locale: resolveHelpdeskMailLocale(payload.locale),
|
|
133
133
|
}));
|
|
134
134
|
return SUBMITTED;
|
|
135
135
|
},
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { SYSTEM_TENANT_ID, } from "@cosmicdrift/kumiko-framework/engine";
|
|
2
2
|
import { copyPendingFileRefsToTenant } from "@cosmicdrift/kumiko-framework/files";
|
|
3
3
|
import { fileContextForTenant } from "../../file-foundation/index.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { helpdeskDb, platformActor } from "../lib.js";
|
|
5
|
+
import { HELPDESK_UPLOAD_FIELD } from "../web/constants.js";
|
|
6
6
|
// The form uploads into the submitter's tenant; the request or reply lives in the system tenant.
|
|
7
7
|
export async function takeOverUploads(ctx, args) {
|
|
8
8
|
if (args.fileIds.length === 0)
|
|
9
9
|
return { isSuccess: true, data: [] };
|
|
10
|
-
const db =
|
|
10
|
+
const db = helpdeskDb(ctx);
|
|
11
11
|
const submitterTenantId = args.user.tenantId;
|
|
12
12
|
return copyPendingFileRefsToTenant({
|
|
13
13
|
source: {
|
|
@@ -15,7 +15,7 @@ export async function takeOverUploads(ctx, args) {
|
|
|
15
15
|
user: args.user,
|
|
16
16
|
files: fileContextForTenant(ctx, submitterTenantId, submitterTenantId),
|
|
17
17
|
entityType: args.screen,
|
|
18
|
-
fieldName:
|
|
18
|
+
fieldName: HELPDESK_UPLOAD_FIELD,
|
|
19
19
|
},
|
|
20
20
|
target: {
|
|
21
21
|
db,
|
|
@@ -24,7 +24,7 @@ export async function takeOverUploads(ctx, args) {
|
|
|
24
24
|
files: fileContextForTenant(ctx, submitterTenantId, SYSTEM_TENANT_ID),
|
|
25
25
|
attachTo: {
|
|
26
26
|
entityType: args.entityType,
|
|
27
|
-
fieldName:
|
|
27
|
+
fieldName: HELPDESK_UPLOAD_FIELD,
|
|
28
28
|
entityId: args.entityId,
|
|
29
29
|
},
|
|
30
30
|
},
|
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
const DELIVERY_FIELD = "
|
|
2
|
-
const REQUEST_FIELD = "
|
|
3
|
-
const REPLY_ENTITY_FIELD = "
|
|
1
|
+
const DELIVERY_FIELD = "helpdesk:entity:helpdesk-delivery:field";
|
|
2
|
+
const REQUEST_FIELD = "helpdesk:entity:helpdesk-request:field";
|
|
3
|
+
const REPLY_ENTITY_FIELD = "helpdesk:entity:helpdesk-reply:field";
|
|
4
4
|
// Option labels of an actionForm select resolve against the renderer's pseudo-entity, not a real one.
|
|
5
|
-
const FORM_FIELD = "
|
|
6
|
-
export function
|
|
5
|
+
const FORM_FIELD = "helpdesk:entity:__action-form__:field";
|
|
6
|
+
export function createHelpdeskI18n() {
|
|
7
7
|
return {
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"
|
|
8
|
+
"helpdesk:feature.label": { en: "Contact", de: "Kontakt" },
|
|
9
|
+
"helpdesk:notify.new-request.label": { en: "New contact request", de: "Neue Meldung" },
|
|
10
|
+
"helpdesk:notify.confirmation.label": {
|
|
11
11
|
en: "Contact confirmation",
|
|
12
12
|
de: "Bestätigung der Meldung",
|
|
13
13
|
},
|
|
14
|
-
"
|
|
14
|
+
"helpdesk:notify.acknowledgement.label": {
|
|
15
15
|
en: "Contact acknowledgement",
|
|
16
16
|
de: "Eingangsbestätigung der Meldung",
|
|
17
17
|
},
|
|
18
|
-
"
|
|
18
|
+
"helpdesk:notify.reply.label": {
|
|
19
19
|
en: "Reply to a contact request",
|
|
20
20
|
de: "Antwort auf eine Meldung",
|
|
21
21
|
},
|
|
22
|
-
"
|
|
22
|
+
"helpdesk:notify.reply-in-app.label": {
|
|
23
23
|
en: "Reply note in the app",
|
|
24
24
|
de: "Hinweis auf eine Antwort in der App",
|
|
25
25
|
},
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
26
|
+
"helpdesk:notify.test.label": { en: "Contact test message", de: "Testnachricht Kontakt" },
|
|
27
|
+
"helpdesk:report.submit": { en: "Send report", de: "Meldung senden" },
|
|
28
|
+
"helpdesk:reply.submit": { en: "Send reply", de: "Antwort senden" },
|
|
29
|
+
"helpdesk:overview.open": { en: "Open requests", de: "Offene Meldungen" },
|
|
30
|
+
"helpdesk:filter.open": { en: "Open", de: "Offen" },
|
|
31
|
+
"helpdesk:config.reply-to.label": { en: "Reply-To address", de: "Antwortadresse" },
|
|
32
|
+
"helpdesk:config.telegram-chat.label": { en: "Chat id or @channel", de: "Chat-ID oder @Kanal" },
|
|
33
|
+
"helpdesk:entity:helpdesk-request:field:kind": { en: "Kind", de: "Art" },
|
|
34
|
+
"helpdesk:entity:helpdesk-request:field:status": { en: "Status", de: "Status" },
|
|
35
|
+
"helpdesk:entity:helpdesk-request:field:source": { en: "Source", de: "Quelle" },
|
|
36
|
+
"helpdesk:entity:helpdesk-request:field:subject": { en: "Subject", de: "Betreff" },
|
|
37
|
+
"helpdesk:entity:helpdesk-request:field:message": { en: "Message", de: "Nachricht" },
|
|
38
|
+
"helpdesk:entity:helpdesk-request:field:name": { en: "Name", de: "Name" },
|
|
39
|
+
"helpdesk:entity:helpdesk-request:field:email": { en: "Email", de: "E-Mail" },
|
|
40
|
+
"helpdesk:entity:helpdesk-request:field:phone": { en: "Phone", de: "Telefon" },
|
|
41
|
+
"helpdesk:entity:helpdesk-request:field:submittedAt": { en: "Received", de: "Eingang" },
|
|
42
|
+
"helpdesk:entity:helpdesk-request:field:answeredAt": { en: "Answered", de: "Beantwortet" },
|
|
43
|
+
"helpdesk:entity:helpdesk-request:field:closedAt": { en: "Closed", de: "Abgeschlossen" },
|
|
44
|
+
"helpdesk:entity:helpdesk-request:field:replyCount": { en: "Replies", de: "Antworten" },
|
|
45
|
+
"helpdesk:report.hint": {
|
|
46
46
|
en: "Goes straight to the {appName} team",
|
|
47
47
|
de: "Geht direkt an das Team von {appName}",
|
|
48
48
|
},
|
|
49
|
-
"
|
|
49
|
+
"helpdesk:config.send-test.description": {
|
|
50
50
|
en: "Now sends a test message to the chat.",
|
|
51
51
|
de: "Schickt jetzt eine Testnachricht an den Chat.",
|
|
52
52
|
},
|
|
@@ -56,24 +56,24 @@ export function createContactI18n() {
|
|
|
56
56
|
"screen:reply.title": { en: "Reply", de: "Antworten" },
|
|
57
57
|
"screen:reply-mail.title": { en: "Reply", de: "Antworten" },
|
|
58
58
|
"screen:forwarding.title": { en: "Forwarding of requests", de: "Weiterleitung von Meldungen" },
|
|
59
|
-
"
|
|
59
|
+
"helpdesk:report.summary": {
|
|
60
60
|
en: "The answer comes by email to your account address, usually the same working day.",
|
|
61
61
|
de: "Die Antwort kommt per Mail an die Adresse deines Kontos, meist am selben Werktag.",
|
|
62
62
|
},
|
|
63
|
-
"
|
|
64
|
-
"
|
|
63
|
+
"helpdesk:report.section": { en: "Your report", de: "Deine Meldung" },
|
|
64
|
+
"helpdesk:report.section.description": {
|
|
65
65
|
en: "We attach account, tenant, app version and browser automatically.",
|
|
66
66
|
de: "Konto, Mandant, App-Version und Browser hängen wir automatisch an.",
|
|
67
67
|
},
|
|
68
|
-
"
|
|
68
|
+
"helpdesk:report.success": {
|
|
69
69
|
en: "Thanks, your report has arrived. The answer comes by email.",
|
|
70
70
|
de: "Danke, deine Meldung ist angekommen. Die Antwort kommt per Mail.",
|
|
71
71
|
},
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
"
|
|
75
|
-
"
|
|
76
|
-
"
|
|
72
|
+
"helpdesk:report.field.kind": { en: "Kind", de: "Art" },
|
|
73
|
+
"helpdesk:report.field.phone": { en: "Phone", de: "Telefon" },
|
|
74
|
+
"helpdesk:report.field.subject": { en: "Subject", de: "Betreff" },
|
|
75
|
+
"helpdesk:report.field.message": { en: "What happened?", de: "Was ist passiert?" },
|
|
76
|
+
"helpdesk:report.field.files": { en: "Files", de: "Dateien" },
|
|
77
77
|
[`${FORM_FIELD}:name`]: { en: "Reporter", de: "Absender" },
|
|
78
78
|
[`${FORM_FIELD}:email`]: { en: "Email", de: "E-Mail" },
|
|
79
79
|
[`${FORM_FIELD}:replyTo`]: { en: "Replies go to", de: "Rückantworten an" },
|
|
@@ -81,40 +81,40 @@ export function createContactI18n() {
|
|
|
81
81
|
[`${FORM_FIELD}:kind:option:question`]: { en: "Question", de: "Frage" },
|
|
82
82
|
[`${FORM_FIELD}:kind:option:bug`]: { en: "Bug", de: "Fehler" },
|
|
83
83
|
[`${FORM_FIELD}:kind:option:wish`]: { en: "Wish", de: "Wunsch" },
|
|
84
|
-
"
|
|
85
|
-
"
|
|
84
|
+
"helpdesk:reply.title": { en: "To {name}", de: "An {name}" },
|
|
85
|
+
"helpdesk:reply.summary.in-app": {
|
|
86
86
|
en: "By email to {email} and in the app. Replies go to {replyTo}.",
|
|
87
87
|
de: "Per E-Mail an {email} und in der App. Rückantworten gehen an {replyTo}.",
|
|
88
88
|
},
|
|
89
|
-
"
|
|
89
|
+
"helpdesk:reply.summary.mail": {
|
|
90
90
|
en: "By email to {email}. Replies go to {replyTo}.",
|
|
91
91
|
de: "Per E-Mail an {email}. Rückantworten gehen an {replyTo}.",
|
|
92
92
|
},
|
|
93
|
-
"
|
|
94
|
-
"
|
|
93
|
+
"helpdesk:reply.section": { en: "Reply", de: "Antwort" },
|
|
94
|
+
"helpdesk:reply.section.description": {
|
|
95
95
|
en: "The request is quoted below in the mail.",
|
|
96
96
|
de: "Die Meldung wird unten in der Mail zitiert.",
|
|
97
97
|
},
|
|
98
|
-
"
|
|
99
|
-
"
|
|
100
|
-
"
|
|
98
|
+
"helpdesk:reply.field.message": { en: "Message", de: "Nachricht" },
|
|
99
|
+
"helpdesk:reply.field.files": { en: "Files", de: "Dateien" },
|
|
100
|
+
"helpdesk:reply.field.mark-done": {
|
|
101
101
|
en: "Mark the request as done afterwards",
|
|
102
102
|
de: "Meldung danach als erledigt markieren",
|
|
103
103
|
},
|
|
104
|
-
"
|
|
105
|
-
"
|
|
106
|
-
"
|
|
107
|
-
"
|
|
108
|
-
"
|
|
109
|
-
"
|
|
110
|
-
"
|
|
111
|
-
"
|
|
112
|
-
"
|
|
113
|
-
"
|
|
114
|
-
"
|
|
115
|
-
"
|
|
116
|
-
"
|
|
117
|
-
"
|
|
104
|
+
"helpdesk:filter.all": { en: "All", de: "Alle" },
|
|
105
|
+
"helpdesk:list.from": { en: "From", de: "Von" },
|
|
106
|
+
"helpdesk:action.open": { en: "Open", de: "Öffnen" },
|
|
107
|
+
"helpdesk:action.mark-done": { en: "Mark as done", de: "Als erledigt markieren" },
|
|
108
|
+
"helpdesk:action.reply": { en: "Reply", de: "Antworten" },
|
|
109
|
+
"helpdesk:detail.attachments": { en: "Attachments", de: "Anhänge" },
|
|
110
|
+
"helpdesk:detail.section.message": { en: "Request", de: "Anliegen" },
|
|
111
|
+
"helpdesk:detail.section.replies": { en: "Replies", de: "Antworten" },
|
|
112
|
+
"helpdesk:detail.section.files": { en: "Files", de: "Dateien" },
|
|
113
|
+
"helpdesk:detail.section.sender": { en: "Sender", de: "Absender" },
|
|
114
|
+
"helpdesk:detail.section.origin": { en: "Origin", de: "Herkunft" },
|
|
115
|
+
"helpdesk:detail.section.delivery": { en: "Delivery", de: "Zustellung" },
|
|
116
|
+
"helpdesk:detail.delivery-log": { en: "Delivery log", de: "Zustellprotokoll" },
|
|
117
|
+
"helpdesk:detail.section.notes": { en: "Notes", de: "Notizen" },
|
|
118
118
|
[`${REQUEST_FIELD}:reporterTenantName`]: { en: "Tenant", de: "Mandant" },
|
|
119
119
|
[`${REQUEST_FIELD}:reporterTenantPlan`]: { en: "Tenant plan", de: "Plan des Mandanten" },
|
|
120
120
|
[`${REQUEST_FIELD}:fileCount`]: { en: "Files", de: "Dateien" },
|
|
@@ -134,33 +134,36 @@ export function createContactI18n() {
|
|
|
134
134
|
[`${REPLY_ENTITY_FIELD}:sentAt`]: { en: "Sent", de: "Gesendet" },
|
|
135
135
|
[`${REPLY_ENTITY_FIELD}:authorName`]: { en: "From", de: "Von" },
|
|
136
136
|
[`${REPLY_ENTITY_FIELD}:message`]: { en: "Message", de: "Nachricht" },
|
|
137
|
-
"
|
|
138
|
-
"
|
|
137
|
+
"helpdesk:forwarding.email": { en: "Email", de: "E-Mail" },
|
|
138
|
+
"helpdesk:forwarding.email.description": {
|
|
139
139
|
en: "Every new request goes by email to all SystemAdmins of this app. Turning it off per person goes through delivery; there is no screen for that yet.",
|
|
140
140
|
de: "Jede neue Meldung geht per Mail an alle SystemAdmins dieser App. Abschalten pro Person geht über die Zustellung, eine Maske dafür gibt es noch nicht.",
|
|
141
141
|
},
|
|
142
|
-
"
|
|
143
|
-
"
|
|
142
|
+
"helpdesk:forwarding.telegram": { en: "Telegram", de: "Telegram" },
|
|
143
|
+
"helpdesk:forwarding.telegram.description": {
|
|
144
144
|
en: "Optional. Requests also go as a message to a Telegram chat or channel.",
|
|
145
145
|
de: "Optional. Meldungen gehen zusätzlich als Nachricht in einen Telegram-Chat oder Kanal.",
|
|
146
146
|
},
|
|
147
|
-
"
|
|
148
|
-
"
|
|
147
|
+
"helpdesk:forwarding.submit": { en: "Save", de: "Speichern" },
|
|
148
|
+
"helpdesk:config.reply-to.description": {
|
|
149
149
|
en: "Used as Reply-To in every answer. Empty means the address of the SystemAdmin who replies.",
|
|
150
150
|
de: "Steht als Reply-To in jeder Antwort. Leer heißt: Adresse des SystemAdmins, der antwortet.",
|
|
151
151
|
},
|
|
152
|
-
"
|
|
152
|
+
"helpdesk:config.telegram-chat.description": {
|
|
153
153
|
en: "Leave empty to not use Telegram.",
|
|
154
154
|
de: "Leer lassen, um Telegram nicht zu nutzen.",
|
|
155
155
|
},
|
|
156
|
-
"
|
|
157
|
-
"
|
|
156
|
+
"helpdesk:config.bot-token.label": { en: "Bot token", de: "Bot-Token" },
|
|
157
|
+
"helpdesk:config.bot-token.description": {
|
|
158
158
|
en: "From @BotFather. Stored encrypted and never shown again.",
|
|
159
159
|
de: "Von @BotFather. Wird verschlüsselt gespeichert und nie wieder angezeigt.",
|
|
160
160
|
},
|
|
161
|
-
"
|
|
162
|
-
"
|
|
163
|
-
"
|
|
161
|
+
"helpdesk:config.send-test.label": { en: "Test message", de: "Testnachricht" },
|
|
162
|
+
"helpdesk:config.send-test.button": { en: "Send test message", de: "Testnachricht senden" },
|
|
163
|
+
"helpdesk:config.send-test.success": {
|
|
164
|
+
en: "Test message sent.",
|
|
165
|
+
de: "Testnachricht gesendet.",
|
|
166
|
+
},
|
|
164
167
|
[`${REQUEST_FIELD}:origin:option:website`]: { en: "Website", de: "Website" },
|
|
165
168
|
[`${REQUEST_FIELD}:origin:option:admin-report`]: {
|
|
166
169
|
en: "Admin, report a problem",
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { helpdeskReplyEntity, helpdeskReplyTable, helpdeskRequestEntity, helpdeskRequestTable, } from "./entity.ts";
|
|
2
|
+
export { createHelpdeskFeature } from "./feature.ts";
|
|
3
|
+
export type { HelpdeskOptions } from "./options.ts";
|
|
4
|
+
export { helpdeskOpenRequestsPanels } from "./panels.ts";
|
|
5
|
+
export { HELPDESK_ADMIN_KINDS, HELPDESK_CLIENT_PATH, HELPDESK_DELIVERY_CHANNEL, HELPDESK_DELIVERY_STATUS, HELPDESK_FEATURE, HELPDESK_FIELD_LIMITS, HELPDESK_KIND, HELPDESK_NOTIFICATION_TYPES, HELPDESK_ORIGIN, HELPDESK_REPLY_CHANNELS, HELPDESK_SOURCE, HELPDESK_STATUS, HELPDESK_WEBSITE_KINDS, HelpdeskConfigKeys, HelpdeskErrors, HelpdeskHandlers, HelpdeskQueries, HelpdeskScreens, } from "./web/constants.ts";
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { helpdeskReplyEntity, helpdeskReplyTable, helpdeskRequestEntity, helpdeskRequestTable, } from "./entity.js";
|
|
2
|
+
export { createHelpdeskFeature } from "./feature.js";
|
|
3
|
+
export { helpdeskOpenRequestsPanels } from "./panels.js";
|
|
4
|
+
export { HELPDESK_ADMIN_KINDS, HELPDESK_CLIENT_PATH, HELPDESK_DELIVERY_CHANNEL, HELPDESK_DELIVERY_STATUS, HELPDESK_FEATURE, HELPDESK_FIELD_LIMITS, HELPDESK_KIND, HELPDESK_NOTIFICATION_TYPES, HELPDESK_ORIGIN, HELPDESK_REPLY_CHANNELS, HELPDESK_SOURCE, HELPDESK_STATUS, HELPDESK_WEBSITE_KINDS, HelpdeskConfigKeys, HelpdeskErrors, HelpdeskHandlers, HelpdeskQueries, HelpdeskScreens, } from "./web/constants.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { type TenantDb } from "@cosmicdrift/kumiko-framework/db";
|
|
2
2
|
import { type AppContext, type HandlerContext, type SessionUser } from "@cosmicdrift/kumiko-framework/engine";
|
|
3
|
-
import {
|
|
3
|
+
import { HelpdeskErrors, type HelpdeskPhoneMode, type HelpdeskReplyChannels } from "./web/constants.ts";
|
|
4
4
|
export declare const IN_APP_FEATURE = "channel-in-app";
|
|
5
5
|
export declare const TELEGRAM_FEATURE = "channel-telegram";
|
|
6
|
-
export declare const
|
|
6
|
+
export declare const HELPDESK_CROSS_TENANT_REASON = "helpdesk is platform-wide (systemScope)";
|
|
7
7
|
export declare const SYSTEM_ADMIN_ROLE = "SystemAdmin";
|
|
8
8
|
export declare const adminAccess: {
|
|
9
9
|
readonly roles: readonly string[];
|
|
@@ -86,7 +86,7 @@ export declare function listRepliesOf(db: TenantDb, requestId: string): Promise<
|
|
|
86
86
|
readonly sentAt: Temporal.Instant;
|
|
87
87
|
}[]>;
|
|
88
88
|
export declare function normalizeEmail(email: string): string;
|
|
89
|
-
export declare function
|
|
89
|
+
export declare function helpdeskDb(ctx: Pick<AppContext, "systemDb">): TenantDb;
|
|
90
90
|
export declare function platformActor(): SessionUser;
|
|
91
91
|
export declare function listSystemAdminIds(db: TenantDb): Promise<readonly string[]>;
|
|
92
92
|
export type UserLabel = {
|
|
@@ -95,7 +95,7 @@ export type UserLabel = {
|
|
|
95
95
|
};
|
|
96
96
|
export declare function loadUserLabel(db: TenantDb, userId: string): Promise<UserLabel | null>;
|
|
97
97
|
export declare function sendBestEffort(ctx: Pick<HandlerContext, "notify" | "obs">, label: string, send: (notify: NonNullable<HandlerContext["notify"]>) => Promise<unknown>): Promise<void>;
|
|
98
|
-
export declare function pickReplyChannels(ctx: Pick<HandlerContext, "hasFeature">, reporterUserId: string | null | undefined): Promise<
|
|
99
|
-
export declare function phoneProblem(mode:
|
|
98
|
+
export declare function pickReplyChannels(ctx: Pick<HandlerContext, "hasFeature">, reporterUserId: string | null | undefined): Promise<HelpdeskReplyChannels>;
|
|
99
|
+
export declare function phoneProblem(mode: HelpdeskPhoneMode, phone: string | undefined): (typeof HelpdeskErrors)[keyof typeof HelpdeskErrors] | null;
|
|
100
100
|
export declare function loadTenantName(db: TenantDb, tenantId: string): Promise<string | null>;
|
|
101
101
|
export declare function loadTenantPlan(ctx: Pick<HandlerContext, "dispatch" | "registry" | "obs">, tenantId: string): Promise<string | null>;
|