@escalated-dev/escalated 0.7.0 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +31 -0
- package/package.json +12 -6
- package/src/components/ActiveChatsPanel.vue +246 -0
- package/src/components/ActivityTimeline.stories.js +55 -55
- package/src/components/ActivityTimeline.vue +83 -83
- package/src/components/AdminDashboard.stories.js +1423 -1095
- package/src/components/AgentLoadIndicator.stories.js +37 -37
- package/src/components/AgentLoadIndicator.vue +49 -49
- package/src/components/AgentPerformanceCard.vue +44 -44
- package/src/components/ArticleEditor.vue +82 -82
- package/src/components/AssigneeSelect.vue +37 -37
- package/src/components/AttachmentList.vue +13 -1
- package/src/components/AuditLogEntry.vue +95 -95
- package/src/components/BulkActionBar.vue +166 -166
- package/src/components/CategoryTree.vue +89 -89
- package/src/components/ChartWidget.vue +46 -46
- package/src/components/ChatActionBar.vue +226 -0
- package/src/components/ChatBubble.vue +162 -0
- package/src/components/ChatComposer.vue +308 -0
- package/src/components/ChatQueue.vue +222 -0
- package/src/components/ChatThread.vue +197 -0
- package/src/components/CollisionWarning.stories.js +30 -30
- package/src/components/CollisionWarning.vue +68 -68
- package/src/components/ConditionalFieldRules.vue +135 -135
- package/src/components/ContextPanel.vue +66 -66
- package/src/components/ContextPanelSection.vue +65 -65
- package/src/components/CustomFieldRenderer.vue +159 -159
- package/src/components/EscalatedLayout.vue +29 -6
- package/src/components/FileDropzone.vue +57 -57
- package/src/components/FollowButton.stories.js +30 -30
- package/src/components/FollowButton.vue +88 -88
- package/src/components/KeyboardShortcutHelp.vue +213 -213
- package/src/components/KnowledgePanel.vue +122 -122
- package/src/components/KpiCard.stories.js +32 -32
- package/src/components/KpiCard.vue +88 -88
- package/src/components/MacroDropdown.vue +150 -150
- package/src/components/MentionDropdown.vue +154 -0
- package/src/components/MetricComparison.vue +89 -0
- package/src/components/PercentileChart.vue +67 -0
- package/src/components/PeriodSelector.vue +98 -0
- package/src/components/PermissionMatrix.vue +107 -107
- package/src/components/PinnedNotes.vue +129 -129
- package/src/components/PluginSlot.vue +68 -62
- package/src/components/PresenceIndicator.vue +46 -2
- package/src/components/PriorityBadge.stories.js +33 -33
- package/src/components/PriorityBadge.vue +46 -46
- package/src/components/ReplyComposer.vue +81 -18
- package/src/components/ReplyThread.vue +40 -2
- package/src/components/ReportChart.vue +395 -0
- package/src/components/ReportExportButton.vue +108 -0
- package/src/components/SatisfactionRating.vue +180 -180
- package/src/components/SaveViewDialog.vue +172 -0
- package/src/components/SavedViewSidebar.vue +208 -0
- package/src/components/ScheduleEditor.vue +104 -104
- package/src/components/SideConversation.vue +165 -165
- package/src/components/SideConversationList.vue +147 -147
- package/src/components/SkillTagManager.vue +79 -79
- package/src/components/SlaComplianceChart.vue +46 -53
- package/src/components/SlaTimer.stories.js +35 -35
- package/src/components/SlaTimer.vue +62 -62
- package/src/components/SnoozeButton.vue +247 -0
- package/src/components/StatsCard.stories.js +24 -24
- package/src/components/StatsCard.vue +58 -58
- package/src/components/StatusBadge.stories.js +53 -53
- package/src/components/StatusBadge.vue +78 -78
- package/src/components/TagSelect.vue +84 -84
- package/src/components/TicketFilters.vue +270 -225
- package/src/components/TicketLinkPanel.vue +193 -193
- package/src/components/TicketList.vue +655 -594
- package/src/components/TicketMergeDialog.vue +157 -157
- package/src/components/TicketSplitDialog.vue +98 -0
- package/src/components/TotpInput.stories.js +9 -9
- package/src/components/TotpInput.vue +81 -81
- package/src/components/TwoFactorSetup.vue +113 -113
- package/src/components/VariableTokenInput.vue +111 -0
- package/src/components/WorkflowActionConfig.vue +287 -0
- package/src/components/WorkflowActionList.vue +350 -0
- package/src/components/WorkflowConditionBuilder.vue +265 -0
- package/src/components/WorkflowTriggerSelector.vue +125 -0
- package/src/composables/useChat.js +187 -0
- package/src/composables/useI18n.js +80 -80
- package/src/composables/useKeyboardShortcuts.js +46 -46
- package/src/composables/useMentions.js +134 -0
- package/src/composables/usePluginExtensions.js +159 -159
- package/src/composables/usePluginHooks.js +65 -65
- package/src/composables/useRealtime.js +182 -0
- package/src/defineEscalatedPlugin.js +76 -76
- package/src/index.js +84 -72
- package/src/locales/ar.json +727 -0
- package/src/locales/de.json +678 -430
- package/src/locales/en.json +717 -455
- package/src/locales/es.json +679 -430
- package/src/locales/fr.json +680 -431
- package/src/locales/index.js +12 -2
- package/src/locales/it.json +727 -0
- package/src/locales/ja.json +727 -0
- package/src/locales/ko.json +727 -0
- package/src/locales/nl.json +727 -0
- package/src/locales/pl.json +727 -0
- package/src/locales/pt-BR.json +727 -0
- package/src/locales/ru.json +727 -0
- package/src/locales/tr.json +727 -0
- package/src/locales/zh-CN.json +727 -0
- package/src/pages/Admin/ApiTokens/Index.vue +381 -381
- package/src/pages/Admin/AuditLog/Index.vue +154 -154
- package/src/pages/Admin/BusinessHours/Form.vue +172 -172
- package/src/pages/Admin/BusinessHours/Index.vue +113 -113
- package/src/pages/Admin/CannedResponses/Index.vue +127 -127
- package/src/pages/Admin/Capacity/Index.vue +134 -134
- package/src/pages/Admin/CustomFields/Form.vue +195 -195
- package/src/pages/Admin/CustomFields/Index.vue +134 -134
- package/src/pages/Admin/CustomObjects/Form.vue +202 -202
- package/src/pages/Admin/CustomObjects/Index.vue +127 -127
- package/src/pages/Admin/CustomObjects/Records.vue +228 -228
- package/src/pages/Admin/Departments/Form.vue +75 -75
- package/src/pages/Admin/Departments/Index.vue +110 -109
- package/src/pages/Admin/EscalationRules/Form.vue +157 -157
- package/src/pages/Admin/EscalationRules/Index.vue +178 -178
- package/src/pages/Admin/Import/Connect.vue +0 -1
- package/src/pages/Admin/Import/Index.vue +1 -1
- package/src/pages/Admin/Import/Progress.vue +1 -1
- package/src/pages/Admin/KnowledgeBase/Articles/Form.vue +142 -142
- package/src/pages/Admin/KnowledgeBase/Articles/Index.vue +195 -195
- package/src/pages/Admin/KnowledgeBase/Categories/Index.vue +193 -193
- package/src/pages/Admin/Macros/Index.vue +448 -448
- package/src/pages/Admin/Plugins/Index.vue +327 -327
- package/src/pages/Admin/Reports/AgentDetail.vue +132 -0
- package/src/pages/Admin/Reports/AgentMetrics.vue +115 -115
- package/src/pages/Admin/Reports/AgentRanking.vue +246 -0
- package/src/pages/Admin/Reports/Cohorts.vue +180 -0
- package/src/pages/Admin/Reports/Comparison.vue +141 -0
- package/src/pages/Admin/Reports/CsatReport.vue +127 -127
- package/src/pages/Admin/Reports/Dashboard.vue +36 -21
- package/src/pages/Admin/Reports/ResolutionTimes.vue +164 -0
- package/src/pages/Admin/Reports/ResponseTimes.vue +164 -0
- package/src/pages/Admin/Reports/SlaReport.vue +162 -166
- package/src/pages/Admin/Reports/SlaTrends.vue +183 -0
- package/src/pages/Admin/Reports.vue +206 -206
- package/src/pages/Admin/Roles/Form.vue +71 -71
- package/src/pages/Admin/Roles/Index.vue +122 -122
- package/src/pages/Admin/Settings/CsatSettings.vue +165 -165
- package/src/pages/Admin/Settings/DataRetention.vue +182 -182
- package/src/pages/Admin/Settings/EmailSettings.vue +243 -243
- package/src/pages/Admin/Settings/Sandbox.vue +135 -135
- package/src/pages/Admin/Settings/SsoSettings.vue +218 -218
- package/src/pages/Admin/Settings/TwoFactor.vue +110 -110
- package/src/pages/Admin/Settings.vue +1008 -468
- package/src/pages/Admin/Skills/Form.vue +53 -53
- package/src/pages/Admin/Skills/Index.vue +94 -94
- package/src/pages/Admin/SlaPolicies/Form.vue +118 -118
- package/src/pages/Admin/SlaPolicies/Index.vue +121 -120
- package/src/pages/Admin/Statuses/Form.vue +114 -114
- package/src/pages/Admin/Statuses/Index.vue +153 -153
- package/src/pages/Admin/Tags/Index.vue +191 -191
- package/src/pages/Admin/Tickets/Index.vue +126 -91
- package/src/pages/Admin/Tickets/Show.vue +29 -0
- package/src/pages/Admin/Webhooks/DeliveryLog.vue +120 -120
- package/src/pages/Admin/Webhooks/Form.vue +110 -110
- package/src/pages/Admin/Webhooks/Index.vue +136 -136
- package/src/pages/Admin/Workflows/Builder.vue +207 -0
- package/src/pages/Admin/Workflows/Index.vue +235 -0
- package/src/pages/Admin/Workflows/Logs.vue +286 -0
- package/src/pages/Agent/TicketIndex.vue +112 -88
- package/src/pages/Agent/TicketShow.vue +192 -60
- package/src/pages/Customer/Create.vue +1 -1
- package/src/pages/Customer/Index.vue +31 -31
- package/src/pages/Customer/KnowledgeBase/Article.vue +4 -2
- package/src/pages/Customer/KnowledgeBase/Index.vue +151 -151
- package/src/pages/Customer/Show.vue +69 -63
- package/src/pages/Guest/Create.vue +40 -15
- package/src/pages/Guest/Show.vue +124 -93
- package/src/plugin.js +25 -0
- package/src/utils/mentionHighlight.js +24 -0
- package/src/utils/sanitizeHtml.js +78 -64
- package/src/widget/EscalatedWidget.vue +804 -0
- package/src/widget/index.js +254 -0
- package/src/pages/Admin/Automations/Form.vue +0 -184
- package/src/pages/Admin/Automations/Index.vue +0 -129
|
@@ -1,89 +1,89 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import { computed } from 'vue';
|
|
3
|
-
|
|
4
|
-
const props = defineProps({
|
|
5
|
-
categories: { type: Array, default: () => [] },
|
|
6
|
-
level: { type: Number, default: 0 },
|
|
7
|
-
parentId: { type: [Number, null], default: null },
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
defineEmits(['edit', 'delete']);
|
|
11
|
-
|
|
12
|
-
const children = computed(() => {
|
|
13
|
-
return props.categories.filter((c) => {
|
|
14
|
-
if (props.parentId === null) return !c.parent_id;
|
|
15
|
-
return c.parent_id === props.parentId;
|
|
16
|
-
});
|
|
17
|
-
});
|
|
18
|
-
</script>
|
|
19
|
-
|
|
20
|
-
<template>
|
|
21
|
-
<div>
|
|
22
|
-
<div v-for="category in children" :key="category.id">
|
|
23
|
-
<div
|
|
24
|
-
:class="[
|
|
25
|
-
'flex items-center justify-between rounded-lg border border-white/[0.06] bg-neutral-900/60 px-4 py-3 mb-1.5',
|
|
26
|
-
]"
|
|
27
|
-
:style="{ marginLeft: level * 24 + 'px' }"
|
|
28
|
-
>
|
|
29
|
-
<div class="flex items-center gap-3">
|
|
30
|
-
<svg
|
|
31
|
-
class="h-4 w-4 text-neutral-600"
|
|
32
|
-
fill="none"
|
|
33
|
-
stroke="currentColor"
|
|
34
|
-
stroke-width="1.5"
|
|
35
|
-
viewBox="0 0 24 24"
|
|
36
|
-
>
|
|
37
|
-
<path
|
|
38
|
-
stroke-linecap="round"
|
|
39
|
-
stroke-linejoin="round"
|
|
40
|
-
d="M2.25 12.75V12A2.25 2.25 0 014.5 9.75h15A2.25 2.25 0 0121.75 12v.75m-8.69-6.44l-2.12-2.12a1.5 1.5 0 00-1.061-.44H4.5A2.25 2.25 0 002.25 6v12a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9a2.25 2.25 0 00-2.25-2.25h-5.379a1.5 1.5 0 01-1.06-.44z"
|
|
41
|
-
/>
|
|
42
|
-
</svg>
|
|
43
|
-
<div>
|
|
44
|
-
<span class="text-sm font-medium text-neutral-200">{{ category.name }}</span>
|
|
45
|
-
<span v-if="category.articles_count !== undefined" class="ml-2 text-xs text-neutral-500">
|
|
46
|
-
{{ category.articles_count }} articles
|
|
47
|
-
</span>
|
|
48
|
-
</div>
|
|
49
|
-
</div>
|
|
50
|
-
<div class="flex items-center gap-2">
|
|
51
|
-
<span class="text-xs text-neutral-600">pos: {{ category.position }}</span>
|
|
52
|
-
<button
|
|
53
|
-
type="button"
|
|
54
|
-
class="rounded p-1 text-neutral-500 hover:bg-white/[0.06] hover:text-neutral-300"
|
|
55
|
-
@click="$emit('edit', category)"
|
|
56
|
-
>
|
|
57
|
-
<svg class="h-4 w-4" fill="none" stroke="currentColor" stroke-width="1.5" viewBox="0 0 24 24">
|
|
58
|
-
<path
|
|
59
|
-
stroke-linecap="round"
|
|
60
|
-
stroke-linejoin="round"
|
|
61
|
-
d="M16.862 4.487l1.687-1.688a1.875 1.875 0 112.652 2.652L10.582 16.07a4.5 4.5 0 01-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 011.13-1.897l8.932-8.931zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0115.75 21H5.25A2.25 2.25 0 013 18.75V8.25A2.25 2.25 0 015.25 6H10"
|
|
62
|
-
/>
|
|
63
|
-
</svg>
|
|
64
|
-
</button>
|
|
65
|
-
<button
|
|
66
|
-
type="button"
|
|
67
|
-
class="rounded p-1 text-neutral-500 hover:bg-red-500/10 hover:text-red-400"
|
|
68
|
-
@click="$emit('delete', category)"
|
|
69
|
-
>
|
|
70
|
-
<svg class="h-4 w-4" fill="none" stroke="currentColor" stroke-width="1.5" viewBox="0 0 24 24">
|
|
71
|
-
<path
|
|
72
|
-
stroke-linecap="round"
|
|
73
|
-
stroke-linejoin="round"
|
|
74
|
-
d="M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0"
|
|
75
|
-
/>
|
|
76
|
-
</svg>
|
|
77
|
-
</button>
|
|
78
|
-
</div>
|
|
79
|
-
</div>
|
|
80
|
-
<CategoryTree
|
|
81
|
-
:categories="categories"
|
|
82
|
-
:level="level + 1"
|
|
83
|
-
:parent-id="category.id"
|
|
84
|
-
@edit="$emit('edit', $event)"
|
|
85
|
-
@delete="$emit('delete', $event)"
|
|
86
|
-
/>
|
|
87
|
-
</div>
|
|
88
|
-
</div>
|
|
89
|
-
</template>
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed } from 'vue';
|
|
3
|
+
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
categories: { type: Array, default: () => [] },
|
|
6
|
+
level: { type: Number, default: 0 },
|
|
7
|
+
parentId: { type: [Number, null], default: null },
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
defineEmits(['edit', 'delete']);
|
|
11
|
+
|
|
12
|
+
const children = computed(() => {
|
|
13
|
+
return props.categories.filter((c) => {
|
|
14
|
+
if (props.parentId === null) return !c.parent_id;
|
|
15
|
+
return c.parent_id === props.parentId;
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<template>
|
|
21
|
+
<div>
|
|
22
|
+
<div v-for="category in children" :key="category.id">
|
|
23
|
+
<div
|
|
24
|
+
:class="[
|
|
25
|
+
'flex items-center justify-between rounded-lg border border-white/[0.06] bg-neutral-900/60 px-4 py-3 mb-1.5',
|
|
26
|
+
]"
|
|
27
|
+
:style="{ marginLeft: level * 24 + 'px' }"
|
|
28
|
+
>
|
|
29
|
+
<div class="flex items-center gap-3">
|
|
30
|
+
<svg
|
|
31
|
+
class="h-4 w-4 text-neutral-600"
|
|
32
|
+
fill="none"
|
|
33
|
+
stroke="currentColor"
|
|
34
|
+
stroke-width="1.5"
|
|
35
|
+
viewBox="0 0 24 24"
|
|
36
|
+
>
|
|
37
|
+
<path
|
|
38
|
+
stroke-linecap="round"
|
|
39
|
+
stroke-linejoin="round"
|
|
40
|
+
d="M2.25 12.75V12A2.25 2.25 0 014.5 9.75h15A2.25 2.25 0 0121.75 12v.75m-8.69-6.44l-2.12-2.12a1.5 1.5 0 00-1.061-.44H4.5A2.25 2.25 0 002.25 6v12a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9a2.25 2.25 0 00-2.25-2.25h-5.379a1.5 1.5 0 01-1.06-.44z"
|
|
41
|
+
/>
|
|
42
|
+
</svg>
|
|
43
|
+
<div>
|
|
44
|
+
<span class="text-sm font-medium text-neutral-200">{{ category.name }}</span>
|
|
45
|
+
<span v-if="category.articles_count !== undefined" class="ml-2 text-xs text-neutral-500">
|
|
46
|
+
{{ category.articles_count }} articles
|
|
47
|
+
</span>
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
<div class="flex items-center gap-2">
|
|
51
|
+
<span class="text-xs text-neutral-600">pos: {{ category.position }}</span>
|
|
52
|
+
<button
|
|
53
|
+
type="button"
|
|
54
|
+
class="rounded p-1 text-neutral-500 hover:bg-white/[0.06] hover:text-neutral-300"
|
|
55
|
+
@click="$emit('edit', category)"
|
|
56
|
+
>
|
|
57
|
+
<svg class="h-4 w-4" fill="none" stroke="currentColor" stroke-width="1.5" viewBox="0 0 24 24">
|
|
58
|
+
<path
|
|
59
|
+
stroke-linecap="round"
|
|
60
|
+
stroke-linejoin="round"
|
|
61
|
+
d="M16.862 4.487l1.687-1.688a1.875 1.875 0 112.652 2.652L10.582 16.07a4.5 4.5 0 01-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 011.13-1.897l8.932-8.931zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0115.75 21H5.25A2.25 2.25 0 013 18.75V8.25A2.25 2.25 0 015.25 6H10"
|
|
62
|
+
/>
|
|
63
|
+
</svg>
|
|
64
|
+
</button>
|
|
65
|
+
<button
|
|
66
|
+
type="button"
|
|
67
|
+
class="rounded p-1 text-neutral-500 hover:bg-red-500/10 hover:text-red-400"
|
|
68
|
+
@click="$emit('delete', category)"
|
|
69
|
+
>
|
|
70
|
+
<svg class="h-4 w-4" fill="none" stroke="currentColor" stroke-width="1.5" viewBox="0 0 24 24">
|
|
71
|
+
<path
|
|
72
|
+
stroke-linecap="round"
|
|
73
|
+
stroke-linejoin="round"
|
|
74
|
+
d="M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0"
|
|
75
|
+
/>
|
|
76
|
+
</svg>
|
|
77
|
+
</button>
|
|
78
|
+
</div>
|
|
79
|
+
</div>
|
|
80
|
+
<CategoryTree
|
|
81
|
+
:categories="categories"
|
|
82
|
+
:level="level + 1"
|
|
83
|
+
:parent-id="category.id"
|
|
84
|
+
@edit="$emit('edit', $event)"
|
|
85
|
+
@delete="$emit('delete', $event)"
|
|
86
|
+
/>
|
|
87
|
+
</div>
|
|
88
|
+
</div>
|
|
89
|
+
</template>
|
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import { computed } from 'vue';
|
|
3
|
-
|
|
4
|
-
const props = defineProps({
|
|
5
|
-
title: { type: String, default: '' },
|
|
6
|
-
data: { type: Array, default: () => [] },
|
|
7
|
-
color: { type: String, default: 'cyan' },
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
const colorMap = {
|
|
11
|
-
cyan: 'bg-cyan-500',
|
|
12
|
-
violet: 'bg-violet-500',
|
|
13
|
-
emerald: 'bg-emerald-500',
|
|
14
|
-
amber: 'bg-amber-500',
|
|
15
|
-
red: 'bg-red-500',
|
|
16
|
-
blue: 'bg-blue-500',
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const barColor = computed(() => colorMap[props.color] || colorMap.cyan);
|
|
20
|
-
|
|
21
|
-
const maxValue = computed(() => {
|
|
22
|
-
if (!props.data.length) return 1;
|
|
23
|
-
return Math.max(...props.data.map((d) => d.value), 1);
|
|
24
|
-
});
|
|
25
|
-
</script>
|
|
26
|
-
|
|
27
|
-
<template>
|
|
28
|
-
<div class="rounded-xl border border-white/[0.06] bg-neutral-900/60 p-5">
|
|
29
|
-
<h3 v-if="title" class="mb-4 text-sm font-semibold text-neutral-200">{{ title }}</h3>
|
|
30
|
-
<div v-if="data.length" class="space-y-2.5">
|
|
31
|
-
<div v-for="item in data" :key="item.label" class="flex items-center gap-3">
|
|
32
|
-
<span class="w-20 shrink-0 truncate text-xs text-neutral-500">{{ item.label }}</span>
|
|
33
|
-
<div class="flex-1">
|
|
34
|
-
<div class="h-5 overflow-hidden rounded-full bg-white/[0.04]">
|
|
35
|
-
<div
|
|
36
|
-
:class="['h-full rounded-full transition-all', barColor]"
|
|
37
|
-
:style="{ width: `${(item.value / maxValue) * 100}%`, opacity: 0.8 }"
|
|
38
|
-
></div>
|
|
39
|
-
</div>
|
|
40
|
-
</div>
|
|
41
|
-
<span class="w-10 text-right text-xs font-medium text-neutral-300">{{ item.value }}</span>
|
|
42
|
-
</div>
|
|
43
|
-
</div>
|
|
44
|
-
<div v-else class="py-6 text-center text-sm text-neutral-500">No data available</div>
|
|
45
|
-
</div>
|
|
46
|
-
</template>
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed } from 'vue';
|
|
3
|
+
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
title: { type: String, default: '' },
|
|
6
|
+
data: { type: Array, default: () => [] },
|
|
7
|
+
color: { type: String, default: 'cyan' },
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
const colorMap = {
|
|
11
|
+
cyan: 'bg-cyan-500',
|
|
12
|
+
violet: 'bg-violet-500',
|
|
13
|
+
emerald: 'bg-emerald-500',
|
|
14
|
+
amber: 'bg-amber-500',
|
|
15
|
+
red: 'bg-red-500',
|
|
16
|
+
blue: 'bg-blue-500',
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const barColor = computed(() => colorMap[props.color] || colorMap.cyan);
|
|
20
|
+
|
|
21
|
+
const maxValue = computed(() => {
|
|
22
|
+
if (!props.data.length) return 1;
|
|
23
|
+
return Math.max(...props.data.map((d) => d.value), 1);
|
|
24
|
+
});
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<template>
|
|
28
|
+
<div class="rounded-xl border border-white/[0.06] bg-neutral-900/60 p-5">
|
|
29
|
+
<h3 v-if="title" class="mb-4 text-sm font-semibold text-neutral-200">{{ title }}</h3>
|
|
30
|
+
<div v-if="data.length" class="space-y-2.5">
|
|
31
|
+
<div v-for="item in data" :key="item.label" class="flex items-center gap-3">
|
|
32
|
+
<span class="w-20 shrink-0 truncate text-xs text-neutral-500">{{ item.label }}</span>
|
|
33
|
+
<div class="flex-1">
|
|
34
|
+
<div class="h-5 overflow-hidden rounded-full bg-white/[0.04]">
|
|
35
|
+
<div
|
|
36
|
+
:class="['h-full rounded-full transition-all', barColor]"
|
|
37
|
+
:style="{ width: `${(item.value / maxValue) * 100}%`, opacity: 0.8 }"
|
|
38
|
+
></div>
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
41
|
+
<span class="w-10 text-right text-xs font-medium text-neutral-300">{{ item.value }}</span>
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|
|
44
|
+
<div v-else class="py-6 text-center text-sm text-neutral-500">No data available</div>
|
|
45
|
+
</div>
|
|
46
|
+
</template>
|
|
@@ -0,0 +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">· {{ customer.email }}</span>
|
|
115
|
+
<span v-if="customer.page_url" class="hidden md:inline truncate max-w-[200px]"
|
|
116
|
+
>· {{ 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>
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed, inject } from 'vue';
|
|
3
|
+
import { timeAgo } from '../utils/formatting';
|
|
4
|
+
import { highlightMentions } from '../utils/mentionHighlight';
|
|
5
|
+
import { sanitizeHtml } from '../utils/sanitizeHtml';
|
|
6
|
+
|
|
7
|
+
const props = defineProps({
|
|
8
|
+
message: { type: Object, required: true },
|
|
9
|
+
isAgent: { type: Boolean, default: false },
|
|
10
|
+
showAvatar: { type: Boolean, default: true },
|
|
11
|
+
showTimestamp: { type: Boolean, default: false },
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
const escDark = inject(
|
|
15
|
+
'esc-dark',
|
|
16
|
+
computed(() => false),
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
function attachmentUrl(att) {
|
|
20
|
+
if (att.url) return att.url;
|
|
21
|
+
if (typeof window.route === 'function') {
|
|
22
|
+
try {
|
|
23
|
+
return window.route('escalated.attachments.download', att.id);
|
|
24
|
+
} catch {
|
|
25
|
+
// route not registered
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return `/escalated/attachments/${att.id}/download`;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const initials = computed(() => {
|
|
32
|
+
const name = props.message.author?.name || 'U';
|
|
33
|
+
return name
|
|
34
|
+
.split(' ')
|
|
35
|
+
.map((w) => w[0])
|
|
36
|
+
.join('')
|
|
37
|
+
.toUpperCase()
|
|
38
|
+
.slice(0, 2);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
const formattedTime = computed(() => {
|
|
42
|
+
if (!props.message.created_at) return '';
|
|
43
|
+
const date = new Date(props.message.created_at);
|
|
44
|
+
const diffMs = Date.now() - date.getTime();
|
|
45
|
+
// If less than 24h, show relative; otherwise show absolute
|
|
46
|
+
if (diffMs < 86400000) {
|
|
47
|
+
return timeAgo(props.message.created_at);
|
|
48
|
+
}
|
|
49
|
+
return date.toLocaleString(undefined, {
|
|
50
|
+
month: 'short',
|
|
51
|
+
day: 'numeric',
|
|
52
|
+
hour: '2-digit',
|
|
53
|
+
minute: '2-digit',
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
const isInternalNote = computed(() => props.message.is_internal_note);
|
|
58
|
+
</script>
|
|
59
|
+
|
|
60
|
+
<template>
|
|
61
|
+
<div
|
|
62
|
+
:class="[
|
|
63
|
+
'flex gap-2',
|
|
64
|
+
isAgent ? 'flex-row-reverse' : 'flex-row',
|
|
65
|
+
!showAvatar && isAgent ? 'pr-10' : '',
|
|
66
|
+
!showAvatar && !isAgent ? 'pl-10' : '',
|
|
67
|
+
]"
|
|
68
|
+
:data-message-id="message.id"
|
|
69
|
+
>
|
|
70
|
+
<!-- Avatar -->
|
|
71
|
+
<div v-if="showAvatar" class="flex-shrink-0">
|
|
72
|
+
<div v-if="message.author?.avatar" class="h-8 w-8 overflow-hidden rounded-full">
|
|
73
|
+
<img :src="message.author.avatar" :alt="message.author.name" class="h-full w-full object-cover" />
|
|
74
|
+
</div>
|
|
75
|
+
<div
|
|
76
|
+
v-else
|
|
77
|
+
:class="[
|
|
78
|
+
'flex h-8 w-8 items-center justify-center rounded-full text-xs font-semibold',
|
|
79
|
+
isAgent
|
|
80
|
+
? escDark
|
|
81
|
+
? 'bg-cyan-500/20 text-cyan-400'
|
|
82
|
+
: 'bg-blue-100 text-blue-700'
|
|
83
|
+
: escDark
|
|
84
|
+
? 'bg-neutral-700 text-neutral-300'
|
|
85
|
+
: 'bg-gray-200 text-gray-600',
|
|
86
|
+
]"
|
|
87
|
+
>
|
|
88
|
+
{{ initials }}
|
|
89
|
+
</div>
|
|
90
|
+
</div>
|
|
91
|
+
|
|
92
|
+
<!-- Bubble -->
|
|
93
|
+
<div class="max-w-[75%]">
|
|
94
|
+
<div
|
|
95
|
+
:class="[
|
|
96
|
+
'rounded-2xl px-4 py-2 text-sm',
|
|
97
|
+
isInternalNote
|
|
98
|
+
? escDark
|
|
99
|
+
? 'bg-amber-500/10 text-amber-300 ring-1 ring-amber-500/20'
|
|
100
|
+
: 'bg-yellow-50 text-yellow-800 ring-1 ring-yellow-200'
|
|
101
|
+
: isAgent
|
|
102
|
+
? escDark
|
|
103
|
+
? 'bg-cyan-500/15 text-neutral-200'
|
|
104
|
+
: 'bg-blue-600 text-white'
|
|
105
|
+
: escDark
|
|
106
|
+
? 'bg-neutral-800 text-neutral-200'
|
|
107
|
+
: 'bg-gray-100 text-gray-900',
|
|
108
|
+
]"
|
|
109
|
+
>
|
|
110
|
+
<span v-if="isInternalNote" class="mb-1 block text-[10px] font-semibold uppercase opacity-70">
|
|
111
|
+
Internal Note
|
|
112
|
+
</span>
|
|
113
|
+
<p
|
|
114
|
+
class="whitespace-pre-wrap break-words"
|
|
115
|
+
v-html="highlightMentions(sanitizeHtml(message.body || ''), escDark)"
|
|
116
|
+
></p>
|
|
117
|
+
|
|
118
|
+
<!-- Attachments -->
|
|
119
|
+
<div v-if="message.attachments?.length" class="mt-2 space-y-1">
|
|
120
|
+
<a
|
|
121
|
+
v-for="att in message.attachments"
|
|
122
|
+
:key="att.id || att.url"
|
|
123
|
+
:href="attachmentUrl(att)"
|
|
124
|
+
target="_blank"
|
|
125
|
+
rel="noopener"
|
|
126
|
+
:class="[
|
|
127
|
+
'flex items-center gap-1 text-xs underline',
|
|
128
|
+
isAgent && !isInternalNote
|
|
129
|
+
? escDark
|
|
130
|
+
? 'text-cyan-300'
|
|
131
|
+
: 'text-blue-200'
|
|
132
|
+
: escDark
|
|
133
|
+
? 'text-cyan-400'
|
|
134
|
+
: 'text-blue-600',
|
|
135
|
+
]"
|
|
136
|
+
>
|
|
137
|
+
<svg class="h-3 w-3" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">
|
|
138
|
+
<path
|
|
139
|
+
stroke-linecap="round"
|
|
140
|
+
stroke-linejoin="round"
|
|
141
|
+
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"
|
|
142
|
+
/>
|
|
143
|
+
</svg>
|
|
144
|
+
{{ att.name || 'Attachment' }}
|
|
145
|
+
</a>
|
|
146
|
+
</div>
|
|
147
|
+
</div>
|
|
148
|
+
|
|
149
|
+
<!-- Timestamp -->
|
|
150
|
+
<div
|
|
151
|
+
v-if="showTimestamp"
|
|
152
|
+
:class="[
|
|
153
|
+
'mt-1 text-[10px]',
|
|
154
|
+
isAgent ? 'text-right' : 'text-left',
|
|
155
|
+
escDark ? 'text-neutral-600' : 'text-gray-400',
|
|
156
|
+
]"
|
|
157
|
+
>
|
|
158
|
+
{{ formattedTime }}
|
|
159
|
+
</div>
|
|
160
|
+
</div>
|
|
161
|
+
</div>
|
|
162
|
+
</template>
|