@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
@@ -1,150 +1,150 @@
1
- <script setup>
2
- import { ref, computed, inject } from 'vue';
3
- import { router } from '@inertiajs/vue3';
4
-
5
- const props = defineProps({
6
- macros: { type: Array, default: () => [] },
7
- action: { type: String, required: true },
8
- });
9
-
10
- const escDark = inject(
11
- 'esc-dark',
12
- computed(() => false),
13
- );
14
- const open = ref(false);
15
- const processing = ref(false);
16
-
17
- function applyMacro(macroId) {
18
- if (processing.value) return;
19
- processing.value = true;
20
- router.post(
21
- props.action,
22
- { macro_id: macroId },
23
- {
24
- preserveScroll: true,
25
- onFinish: () => {
26
- processing.value = false;
27
- open.value = false;
28
- },
29
- },
30
- );
31
- }
32
-
33
- function toggle() {
34
- open.value = !open.value;
35
- }
36
-
37
- function close() {
38
- open.value = false;
39
- }
40
- </script>
41
-
42
- <template>
43
- <div class="relative">
44
- <!-- Trigger button -->
45
- <button
46
- :class="[
47
- 'inline-flex items-center gap-2 rounded-lg px-3 py-2 text-sm font-medium transition-colors',
48
- escDark
49
- ? 'border border-[var(--esc-panel-border-input)] bg-[var(--esc-panel-hover)] text-[var(--esc-panel-text-secondary)] hover:bg-[var(--esc-panel-hover)]'
50
- : 'border border-gray-300 bg-white text-gray-700 hover:bg-gray-50',
51
- ]"
52
- :disabled="processing"
53
- aria-label="Apply macro"
54
- :aria-expanded="open"
55
- @click="toggle"
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="M3.75 13.5l10.5-11.25L12 10.5h8.25L9.75 21.75 12 13.5H3.75z"
62
- />
63
- </svg>
64
- Apply Macro
65
- <svg
66
- :class="['h-4 w-4 transition-transform', open && 'rotate-180']"
67
- fill="none"
68
- stroke="currentColor"
69
- stroke-width="1.5"
70
- viewBox="0 0 24 24"
71
- >
72
- <path stroke-linecap="round" stroke-linejoin="round" d="M19.5 8.25l-7.5 7.5-7.5-7.5" />
73
- </svg>
74
- </button>
75
-
76
- <!-- Backdrop -->
77
- <div v-if="open" class="fixed inset-0 z-30" @click="close"></div>
78
-
79
- <!-- Dropdown -->
80
- <Transition
81
- enter-active-class="transition duration-100 ease-out"
82
- enter-from-class="scale-95 opacity-0"
83
- enter-to-class="scale-100 opacity-100"
84
- leave-active-class="transition duration-75 ease-in"
85
- leave-from-class="scale-100 opacity-100"
86
- leave-to-class="scale-95 opacity-0"
87
- >
88
- <div
89
- v-if="open"
90
- :class="[
91
- 'absolute right-0 z-40 mt-1 w-64 overflow-hidden rounded-xl border shadow-xl',
92
- escDark
93
- ? 'border-[var(--esc-panel-border)] bg-[var(--esc-panel-surface)]'
94
- : 'border-gray-200 bg-white',
95
- ]"
96
- >
97
- <div
98
- :class="[
99
- 'px-3 py-2 text-xs font-semibold uppercase tracking-wider',
100
- escDark ? 'text-[var(--esc-panel-text-muted)]' : 'text-gray-500',
101
- ]"
102
- >
103
- Macros
104
- </div>
105
- <div class="max-h-64 overflow-y-auto" role="menu">
106
- <div
107
- v-if="!macros.length"
108
- :class="[
109
- 'px-3 py-4 text-center text-sm',
110
- escDark ? 'text-[var(--esc-panel-text-muted)]' : 'text-gray-400',
111
- ]"
112
- >
113
- No macros available
114
- </div>
115
- <button
116
- v-for="macro in macros"
117
- :key="macro.id"
118
- role="menuitem"
119
- :disabled="processing"
120
- :class="[
121
- 'flex w-full flex-col px-3 py-2.5 text-left transition-colors',
122
- escDark
123
- ? 'hover:bg-[var(--esc-panel-hover)] disabled:opacity-50'
124
- : 'hover:bg-gray-50 disabled:opacity-50',
125
- ]"
126
- @click="applyMacro(macro.id)"
127
- >
128
- <span
129
- :class="[
130
- 'text-sm font-medium',
131
- escDark ? 'text-[var(--esc-panel-text-secondary)]' : 'text-gray-900',
132
- ]"
133
- >
134
- {{ macro.name }}
135
- </span>
136
- <span
137
- v-if="macro.description"
138
- :class="[
139
- 'mt-0.5 text-xs',
140
- escDark ? 'text-[var(--esc-panel-text-muted)]' : 'text-gray-500',
141
- ]"
142
- >
143
- {{ macro.description }}
144
- </span>
145
- </button>
146
- </div>
147
- </div>
148
- </Transition>
149
- </div>
150
- </template>
1
+ <script setup>
2
+ import { ref, computed, inject } from 'vue';
3
+ import { router } from '@inertiajs/vue3';
4
+
5
+ const props = defineProps({
6
+ macros: { type: Array, default: () => [] },
7
+ action: { type: String, required: true },
8
+ });
9
+
10
+ const escDark = inject(
11
+ 'esc-dark',
12
+ computed(() => false),
13
+ );
14
+ const open = ref(false);
15
+ const processing = ref(false);
16
+
17
+ function applyMacro(macroId) {
18
+ if (processing.value) return;
19
+ processing.value = true;
20
+ router.post(
21
+ props.action,
22
+ { macro_id: macroId },
23
+ {
24
+ preserveScroll: true,
25
+ onFinish: () => {
26
+ processing.value = false;
27
+ open.value = false;
28
+ },
29
+ },
30
+ );
31
+ }
32
+
33
+ function toggle() {
34
+ open.value = !open.value;
35
+ }
36
+
37
+ function close() {
38
+ open.value = false;
39
+ }
40
+ </script>
41
+
42
+ <template>
43
+ <div class="relative">
44
+ <!-- Trigger button -->
45
+ <button
46
+ :class="[
47
+ 'inline-flex items-center gap-2 rounded-lg px-3 py-2 text-sm font-medium transition-colors',
48
+ escDark
49
+ ? 'border border-[var(--esc-panel-border-input)] bg-[var(--esc-panel-hover)] text-[var(--esc-panel-text-secondary)] hover:bg-[var(--esc-panel-hover)]'
50
+ : 'border border-gray-300 bg-white text-gray-700 hover:bg-gray-50',
51
+ ]"
52
+ :disabled="processing"
53
+ aria-label="Apply macro"
54
+ :aria-expanded="open"
55
+ @click="toggle"
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="M3.75 13.5l10.5-11.25L12 10.5h8.25L9.75 21.75 12 13.5H3.75z"
62
+ />
63
+ </svg>
64
+ Apply Macro
65
+ <svg
66
+ :class="['h-4 w-4 transition-transform', open && 'rotate-180']"
67
+ fill="none"
68
+ stroke="currentColor"
69
+ stroke-width="1.5"
70
+ viewBox="0 0 24 24"
71
+ >
72
+ <path stroke-linecap="round" stroke-linejoin="round" d="M19.5 8.25l-7.5 7.5-7.5-7.5" />
73
+ </svg>
74
+ </button>
75
+
76
+ <!-- Backdrop -->
77
+ <div v-if="open" class="fixed inset-0 z-30" @click="close"></div>
78
+
79
+ <!-- Dropdown -->
80
+ <Transition
81
+ enter-active-class="transition duration-100 ease-out"
82
+ enter-from-class="scale-95 opacity-0"
83
+ enter-to-class="scale-100 opacity-100"
84
+ leave-active-class="transition duration-75 ease-in"
85
+ leave-from-class="scale-100 opacity-100"
86
+ leave-to-class="scale-95 opacity-0"
87
+ >
88
+ <div
89
+ v-if="open"
90
+ :class="[
91
+ 'absolute right-0 z-40 mt-1 w-64 overflow-hidden rounded-xl border shadow-xl',
92
+ escDark
93
+ ? 'border-[var(--esc-panel-border)] bg-[var(--esc-panel-surface)]'
94
+ : 'border-gray-200 bg-white',
95
+ ]"
96
+ >
97
+ <div
98
+ :class="[
99
+ 'px-3 py-2 text-xs font-semibold uppercase tracking-wider',
100
+ escDark ? 'text-[var(--esc-panel-text-muted)]' : 'text-gray-500',
101
+ ]"
102
+ >
103
+ Macros
104
+ </div>
105
+ <div class="max-h-64 overflow-y-auto" role="menu">
106
+ <div
107
+ v-if="!macros.length"
108
+ :class="[
109
+ 'px-3 py-4 text-center text-sm',
110
+ escDark ? 'text-[var(--esc-panel-text-muted)]' : 'text-gray-400',
111
+ ]"
112
+ >
113
+ No macros available
114
+ </div>
115
+ <button
116
+ v-for="macro in macros"
117
+ :key="macro.id"
118
+ role="menuitem"
119
+ :disabled="processing"
120
+ :class="[
121
+ 'flex w-full flex-col px-3 py-2.5 text-left transition-colors',
122
+ escDark
123
+ ? 'hover:bg-[var(--esc-panel-hover)] disabled:opacity-50'
124
+ : 'hover:bg-gray-50 disabled:opacity-50',
125
+ ]"
126
+ @click="applyMacro(macro.id)"
127
+ >
128
+ <span
129
+ :class="[
130
+ 'text-sm font-medium',
131
+ escDark ? 'text-[var(--esc-panel-text-secondary)]' : 'text-gray-900',
132
+ ]"
133
+ >
134
+ {{ macro.name }}
135
+ </span>
136
+ <span
137
+ v-if="macro.description"
138
+ :class="[
139
+ 'mt-0.5 text-xs',
140
+ escDark ? 'text-[var(--esc-panel-text-muted)]' : 'text-gray-500',
141
+ ]"
142
+ >
143
+ {{ macro.description }}
144
+ </span>
145
+ </button>
146
+ </div>
147
+ </div>
148
+ </Transition>
149
+ </div>
150
+ </template>
@@ -0,0 +1,154 @@
1
+ <script setup>
2
+ import { ref, computed, inject, watch, nextTick } from 'vue';
3
+
4
+ const props = defineProps({
5
+ suggestions: { type: Array, default: () => [] },
6
+ visible: { type: Boolean, default: false },
7
+ loading: { type: Boolean, default: false },
8
+ });
9
+
10
+ const emit = defineEmits(['select', 'close']);
11
+
12
+ const escDark = inject(
13
+ 'esc-dark',
14
+ computed(() => false),
15
+ );
16
+
17
+ const activeIndex = ref(0);
18
+ const listRef = ref(null);
19
+
20
+ // Reset active index when suggestions change
21
+ watch(
22
+ () => props.suggestions,
23
+ () => {
24
+ activeIndex.value = 0;
25
+ },
26
+ );
27
+
28
+ function scrollActiveIntoView() {
29
+ nextTick(() => {
30
+ const list = listRef.value;
31
+ if (!list) return;
32
+ const item = list.children[activeIndex.value];
33
+ if (item) {
34
+ item.scrollIntoView({ block: 'nearest' });
35
+ }
36
+ });
37
+ }
38
+
39
+ function onKeydown(e) {
40
+ if (!props.visible) return false;
41
+
42
+ if (e.key === 'ArrowDown') {
43
+ e.preventDefault();
44
+ activeIndex.value = (activeIndex.value + 1) % props.suggestions.length;
45
+ scrollActiveIntoView();
46
+ return true;
47
+ }
48
+
49
+ if (e.key === 'ArrowUp') {
50
+ e.preventDefault();
51
+ activeIndex.value = (activeIndex.value - 1 + props.suggestions.length) % props.suggestions.length;
52
+ scrollActiveIntoView();
53
+ return true;
54
+ }
55
+
56
+ if (e.key === 'Enter' || e.key === 'Tab') {
57
+ if (props.suggestions.length > 0) {
58
+ e.preventDefault();
59
+ emit('select', props.suggestions[activeIndex.value]);
60
+ return true;
61
+ }
62
+ }
63
+
64
+ if (e.key === 'Escape') {
65
+ e.preventDefault();
66
+ emit('close');
67
+ return true;
68
+ }
69
+
70
+ return false;
71
+ }
72
+
73
+ function selectAgent(agent) {
74
+ emit('select', agent);
75
+ }
76
+
77
+ defineExpose({ onKeydown });
78
+ </script>
79
+
80
+ <template>
81
+ <div
82
+ v-if="visible && (suggestions.length > 0 || loading)"
83
+ :class="[
84
+ 'absolute z-50 w-64 max-h-48 overflow-y-auto rounded-lg border shadow-lg',
85
+ escDark ? 'border-white/10 bg-neutral-900 shadow-black/40' : 'border-gray-200 bg-white shadow-gray-200/50',
86
+ ]"
87
+ role="listbox"
88
+ aria-label="Agent suggestions"
89
+ >
90
+ <!-- Loading state -->
91
+ <div
92
+ v-if="loading && suggestions.length === 0"
93
+ :class="['px-3 py-2 text-xs', escDark ? 'text-neutral-500' : 'text-gray-400']"
94
+ >
95
+ Searching...
96
+ </div>
97
+
98
+ <!-- Suggestions list -->
99
+ <div ref="listRef">
100
+ <button
101
+ v-for="(agent, index) in suggestions"
102
+ :key="agent.id"
103
+ type="button"
104
+ role="option"
105
+ :aria-selected="index === activeIndex"
106
+ :class="[
107
+ 'flex w-full items-center gap-2 px-3 py-2 text-left text-sm transition-colors',
108
+ index === activeIndex
109
+ ? escDark
110
+ ? 'bg-white/[0.06] text-white'
111
+ : 'bg-blue-50 text-blue-900'
112
+ : escDark
113
+ ? 'text-neutral-300 hover:bg-white/[0.04]'
114
+ : 'text-gray-700 hover:bg-gray-50',
115
+ ]"
116
+ @click="selectAgent(agent)"
117
+ @mouseenter="activeIndex = index"
118
+ >
119
+ <!-- Avatar placeholder -->
120
+ <div
121
+ :class="[
122
+ 'flex h-7 w-7 flex-shrink-0 items-center justify-center rounded-full text-xs font-semibold',
123
+ escDark ? 'bg-cyan-500/20 text-cyan-400' : 'bg-blue-100 text-blue-700',
124
+ ]"
125
+ >
126
+ {{
127
+ (agent.name || '')
128
+ .split(' ')
129
+ .map((w) => w[0])
130
+ .join('')
131
+ .toUpperCase()
132
+ .slice(0, 2)
133
+ }}
134
+ </div>
135
+ <div class="min-w-0 flex-1">
136
+ <div :class="['truncate font-medium text-sm', escDark ? 'text-white' : 'text-gray-900']">
137
+ {{ agent.name }}
138
+ </div>
139
+ <div :class="['truncate text-xs', escDark ? 'text-neutral-500' : 'text-gray-500']">
140
+ {{ agent.email }}
141
+ </div>
142
+ </div>
143
+ </button>
144
+ </div>
145
+
146
+ <!-- No results -->
147
+ <div
148
+ v-if="!loading && suggestions.length === 0 && visible"
149
+ :class="['px-3 py-2 text-xs', escDark ? 'text-neutral-500' : 'text-gray-400']"
150
+ >
151
+ No agents found
152
+ </div>
153
+ </div>
154
+ </template>
@@ -0,0 +1,89 @@
1
+ <script setup>
2
+ import { computed } from 'vue';
3
+
4
+ const props = defineProps({
5
+ label: { type: String, required: true },
6
+ value: { type: [Number, String], required: true },
7
+ previousValue: { type: [Number, String], default: null },
8
+ format: { type: String, default: '' },
9
+ icon: { type: String, default: null },
10
+ invertColor: { type: Boolean, default: false },
11
+ });
12
+
13
+ const percentChange = computed(() => {
14
+ if (props.previousValue === null || props.previousValue === 0) return null;
15
+ const current = Number(props.value) || 0;
16
+ const previous = Number(props.previousValue) || 0;
17
+ if (previous === 0) return null;
18
+ return Math.round(((current - previous) / previous) * 100);
19
+ });
20
+
21
+ const changeDirection = computed(() => {
22
+ if (percentChange.value === null || percentChange.value === 0) return 'neutral';
23
+ return percentChange.value > 0 ? 'up' : 'down';
24
+ });
25
+
26
+ const changeColor = computed(() => {
27
+ if (changeDirection.value === 'neutral') return 'text-[var(--esc-panel-text-muted)]';
28
+ const isPositiveGood = !props.invertColor;
29
+ if (changeDirection.value === 'up') {
30
+ return isPositiveGood ? 'text-emerald-400' : 'text-red-400';
31
+ }
32
+ return isPositiveGood ? 'text-red-400' : 'text-emerald-400';
33
+ });
34
+ </script>
35
+
36
+ <template>
37
+ <div class="rounded-xl border border-[var(--esc-panel-border)] bg-[var(--esc-panel-surface)] p-5">
38
+ <div class="flex items-start justify-between">
39
+ <div>
40
+ <div class="text-[13px] font-medium text-[var(--esc-panel-text-muted)]">
41
+ {{ label }}
42
+ </div>
43
+ <div class="mt-2 text-2xl font-bold tracking-tight text-[var(--esc-panel-text)]">
44
+ {{ value }}{{ format }}
45
+ </div>
46
+ </div>
47
+ <div v-if="icon" class="flex h-10 w-10 items-center justify-center rounded-lg bg-[var(--esc-panel-hover)]">
48
+ <svg
49
+ class="h-5 w-5 text-[var(--esc-panel-text-muted)]"
50
+ fill="none"
51
+ stroke="currentColor"
52
+ stroke-width="1.5"
53
+ viewBox="0 0 24 24"
54
+ >
55
+ <path stroke-linecap="round" stroke-linejoin="round" :d="icon" />
56
+ </svg>
57
+ </div>
58
+ </div>
59
+ <div v-if="previousValue !== null" class="mt-3 flex items-center gap-2">
60
+ <div class="flex items-center gap-1" :class="changeColor">
61
+ <svg
62
+ v-if="changeDirection === 'up'"
63
+ class="h-4 w-4"
64
+ fill="none"
65
+ stroke="currentColor"
66
+ stroke-width="2"
67
+ viewBox="0 0 24 24"
68
+ >
69
+ <path stroke-linecap="round" stroke-linejoin="round" d="M4.5 19.5l15-15m0 0H8.25m11.25 0v11.25" />
70
+ </svg>
71
+ <svg
72
+ v-else-if="changeDirection === 'down'"
73
+ class="h-4 w-4"
74
+ fill="none"
75
+ stroke="currentColor"
76
+ stroke-width="2"
77
+ viewBox="0 0 24 24"
78
+ >
79
+ <path stroke-linecap="round" stroke-linejoin="round" d="M4.5 4.5l15 15m0 0V8.25m0 11.25H8.25" />
80
+ </svg>
81
+ <span v-else class="text-sm">--</span>
82
+ <span class="text-xs font-medium">
83
+ {{ percentChange !== null ? `${Math.abs(percentChange)}%` : '--' }}
84
+ </span>
85
+ </div>
86
+ <span class="text-xs text-[var(--esc-panel-text-muted)]"> vs {{ previousValue }}{{ format }} prev </span>
87
+ </div>
88
+ </div>
89
+ </template>
@@ -0,0 +1,67 @@
1
+ <script setup>
2
+ import { computed } from 'vue';
3
+
4
+ const props = defineProps({
5
+ title: { type: String, default: 'Percentile Distribution' },
6
+ percentiles: {
7
+ type: Object,
8
+ default: () => ({ p50: 0, p75: 0, p90: 0, p95: 0, p99: 0 }),
9
+ },
10
+ unit: { type: String, default: 'h' },
11
+ target: { type: Number, default: null },
12
+ });
13
+
14
+ const maxVal = computed(() => {
15
+ const vals = Object.values(props.percentiles);
16
+ return Math.max(...vals, 1);
17
+ });
18
+
19
+ const bars = computed(() => {
20
+ const entries = [
21
+ { key: 'p50', label: 'P50 (Median)', color: '#10b981' },
22
+ { key: 'p75', label: 'P75', color: '#f59e0b' },
23
+ { key: 'p90', label: 'P90', color: '#f97316' },
24
+ { key: 'p95', label: 'P95', color: '#ef4444' },
25
+ { key: 'p99', label: 'P99', color: '#dc2626' },
26
+ ];
27
+ return entries.map((e) => ({
28
+ ...e,
29
+ value: props.percentiles[e.key] || 0,
30
+ width: ((props.percentiles[e.key] || 0) / maxVal.value) * 100,
31
+ }));
32
+ });
33
+ </script>
34
+
35
+ <template>
36
+ <div class="rounded-xl border border-[var(--esc-panel-border)] bg-[var(--esc-panel-surface)] p-5">
37
+ <h3 v-if="title" class="mb-4 text-sm font-semibold text-[var(--esc-panel-text-secondary)]">{{ title }}</h3>
38
+ <div class="space-y-3">
39
+ <div v-for="bar in bars" :key="bar.key" class="flex items-center gap-3">
40
+ <span class="w-24 shrink-0 text-xs font-medium text-[var(--esc-panel-text-muted)]">
41
+ {{ bar.label }}
42
+ </span>
43
+ <div class="relative flex-1">
44
+ <div class="h-6 overflow-hidden rounded-full bg-[var(--esc-panel-hover)]">
45
+ <div
46
+ class="h-full rounded-full transition-all duration-700 ease-out"
47
+ :style="{ width: `${bar.width}%`, backgroundColor: bar.color }"
48
+ ></div>
49
+ </div>
50
+ <div
51
+ v-if="target !== null"
52
+ class="absolute top-0 h-6 w-0.5 bg-white/40"
53
+ :style="{ left: `${(target / maxVal) * 100}%` }"
54
+ :title="`Target: ${target}${unit}`"
55
+ ></div>
56
+ </div>
57
+ <span class="w-16 text-right text-xs font-bold text-[var(--esc-panel-text)]">
58
+ {{ bar.value }}{{ unit }}
59
+ </span>
60
+ </div>
61
+ </div>
62
+ <div v-if="target !== null" class="mt-3 flex items-center gap-2 text-xs text-[var(--esc-panel-text-muted)]">
63
+ <span class="inline-block h-3 w-0.5 bg-white/40"></span>
64
+ Target: {{ target }}{{ unit }}
65
+ </div>
66
+ </div>
67
+ </template>