@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.
Files changed (179) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +31 -0
  3. package/package.json +12 -6
  4. package/src/components/ActiveChatsPanel.vue +246 -0
  5. package/src/components/ActivityTimeline.stories.js +55 -55
  6. package/src/components/ActivityTimeline.vue +83 -83
  7. package/src/components/AdminDashboard.stories.js +1423 -1095
  8. package/src/components/AgentLoadIndicator.stories.js +37 -37
  9. package/src/components/AgentLoadIndicator.vue +49 -49
  10. package/src/components/AgentPerformanceCard.vue +44 -44
  11. package/src/components/ArticleEditor.vue +82 -82
  12. package/src/components/AssigneeSelect.vue +37 -37
  13. package/src/components/AttachmentList.vue +13 -1
  14. package/src/components/AuditLogEntry.vue +95 -95
  15. package/src/components/BulkActionBar.vue +166 -166
  16. package/src/components/CategoryTree.vue +89 -89
  17. package/src/components/ChartWidget.vue +46 -46
  18. package/src/components/ChatActionBar.vue +226 -0
  19. package/src/components/ChatBubble.vue +162 -0
  20. package/src/components/ChatComposer.vue +308 -0
  21. package/src/components/ChatQueue.vue +222 -0
  22. package/src/components/ChatThread.vue +197 -0
  23. package/src/components/CollisionWarning.stories.js +30 -30
  24. package/src/components/CollisionWarning.vue +68 -68
  25. package/src/components/ConditionalFieldRules.vue +135 -135
  26. package/src/components/ContextPanel.vue +66 -66
  27. package/src/components/ContextPanelSection.vue +65 -65
  28. package/src/components/CustomFieldRenderer.vue +159 -159
  29. package/src/components/EscalatedLayout.vue +29 -6
  30. package/src/components/FileDropzone.vue +57 -57
  31. package/src/components/FollowButton.stories.js +30 -30
  32. package/src/components/FollowButton.vue +88 -88
  33. package/src/components/KeyboardShortcutHelp.vue +213 -213
  34. package/src/components/KnowledgePanel.vue +122 -122
  35. package/src/components/KpiCard.stories.js +32 -32
  36. package/src/components/KpiCard.vue +88 -88
  37. package/src/components/MacroDropdown.vue +150 -150
  38. package/src/components/MentionDropdown.vue +154 -0
  39. package/src/components/MetricComparison.vue +89 -0
  40. package/src/components/PercentileChart.vue +67 -0
  41. package/src/components/PeriodSelector.vue +98 -0
  42. package/src/components/PermissionMatrix.vue +107 -107
  43. package/src/components/PinnedNotes.vue +129 -129
  44. package/src/components/PluginSlot.vue +68 -62
  45. package/src/components/PresenceIndicator.vue +46 -2
  46. package/src/components/PriorityBadge.stories.js +33 -33
  47. package/src/components/PriorityBadge.vue +46 -46
  48. package/src/components/ReplyComposer.vue +81 -18
  49. package/src/components/ReplyThread.vue +40 -2
  50. package/src/components/ReportChart.vue +395 -0
  51. package/src/components/ReportExportButton.vue +108 -0
  52. package/src/components/SatisfactionRating.vue +180 -180
  53. package/src/components/SaveViewDialog.vue +172 -0
  54. package/src/components/SavedViewSidebar.vue +208 -0
  55. package/src/components/ScheduleEditor.vue +104 -104
  56. package/src/components/SideConversation.vue +165 -165
  57. package/src/components/SideConversationList.vue +147 -147
  58. package/src/components/SkillTagManager.vue +79 -79
  59. package/src/components/SlaComplianceChart.vue +46 -53
  60. package/src/components/SlaTimer.stories.js +35 -35
  61. package/src/components/SlaTimer.vue +62 -62
  62. package/src/components/SnoozeButton.vue +247 -0
  63. package/src/components/StatsCard.stories.js +24 -24
  64. package/src/components/StatsCard.vue +58 -58
  65. package/src/components/StatusBadge.stories.js +53 -53
  66. package/src/components/StatusBadge.vue +78 -78
  67. package/src/components/TagSelect.vue +84 -84
  68. package/src/components/TicketFilters.vue +270 -225
  69. package/src/components/TicketLinkPanel.vue +193 -193
  70. package/src/components/TicketList.vue +655 -594
  71. package/src/components/TicketMergeDialog.vue +157 -157
  72. package/src/components/TicketSplitDialog.vue +98 -0
  73. package/src/components/TotpInput.stories.js +9 -9
  74. package/src/components/TotpInput.vue +81 -81
  75. package/src/components/TwoFactorSetup.vue +113 -113
  76. package/src/components/VariableTokenInput.vue +111 -0
  77. package/src/components/WorkflowActionConfig.vue +287 -0
  78. package/src/components/WorkflowActionList.vue +350 -0
  79. package/src/components/WorkflowConditionBuilder.vue +265 -0
  80. package/src/components/WorkflowTriggerSelector.vue +125 -0
  81. package/src/composables/useChat.js +187 -0
  82. package/src/composables/useI18n.js +80 -80
  83. package/src/composables/useKeyboardShortcuts.js +46 -46
  84. package/src/composables/useMentions.js +134 -0
  85. package/src/composables/usePluginExtensions.js +159 -159
  86. package/src/composables/usePluginHooks.js +65 -65
  87. package/src/composables/useRealtime.js +182 -0
  88. package/src/defineEscalatedPlugin.js +76 -76
  89. package/src/index.js +84 -72
  90. package/src/locales/ar.json +727 -0
  91. package/src/locales/de.json +678 -430
  92. package/src/locales/en.json +717 -455
  93. package/src/locales/es.json +679 -430
  94. package/src/locales/fr.json +680 -431
  95. package/src/locales/index.js +12 -2
  96. package/src/locales/it.json +727 -0
  97. package/src/locales/ja.json +727 -0
  98. package/src/locales/ko.json +727 -0
  99. package/src/locales/nl.json +727 -0
  100. package/src/locales/pl.json +727 -0
  101. package/src/locales/pt-BR.json +727 -0
  102. package/src/locales/ru.json +727 -0
  103. package/src/locales/tr.json +727 -0
  104. package/src/locales/zh-CN.json +727 -0
  105. package/src/pages/Admin/ApiTokens/Index.vue +381 -381
  106. package/src/pages/Admin/AuditLog/Index.vue +154 -154
  107. package/src/pages/Admin/BusinessHours/Form.vue +172 -172
  108. package/src/pages/Admin/BusinessHours/Index.vue +113 -113
  109. package/src/pages/Admin/CannedResponses/Index.vue +127 -127
  110. package/src/pages/Admin/Capacity/Index.vue +134 -134
  111. package/src/pages/Admin/CustomFields/Form.vue +195 -195
  112. package/src/pages/Admin/CustomFields/Index.vue +134 -134
  113. package/src/pages/Admin/CustomObjects/Form.vue +202 -202
  114. package/src/pages/Admin/CustomObjects/Index.vue +127 -127
  115. package/src/pages/Admin/CustomObjects/Records.vue +228 -228
  116. package/src/pages/Admin/Departments/Form.vue +75 -75
  117. package/src/pages/Admin/Departments/Index.vue +110 -109
  118. package/src/pages/Admin/EscalationRules/Form.vue +157 -157
  119. package/src/pages/Admin/EscalationRules/Index.vue +178 -178
  120. package/src/pages/Admin/Import/Connect.vue +0 -1
  121. package/src/pages/Admin/Import/Index.vue +1 -1
  122. package/src/pages/Admin/Import/Progress.vue +1 -1
  123. package/src/pages/Admin/KnowledgeBase/Articles/Form.vue +142 -142
  124. package/src/pages/Admin/KnowledgeBase/Articles/Index.vue +195 -195
  125. package/src/pages/Admin/KnowledgeBase/Categories/Index.vue +193 -193
  126. package/src/pages/Admin/Macros/Index.vue +448 -448
  127. package/src/pages/Admin/Plugins/Index.vue +327 -327
  128. package/src/pages/Admin/Reports/AgentDetail.vue +132 -0
  129. package/src/pages/Admin/Reports/AgentMetrics.vue +115 -115
  130. package/src/pages/Admin/Reports/AgentRanking.vue +246 -0
  131. package/src/pages/Admin/Reports/Cohorts.vue +180 -0
  132. package/src/pages/Admin/Reports/Comparison.vue +141 -0
  133. package/src/pages/Admin/Reports/CsatReport.vue +127 -127
  134. package/src/pages/Admin/Reports/Dashboard.vue +36 -21
  135. package/src/pages/Admin/Reports/ResolutionTimes.vue +164 -0
  136. package/src/pages/Admin/Reports/ResponseTimes.vue +164 -0
  137. package/src/pages/Admin/Reports/SlaReport.vue +162 -166
  138. package/src/pages/Admin/Reports/SlaTrends.vue +183 -0
  139. package/src/pages/Admin/Reports.vue +206 -206
  140. package/src/pages/Admin/Roles/Form.vue +71 -71
  141. package/src/pages/Admin/Roles/Index.vue +122 -122
  142. package/src/pages/Admin/Settings/CsatSettings.vue +165 -165
  143. package/src/pages/Admin/Settings/DataRetention.vue +182 -182
  144. package/src/pages/Admin/Settings/EmailSettings.vue +243 -243
  145. package/src/pages/Admin/Settings/Sandbox.vue +135 -135
  146. package/src/pages/Admin/Settings/SsoSettings.vue +218 -218
  147. package/src/pages/Admin/Settings/TwoFactor.vue +110 -110
  148. package/src/pages/Admin/Settings.vue +1008 -468
  149. package/src/pages/Admin/Skills/Form.vue +53 -53
  150. package/src/pages/Admin/Skills/Index.vue +94 -94
  151. package/src/pages/Admin/SlaPolicies/Form.vue +118 -118
  152. package/src/pages/Admin/SlaPolicies/Index.vue +121 -120
  153. package/src/pages/Admin/Statuses/Form.vue +114 -114
  154. package/src/pages/Admin/Statuses/Index.vue +153 -153
  155. package/src/pages/Admin/Tags/Index.vue +191 -191
  156. package/src/pages/Admin/Tickets/Index.vue +126 -91
  157. package/src/pages/Admin/Tickets/Show.vue +29 -0
  158. package/src/pages/Admin/Webhooks/DeliveryLog.vue +120 -120
  159. package/src/pages/Admin/Webhooks/Form.vue +110 -110
  160. package/src/pages/Admin/Webhooks/Index.vue +136 -136
  161. package/src/pages/Admin/Workflows/Builder.vue +207 -0
  162. package/src/pages/Admin/Workflows/Index.vue +235 -0
  163. package/src/pages/Admin/Workflows/Logs.vue +286 -0
  164. package/src/pages/Agent/TicketIndex.vue +112 -88
  165. package/src/pages/Agent/TicketShow.vue +192 -60
  166. package/src/pages/Customer/Create.vue +1 -1
  167. package/src/pages/Customer/Index.vue +31 -31
  168. package/src/pages/Customer/KnowledgeBase/Article.vue +4 -2
  169. package/src/pages/Customer/KnowledgeBase/Index.vue +151 -151
  170. package/src/pages/Customer/Show.vue +69 -63
  171. package/src/pages/Guest/Create.vue +40 -15
  172. package/src/pages/Guest/Show.vue +124 -93
  173. package/src/plugin.js +25 -0
  174. package/src/utils/mentionHighlight.js +24 -0
  175. package/src/utils/sanitizeHtml.js +78 -64
  176. package/src/widget/EscalatedWidget.vue +804 -0
  177. package/src/widget/index.js +254 -0
  178. package/src/pages/Admin/Automations/Form.vue +0 -184
  179. package/src/pages/Admin/Automations/Index.vue +0 -129
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Escalated Dev
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Escalated Dev
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,20 @@
1
+ <p align="center">
2
+ <a href="docs/translations/README.ar.md">العربية</a> •
3
+ <a href="docs/translations/README.de.md">Deutsch</a> •
4
+ <b>English</b> •
5
+ <a href="docs/translations/README.es.md">Español</a> •
6
+ <a href="docs/translations/README.fr.md">Français</a> •
7
+ <a href="docs/translations/README.it.md">Italiano</a> •
8
+ <a href="docs/translations/README.ja.md">日本語</a> •
9
+ <a href="docs/translations/README.ko.md">한국어</a> •
10
+ <a href="docs/translations/README.nl.md">Nederlands</a> •
11
+ <a href="docs/translations/README.pl.md">Polski</a> •
12
+ <a href="docs/translations/README.pt-BR.md">Português (BR)</a> •
13
+ <a href="docs/translations/README.ru.md">Русский</a> •
14
+ <a href="docs/translations/README.tr.md">Türkçe</a> •
15
+ <a href="docs/translations/README.zh-CN.md">简体中文</a>
16
+ </p>
17
+
1
18
  <h1>
2
19
  <img src="https://escalated.dev/apple-touch-icon.png" width="28" style="vertical-align:middle;" />
3
20
  Escalated
@@ -8,12 +25,26 @@
8
25
  [![Vue 3](https://img.shields.io/badge/vue-3.x-4FC08D?logo=vue.js&logoColor=white)](https://vuejs.org/)
9
26
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
10
27
 
28
+ <p align="center">
29
+ <img src=".github/profile/demo.gif" alt="Escalated demo: filing a ticket and replying from the agent inbox" width="800" />
30
+ </p>
31
+
11
32
  Escalated is an embeddable support ticket system with SLA tracking, escalation rules, agent workflows, and a customer portal. This repo contains all the shared frontend assets (Vue 3 + Inertia.js) used across every supported backend framework.
12
33
 
13
34
  👉 **Learn more, view demos, and compare Cloud vs Self-Hosted options at** **[https://escalated.dev](https://escalated.dev)**
14
35
 
15
36
  **You don't install this package directly.** Start with the backend package for your framework — it handles everything including pulling in these frontend assets.
16
37
 
38
+ ## Features
39
+
40
+ - **Ticket splitting** — Split a reply into a new standalone ticket while preserving context
41
+ - **Ticket snooze** — Snooze tickets with presets (1h, 4h, tomorrow, next week) and automatic wake
42
+ - **Saved views / custom queues** — Save, name, and share filter presets as reusable ticket views
43
+ - **Embeddable support widget** — Drop-in `<script>` widget with KB search, ticket form, and status check
44
+ - **Real-time updates** — WebSocket support (Pusher/Reverb/Soketi) with automatic polling fallback
45
+ - **Knowledge base toggle** — Enable or disable the public knowledge base from admin settings
46
+ - **CI: ESLint + Prettier** — Automated code style enforcement on every pull request
47
+
17
48
  ## Get Started
18
49
 
19
50
  Pick your framework:
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@escalated-dev/escalated",
3
- "version": "0.7.0",
4
- "description": "Vue 3 + Inertia.js UI components for Escalated — the embeddable support ticket system",
3
+ "version": "0.7.1",
4
+ "description": "Vue 3 + Inertia.js UI components for Escalated \u00e2\u20ac\u201d the embeddable support ticket system",
5
5
  "author": "Escalated Dev <hello@escalated.dev>",
6
6
  "license": "MIT",
7
7
  "homepage": "https://github.com/escalated-dev/escalated",
@@ -29,19 +29,22 @@
29
29
  "src"
30
30
  ],
31
31
  "peerDependencies": {
32
- "@inertiajs/vue3": "^1.0.0 || ^2.0.0",
32
+ "@inertiajs/vue3": "^1.0.0 || ^2.0.0 || ^3.0.0",
33
33
  "vue": "^3.3.0"
34
34
  },
35
35
  "scripts": {
36
36
  "test": "vitest run",
37
- "lint": "eslint src/",
37
+ "lint": "eslint src/ --max-warnings 0",
38
38
  "lint:fix": "eslint src/ --fix",
39
39
  "format": "prettier --write src/",
40
40
  "format:check": "prettier --check src/",
41
41
  "prepare": "husky",
42
42
  "storybook": "storybook dev -p 6006",
43
43
  "build-storybook": "storybook build",
44
- "screenshot": "npx playwright test --config=playwright-screenshots.config.js"
44
+ "screenshot": "npx playwright test --config=playwright-screenshots.config.js",
45
+ "demo:serve": "node scripts/demo-server.js",
46
+ "demo:record": "node scripts/generate-demo.js",
47
+ "demo": "concurrently -k -s second \"npm run demo:serve\" \"wait-on http://localhost:3000 && npm run demo:record\""
45
48
  },
46
49
  "lint-staged": {
47
50
  "*.{js,vue}": [
@@ -59,17 +62,20 @@
59
62
  "@vitejs/plugin-vue": "^5.0.0",
60
63
  "@vue/test-utils": "^2.4.0",
61
64
  "autoprefixer": "^10.4.20",
65
+ "concurrently": "^9.0.0",
62
66
  "eslint": "^10.0.1",
63
67
  "eslint-plugin-storybook": "^10.2.12",
64
68
  "eslint-plugin-vue": "^10.8.0",
65
69
  "happy-dom": "^15.0.0",
66
70
  "husky": "^9.1.7",
67
71
  "lint-staged": "^16.2.7",
72
+ "playwright": "^1.50.0",
68
73
  "postcss": "^8.5.0",
69
74
  "prettier": "^3.8.1",
70
75
  "storybook": "^10.2.12",
71
76
  "tailwindcss": "^3.4.0",
72
77
  "vitest": "^2.0.0",
73
- "vue": "^3.5.0"
78
+ "vue": "^3.5.0",
79
+ "wait-on": "^8.0.0"
74
80
  }
75
81
  }
@@ -0,0 +1,246 @@
1
+ <script setup>
2
+ import { ref, computed, inject, onMounted, onUnmounted } from 'vue';
3
+ import { usePage } from '@inertiajs/vue3';
4
+ import { useI18n } from '../composables/useI18n';
5
+ import { useChat } from '../composables/useChat';
6
+ import { timeAgo } from '../utils/formatting';
7
+
8
+ const props = defineProps({
9
+ chats: { type: Array, default: () => [] },
10
+ agentId: { type: [String, Number], default: null },
11
+ agentStatus: { type: String, default: 'online' },
12
+ navigateRoute: { type: String, default: '' },
13
+ });
14
+
15
+ const emit = defineEmits(['navigate', 'status-change']);
16
+
17
+ const escDark = inject(
18
+ 'esc-dark',
19
+ computed(() => false),
20
+ );
21
+ const { t } = useI18n();
22
+
23
+ const isOpen = ref(false);
24
+ const currentStatus = ref(props.agentStatus);
25
+
26
+ const statusOptions = [
27
+ { value: 'online', label: 'Online', color: 'bg-emerald-500' },
28
+ { value: 'away', label: 'Away', color: 'bg-amber-500' },
29
+ { value: 'offline', label: 'Offline', color: 'bg-neutral-500' },
30
+ ];
31
+
32
+ const currentStatusOption = computed(
33
+ () => statusOptions.find((s) => s.value === currentStatus.value) || statusOptions[0],
34
+ );
35
+
36
+ function changeStatus(status) {
37
+ currentStatus.value = status;
38
+ emit('status-change', status);
39
+ }
40
+
41
+ const totalUnread = computed(() => {
42
+ return props.chats.reduce((sum, chat) => sum + (chat.unread_count || 0), 0);
43
+ });
44
+
45
+ // Activity state for each chat
46
+ const now = ref(Date.now());
47
+ let timerInterval = null;
48
+
49
+ onMounted(() => {
50
+ timerInterval = setInterval(() => {
51
+ now.value = Date.now();
52
+ }, 10000);
53
+ });
54
+
55
+ onUnmounted(() => {
56
+ clearInterval(timerInterval);
57
+ });
58
+
59
+ function chatActivityState(chat) {
60
+ if (!chat.last_message_at) return 'new';
61
+ const diffMs = now.value - new Date(chat.last_message_at).getTime();
62
+ if (diffMs > 2 * 60 * 1000) return 'idle';
63
+ return 'active';
64
+ }
65
+
66
+ function activityDotClass(chat) {
67
+ const state = chatActivityState(chat);
68
+ if (state === 'new') return 'bg-blue-500 animate-pulse';
69
+ if (state === 'idle') return 'bg-amber-500';
70
+ return 'bg-emerald-500';
71
+ }
72
+
73
+ function navigateToChat(chat) {
74
+ emit('navigate', chat);
75
+ }
76
+
77
+ function truncate(str, len = 40) {
78
+ if (!str) return '';
79
+ return str.length > len ? str.slice(0, len) + '...' : str;
80
+ }
81
+
82
+ function chatInitials(chat) {
83
+ const name = chat.customer_name || 'U';
84
+ return name
85
+ .split(' ')
86
+ .map((w) => w[0])
87
+ .join('')
88
+ .toUpperCase()
89
+ .slice(0, 2);
90
+ }
91
+
92
+ // Real-time: listen for new chats assigned to this agent. Read the
93
+ // host framework's route prefix from Inertia page props (default
94
+ // 'support') so chat API calls resolve correctly on NestJS backends
95
+ // that use '/escalated/widget' instead of '/support/widget'.
96
+ const page = usePage();
97
+ const routePrefix = page.props.escalated?.prefix || 'support';
98
+ const { subscribeToChatQueue } = useChat({ widgetPath: `/${routePrefix}/widget` });
99
+
100
+ onMounted(() => {
101
+ subscribeToChatQueue({
102
+ onNewChat() {
103
+ // Parent should refresh chat list
104
+ },
105
+ });
106
+ });
107
+ </script>
108
+
109
+ <template>
110
+ <!-- Toggle button -->
111
+ <button
112
+ :class="[
113
+ 'fixed right-4 bottom-20 z-40 flex h-12 w-12 items-center justify-center rounded-full shadow-lg transition-all',
114
+ escDark
115
+ ? 'bg-gradient-to-r from-cyan-500 to-violet-500 text-white hover:from-cyan-400 hover:to-violet-400'
116
+ : 'bg-blue-600 text-white hover:bg-blue-500',
117
+ ]"
118
+ :aria-label="isOpen ? t('chat.close_panel') : t('chat.open_panel')"
119
+ @click="isOpen = !isOpen"
120
+ >
121
+ <svg class="h-5 w-5" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">
122
+ <path
123
+ stroke-linecap="round"
124
+ stroke-linejoin="round"
125
+ d="M8.625 12a.375.375 0 11-.75 0 .375.375 0 01.75 0zm0 0H8.25m4.125 0a.375.375 0 11-.75 0 .375.375 0 01.75 0zm0 0H12m4.125 0a.375.375 0 11-.75 0 .375.375 0 01.75 0zm0 0h-.375M21 12c0 4.556-4.03 8.25-9 8.25a9.764 9.764 0 01-2.555-.337A5.972 5.972 0 015.41 20.97a5.969 5.969 0 01-.474-.065 4.48 4.48 0 00.978-2.025c.09-.457-.133-.901-.467-1.226C3.93 16.178 3 14.189 3 12c0-4.556 4.03-8.25 9-8.25s9 3.694 9 8.25z"
126
+ />
127
+ </svg>
128
+ <!-- Unread badge -->
129
+ <span
130
+ v-if="totalUnread > 0"
131
+ class="absolute -right-1 -top-1 flex h-5 min-w-[20px] items-center justify-center rounded-full bg-rose-500 px-1 text-[10px] font-bold text-white"
132
+ >
133
+ {{ totalUnread > 99 ? '99+' : totalUnread }}
134
+ </span>
135
+ </button>
136
+
137
+ <!-- Panel -->
138
+ <div
139
+ v-if="isOpen"
140
+ :class="[
141
+ 'fixed right-4 bottom-36 z-40 w-80 rounded-xl border shadow-2xl',
142
+ escDark ? 'border-white/[0.08] bg-neutral-900' : 'border-gray-200 bg-white',
143
+ ]"
144
+ style="max-height: calc(100vh - 200px)"
145
+ >
146
+ <!-- Header -->
147
+ <div
148
+ :class="[
149
+ 'flex items-center justify-between border-b px-4 py-3',
150
+ escDark ? 'border-white/[0.06]' : 'border-gray-200',
151
+ ]"
152
+ >
153
+ <div class="flex items-center gap-2">
154
+ <h3 :class="['text-sm font-semibold', escDark ? 'text-white' : 'text-gray-900']">
155
+ {{ t('chat.active_chats') }}
156
+ </h3>
157
+ <span
158
+ v-if="chats.length"
159
+ :class="[
160
+ 'rounded-full px-1.5 py-0.5 text-[10px] font-medium',
161
+ escDark ? 'bg-white/[0.06] text-neutral-400' : 'bg-gray-100 text-gray-500',
162
+ ]"
163
+ >
164
+ {{ chats.length }}
165
+ </span>
166
+ </div>
167
+ <!-- Status dropdown -->
168
+ <div class="relative">
169
+ <button
170
+ :class="[
171
+ 'flex items-center gap-1.5 rounded-lg px-2 py-1 text-xs font-medium transition-colors',
172
+ escDark ? 'hover:bg-white/[0.06] text-neutral-400' : 'hover:bg-gray-100 text-gray-500',
173
+ ]"
174
+ @click="
175
+ const idx = statusOptions.findIndex((s) => s.value === currentStatus);
176
+ changeStatus(statusOptions[(idx + 1) % statusOptions.length].value);
177
+ "
178
+ >
179
+ <span :class="['h-2 w-2 rounded-full', currentStatusOption.color]"></span>
180
+ {{ currentStatusOption.label }}
181
+ </button>
182
+ </div>
183
+ </div>
184
+
185
+ <!-- Chat list -->
186
+ <div class="overflow-y-auto" style="max-height: 400px">
187
+ <div
188
+ v-if="!chats.length"
189
+ :class="['p-6 text-center text-sm', escDark ? 'text-neutral-600' : 'text-gray-400']"
190
+ >
191
+ {{ t('chat.no_active_chats') }}
192
+ </div>
193
+ <button
194
+ v-for="chat in chats"
195
+ :key="chat.id"
196
+ :class="[
197
+ 'flex w-full items-start gap-3 px-4 py-3 text-left transition-colors',
198
+ escDark ? 'hover:bg-white/[0.04]' : 'hover:bg-gray-50',
199
+ ]"
200
+ @click="navigateToChat(chat)"
201
+ >
202
+ <!-- Avatar with status dot -->
203
+ <div class="relative flex-shrink-0">
204
+ <div
205
+ :class="[
206
+ 'flex h-9 w-9 items-center justify-center rounded-full text-xs font-semibold',
207
+ escDark ? 'bg-neutral-800 text-neutral-300' : 'bg-gray-200 text-gray-600',
208
+ ]"
209
+ >
210
+ {{ chatInitials(chat) }}
211
+ </div>
212
+ <span
213
+ :class="[
214
+ 'absolute -bottom-0.5 -right-0.5 h-3 w-3 rounded-full border-2',
215
+ escDark ? 'border-neutral-900' : 'border-white',
216
+ activityDotClass(chat),
217
+ ]"
218
+ ></span>
219
+ </div>
220
+
221
+ <!-- Chat info -->
222
+ <div class="min-w-0 flex-1">
223
+ <div class="flex items-center justify-between">
224
+ <span :class="['truncate text-sm font-medium', escDark ? 'text-neutral-200' : 'text-gray-900']">
225
+ {{ chat.customer_name || t('ticket.unknown') }}
226
+ </span>
227
+ <span :class="['flex-shrink-0 text-[10px]', escDark ? 'text-neutral-600' : 'text-gray-400']">
228
+ {{ chat.last_message_at ? timeAgo(chat.last_message_at) : '' }}
229
+ </span>
230
+ </div>
231
+ <div class="flex items-center justify-between">
232
+ <span :class="['truncate text-xs', escDark ? 'text-neutral-500' : 'text-gray-500']">
233
+ {{ truncate(chat.last_message) }}
234
+ </span>
235
+ <span
236
+ v-if="chat.unread_count"
237
+ class="ml-2 flex h-4 min-w-[16px] flex-shrink-0 items-center justify-center rounded-full bg-cyan-500 px-1 text-[10px] font-bold text-white"
238
+ >
239
+ {{ chat.unread_count }}
240
+ </span>
241
+ </div>
242
+ </div>
243
+ </button>
244
+ </div>
245
+ </div>
246
+ </template>
@@ -1,55 +1,55 @@
1
- import ActivityTimeline from './ActivityTimeline.vue';
2
-
3
- export default {
4
- title: 'Components/ActivityTimeline',
5
- component: ActivityTimeline,
6
- };
7
-
8
- const sampleActivities = [
9
- {
10
- id: 1,
11
- type: 'status_changed',
12
- causer: { name: 'Alice Chen' },
13
- properties: { from: 'open', to: 'in_progress' },
14
- created_at: new Date(Date.now() - 300000).toISOString(),
15
- },
16
- {
17
- id: 2,
18
- type: 'assigned',
19
- causer: { name: 'Bob Smith' },
20
- properties: { agent_name: 'Alice Chen' },
21
- created_at: new Date(Date.now() - 600000).toISOString(),
22
- },
23
- {
24
- id: 3,
25
- type: 'priority_changed',
26
- causer: { name: 'Alice Chen' },
27
- properties: { from: 'medium', to: 'high' },
28
- created_at: new Date(Date.now() - 1200000).toISOString(),
29
- },
30
- {
31
- id: 4,
32
- type: 'tag_added',
33
- causer: { name: 'Alice Chen' },
34
- properties: { tag: 'billing' },
35
- created_at: new Date(Date.now() - 1800000).toISOString(),
36
- },
37
- {
38
- id: 5,
39
- type: 'replied',
40
- causer: { name: 'Alice Chen' },
41
- properties: {},
42
- created_at: new Date(Date.now() - 2400000).toISOString(),
43
- },
44
- {
45
- id: 6,
46
- type: 'sla_breached',
47
- causer: null,
48
- properties: {},
49
- created_at: new Date(Date.now() - 3600000).toISOString(),
50
- },
51
- ];
52
-
53
- export const Default = { args: { activities: sampleActivities } };
54
- export const Empty = { args: { activities: [] } };
55
- export const SingleItem = { args: { activities: [sampleActivities[0]] } };
1
+ import ActivityTimeline from './ActivityTimeline.vue';
2
+
3
+ export default {
4
+ title: 'Components/ActivityTimeline',
5
+ component: ActivityTimeline,
6
+ };
7
+
8
+ const sampleActivities = [
9
+ {
10
+ id: 1,
11
+ type: 'status_changed',
12
+ causer: { name: 'Alice Chen' },
13
+ properties: { from: 'open', to: 'in_progress' },
14
+ created_at: new Date(Date.now() - 300000).toISOString(),
15
+ },
16
+ {
17
+ id: 2,
18
+ type: 'assigned',
19
+ causer: { name: 'Bob Smith' },
20
+ properties: { agent_name: 'Alice Chen' },
21
+ created_at: new Date(Date.now() - 600000).toISOString(),
22
+ },
23
+ {
24
+ id: 3,
25
+ type: 'priority_changed',
26
+ causer: { name: 'Alice Chen' },
27
+ properties: { from: 'medium', to: 'high' },
28
+ created_at: new Date(Date.now() - 1200000).toISOString(),
29
+ },
30
+ {
31
+ id: 4,
32
+ type: 'tag_added',
33
+ causer: { name: 'Alice Chen' },
34
+ properties: { tag: 'billing' },
35
+ created_at: new Date(Date.now() - 1800000).toISOString(),
36
+ },
37
+ {
38
+ id: 5,
39
+ type: 'replied',
40
+ causer: { name: 'Alice Chen' },
41
+ properties: {},
42
+ created_at: new Date(Date.now() - 2400000).toISOString(),
43
+ },
44
+ {
45
+ id: 6,
46
+ type: 'sla_breached',
47
+ causer: null,
48
+ properties: {},
49
+ created_at: new Date(Date.now() - 3600000).toISOString(),
50
+ },
51
+ ];
52
+
53
+ export const Default = { args: { activities: sampleActivities } };
54
+ export const Empty = { args: { activities: [] } };
55
+ export const SingleItem = { args: { activities: [sampleActivities[0]] } };