@burdenoff/microfe-support 2026.625.2 → 2026.626.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/support/components/ui.js +2 -2
  2. package/dist/support/pages/AnalyticsPage.js +144 -113
  3. package/dist/support/pages/AnalyticsPage.js.map +1 -1
  4. package/dist/support/pages/ArticleDetailAdminPage.js +150 -113
  5. package/dist/support/pages/ArticleDetailAdminPage.js.map +1 -1
  6. package/dist/support/pages/ArticleDetailUserPage.js +90 -83
  7. package/dist/support/pages/ArticleDetailUserPage.js.map +1 -1
  8. package/dist/support/pages/ContactInquiriesPage.js +48 -44
  9. package/dist/support/pages/ContactInquiriesPage.js.map +1 -1
  10. package/dist/support/pages/ContactInquiryDetailPage.js +225 -205
  11. package/dist/support/pages/ContactInquiryDetailPage.js.map +1 -1
  12. package/dist/support/pages/CreateArticlePage.js +50 -46
  13. package/dist/support/pages/CreateArticlePage.js.map +1 -1
  14. package/dist/support/pages/CreateTicketPage.js +122 -116
  15. package/dist/support/pages/CreateTicketPage.js.map +1 -1
  16. package/dist/support/pages/EditArticlePage.js +76 -80
  17. package/dist/support/pages/EditArticlePage.js.map +1 -1
  18. package/dist/support/pages/JobApplicationDetailPage.js +292 -269
  19. package/dist/support/pages/JobApplicationDetailPage.js.map +1 -1
  20. package/dist/support/pages/JobApplicationsPage.js +50 -46
  21. package/dist/support/pages/JobApplicationsPage.js.map +1 -1
  22. package/dist/support/pages/KnowledgeBaseAdminPage.js +84 -81
  23. package/dist/support/pages/KnowledgeBaseAdminPage.js.map +1 -1
  24. package/dist/support/pages/KnowledgeBaseUserPage.js +76 -75
  25. package/dist/support/pages/KnowledgeBaseUserPage.js.map +1 -1
  26. package/dist/support/pages/SettingsPage.js +215 -182
  27. package/dist/support/pages/SettingsPage.js.map +1 -1
  28. package/dist/support/pages/TicketDetailAdminPage.js +158 -128
  29. package/dist/support/pages/TicketDetailAdminPage.js.map +1 -1
  30. package/dist/support/pages/TicketDetailUserPage.js +174 -141
  31. package/dist/support/pages/TicketDetailUserPage.js.map +1 -1
  32. package/dist/support/pages/TicketListPage.js +171 -170
  33. package/dist/support/pages/TicketListPage.js.map +1 -1
  34. package/package.json +2 -2
@@ -1,218 +1,251 @@
1
- import { SupportTicketPriority as e } from "../../generated/global-types.js";
2
- import { cn as t } from "../utils/cn.js";
3
- import { EmptyState as n, LoadingState as r, PageLayout as i } from "../components/PageLayout.js";
4
- import { tWithFallback as a } from "../utils/i18n.js";
5
- import { nativeNotify as o } from "../../utils/nativeBridge.js";
6
- import { useSettingsOperations as s } from "../hooks/useSettingsOperations.js";
7
- import { SLAPoliciesSettings as c } from "../components/settings/SLAPoliciesSettings.js";
8
- import { CannedResponsesSettings as l } from "../components/settings/CannedResponsesSettings.js";
9
- import { TicketCategoriesSettings as u } from "../components/settings/TicketCategoriesSettings.js";
10
- import { useState as d } from "react";
11
- import { Settings as f, ShieldAlert as p } from "lucide-react";
12
- import { jsx as m, jsxs as h } from "react/jsx-runtime";
13
- import { useI18n as g } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
1
+ import { NextSteps as e, PagePurpose as t } from "../components/ui.js";
2
+ import { SupportTicketPriority as n } from "../../generated/global-types.js";
3
+ import { cn as r } from "../utils/cn.js";
4
+ import { EmptyState as i, LoadingState as a, PageLayout as o } from "../components/PageLayout.js";
5
+ import { tWithFallback as s } from "../utils/i18n.js";
6
+ import { nativeNotify as c } from "../../utils/nativeBridge.js";
7
+ import { useSettingsOperations as l } from "../hooks/useSettingsOperations.js";
8
+ import { SLAPoliciesSettings as u } from "../components/settings/SLAPoliciesSettings.js";
9
+ import { CannedResponsesSettings as d } from "../components/settings/CannedResponsesSettings.js";
10
+ import { TicketCategoriesSettings as f } from "../components/settings/TicketCategoriesSettings.js";
11
+ import { useState as p } from "react";
12
+ import { Settings as m, ShieldAlert as h } from "lucide-react";
13
+ import { jsx as g, jsxs as _ } from "react/jsx-runtime";
14
+ import { useI18n as v } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
14
15
  //#region src/support/pages/SettingsPage.tsx
15
- function _(e) {
16
+ function y(e) {
16
17
  if (!e) return !1;
17
18
  let t = String(e).toLowerCase();
18
19
  return t.includes("forbidden") || t.includes("not authorized") || t.includes("permission denied") || t.includes("admin");
19
20
  }
20
- function v(t) {
21
- switch (t) {
22
- case "CRITICAL": return e.Critical;
23
- case "HIGH": return e.High;
24
- case "LOW": return e.Low;
25
- default: return e.Normal;
21
+ function b(e) {
22
+ switch (e) {
23
+ case "CRITICAL": return n.Critical;
24
+ case "HIGH": return n.High;
25
+ case "LOW": return n.Low;
26
+ default: return n.Normal;
26
27
  }
27
28
  }
28
- function y(e) {
29
- return e ? v(e) : void 0;
29
+ function x(e) {
30
+ return e ? b(e) : void 0;
30
31
  }
31
- function b() {
32
- let [e, b] = d("sla"), { t: x } = g(), { slaPolicies: S, cannedResponses: C, ticketCategories: w, isLoading: T, slaPoliciesError: E, cannedResponsesError: D, createSLAPolicy: O, updateSLAPolicy: k, deleteSLAPolicy: A, createCannedResponse: j, updateCannedResponse: M, deleteCannedResponse: N, createTicketCategory: P, updateTicketCategory: F, deleteTicketCategory: I } = s();
33
- if (_(E) || _(D)) return /* @__PURE__ */ m(i, {
34
- title: a(x, "support.settings.title", "Support Settings"),
35
- subtitle: a(x, "support.settings.subtitle", "Configure support module preferences and policies"),
36
- icon: /* @__PURE__ */ m(f, { size: 24 }),
37
- children: /* @__PURE__ */ m(n, {
38
- icon: /* @__PURE__ */ m(p, { size: 48 }),
39
- title: a(x, "support.settings.permission.title", "Admin Access Required"),
40
- description: a(x, "support.settings.permission.description", "You need administrator privileges to access support settings. Please contact your workspace admin for access.")
32
+ function S() {
33
+ let [n, S] = p("sla"), { t: C } = v(), { slaPolicies: w, cannedResponses: T, ticketCategories: E, isLoading: D, slaPoliciesError: O, cannedResponsesError: k, createSLAPolicy: A, updateSLAPolicy: j, deleteSLAPolicy: M, createCannedResponse: N, updateCannedResponse: P, deleteCannedResponse: F, createTicketCategory: I, updateTicketCategory: L, deleteTicketCategory: R } = l();
34
+ if (y(O) || y(k)) return /* @__PURE__ */ g(o, {
35
+ title: s(C, "support.settings.title", "Support Settings"),
36
+ subtitle: s(C, "support.settings.subtitle", "Configure support module preferences and policies"),
37
+ icon: /* @__PURE__ */ g(m, { size: 24 }),
38
+ children: /* @__PURE__ */ g(i, {
39
+ icon: /* @__PURE__ */ g(h, { size: 48 }),
40
+ title: s(C, "support.settings.permission.title", "Admin Access Required"),
41
+ description: s(C, "support.settings.permission.description", "You need administrator privileges to access support settings. Please contact your workspace admin for access.")
41
42
  })
42
43
  });
43
- let L = [
44
+ let z = [
44
45
  {
45
46
  id: "sla",
46
- label: a(x, "support.settings.tabs.sla", "SLA Policies")
47
+ label: s(C, "support.settings.tabs.sla", "SLA Policies")
47
48
  },
48
49
  {
49
50
  id: "responses",
50
- label: a(x, "support.settings.tabs.responses", "Canned Responses")
51
+ label: s(C, "support.settings.tabs.responses", "Canned Responses")
51
52
  },
52
53
  {
53
54
  id: "categories",
54
- label: a(x, "support.settings.tabs.categories", "Categories")
55
+ label: s(C, "support.settings.tabs.categories", "Categories")
55
56
  }
56
57
  ];
57
- return T ? /* @__PURE__ */ m(i, {
58
- title: a(x, "support.settings.title", "Support Settings"),
59
- subtitle: a(x, "support.settings.subtitle", "Configure support module preferences and policies"),
60
- icon: /* @__PURE__ */ m(f, { size: 24 }),
61
- children: /* @__PURE__ */ m(r, { message: a(x, "support.settings.loading", "Loading settings...") })
62
- }) : /* @__PURE__ */ h(i, {
63
- title: a(x, "support.settings.title", "Support Settings"),
64
- subtitle: a(x, "support.settings.subtitle", "Configure support module preferences and policies"),
65
- icon: /* @__PURE__ */ m(f, { size: 24 }),
66
- children: [/* @__PURE__ */ m("div", {
67
- className: "border-b border-border-subtle -mx-4 px-4 mb-6 overflow-x-auto sm:-mx-6 sm:px-6",
68
- children: /* @__PURE__ */ m("div", {
69
- className: "flex min-w-max gap-1",
70
- children: L.map((n) => /* @__PURE__ */ h("button", {
71
- type: "button",
72
- onClick: () => b(n.id),
73
- className: t("min-h-11 px-4 py-3 font-medium transition-colors relative", e === n.id ? "text-primary" : "text-text-secondary hover:text-text-primary"),
74
- children: [n.label, e === n.id && /* @__PURE__ */ m("div", { className: "absolute bottom-0 left-0 right-0 h-0.5 bg-action-primary-bg" })]
75
- }, n.id))
76
- })
77
- }), /* @__PURE__ */ h("div", {
78
- className: "max-w-4xl",
79
- children: [
80
- e === "sla" && /* @__PURE__ */ m(c, {
81
- policies: S.map((e) => ({
82
- id: e.id,
83
- name: e.name,
84
- priority: e.priority,
85
- firstResponseTimeMinutes: e.firstResponseMinutes,
86
- resolutionTimeMinutes: e.resolutionMinutes,
87
- businessHoursOnly: !1,
88
- active: e.isActive
89
- })),
90
- defaultPolicyId: S.find((e) => e.isDefault)?.id,
91
- onCreate: async (e) => {
92
- let t = await O({
93
- name: e.name,
94
- priority: v(e.priority),
95
- firstResponseMinutes: e.firstResponseTimeMinutes,
96
- resolutionMinutes: e.resolutionTimeMinutes
97
- });
98
- return {
99
- id: t.id,
100
- name: t.name,
101
- priority: t.priority,
102
- firstResponseTimeMinutes: t.firstResponseMinutes,
103
- resolutionTimeMinutes: t.resolutionMinutes,
104
- businessHoursOnly: !1,
105
- active: t.isActive
106
- };
58
+ return D ? /* @__PURE__ */ g(o, {
59
+ title: s(C, "support.settings.title", "Support Settings"),
60
+ subtitle: s(C, "support.settings.subtitle", "Configure support module preferences and policies"),
61
+ icon: /* @__PURE__ */ g(m, { size: 24 }),
62
+ children: /* @__PURE__ */ g(a, { message: s(C, "support.settings.loading", "Loading settings...") })
63
+ }) : /* @__PURE__ */ _(o, {
64
+ title: s(C, "support.settings.title", "Support Settings"),
65
+ subtitle: s(C, "support.settings.subtitle", "Configure support module preferences and policies"),
66
+ icon: /* @__PURE__ */ g(m, { size: 24 }),
67
+ children: [
68
+ /* @__PURE__ */ g(t, { children: "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." }),
69
+ /* @__PURE__ */ g(e, {
70
+ storageKey: "support-settings",
71
+ title: "Set up your support desk",
72
+ className: "mb-6",
73
+ steps: [
74
+ {
75
+ id: "sla",
76
+ label: "Define SLA policies",
77
+ description: "Set response and resolution targets per priority.",
78
+ onClick: () => S("sla"),
79
+ done: n === "sla"
107
80
  },
108
- onUpdate: async (e, t) => {
109
- let n = await k(e, {
110
- name: t.name,
111
- priority: y(t.priority),
112
- firstResponseMinutes: t.firstResponseTimeMinutes,
113
- resolutionMinutes: t.resolutionTimeMinutes,
114
- isActive: t.active
115
- });
116
- return {
117
- id: n.id,
118
- name: n.name,
119
- priority: n.priority,
120
- firstResponseTimeMinutes: n.firstResponseMinutes,
121
- resolutionTimeMinutes: n.resolutionMinutes,
122
- businessHoursOnly: !1,
123
- active: n.isActive
124
- };
81
+ {
82
+ id: "responses",
83
+ label: "Create canned responses",
84
+ description: "Reusable replies that agents can insert instantly.",
85
+ onClick: () => S("responses"),
86
+ done: n === "responses"
125
87
  },
126
- onDelete: async (e) => {
127
- try {
128
- await A(e), o("success");
129
- } catch (e) {
130
- throw o("error"), e;
131
- }
88
+ {
89
+ id: "categories",
90
+ label: "Organise categories",
91
+ description: "Group tickets and articles for easier triage.",
92
+ onClick: () => S("categories"),
93
+ done: n === "categories"
132
94
  }
133
- }),
134
- e === "responses" && /* @__PURE__ */ m(l, {
135
- responses: C.map((e) => ({
136
- id: e.id,
137
- title: e.title,
138
- content: e.content,
139
- tags: e.tags,
140
- isActive: e.isActive
141
- })),
142
- onCreate: async (e) => await j({
143
- title: e.title,
144
- content: e.content,
145
- tags: e.tags
95
+ ]
96
+ }),
97
+ /* @__PURE__ */ g("div", {
98
+ className: "border-b border-border-subtle -mx-4 px-4 mb-6 overflow-x-auto sm:-mx-6 sm:px-6",
99
+ children: /* @__PURE__ */ g("div", {
100
+ className: "flex min-w-max gap-1",
101
+ children: z.map((e) => /* @__PURE__ */ _("button", {
102
+ type: "button",
103
+ onClick: () => S(e.id),
104
+ className: r("min-h-11 px-4 py-3 font-medium transition-colors relative", n === e.id ? "text-primary" : "text-text-secondary hover:text-text-primary"),
105
+ children: [e.label, n === e.id && /* @__PURE__ */ g("div", { className: "absolute bottom-0 left-0 right-0 h-0.5 bg-action-primary-bg" })]
106
+ }, e.id))
107
+ })
108
+ }),
109
+ /* @__PURE__ */ _("div", {
110
+ className: "max-w-4xl",
111
+ children: [
112
+ n === "sla" && /* @__PURE__ */ g(u, {
113
+ policies: w.map((e) => ({
114
+ id: e.id,
115
+ name: e.name,
116
+ priority: e.priority,
117
+ firstResponseTimeMinutes: e.firstResponseMinutes,
118
+ resolutionTimeMinutes: e.resolutionMinutes,
119
+ businessHoursOnly: !1,
120
+ active: e.isActive
121
+ })),
122
+ defaultPolicyId: w.find((e) => e.isDefault)?.id,
123
+ onCreate: async (e) => {
124
+ let t = await A({
125
+ name: e.name,
126
+ priority: b(e.priority),
127
+ firstResponseMinutes: e.firstResponseTimeMinutes,
128
+ resolutionMinutes: e.resolutionTimeMinutes
129
+ });
130
+ return {
131
+ id: t.id,
132
+ name: t.name,
133
+ priority: t.priority,
134
+ firstResponseTimeMinutes: t.firstResponseMinutes,
135
+ resolutionTimeMinutes: t.resolutionMinutes,
136
+ businessHoursOnly: !1,
137
+ active: t.isActive
138
+ };
139
+ },
140
+ onUpdate: async (e, t) => {
141
+ let n = await j(e, {
142
+ name: t.name,
143
+ priority: x(t.priority),
144
+ firstResponseMinutes: t.firstResponseTimeMinutes,
145
+ resolutionMinutes: t.resolutionTimeMinutes,
146
+ isActive: t.active
147
+ });
148
+ return {
149
+ id: n.id,
150
+ name: n.name,
151
+ priority: n.priority,
152
+ firstResponseTimeMinutes: n.firstResponseMinutes,
153
+ resolutionTimeMinutes: n.resolutionMinutes,
154
+ businessHoursOnly: !1,
155
+ active: n.isActive
156
+ };
157
+ },
158
+ onDelete: async (e) => {
159
+ try {
160
+ await M(e), c("success");
161
+ } catch (e) {
162
+ throw c("error"), e;
163
+ }
164
+ }
146
165
  }),
147
- onUpdate: async (e, t) => await M(e, {
148
- title: t.title,
149
- content: t.content,
150
- tags: t.tags,
151
- isActive: t.isActive
166
+ n === "responses" && /* @__PURE__ */ g(d, {
167
+ responses: T.map((e) => ({
168
+ id: e.id,
169
+ title: e.title,
170
+ content: e.content,
171
+ tags: e.tags,
172
+ isActive: e.isActive
173
+ })),
174
+ onCreate: async (e) => await N({
175
+ title: e.title,
176
+ content: e.content,
177
+ tags: e.tags
178
+ }),
179
+ onUpdate: async (e, t) => await P(e, {
180
+ title: t.title,
181
+ content: t.content,
182
+ tags: t.tags,
183
+ isActive: t.isActive
184
+ }),
185
+ onDelete: async (e) => {
186
+ await F(e);
187
+ }
152
188
  }),
153
- onDelete: async (e) => {
154
- await N(e);
155
- }
156
- }),
157
- e === "categories" && /* @__PURE__ */ m(u, {
158
- categories: w.map((e) => ({
159
- id: e.id,
160
- name: e.name,
161
- slug: e.slug,
162
- description: e.description,
163
- color: e.color,
164
- icon: e.icon,
165
- displayOrder: e.displayOrder,
166
- isActive: e.isActive,
167
- articleCount: e.articleCount,
168
- parentId: e.parentId
169
- })),
170
- onCreate: async (e) => {
171
- let t = await P({
189
+ n === "categories" && /* @__PURE__ */ g(f, {
190
+ categories: E.map((e) => ({
191
+ id: e.id,
172
192
  name: e.name,
173
193
  slug: e.slug,
174
194
  description: e.description,
175
195
  color: e.color,
176
196
  icon: e.icon,
197
+ displayOrder: e.displayOrder,
198
+ isActive: e.isActive,
199
+ articleCount: e.articleCount,
177
200
  parentId: e.parentId
178
- });
179
- return t ? {
180
- id: t.id,
181
- name: t.name,
182
- slug: t.slug,
183
- description: t.description ?? void 0,
184
- color: t.color ?? void 0,
185
- icon: t.icon ?? void 0,
186
- isActive: t.isActive
187
- } : null;
188
- },
189
- onUpdate: async (e, t) => {
190
- let n = await F(e, {
191
- name: t.name,
192
- slug: t.slug,
193
- description: t.description,
194
- color: t.color,
195
- icon: t.icon,
196
- isActive: t.isActive,
197
- parentId: t.parentId
198
- });
199
- return n ? {
200
- id: n.id,
201
- name: n.name,
202
- slug: n.slug,
203
- description: n.description ?? void 0,
204
- color: n.color ?? void 0,
205
- icon: n.icon ?? void 0,
206
- isActive: n.isActive
207
- } : null;
208
- },
209
- onDelete: I
210
- })
211
- ]
212
- })]
201
+ })),
202
+ onCreate: async (e) => {
203
+ let t = await I({
204
+ name: e.name,
205
+ slug: e.slug,
206
+ description: e.description,
207
+ color: e.color,
208
+ icon: e.icon,
209
+ parentId: e.parentId
210
+ });
211
+ return t ? {
212
+ id: t.id,
213
+ name: t.name,
214
+ slug: t.slug,
215
+ description: t.description ?? void 0,
216
+ color: t.color ?? void 0,
217
+ icon: t.icon ?? void 0,
218
+ isActive: t.isActive
219
+ } : null;
220
+ },
221
+ onUpdate: async (e, t) => {
222
+ let n = await L(e, {
223
+ name: t.name,
224
+ slug: t.slug,
225
+ description: t.description,
226
+ color: t.color,
227
+ icon: t.icon,
228
+ isActive: t.isActive,
229
+ parentId: t.parentId
230
+ });
231
+ return n ? {
232
+ id: n.id,
233
+ name: n.name,
234
+ slug: n.slug,
235
+ description: n.description ?? void 0,
236
+ color: n.color ?? void 0,
237
+ icon: n.icon ?? void 0,
238
+ isActive: n.isActive
239
+ } : null;
240
+ },
241
+ onDelete: R
242
+ })
243
+ ]
244
+ })
245
+ ]
213
246
  });
214
247
  }
215
248
  //#endregion
216
- export { b as SettingsPage };
249
+ export { S as SettingsPage };
217
250
 
218
251
  //# 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 { 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 {/* 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":";;;;;;;;;;;;;;AAcA,SAAS,EAAkB,GAAyB;AAClD,KAAI,CAAC,EAAO,QAAO;CACnB,IAAM,IAAe,OAAO,EAAM,CAAC,aAAa;AAChD,QACE,EAAa,SAAS,YAAY,IAClC,EAAa,SAAS,iBAAiB,IACvC,EAAa,SAAS,oBAAoB,IAC1C,EAAa,SAAS,QAAQ;;AAOlC,SAAS,EAAwB,GAAyC;AACxE,SAAQ,GAAR;EACE,KAAK,WACH,QAAO,EAAsB;EAC/B,KAAK,OACH,QAAO,EAAsB;EAC/B,KAAK,MACH,QAAO,EAAsB;EAC/B,QACE,QAAO,EAAsB;;;AAInC,SAAS,EAAgC,GAAsD;AAC7F,QAAO,IAAW,EAAwB,EAAS,GAAG,KAAA;;AAGxD,SAAgB,IAAe;CAC7B,IAAM,CAAC,GAAW,KAAgB,EAAsB,MAAM,EACxD,EAAE,SAAM,GAAS,EACjB,EACJ,gBACA,oBACA,qBACA,cACA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OAChB,UAAU,EAAM;OACjB,CAAC;AAGF,aAFK,IAEE;OACL,IAAI,EAAO;OACX,MAAM,EAAO;OACb,MAAM,EAAO;OACb,aAAa,EAAO,eAAe,KAAA;OACnC,OAAO,EAAO,SAAS,KAAA;OACvB,MAAM,EAAO,QAAQ,KAAA;OACrB,UAAU,EAAO;OAClB,GAVmB;;KAsHZ,UAAU;KACV,CAAA;IAEA;KACK"}
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 guaranteed\n response time, write canned responses so agents reply to common questions in one click, and\n organise tickets and articles into categories. These settings shape the experience for both\n 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;AAClD,KAAI,CAAC,EAAO,QAAO;CACnB,IAAM,IAAe,OAAO,EAAM,CAAC,aAAa;AAChD,QACE,EAAa,SAAS,YAAY,IAClC,EAAa,SAAS,iBAAiB,IACvC,EAAa,SAAS,oBAAoB,IAC1C,EAAa,SAAS,QAAQ;;AAOlC,SAAS,EAAwB,GAAyC;AACxE,SAAQ,GAAR;EACE,KAAK,WACH,QAAO,EAAsB;EAC/B,KAAK,OACH,QAAO,EAAsB;EAC/B,KAAK,MACH,QAAO,EAAsB;EAC/B,QACE,QAAO,EAAsB;;;AAInC,SAAS,EAAgC,GAAsD;AAC7F,QAAO,IAAW,EAAwB,EAAS,GAAG,KAAA;;AAGxD,SAAgB,IAAe;CAC7B,IAAM,CAAC,GAAW,KAAgB,EAAsB,MAAM,EACxD,EAAE,SAAM,GAAS,EACjB,EACJ,gBACA,oBACA,qBACA,cACA,qBACA,yBACA,oBACA,oBACA,oBACA,yBACA,yBACA,yBACA,yBACA,yBACA,4BACE,GAAuB;AAO3B,KAFE,EAAkB,EAAiB,IAAI,EAAkB,EAAqB,CAG9E,QACE,kBAAC,GAAD;EACE,OAAO,EAAc,GAAG,0BAA0B,mBAAmB;EACrE,UAAU,EACR,GACA,6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