@burdenoff/microfe-support 2026.527.2 → 2026.527.4
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/support/SupportAdminRoutes.js +49 -38
- package/dist/support/SupportAdminRoutes.js.map +1 -1
- package/dist/support/SupportUserRoutes.js +33 -22
- package/dist/support/SupportUserRoutes.js.map +1 -1
- package/dist/support/components/PageLayout.js +2 -2
- package/dist/support/components/PageLayout.js.map +1 -1
- package/dist/support/components/RouteHelpers.js +1 -1
- package/dist/support/components/RouteHelpers.js.map +1 -1
- package/dist/support/components/analytics/TrendChart.js +5 -5
- package/dist/support/components/analytics/TrendChart.js.map +1 -1
- package/dist/support/components/kb/ArticleForm.js +97 -94
- package/dist/support/components/kb/ArticleForm.js.map +1 -1
- package/dist/support/components/settings/CannedResponsesSettings.js +14 -2
- package/dist/support/components/settings/CannedResponsesSettings.js.map +1 -1
- package/dist/support/components/settings/SLAPoliciesSettings.js +19 -1
- package/dist/support/components/settings/SLAPoliciesSettings.js.map +1 -1
- package/dist/support/components/settings/TicketCategoriesSettings.js +27 -6
- package/dist/support/components/settings/TicketCategoriesSettings.js.map +1 -1
- package/dist/support/components/tickets/AttachmentList.js +1 -1
- package/dist/support/components/tickets/AttachmentList.js.map +1 -1
- package/dist/support/components/tickets/MessageComposer.js +59 -56
- package/dist/support/components/tickets/MessageComposer.js.map +1 -1
- package/dist/support/components/tickets/TicketHeader.js +1 -0
- package/dist/support/components/tickets/TicketHeader.js.map +1 -1
- package/dist/support/components/tickets/TicketSidebar.js +4 -4
- package/dist/support/components/tickets/TicketSidebar.js.map +1 -1
- package/dist/support/hooks/useAnalyticsOperations.js.map +1 -1
- package/dist/support/hooks/useSupportAttachments.js +20 -12
- package/dist/support/hooks/useSupportAttachments.js.map +1 -1
- package/dist/support/hooks/useTicketListOperations.js +1 -1
- package/dist/support/hooks/useTicketListOperations.js.map +1 -1
- package/dist/support/hooks/useTicketOperations.js +1 -1
- package/dist/support/hooks/useTicketOperations.js.map +1 -1
- package/dist/support/pages/ArticleDetailAdminPage.js +5 -5
- package/dist/support/pages/ArticleDetailAdminPage.js.map +1 -1
- package/dist/support/pages/ContactInquiriesPage.js +118 -108
- package/dist/support/pages/ContactInquiriesPage.js.map +1 -1
- package/dist/support/pages/ContactInquiryDetailPage.js +21 -12
- package/dist/support/pages/ContactInquiryDetailPage.js.map +1 -1
- package/dist/support/pages/CreateArticlePage.js +0 -1
- package/dist/support/pages/CreateArticlePage.js.map +1 -1
- package/dist/support/pages/CreateTicketPage.js +6 -3
- package/dist/support/pages/CreateTicketPage.js.map +1 -1
- package/dist/support/pages/EditArticlePage.js +0 -1
- package/dist/support/pages/EditArticlePage.js.map +1 -1
- package/dist/support/pages/JobApplicationDetailPage.js +26 -17
- package/dist/support/pages/JobApplicationDetailPage.js.map +1 -1
- package/dist/support/pages/JobApplicationsPage.js +121 -113
- package/dist/support/pages/JobApplicationsPage.js.map +1 -1
- package/dist/support/pages/KnowledgeBaseAdminPage.js +3 -0
- package/dist/support/pages/KnowledgeBaseAdminPage.js.map +1 -1
- package/dist/support/pages/KnowledgeBaseUserPage.js +3 -0
- package/dist/support/pages/KnowledgeBaseUserPage.js.map +1 -1
- package/dist/support/pages/SettingsPage.js +1 -0
- package/dist/support/pages/SettingsPage.js.map +1 -1
- package/dist/support/pages/TicketDetailAdminPage.js +4 -0
- package/dist/support/pages/TicketDetailAdminPage.js.map +1 -1
- package/dist/support/pages/TicketDetailUserPage.js +5 -0
- package/dist/support/pages/TicketDetailUserPage.js.map +1 -1
- package/dist/support/pages/TicketListPage.js +15 -2
- package/dist/support/pages/TicketListPage.js.map +1 -1
- package/dist/support/providers/SupportProvider.js +1 -1
- package/dist/support/providers/SupportProvider.js.map +1 -1
- package/dist/support/utils/supportFiles.js +14 -15
- package/dist/support/utils/supportFiles.js.map +1 -1
- package/dist/support/utils/uiTokens.js.map +1 -1
- package/package.json +1 -1
- package/dist/support/components/kb/index.js +0 -1
|
@@ -37,6 +37,7 @@ function d({ policies: d, defaultPolicyId: f, onCreate: p, onUpdate: m, onDelete
|
|
|
37
37
|
className: "text-sm text-secondary",
|
|
38
38
|
children: "Manage service level agreement policies for different priority levels"
|
|
39
39
|
})] }), /* @__PURE__ */ l("button", {
|
|
40
|
+
type: "button",
|
|
40
41
|
onClick: w,
|
|
41
42
|
className: "min-h-11 inline-flex items-center justify-center gap-2 px-4 py-2 rounded-lg transition-all duration-200 bg-primary text-primary-foreground hover:bg-primary/90",
|
|
42
43
|
children: [/* @__PURE__ */ c(r, { size: 20 }), "New Policy"]
|
|
@@ -54,9 +55,12 @@ function d({ policies: d, defaultPolicyId: f, onCreate: p, onUpdate: m, onDelete
|
|
|
54
55
|
children: [
|
|
55
56
|
/* @__PURE__ */ l("div", { children: [/* @__PURE__ */ c("label", {
|
|
56
57
|
className: "block text-sm font-medium mb-1 text-secondary",
|
|
58
|
+
htmlFor: "slapoliciessettings-policy-name-0",
|
|
57
59
|
children: "Policy Name *"
|
|
58
60
|
}), /* @__PURE__ */ c("input", {
|
|
61
|
+
id: "slapoliciessettings-policy-name-0",
|
|
59
62
|
type: "text",
|
|
63
|
+
"aria-label": "Policy Name",
|
|
60
64
|
value: b.name,
|
|
61
65
|
onChange: (e) => x({
|
|
62
66
|
...b,
|
|
@@ -67,8 +71,11 @@ function d({ policies: d, defaultPolicyId: f, onCreate: p, onUpdate: m, onDelete
|
|
|
67
71
|
})] }),
|
|
68
72
|
/* @__PURE__ */ l("div", { children: [/* @__PURE__ */ c("label", {
|
|
69
73
|
className: "block text-sm font-medium mb-1 text-secondary",
|
|
74
|
+
htmlFor: "slapoliciessettings-priority-2",
|
|
70
75
|
children: "Priority"
|
|
71
76
|
}), /* @__PURE__ */ l("select", {
|
|
77
|
+
id: "slapoliciessettings-priority-2",
|
|
78
|
+
"aria-label": "Priority",
|
|
72
79
|
value: b.priority,
|
|
73
80
|
onChange: (e) => x({
|
|
74
81
|
...b,
|
|
@@ -96,9 +103,12 @@ function d({ policies: d, defaultPolicyId: f, onCreate: p, onUpdate: m, onDelete
|
|
|
96
103
|
})] }),
|
|
97
104
|
/* @__PURE__ */ l("div", { children: [/* @__PURE__ */ c("label", {
|
|
98
105
|
className: "block text-sm font-medium mb-1 text-secondary",
|
|
106
|
+
htmlFor: "slapoliciessettings-first-response-minutes-4",
|
|
99
107
|
children: "First Response (minutes)"
|
|
100
108
|
}), /* @__PURE__ */ c("input", {
|
|
109
|
+
id: "slapoliciessettings-first-response-minutes-4",
|
|
101
110
|
type: "number",
|
|
111
|
+
"aria-label": "First Response (minutes)",
|
|
102
112
|
value: b.firstResponseTimeMinutes,
|
|
103
113
|
onChange: (e) => x({
|
|
104
114
|
...b,
|
|
@@ -109,9 +119,12 @@ function d({ policies: d, defaultPolicyId: f, onCreate: p, onUpdate: m, onDelete
|
|
|
109
119
|
})] }),
|
|
110
120
|
/* @__PURE__ */ l("div", { children: [/* @__PURE__ */ c("label", {
|
|
111
121
|
className: "block text-sm font-medium mb-1 text-secondary",
|
|
122
|
+
htmlFor: "slapoliciessettings-resolution-time-minutes-6",
|
|
112
123
|
children: "Resolution Time (minutes)"
|
|
113
124
|
}), /* @__PURE__ */ c("input", {
|
|
125
|
+
id: "slapoliciessettings-resolution-time-minutes-6",
|
|
114
126
|
type: "number",
|
|
127
|
+
"aria-label": "Resolution Time (minutes)",
|
|
115
128
|
value: b.resolutionTimeMinutes,
|
|
116
129
|
onChange: (e) => x({
|
|
117
130
|
...b,
|
|
@@ -128,6 +141,7 @@ function d({ policies: d, defaultPolicyId: f, onCreate: p, onUpdate: m, onDelete
|
|
|
128
141
|
className: "flex items-center gap-2 text-sm text-secondary cursor-pointer",
|
|
129
142
|
children: [/* @__PURE__ */ c("input", {
|
|
130
143
|
type: "checkbox",
|
|
144
|
+
"aria-label": "Business hours only",
|
|
131
145
|
checked: b.businessHoursOnly,
|
|
132
146
|
onChange: (e) => x({
|
|
133
147
|
...b,
|
|
@@ -140,10 +154,12 @@ function d({ policies: d, defaultPolicyId: f, onCreate: p, onUpdate: m, onDelete
|
|
|
140
154
|
/* @__PURE__ */ l("div", {
|
|
141
155
|
className: "flex flex-col gap-2 mt-5 pt-4 border-t border-border sm:flex-row sm:items-center sm:justify-end",
|
|
142
156
|
children: [/* @__PURE__ */ l("button", {
|
|
157
|
+
type: "button",
|
|
143
158
|
onClick: E,
|
|
144
159
|
className: "min-h-11 inline-flex items-center justify-center gap-2 px-4 py-2 rounded-lg border border-border bg-background text-foreground transition-colors hover:bg-muted",
|
|
145
160
|
children: [/* @__PURE__ */ c(s, { size: 16 }), "Cancel"]
|
|
146
161
|
}), /* @__PURE__ */ l("button", {
|
|
162
|
+
type: "button",
|
|
147
163
|
onClick: async () => {
|
|
148
164
|
if (b.name.trim()) {
|
|
149
165
|
C(!0);
|
|
@@ -176,7 +192,7 @@ function d({ policies: d, defaultPolicyId: f, onCreate: p, onUpdate: m, onDelete
|
|
|
176
192
|
children: [/* @__PURE__ */ l("div", {
|
|
177
193
|
className: "flex items-start gap-3",
|
|
178
194
|
children: [/* @__PURE__ */ c("div", {
|
|
179
|
-
className: "
|
|
195
|
+
className: "size-10 rounded-full flex items-center justify-center flex-shrink-0 bg-primary/10",
|
|
180
196
|
children: /* @__PURE__ */ c(i, {
|
|
181
197
|
size: 20,
|
|
182
198
|
className: "text-primary"
|
|
@@ -219,11 +235,13 @@ function d({ policies: d, defaultPolicyId: f, onCreate: p, onUpdate: m, onDelete
|
|
|
219
235
|
}), /* @__PURE__ */ l("div", {
|
|
220
236
|
className: "flex items-center gap-2",
|
|
221
237
|
children: [/* @__PURE__ */ c("button", {
|
|
238
|
+
type: "button",
|
|
222
239
|
className: "min-h-11 min-w-11 p-2 rounded transition-colors duration-200 text-secondary hover:bg-muted",
|
|
223
240
|
onClick: () => T(e),
|
|
224
241
|
"aria-label": "Edit SLA policy",
|
|
225
242
|
children: /* @__PURE__ */ c(n, { size: 18 })
|
|
226
243
|
}), /* @__PURE__ */ c("button", {
|
|
244
|
+
type: "button",
|
|
227
245
|
className: "min-h-11 min-w-11 p-2 rounded transition-colors duration-200 text-error hover:bg-error/10",
|
|
228
246
|
onClick: () => h(e.id),
|
|
229
247
|
"aria-label": "Delete SLA policy",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SLAPoliciesSettings.js","names":[],"sources":["../../../../src/support/components/settings/SLAPoliciesSettings.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { Shield, Plus, Edit2, Trash2, Star, X, Check } from 'lucide-react';\n\ninterface SLAPolicy {\n id: string;\n name: string;\n priority: string;\n firstResponseTimeMinutes: number;\n resolutionTimeMinutes: number;\n businessHoursOnly: boolean;\n active: boolean;\n}\n\ninterface SLAPoliciesSettingsProps {\n policies: SLAPolicy[];\n defaultPolicyId?: string;\n onCreate: (input: SLAPolicy) => Promise<SLAPolicy>;\n onUpdate: (id: string, input: SLAPolicy) => Promise<SLAPolicy>;\n onDelete: (id: string) => Promise<void>;\n}\n\nconst emptyPolicy: Omit<SLAPolicy, 'id'> = {\n name: '',\n priority: 'NORMAL',\n firstResponseTimeMinutes: 60,\n resolutionTimeMinutes: 480,\n businessHoursOnly: false,\n active: true,\n};\n\nexport function SLAPoliciesSettings({\n policies,\n defaultPolicyId,\n onCreate,\n onUpdate,\n onDelete,\n}: SLAPoliciesSettingsProps) {\n const [showForm, setShowForm] = useState(false);\n const [editingId, setEditingId] = useState<string | null>(null);\n const [form, setForm] = useState(emptyPolicy);\n const [saving, setSaving] = useState(false);\n\n const handleNew = () => {\n setEditingId(null);\n setForm(emptyPolicy);\n setShowForm(true);\n };\n\n const handleEdit = (policy: SLAPolicy) => {\n setEditingId(policy.id);\n setForm({\n name: policy.name,\n priority: policy.priority,\n firstResponseTimeMinutes: policy.firstResponseTimeMinutes,\n resolutionTimeMinutes: policy.resolutionTimeMinutes,\n businessHoursOnly: policy.businessHoursOnly,\n active: policy.active,\n });\n setShowForm(true);\n };\n\n const handleCancel = () => {\n setShowForm(false);\n setEditingId(null);\n setForm(emptyPolicy);\n };\n\n const handleSave = async () => {\n if (!form.name.trim()) return;\n setSaving(true);\n try {\n if (editingId) {\n await onUpdate(editingId, { ...form, id: editingId } as SLAPolicy);\n } else {\n await onCreate({ ...form, id: '' } as SLAPolicy);\n }\n handleCancel();\n } finally {\n setSaving(false);\n }\n };\n\n return (\n <div className=\"space-y-6 animate-in fade-in-0 slide-in-from-bottom-2 duration-300\">\n <div className=\"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between\">\n <div>\n <h2 className=\"text-xl font-semibold mb-2 text-primary\">SLA Policies</h2>\n <p className=\"text-sm text-secondary\">\n Manage service level agreement policies for different priority levels\n </p>\n </div>\n <button\n onClick={handleNew}\n className=\"min-h-11 inline-flex items-center justify-center gap-2 px-4 py-2 rounded-lg transition-all duration-200 bg-primary text-primary-foreground hover:bg-primary/90\"\n >\n <Plus size={20} />\n New Policy\n </button>\n </div>\n\n {/* Create/Edit Form */}\n {showForm && (\n <div className=\"p-5 rounded-lg border-2 border-primary/30 bg-surface animate-in fade-in-0 slide-in-from-top-2 duration-200\">\n <h3 className=\"font-semibold mb-4 text-primary\">\n {editingId ? 'Edit Policy' : 'Create New Policy'}\n </h3>\n <div className=\"grid grid-cols-1 md:grid-cols-2 gap-4\">\n <div>\n <label className=\"block text-sm font-medium mb-1 text-secondary\">Policy Name *</label>\n <input\n type=\"text\"\n value={form.name}\n onChange={(e) => setForm({ ...form, name: e.target.value })}\n placeholder=\"e.g., Critical Response SLA\"\n className=\"w-full px-3 py-2 rounded-lg border border-border bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-primary/20\"\n />\n </div>\n <div>\n <label className=\"block text-sm font-medium mb-1 text-secondary\">Priority</label>\n <select\n value={form.priority}\n onChange={(e) => setForm({ ...form, priority: e.target.value })}\n className=\"w-full px-3 py-2 rounded-lg border border-border bg-background text-foreground\"\n >\n <option value=\"LOW\">Low</option>\n <option value=\"NORMAL\">Normal</option>\n <option value=\"HIGH\">High</option>\n <option value=\"CRITICAL\">Critical</option>\n </select>\n </div>\n <div>\n <label className=\"block text-sm font-medium mb-1 text-secondary\">\n First Response (minutes)\n </label>\n <input\n type=\"number\"\n value={form.firstResponseTimeMinutes}\n onChange={(e) =>\n setForm({ ...form, firstResponseTimeMinutes: parseInt(e.target.value) || 0 })\n }\n min={1}\n className=\"w-full px-3 py-2 rounded-lg border border-border bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-primary/20\"\n />\n </div>\n <div>\n <label className=\"block text-sm font-medium mb-1 text-secondary\">\n Resolution Time (minutes)\n </label>\n <input\n type=\"number\"\n value={form.resolutionTimeMinutes}\n onChange={(e) =>\n setForm({ ...form, resolutionTimeMinutes: parseInt(e.target.value) || 0 })\n }\n min={1}\n className=\"w-full px-3 py-2 rounded-lg border border-border bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-primary/20\"\n />\n </div>\n </div>\n <div className=\"flex items-center gap-3 mt-4\">\n <label className=\"flex items-center gap-2 text-sm text-secondary cursor-pointer\">\n <input\n type=\"checkbox\"\n checked={form.businessHoursOnly}\n onChange={(e) => setForm({ ...form, businessHoursOnly: e.target.checked })}\n className=\"rounded\"\n />\n Business hours only\n </label>\n </div>\n <div className=\"flex flex-col gap-2 mt-5 pt-4 border-t border-border sm:flex-row sm:items-center sm:justify-end\">\n <button\n onClick={handleCancel}\n className=\"min-h-11 inline-flex items-center justify-center gap-2 px-4 py-2 rounded-lg border border-border bg-background text-foreground transition-colors hover:bg-muted\"\n >\n <X size={16} />\n Cancel\n </button>\n <button\n onClick={handleSave}\n disabled={saving || !form.name.trim()}\n className=\"min-h-11 inline-flex items-center justify-center gap-2 px-4 py-2 rounded-lg bg-primary text-primary-foreground transition-colors hover:bg-primary/90 disabled:opacity-50\"\n >\n <Check size={16} />\n {saving ? 'Saving...' : editingId ? 'Update Policy' : 'Create Policy'}\n </button>\n </div>\n </div>\n )}\n\n <div className=\"space-y-3\">\n {policies.map((policy) => (\n <div\n key={policy.id}\n className=\"p-4 rounded-lg border border-default bg-surface transition-all duration-200 hover:shadow-sm hover:border-primary/30\"\n >\n <div className=\"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between\">\n <div className=\"flex items-start gap-3\">\n <div className=\"w-10 h-10 rounded-full flex items-center justify-center flex-shrink-0 bg-primary/10\">\n <Shield size={20} className=\"text-primary\" />\n </div>\n <div>\n <div className=\"flex items-center gap-2\">\n <h3 className=\"font-semibold text-primary\">{policy.name}</h3>\n {policy.id === defaultPolicyId && (\n <Star size={14} className=\"text-warning fill-warning\" />\n )}\n {!policy.active && (\n <span className=\"text-xs px-2 py-0.5 rounded bg-warning/10 text-warning\">\n Inactive\n </span>\n )}\n </div>\n <p className=\"text-sm mt-1 text-secondary\">\n Priority: {policy.priority} • First Response: {policy.firstResponseTimeMinutes}m\n • Resolution: {policy.resolutionTimeMinutes}m\n </p>\n <p className=\"text-xs mt-1 text-tertiary\">\n {policy.businessHoursOnly ? 'Business hours only' : '24/7'}\n </p>\n </div>\n </div>\n <div className=\"flex items-center gap-2\">\n <button\n className=\"min-h-11 min-w-11 p-2 rounded transition-colors duration-200 text-secondary hover:bg-muted\"\n onClick={() => handleEdit(policy)}\n aria-label=\"Edit SLA policy\"\n >\n <Edit2 size={18} />\n </button>\n <button\n className=\"min-h-11 min-w-11 p-2 rounded transition-colors duration-200 text-error hover:bg-error/10\"\n onClick={() => onDelete(policy.id)}\n aria-label=\"Delete SLA policy\"\n >\n <Trash2 size={18} />\n </button>\n </div>\n </div>\n </div>\n ))}\n\n {policies.length === 0 && !showForm && (\n <div className=\"text-center py-12 animate-in fade-in-0 duration-300\">\n <Shield size={48} className=\"text-tertiary mx-auto\" />\n <p className=\"mt-4 text-secondary\">No SLA policies configured</p>\n </div>\n )}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;AAqBA,IAAM,IAAqC;CACzC,MAAM;CACN,UAAU;CACV,0BAA0B;CAC1B,uBAAuB;CACvB,mBAAmB;CACnB,QAAQ;CACT;AAED,SAAgB,EAAoB,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EAAO;UAAsB;UAC1C;;QACJ,kBAAC,KAAD;SAAG,WAAU;mBACV,EAAO,oBAAoB,wBAAwB;SAClD,CAAA;QACA,EAAA,CAAA,CACF;UACN,kBAAC,OAAD;OAAK,WAAU;iBAAf,CACE,kBAAC,UAAD;QACE,WAAU;QACV,eAAe,EAAW,EAAO;QACjC,cAAW;kBAEX,kBAAC,GAAD,EAAO,MAAM,IAAM,CAAA;QACZ,CAAA,EACT,kBAAC,UAAD;QACE,WAAU;QACV,eAAe,EAAS,EAAO,GAAG;QAClC,cAAW;kBAEX,kBAAC,GAAD,EAAQ,MAAM,IAAM,CAAA;QACb,CAAA,CACL;SACF;;KACF,EA9CC,EAAO,GA8CR,CACN,EAED,EAAS,WAAW,KAAK,CAAC,KACzB,kBAAC,OAAD;KAAK,WAAU;eAAf,CACE,kBAAC,GAAD;MAAQ,MAAM;MAAI,WAAU;MAA0B,CAAA,EACtD,kBAAC,KAAD;MAAG,WAAU;gBAAsB;MAA8B,CAAA,CAC7D;OAEJ;;GACF"}
|
|
1
|
+
{"version":3,"file":"SLAPoliciesSettings.js","names":[],"sources":["../../../../src/support/components/settings/SLAPoliciesSettings.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { Shield, Plus, Edit2, Trash2, Star, X, Check } from 'lucide-react';\n\ninterface SLAPolicy {\n id: string;\n name: string;\n priority: string;\n firstResponseTimeMinutes: number;\n resolutionTimeMinutes: number;\n businessHoursOnly: boolean;\n active: boolean;\n}\n\ninterface SLAPoliciesSettingsProps {\n policies: SLAPolicy[];\n defaultPolicyId?: string;\n onCreate: (input: SLAPolicy) => Promise<SLAPolicy>;\n onUpdate: (id: string, input: SLAPolicy) => Promise<SLAPolicy>;\n onDelete: (id: string) => Promise<void>;\n}\n\nconst emptyPolicy: Omit<SLAPolicy, 'id'> = {\n name: '',\n priority: 'NORMAL',\n firstResponseTimeMinutes: 60,\n resolutionTimeMinutes: 480,\n businessHoursOnly: false,\n active: true,\n};\n\nexport function SLAPoliciesSettings({\n policies,\n defaultPolicyId,\n onCreate,\n onUpdate,\n onDelete,\n}: SLAPoliciesSettingsProps) {\n const [showForm, setShowForm] = useState(false);\n const [editingId, setEditingId] = useState<string | null>(null);\n const [form, setForm] = useState(emptyPolicy);\n const [saving, setSaving] = useState(false);\n\n const handleNew = () => {\n setEditingId(null);\n setForm(emptyPolicy);\n setShowForm(true);\n };\n\n const handleEdit = (policy: SLAPolicy) => {\n setEditingId(policy.id);\n setForm({\n name: policy.name,\n priority: policy.priority,\n firstResponseTimeMinutes: policy.firstResponseTimeMinutes,\n resolutionTimeMinutes: policy.resolutionTimeMinutes,\n businessHoursOnly: policy.businessHoursOnly,\n active: policy.active,\n });\n setShowForm(true);\n };\n\n const handleCancel = () => {\n setShowForm(false);\n setEditingId(null);\n setForm(emptyPolicy);\n };\n\n const handleSave = async () => {\n if (!form.name.trim()) return;\n setSaving(true);\n try {\n if (editingId) {\n await onUpdate(editingId, { ...form, id: editingId } as SLAPolicy);\n } else {\n await onCreate({ ...form, id: '' } as SLAPolicy);\n }\n handleCancel();\n } finally {\n setSaving(false);\n }\n };\n\n return (\n <div className=\"space-y-6 animate-in fade-in-0 slide-in-from-bottom-2 duration-300\">\n <div className=\"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between\">\n <div>\n <h2 className=\"text-xl font-semibold mb-2 text-primary\">SLA Policies</h2>\n <p className=\"text-sm text-secondary\">\n Manage service level agreement policies for different priority levels\n </p>\n </div>\n <button\n type=\"button\"\n onClick={handleNew}\n className=\"min-h-11 inline-flex items-center justify-center gap-2 px-4 py-2 rounded-lg transition-all duration-200 bg-primary text-primary-foreground hover:bg-primary/90\"\n >\n <Plus size={20} />\n New Policy\n </button>\n </div>\n\n {/* Create/Edit Form */}\n {showForm && (\n <div className=\"p-5 rounded-lg border-2 border-primary/30 bg-surface animate-in fade-in-0 slide-in-from-top-2 duration-200\">\n <h3 className=\"font-semibold mb-4 text-primary\">\n {editingId ? 'Edit Policy' : 'Create New Policy'}\n </h3>\n <div className=\"grid grid-cols-1 md:grid-cols-2 gap-4\">\n <div>\n <label\n className=\"block text-sm font-medium mb-1 text-secondary\"\n htmlFor=\"slapoliciessettings-policy-name-0\"\n >\n Policy Name *\n </label>\n <input\n id=\"slapoliciessettings-policy-name-0\"\n type=\"text\"\n aria-label=\"Policy Name\"\n value={form.name}\n onChange={(e) => setForm({ ...form, name: e.target.value })}\n placeholder=\"e.g., Critical Response SLA\"\n className=\"w-full px-3 py-2 rounded-lg border border-border bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-primary/20\"\n />\n </div>\n <div>\n <label\n className=\"block text-sm font-medium mb-1 text-secondary\"\n htmlFor=\"slapoliciessettings-priority-2\"\n >\n Priority\n </label>\n <select\n id=\"slapoliciessettings-priority-2\"\n aria-label=\"Priority\"\n value={form.priority}\n onChange={(e) => setForm({ ...form, priority: e.target.value })}\n className=\"w-full px-3 py-2 rounded-lg border border-border bg-background text-foreground\"\n >\n <option value=\"LOW\">Low</option>\n <option value=\"NORMAL\">Normal</option>\n <option value=\"HIGH\">High</option>\n <option value=\"CRITICAL\">Critical</option>\n </select>\n </div>\n <div>\n <label\n className=\"block text-sm font-medium mb-1 text-secondary\"\n htmlFor=\"slapoliciessettings-first-response-minutes-4\"\n >\n First Response (minutes)\n </label>\n <input\n id=\"slapoliciessettings-first-response-minutes-4\"\n type=\"number\"\n aria-label=\"First Response (minutes)\"\n value={form.firstResponseTimeMinutes}\n onChange={(e) =>\n setForm({ ...form, firstResponseTimeMinutes: parseInt(e.target.value) || 0 })\n }\n min={1}\n className=\"w-full px-3 py-2 rounded-lg border border-border bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-primary/20\"\n />\n </div>\n <div>\n <label\n className=\"block text-sm font-medium mb-1 text-secondary\"\n htmlFor=\"slapoliciessettings-resolution-time-minutes-6\"\n >\n Resolution Time (minutes)\n </label>\n <input\n id=\"slapoliciessettings-resolution-time-minutes-6\"\n type=\"number\"\n aria-label=\"Resolution Time (minutes)\"\n value={form.resolutionTimeMinutes}\n onChange={(e) =>\n setForm({ ...form, resolutionTimeMinutes: parseInt(e.target.value) || 0 })\n }\n min={1}\n className=\"w-full px-3 py-2 rounded-lg border border-border bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-primary/20\"\n />\n </div>\n </div>\n <div className=\"flex items-center gap-3 mt-4\">\n <label className=\"flex items-center gap-2 text-sm text-secondary cursor-pointer\">\n <input\n type=\"checkbox\"\n aria-label=\"Business hours only\"\n checked={form.businessHoursOnly}\n onChange={(e) => setForm({ ...form, businessHoursOnly: e.target.checked })}\n className=\"rounded\"\n />\n Business hours only\n </label>\n </div>\n <div className=\"flex flex-col gap-2 mt-5 pt-4 border-t border-border sm:flex-row sm:items-center sm:justify-end\">\n <button\n type=\"button\"\n onClick={handleCancel}\n className=\"min-h-11 inline-flex items-center justify-center gap-2 px-4 py-2 rounded-lg border border-border bg-background text-foreground transition-colors hover:bg-muted\"\n >\n <X size={16} />\n Cancel\n </button>\n <button\n type=\"button\"\n onClick={handleSave}\n disabled={saving || !form.name.trim()}\n className=\"min-h-11 inline-flex items-center justify-center gap-2 px-4 py-2 rounded-lg bg-primary text-primary-foreground transition-colors hover:bg-primary/90 disabled:opacity-50\"\n >\n <Check size={16} />\n {saving ? 'Saving...' : editingId ? 'Update Policy' : 'Create Policy'}\n </button>\n </div>\n </div>\n )}\n\n <div className=\"space-y-3\">\n {policies.map((policy) => (\n <div\n key={policy.id}\n className=\"p-4 rounded-lg border border-default bg-surface transition-all duration-200 hover:shadow-sm hover:border-primary/30\"\n >\n <div className=\"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between\">\n <div className=\"flex items-start gap-3\">\n <div className=\"size-10 rounded-full flex items-center justify-center flex-shrink-0 bg-primary/10\">\n <Shield size={20} className=\"text-primary\" />\n </div>\n <div>\n <div className=\"flex items-center gap-2\">\n <h3 className=\"font-semibold text-primary\">{policy.name}</h3>\n {policy.id === defaultPolicyId && (\n <Star size={14} className=\"text-warning fill-warning\" />\n )}\n {!policy.active && (\n <span className=\"text-xs px-2 py-0.5 rounded bg-warning/10 text-warning\">\n Inactive\n </span>\n )}\n </div>\n <p className=\"text-sm mt-1 text-secondary\">\n Priority: {policy.priority} • First Response: {policy.firstResponseTimeMinutes}m\n • Resolution: {policy.resolutionTimeMinutes}m\n </p>\n <p className=\"text-xs mt-1 text-tertiary\">\n {policy.businessHoursOnly ? 'Business hours only' : '24/7'}\n </p>\n </div>\n </div>\n <div className=\"flex items-center gap-2\">\n <button\n type=\"button\"\n className=\"min-h-11 min-w-11 p-2 rounded transition-colors duration-200 text-secondary hover:bg-muted\"\n onClick={() => handleEdit(policy)}\n aria-label=\"Edit SLA policy\"\n >\n <Edit2 size={18} />\n </button>\n <button\n type=\"button\"\n className=\"min-h-11 min-w-11 p-2 rounded transition-colors duration-200 text-error hover:bg-error/10\"\n onClick={() => onDelete(policy.id)}\n aria-label=\"Delete SLA policy\"\n >\n <Trash2 size={18} />\n </button>\n </div>\n </div>\n </div>\n ))}\n\n {policies.length === 0 && !showForm && (\n <div className=\"text-center py-12 animate-in fade-in-0 duration-300\">\n <Shield size={48} className=\"text-tertiary mx-auto\" />\n <p className=\"mt-4 text-secondary\">No SLA policies configured</p>\n </div>\n )}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;AAqBA,IAAM,IAAqC;CACzC,MAAM;CACN,UAAU;CACV,0BAA0B;CAC1B,uBAAuB;CACvB,mBAAmB;CACnB,QAAQ;CACT;AAED,SAAgB,EAAoB,EAClC,aACA,oBACA,aACA,aACA,eAC2B;CAC3B,IAAM,CAAC,GAAU,KAAe,EAAS,GAAM,EACzC,CAAC,GAAW,KAAgB,EAAwB,KAAK,EACzD,CAAC,GAAM,KAAW,EAAS,EAAY,EACvC,CAAC,GAAQ,KAAa,EAAS,GAAM,EAErC,UAAkB;AAGtB,EAFA,EAAa,KAAK,EAClB,EAAQ,EAAY,EACpB,EAAY,GAAK;IAGb,KAAc,MAAsB;AAUxC,EATA,EAAa,EAAO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CACE,kBAAC,UAAD;QACE,MAAK;QACL,WAAU;QACV,eAAe,EAAW,EAAO;QACjC,cAAW;kBAEX,kBAAC,GAAD,EAAO,MAAM,IAAM,CAAA;QACZ,CAAA,EACT,kBAAC,UAAD;QACE,MAAK;QACL,WAAU;QACV,eAAe,EAAS,EAAO,GAAG;QAClC,cAAW;kBAEX,kBAAC,GAAD,EAAQ,MAAM,IAAM,CAAA;QACb,CAAA,CACL;SACF;;KACF,EAhDC,EAAO,GAgDR,CACN,EAED,EAAS,WAAW,KAAK,CAAC,KACzB,kBAAC,OAAD;KAAK,WAAU;eAAf,CACE,kBAAC,GAAD;MAAQ,MAAM;MAAI,WAAU;MAA0B,CAAA,EACtD,kBAAC,KAAD;MAAG,WAAU;gBAAsB;MAA8B,CAAA,CAC7D;OAEJ;;GACF"}
|
|
@@ -90,9 +90,9 @@ function S({ categories: S, onCreate: C, onUpdate: w, onDelete: T }) {
|
|
|
90
90
|
children: I.message
|
|
91
91
|
})]
|
|
92
92
|
}),
|
|
93
|
-
E && /* @__PURE__ */ v("
|
|
94
|
-
|
|
95
|
-
|
|
93
|
+
E && /* @__PURE__ */ v("dialog", {
|
|
94
|
+
open: !0,
|
|
95
|
+
className: "fixed inset-0 z-50 flex items-center justify-center bg-overlay m-0 max-w-none max-h-none w-full h-full",
|
|
96
96
|
"aria-modal": "true",
|
|
97
97
|
"aria-labelledby": "ticket-category-modal-title",
|
|
98
98
|
children: /* @__PURE__ */ y("div", {
|
|
@@ -104,6 +104,7 @@ function S({ categories: S, onCreate: C, onUpdate: w, onDelete: T }) {
|
|
|
104
104
|
className: "text-xl font-semibold text-foreground",
|
|
105
105
|
children: O ? "Edit Category" : "Create Category"
|
|
106
106
|
}), /* @__PURE__ */ v("button", {
|
|
107
|
+
type: "button",
|
|
107
108
|
onClick: H,
|
|
108
109
|
className: "min-h-11 min-w-11 p-2 rounded-lg hover:bg-muted text-muted-foreground",
|
|
109
110
|
"aria-label": "Close category dialog",
|
|
@@ -114,13 +115,16 @@ function S({ categories: S, onCreate: C, onUpdate: w, onDelete: T }) {
|
|
|
114
115
|
className: "space-y-5",
|
|
115
116
|
children: [
|
|
116
117
|
/* @__PURE__ */ y("div", { children: [/* @__PURE__ */ y("label", {
|
|
118
|
+
htmlFor: "ticket-category-name",
|
|
117
119
|
className: "block text-sm font-medium text-foreground mb-2",
|
|
118
120
|
children: ["Category Name ", /* @__PURE__ */ v("span", {
|
|
119
121
|
className: "text-destructive",
|
|
120
122
|
children: "*"
|
|
121
123
|
})]
|
|
122
124
|
}), /* @__PURE__ */ v("input", {
|
|
125
|
+
id: "ticket-category-name",
|
|
123
126
|
type: "text",
|
|
127
|
+
"aria-label": "Category Name",
|
|
124
128
|
value: A.name,
|
|
125
129
|
onChange: (e) => U(e.target.value),
|
|
126
130
|
placeholder: "e.g., Technical Support",
|
|
@@ -129,6 +133,7 @@ function S({ categories: S, onCreate: C, onUpdate: w, onDelete: T }) {
|
|
|
129
133
|
})] }),
|
|
130
134
|
/* @__PURE__ */ y("div", { children: [
|
|
131
135
|
/* @__PURE__ */ y("label", {
|
|
136
|
+
htmlFor: "ticket-category-slug",
|
|
132
137
|
className: "block text-sm font-medium text-foreground mb-2",
|
|
133
138
|
children: ["Slug ", /* @__PURE__ */ v("span", {
|
|
134
139
|
className: "text-destructive",
|
|
@@ -136,7 +141,9 @@ function S({ categories: S, onCreate: C, onUpdate: w, onDelete: T }) {
|
|
|
136
141
|
})]
|
|
137
142
|
}),
|
|
138
143
|
/* @__PURE__ */ v("input", {
|
|
144
|
+
id: "ticket-category-slug",
|
|
139
145
|
type: "text",
|
|
146
|
+
"aria-label": "Slug",
|
|
140
147
|
value: A.slug,
|
|
141
148
|
onChange: (e) => j({
|
|
142
149
|
...A,
|
|
@@ -153,8 +160,11 @@ function S({ categories: S, onCreate: C, onUpdate: w, onDelete: T }) {
|
|
|
153
160
|
] }),
|
|
154
161
|
/* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("label", {
|
|
155
162
|
className: "block text-sm font-medium text-foreground mb-2",
|
|
163
|
+
htmlFor: "ticketcategoriessettings-description-0",
|
|
156
164
|
children: "Description"
|
|
157
165
|
}), /* @__PURE__ */ v("textarea", {
|
|
166
|
+
id: "ticketcategoriessettings-description-0",
|
|
167
|
+
"aria-label": "Description",
|
|
158
168
|
value: A.description,
|
|
159
169
|
onChange: (e) => j({
|
|
160
170
|
...A,
|
|
@@ -164,7 +174,8 @@ function S({ categories: S, onCreate: C, onUpdate: w, onDelete: T }) {
|
|
|
164
174
|
rows: 3,
|
|
165
175
|
className: "w-full px-4 py-2.5 rounded-lg border border-input bg-background text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary resize-none"
|
|
166
176
|
})] }),
|
|
167
|
-
/* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("
|
|
177
|
+
/* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("span", {
|
|
178
|
+
id: "ticket-category-color-heading",
|
|
168
179
|
className: "block text-sm font-medium text-foreground mb-2",
|
|
169
180
|
children: "Color"
|
|
170
181
|
}), /* @__PURE__ */ y("div", {
|
|
@@ -181,6 +192,7 @@ function S({ categories: S, onCreate: C, onUpdate: w, onDelete: T }) {
|
|
|
181
192
|
"aria-label": `Use ${e.label} category color`
|
|
182
193
|
}, e.value))
|
|
183
194
|
}), /* @__PURE__ */ v("select", {
|
|
195
|
+
"aria-labelledby": "ticket-category-color-heading",
|
|
184
196
|
value: A.color,
|
|
185
197
|
onChange: (e) => j({
|
|
186
198
|
...A,
|
|
@@ -195,9 +207,12 @@ function S({ categories: S, onCreate: C, onUpdate: w, onDelete: T }) {
|
|
|
195
207
|
})] }),
|
|
196
208
|
/* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("label", {
|
|
197
209
|
className: "block text-sm font-medium text-foreground mb-2",
|
|
210
|
+
htmlFor: "ticketcategoriessettings-icon-emoji-2",
|
|
198
211
|
children: "Icon (emoji)"
|
|
199
212
|
}), /* @__PURE__ */ v("input", {
|
|
213
|
+
id: "ticketcategoriessettings-icon-emoji-2",
|
|
200
214
|
type: "text",
|
|
215
|
+
"aria-label": "Icon (emoji)",
|
|
201
216
|
value: A.icon,
|
|
202
217
|
onChange: (e) => j({
|
|
203
218
|
...A,
|
|
@@ -211,12 +226,13 @@ function S({ categories: S, onCreate: C, onUpdate: w, onDelete: T }) {
|
|
|
211
226
|
className: "flex items-center gap-3 cursor-pointer",
|
|
212
227
|
children: [/* @__PURE__ */ v("input", {
|
|
213
228
|
type: "checkbox",
|
|
229
|
+
"aria-label": "Active",
|
|
214
230
|
checked: A.isActive,
|
|
215
231
|
onChange: (e) => j({
|
|
216
232
|
...A,
|
|
217
233
|
isActive: e.target.checked
|
|
218
234
|
}),
|
|
219
|
-
className: "
|
|
235
|
+
className: "size-4 rounded border-input text-primary focus:ring-primary"
|
|
220
236
|
}), /* @__PURE__ */ v("span", {
|
|
221
237
|
className: "text-sm text-foreground",
|
|
222
238
|
children: "Active"
|
|
@@ -252,6 +268,7 @@ function S({ categories: S, onCreate: C, onUpdate: w, onDelete: T }) {
|
|
|
252
268
|
className: "text-sm text-muted-foreground",
|
|
253
269
|
children: "Organize tickets and knowledge base articles by category"
|
|
254
270
|
})] }), /* @__PURE__ */ y("button", {
|
|
271
|
+
type: "button",
|
|
255
272
|
onClick: B,
|
|
256
273
|
className: "min-h-11 inline-flex items-center justify-center gap-2 px-4 py-2 rounded-lg transition-colors bg-primary text-primary-foreground hover:bg-primary/90",
|
|
257
274
|
children: [/* @__PURE__ */ v(f, { size: 20 }), "New Category"]
|
|
@@ -267,7 +284,7 @@ function S({ categories: S, onCreate: C, onUpdate: w, onDelete: T }) {
|
|
|
267
284
|
children: /* @__PURE__ */ v(u, { size: 20 })
|
|
268
285
|
}),
|
|
269
286
|
/* @__PURE__ */ v("div", {
|
|
270
|
-
className: `
|
|
287
|
+
className: `size-10 rounded-lg flex items-center justify-center text-on-accent text-xl flex-shrink-0 ${n(e.color)}`,
|
|
271
288
|
children: e.icon || /* @__PURE__ */ v(l, { size: 20 })
|
|
272
289
|
}),
|
|
273
290
|
/* @__PURE__ */ y("div", {
|
|
@@ -303,6 +320,7 @@ function S({ categories: S, onCreate: C, onUpdate: w, onDelete: T }) {
|
|
|
303
320
|
className: "flex w-full items-center justify-end gap-1 sm:w-auto",
|
|
304
321
|
children: [
|
|
305
322
|
/* @__PURE__ */ v("button", {
|
|
323
|
+
type: "button",
|
|
306
324
|
onClick: () => K(e),
|
|
307
325
|
className: "min-h-11 min-w-11 p-2 rounded hover:bg-muted text-muted-foreground transition-colors",
|
|
308
326
|
title: e.isActive ? "Deactivate" : "Activate",
|
|
@@ -313,6 +331,7 @@ function S({ categories: S, onCreate: C, onUpdate: w, onDelete: T }) {
|
|
|
313
331
|
}) : /* @__PURE__ */ v(p, { size: 20 })
|
|
314
332
|
}),
|
|
315
333
|
/* @__PURE__ */ v("button", {
|
|
334
|
+
type: "button",
|
|
316
335
|
onClick: () => V(e),
|
|
317
336
|
className: "min-h-11 min-w-11 p-2 rounded hover:bg-muted text-muted-foreground transition-colors",
|
|
318
337
|
title: "Edit category",
|
|
@@ -320,6 +339,7 @@ function S({ categories: S, onCreate: C, onUpdate: w, onDelete: T }) {
|
|
|
320
339
|
children: /* @__PURE__ */ v(c, { size: 18 })
|
|
321
340
|
}),
|
|
322
341
|
/* @__PURE__ */ v("button", {
|
|
342
|
+
type: "button",
|
|
323
343
|
onClick: () => e.id && G(e.id, e.articleCount ?? 0),
|
|
324
344
|
disabled: P === e.id,
|
|
325
345
|
className: "min-h-11 min-w-11 p-2 rounded hover:bg-muted text-status-error-text transition-colors disabled:opacity-50",
|
|
@@ -345,6 +365,7 @@ function S({ categories: S, onCreate: C, onUpdate: w, onDelete: T }) {
|
|
|
345
365
|
children: "No categories configured"
|
|
346
366
|
}),
|
|
347
367
|
/* @__PURE__ */ v("button", {
|
|
368
|
+
type: "button",
|
|
348
369
|
onClick: B,
|
|
349
370
|
className: "mt-4 text-primary hover:underline",
|
|
350
371
|
children: "Create your first category"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TicketCategoriesSettings.js","names":[],"sources":["../../../../src/support/components/settings/TicketCategoriesSettings.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\nimport {\n FolderOpen,\n Plus,\n Edit2,\n Trash2,\n X,\n Loader2,\n AlertCircle,\n CheckCircle,\n ToggleLeft,\n ToggleRight,\n GripVertical,\n} from 'lucide-react';\nimport {\n CATEGORY_COLOR_OPTIONS,\n getCategoryColorOption,\n getCategorySwatchClass,\n} from '../../utils/categoryColors';\n\ninterface TicketCategory {\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\ninterface TicketCategoriesSettingsProps {\n categories: TicketCategory[];\n onCreate: (\n input: Omit<TicketCategory, 'id' | 'articleCount'>\n ) => Promise<TicketCategory | null | undefined>;\n onUpdate: (\n id: string,\n input: Partial<TicketCategory>\n ) => Promise<TicketCategory | null | undefined>;\n onDelete: (id: string) => Promise<boolean | null | undefined>;\n}\n\nconst generateSlug = (name: string): string => {\n return name\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, '-')\n .replace(/(^-|-$)/g, '');\n};\n\nconst initialFormData: Omit<TicketCategory, 'id' | 'articleCount'> = {\n name: '',\n slug: '',\n description: '',\n color: CATEGORY_COLOR_OPTIONS[0].value,\n icon: '',\n isActive: true,\n};\n\nexport function TicketCategoriesSettings({\n categories,\n onCreate,\n onUpdate,\n onDelete,\n}: TicketCategoriesSettingsProps) {\n const [isModalOpen, setIsModalOpen] = useState(false);\n const [editingCategory, setEditingCategory] = useState<TicketCategory | null>(null);\n const [formData, setFormData] =\n useState<Omit<TicketCategory, 'id' | 'articleCount'>>(initialFormData);\n const [isSubmitting, setIsSubmitting] = useState(false);\n const [isDeleting, setIsDeleting] = useState<string | null>(null);\n const [notification, setNotification] = useState<{\n type: 'success' | 'error';\n message: string;\n } | null>(null);\n const notificationTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n useEffect(() => {\n return () => {\n if (notificationTimerRef.current) clearTimeout(notificationTimerRef.current);\n };\n }, []);\n\n const showNotification = (type: 'success' | 'error', message: string) => {\n setNotification({ type, message });\n if (notificationTimerRef.current) clearTimeout(notificationTimerRef.current);\n notificationTimerRef.current = setTimeout(() => setNotification(null), 3000);\n };\n\n const openCreateModal = () => {\n setEditingCategory(null);\n setFormData(initialFormData);\n setIsModalOpen(true);\n };\n\n const openEditModal = (category: TicketCategory) => {\n setEditingCategory(category);\n setFormData({\n name: category.name,\n slug: category.slug,\n description: category.description || '',\n color: getCategoryColorOption(category.color).value,\n icon: category.icon || '',\n isActive: category.isActive ?? true,\n parentId: category.parentId,\n });\n setIsModalOpen(true);\n };\n\n const closeModal = () => {\n setIsModalOpen(false);\n setEditingCategory(null);\n setFormData(initialFormData);\n };\n\n const handleNameChange = (name: string) => {\n setFormData({\n ...formData,\n name,\n slug: editingCategory ? formData.slug : generateSlug(name),\n });\n };\n\n const handleSubmit = async (e: React.FormEvent) => {\n e.preventDefault();\n if (!formData.name.trim() || !formData.slug.trim()) return;\n\n setIsSubmitting(true);\n try {\n if (editingCategory?.id) {\n await onUpdate(editingCategory.id, formData);\n showNotification('success', 'Category updated successfully!');\n } else {\n await onCreate(formData);\n showNotification('success', 'Category created successfully!');\n }\n closeModal();\n } catch {\n showNotification('error', `Failed to ${editingCategory ? 'update' : 'create'} category.`);\n } finally {\n setIsSubmitting(false);\n }\n };\n\n const handleDelete = async (id: string, articleCount: number) => {\n if (articleCount > 0) {\n showNotification(\n 'error',\n `Cannot delete category with ${articleCount} articles. Move articles first.`\n );\n return;\n }\n if (!confirm('Are you sure you want to delete this category?')) return;\n\n setIsDeleting(id);\n try {\n await onDelete(id);\n showNotification('success', 'Category deleted successfully!');\n } catch {\n showNotification('error', 'Failed to delete category.');\n } finally {\n setIsDeleting(null);\n }\n };\n\n const handleToggleActive = async (category: TicketCategory) => {\n if (!category.id) return;\n try {\n await onUpdate(category.id, { isActive: !category.isActive });\n showNotification(\n 'success',\n `Category ${category.isActive ? 'deactivated' : 'activated'} successfully!`\n );\n } catch {\n showNotification('error', 'Failed to update category status.');\n }\n };\n\n // Sort categories by displayOrder\n const sortedCategories = [...categories].sort(\n (a, b) => (a.displayOrder ?? 0) - (b.displayOrder ?? 0)\n );\n\n return (\n <div className=\"space-y-6\">\n {/* Notification */}\n {notification && (\n <div\n className={`fixed right-4 top-[calc(var(--header-height,4rem)+1rem)] z-[200] flex items-center gap-3 px-5 py-3 rounded-xl shadow-2xl border-2 animate-in slide-in-from-top-4 duration-300 ${\n notification.type === 'success'\n ? 'bg-status-success-bg-subtle text-status-success-text border-border-subtle'\n : 'bg-status-error-bg-subtle text-status-error-text border-border-subtle'\n }`}\n >\n {notification.type === 'success' ? (\n <CheckCircle size={20} className=\"text-status-success-text\" />\n ) : (\n <AlertCircle size={20} className=\"text-destructive\" />\n )}\n <span className=\"font-medium\">{notification.message}</span>\n </div>\n )}\n\n {/* Modal */}\n {isModalOpen && (\n <div\n className=\"fixed inset-0 z-50 flex items-center justify-center bg-overlay\"\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby=\"ticket-category-modal-title\"\n >\n <div className=\"bg-background rounded-xl p-6 w-full max-w-lg mx-4 shadow-2xl border max-h-[90vh] overflow-y-auto\">\n <div className=\"flex items-center justify-between mb-6\">\n <h3\n id=\"ticket-category-modal-title\"\n className=\"text-xl font-semibold text-foreground\"\n >\n {editingCategory ? 'Edit Category' : 'Create Category'}\n </h3>\n <button\n onClick={closeModal}\n className=\"min-h-11 min-w-11 p-2 rounded-lg hover:bg-muted text-muted-foreground\"\n aria-label=\"Close category dialog\"\n >\n <X size={20} />\n </button>\n </div>\n\n <form onSubmit={handleSubmit} className=\"space-y-5\">\n {/* Name */}\n <div>\n <label className=\"block text-sm font-medium text-foreground mb-2\">\n Category Name <span className=\"text-destructive\">*</span>\n </label>\n <input\n type=\"text\"\n value={formData.name}\n onChange={(e) => handleNameChange(e.target.value)}\n placeholder=\"e.g., Technical Support\"\n className=\"w-full px-4 py-2.5 rounded-lg border border-input bg-background text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary\"\n required\n />\n </div>\n\n {/* Slug */}\n <div>\n <label className=\"block text-sm font-medium text-foreground mb-2\">\n Slug <span className=\"text-destructive\">*</span>\n </label>\n <input\n type=\"text\"\n value={formData.slug}\n onChange={(e) => setFormData({ ...formData, slug: e.target.value })}\n placeholder=\"technical-support\"\n className=\"w-full px-4 py-2.5 rounded-lg border border-input bg-background text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary\"\n required\n />\n <p className=\"text-xs text-muted-foreground mt-1\">\n URL-friendly identifier (auto-generated from name)\n </p>\n </div>\n\n {/* Description */}\n <div>\n <label className=\"block text-sm font-medium text-foreground mb-2\">\n Description\n </label>\n <textarea\n value={formData.description}\n onChange={(e) => setFormData({ ...formData, description: e.target.value })}\n placeholder=\"Brief description of this category...\"\n rows={3}\n className=\"w-full px-4 py-2.5 rounded-lg border border-input bg-background text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary resize-none\"\n />\n </div>\n\n {/* Color */}\n <div>\n <label className=\"block text-sm font-medium text-foreground mb-2\">Color</label>\n <div className=\"flex flex-col gap-3 sm:flex-row sm:items-center\">\n <div className=\"flex flex-wrap gap-2\">\n {CATEGORY_COLOR_OPTIONS.map((option) => (\n <button\n key={option.value}\n type=\"button\"\n onClick={() => setFormData({ ...formData, color: option.value })}\n className={`min-h-11 min-w-11 rounded-full border-2 transition-all ${option.swatchClass} ${\n formData.color === option.value\n ? 'border-foreground scale-110'\n : 'border-transparent hover:scale-105'\n }`}\n aria-label={`Use ${option.label} category color`}\n />\n ))}\n </div>\n <select\n value={formData.color}\n onChange={(e) => setFormData({ ...formData, color: e.target.value })}\n className=\"min-h-11 rounded-lg border border-input bg-background px-3 text-sm text-foreground\"\n >\n {CATEGORY_COLOR_OPTIONS.map((option) => (\n <option key={option.value} value={option.value}>\n {option.label}\n </option>\n ))}\n </select>\n </div>\n </div>\n\n {/* Icon */}\n <div>\n <label className=\"block text-sm font-medium text-foreground mb-2\">\n Icon (emoji)\n </label>\n <input\n type=\"text\"\n value={formData.icon}\n onChange={(e) => setFormData({ ...formData, icon: e.target.value })}\n placeholder=\"e.g., 🛠️\"\n className=\"w-full px-4 py-2.5 rounded-lg border border-input bg-background text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary\"\n maxLength={4}\n />\n </div>\n\n {/* Active Toggle */}\n <label className=\"flex items-center gap-3 cursor-pointer\">\n <input\n type=\"checkbox\"\n checked={formData.isActive}\n onChange={(e) => setFormData({ ...formData, isActive: e.target.checked })}\n className=\"w-4 h-4 rounded border-input text-primary focus:ring-primary\"\n />\n <span className=\"text-sm text-foreground\">Active</span>\n </label>\n\n {/* Actions */}\n <div className=\"flex flex-col gap-3 pt-4 sm:flex-row\">\n <button\n type=\"submit\"\n disabled={isSubmitting || !formData.name.trim() || !formData.slug.trim()}\n className=\"min-h-11 flex-1 flex items-center justify-center gap-2 px-4 py-2.5 rounded-lg bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50 disabled:cursor-not-allowed transition-colors\"\n >\n {isSubmitting ? (\n <>\n <Loader2 size={18} className=\"animate-spin\" />\n {editingCategory ? 'Updating...' : 'Creating...'}\n </>\n ) : (\n <>{editingCategory ? 'Update Category' : 'Create Category'}</>\n )}\n </button>\n <button\n type=\"button\"\n onClick={closeModal}\n className=\"min-h-11 px-4 py-2.5 rounded-lg border border-input hover:bg-muted transition-colors\"\n >\n Cancel\n </button>\n </div>\n </form>\n </div>\n </div>\n )}\n\n {/* Header */}\n <div className=\"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between\">\n <div>\n <h2 className=\"text-xl font-semibold mb-2 text-foreground\">Ticket Categories</h2>\n <p className=\"text-sm text-muted-foreground\">\n Organize tickets and knowledge base articles by category\n </p>\n </div>\n <button\n onClick={openCreateModal}\n className=\"min-h-11 inline-flex items-center justify-center gap-2 px-4 py-2 rounded-lg transition-colors bg-primary text-primary-foreground hover:bg-primary/90\"\n >\n <Plus size={20} />\n New Category\n </button>\n </div>\n\n {/* Categories List */}\n <div className=\"space-y-2\">\n {sortedCategories.map((category) => (\n <div\n key={category.id}\n className={`p-4 rounded-lg border bg-background flex flex-col gap-4 sm:flex-row sm:items-center ${\n category.isActive === false ? 'border-border/50 opacity-60' : 'border-border'\n }`}\n >\n {/* Drag Handle (visual only for now) */}\n <div className=\"text-muted-foreground cursor-grab\">\n <GripVertical size={20} />\n </div>\n\n {/* Color & Icon */}\n <div\n className={`w-10 h-10 rounded-lg flex items-center justify-center text-on-accent text-xl flex-shrink-0 ${getCategorySwatchClass(category.color)}`}\n >\n {category.icon || <FolderOpen size={20} />}\n </div>\n\n {/* Info */}\n <div className=\"flex-1 min-w-0\">\n <div className=\"flex items-center gap-2\">\n <h3 className=\"font-semibold text-foreground\">{category.name}</h3>\n {category.isActive === false && (\n <span className=\"text-xs px-2 py-0.5 rounded bg-muted text-muted-foreground\">\n Inactive\n </span>\n )}\n </div>\n <p className=\"text-sm text-muted-foreground\">\n /{category.slug} • {category.articleCount ?? 0} articles\n </p>\n {category.description && (\n <p className=\"text-xs text-muted-foreground mt-1 line-clamp-1\">\n {category.description}\n </p>\n )}\n </div>\n\n {/* Actions */}\n <div className=\"flex w-full items-center justify-end gap-1 sm:w-auto\">\n <button\n onClick={() => handleToggleActive(category)}\n className=\"min-h-11 min-w-11 p-2 rounded hover:bg-muted text-muted-foreground transition-colors\"\n title={category.isActive ? 'Deactivate' : 'Activate'}\n aria-label={category.isActive ? 'Deactivate category' : 'Activate category'}\n >\n {category.isActive ? (\n <ToggleRight size={20} className=\"text-status-success-text\" />\n ) : (\n <ToggleLeft size={20} />\n )}\n </button>\n <button\n onClick={() => openEditModal(category)}\n className=\"min-h-11 min-w-11 p-2 rounded hover:bg-muted text-muted-foreground transition-colors\"\n title=\"Edit category\"\n aria-label=\"Edit category\"\n >\n <Edit2 size={18} />\n </button>\n <button\n onClick={() => category.id && handleDelete(category.id, category.articleCount ?? 0)}\n disabled={isDeleting === category.id}\n className=\"min-h-11 min-w-11 p-2 rounded hover:bg-muted text-status-error-text transition-colors disabled:opacity-50\"\n title=\"Delete category\"\n aria-label=\"Delete category\"\n >\n {isDeleting === category.id ? (\n <Loader2 size={18} className=\"animate-spin\" />\n ) : (\n <Trash2 size={18} />\n )}\n </button>\n </div>\n </div>\n ))}\n\n {categories.length === 0 && (\n <div className=\"text-center py-12 border border-dashed border-border rounded-lg\">\n <FolderOpen size={48} className=\"text-muted-foreground mx-auto\" />\n <p className=\"mt-4 text-muted-foreground\">No categories configured</p>\n <button onClick={openCreateModal} className=\"mt-4 text-primary hover:underline\">\n Create your first category\n </button>\n </div>\n )}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;AA6CA,IAAM,KAAgB,MACb,EACJ,aAAa,CACb,QAAQ,eAAe,IAAI,CAC3B,QAAQ,YAAY,GAAG,EAGtB,IAA+D;CACnE,MAAM;CACN,MAAM;CACN,aAAa;CACb,OAAO,EAAuB,GAAG;CACjC,MAAM;CACN,UAAU;CACX;AAED,SAAgB,EAAyB,EACvC,eACA,aACA,aACA,eACgC;CAChC,IAAM,CAAC,GAAa,KAAkB,EAAS,GAAM,EAC/C,CAAC,GAAiB,KAAsB,EAAgC,KAAK,EAC7E,CAAC,GAAU,KACf,EAAsD,EAAgB,EAClE,CAAC,GAAc,KAAmB,EAAS,GAAM,EACjD,CAAC,GAAY,KAAiB,EAAwB,KAAK,EAC3D,CAAC,GAAc,KAAmB,EAG9B,KAAK,EACT,IAAuB,EAA6C,KAAK;AAE/E,eACe;AACX,EAAI,EAAqB,WAAS,aAAa,EAAqB,QAAQ;IAE7E,EAAE,CAAC;CAEN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AD;SACE,eAAe,EAAc,EAAS;SACtC,WAAU;SACV,OAAM;SACN,cAAW;mBAEX,kBAAC,GAAD,EAAO,MAAM,IAAM,CAAA;SACZ,CAAA;QACT,kBAAC,UAAD;SACE,eAAe,EAAS,MAAM,EAAa,EAAS,IAAI,EAAS,gBAAgB,EAAE;SACnF,UAAU,MAAe,EAAS;SAClC,WAAU;SACV,OAAM;SACN,cAAW;mBAEV,MAAe,EAAS,KACvB,kBAAC,GAAD;UAAS,MAAM;UAAI,WAAU;UAAiB,CAAA,GAE9C,kBAAC,GAAD,EAAQ,MAAM,IAAM,CAAA;SAEf,CAAA;QACL;;MACF;OAzEC,EAAS,GAyEV,CACN,EAED,EAAW,WAAW,KACrB,kBAAC,OAAD;KAAK,WAAU;eAAf;MACE,kBAAC,GAAD;OAAY,MAAM;OAAI,WAAU;OAAkC,CAAA;MAClE,kBAAC,KAAD;OAAG,WAAU;iBAA6B;OAA4B,CAAA;MACtE,kBAAC,UAAD;OAAQ,SAAS;OAAiB,WAAU;iBAAoC;OAEvE,CAAA;MACL;OAEJ;;GACF"}
|
|
1
|
+
{"version":3,"file":"TicketCategoriesSettings.js","names":[],"sources":["../../../../src/support/components/settings/TicketCategoriesSettings.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\nimport {\n FolderOpen,\n Plus,\n Edit2,\n Trash2,\n X,\n Loader2,\n AlertCircle,\n CheckCircle,\n ToggleLeft,\n ToggleRight,\n GripVertical,\n} from 'lucide-react';\nimport {\n CATEGORY_COLOR_OPTIONS,\n getCategoryColorOption,\n getCategorySwatchClass,\n} from '../../utils/categoryColors';\n\ninterface TicketCategory {\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\ninterface TicketCategoriesSettingsProps {\n categories: TicketCategory[];\n onCreate: (\n input: Omit<TicketCategory, 'id' | 'articleCount'>\n ) => Promise<TicketCategory | null | undefined>;\n onUpdate: (\n id: string,\n input: Partial<TicketCategory>\n ) => Promise<TicketCategory | null | undefined>;\n onDelete: (id: string) => Promise<boolean | null | undefined>;\n}\n\nconst generateSlug = (name: string): string => {\n return name\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, '-')\n .replace(/(^-|-$)/g, '');\n};\n\nconst initialFormData: Omit<TicketCategory, 'id' | 'articleCount'> = {\n name: '',\n slug: '',\n description: '',\n color: CATEGORY_COLOR_OPTIONS[0].value,\n icon: '',\n isActive: true,\n};\n\nexport function TicketCategoriesSettings({\n categories,\n onCreate,\n onUpdate,\n onDelete,\n}: TicketCategoriesSettingsProps) {\n const [isModalOpen, setIsModalOpen] = useState(false);\n const [editingCategory, setEditingCategory] = useState<TicketCategory | null>(null);\n const [formData, setFormData] =\n useState<Omit<TicketCategory, 'id' | 'articleCount'>>(initialFormData);\n const [isSubmitting, setIsSubmitting] = useState(false);\n const [isDeleting, setIsDeleting] = useState<string | null>(null);\n const [notification, setNotification] = useState<{\n type: 'success' | 'error';\n message: string;\n } | null>(null);\n const notificationTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n useEffect(() => {\n return () => {\n if (notificationTimerRef.current) clearTimeout(notificationTimerRef.current);\n };\n }, []);\n\n const showNotification = (type: 'success' | 'error', message: string) => {\n setNotification({ type, message });\n if (notificationTimerRef.current) clearTimeout(notificationTimerRef.current);\n notificationTimerRef.current = setTimeout(() => setNotification(null), 3000);\n };\n\n const openCreateModal = () => {\n setEditingCategory(null);\n setFormData(initialFormData);\n setIsModalOpen(true);\n };\n\n const openEditModal = (category: TicketCategory) => {\n setEditingCategory(category);\n setFormData({\n name: category.name,\n slug: category.slug,\n description: category.description || '',\n color: getCategoryColorOption(category.color).value,\n icon: category.icon || '',\n isActive: category.isActive ?? true,\n parentId: category.parentId,\n });\n setIsModalOpen(true);\n };\n\n const closeModal = () => {\n setIsModalOpen(false);\n setEditingCategory(null);\n setFormData(initialFormData);\n };\n\n const handleNameChange = (name: string) => {\n setFormData({\n ...formData,\n name,\n slug: editingCategory ? formData.slug : generateSlug(name),\n });\n };\n\n const handleSubmit = async (e: React.FormEvent) => {\n e.preventDefault();\n if (!formData.name.trim() || !formData.slug.trim()) return;\n\n setIsSubmitting(true);\n try {\n if (editingCategory?.id) {\n await onUpdate(editingCategory.id, formData);\n showNotification('success', 'Category updated successfully!');\n } else {\n await onCreate(formData);\n showNotification('success', 'Category created successfully!');\n }\n closeModal();\n } catch {\n showNotification('error', `Failed to ${editingCategory ? 'update' : 'create'} category.`);\n } finally {\n setIsSubmitting(false);\n }\n };\n\n const handleDelete = async (id: string, articleCount: number) => {\n if (articleCount > 0) {\n showNotification(\n 'error',\n `Cannot delete category with ${articleCount} articles. Move articles first.`\n );\n return;\n }\n if (!confirm('Are you sure you want to delete this category?')) return;\n\n setIsDeleting(id);\n try {\n await onDelete(id);\n showNotification('success', 'Category deleted successfully!');\n } catch {\n showNotification('error', 'Failed to delete category.');\n } finally {\n setIsDeleting(null);\n }\n };\n\n const handleToggleActive = async (category: TicketCategory) => {\n if (!category.id) return;\n try {\n await onUpdate(category.id, { isActive: !category.isActive });\n showNotification(\n 'success',\n `Category ${category.isActive ? 'deactivated' : 'activated'} successfully!`\n );\n } catch {\n showNotification('error', 'Failed to update category status.');\n }\n };\n\n // Sort categories by displayOrder\n const sortedCategories = [...categories].sort(\n (a, b) => (a.displayOrder ?? 0) - (b.displayOrder ?? 0)\n );\n\n return (\n <div className=\"space-y-6\">\n {/* Notification */}\n {notification && (\n <div\n className={`fixed right-4 top-[calc(var(--header-height,4rem)+1rem)] z-[200] flex items-center gap-3 px-5 py-3 rounded-xl shadow-2xl border-2 animate-in slide-in-from-top-4 duration-300 ${\n notification.type === 'success'\n ? 'bg-status-success-bg-subtle text-status-success-text border-border-subtle'\n : 'bg-status-error-bg-subtle text-status-error-text border-border-subtle'\n }`}\n >\n {notification.type === 'success' ? (\n <CheckCircle size={20} className=\"text-status-success-text\" />\n ) : (\n <AlertCircle size={20} className=\"text-destructive\" />\n )}\n <span className=\"font-medium\">{notification.message}</span>\n </div>\n )}\n\n {/* Modal */}\n {isModalOpen && (\n <dialog\n open\n className=\"fixed inset-0 z-50 flex items-center justify-center bg-overlay m-0 max-w-none max-h-none w-full h-full\"\n aria-modal=\"true\"\n aria-labelledby=\"ticket-category-modal-title\"\n >\n <div className=\"bg-background rounded-xl p-6 w-full max-w-lg mx-4 shadow-2xl border max-h-[90vh] overflow-y-auto\">\n <div className=\"flex items-center justify-between mb-6\">\n <h3\n id=\"ticket-category-modal-title\"\n className=\"text-xl font-semibold text-foreground\"\n >\n {editingCategory ? 'Edit Category' : 'Create Category'}\n </h3>\n <button\n type=\"button\"\n onClick={closeModal}\n className=\"min-h-11 min-w-11 p-2 rounded-lg hover:bg-muted text-muted-foreground\"\n aria-label=\"Close category dialog\"\n >\n <X size={20} />\n </button>\n </div>\n\n <form onSubmit={handleSubmit} className=\"space-y-5\">\n {/* Name */}\n <div>\n <label\n htmlFor=\"ticket-category-name\"\n className=\"block text-sm font-medium text-foreground mb-2\"\n >\n Category Name <span className=\"text-destructive\">*</span>\n </label>\n <input\n id=\"ticket-category-name\"\n type=\"text\"\n aria-label=\"Category Name\"\n value={formData.name}\n onChange={(e) => handleNameChange(e.target.value)}\n placeholder=\"e.g., Technical Support\"\n className=\"w-full px-4 py-2.5 rounded-lg border border-input bg-background text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary\"\n required\n />\n </div>\n\n {/* Slug */}\n <div>\n <label\n htmlFor=\"ticket-category-slug\"\n className=\"block text-sm font-medium text-foreground mb-2\"\n >\n Slug <span className=\"text-destructive\">*</span>\n </label>\n <input\n id=\"ticket-category-slug\"\n type=\"text\"\n aria-label=\"Slug\"\n value={formData.slug}\n onChange={(e) => setFormData({ ...formData, slug: e.target.value })}\n placeholder=\"technical-support\"\n className=\"w-full px-4 py-2.5 rounded-lg border border-input bg-background text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary\"\n required\n />\n <p className=\"text-xs text-muted-foreground mt-1\">\n URL-friendly identifier (auto-generated from name)\n </p>\n </div>\n\n {/* Description */}\n <div>\n <label\n className=\"block text-sm font-medium text-foreground mb-2\"\n htmlFor=\"ticketcategoriessettings-description-0\"\n >\n Description\n </label>\n <textarea\n id=\"ticketcategoriessettings-description-0\"\n aria-label=\"Description\"\n value={formData.description}\n onChange={(e) => setFormData({ ...formData, description: e.target.value })}\n placeholder=\"Brief description of this category...\"\n rows={3}\n className=\"w-full px-4 py-2.5 rounded-lg border border-input bg-background text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary resize-none\"\n />\n </div>\n\n {/* Color */}\n <div>\n <span\n id=\"ticket-category-color-heading\"\n className=\"block text-sm font-medium text-foreground mb-2\"\n >\n Color\n </span>\n <div className=\"flex flex-col gap-3 sm:flex-row sm:items-center\">\n <div className=\"flex flex-wrap gap-2\">\n {CATEGORY_COLOR_OPTIONS.map((option) => (\n <button\n key={option.value}\n type=\"button\"\n onClick={() => setFormData({ ...formData, color: option.value })}\n className={`min-h-11 min-w-11 rounded-full border-2 transition-all ${option.swatchClass} ${\n formData.color === option.value\n ? 'border-foreground scale-110'\n : 'border-transparent hover:scale-105'\n }`}\n aria-label={`Use ${option.label} category color`}\n />\n ))}\n </div>\n <select\n aria-labelledby=\"ticket-category-color-heading\"\n value={formData.color}\n onChange={(e) => setFormData({ ...formData, color: e.target.value })}\n className=\"min-h-11 rounded-lg border border-input bg-background px-3 text-sm text-foreground\"\n >\n {CATEGORY_COLOR_OPTIONS.map((option) => (\n <option key={option.value} value={option.value}>\n {option.label}\n </option>\n ))}\n </select>\n </div>\n </div>\n\n {/* Icon */}\n <div>\n <label\n className=\"block text-sm font-medium text-foreground mb-2\"\n htmlFor=\"ticketcategoriessettings-icon-emoji-2\"\n >\n Icon (emoji)\n </label>\n <input\n id=\"ticketcategoriessettings-icon-emoji-2\"\n type=\"text\"\n aria-label=\"Icon (emoji)\"\n value={formData.icon}\n onChange={(e) => setFormData({ ...formData, icon: e.target.value })}\n placeholder=\"e.g., 🛠️\"\n className=\"w-full px-4 py-2.5 rounded-lg border border-input bg-background text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary\"\n maxLength={4}\n />\n </div>\n\n {/* Active Toggle */}\n <label className=\"flex items-center gap-3 cursor-pointer\">\n <input\n type=\"checkbox\"\n aria-label=\"Active\"\n checked={formData.isActive}\n onChange={(e) => setFormData({ ...formData, isActive: e.target.checked })}\n className=\"size-4 rounded border-input text-primary focus:ring-primary\"\n />\n <span className=\"text-sm text-foreground\">Active</span>\n </label>\n\n {/* Actions */}\n <div className=\"flex flex-col gap-3 pt-4 sm:flex-row\">\n <button\n type=\"submit\"\n disabled={isSubmitting || !formData.name.trim() || !formData.slug.trim()}\n className=\"min-h-11 flex-1 flex items-center justify-center gap-2 px-4 py-2.5 rounded-lg bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50 disabled:cursor-not-allowed transition-colors\"\n >\n {isSubmitting ? (\n <>\n <Loader2 size={18} className=\"animate-spin\" />\n {editingCategory ? 'Updating...' : 'Creating...'}\n </>\n ) : (\n <>{editingCategory ? 'Update Category' : 'Create Category'}</>\n )}\n </button>\n <button\n type=\"button\"\n onClick={closeModal}\n className=\"min-h-11 px-4 py-2.5 rounded-lg border border-input hover:bg-muted transition-colors\"\n >\n Cancel\n </button>\n </div>\n </form>\n </div>\n </dialog>\n )}\n\n {/* Header */}\n <div className=\"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between\">\n <div>\n <h2 className=\"text-xl font-semibold mb-2 text-foreground\">Ticket Categories</h2>\n <p className=\"text-sm text-muted-foreground\">\n Organize tickets and knowledge base articles by category\n </p>\n </div>\n <button\n type=\"button\"\n onClick={openCreateModal}\n className=\"min-h-11 inline-flex items-center justify-center gap-2 px-4 py-2 rounded-lg transition-colors bg-primary text-primary-foreground hover:bg-primary/90\"\n >\n <Plus size={20} />\n New Category\n </button>\n </div>\n\n {/* Categories List */}\n <div className=\"space-y-2\">\n {sortedCategories.map((category) => (\n <div\n key={category.id}\n className={`p-4 rounded-lg border bg-background flex flex-col gap-4 sm:flex-row sm:items-center ${\n category.isActive === false ? 'border-border/50 opacity-60' : 'border-border'\n }`}\n >\n {/* Drag Handle (visual only for now) */}\n <div className=\"text-muted-foreground cursor-grab\">\n <GripVertical size={20} />\n </div>\n\n {/* Color & Icon */}\n <div\n className={`size-10 rounded-lg flex items-center justify-center text-on-accent text-xl flex-shrink-0 ${getCategorySwatchClass(category.color)}`}\n >\n {category.icon || <FolderOpen size={20} />}\n </div>\n\n {/* Info */}\n <div className=\"flex-1 min-w-0\">\n <div className=\"flex items-center gap-2\">\n <h3 className=\"font-semibold text-foreground\">{category.name}</h3>\n {category.isActive === false && (\n <span className=\"text-xs px-2 py-0.5 rounded bg-muted text-muted-foreground\">\n Inactive\n </span>\n )}\n </div>\n <p className=\"text-sm text-muted-foreground\">\n /{category.slug} • {category.articleCount ?? 0} articles\n </p>\n {category.description && (\n <p className=\"text-xs text-muted-foreground mt-1 line-clamp-1\">\n {category.description}\n </p>\n )}\n </div>\n\n {/* Actions */}\n <div className=\"flex w-full items-center justify-end gap-1 sm:w-auto\">\n <button\n type=\"button\"\n onClick={() => handleToggleActive(category)}\n className=\"min-h-11 min-w-11 p-2 rounded hover:bg-muted text-muted-foreground transition-colors\"\n title={category.isActive ? 'Deactivate' : 'Activate'}\n aria-label={category.isActive ? 'Deactivate category' : 'Activate category'}\n >\n {category.isActive ? (\n <ToggleRight size={20} className=\"text-status-success-text\" />\n ) : (\n <ToggleLeft size={20} />\n )}\n </button>\n <button\n type=\"button\"\n onClick={() => openEditModal(category)}\n className=\"min-h-11 min-w-11 p-2 rounded hover:bg-muted text-muted-foreground transition-colors\"\n title=\"Edit category\"\n aria-label=\"Edit category\"\n >\n <Edit2 size={18} />\n </button>\n <button\n type=\"button\"\n onClick={() => category.id && handleDelete(category.id, category.articleCount ?? 0)}\n disabled={isDeleting === category.id}\n className=\"min-h-11 min-w-11 p-2 rounded hover:bg-muted text-status-error-text transition-colors disabled:opacity-50\"\n title=\"Delete category\"\n aria-label=\"Delete category\"\n >\n {isDeleting === category.id ? (\n <Loader2 size={18} className=\"animate-spin\" />\n ) : (\n <Trash2 size={18} />\n )}\n </button>\n </div>\n </div>\n ))}\n\n {categories.length === 0 && (\n <div className=\"text-center py-12 border border-dashed border-border rounded-lg\">\n <FolderOpen size={48} className=\"text-muted-foreground mx-auto\" />\n <p className=\"mt-4 text-muted-foreground\">No categories configured</p>\n <button\n type=\"button\"\n onClick={openCreateModal}\n className=\"mt-4 text-primary hover:underline\"\n >\n Create your first category\n </button>\n </div>\n )}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;AA6CA,IAAM,KAAgB,MACb,EACJ,aAAa,CACb,QAAQ,eAAe,IAAI,CAC3B,QAAQ,YAAY,GAAG,EAGtB,IAA+D;CACnE,MAAM;CACN,MAAM;CACN,aAAa;CACb,OAAO,EAAuB,GAAG;CACjC,MAAM;CACN,UAAU;CACX;AAED,SAAgB,EAAyB,EACvC,eACA,aACA,aACA,eACgC;CAChC,IAAM,CAAC,GAAa,KAAkB,EAAS,GAAM,EAC/C,CAAC,GAAiB,KAAsB,EAAgC,KAAK,EAC7E,CAAC,GAAU,KACf,EAAsD,EAAgB,EAClE,CAAC,GAAc,KAAmB,EAAS,GAAM,EACjD,CAAC,GAAY,KAAiB,EAAwB,KAAK,EAC3D,CAAC,GAAc,KAAmB,EAG9B,KAAK,EACT,IAAuB,EAA6C,KAAK;AAE/E,eACe;AACX,EAAI,EAAqB,WAAS,aAAa,EAAqB,QAAQ;IAE7E,EAAE,CAAC;CAEN,IAAM,KAAoB,GAA2B,MAAoB;AAGvE,EAFA,EAAgB;GAAE;GAAM;GAAS,CAAC,EAC9B,EAAqB,WAAS,aAAa,EAAqB,QAAQ,EAC5E,EAAqB,UAAU,iBAAi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AAM,CAAA;SAEnB,CAAA;QACT,kBAAC,UAAD;SACE,MAAK;SACL,eAAe,EAAc,EAAS;SACtC,WAAU;SACV,OAAM;SACN,cAAW;mBAEX,kBAAC,GAAD,EAAO,MAAM,IAAM,CAAA;SACZ,CAAA;QACT,kBAAC,UAAD;SACE,MAAK;SACL,eAAe,EAAS,MAAM,EAAa,EAAS,IAAI,EAAS,gBAAgB,EAAE;SACnF,UAAU,MAAe,EAAS;SAClC,WAAU;SACV,OAAM;SACN,cAAW;mBAEV,MAAe,EAAS,KACvB,kBAAC,GAAD;UAAS,MAAM;UAAI,WAAU;UAAiB,CAAA,GAE9C,kBAAC,GAAD,EAAQ,MAAM,IAAM,CAAA;SAEf,CAAA;QACL;;MACF;OA5EC,EAAS,GA4EV,CACN,EAED,EAAW,WAAW,KACrB,kBAAC,OAAD;KAAK,WAAU;eAAf;MACE,kBAAC,GAAD;OAAY,MAAM;OAAI,WAAU;OAAkC,CAAA;MAClE,kBAAC,KAAD;OAAG,WAAU;iBAA6B;OAA4B,CAAA;MACtE,kBAAC,UAAD;OACE,MAAK;OACL,SAAS;OACT,WAAU;iBACX;OAEQ,CAAA;MACL;OAEJ;;GACF"}
|
|
@@ -12,7 +12,7 @@ var o = ({ fileIds: o, ticketId: s }) => {
|
|
|
12
12
|
children: [/* @__PURE__ */ i(n, {
|
|
13
13
|
size: 16,
|
|
14
14
|
className: "animate-spin"
|
|
15
|
-
}), "Loading attachments
|
|
15
|
+
}), "Loading attachments…"]
|
|
16
16
|
}) : /* @__PURE__ */ i("div", {
|
|
17
17
|
className: "space-y-3",
|
|
18
18
|
children: c.map((e) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AttachmentList.js","names":[],"sources":["../../../../src/support/components/tickets/AttachmentList.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport { ImageIcon, Loader2, Paperclip } from 'lucide-react';\n\nimport { useSupportAttachments } from '../../hooks/useSupportAttachments';\n\ninterface AttachmentListProps {\n fileIds: string[];\n ticketId: string;\n}\n\nexport const AttachmentList: FC<AttachmentListProps> = ({ fileIds, ticketId }) => {\n const { attachments, isLoading } = useSupportAttachments({ fileIds, ticketId });\n\n if (fileIds.length === 0) {\n return null;\n }\n\n if (isLoading) {\n return (\n <div className=\"flex items-center gap-2 text-sm text-muted-foreground\">\n <Loader2 size={16} className=\"animate-spin\" />\n Loading attachments
|
|
1
|
+
{"version":3,"file":"AttachmentList.js","names":[],"sources":["../../../../src/support/components/tickets/AttachmentList.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport { ImageIcon, Loader2, Paperclip } from 'lucide-react';\n\nimport { useSupportAttachments } from '../../hooks/useSupportAttachments';\n\ninterface AttachmentListProps {\n fileIds: string[];\n ticketId: string;\n}\n\nexport const AttachmentList: FC<AttachmentListProps> = ({ fileIds, ticketId }) => {\n const { attachments, isLoading } = useSupportAttachments({ fileIds, ticketId });\n\n if (fileIds.length === 0) {\n return null;\n }\n\n if (isLoading) {\n return (\n <div className=\"flex items-center gap-2 text-sm text-muted-foreground\">\n <Loader2 size={16} className=\"animate-spin\" />\n Loading attachments…\n </div>\n );\n }\n\n return (\n <div className=\"space-y-3\">\n {attachments.map((attachment) => {\n const isImage = attachment.mimeType.startsWith('image/');\n\n return (\n <div key={attachment.id} className=\"rounded-lg border border-border bg-muted/30 p-3\">\n <div className=\"flex items-center gap-2 text-sm\">\n {isImage ? <ImageIcon size={16} /> : <Paperclip size={16} />}\n <a\n href={attachment.downloadUrl}\n target=\"_blank\"\n rel=\"noreferrer\"\n className=\"font-medium text-primary hover:underline\"\n >\n {attachment.name}\n </a>\n <span className=\"text-muted-foreground\">({attachment.mimeType})</span>\n </div>\n\n {isImage && attachment.downloadUrl !== '#' && (\n <img\n src={attachment.downloadUrl}\n alt={attachment.name}\n className=\"mt-3 max-h-64 rounded-lg border border-border object-contain\"\n />\n )}\n </div>\n );\n })}\n </div>\n );\n};\n"],"mappings":";;;;AAUA,IAAa,KAA2C,EAAE,YAAS,kBAAe;CAChF,IAAM,EAAE,gBAAa,iBAAc,EAAsB;EAAE;EAAS;EAAU,CAAC;AAe/E,QAbI,EAAQ,WAAW,IACd,OAGL,IAEA,kBAAC,OAAD;EAAK,WAAU;YAAf,CACE,kBAAC,GAAD;GAAS,MAAM;GAAI,WAAU;GAAiB,CAAA,EAAA,uBAE1C;MAKR,kBAAC,OAAD;EAAK,WAAU;YACZ,EAAY,KAAK,MAAe;GAC/B,IAAM,IAAU,EAAW,SAAS,WAAW,SAAS;AAExD,UACE,kBAAC,OAAD;IAAyB,WAAU;cAAnC,CACE,kBAAC,OAAD;KAAK,WAAU;eAAf;MACa,EAAV,IAAW,IAA0B,GAA3B,EAAW,MAAM,IAAM,CAA0B;MAC5D,kBAAC,KAAD;OACE,MAAM,EAAW;OACjB,QAAO;OACP,KAAI;OACJ,WAAU;iBAET,EAAW;OACV,CAAA;MACJ,kBAAC,QAAD;OAAM,WAAU;iBAAhB;QAAwC;QAAE,EAAW;QAAS;QAAQ;;MAClE;QAEL,KAAW,EAAW,gBAAgB,OACrC,kBAAC,OAAD;KACE,KAAK,EAAW;KAChB,KAAK,EAAW;KAChB,WAAU;KACV,CAAA,CAEA;MArBI,EAAW,GAqBf;IAER;EACE,CAAA"}
|