@escalated-dev/escalated 0.5.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/README.md +102 -0
  2. package/package.json +37 -6
  3. package/src/components/ActivityTimeline.stories.js +55 -0
  4. package/src/components/ActivityTimeline.vue +83 -66
  5. package/src/components/AdminDashboard.stories.js +1095 -0
  6. package/src/components/AgentLoadIndicator.stories.js +37 -0
  7. package/src/components/AgentLoadIndicator.vue +49 -0
  8. package/src/components/AgentPerformanceCard.vue +44 -0
  9. package/src/components/ArticleEditor.vue +82 -0
  10. package/src/components/AssigneeSelect.vue +37 -23
  11. package/src/components/AttachmentList.vue +53 -37
  12. package/src/components/AuditLogEntry.vue +95 -0
  13. package/src/components/BulkActionBar.vue +99 -30
  14. package/src/components/CategoryTree.vue +89 -0
  15. package/src/components/ChartWidget.vue +46 -0
  16. package/src/components/CollisionWarning.stories.js +30 -0
  17. package/src/components/CollisionWarning.vue +68 -0
  18. package/src/components/ConditionalFieldRules.vue +135 -0
  19. package/src/components/ContextPanel.vue +66 -0
  20. package/src/components/ContextPanelSection.vue +65 -0
  21. package/src/components/CustomFieldRenderer.vue +159 -0
  22. package/src/components/EscalatedLayout.vue +400 -69
  23. package/src/components/FileDropzone.vue +57 -41
  24. package/src/components/FollowButton.stories.js +30 -0
  25. package/src/components/FollowButton.vue +53 -28
  26. package/src/components/KeyboardShortcutHelp.vue +129 -39
  27. package/src/components/KnowledgePanel.vue +122 -0
  28. package/src/components/KpiCard.stories.js +32 -0
  29. package/src/components/KpiCard.vue +88 -0
  30. package/src/components/MacroDropdown.vue +95 -35
  31. package/src/components/PermissionMatrix.vue +107 -0
  32. package/src/components/PinnedNotes.vue +75 -33
  33. package/src/components/PresenceIndicator.vue +93 -27
  34. package/src/components/PriorityBadge.stories.js +33 -0
  35. package/src/components/PriorityBadge.vue +46 -39
  36. package/src/components/QuickFilters.vue +65 -49
  37. package/src/components/ReplyComposer.vue +273 -159
  38. package/src/components/ReplyThread.vue +78 -23
  39. package/src/components/SatisfactionRating.vue +98 -46
  40. package/src/components/ScheduleEditor.vue +104 -0
  41. package/src/components/SideConversation.vue +165 -0
  42. package/src/components/SideConversationList.vue +147 -0
  43. package/src/components/SkillTagManager.vue +79 -0
  44. package/src/components/SlaComplianceChart.vue +53 -0
  45. package/src/components/SlaTimer.stories.js +35 -0
  46. package/src/components/SlaTimer.vue +62 -49
  47. package/src/components/StatsCard.stories.js +24 -0
  48. package/src/components/StatsCard.vue +58 -46
  49. package/src/components/StatusBadge.stories.js +53 -0
  50. package/src/components/StatusBadge.vue +78 -46
  51. package/src/components/TagSelect.vue +84 -53
  52. package/src/components/TicketFilters.vue +225 -69
  53. package/src/components/TicketLinkPanel.vue +193 -0
  54. package/src/components/TicketList.vue +594 -193
  55. package/src/components/TicketMergeDialog.vue +157 -0
  56. package/src/components/TicketSidebar.vue +167 -99
  57. package/src/components/TicketTypeSelector.vue +21 -0
  58. package/src/components/TotpInput.stories.js +9 -0
  59. package/src/components/TotpInput.vue +81 -0
  60. package/src/components/TwoFactorSetup.vue +113 -0
  61. package/src/composables/useDebouncedSearch.js +38 -0
  62. package/src/composables/useI18n.js +80 -0
  63. package/src/composables/usePluginExtensions.js +95 -3
  64. package/src/composables/usePluginHooks.js +65 -0
  65. package/src/defineEscalatedPlugin.js +34 -8
  66. package/src/index.js +72 -35
  67. package/src/locales/de.json +442 -0
  68. package/src/locales/en.json +467 -0
  69. package/src/locales/es.json +442 -0
  70. package/src/locales/fr.json +442 -0
  71. package/src/locales/index.js +6 -0
  72. package/src/pages/Admin/ApiTokens/Index.vue +231 -67
  73. package/src/pages/Admin/AuditLog/Index.vue +154 -0
  74. package/src/pages/Admin/Automations/Form.vue +184 -0
  75. package/src/pages/Admin/Automations/Index.vue +129 -0
  76. package/src/pages/Admin/BusinessHours/Form.vue +172 -0
  77. package/src/pages/Admin/BusinessHours/Index.vue +113 -0
  78. package/src/pages/Admin/CannedResponses/Index.vue +127 -70
  79. package/src/pages/Admin/Capacity/Index.vue +134 -0
  80. package/src/pages/Admin/CustomFields/Form.vue +195 -0
  81. package/src/pages/Admin/CustomFields/Index.vue +134 -0
  82. package/src/pages/Admin/CustomObjects/Form.vue +202 -0
  83. package/src/pages/Admin/CustomObjects/Index.vue +127 -0
  84. package/src/pages/Admin/CustomObjects/Records.vue +228 -0
  85. package/src/pages/Admin/Departments/Form.vue +75 -51
  86. package/src/pages/Admin/Departments/Index.vue +109 -57
  87. package/src/pages/Admin/EscalationRules/Form.vue +157 -96
  88. package/src/pages/Admin/EscalationRules/Index.vue +178 -57
  89. package/src/pages/Admin/Import/Connect.vue +96 -0
  90. package/src/pages/Admin/Import/Index.vue +102 -0
  91. package/src/pages/Admin/Import/Mapping.vue +110 -0
  92. package/src/pages/Admin/Import/Progress.vue +153 -0
  93. package/src/pages/Admin/Import/Review.vue +76 -0
  94. package/src/pages/Admin/KnowledgeBase/Articles/Form.vue +142 -0
  95. package/src/pages/Admin/KnowledgeBase/Articles/Index.vue +195 -0
  96. package/src/pages/Admin/KnowledgeBase/Categories/Index.vue +193 -0
  97. package/src/pages/Admin/Macros/Index.vue +250 -89
  98. package/src/pages/Admin/Plugins/Index.vue +205 -75
  99. package/src/pages/Admin/Reports/AgentMetrics.vue +115 -0
  100. package/src/pages/Admin/Reports/CsatReport.vue +127 -0
  101. package/src/pages/Admin/Reports/Dashboard.vue +211 -0
  102. package/src/pages/Admin/Reports/SlaReport.vue +166 -0
  103. package/src/pages/Admin/Reports.vue +139 -34
  104. package/src/pages/Admin/Roles/Form.vue +71 -0
  105. package/src/pages/Admin/Roles/Index.vue +122 -0
  106. package/src/pages/Admin/Settings/CsatSettings.vue +165 -0
  107. package/src/pages/Admin/Settings/DataRetention.vue +182 -0
  108. package/src/pages/Admin/Settings/EmailSettings.vue +243 -0
  109. package/src/pages/Admin/Settings/Sandbox.vue +135 -0
  110. package/src/pages/Admin/Settings/SsoSettings.vue +218 -0
  111. package/src/pages/Admin/Settings/TwoFactor.vue +110 -0
  112. package/src/pages/Admin/Settings.vue +468 -260
  113. package/src/pages/Admin/Skills/Form.vue +53 -0
  114. package/src/pages/Admin/Skills/Index.vue +94 -0
  115. package/src/pages/Admin/SlaPolicies/Form.vue +118 -75
  116. package/src/pages/Admin/SlaPolicies/Index.vue +120 -59
  117. package/src/pages/Admin/Statuses/Form.vue +114 -0
  118. package/src/pages/Admin/Statuses/Index.vue +153 -0
  119. package/src/pages/Admin/Tags/Index.vue +191 -105
  120. package/src/pages/Admin/Tickets/Index.vue +91 -39
  121. package/src/pages/Admin/Tickets/Show.vue +101 -37
  122. package/src/pages/Admin/Webhooks/DeliveryLog.vue +120 -0
  123. package/src/pages/Admin/Webhooks/Form.vue +110 -0
  124. package/src/pages/Admin/Webhooks/Index.vue +136 -0
  125. package/src/pages/Agent/Dashboard.vue +311 -186
  126. package/src/pages/Agent/TicketIndex.vue +88 -38
  127. package/src/pages/Agent/TicketShow.vue +258 -51
  128. package/src/pages/Customer/Create.vue +36 -9
  129. package/src/pages/Customer/Index.vue +31 -24
  130. package/src/pages/Customer/KnowledgeBase/Article.vue +127 -0
  131. package/src/pages/Customer/KnowledgeBase/Index.vue +151 -0
  132. package/src/plugin.js +86 -1
  133. package/src/utils/constants.js +30 -0
  134. package/src/utils/formatting.js +35 -0
  135. package/src/utils/sanitizeHtml.js +64 -0
  136. package/src/pages/Admin/Plugins.vue +0 -129
@@ -1,159 +1,273 @@
1
- <script setup>
2
- import { ref, computed, inject } from 'vue';
3
- import { router } from '@inertiajs/vue3';
4
- import FileDropzone from './FileDropzone.vue';
5
-
6
- const props = defineProps({
7
- action: { type: String, required: true },
8
- cannedResponses: { type: Array, default: () => [] },
9
- allowNotes: { type: Boolean, default: false },
10
- placeholder: { type: String, default: 'Type your reply...' },
11
- submitLabel: { type: String, default: null },
12
- });
13
-
14
- const emit = defineEmits(['submit']);
15
- const escDark = inject('esc-dark', computed(() => false));
16
-
17
- const body = ref('');
18
- const isNote = ref(false);
19
- const files = ref([]);
20
- const submitting = ref(false);
21
-
22
- function insertCanned(response) {
23
- body.value += response.body;
24
- }
25
-
26
- function handleFiles(newFiles) {
27
- files.value = [...files.value, ...newFiles];
28
- }
29
-
30
- function removeFile(index) {
31
- files.value.splice(index, 1);
32
- }
33
-
34
- function submit() {
35
- if (!body.value.trim() || submitting.value) return;
36
- submitting.value = true;
37
-
38
- const payload = {
39
- body: body.value,
40
- is_internal_note: isNote.value,
41
- attachments: files.value,
42
- };
43
-
44
- emit('submit', payload);
45
-
46
- router.post(props.action, payload, {
47
- preserveScroll: true,
48
- onSuccess: () => {
49
- body.value = '';
50
- files.value = [];
51
- isNote.value = false;
52
- },
53
- onFinish: () => {
54
- submitting.value = false;
55
- },
56
- });
57
- }
58
-
59
- const buttonLabel = computed(() => {
60
- if (props.submitLabel) return props.submitLabel;
61
- return isNote.value ? 'Add Note' : 'Send Reply';
62
- });
63
- </script>
64
-
65
- <template>
66
- <!-- Dark mode -->
67
- <div v-if="escDark" class="rounded-xl border border-white/[0.06] bg-neutral-900/60 p-4">
68
- <div v-if="allowNotes" class="mb-3 flex gap-2">
69
- <button @click="isNote = false"
70
- :class="['rounded-lg px-3 py-1.5 text-sm font-medium transition-colors', !isNote ? 'bg-cyan-500/15 text-white ring-1 ring-cyan-500/20' : 'text-gray-400 hover:bg-white/[0.04]']">
71
- Reply
72
- </button>
73
- <button @click="isNote = true"
74
- :class="['rounded-lg px-3 py-1.5 text-sm font-medium transition-colors', isNote ? 'bg-amber-500/15 text-amber-400 ring-1 ring-amber-500/20' : 'text-gray-400 hover:bg-white/[0.04]']">
75
- Internal Note
76
- </button>
77
- </div>
78
-
79
- <div v-if="isNote" class="mb-2 rounded-lg bg-amber-500/10 px-3 py-1.5 text-xs text-amber-400 ring-1 ring-amber-500/20">
80
- This note is only visible to agents.
81
- </div>
82
-
83
- <textarea v-model="body" rows="4" :placeholder="placeholder"
84
- class="w-full rounded-lg border border-white/10 bg-neutral-950 px-3 py-2 text-sm text-gray-200 placeholder-gray-500 focus:border-white/20 focus:outline-none focus:ring-1 focus:ring-white/10"></textarea>
85
-
86
- <FileDropzone @files="handleFiles" class="mt-2" />
87
-
88
- <div v-if="files.length" class="mt-2 space-y-1">
89
- <div v-for="(file, i) in files" :key="i" class="flex items-center gap-2 text-sm text-gray-400">
90
- <span>{{ file.name }}</span>
91
- <button @click="removeFile(i)" class="text-rose-400 hover:text-rose-300">&times;</button>
92
- </div>
93
- </div>
94
-
95
- <div class="mt-3 flex items-center justify-between">
96
- <div v-if="cannedResponses.length">
97
- <select @change="insertCanned(cannedResponses[$event.target.value]); $event.target.value = ''"
98
- class="rounded-lg border border-white/10 bg-gray-900 px-2 py-1 text-xs text-gray-400">
99
- <option value="">Canned responses...</option>
100
- <option v-for="(cr, i) in cannedResponses" :key="cr.id" :value="i">{{ cr.title }}</option>
101
- </select>
102
- </div>
103
- <div v-else></div>
104
- <button @click="submit" :disabled="!body.trim() || submitting"
105
- :class="['rounded-lg px-4 py-2 text-sm font-medium text-white transition-all',
106
- isNote ? 'bg-amber-500 hover:bg-amber-400' : 'bg-gradient-to-r from-cyan-500 to-violet-500 hover:from-cyan-400 hover:to-violet-400',
107
- (!body.trim() || submitting) && 'cursor-not-allowed opacity-40']">
108
- {{ buttonLabel }}
109
- </button>
110
- </div>
111
- </div>
112
-
113
- <!-- Light mode -->
114
- <div v-else class="rounded-lg border border-gray-200 bg-white p-4">
115
- <div v-if="allowNotes" class="mb-3 flex gap-2">
116
- <button @click="isNote = false"
117
- :class="['rounded-md px-3 py-1 text-sm font-medium', !isNote ? 'bg-blue-100 text-blue-700' : 'text-gray-500 hover:bg-gray-100']">
118
- Reply
119
- </button>
120
- <button @click="isNote = true"
121
- :class="['rounded-md px-3 py-1 text-sm font-medium', isNote ? 'bg-yellow-100 text-yellow-700' : 'text-gray-500 hover:bg-gray-100']">
122
- Internal Note
123
- </button>
124
- </div>
125
-
126
- <div v-if="isNote" class="mb-2 rounded bg-yellow-50 px-3 py-1.5 text-xs text-yellow-700">
127
- This note is only visible to agents.
128
- </div>
129
-
130
- <textarea v-model="body" rows="4" :placeholder="placeholder"
131
- class="w-full rounded-md border border-gray-300 px-3 py-2 text-sm focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500"></textarea>
132
-
133
- <FileDropzone @files="handleFiles" class="mt-2" />
134
-
135
- <div v-if="files.length" class="mt-2 space-y-1">
136
- <div v-for="(file, i) in files" :key="i" class="flex items-center gap-2 text-sm text-gray-600">
137
- <span>{{ file.name }}</span>
138
- <button @click="removeFile(i)" class="text-red-500 hover:text-red-700">&times;</button>
139
- </div>
140
- </div>
141
-
142
- <div class="mt-3 flex items-center justify-between">
143
- <div v-if="cannedResponses.length">
144
- <select @change="insertCanned(cannedResponses[$event.target.value]); $event.target.value = ''"
145
- class="rounded border border-gray-300 px-2 py-1 text-xs text-gray-600">
146
- <option value="">Canned responses...</option>
147
- <option v-for="(cr, i) in cannedResponses" :key="cr.id" :value="i">{{ cr.title }}</option>
148
- </select>
149
- </div>
150
- <div v-else></div>
151
- <button @click="submit" :disabled="!body.trim() || submitting"
152
- :class="['rounded-md px-4 py-2 text-sm font-medium text-white',
153
- isNote ? 'bg-yellow-500 hover:bg-yellow-600' : 'bg-blue-600 hover:bg-blue-700',
154
- (!body.trim() || submitting) && 'cursor-not-allowed opacity-50']">
155
- {{ buttonLabel }}
156
- </button>
157
- </div>
158
- </div>
159
- </template>
1
+ <script setup>
2
+ import { ref, computed, inject } from 'vue';
3
+ import { router } from '@inertiajs/vue3';
4
+ import FileDropzone from './FileDropzone.vue';
5
+
6
+ const props = defineProps({
7
+ action: { type: String, required: true },
8
+ cannedResponses: { type: Array, default: () => [] },
9
+ allowNotes: { type: Boolean, default: false },
10
+ placeholder: { type: String, default: 'Type your reply...' },
11
+ submitLabel: { type: String, default: null },
12
+ typingEndpoint: { type: String, default: '' },
13
+ });
14
+
15
+ const emit = defineEmits(['submit']);
16
+ const escDark = inject(
17
+ 'esc-dark',
18
+ computed(() => false),
19
+ );
20
+
21
+ const body = ref('');
22
+ const isNote = ref(false);
23
+ const files = ref([]);
24
+ const submitting = ref(false);
25
+
26
+ // Typing indicator: debounced POST every 5 seconds while typing
27
+ let lastTypingSent = 0;
28
+ let typingTimer = null;
29
+
30
+ function onTyping() {
31
+ if (!props.typingEndpoint) return;
32
+ const now = Date.now();
33
+ if (now - lastTypingSent < 5000) return;
34
+ lastTypingSent = now;
35
+ sendTypingIndicator();
36
+
37
+ // Clear typing after 6 seconds of inactivity
38
+ window.clearTimeout(typingTimer);
39
+ typingTimer = window.setTimeout(() => {
40
+ lastTypingSent = 0;
41
+ }, 6000);
42
+ }
43
+
44
+ async function sendTypingIndicator() {
45
+ try {
46
+ await fetch(props.typingEndpoint, {
47
+ method: 'POST',
48
+ headers: {
49
+ Accept: 'application/json',
50
+ 'Content-Type': 'application/json',
51
+ 'X-Requested-With': 'XMLHttpRequest',
52
+ 'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]')?.content || '',
53
+ },
54
+ });
55
+ } catch {
56
+ // silently ignore
57
+ }
58
+ }
59
+
60
+ function onBlur() {
61
+ window.clearTimeout(typingTimer);
62
+ lastTypingSent = 0;
63
+ }
64
+
65
+ function insertCanned(response) {
66
+ body.value += response.body;
67
+ }
68
+
69
+ function handleFiles(newFiles) {
70
+ files.value = [...files.value, ...newFiles];
71
+ }
72
+
73
+ function removeFile(index) {
74
+ files.value.splice(index, 1);
75
+ }
76
+
77
+ function submit() {
78
+ if (!body.value.trim() || submitting.value) return;
79
+ submitting.value = true;
80
+ window.clearTimeout(typingTimer);
81
+ lastTypingSent = 0;
82
+
83
+ const payload = {
84
+ body: body.value,
85
+ is_internal_note: isNote.value,
86
+ attachments: files.value,
87
+ };
88
+
89
+ emit('submit', payload);
90
+
91
+ router.post(props.action, payload, {
92
+ preserveScroll: true,
93
+ onSuccess: () => {
94
+ body.value = '';
95
+ files.value = [];
96
+ isNote.value = false;
97
+ },
98
+ onFinish: () => {
99
+ submitting.value = false;
100
+ },
101
+ });
102
+ }
103
+
104
+ const buttonLabel = computed(() => {
105
+ if (props.submitLabel) return props.submitLabel;
106
+ return isNote.value ? 'Add Note' : 'Send Reply';
107
+ });
108
+ </script>
109
+
110
+ <template>
111
+ <!-- Dark mode -->
112
+ <div v-if="escDark" class="rounded-xl border border-white/[0.06] bg-neutral-900/60 p-4">
113
+ <div v-if="allowNotes" class="mb-3 flex gap-2">
114
+ <button
115
+ :class="[
116
+ 'rounded-lg px-3 py-1.5 text-sm font-medium transition-colors',
117
+ !isNote
118
+ ? 'bg-cyan-500/15 text-white ring-1 ring-cyan-500/20'
119
+ : 'text-gray-400 hover:bg-white/[0.04]',
120
+ ]"
121
+ @click="isNote = false"
122
+ >
123
+ Reply
124
+ </button>
125
+ <button
126
+ :class="[
127
+ 'rounded-lg px-3 py-1.5 text-sm font-medium transition-colors',
128
+ isNote
129
+ ? 'bg-amber-500/15 text-amber-400 ring-1 ring-amber-500/20'
130
+ : 'text-gray-400 hover:bg-white/[0.04]',
131
+ ]"
132
+ aria-label="Internal note"
133
+ @click="isNote = true"
134
+ >
135
+ Internal Note
136
+ </button>
137
+ </div>
138
+
139
+ <div
140
+ v-if="isNote"
141
+ class="mb-2 rounded-lg bg-amber-500/10 px-3 py-1.5 text-xs text-amber-400 ring-1 ring-amber-500/20"
142
+ >
143
+ This note is only visible to agents.
144
+ </div>
145
+
146
+ <textarea
147
+ v-model="body"
148
+ rows="4"
149
+ :placeholder="placeholder"
150
+ aria-label="Reply message"
151
+ class="w-full rounded-lg border border-white/10 bg-neutral-950 px-3 py-2 text-sm text-gray-200 placeholder-gray-500 focus:border-white/20 focus:outline-none focus:ring-1 focus:ring-white/10"
152
+ @keydown="onTyping"
153
+ @blur="onBlur"
154
+ ></textarea>
155
+
156
+ <FileDropzone class="mt-2" @files="handleFiles" />
157
+
158
+ <div v-if="files.length" class="mt-2 space-y-1">
159
+ <div v-for="(file, i) in files" :key="i" class="flex items-center gap-2 text-sm text-gray-400">
160
+ <span>{{ file.name }}</span>
161
+ <button aria-label="Remove attachment" class="text-rose-400 hover:text-rose-300" @click="removeFile(i)">
162
+ &times;
163
+ </button>
164
+ </div>
165
+ </div>
166
+
167
+ <div class="mt-3 flex items-center justify-between">
168
+ <div v-if="cannedResponses.length">
169
+ <select
170
+ class="rounded-lg border border-white/10 bg-gray-900 px-2 py-1 text-xs text-gray-400"
171
+ @change="
172
+ insertCanned(cannedResponses[$event.target.value]);
173
+ $event.target.value = '';
174
+ "
175
+ >
176
+ <option value="">Canned responses...</option>
177
+ <option v-for="(cr, i) in cannedResponses" :key="cr.id" :value="i">{{ cr.title }}</option>
178
+ </select>
179
+ </div>
180
+ <div v-else></div>
181
+ <button
182
+ :disabled="!body.trim() || submitting"
183
+ :class="[
184
+ 'rounded-lg px-4 py-2 text-sm font-medium text-white transition-all',
185
+ isNote
186
+ ? 'bg-amber-500 hover:bg-amber-400'
187
+ : 'bg-gradient-to-r from-cyan-500 to-violet-500 hover:from-cyan-400 hover:to-violet-400',
188
+ (!body.trim() || submitting) && 'cursor-not-allowed opacity-40',
189
+ ]"
190
+ @click="submit"
191
+ >
192
+ {{ buttonLabel }}
193
+ </button>
194
+ </div>
195
+ </div>
196
+
197
+ <!-- Light mode -->
198
+ <div v-else class="rounded-lg border border-gray-200 bg-white p-4">
199
+ <div v-if="allowNotes" class="mb-3 flex gap-2">
200
+ <button
201
+ :class="[
202
+ 'rounded-md px-3 py-1 text-sm font-medium',
203
+ !isNote ? 'bg-blue-100 text-blue-700' : 'text-gray-500 hover:bg-gray-100',
204
+ ]"
205
+ @click="isNote = false"
206
+ >
207
+ Reply
208
+ </button>
209
+ <button
210
+ :class="[
211
+ 'rounded-md px-3 py-1 text-sm font-medium',
212
+ isNote ? 'bg-yellow-100 text-yellow-700' : 'text-gray-500 hover:bg-gray-100',
213
+ ]"
214
+ aria-label="Internal note"
215
+ @click="isNote = true"
216
+ >
217
+ Internal Note
218
+ </button>
219
+ </div>
220
+
221
+ <div v-if="isNote" class="mb-2 rounded bg-yellow-50 px-3 py-1.5 text-xs text-yellow-700">
222
+ This note is only visible to agents.
223
+ </div>
224
+
225
+ <textarea
226
+ v-model="body"
227
+ rows="4"
228
+ :placeholder="placeholder"
229
+ aria-label="Reply message"
230
+ class="w-full rounded-md border border-gray-300 px-3 py-2 text-sm focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500"
231
+ @keydown="onTyping"
232
+ @blur="onBlur"
233
+ ></textarea>
234
+
235
+ <FileDropzone class="mt-2" @files="handleFiles" />
236
+
237
+ <div v-if="files.length" class="mt-2 space-y-1">
238
+ <div v-for="(file, i) in files" :key="i" class="flex items-center gap-2 text-sm text-gray-600">
239
+ <span>{{ file.name }}</span>
240
+ <button aria-label="Remove attachment" class="text-red-500 hover:text-red-700" @click="removeFile(i)">
241
+ &times;
242
+ </button>
243
+ </div>
244
+ </div>
245
+
246
+ <div class="mt-3 flex items-center justify-between">
247
+ <div v-if="cannedResponses.length">
248
+ <select
249
+ class="rounded border border-gray-300 px-2 py-1 text-xs text-gray-600"
250
+ @change="
251
+ insertCanned(cannedResponses[$event.target.value]);
252
+ $event.target.value = '';
253
+ "
254
+ >
255
+ <option value="">Canned responses...</option>
256
+ <option v-for="(cr, i) in cannedResponses" :key="cr.id" :value="i">{{ cr.title }}</option>
257
+ </select>
258
+ </div>
259
+ <div v-else></div>
260
+ <button
261
+ :disabled="!body.trim() || submitting"
262
+ :class="[
263
+ 'rounded-md px-4 py-2 text-sm font-medium text-white',
264
+ isNote ? 'bg-yellow-500 hover:bg-yellow-600' : 'bg-blue-600 hover:bg-blue-700',
265
+ (!body.trim() || submitting) && 'cursor-not-allowed opacity-50',
266
+ ]"
267
+ @click="submit"
268
+ >
269
+ {{ buttonLabel }}
270
+ </button>
271
+ </div>
272
+ </div>
273
+ </template>
@@ -2,6 +2,8 @@
2
2
  import { inject, computed } from 'vue';
3
3
  import { router } from '@inertiajs/vue3';
4
4
  import AttachmentList from './AttachmentList.vue';
5
+ import { sanitizeHtml } from '../utils/sanitizeHtml';
6
+ import { useI18n } from '../composables/useI18n';
5
7
 
6
8
  const props = defineProps({
7
9
  replies: { type: Array, required: true },
@@ -11,7 +13,11 @@ const props = defineProps({
11
13
  pinnable: { type: Boolean, default: false },
12
14
  });
13
15
 
14
- const escDark = inject('esc-dark', computed(() => false));
16
+ const escDark = inject(
17
+ 'esc-dark',
18
+ computed(() => false),
19
+ );
20
+ const { t } = useI18n();
15
21
 
16
22
  function formatDate(date) {
17
23
  return new Date(date).toLocaleString();
@@ -19,42 +25,91 @@ function formatDate(date) {
19
25
 
20
26
  function togglePin(reply) {
21
27
  if (!props.routePrefix || !props.ticketReference) return;
22
- router.post(route(`${props.routePrefix}.tickets.pin`, [props.ticketReference, reply.id]), {}, { preserveScroll: true });
28
+ router.post(
29
+ route(`${props.routePrefix}.tickets.pin`, [props.ticketReference, reply.id]),
30
+ {},
31
+ { preserveScroll: true },
32
+ );
23
33
  }
24
34
  </script>
25
35
 
26
36
  <template>
27
- <div class="space-y-4">
28
- <div v-for="reply in replies" :key="reply.id"
29
- :class="['rounded-xl border p-4', escDark
30
- ? (reply.is_internal_note ? 'border-amber-500/20 bg-amber-500/5' : 'border-white/[0.06] bg-neutral-900/60')
31
- : (reply.is_internal_note ? 'border-yellow-200 bg-yellow-50' : 'border-gray-200 bg-white')]">
37
+ <div class="space-y-4" role="feed" aria-label="Reply thread">
38
+ <div
39
+ v-for="reply in replies"
40
+ :key="reply.id"
41
+ :class="[
42
+ 'rounded-xl border p-4',
43
+ escDark
44
+ ? reply.is_internal_note
45
+ ? 'border-amber-500/20 bg-amber-500/5'
46
+ : 'border-[var(--esc-panel-border)] bg-[var(--esc-panel-surface)]'
47
+ : reply.is_internal_note
48
+ ? 'border-yellow-200 bg-yellow-50'
49
+ : 'border-gray-200 bg-white',
50
+ ]"
51
+ >
32
52
  <div class="mb-2 flex items-center justify-between">
33
53
  <div class="flex items-center gap-2">
34
- <span :class="['font-medium', escDark ? 'text-gray-200' : 'text-gray-900']">{{ reply.author?.name || 'Unknown' }}</span>
35
- <span v-if="reply.is_internal_note"
36
- :class="['rounded px-1.5 py-0.5 text-xs font-medium', escDark ? 'bg-amber-500/15 text-amber-400' : 'bg-yellow-200 text-yellow-800']">
37
- Internal Note
54
+ <span
55
+ :class="['font-medium', escDark ? 'text-[var(--esc-panel-text-secondary)]' : 'text-gray-900']"
56
+ >{{ reply.author?.name || t('ticket.unknown') }}</span
57
+ >
58
+ <span
59
+ v-if="reply.is_internal_note"
60
+ :class="[
61
+ 'rounded px-1.5 py-0.5 text-xs font-medium',
62
+ escDark ? 'bg-amber-500/15 text-amber-400' : 'bg-yellow-200 text-yellow-800',
63
+ ]"
64
+ >
65
+ {{ t('reply.internal_note') }}
38
66
  </span>
39
- <span v-if="reply.is_pinned"
40
- :class="['rounded px-1.5 py-0.5 text-xs font-medium', escDark ? 'bg-cyan-500/15 text-cyan-400' : 'bg-blue-100 text-blue-700']">
41
- Pinned
67
+ <span
68
+ v-if="reply.is_pinned"
69
+ :class="[
70
+ 'rounded px-1.5 py-0.5 text-xs font-medium',
71
+ escDark ? 'bg-cyan-500/15 text-cyan-400' : 'bg-blue-100 text-blue-700',
72
+ ]"
73
+ >
74
+ {{ t('reply.pinned') }}
42
75
  </span>
43
76
  </div>
44
77
  <div class="flex items-center gap-2">
45
- <button v-if="pinnable && reply.is_internal_note" @click="togglePin(reply)"
46
- :class="['rounded px-2 py-0.5 text-xs font-medium transition-colors',
47
- escDark
48
- ? (reply.is_pinned ? 'bg-cyan-500/15 text-cyan-400 hover:bg-cyan-500/25' : 'text-neutral-500 hover:bg-white/[0.06] hover:text-neutral-300')
49
- : (reply.is_pinned ? 'bg-blue-100 text-blue-700 hover:bg-blue-200' : 'text-gray-400 hover:bg-gray-100 hover:text-gray-600')]">
50
- {{ reply.is_pinned ? 'Unpin' : 'Pin' }}
78
+ <button
79
+ v-if="pinnable && reply.is_internal_note"
80
+ :class="[
81
+ 'rounded px-2 py-0.5 text-xs font-medium transition-colors',
82
+ escDark
83
+ ? reply.is_pinned
84
+ ? 'bg-cyan-500/15 text-cyan-400 hover:bg-cyan-500/25'
85
+ : 'text-[var(--esc-panel-text-muted)] hover:bg-[var(--esc-panel-hover)] hover:text-[var(--esc-panel-text-secondary)]'
86
+ : reply.is_pinned
87
+ ? 'bg-blue-100 text-blue-700 hover:bg-blue-200'
88
+ : 'text-gray-400 hover:bg-gray-100 hover:text-gray-600',
89
+ ]"
90
+ @click="togglePin(reply)"
91
+ >
92
+ {{ reply.is_pinned ? t('reply.unpin') : t('reply.pin') }}
51
93
  </button>
52
- <span :class="['text-xs', escDark ? 'text-gray-500' : 'text-gray-500']">{{ formatDate(reply.created_at) }}</span>
94
+ <span :class="['text-xs', escDark ? 'text-[var(--esc-panel-text-muted)]' : 'text-gray-500']">{{
95
+ formatDate(reply.created_at)
96
+ }}</span>
53
97
  </div>
54
98
  </div>
55
- <div :class="['prose prose-sm max-w-none', escDark ? 'prose-invert text-gray-300' : 'text-gray-700']" v-html="reply.body"></div>
99
+ <div
100
+ :class="[
101
+ 'prose prose-sm max-w-none',
102
+ escDark ? 'prose-invert text-[var(--esc-panel-text-secondary)]' : 'text-gray-700',
103
+ ]"
104
+ v-html="sanitizeHtml(reply.body)"
105
+ ></div>
56
106
  <AttachmentList v-if="reply.attachments?.length" :attachments="reply.attachments" class="mt-3" />
57
107
  </div>
58
- <div v-if="!replies?.length" :class="['py-8 text-center text-sm', escDark ? 'text-gray-500' : 'text-gray-500']">No replies yet.</div>
108
+ <div
109
+ v-if="!replies?.length"
110
+ :class="['py-8 text-center text-sm', escDark ? 'text-[var(--esc-panel-text-muted)]' : 'text-gray-500']"
111
+ >
112
+ {{ t('ticket.no_replies') }}
113
+ </div>
59
114
  </div>
60
115
  </template>