@burdenoff/microfe-support 2026.830.1 → 2026.830.2
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/index.js +2 -1
- package/dist/support/SupportAdminRoot.js +31 -34
- package/dist/support/SupportAdminRoot.js.map +1 -1
- package/dist/support/SupportUserRoot.js +19 -22
- package/dist/support/SupportUserRoot.js.map +1 -1
- package/dist/support/components/PageLayout.d.ts +1 -1
- package/dist/support/components/PageLayout.js +46 -44
- package/dist/support/components/PageLayout.js.map +1 -1
- package/dist/support/components/analytics/CategoryBreakdown.js +24 -23
- package/dist/support/components/analytics/CategoryBreakdown.js.map +1 -1
- package/dist/support/components/analytics/PriorityBreakdown.js +27 -26
- package/dist/support/components/analytics/PriorityBreakdown.js.map +1 -1
- package/dist/support/components/analytics/SLAReport.js +48 -54
- package/dist/support/components/analytics/SLAReport.js.map +1 -1
- package/dist/support/components/analytics/SatisfactionDistribution.js +56 -59
- package/dist/support/components/analytics/SatisfactionDistribution.js.map +1 -1
- package/dist/support/components/analytics/TopAgents.js +27 -26
- package/dist/support/components/analytics/TopAgents.js.map +1 -1
- package/dist/support/components/analytics/TrendChart.js +23 -21
- package/dist/support/components/analytics/TrendChart.js.map +1 -1
- package/dist/support/components/kb/ArticleForm.js +145 -132
- package/dist/support/components/kb/ArticleForm.js.map +1 -1
- package/dist/support/components/settings/CannedResponsesSettings.js +104 -103
- package/dist/support/components/settings/CannedResponsesSettings.js.map +1 -1
- package/dist/support/components/settings/SLAPoliciesSettings.js +120 -123
- package/dist/support/components/settings/SLAPoliciesSettings.js.map +1 -1
- package/dist/support/components/settings/TicketCategoriesSettings.js +175 -180
- package/dist/support/components/settings/TicketCategoriesSettings.js.map +1 -1
- package/dist/support/components/tickets/AttachmentList.js +21 -20
- package/dist/support/components/tickets/AttachmentList.js.map +1 -1
- package/dist/support/components/tickets/MessageComposer.js +35 -35
- package/dist/support/components/tickets/MessageThread.js +55 -54
- package/dist/support/components/tickets/MessageThread.js.map +1 -1
- package/dist/support/components/tickets/TicketDetailHeader.js +62 -57
- package/dist/support/components/tickets/TicketDetailHeader.js.map +1 -1
- package/dist/support/components/tickets/TicketHeader.js +47 -47
- package/dist/support/components/tickets/TicketSidebar.js +122 -121
- package/dist/support/components/tickets/TicketSidebar.js.map +1 -1
- package/dist/support/hooks/index.d.ts +1 -0
- package/dist/support/hooks/index.js +1 -0
- package/dist/support/hooks/useTr.d.ts +16 -0
- package/dist/support/hooks/useTr.js +12 -0
- package/dist/support/hooks/useTr.js.map +1 -0
- package/dist/support/index.d.ts +1 -0
- package/dist/support/index.js +2 -1
- package/dist/support/pages/AnalyticsPage.js +151 -145
- package/dist/support/pages/AnalyticsPage.js.map +1 -1
- package/dist/support/pages/ArticleDetailAdminPage.js +134 -147
- package/dist/support/pages/ArticleDetailAdminPage.js.map +1 -1
- package/dist/support/pages/ArticleDetailUserPage.js +70 -79
- package/dist/support/pages/ArticleDetailUserPage.js.map +1 -1
- package/dist/support/pages/ContactInquiriesPage.js +140 -139
- package/dist/support/pages/ContactInquiriesPage.js.map +1 -1
- package/dist/support/pages/ContactInquiryDetailPage.js +259 -232
- package/dist/support/pages/ContactInquiryDetailPage.js.map +1 -1
- package/dist/support/pages/CreateArticlePage.js +57 -56
- package/dist/support/pages/CreateArticlePage.js.map +1 -1
- package/dist/support/pages/CreateTicketPage.js +151 -146
- package/dist/support/pages/CreateTicketPage.js.map +1 -1
- package/dist/support/pages/EditArticlePage.js +80 -79
- package/dist/support/pages/EditArticlePage.js.map +1 -1
- package/dist/support/pages/KnowledgeBaseAdminPage.js +92 -99
- package/dist/support/pages/KnowledgeBaseAdminPage.js.map +1 -1
- package/dist/support/pages/KnowledgeBaseUserPage.js +85 -92
- package/dist/support/pages/KnowledgeBaseUserPage.js.map +1 -1
- package/dist/support/pages/SettingsPage.js +88 -87
- package/dist/support/pages/SettingsPage.js.map +1 -1
- package/dist/support/pages/TicketDetailAdminPage.js +91 -90
- package/dist/support/pages/TicketDetailAdminPage.js.map +1 -1
- package/dist/support/pages/TicketDetailUserPage.js +120 -118
- package/dist/support/pages/TicketDetailUserPage.js.map +1 -1
- package/dist/support/pages/TicketListPage.js +139 -139
- package/dist/support/translations/en.d.ts +814 -0
- package/dist/support/translations/en.js +779 -0
- package/dist/support/translations/en.js.map +1 -0
- package/dist/support/translations/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,116 +1,117 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
1
|
+
import { tWithFallback as e } from "../utils/i18n.js";
|
|
2
|
+
import { useTr as t } from "../hooks/useTr.js";
|
|
3
|
+
import { NextSteps as n, PagePurpose as r } from "../components/ui.js";
|
|
4
|
+
import { SupportTicketPriority as i } from "../../generated/global-types.js";
|
|
5
|
+
import { cn as a } from "../utils/cn.js";
|
|
6
|
+
import { EmptyState as o, LoadingState as s, PageLayout as c } from "../components/PageLayout.js";
|
|
7
|
+
import { nativeNotify as l } from "../../utils/nativeBridge.js";
|
|
8
|
+
import { useSettingsOperations as u } from "../hooks/useSettingsOperations.js";
|
|
9
|
+
import { SLAPoliciesSettings as d } from "../components/settings/SLAPoliciesSettings.js";
|
|
10
|
+
import { CannedResponsesSettings as f } from "../components/settings/CannedResponsesSettings.js";
|
|
11
|
+
import { TicketCategoriesSettings as p } from "../components/settings/TicketCategoriesSettings.js";
|
|
12
|
+
import { useState as m } from "react";
|
|
13
|
+
import { useI18n as h } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
14
|
+
import { Settings as g, ShieldAlert as _ } from "lucide-react";
|
|
15
|
+
import { jsx as v, jsxs as y } from "react/jsx-runtime";
|
|
15
16
|
//#region src/support/pages/SettingsPage.tsx
|
|
16
|
-
function
|
|
17
|
+
function b(e) {
|
|
17
18
|
if (!e) return !1;
|
|
18
19
|
let t = String(e).toLowerCase();
|
|
19
20
|
return t.includes("forbidden") || t.includes("not authorized") || t.includes("permission denied") || t.includes("admin");
|
|
20
21
|
}
|
|
21
|
-
function
|
|
22
|
+
function x(e) {
|
|
22
23
|
switch (e) {
|
|
23
|
-
case "CRITICAL": return
|
|
24
|
-
case "HIGH": return
|
|
25
|
-
case "LOW": return
|
|
26
|
-
default: return
|
|
24
|
+
case "CRITICAL": return i.Critical;
|
|
25
|
+
case "HIGH": return i.High;
|
|
26
|
+
case "LOW": return i.Low;
|
|
27
|
+
default: return i.Normal;
|
|
27
28
|
}
|
|
28
29
|
}
|
|
29
|
-
function
|
|
30
|
-
return e ?
|
|
30
|
+
function S(e) {
|
|
31
|
+
return e ? x(e) : void 0;
|
|
31
32
|
}
|
|
32
|
-
function
|
|
33
|
-
let [
|
|
34
|
-
if (
|
|
35
|
-
title:
|
|
36
|
-
subtitle:
|
|
37
|
-
icon: /* @__PURE__ */ g
|
|
38
|
-
children: /* @__PURE__ */
|
|
39
|
-
icon: /* @__PURE__ */
|
|
40
|
-
title:
|
|
41
|
-
description:
|
|
33
|
+
function C() {
|
|
34
|
+
let [i, C] = m("sla"), { t: w } = h(), T = t(), { slaPolicies: E, cannedResponses: D, ticketCategories: O, isLoading: k, slaPoliciesError: A, cannedResponsesError: j, createSLAPolicy: M, updateSLAPolicy: N, deleteSLAPolicy: P, createCannedResponse: F, updateCannedResponse: I, deleteCannedResponse: L, createTicketCategory: R, updateTicketCategory: z, deleteTicketCategory: B } = u();
|
|
35
|
+
if (b(A) || b(j)) return /* @__PURE__ */ v(c, {
|
|
36
|
+
title: e(w, "support.settings.title", "Support Settings"),
|
|
37
|
+
subtitle: e(w, "support.settings.subtitle", "Configure support module preferences and policies"),
|
|
38
|
+
icon: /* @__PURE__ */ v(g, { size: 24 }),
|
|
39
|
+
children: /* @__PURE__ */ v(o, {
|
|
40
|
+
icon: /* @__PURE__ */ v(_, { size: 48 }),
|
|
41
|
+
title: e(w, "support.settings.permission.title", "Admin Access Required"),
|
|
42
|
+
description: e(w, "support.settings.permission.description", "You need administrator privileges to access support settings. Please contact your workspace admin for access.")
|
|
42
43
|
})
|
|
43
44
|
});
|
|
44
|
-
let
|
|
45
|
+
let V = [
|
|
45
46
|
{
|
|
46
47
|
id: "sla",
|
|
47
|
-
label:
|
|
48
|
+
label: e(w, "support.settings.tabs.sla", "SLA Policies")
|
|
48
49
|
},
|
|
49
50
|
{
|
|
50
51
|
id: "responses",
|
|
51
|
-
label:
|
|
52
|
+
label: e(w, "support.settings.tabs.responses", "Canned Responses")
|
|
52
53
|
},
|
|
53
54
|
{
|
|
54
55
|
id: "categories",
|
|
55
|
-
label:
|
|
56
|
+
label: e(w, "support.settings.tabs.categories", "Categories")
|
|
56
57
|
}
|
|
57
58
|
];
|
|
58
|
-
return
|
|
59
|
-
title:
|
|
60
|
-
subtitle:
|
|
61
|
-
icon: /* @__PURE__ */ g
|
|
62
|
-
children: /* @__PURE__ */
|
|
63
|
-
}) : /* @__PURE__ */
|
|
64
|
-
title:
|
|
65
|
-
subtitle:
|
|
66
|
-
icon: /* @__PURE__ */ g
|
|
59
|
+
return k ? /* @__PURE__ */ v(c, {
|
|
60
|
+
title: e(w, "support.settings.title", "Support Settings"),
|
|
61
|
+
subtitle: e(w, "support.settings.subtitle", "Configure support module preferences and policies"),
|
|
62
|
+
icon: /* @__PURE__ */ v(g, { size: 24 }),
|
|
63
|
+
children: /* @__PURE__ */ v(s, { message: e(w, "support.settings.loading", "Loading settings...") })
|
|
64
|
+
}) : /* @__PURE__ */ y(c, {
|
|
65
|
+
title: e(w, "support.settings.title", "Support Settings"),
|
|
66
|
+
subtitle: e(w, "support.settings.subtitle", "Configure support module preferences and policies"),
|
|
67
|
+
icon: /* @__PURE__ */ v(g, { size: 24 }),
|
|
67
68
|
children: [
|
|
68
|
-
/* @__PURE__ */
|
|
69
|
-
/* @__PURE__ */
|
|
69
|
+
/* @__PURE__ */ v(r, { children: T("support.settings.purpose", "Tune how your support desk runs. Define SLA policies so high-priority tickets get a guaranteed response time, write canned responses so agents reply to common questions in one click, and organise tickets and articles into categories. These settings shape the experience for both your team and your customers.") }),
|
|
70
|
+
/* @__PURE__ */ v(n, {
|
|
70
71
|
storageKey: "support-settings",
|
|
71
|
-
title: "Set up your support desk",
|
|
72
|
+
title: T("support.settings.nextSteps.title", "Set up your support desk"),
|
|
72
73
|
className: "mb-6",
|
|
73
74
|
steps: [
|
|
74
75
|
{
|
|
75
76
|
id: "sla",
|
|
76
|
-
label: "Define SLA policies",
|
|
77
|
-
description: "Set response and resolution targets per priority.",
|
|
78
|
-
onClick: () =>
|
|
79
|
-
done:
|
|
77
|
+
label: T("support.settings.nextSteps.sla.label", "Define SLA policies"),
|
|
78
|
+
description: T("support.settings.nextSteps.sla.description", "Set response and resolution targets per priority."),
|
|
79
|
+
onClick: () => C("sla"),
|
|
80
|
+
done: i === "sla"
|
|
80
81
|
},
|
|
81
82
|
{
|
|
82
83
|
id: "responses",
|
|
83
|
-
label: "Create canned responses",
|
|
84
|
-
description: "Reusable replies that agents can insert instantly.",
|
|
85
|
-
onClick: () =>
|
|
86
|
-
done:
|
|
84
|
+
label: T("support.settings.nextSteps.responses.label", "Create canned responses"),
|
|
85
|
+
description: T("support.settings.nextSteps.responses.description", "Reusable replies that agents can insert instantly."),
|
|
86
|
+
onClick: () => C("responses"),
|
|
87
|
+
done: i === "responses"
|
|
87
88
|
},
|
|
88
89
|
{
|
|
89
90
|
id: "categories",
|
|
90
|
-
label: "Organise categories",
|
|
91
|
-
description: "Group tickets and articles for easier triage.",
|
|
92
|
-
onClick: () =>
|
|
93
|
-
done:
|
|
91
|
+
label: T("support.settings.nextSteps.categories.label", "Organise categories"),
|
|
92
|
+
description: T("support.settings.nextSteps.categories.description", "Group tickets and articles for easier triage."),
|
|
93
|
+
onClick: () => C("categories"),
|
|
94
|
+
done: i === "categories"
|
|
94
95
|
}
|
|
95
96
|
]
|
|
96
97
|
}),
|
|
97
|
-
/* @__PURE__ */
|
|
98
|
+
/* @__PURE__ */ v("div", {
|
|
98
99
|
className: "border-b border-border-subtle -mx-4 px-4 mb-6 overflow-x-auto sm:-mx-6 sm:px-6",
|
|
99
|
-
children: /* @__PURE__ */
|
|
100
|
+
children: /* @__PURE__ */ v("div", {
|
|
100
101
|
className: "flex min-w-max gap-1",
|
|
101
|
-
children:
|
|
102
|
+
children: V.map((e) => /* @__PURE__ */ y("button", {
|
|
102
103
|
type: "button",
|
|
103
|
-
onClick: () =>
|
|
104
|
-
className:
|
|
105
|
-
children: [e.label,
|
|
104
|
+
onClick: () => C(e.id),
|
|
105
|
+
className: a("min-h-11 px-4 py-3 font-medium transition-colors relative", i === e.id ? "text-primary" : "text-text-secondary hover:text-text-primary"),
|
|
106
|
+
children: [e.label, i === e.id && /* @__PURE__ */ v("div", { className: "absolute bottom-0 left-0 right-0 h-0.5 bg-action-primary-bg" })]
|
|
106
107
|
}, e.id))
|
|
107
108
|
})
|
|
108
109
|
}),
|
|
109
|
-
/* @__PURE__ */
|
|
110
|
+
/* @__PURE__ */ y("div", {
|
|
110
111
|
className: "max-w-4xl",
|
|
111
112
|
children: [
|
|
112
|
-
|
|
113
|
-
policies:
|
|
113
|
+
i === "sla" && /* @__PURE__ */ v(d, {
|
|
114
|
+
policies: E.map((e) => ({
|
|
114
115
|
id: e.id,
|
|
115
116
|
name: e.name,
|
|
116
117
|
priority: e.priority,
|
|
@@ -119,11 +120,11 @@ function S() {
|
|
|
119
120
|
businessHoursOnly: !1,
|
|
120
121
|
active: e.isActive
|
|
121
122
|
})),
|
|
122
|
-
defaultPolicyId:
|
|
123
|
+
defaultPolicyId: E.find((e) => e.isDefault)?.id,
|
|
123
124
|
onCreate: async (e) => {
|
|
124
|
-
let t = await
|
|
125
|
+
let t = await M({
|
|
125
126
|
name: e.name,
|
|
126
|
-
priority:
|
|
127
|
+
priority: x(e.priority),
|
|
127
128
|
firstResponseMinutes: e.firstResponseTimeMinutes,
|
|
128
129
|
resolutionMinutes: e.resolutionTimeMinutes
|
|
129
130
|
});
|
|
@@ -138,9 +139,9 @@ function S() {
|
|
|
138
139
|
};
|
|
139
140
|
},
|
|
140
141
|
onUpdate: async (e, t) => {
|
|
141
|
-
let n = await
|
|
142
|
+
let n = await N(e, {
|
|
142
143
|
name: t.name,
|
|
143
|
-
priority:
|
|
144
|
+
priority: S(t.priority),
|
|
144
145
|
firstResponseMinutes: t.firstResponseTimeMinutes,
|
|
145
146
|
resolutionMinutes: t.resolutionTimeMinutes,
|
|
146
147
|
isActive: t.active
|
|
@@ -157,37 +158,37 @@ function S() {
|
|
|
157
158
|
},
|
|
158
159
|
onDelete: async (e) => {
|
|
159
160
|
try {
|
|
160
|
-
await
|
|
161
|
+
await P(e), l("success");
|
|
161
162
|
} catch (e) {
|
|
162
|
-
throw
|
|
163
|
+
throw l("error"), e;
|
|
163
164
|
}
|
|
164
165
|
}
|
|
165
166
|
}),
|
|
166
|
-
|
|
167
|
-
responses:
|
|
167
|
+
i === "responses" && /* @__PURE__ */ v(f, {
|
|
168
|
+
responses: D.map((e) => ({
|
|
168
169
|
id: e.id,
|
|
169
170
|
title: e.title,
|
|
170
171
|
content: e.content,
|
|
171
172
|
tags: e.tags,
|
|
172
173
|
isActive: e.isActive
|
|
173
174
|
})),
|
|
174
|
-
onCreate: async (e) => await
|
|
175
|
+
onCreate: async (e) => await F({
|
|
175
176
|
title: e.title,
|
|
176
177
|
content: e.content,
|
|
177
178
|
tags: e.tags
|
|
178
179
|
}),
|
|
179
|
-
onUpdate: async (e, t) => await
|
|
180
|
+
onUpdate: async (e, t) => await I(e, {
|
|
180
181
|
title: t.title,
|
|
181
182
|
content: t.content,
|
|
182
183
|
tags: t.tags,
|
|
183
184
|
isActive: t.isActive
|
|
184
185
|
}),
|
|
185
186
|
onDelete: async (e) => {
|
|
186
|
-
await
|
|
187
|
+
await L(e);
|
|
187
188
|
}
|
|
188
189
|
}),
|
|
189
|
-
|
|
190
|
-
categories:
|
|
190
|
+
i === "categories" && /* @__PURE__ */ v(p, {
|
|
191
|
+
categories: O.map((e) => ({
|
|
191
192
|
id: e.id,
|
|
192
193
|
name: e.name,
|
|
193
194
|
slug: e.slug,
|
|
@@ -200,7 +201,7 @@ function S() {
|
|
|
200
201
|
parentId: e.parentId
|
|
201
202
|
})),
|
|
202
203
|
onCreate: async (e) => {
|
|
203
|
-
let t = await
|
|
204
|
+
let t = await R({
|
|
204
205
|
name: e.name,
|
|
205
206
|
slug: e.slug,
|
|
206
207
|
description: e.description,
|
|
@@ -219,7 +220,7 @@ function S() {
|
|
|
219
220
|
} : null;
|
|
220
221
|
},
|
|
221
222
|
onUpdate: async (e, t) => {
|
|
222
|
-
let n = await
|
|
223
|
+
let n = await z(e, {
|
|
223
224
|
name: t.name,
|
|
224
225
|
slug: t.slug,
|
|
225
226
|
description: t.description,
|
|
@@ -238,7 +239,7 @@ function S() {
|
|
|
238
239
|
isActive: n.isActive
|
|
239
240
|
} : null;
|
|
240
241
|
},
|
|
241
|
-
onDelete:
|
|
242
|
+
onDelete: B
|
|
242
243
|
})
|
|
243
244
|
]
|
|
244
245
|
})
|
|
@@ -246,6 +247,6 @@ function S() {
|
|
|
246
247
|
});
|
|
247
248
|
}
|
|
248
249
|
//#endregion
|
|
249
|
-
export {
|
|
250
|
+
export { C as SettingsPage };
|
|
250
251
|
|
|
251
252
|
//# sourceMappingURL=SettingsPage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SettingsPage.js","names":[],"sources":["../../../src/support/pages/SettingsPage.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { Settings, ShieldAlert } from 'lucide-react';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport { cn } from '../utils/cn';\nimport { useSettingsOperations } from '../hooks/useSettingsOperations';\nimport { SLAPoliciesSettings } from '../components/settings/SLAPoliciesSettings';\nimport { CannedResponsesSettings } from '../components/settings/CannedResponsesSettings';\nimport { TicketCategoriesSettings } from '../components/settings/TicketCategoriesSettings';\nimport { PageLayout, LoadingState, EmptyState } from '../components/PageLayout';\nimport { PagePurpose, NextSteps } from '../components/ui';\nimport { tWithFallback } from '../utils/i18n';\nimport { SupportTicketPriority } from '../../generated/global-types';\nimport { nativeNotify } from '../../utils/nativeBridge';\n\n// Helper to check if error is a permission/authorization error\nfunction isPermissionError(error: unknown): boolean {\n if (!error) return false;\n const errorMessage = String(error).toLowerCase();\n return (\n errorMessage.includes('forbidden') ||\n errorMessage.includes('not authorized') ||\n errorMessage.includes('permission denied') ||\n errorMessage.includes('admin')\n );\n}\n\n// Note: Backend doesn't have unified \"settings\" query - only individual resources\ntype SettingsTab = 'sla' | 'responses' | 'categories';\n\nfunction toSupportTicketPriority(priority: string): SupportTicketPriority {\n switch (priority) {\n case 'CRITICAL':\n return SupportTicketPriority.Critical;\n case 'HIGH':\n return SupportTicketPriority.High;\n case 'LOW':\n return SupportTicketPriority.Low;\n default:\n return SupportTicketPriority.Normal;\n }\n}\n\nfunction toOptionalSupportTicketPriority(priority?: string): SupportTicketPriority | undefined {\n return priority ? toSupportTicketPriority(priority) : undefined;\n}\n\nexport function SettingsPage() {\n const [activeTab, setActiveTab] = useState<SettingsTab>('sla');\n const { t } = useI18n();\n const {\n slaPolicies,\n cannedResponses,\n ticketCategories,\n isLoading,\n slaPoliciesError,\n cannedResponsesError,\n createSLAPolicy,\n updateSLAPolicy,\n deleteSLAPolicy,\n createCannedResponse,\n updateCannedResponse,\n deleteCannedResponse,\n createTicketCategory,\n updateTicketCategory,\n deleteTicketCategory,\n } = useSettingsOperations();\n\n // Check for permission errors across settings queries\n // Note: SLA policies and canned responses require admin access\n const hasPermissionError =\n isPermissionError(slaPoliciesError) || isPermissionError(cannedResponsesError);\n\n if (hasPermissionError) {\n return (\n <PageLayout\n title={tWithFallback(t, 'support.settings.title', 'Support Settings')}\n subtitle={tWithFallback(\n t,\n 'support.settings.subtitle',\n 'Configure support module preferences and policies'\n )}\n icon={<Settings size={24} />}\n >\n <EmptyState\n icon={<ShieldAlert size={48} />}\n title={tWithFallback(t, 'support.settings.permission.title', 'Admin Access Required')}\n description={tWithFallback(\n t,\n 'support.settings.permission.description',\n 'You need administrator privileges to access support settings. Please contact your workspace admin for access.'\n )}\n />\n </PageLayout>\n );\n }\n\n const tabs: { id: SettingsTab; label: string }[] = [\n { id: 'sla', label: tWithFallback(t, 'support.settings.tabs.sla', 'SLA Policies') },\n {\n id: 'responses',\n label: tWithFallback(t, 'support.settings.tabs.responses', 'Canned Responses'),\n },\n {\n id: 'categories',\n label: tWithFallback(t, 'support.settings.tabs.categories', 'Categories'),\n },\n ];\n\n // Local SLAPolicy type matching component expectations\n type LocalSLAPolicy = {\n id: string;\n name: string;\n priority: string;\n firstResponseTimeMinutes: number;\n resolutionTimeMinutes: number;\n businessHoursOnly: boolean;\n active: boolean;\n };\n\n // Adapter functions to match component prop types\n const handleCreateSLAPolicy = async (input: LocalSLAPolicy): Promise<LocalSLAPolicy> => {\n const result = await createSLAPolicy({\n name: input.name,\n priority: toSupportTicketPriority(input.priority),\n firstResponseMinutes: input.firstResponseTimeMinutes,\n resolutionMinutes: input.resolutionTimeMinutes,\n });\n return {\n id: result.id,\n name: result.name,\n priority: result.priority,\n firstResponseTimeMinutes: result.firstResponseMinutes,\n resolutionTimeMinutes: result.resolutionMinutes,\n businessHoursOnly: false,\n active: result.isActive,\n };\n };\n\n const handleUpdateSLAPolicy = async (\n id: string,\n input: LocalSLAPolicy\n ): Promise<LocalSLAPolicy> => {\n const result = await updateSLAPolicy(id, {\n name: input.name,\n priority: toOptionalSupportTicketPriority(input.priority),\n firstResponseMinutes: input.firstResponseTimeMinutes,\n resolutionMinutes: input.resolutionTimeMinutes,\n isActive: input.active,\n });\n return {\n id: result.id,\n name: result.name,\n priority: result.priority,\n firstResponseTimeMinutes: result.firstResponseMinutes,\n resolutionTimeMinutes: result.resolutionMinutes,\n businessHoursOnly: false,\n active: result.isActive,\n };\n };\n\n const handleDeleteSLAPolicy = async (id: string): Promise<void> => {\n try {\n await deleteSLAPolicy(id);\n void nativeNotify('success');\n } catch (err) {\n void nativeNotify('error');\n throw err;\n }\n };\n\n const handleCreateCannedResponse = async (input: {\n title: string;\n content: string;\n tags?: string[];\n }) => {\n const result = await createCannedResponse({\n title: input.title,\n content: input.content,\n tags: input.tags,\n });\n return result;\n };\n\n const handleUpdateCannedResponse = async (\n id: string,\n input: { title?: string; content?: string; tags?: string[]; isActive?: boolean }\n ) => {\n const result = await updateCannedResponse(id, {\n title: input.title,\n content: input.content,\n tags: input.tags,\n isActive: input.isActive,\n });\n return result;\n };\n\n const handleDeleteCannedResponse = async (id: string): Promise<void> => {\n await deleteCannedResponse(id);\n };\n\n // Local TicketCategory type matching component expectations\n type LocalTicketCategory = {\n id?: string;\n name: string;\n slug: string;\n description?: string;\n color?: string;\n icon?: string;\n displayOrder?: number;\n isActive?: boolean;\n articleCount?: number;\n parentId?: string;\n };\n\n const handleCreateTicketCategory = async (\n input: Omit<LocalTicketCategory, 'id' | 'articleCount'>\n ): Promise<LocalTicketCategory | null | undefined> => {\n const result = await createTicketCategory({\n name: input.name,\n slug: input.slug,\n description: input.description,\n color: input.color,\n icon: input.icon,\n parentId: input.parentId,\n });\n if (!result) return null;\n // Transform from generated TicketCategory (Maybe<string>) to local (string | undefined)\n return {\n id: result.id,\n name: result.name,\n slug: result.slug,\n description: result.description ?? undefined,\n color: result.color ?? undefined,\n icon: result.icon ?? undefined,\n isActive: result.isActive,\n };\n };\n\n const handleUpdateTicketCategory = async (\n id: string,\n input: Partial<LocalTicketCategory>\n ): Promise<LocalTicketCategory | null | undefined> => {\n const result = await updateTicketCategory(id, {\n name: input.name,\n slug: input.slug,\n description: input.description,\n color: input.color,\n icon: input.icon,\n isActive: input.isActive,\n parentId: input.parentId,\n });\n if (!result) return null;\n // Transform from generated TicketCategory (Maybe<string>) to local (string | undefined)\n return {\n id: result.id,\n name: result.name,\n slug: result.slug,\n description: result.description ?? undefined,\n color: result.color ?? undefined,\n icon: result.icon ?? undefined,\n isActive: result.isActive,\n };\n };\n\n if (isLoading) {\n return (\n <PageLayout\n title={tWithFallback(t, 'support.settings.title', 'Support Settings')}\n subtitle={tWithFallback(\n t,\n 'support.settings.subtitle',\n 'Configure support module preferences and policies'\n )}\n icon={<Settings size={24} />}\n >\n <LoadingState\n message={tWithFallback(t, 'support.settings.loading', 'Loading settings...')}\n />\n </PageLayout>\n );\n }\n\n return (\n <PageLayout\n title={tWithFallback(t, 'support.settings.title', 'Support Settings')}\n subtitle={tWithFallback(\n t,\n 'support.settings.subtitle',\n 'Configure support module preferences and policies'\n )}\n icon={<Settings size={24} />}\n >\n <PagePurpose>\n Tune how your support desk runs. Define SLA policies so high-priority tickets get a\n guaranteed response time, write canned responses so agents reply to common questions in one\n click, and organise tickets and articles into categories. These settings shape the\n experience for both your team and your customers.\n </PagePurpose>\n\n <NextSteps\n storageKey=\"support-settings\"\n title=\"Set up your support desk\"\n className=\"mb-6\"\n steps={[\n {\n id: 'sla',\n label: 'Define SLA policies',\n description: 'Set response and resolution targets per priority.',\n onClick: () => setActiveTab('sla'),\n done: activeTab === 'sla',\n },\n {\n id: 'responses',\n label: 'Create canned responses',\n description: 'Reusable replies that agents can insert instantly.',\n onClick: () => setActiveTab('responses'),\n done: activeTab === 'responses',\n },\n {\n id: 'categories',\n label: 'Organise categories',\n description: 'Group tickets and articles for easier triage.',\n onClick: () => setActiveTab('categories'),\n done: activeTab === 'categories',\n },\n ]}\n />\n\n {/* Tabs */}\n <div className=\"border-b border-border-subtle -mx-4 px-4 mb-6 overflow-x-auto sm:-mx-6 sm:px-6\">\n <div className=\"flex min-w-max gap-1\">\n {tabs.map((tab) => (\n <button\n type=\"button\"\n key={tab.id}\n onClick={() => setActiveTab(tab.id)}\n className={cn(\n 'min-h-11 px-4 py-3 font-medium transition-colors relative',\n activeTab === tab.id\n ? 'text-primary'\n : 'text-text-secondary hover:text-text-primary'\n )}\n >\n {tab.label}\n {activeTab === tab.id && (\n <div className=\"absolute bottom-0 left-0 right-0 h-0.5 bg-action-primary-bg\" />\n )}\n </button>\n ))}\n </div>\n </div>\n\n {/* Content */}\n <div className=\"max-w-4xl\">\n {activeTab === 'sla' && (\n <SLAPoliciesSettings\n policies={slaPolicies.map((p: Record<string, unknown>) => ({\n id: p.id as string,\n name: p.name as string,\n priority: p.priority as string,\n firstResponseTimeMinutes: p.firstResponseMinutes as number,\n resolutionTimeMinutes: p.resolutionMinutes as number,\n businessHoursOnly: false,\n active: p.isActive as boolean,\n }))}\n defaultPolicyId={\n slaPolicies.find((p: Record<string, unknown>) => p.isDefault)?.id as\n | string\n | undefined\n }\n onCreate={handleCreateSLAPolicy}\n onUpdate={handleUpdateSLAPolicy}\n onDelete={handleDeleteSLAPolicy}\n />\n )}\n {activeTab === 'responses' && (\n <CannedResponsesSettings\n responses={cannedResponses.map((r: Record<string, unknown>) => ({\n id: r.id as string,\n title: r.title as string,\n content: r.content as string,\n tags: r.tags as string[],\n isActive: r.isActive as boolean,\n }))}\n onCreate={handleCreateCannedResponse}\n onUpdate={handleUpdateCannedResponse}\n onDelete={handleDeleteCannedResponse}\n />\n )}\n {activeTab === 'categories' && (\n <TicketCategoriesSettings\n categories={ticketCategories.map((c: Record<string, unknown>) => ({\n id: c.id as string,\n name: c.name as string,\n slug: c.slug as string,\n description: c.description as string | undefined,\n color: c.color as string | undefined,\n icon: c.icon as string | undefined,\n displayOrder: c.displayOrder as number | undefined,\n isActive: c.isActive as boolean,\n articleCount: c.articleCount as number | undefined,\n parentId: c.parentId as string | undefined,\n }))}\n onCreate={handleCreateTicketCategory}\n onUpdate={handleUpdateTicketCategory}\n onDelete={deleteTicketCategory}\n />\n )}\n </div>\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAeA,SAAS,EAAkB,GAAyB;CAClD,IAAI,CAAC,GAAO,OAAO;CACnB,IAAM,IAAe,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A;IAEA;;EACK;;AAEhB"}
|
|
1
|
+
{"version":3,"file":"SettingsPage.js","names":[],"sources":["../../../src/support/pages/SettingsPage.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { Settings, ShieldAlert } from 'lucide-react';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport { cn } from '../utils/cn';\nimport { useSettingsOperations } from '../hooks/useSettingsOperations';\nimport { useTr } from '../hooks/useTr';\nimport { SLAPoliciesSettings } from '../components/settings/SLAPoliciesSettings';\nimport { CannedResponsesSettings } from '../components/settings/CannedResponsesSettings';\nimport { TicketCategoriesSettings } from '../components/settings/TicketCategoriesSettings';\nimport { PageLayout, LoadingState, EmptyState } from '../components/PageLayout';\nimport { PagePurpose, NextSteps } from '../components/ui';\nimport { tWithFallback } from '../utils/i18n';\nimport { SupportTicketPriority } from '../../generated/global-types';\nimport { nativeNotify } from '../../utils/nativeBridge';\n\n// Helper to check if error is a permission/authorization error\nfunction isPermissionError(error: unknown): boolean {\n if (!error) return false;\n const errorMessage = String(error).toLowerCase();\n return (\n errorMessage.includes('forbidden') ||\n errorMessage.includes('not authorized') ||\n errorMessage.includes('permission denied') ||\n errorMessage.includes('admin')\n );\n}\n\n// Note: Backend doesn't have unified \"settings\" query - only individual resources\ntype SettingsTab = 'sla' | 'responses' | 'categories';\n\nfunction toSupportTicketPriority(priority: string): SupportTicketPriority {\n switch (priority) {\n case 'CRITICAL':\n return SupportTicketPriority.Critical;\n case 'HIGH':\n return SupportTicketPriority.High;\n case 'LOW':\n return SupportTicketPriority.Low;\n default:\n return SupportTicketPriority.Normal;\n }\n}\n\nfunction toOptionalSupportTicketPriority(priority?: string): SupportTicketPriority | undefined {\n return priority ? toSupportTicketPriority(priority) : undefined;\n}\n\nexport function SettingsPage() {\n const [activeTab, setActiveTab] = useState<SettingsTab>('sla');\n const { t } = useI18n();\n const tr = useTr();\n const {\n slaPolicies,\n cannedResponses,\n ticketCategories,\n isLoading,\n slaPoliciesError,\n cannedResponsesError,\n createSLAPolicy,\n updateSLAPolicy,\n deleteSLAPolicy,\n createCannedResponse,\n updateCannedResponse,\n deleteCannedResponse,\n createTicketCategory,\n updateTicketCategory,\n deleteTicketCategory,\n } = useSettingsOperations();\n\n // Check for permission errors across settings queries\n // Note: SLA policies and canned responses require admin access\n const hasPermissionError =\n isPermissionError(slaPoliciesError) || isPermissionError(cannedResponsesError);\n\n if (hasPermissionError) {\n return (\n <PageLayout\n title={tWithFallback(t, 'support.settings.title', 'Support Settings')}\n subtitle={tWithFallback(\n t,\n 'support.settings.subtitle',\n 'Configure support module preferences and policies'\n )}\n icon={<Settings size={24} />}\n >\n <EmptyState\n icon={<ShieldAlert size={48} />}\n title={tWithFallback(t, 'support.settings.permission.title', 'Admin Access Required')}\n description={tWithFallback(\n t,\n 'support.settings.permission.description',\n 'You need administrator privileges to access support settings. Please contact your workspace admin for access.'\n )}\n />\n </PageLayout>\n );\n }\n\n const tabs: { id: SettingsTab; label: string }[] = [\n { id: 'sla', label: tWithFallback(t, 'support.settings.tabs.sla', 'SLA Policies') },\n {\n id: 'responses',\n label: tWithFallback(t, 'support.settings.tabs.responses', 'Canned Responses'),\n },\n {\n id: 'categories',\n label: tWithFallback(t, 'support.settings.tabs.categories', 'Categories'),\n },\n ];\n\n // Local SLAPolicy type matching component expectations\n type LocalSLAPolicy = {\n id: string;\n name: string;\n priority: string;\n firstResponseTimeMinutes: number;\n resolutionTimeMinutes: number;\n businessHoursOnly: boolean;\n active: boolean;\n };\n\n // Adapter functions to match component prop types\n const handleCreateSLAPolicy = async (input: LocalSLAPolicy): Promise<LocalSLAPolicy> => {\n const result = await createSLAPolicy({\n name: input.name,\n priority: toSupportTicketPriority(input.priority),\n firstResponseMinutes: input.firstResponseTimeMinutes,\n resolutionMinutes: input.resolutionTimeMinutes,\n });\n return {\n id: result.id,\n name: result.name,\n priority: result.priority,\n firstResponseTimeMinutes: result.firstResponseMinutes,\n resolutionTimeMinutes: result.resolutionMinutes,\n businessHoursOnly: false,\n active: result.isActive,\n };\n };\n\n const handleUpdateSLAPolicy = async (\n id: string,\n input: LocalSLAPolicy\n ): Promise<LocalSLAPolicy> => {\n const result = await updateSLAPolicy(id, {\n name: input.name,\n priority: toOptionalSupportTicketPriority(input.priority),\n firstResponseMinutes: input.firstResponseTimeMinutes,\n resolutionMinutes: input.resolutionTimeMinutes,\n isActive: input.active,\n });\n return {\n id: result.id,\n name: result.name,\n priority: result.priority,\n firstResponseTimeMinutes: result.firstResponseMinutes,\n resolutionTimeMinutes: result.resolutionMinutes,\n businessHoursOnly: false,\n active: result.isActive,\n };\n };\n\n const handleDeleteSLAPolicy = async (id: string): Promise<void> => {\n try {\n await deleteSLAPolicy(id);\n void nativeNotify('success');\n } catch (err) {\n void nativeNotify('error');\n throw err;\n }\n };\n\n const handleCreateCannedResponse = async (input: {\n title: string;\n content: string;\n tags?: string[];\n }) => {\n const result = await createCannedResponse({\n title: input.title,\n content: input.content,\n tags: input.tags,\n });\n return result;\n };\n\n const handleUpdateCannedResponse = async (\n id: string,\n input: { title?: string; content?: string; tags?: string[]; isActive?: boolean }\n ) => {\n const result = await updateCannedResponse(id, {\n title: input.title,\n content: input.content,\n tags: input.tags,\n isActive: input.isActive,\n });\n return result;\n };\n\n const handleDeleteCannedResponse = async (id: string): Promise<void> => {\n await deleteCannedResponse(id);\n };\n\n // Local TicketCategory type matching component expectations\n type LocalTicketCategory = {\n id?: string;\n name: string;\n slug: string;\n description?: string;\n color?: string;\n icon?: string;\n displayOrder?: number;\n isActive?: boolean;\n articleCount?: number;\n parentId?: string;\n };\n\n const handleCreateTicketCategory = async (\n input: Omit<LocalTicketCategory, 'id' | 'articleCount'>\n ): Promise<LocalTicketCategory | null | undefined> => {\n const result = await createTicketCategory({\n name: input.name,\n slug: input.slug,\n description: input.description,\n color: input.color,\n icon: input.icon,\n parentId: input.parentId,\n });\n if (!result) return null;\n // Transform from generated TicketCategory (Maybe<string>) to local (string | undefined)\n return {\n id: result.id,\n name: result.name,\n slug: result.slug,\n description: result.description ?? undefined,\n color: result.color ?? undefined,\n icon: result.icon ?? undefined,\n isActive: result.isActive,\n };\n };\n\n const handleUpdateTicketCategory = async (\n id: string,\n input: Partial<LocalTicketCategory>\n ): Promise<LocalTicketCategory | null | undefined> => {\n const result = await updateTicketCategory(id, {\n name: input.name,\n slug: input.slug,\n description: input.description,\n color: input.color,\n icon: input.icon,\n isActive: input.isActive,\n parentId: input.parentId,\n });\n if (!result) return null;\n // Transform from generated TicketCategory (Maybe<string>) to local (string | undefined)\n return {\n id: result.id,\n name: result.name,\n slug: result.slug,\n description: result.description ?? undefined,\n color: result.color ?? undefined,\n icon: result.icon ?? undefined,\n isActive: result.isActive,\n };\n };\n\n if (isLoading) {\n return (\n <PageLayout\n title={tWithFallback(t, 'support.settings.title', 'Support Settings')}\n subtitle={tWithFallback(\n t,\n 'support.settings.subtitle',\n 'Configure support module preferences and policies'\n )}\n icon={<Settings size={24} />}\n >\n <LoadingState\n message={tWithFallback(t, 'support.settings.loading', 'Loading settings...')}\n />\n </PageLayout>\n );\n }\n\n return (\n <PageLayout\n title={tWithFallback(t, 'support.settings.title', 'Support Settings')}\n subtitle={tWithFallback(\n t,\n 'support.settings.subtitle',\n 'Configure support module preferences and policies'\n )}\n icon={<Settings size={24} />}\n >\n <PagePurpose>\n {tr(\n 'support.settings.purpose',\n 'Tune how your support desk runs. Define SLA policies so high-priority tickets get a guaranteed response time, write canned responses so agents reply to common questions in one click, and organise tickets and articles into categories. These settings shape the experience for both your team and your customers.'\n )}\n </PagePurpose>\n\n <NextSteps\n storageKey=\"support-settings\"\n title={tr('support.settings.nextSteps.title', 'Set up your support desk')}\n className=\"mb-6\"\n steps={[\n {\n id: 'sla',\n label: tr('support.settings.nextSteps.sla.label', 'Define SLA policies'),\n description: tr(\n 'support.settings.nextSteps.sla.description',\n 'Set response and resolution targets per priority.'\n ),\n onClick: () => setActiveTab('sla'),\n done: activeTab === 'sla',\n },\n {\n id: 'responses',\n label: tr('support.settings.nextSteps.responses.label', 'Create canned responses'),\n description: tr(\n 'support.settings.nextSteps.responses.description',\n 'Reusable replies that agents can insert instantly.'\n ),\n onClick: () => setActiveTab('responses'),\n done: activeTab === 'responses',\n },\n {\n id: 'categories',\n label: tr('support.settings.nextSteps.categories.label', 'Organise categories'),\n description: tr(\n 'support.settings.nextSteps.categories.description',\n 'Group tickets and articles for easier triage.'\n ),\n onClick: () => setActiveTab('categories'),\n done: activeTab === 'categories',\n },\n ]}\n />\n\n {/* Tabs */}\n <div className=\"border-b border-border-subtle -mx-4 px-4 mb-6 overflow-x-auto sm:-mx-6 sm:px-6\">\n <div className=\"flex min-w-max gap-1\">\n {tabs.map((tab) => (\n <button\n type=\"button\"\n key={tab.id}\n onClick={() => setActiveTab(tab.id)}\n className={cn(\n 'min-h-11 px-4 py-3 font-medium transition-colors relative',\n activeTab === tab.id\n ? 'text-primary'\n : 'text-text-secondary hover:text-text-primary'\n )}\n >\n {tab.label}\n {activeTab === tab.id && (\n <div className=\"absolute bottom-0 left-0 right-0 h-0.5 bg-action-primary-bg\" />\n )}\n </button>\n ))}\n </div>\n </div>\n\n {/* Content */}\n <div className=\"max-w-4xl\">\n {activeTab === 'sla' && (\n <SLAPoliciesSettings\n policies={slaPolicies.map((p: Record<string, unknown>) => ({\n id: p.id as string,\n name: p.name as string,\n priority: p.priority as string,\n firstResponseTimeMinutes: p.firstResponseMinutes as number,\n resolutionTimeMinutes: p.resolutionMinutes as number,\n businessHoursOnly: false,\n active: p.isActive as boolean,\n }))}\n defaultPolicyId={\n slaPolicies.find((p: Record<string, unknown>) => p.isDefault)?.id as\n | string\n | undefined\n }\n onCreate={handleCreateSLAPolicy}\n onUpdate={handleUpdateSLAPolicy}\n onDelete={handleDeleteSLAPolicy}\n />\n )}\n {activeTab === 'responses' && (\n <CannedResponsesSettings\n responses={cannedResponses.map((r: Record<string, unknown>) => ({\n id: r.id as string,\n title: r.title as string,\n content: r.content as string,\n tags: r.tags as string[],\n isActive: r.isActive as boolean,\n }))}\n onCreate={handleCreateCannedResponse}\n onUpdate={handleUpdateCannedResponse}\n onDelete={handleDeleteCannedResponse}\n />\n )}\n {activeTab === 'categories' && (\n <TicketCategoriesSettings\n categories={ticketCategories.map((c: Record<string, unknown>) => ({\n id: c.id as string,\n name: c.name as string,\n slug: c.slug as string,\n description: c.description as string | undefined,\n color: c.color as string | undefined,\n icon: c.icon as string | undefined,\n displayOrder: c.displayOrder as number | undefined,\n isActive: c.isActive as boolean,\n articleCount: c.articleCount as number | undefined,\n parentId: c.parentId as string | undefined,\n }))}\n onCreate={handleCreateTicketCategory}\n onUpdate={handleUpdateTicketCategory}\n onDelete={deleteTicketCategory}\n />\n )}\n </div>\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAgBA,SAAS,EAAkB,GAAyB;CAClD,IAAI,CAAC,GAAO,OAAO;CACnB,IAAM,IAAe,OAAO,CAAK,CAAC,CAAC,YAAY;CAC/C,OACE,EAAa,SAAS,WAAW,KACjC,EAAa,SAAS,gBAAgB,KACtC,EAAa,SAAS,mBAAmB,KACzC,EAAa,SAAS,OAAO;AAEjC;AAKA,SAAS,EAAwB,GAAyC;CACxE,QAAQ,GAAR;EACE,KAAK,YACH,OAAO,EAAsB;EAC/B,KAAK,QACH,OAAO,EAAsB;EAC/B,KAAK,OACH,OAAO,EAAsB;EAC/B,SACE,OAAO,EAAsB;CACjC;AACF;AAEA,SAAS,EAAgC,GAAsD;CAC7F,OAAO,IAAW,EAAwB,CAAQ,IAAI,KAAA;AACxD;AAEA,SAAgB,IAAe;CAC7B,IAAM,CAAC,GAAW,KAAgB,EAAsB,KAAK,GACvD,EAAE,SAAM,EAAQ,GAChB,IAAK,EAAM,GACX,EACJ,gBACA,oBACA,qBACA,cACA,qBACA,yBACA,oBACA,oBACA,oBACA,yBACA,yBACA,yBACA,yBACA,yBACA,4BACE,EAAsB;CAO1B,IAFE,EAAkB,CAAgB,KAAK,EAAkB,CAAoB,GAG7E,OACE,kBA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