@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,65 +1,65 @@
1
- <script setup>
2
- import { computed, inject } from 'vue';
3
-
4
- defineProps({
5
- attachments: { type: Array, required: true },
6
- });
7
-
8
- const dark = inject(
9
- 'esc-dark',
10
- computed(() => false),
11
- );
12
-
13
- function formatSize(bytes) {
14
- if (bytes < 1024) return bytes + ' B';
15
- if (bytes < 1048576) return (bytes / 1024).toFixed(1) + ' KB';
16
- return (bytes / 1048576).toFixed(1) + ' MB';
17
- }
18
-
19
- function iconForMime(mime) {
20
- if (mime?.startsWith('image/')) return '🖼️';
21
- if (mime?.startsWith('video/')) return '🎬';
22
- if (mime === 'application/pdf') return '📄';
23
- return '📎';
24
- }
25
-
26
- function attachmentUrl(attachment) {
27
- if (attachment.url) return attachment.url;
28
- if (typeof window.route === 'function') {
29
- try {
30
- return window.route('escalated.attachments.download', attachment.id);
31
- } catch {
32
- // route not registered
33
- }
34
- }
35
- return `/escalated/attachments/${attachment.id}/download`;
36
- }
37
- </script>
38
-
39
- <template>
40
- <div class="space-y-1">
41
- <div
42
- v-for="attachment in attachments"
43
- :key="attachment.id"
44
- :class="[
45
- 'flex items-center gap-2 rounded-lg border px-3 py-2 text-sm',
46
- dark ? 'border-[var(--esc-panel-border)] bg-[var(--esc-panel-hover)]' : 'border-gray-200 bg-gray-50',
47
- ]"
48
- >
49
- <span>{{ iconForMime(attachment.mime_type) }}</span>
50
- <a
51
- :href="attachmentUrl(attachment)"
52
- target="_blank"
53
- :class="[
54
- 'flex-1 truncate font-medium hover:underline',
55
- dark ? 'text-[var(--esc-panel-text)]' : 'text-blue-600',
56
- ]"
57
- >
58
- {{ attachment.original_filename }}
59
- </a>
60
- <span :class="['text-xs', dark ? 'text-[var(--esc-panel-text-muted)]' : 'text-gray-400']">{{
61
- formatSize(attachment.size)
62
- }}</span>
63
- </div>
64
- </div>
65
- </template>
1
+ <script setup>
2
+ import { computed, inject } from 'vue';
3
+
4
+ defineProps({
5
+ attachments: { type: Array, required: true },
6
+ });
7
+
8
+ const dark = inject(
9
+ 'esc-dark',
10
+ computed(() => false),
11
+ );
12
+
13
+ function formatSize(bytes) {
14
+ if (bytes < 1024) return bytes + ' B';
15
+ if (bytes < 1048576) return (bytes / 1024).toFixed(1) + ' KB';
16
+ return (bytes / 1048576).toFixed(1) + ' MB';
17
+ }
18
+
19
+ function iconForMime(mime) {
20
+ if (mime?.startsWith('image/')) return '🖼️';
21
+ if (mime?.startsWith('video/')) return '🎬';
22
+ if (mime === 'application/pdf') return '📄';
23
+ return '📎';
24
+ }
25
+
26
+ function attachmentUrl(attachment) {
27
+ if (attachment.url) return attachment.url;
28
+ if (typeof window.route === 'function') {
29
+ try {
30
+ return window.route('escalated.attachments.download', attachment.id);
31
+ } catch {
32
+ // route not registered
33
+ }
34
+ }
35
+ return `/escalated/attachments/${attachment.id}/download`;
36
+ }
37
+ </script>
38
+
39
+ <template>
40
+ <div class="space-y-1">
41
+ <div
42
+ v-for="attachment in attachments"
43
+ :key="attachment.id"
44
+ :class="[
45
+ 'flex items-center gap-2 rounded-lg border px-3 py-2 text-sm',
46
+ dark ? 'border-[var(--esc-panel-border)] bg-[var(--esc-panel-hover)]' : 'border-gray-200 bg-gray-50',
47
+ ]"
48
+ >
49
+ <span>{{ iconForMime(attachment.mime_type) }}</span>
50
+ <a
51
+ :href="attachmentUrl(attachment)"
52
+ target="_blank"
53
+ :class="[
54
+ 'flex-1 truncate font-medium hover:underline',
55
+ dark ? 'text-[var(--esc-panel-text)]' : 'text-blue-600',
56
+ ]"
57
+ >
58
+ {{ attachment.original_filename }}
59
+ </a>
60
+ <span :class="['text-xs', dark ? 'text-[var(--esc-panel-text-muted)]' : 'text-gray-400']">{{
61
+ formatSize(attachment.size)
62
+ }}</span>
63
+ </div>
64
+ </div>
65
+ </template>
@@ -1,226 +1,226 @@
1
- <script setup>
2
- import { ref, computed, inject, onMounted, onUnmounted } from 'vue';
3
- import { useI18n } from '../composables/useI18n';
4
-
5
- const props = defineProps({
6
- sessionId: { type: [String, Number], default: null },
7
- startedAt: { type: String, default: null },
8
- customer: { type: Object, default: () => ({}) },
9
- agents: { type: Array, default: () => [] },
10
- departments: { type: Array, default: () => [] },
11
- endEndpoint: { type: String, default: '' },
12
- transferEndpoint: { type: String, default: '' },
13
- });
14
-
15
- const emit = defineEmits(['end-chat', 'transfer']);
16
-
17
- const escDark = inject(
18
- 'esc-dark',
19
- computed(() => false),
20
- );
21
- const { t } = useI18n();
22
-
23
- const showEndConfirm = ref(false);
24
- const showTransfer = ref(false);
25
- const elapsed = ref('0:00');
26
- let timerInterval = null;
27
-
28
- function updateTimer() {
29
- if (!props.startedAt) return;
30
- const diffMs = Date.now() - new Date(props.startedAt).getTime();
31
- const totalSecs = Math.max(0, Math.floor(diffMs / 1000));
32
- const mins = Math.floor(totalSecs / 60);
33
- const secs = totalSecs % 60;
34
- if (mins >= 60) {
35
- const hrs = Math.floor(mins / 60);
36
- const remMins = mins % 60;
37
- elapsed.value = `${hrs}:${String(remMins).padStart(2, '0')}:${String(secs).padStart(2, '0')}`;
38
- } else {
39
- elapsed.value = `${mins}:${String(secs).padStart(2, '0')}`;
40
- }
41
- }
42
-
43
- onMounted(() => {
44
- updateTimer();
45
- timerInterval = setInterval(updateTimer, 1000);
46
- });
47
-
48
- onUnmounted(() => {
49
- clearInterval(timerInterval);
50
- });
51
-
52
- async function confirmEndChat() {
53
- emit('end-chat', props.sessionId);
54
- if (props.endEndpoint) {
55
- try {
56
- await fetch(props.endEndpoint, {
57
- method: 'POST',
58
- headers: {
59
- Accept: 'application/json',
60
- 'Content-Type': 'application/json',
61
- 'X-Requested-With': 'XMLHttpRequest',
62
- 'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]')?.content || '',
63
- },
64
- });
65
- } catch {
66
- // handled by caller
67
- }
68
- }
69
- showEndConfirm.value = false;
70
- }
71
-
72
- function transferTo(type, id) {
73
- emit('transfer', { type, id });
74
- if (props.transferEndpoint) {
75
- fetch(props.transferEndpoint, {
76
- method: 'POST',
77
- headers: {
78
- Accept: 'application/json',
79
- 'Content-Type': 'application/json',
80
- 'X-Requested-With': 'XMLHttpRequest',
81
- 'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]')?.content || '',
82
- },
83
- body: JSON.stringify({ type, id }),
84
- }).catch(() => {});
85
- }
86
- showTransfer.value = false;
87
- }
88
- </script>
89
-
90
- <template>
91
- <div
92
- :class="[
93
- 'flex flex-wrap items-center gap-3 rounded-xl border px-4 py-3',
94
- escDark ? 'border-white/[0.06] bg-neutral-900/60' : 'border-gray-200 bg-white',
95
- ]"
96
- >
97
- <!-- Chat duration -->
98
- <div class="flex items-center gap-2">
99
- <span :class="['h-2 w-2 animate-pulse rounded-full bg-emerald-500']"></span>
100
- <span :class="['text-sm font-mono font-medium', escDark ? 'text-neutral-300' : 'text-gray-700']">
101
- {{ elapsed }}
102
- </span>
103
- <span :class="['text-xs', escDark ? 'text-neutral-600' : 'text-gray-400']">
104
- {{ t('chat.live') }}
105
- </span>
106
- </div>
107
-
108
- <!-- Customer info -->
109
- <div
110
- v-if="customer.name || customer.email"
111
- :class="['flex items-center gap-2 text-xs', escDark ? 'text-neutral-500' : 'text-gray-500']"
112
- >
113
- <span v-if="customer.name">{{ customer.name }}</span>
114
- <span v-if="customer.email" class="hidden sm:inline">&middot; {{ customer.email }}</span>
115
- <span v-if="customer.page_url" class="hidden md:inline truncate max-w-[200px]"
116
- >&middot; {{ customer.page_url }}</span
117
- >
118
- </div>
119
-
120
- <div class="ml-auto flex items-center gap-2">
121
- <!-- Transfer -->
122
- <div class="relative">
123
- <button
124
- :class="[
125
- 'rounded-lg border px-3 py-1.5 text-sm transition-colors',
126
- escDark
127
- ? 'border-white/10 text-neutral-400 hover:border-white/20 hover:text-neutral-200'
128
- : 'border-gray-300 text-gray-600 hover:border-gray-400 hover:text-gray-800',
129
- ]"
130
- @click="showTransfer = !showTransfer"
131
- >
132
- {{ t('chat.transfer') }}
133
- </button>
134
- <div
135
- v-if="showTransfer"
136
- :class="[
137
- 'absolute right-0 top-full z-50 mt-1 w-56 rounded-lg border py-1 shadow-xl',
138
- escDark ? 'border-white/[0.08] bg-neutral-800' : 'border-gray-200 bg-white',
139
- ]"
140
- >
141
- <div
142
- v-if="agents.length"
143
- :class="[
144
- 'px-3 py-1 text-[10px] font-semibold uppercase',
145
- escDark ? 'text-neutral-600' : 'text-gray-400',
146
- ]"
147
- >
148
- {{ t('chat.agents') }}
149
- </div>
150
- <button
151
- v-for="agent in agents"
152
- :key="'a-' + agent.id"
153
- :class="[
154
- 'block w-full px-3 py-1.5 text-left text-sm',
155
- escDark ? 'text-neutral-300 hover:bg-white/[0.06]' : 'text-gray-700 hover:bg-gray-50',
156
- ]"
157
- @click="transferTo('agent', agent.id)"
158
- >
159
- {{ agent.name }}
160
- </button>
161
- <div
162
- v-if="departments.length"
163
- :class="[
164
- 'mt-1 border-t px-3 py-1 text-[10px] font-semibold uppercase',
165
- escDark ? 'border-white/[0.06] text-neutral-600' : 'border-gray-100 text-gray-400',
166
- ]"
167
- >
168
- {{ t('chat.departments') }}
169
- </div>
170
- <button
171
- v-for="dept in departments"
172
- :key="'d-' + dept.id"
173
- :class="[
174
- 'block w-full px-3 py-1.5 text-left text-sm',
175
- escDark ? 'text-neutral-300 hover:bg-white/[0.06]' : 'text-gray-700 hover:bg-gray-50',
176
- ]"
177
- @click="transferTo('department', dept.id)"
178
- >
179
- {{ dept.name }}
180
- </button>
181
- </div>
182
- </div>
183
-
184
- <!-- End Chat -->
185
- <div class="relative">
186
- <button
187
- v-if="!showEndConfirm"
188
- :class="[
189
- 'rounded-lg border px-3 py-1.5 text-sm transition-colors',
190
- escDark
191
- ? 'border-rose-500/20 text-rose-400 hover:bg-rose-500/10'
192
- : 'border-red-200 text-red-600 hover:bg-red-50',
193
- ]"
194
- @click="showEndConfirm = true"
195
- >
196
- {{ t('chat.end_chat') }}
197
- </button>
198
- <div v-else class="flex items-center gap-2">
199
- <span :class="['text-xs', escDark ? 'text-neutral-400' : 'text-gray-500']">
200
- {{ t('chat.end_confirm') }}
201
- </span>
202
- <button
203
- :class="[
204
- 'rounded-lg px-3 py-1.5 text-sm font-medium text-white',
205
- escDark ? 'bg-rose-600 hover:bg-rose-500' : 'bg-red-600 hover:bg-red-500',
206
- ]"
207
- @click="confirmEndChat"
208
- >
209
- {{ t('form.confirm') }}
210
- </button>
211
- <button
212
- :class="[
213
- 'rounded-lg border px-3 py-1.5 text-sm',
214
- escDark
215
- ? 'border-white/10 text-neutral-400 hover:text-neutral-200'
216
- : 'border-gray-300 text-gray-500 hover:text-gray-700',
217
- ]"
218
- @click="showEndConfirm = false"
219
- >
220
- {{ t('form.cancel') }}
221
- </button>
222
- </div>
223
- </div>
224
- </div>
225
- </div>
226
- </template>
1
+ <script setup>
2
+ import { ref, computed, inject, onMounted, onUnmounted } from 'vue';
3
+ import { useI18n } from '../composables/useI18n';
4
+
5
+ const props = defineProps({
6
+ sessionId: { type: [String, Number], default: null },
7
+ startedAt: { type: String, default: null },
8
+ customer: { type: Object, default: () => ({}) },
9
+ agents: { type: Array, default: () => [] },
10
+ departments: { type: Array, default: () => [] },
11
+ endEndpoint: { type: String, default: '' },
12
+ transferEndpoint: { type: String, default: '' },
13
+ });
14
+
15
+ const emit = defineEmits(['end-chat', 'transfer']);
16
+
17
+ const escDark = inject(
18
+ 'esc-dark',
19
+ computed(() => false),
20
+ );
21
+ const { t } = useI18n();
22
+
23
+ const showEndConfirm = ref(false);
24
+ const showTransfer = ref(false);
25
+ const elapsed = ref('0:00');
26
+ let timerInterval = null;
27
+
28
+ function updateTimer() {
29
+ if (!props.startedAt) return;
30
+ const diffMs = Date.now() - new Date(props.startedAt).getTime();
31
+ const totalSecs = Math.max(0, Math.floor(diffMs / 1000));
32
+ const mins = Math.floor(totalSecs / 60);
33
+ const secs = totalSecs % 60;
34
+ if (mins >= 60) {
35
+ const hrs = Math.floor(mins / 60);
36
+ const remMins = mins % 60;
37
+ elapsed.value = `${hrs}:${String(remMins).padStart(2, '0')}:${String(secs).padStart(2, '0')}`;
38
+ } else {
39
+ elapsed.value = `${mins}:${String(secs).padStart(2, '0')}`;
40
+ }
41
+ }
42
+
43
+ onMounted(() => {
44
+ updateTimer();
45
+ timerInterval = setInterval(updateTimer, 1000);
46
+ });
47
+
48
+ onUnmounted(() => {
49
+ clearInterval(timerInterval);
50
+ });
51
+
52
+ async function confirmEndChat() {
53
+ emit('end-chat', props.sessionId);
54
+ if (props.endEndpoint) {
55
+ try {
56
+ await fetch(props.endEndpoint, {
57
+ method: 'POST',
58
+ headers: {
59
+ Accept: 'application/json',
60
+ 'Content-Type': 'application/json',
61
+ 'X-Requested-With': 'XMLHttpRequest',
62
+ 'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]')?.content || '',
63
+ },
64
+ });
65
+ } catch {
66
+ // handled by caller
67
+ }
68
+ }
69
+ showEndConfirm.value = false;
70
+ }
71
+
72
+ function transferTo(type, id) {
73
+ emit('transfer', { type, id });
74
+ if (props.transferEndpoint) {
75
+ fetch(props.transferEndpoint, {
76
+ method: 'POST',
77
+ headers: {
78
+ Accept: 'application/json',
79
+ 'Content-Type': 'application/json',
80
+ 'X-Requested-With': 'XMLHttpRequest',
81
+ 'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]')?.content || '',
82
+ },
83
+ body: JSON.stringify({ type, id }),
84
+ }).catch(() => {});
85
+ }
86
+ showTransfer.value = false;
87
+ }
88
+ </script>
89
+
90
+ <template>
91
+ <div
92
+ :class="[
93
+ 'flex flex-wrap items-center gap-3 rounded-xl border px-4 py-3',
94
+ escDark ? 'border-white/[0.06] bg-neutral-900/60' : 'border-gray-200 bg-white',
95
+ ]"
96
+ >
97
+ <!-- Chat duration -->
98
+ <div class="flex items-center gap-2">
99
+ <span :class="['h-2 w-2 animate-pulse rounded-full bg-emerald-500']"></span>
100
+ <span :class="['text-sm font-mono font-medium', escDark ? 'text-neutral-300' : 'text-gray-700']">
101
+ {{ elapsed }}
102
+ </span>
103
+ <span :class="['text-xs', escDark ? 'text-neutral-600' : 'text-gray-400']">
104
+ {{ t('chat.live') }}
105
+ </span>
106
+ </div>
107
+
108
+ <!-- Customer info -->
109
+ <div
110
+ v-if="customer.name || customer.email"
111
+ :class="['flex items-center gap-2 text-xs', escDark ? 'text-neutral-500' : 'text-gray-500']"
112
+ >
113
+ <span v-if="customer.name">{{ customer.name }}</span>
114
+ <span v-if="customer.email" class="hidden sm:inline">&middot; {{ customer.email }}</span>
115
+ <span v-if="customer.page_url" class="hidden md:inline truncate max-w-[200px]"
116
+ >&middot; {{ customer.page_url }}</span
117
+ >
118
+ </div>
119
+
120
+ <div class="ml-auto flex items-center gap-2">
121
+ <!-- Transfer -->
122
+ <div class="relative">
123
+ <button
124
+ :class="[
125
+ 'rounded-lg border px-3 py-1.5 text-sm transition-colors',
126
+ escDark
127
+ ? 'border-white/10 text-neutral-400 hover:border-white/20 hover:text-neutral-200'
128
+ : 'border-gray-300 text-gray-600 hover:border-gray-400 hover:text-gray-800',
129
+ ]"
130
+ @click="showTransfer = !showTransfer"
131
+ >
132
+ {{ t('chat.transfer') }}
133
+ </button>
134
+ <div
135
+ v-if="showTransfer"
136
+ :class="[
137
+ 'absolute right-0 top-full z-50 mt-1 w-56 rounded-lg border py-1 shadow-xl',
138
+ escDark ? 'border-white/[0.08] bg-neutral-800' : 'border-gray-200 bg-white',
139
+ ]"
140
+ >
141
+ <div
142
+ v-if="agents.length"
143
+ :class="[
144
+ 'px-3 py-1 text-[10px] font-semibold uppercase',
145
+ escDark ? 'text-neutral-600' : 'text-gray-400',
146
+ ]"
147
+ >
148
+ {{ t('chat.agents') }}
149
+ </div>
150
+ <button
151
+ v-for="agent in agents"
152
+ :key="'a-' + agent.id"
153
+ :class="[
154
+ 'block w-full px-3 py-1.5 text-left text-sm',
155
+ escDark ? 'text-neutral-300 hover:bg-white/[0.06]' : 'text-gray-700 hover:bg-gray-50',
156
+ ]"
157
+ @click="transferTo('agent', agent.id)"
158
+ >
159
+ {{ agent.name }}
160
+ </button>
161
+ <div
162
+ v-if="departments.length"
163
+ :class="[
164
+ 'mt-1 border-t px-3 py-1 text-[10px] font-semibold uppercase',
165
+ escDark ? 'border-white/[0.06] text-neutral-600' : 'border-gray-100 text-gray-400',
166
+ ]"
167
+ >
168
+ {{ t('chat.departments') }}
169
+ </div>
170
+ <button
171
+ v-for="dept in departments"
172
+ :key="'d-' + dept.id"
173
+ :class="[
174
+ 'block w-full px-3 py-1.5 text-left text-sm',
175
+ escDark ? 'text-neutral-300 hover:bg-white/[0.06]' : 'text-gray-700 hover:bg-gray-50',
176
+ ]"
177
+ @click="transferTo('department', dept.id)"
178
+ >
179
+ {{ dept.name }}
180
+ </button>
181
+ </div>
182
+ </div>
183
+
184
+ <!-- End Chat -->
185
+ <div class="relative">
186
+ <button
187
+ v-if="!showEndConfirm"
188
+ :class="[
189
+ 'rounded-lg border px-3 py-1.5 text-sm transition-colors',
190
+ escDark
191
+ ? 'border-rose-500/20 text-rose-400 hover:bg-rose-500/10'
192
+ : 'border-red-200 text-red-600 hover:bg-red-50',
193
+ ]"
194
+ @click="showEndConfirm = true"
195
+ >
196
+ {{ t('chat.end_chat') }}
197
+ </button>
198
+ <div v-else class="flex items-center gap-2">
199
+ <span :class="['text-xs', escDark ? 'text-neutral-400' : 'text-gray-500']">
200
+ {{ t('chat.end_confirm') }}
201
+ </span>
202
+ <button
203
+ :class="[
204
+ 'rounded-lg px-3 py-1.5 text-sm font-medium text-white',
205
+ escDark ? 'bg-rose-600 hover:bg-rose-500' : 'bg-red-600 hover:bg-red-500',
206
+ ]"
207
+ @click="confirmEndChat"
208
+ >
209
+ {{ t('form.confirm') }}
210
+ </button>
211
+ <button
212
+ :class="[
213
+ 'rounded-lg border px-3 py-1.5 text-sm',
214
+ escDark
215
+ ? 'border-white/10 text-neutral-400 hover:text-neutral-200'
216
+ : 'border-gray-300 text-gray-500 hover:text-gray-700',
217
+ ]"
218
+ @click="showEndConfirm = false"
219
+ >
220
+ {{ t('form.cancel') }}
221
+ </button>
222
+ </div>
223
+ </div>
224
+ </div>
225
+ </div>
226
+ </template>