@escalated-dev/escalated 0.8.0 → 0.9.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 (116) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +380 -361
  3. package/package.json +85 -84
  4. package/src/components/ActiveChatsPanel.vue +246 -246
  5. package/src/components/AdminDashboard.stories.js +1423 -1423
  6. package/src/components/AttachmentList.vue +65 -65
  7. package/src/components/ChatActionBar.vue +226 -226
  8. package/src/components/ChatBubble.vue +162 -162
  9. package/src/components/ChatComposer.vue +308 -308
  10. package/src/components/ChatQueue.vue +222 -222
  11. package/src/components/ChatThread.vue +197 -197
  12. package/src/components/CustomTicketActions.stories.js +71 -0
  13. package/src/components/CustomTicketActions.vue +101 -0
  14. package/src/components/EscalatedLayout.vue +619 -604
  15. package/src/components/FollowButton.vue +20 -1
  16. package/src/components/MentionDropdown.vue +154 -154
  17. package/src/components/MetricComparison.vue +89 -89
  18. package/src/components/PercentileChart.vue +67 -67
  19. package/src/components/PeriodSelector.vue +98 -98
  20. package/src/components/PresenceIndicator.vue +228 -213
  21. package/src/components/ReplyComposer.vue +336 -336
  22. package/src/components/ReplyThread.vue +153 -153
  23. package/src/components/ReportChart.vue +395 -395
  24. package/src/components/ReportExportButton.vue +108 -108
  25. package/src/components/SaveViewDialog.vue +172 -172
  26. package/src/components/SavedViewSidebar.vue +208 -208
  27. package/src/components/SkillTagManager.vue +3 -0
  28. package/src/components/SnoozeButton.vue +247 -247
  29. package/src/components/TicketFilters.vue +270 -270
  30. package/src/components/TicketList.vue +655 -655
  31. package/src/components/TicketSidebar.vue +4 -0
  32. package/src/components/TicketSplitDialog.vue +98 -98
  33. package/src/components/TicketSubjects.stories.js +63 -0
  34. package/src/components/TicketSubjects.vue +107 -0
  35. package/src/components/TwoFactorSetup.vue +1 -37
  36. package/src/components/VariableTokenInput.vue +111 -111
  37. package/src/components/WorkflowActionConfig.vue +287 -287
  38. package/src/components/WorkflowActionList.vue +350 -350
  39. package/src/components/WorkflowConditionBuilder.vue +265 -265
  40. package/src/components/WorkflowTriggerSelector.vue +125 -125
  41. package/src/components/admin/newsletters/AnalyticsTiles.stories.js +14 -0
  42. package/src/components/admin/newsletters/AnalyticsTiles.vue +55 -0
  43. package/src/components/admin/newsletters/DeliveriesTable.stories.js +28 -0
  44. package/src/components/admin/newsletters/DeliveriesTable.vue +104 -0
  45. package/src/components/admin/newsletters/DynamicFilterBuilder.stories.js +11 -0
  46. package/src/components/admin/newsletters/DynamicFilterBuilder.vue +53 -0
  47. package/src/components/admin/newsletters/ListMemberTable.stories.js +12 -0
  48. package/src/components/admin/newsletters/ListMemberTable.vue +53 -0
  49. package/src/components/admin/newsletters/MarkdownEditor.stories.js +6 -0
  50. package/src/components/admin/newsletters/MarkdownEditor.vue +53 -0
  51. package/src/components/admin/newsletters/MergeFieldDropdown.stories.js +6 -0
  52. package/src/components/admin/newsletters/MergeFieldDropdown.vue +84 -0
  53. package/src/components/admin/newsletters/PreviewIframe.stories.js +7 -0
  54. package/src/components/admin/newsletters/PreviewIframe.vue +40 -0
  55. package/src/components/admin/newsletters/SummaryTiles.stories.js +8 -0
  56. package/src/components/admin/newsletters/SummaryTiles.vue +63 -0
  57. package/src/composables/useChat.js +187 -187
  58. package/src/composables/useI18n.js +102 -102
  59. package/src/composables/useMentions.js +134 -134
  60. package/src/composables/usePermissions.js +31 -0
  61. package/src/composables/useRealtime.js +182 -182
  62. package/src/index.js +85 -84
  63. package/src/locales/README.md +13 -13
  64. package/src/locales/ar.json +727 -727
  65. package/src/locales/de.json +690 -690
  66. package/src/locales/en.json +889 -729
  67. package/src/locales/es.json +691 -691
  68. package/src/locales/fr.json +691 -691
  69. package/src/locales/index.js +16 -16
  70. package/src/locales/it.json +727 -727
  71. package/src/locales/ja.json +727 -727
  72. package/src/locales/ko.json +727 -727
  73. package/src/locales/nl.json +727 -727
  74. package/src/locales/pl.json +727 -727
  75. package/src/locales/pt-BR.json +727 -727
  76. package/src/locales/ru.json +727 -727
  77. package/src/locales/tr.json +727 -727
  78. package/src/locales/zh-CN.json +727 -727
  79. package/src/pages/Admin/Newsletters/Compose.vue +192 -0
  80. package/src/pages/Admin/Newsletters/Edit.vue +24 -0
  81. package/src/pages/Admin/Newsletters/Index.vue +141 -0
  82. package/src/pages/Admin/Newsletters/Lists/Create.vue +64 -0
  83. package/src/pages/Admin/Newsletters/Lists/Index.vue +59 -0
  84. package/src/pages/Admin/Newsletters/Lists/Show.vue +53 -0
  85. package/src/pages/Admin/Newsletters/Settings.vue +85 -0
  86. package/src/pages/Admin/Newsletters/Show.vue +140 -0
  87. package/src/pages/Admin/Newsletters/Templates/Create.vue +11 -0
  88. package/src/pages/Admin/Newsletters/Templates/Index.vue +54 -0
  89. package/src/pages/Admin/Newsletters/Templates/Show.vue +65 -0
  90. package/src/pages/Admin/Newsletters/usePreview.js +44 -0
  91. package/src/pages/Admin/Reports/AgentDetail.vue +132 -132
  92. package/src/pages/Admin/Reports/AgentRanking.vue +246 -246
  93. package/src/pages/Admin/Reports/Cohorts.vue +180 -180
  94. package/src/pages/Admin/Reports/Comparison.vue +141 -141
  95. package/src/pages/Admin/Reports/Dashboard.vue +226 -226
  96. package/src/pages/Admin/Reports/ResolutionTimes.vue +164 -164
  97. package/src/pages/Admin/Reports/ResponseTimes.vue +164 -164
  98. package/src/pages/Admin/Reports/SlaTrends.vue +183 -183
  99. package/src/pages/Admin/Settings/SsoSettings.vue +157 -4
  100. package/src/pages/Admin/Settings/TwoFactor.vue +32 -6
  101. package/src/pages/Admin/Settings.vue +1008 -1008
  102. package/src/pages/Admin/Skills/Form.vue +30 -10
  103. package/src/pages/Admin/Tickets/Index.vue +126 -126
  104. package/src/pages/Admin/Tickets/Show.vue +254 -249
  105. package/src/pages/Admin/Users/Index.vue +145 -145
  106. package/src/pages/Admin/Workflows/Builder.vue +207 -207
  107. package/src/pages/Admin/Workflows/Index.vue +235 -235
  108. package/src/pages/Admin/Workflows/Logs.vue +286 -286
  109. package/src/pages/Agent/TicketIndex.vue +112 -112
  110. package/src/pages/Agent/TicketShow.vue +547 -494
  111. package/src/pages/Customer/Index.vue +56 -56
  112. package/src/pages/Customer/KnowledgeBase/Article.vue +129 -129
  113. package/src/plugin.js +175 -175
  114. package/src/utils/mentionHighlight.js +24 -24
  115. package/src/widget/EscalatedWidget.vue +804 -804
  116. package/src/widget/index.js +254 -254
@@ -1,308 +1,308 @@
1
- <script setup>
2
- import { ref, computed, inject } from 'vue';
3
- import { useI18n } from '../composables/useI18n';
4
- import MentionDropdown from './MentionDropdown.vue';
5
- import { useMentions } from '../composables/useMentions';
6
-
7
- const props = defineProps({
8
- sessionId: { type: [String, Number], default: null },
9
- disabled: { type: Boolean, default: false },
10
- allowNotes: { type: Boolean, default: false },
11
- allowAttachments: { type: Boolean, default: true },
12
- sendEndpoint: { type: String, default: '' },
13
- typingEndpoint: { type: String, default: '' },
14
- });
15
-
16
- const emit = defineEmits(['send', 'typing']);
17
-
18
- const escDark = inject(
19
- 'esc-dark',
20
- computed(() => false),
21
- );
22
- const { t } = useI18n();
23
-
24
- const body = ref('');
25
- const isNote = ref(false);
26
- const files = ref([]);
27
- const submitting = ref(false);
28
- const textareaRef = ref(null);
29
- const mentionDropdownRef = ref(null);
30
-
31
- const {
32
- suggestions,
33
- isActive: mentionActive,
34
- loading: mentionLoading,
35
- onTextChange,
36
- insertMention,
37
- close: closeMentions,
38
- } = useMentions();
39
-
40
- function onMentionInput() {
41
- if (textareaRef.value) {
42
- onTextChange(textareaRef.value, body.value);
43
- }
44
- }
45
-
46
- function handleMentionSelect(agent) {
47
- body.value = insertMention(body.value, agent);
48
- textareaRef.value?.focus();
49
- }
50
-
51
- // Typing indicator: debounced POST every 3 seconds while typing
52
- let lastTypingSent = 0;
53
- let typingTimer = null;
54
-
55
- function onInput() {
56
- emit('typing');
57
- if (!props.typingEndpoint) return;
58
- const now = Date.now();
59
- if (now - lastTypingSent < 3000) return;
60
- lastTypingSent = now;
61
- sendTypingIndicator();
62
-
63
- window.clearTimeout(typingTimer);
64
- typingTimer = window.setTimeout(() => {
65
- lastTypingSent = 0;
66
- }, 4000);
67
- }
68
-
69
- async function sendTypingIndicator() {
70
- try {
71
- await fetch(props.typingEndpoint, {
72
- method: 'POST',
73
- headers: {
74
- Accept: 'application/json',
75
- 'Content-Type': 'application/json',
76
- 'X-Requested-With': 'XMLHttpRequest',
77
- 'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]')?.content || '',
78
- },
79
- });
80
- } catch {
81
- // silently ignore
82
- }
83
- }
84
-
85
- function handleKeydown(e) {
86
- // Let mention dropdown handle keys first
87
- if (mentionActive.value && mentionDropdownRef.value) {
88
- const handled = mentionDropdownRef.value.onKeydown(e);
89
- if (handled) return;
90
- }
91
-
92
- if (e.key === 'Enter' && !e.shiftKey) {
93
- e.preventDefault();
94
- submit();
95
- }
96
- }
97
-
98
- function triggerFileInput() {
99
- const input = document.createElement('input');
100
- input.type = 'file';
101
- input.multiple = true;
102
- input.addEventListener('change', () => {
103
- if (input.files) {
104
- files.value = [...files.value, ...Array.from(input.files)];
105
- }
106
- });
107
- input.click();
108
- }
109
-
110
- function removeFile(index) {
111
- files.value.splice(index, 1);
112
- }
113
-
114
- async function submit() {
115
- if (!body.value.trim() || submitting.value || props.disabled) return;
116
- submitting.value = true;
117
- window.clearTimeout(typingTimer);
118
- lastTypingSent = 0;
119
-
120
- const payload = {
121
- body: body.value,
122
- is_internal_note: isNote.value,
123
- attachments: files.value,
124
- };
125
-
126
- emit('send', payload);
127
-
128
- if (props.sendEndpoint) {
129
- try {
130
- await fetch(props.sendEndpoint, {
131
- method: 'POST',
132
- headers: {
133
- Accept: 'application/json',
134
- 'Content-Type': 'application/json',
135
- 'X-Requested-With': 'XMLHttpRequest',
136
- 'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]')?.content || '',
137
- },
138
- body: JSON.stringify(payload),
139
- });
140
- } catch {
141
- // error handling delegated to caller
142
- }
143
- }
144
-
145
- body.value = '';
146
- files.value = [];
147
- isNote.value = false;
148
- submitting.value = false;
149
-
150
- // Re-focus textarea
151
- textareaRef.value?.focus();
152
- }
153
- </script>
154
-
155
- <template>
156
- <div
157
- :class="[
158
- 'border-t',
159
- isNote
160
- ? escDark
161
- ? 'border-amber-500/20 bg-amber-500/5'
162
- : 'border-yellow-200 bg-yellow-50'
163
- : escDark
164
- ? 'border-white/[0.06] bg-neutral-900/60'
165
- : 'border-gray-200 bg-white',
166
- ]"
167
- >
168
- <!-- Note/Reply toggle -->
169
- <div v-if="allowNotes" class="flex gap-1 px-3 pt-2">
170
- <button
171
- :class="[
172
- 'rounded px-2 py-0.5 text-xs font-medium transition-colors',
173
- !isNote
174
- ? escDark
175
- ? 'bg-cyan-500/15 text-white'
176
- : 'bg-blue-100 text-blue-700'
177
- : escDark
178
- ? 'text-neutral-500 hover:text-neutral-300'
179
- : 'text-gray-400 hover:text-gray-600',
180
- ]"
181
- @click="isNote = false"
182
- >
183
- {{ t('reply.reply') }}
184
- </button>
185
- <button
186
- :class="[
187
- 'rounded px-2 py-0.5 text-xs font-medium transition-colors',
188
- isNote
189
- ? escDark
190
- ? 'bg-amber-500/15 text-amber-400'
191
- : 'bg-yellow-100 text-yellow-700'
192
- : escDark
193
- ? 'text-neutral-500 hover:text-neutral-300'
194
- : 'text-gray-400 hover:text-gray-600',
195
- ]"
196
- aria-label="Internal note"
197
- @click="isNote = true"
198
- >
199
- {{ t('chat.note') }}
200
- </button>
201
- </div>
202
-
203
- <!-- File list -->
204
- <div v-if="files.length" class="flex flex-wrap gap-2 px-3 pt-2">
205
- <span
206
- v-for="(file, i) in files"
207
- :key="i"
208
- :class="[
209
- 'inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-xs',
210
- escDark ? 'bg-neutral-800 text-neutral-400' : 'bg-gray-100 text-gray-600',
211
- ]"
212
- >
213
- {{ file.name }}
214
- <button
215
- aria-label="Remove attachment"
216
- :class="[escDark ? 'text-rose-400 hover:text-rose-300' : 'text-red-500 hover:text-red-700']"
217
- @click="removeFile(i)"
218
- >
219
- &times;
220
- </button>
221
- </span>
222
- </div>
223
-
224
- <!-- Input row -->
225
- <div class="flex items-end gap-2 p-3">
226
- <!-- Attachment button -->
227
- <button
228
- v-if="allowAttachments"
229
- :disabled="disabled"
230
- :class="[
231
- 'flex-shrink-0 rounded-lg p-2 transition-colors',
232
- disabled
233
- ? 'cursor-not-allowed opacity-40'
234
- : escDark
235
- ? 'text-neutral-500 hover:bg-white/[0.04] hover:text-neutral-300'
236
- : 'text-gray-400 hover:bg-gray-100 hover:text-gray-600',
237
- ]"
238
- aria-label="Attach file"
239
- @click="triggerFileInput"
240
- >
241
- <svg class="h-5 w-5" fill="none" stroke="currentColor" stroke-width="1.5" viewBox="0 0 24 24">
242
- <path
243
- stroke-linecap="round"
244
- stroke-linejoin="round"
245
- d="M18.375 12.739l-7.693 7.693a4.5 4.5 0 01-6.364-6.364l10.94-10.94A3 3 0 1119.5 7.372L8.552 18.32m.009-.01l-.01.01m5.699-9.941l-7.81 7.81a1.5 1.5 0 002.112 2.13"
246
- />
247
- </svg>
248
- </button>
249
-
250
- <!-- Text input -->
251
- <div class="relative flex-1">
252
- <textarea
253
- ref="textareaRef"
254
- v-model="body"
255
- :disabled="disabled"
256
- rows="1"
257
- :placeholder="isNote ? t('reply.write_internal_note') : t('chat.placeholder')"
258
- :class="[
259
- 'w-full resize-none rounded-xl border px-4 py-2 text-sm focus:outline-none focus:ring-1',
260
- disabled && 'cursor-not-allowed opacity-50',
261
- escDark
262
- ? 'border-white/10 bg-neutral-950 text-neutral-200 placeholder-neutral-600 focus:border-white/20 focus:ring-white/10'
263
- : 'border-gray-300 bg-white text-gray-900 placeholder-gray-400 focus:border-blue-500 focus:ring-blue-500',
264
- ]"
265
- aria-label="Chat message"
266
- @input="
267
- onInput();
268
- onMentionInput();
269
- "
270
- @keydown="handleKeydown"
271
- ></textarea>
272
- <MentionDropdown
273
- ref="mentionDropdownRef"
274
- :suggestions="suggestions"
275
- :visible="mentionActive"
276
- :loading="mentionLoading"
277
- class="bottom-0 left-0 translate-y-full"
278
- @select="handleMentionSelect"
279
- @close="closeMentions"
280
- />
281
- </div>
282
-
283
- <!-- Send button -->
284
- <button
285
- :disabled="!body.trim() || submitting || disabled"
286
- :class="[
287
- 'flex-shrink-0 rounded-xl p-2 transition-all',
288
- !body.trim() || submitting || disabled ? 'cursor-not-allowed opacity-40' : '',
289
- isNote
290
- ? 'bg-amber-500 text-white hover:bg-amber-400'
291
- : escDark
292
- ? 'bg-gradient-to-r from-cyan-500 to-violet-500 text-white hover:from-cyan-400 hover:to-violet-400'
293
- : 'bg-blue-600 text-white hover:bg-blue-500',
294
- ]"
295
- aria-label="Send message"
296
- @click="submit"
297
- >
298
- <svg class="h-5 w-5" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">
299
- <path
300
- stroke-linecap="round"
301
- stroke-linejoin="round"
302
- d="M6 12L3.269 3.126A59.768 59.768 0 0121.485 12 59.77 59.77 0 013.27 20.876L5.999 12zm0 0h7.5"
303
- />
304
- </svg>
305
- </button>
306
- </div>
307
- </div>
308
- </template>
1
+ <script setup>
2
+ import { ref, computed, inject } from 'vue';
3
+ import { useI18n } from '../composables/useI18n';
4
+ import MentionDropdown from './MentionDropdown.vue';
5
+ import { useMentions } from '../composables/useMentions';
6
+
7
+ const props = defineProps({
8
+ sessionId: { type: [String, Number], default: null },
9
+ disabled: { type: Boolean, default: false },
10
+ allowNotes: { type: Boolean, default: false },
11
+ allowAttachments: { type: Boolean, default: true },
12
+ sendEndpoint: { type: String, default: '' },
13
+ typingEndpoint: { type: String, default: '' },
14
+ });
15
+
16
+ const emit = defineEmits(['send', 'typing']);
17
+
18
+ const escDark = inject(
19
+ 'esc-dark',
20
+ computed(() => false),
21
+ );
22
+ const { t } = useI18n();
23
+
24
+ const body = ref('');
25
+ const isNote = ref(false);
26
+ const files = ref([]);
27
+ const submitting = ref(false);
28
+ const textareaRef = ref(null);
29
+ const mentionDropdownRef = ref(null);
30
+
31
+ const {
32
+ suggestions,
33
+ isActive: mentionActive,
34
+ loading: mentionLoading,
35
+ onTextChange,
36
+ insertMention,
37
+ close: closeMentions,
38
+ } = useMentions();
39
+
40
+ function onMentionInput() {
41
+ if (textareaRef.value) {
42
+ onTextChange(textareaRef.value, body.value);
43
+ }
44
+ }
45
+
46
+ function handleMentionSelect(agent) {
47
+ body.value = insertMention(body.value, agent);
48
+ textareaRef.value?.focus();
49
+ }
50
+
51
+ // Typing indicator: debounced POST every 3 seconds while typing
52
+ let lastTypingSent = 0;
53
+ let typingTimer = null;
54
+
55
+ function onInput() {
56
+ emit('typing');
57
+ if (!props.typingEndpoint) return;
58
+ const now = Date.now();
59
+ if (now - lastTypingSent < 3000) return;
60
+ lastTypingSent = now;
61
+ sendTypingIndicator();
62
+
63
+ window.clearTimeout(typingTimer);
64
+ typingTimer = window.setTimeout(() => {
65
+ lastTypingSent = 0;
66
+ }, 4000);
67
+ }
68
+
69
+ async function sendTypingIndicator() {
70
+ try {
71
+ await fetch(props.typingEndpoint, {
72
+ method: 'POST',
73
+ headers: {
74
+ Accept: 'application/json',
75
+ 'Content-Type': 'application/json',
76
+ 'X-Requested-With': 'XMLHttpRequest',
77
+ 'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]')?.content || '',
78
+ },
79
+ });
80
+ } catch {
81
+ // silently ignore
82
+ }
83
+ }
84
+
85
+ function handleKeydown(e) {
86
+ // Let mention dropdown handle keys first
87
+ if (mentionActive.value && mentionDropdownRef.value) {
88
+ const handled = mentionDropdownRef.value.onKeydown(e);
89
+ if (handled) return;
90
+ }
91
+
92
+ if (e.key === 'Enter' && !e.shiftKey) {
93
+ e.preventDefault();
94
+ submit();
95
+ }
96
+ }
97
+
98
+ function triggerFileInput() {
99
+ const input = document.createElement('input');
100
+ input.type = 'file';
101
+ input.multiple = true;
102
+ input.addEventListener('change', () => {
103
+ if (input.files) {
104
+ files.value = [...files.value, ...Array.from(input.files)];
105
+ }
106
+ });
107
+ input.click();
108
+ }
109
+
110
+ function removeFile(index) {
111
+ files.value.splice(index, 1);
112
+ }
113
+
114
+ async function submit() {
115
+ if (!body.value.trim() || submitting.value || props.disabled) return;
116
+ submitting.value = true;
117
+ window.clearTimeout(typingTimer);
118
+ lastTypingSent = 0;
119
+
120
+ const payload = {
121
+ body: body.value,
122
+ is_internal_note: isNote.value,
123
+ attachments: files.value,
124
+ };
125
+
126
+ emit('send', payload);
127
+
128
+ if (props.sendEndpoint) {
129
+ try {
130
+ await fetch(props.sendEndpoint, {
131
+ method: 'POST',
132
+ headers: {
133
+ Accept: 'application/json',
134
+ 'Content-Type': 'application/json',
135
+ 'X-Requested-With': 'XMLHttpRequest',
136
+ 'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]')?.content || '',
137
+ },
138
+ body: JSON.stringify(payload),
139
+ });
140
+ } catch {
141
+ // error handling delegated to caller
142
+ }
143
+ }
144
+
145
+ body.value = '';
146
+ files.value = [];
147
+ isNote.value = false;
148
+ submitting.value = false;
149
+
150
+ // Re-focus textarea
151
+ textareaRef.value?.focus();
152
+ }
153
+ </script>
154
+
155
+ <template>
156
+ <div
157
+ :class="[
158
+ 'border-t',
159
+ isNote
160
+ ? escDark
161
+ ? 'border-amber-500/20 bg-amber-500/5'
162
+ : 'border-yellow-200 bg-yellow-50'
163
+ : escDark
164
+ ? 'border-white/[0.06] bg-neutral-900/60'
165
+ : 'border-gray-200 bg-white',
166
+ ]"
167
+ >
168
+ <!-- Note/Reply toggle -->
169
+ <div v-if="allowNotes" class="flex gap-1 px-3 pt-2">
170
+ <button
171
+ :class="[
172
+ 'rounded px-2 py-0.5 text-xs font-medium transition-colors',
173
+ !isNote
174
+ ? escDark
175
+ ? 'bg-cyan-500/15 text-white'
176
+ : 'bg-blue-100 text-blue-700'
177
+ : escDark
178
+ ? 'text-neutral-500 hover:text-neutral-300'
179
+ : 'text-gray-400 hover:text-gray-600',
180
+ ]"
181
+ @click="isNote = false"
182
+ >
183
+ {{ t('reply.reply') }}
184
+ </button>
185
+ <button
186
+ :class="[
187
+ 'rounded px-2 py-0.5 text-xs font-medium transition-colors',
188
+ isNote
189
+ ? escDark
190
+ ? 'bg-amber-500/15 text-amber-400'
191
+ : 'bg-yellow-100 text-yellow-700'
192
+ : escDark
193
+ ? 'text-neutral-500 hover:text-neutral-300'
194
+ : 'text-gray-400 hover:text-gray-600',
195
+ ]"
196
+ aria-label="Internal note"
197
+ @click="isNote = true"
198
+ >
199
+ {{ t('chat.note') }}
200
+ </button>
201
+ </div>
202
+
203
+ <!-- File list -->
204
+ <div v-if="files.length" class="flex flex-wrap gap-2 px-3 pt-2">
205
+ <span
206
+ v-for="(file, i) in files"
207
+ :key="i"
208
+ :class="[
209
+ 'inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-xs',
210
+ escDark ? 'bg-neutral-800 text-neutral-400' : 'bg-gray-100 text-gray-600',
211
+ ]"
212
+ >
213
+ {{ file.name }}
214
+ <button
215
+ aria-label="Remove attachment"
216
+ :class="[escDark ? 'text-rose-400 hover:text-rose-300' : 'text-red-500 hover:text-red-700']"
217
+ @click="removeFile(i)"
218
+ >
219
+ &times;
220
+ </button>
221
+ </span>
222
+ </div>
223
+
224
+ <!-- Input row -->
225
+ <div class="flex items-end gap-2 p-3">
226
+ <!-- Attachment button -->
227
+ <button
228
+ v-if="allowAttachments"
229
+ :disabled="disabled"
230
+ :class="[
231
+ 'flex-shrink-0 rounded-lg p-2 transition-colors',
232
+ disabled
233
+ ? 'cursor-not-allowed opacity-40'
234
+ : escDark
235
+ ? 'text-neutral-500 hover:bg-white/[0.04] hover:text-neutral-300'
236
+ : 'text-gray-400 hover:bg-gray-100 hover:text-gray-600',
237
+ ]"
238
+ aria-label="Attach file"
239
+ @click="triggerFileInput"
240
+ >
241
+ <svg class="h-5 w-5" fill="none" stroke="currentColor" stroke-width="1.5" viewBox="0 0 24 24">
242
+ <path
243
+ stroke-linecap="round"
244
+ stroke-linejoin="round"
245
+ d="M18.375 12.739l-7.693 7.693a4.5 4.5 0 01-6.364-6.364l10.94-10.94A3 3 0 1119.5 7.372L8.552 18.32m.009-.01l-.01.01m5.699-9.941l-7.81 7.81a1.5 1.5 0 002.112 2.13"
246
+ />
247
+ </svg>
248
+ </button>
249
+
250
+ <!-- Text input -->
251
+ <div class="relative flex-1">
252
+ <textarea
253
+ ref="textareaRef"
254
+ v-model="body"
255
+ :disabled="disabled"
256
+ rows="1"
257
+ :placeholder="isNote ? t('reply.write_internal_note') : t('chat.placeholder')"
258
+ :class="[
259
+ 'w-full resize-none rounded-xl border px-4 py-2 text-sm focus:outline-none focus:ring-1',
260
+ disabled && 'cursor-not-allowed opacity-50',
261
+ escDark
262
+ ? 'border-white/10 bg-neutral-950 text-neutral-200 placeholder-neutral-600 focus:border-white/20 focus:ring-white/10'
263
+ : 'border-gray-300 bg-white text-gray-900 placeholder-gray-400 focus:border-blue-500 focus:ring-blue-500',
264
+ ]"
265
+ aria-label="Chat message"
266
+ @input="
267
+ onInput();
268
+ onMentionInput();
269
+ "
270
+ @keydown="handleKeydown"
271
+ ></textarea>
272
+ <MentionDropdown
273
+ ref="mentionDropdownRef"
274
+ :suggestions="suggestions"
275
+ :visible="mentionActive"
276
+ :loading="mentionLoading"
277
+ class="bottom-0 left-0 translate-y-full"
278
+ @select="handleMentionSelect"
279
+ @close="closeMentions"
280
+ />
281
+ </div>
282
+
283
+ <!-- Send button -->
284
+ <button
285
+ :disabled="!body.trim() || submitting || disabled"
286
+ :class="[
287
+ 'flex-shrink-0 rounded-xl p-2 transition-all',
288
+ !body.trim() || submitting || disabled ? 'cursor-not-allowed opacity-40' : '',
289
+ isNote
290
+ ? 'bg-amber-500 text-white hover:bg-amber-400'
291
+ : escDark
292
+ ? 'bg-gradient-to-r from-cyan-500 to-violet-500 text-white hover:from-cyan-400 hover:to-violet-400'
293
+ : 'bg-blue-600 text-white hover:bg-blue-500',
294
+ ]"
295
+ aria-label="Send message"
296
+ @click="submit"
297
+ >
298
+ <svg class="h-5 w-5" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">
299
+ <path
300
+ stroke-linecap="round"
301
+ stroke-linejoin="round"
302
+ d="M6 12L3.269 3.126A59.768 59.768 0 0121.485 12 59.77 59.77 0 013.27 20.876L5.999 12zm0 0h7.5"
303
+ />
304
+ </svg>
305
+ </button>
306
+ </div>
307
+ </div>
308
+ </template>