@escalated-dev/escalated 0.6.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 (187) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +125 -2
  3. package/package.json +40 -5
  4. package/src/components/ActiveChatsPanel.vue +246 -0
  5. package/src/components/ActivityTimeline.stories.js +55 -0
  6. package/src/components/ActivityTimeline.vue +83 -66
  7. package/src/components/AdminDashboard.stories.js +1423 -0
  8. package/src/components/AgentLoadIndicator.stories.js +37 -0
  9. package/src/components/AgentLoadIndicator.vue +49 -0
  10. package/src/components/AgentPerformanceCard.vue +44 -0
  11. package/src/components/ArticleEditor.vue +82 -0
  12. package/src/components/AssigneeSelect.vue +37 -23
  13. package/src/components/AttachmentList.vue +65 -37
  14. package/src/components/AuditLogEntry.vue +95 -0
  15. package/src/components/BulkActionBar.vue +166 -97
  16. package/src/components/CategoryTree.vue +89 -0
  17. package/src/components/ChartWidget.vue +46 -0
  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 -0
  24. package/src/components/CollisionWarning.vue +68 -0
  25. package/src/components/ConditionalFieldRules.vue +135 -0
  26. package/src/components/ContextPanel.vue +66 -0
  27. package/src/components/ContextPanelSection.vue +65 -0
  28. package/src/components/CustomFieldRenderer.vue +159 -0
  29. package/src/components/EscalatedLayout.vue +424 -70
  30. package/src/components/FileDropzone.vue +57 -41
  31. package/src/components/FollowButton.stories.js +30 -0
  32. package/src/components/FollowButton.vue +88 -63
  33. package/src/components/KeyboardShortcutHelp.vue +213 -123
  34. package/src/components/KnowledgePanel.vue +122 -0
  35. package/src/components/KpiCard.stories.js +32 -0
  36. package/src/components/KpiCard.vue +88 -0
  37. package/src/components/MacroDropdown.vue +150 -90
  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 -0
  43. package/src/components/PinnedNotes.vue +129 -90
  44. package/src/components/PluginSlot.vue +68 -62
  45. package/src/components/PresenceIndicator.vue +138 -28
  46. package/src/components/PriorityBadge.stories.js +33 -0
  47. package/src/components/PriorityBadge.vue +46 -39
  48. package/src/components/QuickFilters.vue +65 -49
  49. package/src/components/ReplyComposer.vue +207 -30
  50. package/src/components/ReplyThread.vue +111 -21
  51. package/src/components/ReportChart.vue +395 -0
  52. package/src/components/ReportExportButton.vue +108 -0
  53. package/src/components/SatisfactionRating.vue +180 -128
  54. package/src/components/SaveViewDialog.vue +172 -0
  55. package/src/components/SavedViewSidebar.vue +208 -0
  56. package/src/components/ScheduleEditor.vue +104 -0
  57. package/src/components/SideConversation.vue +165 -0
  58. package/src/components/SideConversationList.vue +147 -0
  59. package/src/components/SkillTagManager.vue +79 -0
  60. package/src/components/SlaComplianceChart.vue +46 -0
  61. package/src/components/SlaTimer.stories.js +35 -0
  62. package/src/components/SlaTimer.vue +62 -49
  63. package/src/components/SnoozeButton.vue +247 -0
  64. package/src/components/StatsCard.stories.js +24 -0
  65. package/src/components/StatsCard.vue +18 -6
  66. package/src/components/StatusBadge.stories.js +53 -0
  67. package/src/components/StatusBadge.vue +78 -46
  68. package/src/components/TagSelect.vue +84 -53
  69. package/src/components/TicketFilters.vue +247 -46
  70. package/src/components/TicketLinkPanel.vue +193 -0
  71. package/src/components/TicketList.vue +536 -74
  72. package/src/components/TicketMergeDialog.vue +157 -0
  73. package/src/components/TicketSidebar.vue +167 -99
  74. package/src/components/TicketSplitDialog.vue +98 -0
  75. package/src/components/TicketTypeSelector.vue +21 -0
  76. package/src/components/TotpInput.stories.js +9 -0
  77. package/src/components/TotpInput.vue +81 -0
  78. package/src/components/TwoFactorSetup.vue +113 -0
  79. package/src/components/VariableTokenInput.vue +111 -0
  80. package/src/components/WorkflowActionConfig.vue +287 -0
  81. package/src/components/WorkflowActionList.vue +350 -0
  82. package/src/components/WorkflowConditionBuilder.vue +265 -0
  83. package/src/components/WorkflowTriggerSelector.vue +125 -0
  84. package/src/composables/useChat.js +187 -0
  85. package/src/composables/useDebouncedSearch.js +38 -0
  86. package/src/composables/useI18n.js +80 -80
  87. package/src/composables/useKeyboardShortcuts.js +46 -46
  88. package/src/composables/useMentions.js +134 -0
  89. package/src/composables/usePluginExtensions.js +159 -67
  90. package/src/composables/usePluginHooks.js +65 -0
  91. package/src/composables/useRealtime.js +182 -0
  92. package/src/defineEscalatedPlugin.js +76 -50
  93. package/src/index.js +77 -28
  94. package/src/locales/ar.json +727 -0
  95. package/src/locales/de.json +678 -430
  96. package/src/locales/en.json +717 -430
  97. package/src/locales/es.json +679 -430
  98. package/src/locales/fr.json +680 -431
  99. package/src/locales/index.js +12 -2
  100. package/src/locales/it.json +727 -0
  101. package/src/locales/ja.json +727 -0
  102. package/src/locales/ko.json +727 -0
  103. package/src/locales/nl.json +727 -0
  104. package/src/locales/pl.json +727 -0
  105. package/src/locales/pt-BR.json +727 -0
  106. package/src/locales/ru.json +727 -0
  107. package/src/locales/tr.json +727 -0
  108. package/src/locales/zh-CN.json +727 -0
  109. package/src/pages/Admin/ApiTokens/Index.vue +381 -217
  110. package/src/pages/Admin/AuditLog/Index.vue +154 -0
  111. package/src/pages/Admin/BusinessHours/Form.vue +172 -0
  112. package/src/pages/Admin/BusinessHours/Index.vue +113 -0
  113. package/src/pages/Admin/CannedResponses/Index.vue +82 -25
  114. package/src/pages/Admin/Capacity/Index.vue +134 -0
  115. package/src/pages/Admin/CustomFields/Form.vue +195 -0
  116. package/src/pages/Admin/CustomFields/Index.vue +134 -0
  117. package/src/pages/Admin/CustomObjects/Form.vue +202 -0
  118. package/src/pages/Admin/CustomObjects/Index.vue +127 -0
  119. package/src/pages/Admin/CustomObjects/Records.vue +228 -0
  120. package/src/pages/Admin/Departments/Form.vue +35 -11
  121. package/src/pages/Admin/Departments/Index.vue +74 -21
  122. package/src/pages/Admin/EscalationRules/Form.vue +86 -25
  123. package/src/pages/Admin/EscalationRules/Index.vue +158 -37
  124. package/src/pages/Admin/Import/Connect.vue +95 -0
  125. package/src/pages/Admin/Import/Index.vue +102 -0
  126. package/src/pages/Admin/Import/Mapping.vue +110 -0
  127. package/src/pages/Admin/Import/Progress.vue +153 -0
  128. package/src/pages/Admin/Import/Review.vue +76 -0
  129. package/src/pages/Admin/KnowledgeBase/Articles/Form.vue +142 -0
  130. package/src/pages/Admin/KnowledgeBase/Articles/Index.vue +195 -0
  131. package/src/pages/Admin/KnowledgeBase/Categories/Index.vue +193 -0
  132. package/src/pages/Admin/Macros/Index.vue +448 -287
  133. package/src/pages/Admin/Plugins/Index.vue +327 -197
  134. package/src/pages/Admin/Reports/AgentDetail.vue +132 -0
  135. package/src/pages/Admin/Reports/AgentMetrics.vue +115 -0
  136. package/src/pages/Admin/Reports/AgentRanking.vue +246 -0
  137. package/src/pages/Admin/Reports/Cohorts.vue +180 -0
  138. package/src/pages/Admin/Reports/Comparison.vue +141 -0
  139. package/src/pages/Admin/Reports/CsatReport.vue +127 -0
  140. package/src/pages/Admin/Reports/Dashboard.vue +226 -0
  141. package/src/pages/Admin/Reports/ResolutionTimes.vue +164 -0
  142. package/src/pages/Admin/Reports/ResponseTimes.vue +164 -0
  143. package/src/pages/Admin/Reports/SlaReport.vue +162 -0
  144. package/src/pages/Admin/Reports/SlaTrends.vue +183 -0
  145. package/src/pages/Admin/Reports.vue +206 -101
  146. package/src/pages/Admin/Roles/Form.vue +71 -0
  147. package/src/pages/Admin/Roles/Index.vue +122 -0
  148. package/src/pages/Admin/Settings/CsatSettings.vue +165 -0
  149. package/src/pages/Admin/Settings/DataRetention.vue +182 -0
  150. package/src/pages/Admin/Settings/EmailSettings.vue +243 -0
  151. package/src/pages/Admin/Settings/Sandbox.vue +135 -0
  152. package/src/pages/Admin/Settings/SsoSettings.vue +218 -0
  153. package/src/pages/Admin/Settings/TwoFactor.vue +110 -0
  154. package/src/pages/Admin/Settings.vue +847 -99
  155. package/src/pages/Admin/Skills/Form.vue +53 -0
  156. package/src/pages/Admin/Skills/Index.vue +94 -0
  157. package/src/pages/Admin/SlaPolicies/Form.vue +62 -19
  158. package/src/pages/Admin/SlaPolicies/Index.vue +85 -23
  159. package/src/pages/Admin/Statuses/Form.vue +114 -0
  160. package/src/pages/Admin/Statuses/Index.vue +153 -0
  161. package/src/pages/Admin/Tags/Index.vue +121 -35
  162. package/src/pages/Admin/Tickets/Index.vue +96 -9
  163. package/src/pages/Admin/Tickets/Show.vue +130 -37
  164. package/src/pages/Admin/Webhooks/DeliveryLog.vue +120 -0
  165. package/src/pages/Admin/Webhooks/Form.vue +110 -0
  166. package/src/pages/Admin/Webhooks/Index.vue +136 -0
  167. package/src/pages/Admin/Workflows/Builder.vue +207 -0
  168. package/src/pages/Admin/Workflows/Index.vue +235 -0
  169. package/src/pages/Admin/Workflows/Logs.vue +286 -0
  170. package/src/pages/Agent/Dashboard.vue +311 -186
  171. package/src/pages/Agent/TicketIndex.vue +80 -6
  172. package/src/pages/Agent/TicketShow.vue +399 -60
  173. package/src/pages/Customer/Create.vue +37 -10
  174. package/src/pages/Customer/Index.vue +9 -2
  175. package/src/pages/Customer/KnowledgeBase/Article.vue +129 -0
  176. package/src/pages/Customer/KnowledgeBase/Index.vue +151 -0
  177. package/src/pages/Customer/Show.vue +69 -63
  178. package/src/pages/Guest/Create.vue +40 -15
  179. package/src/pages/Guest/Show.vue +124 -93
  180. package/src/plugin.js +111 -1
  181. package/src/utils/constants.js +30 -0
  182. package/src/utils/formatting.js +35 -0
  183. package/src/utils/mentionHighlight.js +24 -0
  184. package/src/utils/sanitizeHtml.js +78 -64
  185. package/src/widget/EscalatedWidget.vue +804 -0
  186. package/src/widget/index.js +254 -0
  187. package/src/pages/Admin/Plugins.vue +0 -129
@@ -0,0 +1,157 @@
1
+ <script setup>
2
+ import { ref, watch } from 'vue';
3
+ import { router } from '@inertiajs/vue3';
4
+
5
+ const props = defineProps({
6
+ ticketReference: { type: String, required: true },
7
+ });
8
+
9
+ const emit = defineEmits(['close']);
10
+
11
+ const searchTerm = ref('');
12
+ const results = ref([]);
13
+ const loading = ref(false);
14
+ const selectedTicket = ref(null);
15
+ const merging = ref(false);
16
+ let debounceTimer = null;
17
+
18
+ watch(searchTerm, (val) => {
19
+ window.clearTimeout(debounceTimer);
20
+ selectedTicket.value = null;
21
+ if (!val || val.length < 2) {
22
+ results.value = [];
23
+ return;
24
+ }
25
+ debounceTimer = window.setTimeout(() => searchTickets(val), 300);
26
+ });
27
+
28
+ async function searchTickets(term) {
29
+ loading.value = true;
30
+ try {
31
+ const response = await fetch(route('escalated.admin.tickets.merge-search', { q: term }), {
32
+ headers: {
33
+ Accept: 'application/json',
34
+ 'X-Requested-With': 'XMLHttpRequest',
35
+ 'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]')?.content || '',
36
+ },
37
+ });
38
+ if (response.ok) {
39
+ const data = await response.json();
40
+ results.value = (data.tickets || []).filter((t) => t.reference !== props.ticketReference);
41
+ }
42
+ } catch {
43
+ // silently ignore
44
+ } finally {
45
+ loading.value = false;
46
+ }
47
+ }
48
+
49
+ function selectTicket(ticket) {
50
+ selectedTicket.value = ticket;
51
+ }
52
+
53
+ function confirmMerge() {
54
+ if (!selectedTicket.value || merging.value) return;
55
+ merging.value = true;
56
+
57
+ router.post(
58
+ route('escalated.admin.tickets.merge', props.ticketReference),
59
+ {
60
+ target_reference: selectedTicket.value.reference,
61
+ },
62
+ {
63
+ preserveScroll: true,
64
+ onSuccess: () => {
65
+ emit('close');
66
+ },
67
+ onFinish: () => {
68
+ merging.value = false;
69
+ },
70
+ },
71
+ );
72
+ }
73
+ </script>
74
+
75
+ <template>
76
+ <Teleport to="body">
77
+ <div
78
+ class="fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm"
79
+ @click.self="emit('close')"
80
+ >
81
+ <div class="w-full max-w-lg rounded-xl border border-white/[0.06] bg-neutral-900 p-6 shadow-2xl">
82
+ <div class="mb-4 flex items-center justify-between">
83
+ <h3 class="text-lg font-semibold text-neutral-200">Merge Ticket</h3>
84
+ <button class="text-neutral-500 hover:text-neutral-300" @click="emit('close')">
85
+ <svg class="h-5 w-5" fill="none" stroke="currentColor" stroke-width="1.5" viewBox="0 0 24 24">
86
+ <path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" />
87
+ </svg>
88
+ </button>
89
+ </div>
90
+
91
+ <p class="mb-4 text-sm text-neutral-400">
92
+ Search for a ticket to merge
93
+ <span class="font-mono text-neutral-300">{{ ticketReference }}</span> into. All replies will be
94
+ moved to the target ticket and this ticket will be closed.
95
+ </p>
96
+
97
+ <input
98
+ v-model="searchTerm"
99
+ type="text"
100
+ placeholder="Search by reference or subject..."
101
+ class="w-full rounded-lg border border-white/10 bg-neutral-950 px-3 py-2 text-sm text-neutral-200 placeholder-neutral-500 focus:border-white/20 focus:outline-none focus:ring-1 focus:ring-white/10"
102
+ />
103
+
104
+ <div v-if="loading" class="mt-3 text-center text-sm text-neutral-500">Searching...</div>
105
+
106
+ <div v-else-if="results.length" class="mt-3 max-h-48 space-y-1 overflow-y-auto">
107
+ <button
108
+ v-for="ticket in results"
109
+ :key="ticket.id"
110
+ :class="[
111
+ 'w-full rounded-lg px-3 py-2 text-left text-sm transition-colors',
112
+ selectedTicket?.id === ticket.id
113
+ ? 'bg-cyan-500/15 ring-1 ring-cyan-500/20 text-neutral-200'
114
+ : 'text-neutral-300 hover:bg-white/[0.04]',
115
+ ]"
116
+ @click="selectTicket(ticket)"
117
+ >
118
+ <span class="font-mono text-xs text-neutral-400">{{ ticket.reference }}</span>
119
+ <span class="ml-2">{{ ticket.subject }}</span>
120
+ </button>
121
+ </div>
122
+
123
+ <div v-else-if="searchTerm.length >= 2 && !loading" class="mt-3 text-center text-sm text-neutral-500">
124
+ No matching tickets found.
125
+ </div>
126
+
127
+ <!-- Selected ticket preview -->
128
+ <div v-if="selectedTicket" class="mt-4 rounded-lg border border-white/[0.06] bg-white/[0.02] p-3">
129
+ <p class="text-xs font-semibold uppercase tracking-wider text-neutral-500">Merge into</p>
130
+ <p class="mt-1 text-sm text-neutral-200">
131
+ <span class="font-mono text-neutral-400">{{ selectedTicket.reference }}</span>
132
+ &mdash; {{ selectedTicket.subject }}
133
+ </p>
134
+ </div>
135
+
136
+ <div class="mt-5 flex justify-end gap-3">
137
+ <button
138
+ class="rounded-lg border border-white/10 bg-white/[0.03] px-4 py-2 text-sm font-medium text-neutral-300 transition-colors hover:bg-white/[0.06]"
139
+ @click="emit('close')"
140
+ >
141
+ Cancel
142
+ </button>
143
+ <button
144
+ :disabled="!selectedTicket || merging"
145
+ :class="[
146
+ 'rounded-lg bg-gradient-to-r from-cyan-500 to-violet-500 px-4 py-2 text-sm font-medium text-white shadow-lg shadow-black/20 transition-all hover:from-cyan-400 hover:to-violet-400',
147
+ (!selectedTicket || merging) && 'cursor-not-allowed opacity-40',
148
+ ]"
149
+ @click="confirmMerge"
150
+ >
151
+ {{ merging ? 'Merging...' : 'Confirm Merge' }}
152
+ </button>
153
+ </div>
154
+ </div>
155
+ </div>
156
+ </Teleport>
157
+ </template>
@@ -1,99 +1,167 @@
1
- <script setup>
2
- import { inject, computed } from 'vue';
3
- import StatusBadge from './StatusBadge.vue';
4
- import PriorityBadge from './PriorityBadge.vue';
5
- import SlaTimer from './SlaTimer.vue';
6
- import AssigneeSelect from './AssigneeSelect.vue';
7
- import TagSelect from './TagSelect.vue';
8
- import ActivityTimeline from './ActivityTimeline.vue';
9
-
10
- defineProps({
11
- ticket: { type: Object, required: true },
12
- agents: { type: Array, default: () => [] },
13
- tags: { type: Array, default: () => [] },
14
- activities: { type: Array, default: () => [] },
15
- editable: { type: Boolean, default: false },
16
- });
17
-
18
- const emit = defineEmits(['assign', 'tags', 'priority', 'department', 'status']);
19
- const escDark = inject('esc-dark', computed(() => false));
20
-
21
- const cardClass = computed(() => escDark.value
22
- ? 'rounded-xl border border-white/[0.06] bg-neutral-900/60 p-4'
23
- : 'rounded-lg border border-gray-200 bg-white p-4'
24
- );
25
-
26
- function renderStars(rating) {
27
- return Array.from({ length: 5 }, (_, i) => i < rating ? 'filled' : 'empty');
28
- }
29
- </script>
30
-
31
- <template>
32
- <aside class="space-y-4">
33
- <div :class="cardClass">
34
- <h3 :class="['mb-3 text-sm font-semibold', escDark ? 'text-white' : 'text-gray-900']">Details</h3>
35
- <dl class="space-y-2 text-sm">
36
- <div class="flex justify-between">
37
- <dt :class="escDark ? 'text-neutral-500' : 'text-gray-500'">Status</dt>
38
- <dd><StatusBadge :status="ticket.status" /></dd>
39
- </div>
40
- <div class="flex justify-between">
41
- <dt :class="escDark ? 'text-neutral-500' : 'text-gray-500'">Priority</dt>
42
- <dd><PriorityBadge :priority="ticket.priority" /></dd>
43
- </div>
44
- <div class="flex justify-between">
45
- <dt :class="escDark ? 'text-neutral-500' : 'text-gray-500'">Reference</dt>
46
- <dd :class="['font-mono text-xs', escDark ? 'text-white' : '']">{{ ticket.reference }}</dd>
47
- </div>
48
- <div v-if="ticket.department" class="flex justify-between">
49
- <dt :class="escDark ? 'text-neutral-500' : 'text-gray-500'">Department</dt>
50
- <dd :class="escDark ? 'text-neutral-300' : ''">{{ ticket.department.name }}</dd>
51
- </div>
52
- <div class="flex justify-between">
53
- <dt :class="escDark ? 'text-neutral-500' : 'text-gray-500'">Created</dt>
54
- <dd :class="escDark ? 'text-neutral-300' : ''">{{ new Date(ticket.created_at).toLocaleDateString() }}</dd>
55
- </div>
56
- </dl>
57
- </div>
58
-
59
- <!-- Satisfaction Rating (read-only) -->
60
- <div v-if="ticket.satisfaction_rating" :class="cardClass">
61
- <h3 :class="['mb-3 text-sm font-semibold', escDark ? 'text-white' : 'text-gray-900']">Customer Satisfaction</h3>
62
- <div class="flex items-center gap-1">
63
- <svg v-for="(star, i) in renderStars(ticket.satisfaction_rating.rating)" :key="i"
64
- class="h-5 w-5" :class="star === 'filled' ? 'text-amber-400' : (escDark ? 'text-neutral-700' : 'text-gray-300')"
65
- fill="currentColor" viewBox="0 0 20 20">
66
- <path d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z" />
67
- </svg>
68
- <span :class="['ml-2 text-sm font-medium', escDark ? 'text-neutral-300' : 'text-gray-700']">
69
- {{ ticket.satisfaction_rating.rating }}/5
70
- </span>
71
- </div>
72
- <p v-if="ticket.satisfaction_rating.comment" :class="['mt-2 text-xs italic', escDark ? 'text-neutral-500' : 'text-gray-500']">
73
- "{{ ticket.satisfaction_rating.comment }}"
74
- </p>
75
- </div>
76
-
77
- <div v-if="ticket.first_response_due_at || ticket.resolution_due_at" class="space-y-2">
78
- <SlaTimer v-if="ticket.first_response_due_at" :due-at="ticket.first_response_due_at"
79
- :breached="ticket.sla_first_response_breached" label="First Response" />
80
- <SlaTimer v-if="ticket.resolution_due_at" :due-at="ticket.resolution_due_at"
81
- :breached="ticket.sla_resolution_breached" label="Resolution" />
82
- </div>
83
-
84
- <div v-if="editable && agents.length" :class="cardClass">
85
- <AssigneeSelect :agents="agents" :model-value="ticket.assigned_to"
86
- @update:model-value="emit('assign', $event)" />
87
- </div>
88
-
89
- <div v-if="editable && tags.length" :class="cardClass">
90
- <TagSelect :tags="tags" :model-value="(ticket.tags || []).map(t => t.id)"
91
- @update:model-value="emit('tags', $event)" />
92
- </div>
93
-
94
- <div v-if="activities.length" :class="cardClass">
95
- <h3 :class="['mb-3 text-sm font-semibold', escDark ? 'text-white' : 'text-gray-900']">Activity</h3>
96
- <ActivityTimeline :activities="activities" />
97
- </div>
98
- </aside>
99
- </template>
1
+ <script setup>
2
+ import { inject, computed } from 'vue';
3
+ import StatusBadge from './StatusBadge.vue';
4
+ import PriorityBadge from './PriorityBadge.vue';
5
+ import SlaTimer from './SlaTimer.vue';
6
+ import AssigneeSelect from './AssigneeSelect.vue';
7
+ import TagSelect from './TagSelect.vue';
8
+ import TicketTypeSelector from './TicketTypeSelector.vue';
9
+ import ActivityTimeline from './ActivityTimeline.vue';
10
+
11
+ defineProps({
12
+ ticket: { type: Object, required: true },
13
+ agents: { type: Array, default: () => [] },
14
+ tags: { type: Array, default: () => [] },
15
+ activities: { type: Array, default: () => [] },
16
+ editable: { type: Boolean, default: false },
17
+ });
18
+
19
+ const emit = defineEmits(['assign', 'tags', 'priority', 'department', 'status', 'ticket-type']);
20
+ const escDark = inject(
21
+ 'esc-dark',
22
+ computed(() => false),
23
+ );
24
+
25
+ const cardClass = computed(() =>
26
+ escDark.value
27
+ ? 'rounded-xl border border-[var(--esc-panel-border)] bg-[var(--esc-panel-surface)] p-4'
28
+ : 'rounded-lg border border-gray-200 bg-white p-4',
29
+ );
30
+
31
+ function renderStars(rating) {
32
+ return Array.from({ length: 5 }, (_, i) => (i < rating ? 'filled' : 'empty'));
33
+ }
34
+ </script>
35
+
36
+ <template>
37
+ <aside class="space-y-4">
38
+ <div :class="cardClass">
39
+ <h3 :class="['mb-3 text-sm font-semibold', escDark ? 'text-[var(--esc-panel-text)]' : 'text-gray-900']">
40
+ Details
41
+ </h3>
42
+ <dl class="space-y-2 text-sm">
43
+ <div class="flex justify-between">
44
+ <dt :class="escDark ? 'text-[var(--esc-panel-text-muted)]' : 'text-gray-500'">Status</dt>
45
+ <dd><StatusBadge :status="ticket.status" /></dd>
46
+ </div>
47
+ <div class="flex justify-between">
48
+ <dt :class="escDark ? 'text-[var(--esc-panel-text-muted)]' : 'text-gray-500'">Priority</dt>
49
+ <dd><PriorityBadge :priority="ticket.priority" /></dd>
50
+ </div>
51
+ <div class="flex justify-between">
52
+ <dt :class="escDark ? 'text-[var(--esc-panel-text-muted)]' : 'text-gray-500'">Reference</dt>
53
+ <dd :class="['font-mono text-xs', escDark ? 'text-[var(--esc-panel-text)]' : '']">
54
+ {{ ticket.reference }}
55
+ </dd>
56
+ </div>
57
+ <div v-if="ticket.department" class="flex justify-between">
58
+ <dt :class="escDark ? 'text-[var(--esc-panel-text-muted)]' : 'text-gray-500'">Department</dt>
59
+ <dd :class="escDark ? 'text-[var(--esc-panel-text-secondary)]' : ''">
60
+ {{ ticket.department.name }}
61
+ </dd>
62
+ </div>
63
+ <div class="flex items-center justify-between">
64
+ <dt :class="escDark ? 'text-[var(--esc-panel-text-muted)]' : 'text-gray-500'">Type</dt>
65
+ <dd v-if="editable">
66
+ <TicketTypeSelector
67
+ :model-value="ticket.ticket_type || 'question'"
68
+ @update:model-value="emit('ticket-type', $event)"
69
+ />
70
+ </dd>
71
+ <dd v-else :class="escDark ? 'text-[var(--esc-panel-text-secondary)]' : ''">
72
+ {{
73
+ ticket.ticket_type
74
+ ? ticket.ticket_type.charAt(0).toUpperCase() + ticket.ticket_type.slice(1)
75
+ : '—'
76
+ }}
77
+ </dd>
78
+ </div>
79
+ <div class="flex justify-between">
80
+ <dt :class="escDark ? 'text-[var(--esc-panel-text-muted)]' : 'text-gray-500'">Created</dt>
81
+ <dd :class="escDark ? 'text-[var(--esc-panel-text-secondary)]' : ''">
82
+ {{ new Date(ticket.created_at).toLocaleDateString() }}
83
+ </dd>
84
+ </div>
85
+ </dl>
86
+ </div>
87
+
88
+ <!-- Satisfaction Rating (read-only) -->
89
+ <div v-if="ticket.satisfaction_rating" :class="cardClass">
90
+ <h3 :class="['mb-3 text-sm font-semibold', escDark ? 'text-[var(--esc-panel-text)]' : 'text-gray-900']">
91
+ Customer Satisfaction
92
+ </h3>
93
+ <div class="flex items-center gap-1">
94
+ <svg
95
+ v-for="(star, i) in renderStars(ticket.satisfaction_rating.rating)"
96
+ :key="i"
97
+ class="h-5 w-5"
98
+ :class="
99
+ star === 'filled'
100
+ ? 'text-amber-400'
101
+ : escDark
102
+ ? 'text-[var(--esc-panel-text-muted)]'
103
+ : 'text-gray-300'
104
+ "
105
+ fill="currentColor"
106
+ viewBox="0 0 20 20"
107
+ >
108
+ <path
109
+ d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z"
110
+ />
111
+ </svg>
112
+ <span
113
+ :class="[
114
+ 'ml-2 text-sm font-medium',
115
+ escDark ? 'text-[var(--esc-panel-text-secondary)]' : 'text-gray-700',
116
+ ]"
117
+ >
118
+ {{ ticket.satisfaction_rating.rating }}/5
119
+ </span>
120
+ </div>
121
+ <p
122
+ v-if="ticket.satisfaction_rating.comment"
123
+ :class="['mt-2 text-xs italic', escDark ? 'text-[var(--esc-panel-text-muted)]' : 'text-gray-500']"
124
+ >
125
+ "{{ ticket.satisfaction_rating.comment }}"
126
+ </p>
127
+ </div>
128
+
129
+ <div v-if="ticket.first_response_due_at || ticket.resolution_due_at" class="space-y-2">
130
+ <SlaTimer
131
+ v-if="ticket.first_response_due_at"
132
+ :due-at="ticket.first_response_due_at"
133
+ :breached="ticket.sla_first_response_breached"
134
+ label="First Response"
135
+ />
136
+ <SlaTimer
137
+ v-if="ticket.resolution_due_at"
138
+ :due-at="ticket.resolution_due_at"
139
+ :breached="ticket.sla_resolution_breached"
140
+ label="Resolution"
141
+ />
142
+ </div>
143
+
144
+ <div v-if="editable && agents.length" :class="cardClass">
145
+ <AssigneeSelect
146
+ :agents="agents"
147
+ :model-value="ticket.assigned_to"
148
+ @update:model-value="emit('assign', $event)"
149
+ />
150
+ </div>
151
+
152
+ <div v-if="editable && tags.length" :class="cardClass">
153
+ <TagSelect
154
+ :tags="tags"
155
+ :model-value="(ticket.tags || []).map((t) => t.id)"
156
+ @update:model-value="emit('tags', $event)"
157
+ />
158
+ </div>
159
+
160
+ <div v-if="activities.length" :class="cardClass">
161
+ <h3 :class="['mb-3 text-sm font-semibold', escDark ? 'text-[var(--esc-panel-text)]' : 'text-gray-900']">
162
+ Activity
163
+ </h3>
164
+ <ActivityTimeline :activities="activities" />
165
+ </div>
166
+ </aside>
167
+ </template>
@@ -0,0 +1,98 @@
1
+ <script setup>
2
+ import { ref } from 'vue';
3
+ import { router } from '@inertiajs/vue3';
4
+
5
+ const props = defineProps({
6
+ ticketReference: { type: String, required: true },
7
+ replyId: { type: [Number, String], required: true },
8
+ replyAuthor: { type: String, default: '' },
9
+ replyExcerpt: { type: String, default: '' },
10
+ });
11
+
12
+ const emit = defineEmits(['close']);
13
+
14
+ const subject = ref('');
15
+ const splitting = ref(false);
16
+
17
+ function confirmSplit() {
18
+ if (splitting.value) return;
19
+ splitting.value = true;
20
+
21
+ const payload = { reply_id: props.replyId };
22
+ if (subject.value.trim()) {
23
+ payload.subject = subject.value.trim();
24
+ }
25
+
26
+ router.post(route('escalated.admin.tickets.split', props.ticketReference), payload, {
27
+ onFinish: () => {
28
+ splitting.value = false;
29
+ },
30
+ onError: () => {
31
+ splitting.value = false;
32
+ },
33
+ });
34
+ }
35
+ </script>
36
+
37
+ <template>
38
+ <Teleport to="body">
39
+ <div
40
+ class="fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm"
41
+ @click.self="emit('close')"
42
+ >
43
+ <div class="w-full max-w-lg rounded-xl border border-white/[0.06] bg-neutral-900 p-6 shadow-2xl">
44
+ <div class="mb-4 flex items-center justify-between">
45
+ <h3 class="text-lg font-semibold text-neutral-200">Split to New Ticket</h3>
46
+ <button class="text-neutral-500 hover:text-neutral-300" @click="emit('close')">
47
+ <svg class="h-5 w-5" fill="none" stroke="currentColor" stroke-width="1.5" viewBox="0 0 24 24">
48
+ <path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" />
49
+ </svg>
50
+ </button>
51
+ </div>
52
+
53
+ <p class="mb-4 text-sm text-neutral-400">
54
+ This will create a new ticket from the selected reply
55
+ <span v-if="replyAuthor" class="text-neutral-300">by {{ replyAuthor }}</span
56
+ >. The new ticket will be linked to
57
+ <span class="font-mono text-neutral-300">{{ ticketReference }}</span
58
+ >.
59
+ </p>
60
+
61
+ <!-- Reply excerpt preview -->
62
+ <div v-if="replyExcerpt" class="mb-4 rounded-lg border border-white/[0.06] bg-white/[0.02] p-3">
63
+ <p class="text-xs font-semibold uppercase tracking-wider text-neutral-500">Reply content</p>
64
+ <p class="mt-1 line-clamp-3 text-sm text-neutral-300">{{ replyExcerpt }}</p>
65
+ </div>
66
+
67
+ <label class="mb-1 block text-sm font-medium text-neutral-400">
68
+ Subject <span class="text-neutral-600">(optional override)</span>
69
+ </label>
70
+ <input
71
+ v-model="subject"
72
+ type="text"
73
+ placeholder="Leave empty to auto-generate from source ticket"
74
+ class="w-full rounded-lg border border-white/10 bg-neutral-950 px-3 py-2 text-sm text-neutral-200 placeholder-neutral-500 focus:border-white/20 focus:outline-none focus:ring-1 focus:ring-white/10"
75
+ />
76
+
77
+ <div class="mt-5 flex justify-end gap-3">
78
+ <button
79
+ class="rounded-lg border border-white/10 bg-white/[0.03] px-4 py-2 text-sm font-medium text-neutral-300 transition-colors hover:bg-white/[0.06]"
80
+ @click="emit('close')"
81
+ >
82
+ Cancel
83
+ </button>
84
+ <button
85
+ :disabled="splitting"
86
+ :class="[
87
+ 'rounded-lg bg-gradient-to-r from-cyan-500 to-violet-500 px-4 py-2 text-sm font-medium text-white shadow-lg shadow-black/20 transition-all hover:from-cyan-400 hover:to-violet-400',
88
+ splitting && 'cursor-not-allowed opacity-40',
89
+ ]"
90
+ @click="confirmSplit"
91
+ >
92
+ {{ splitting ? 'Splitting...' : 'Split to New Ticket' }}
93
+ </button>
94
+ </div>
95
+ </div>
96
+ </div>
97
+ </Teleport>
98
+ </template>
@@ -0,0 +1,21 @@
1
+ <script setup>
2
+ import { TICKET_TYPES } from '../utils/constants';
3
+
4
+ defineProps({
5
+ modelValue: { type: String, default: 'question' },
6
+ });
7
+
8
+ const emit = defineEmits(['update:modelValue']);
9
+
10
+ const types = TICKET_TYPES;
11
+ </script>
12
+
13
+ <template>
14
+ <select
15
+ :value="modelValue"
16
+ class="rounded-lg border border-white/10 bg-neutral-950 px-3 py-2 text-sm text-neutral-200 focus:border-white/20 focus:outline-none focus:ring-1 focus:ring-white/10"
17
+ @change="emit('update:modelValue', $event.target.value)"
18
+ >
19
+ <option v-for="t in types" :key="t.value" :value="t.value">{{ t.label }}</option>
20
+ </select>
21
+ </template>
@@ -0,0 +1,9 @@
1
+ import TotpInput from './TotpInput.vue';
2
+
3
+ export default {
4
+ title: 'Components/TotpInput',
5
+ component: TotpInput,
6
+ };
7
+
8
+ export const Empty = { args: { modelValue: '' } };
9
+ export const PartiallyFilled = { args: { modelValue: '123' } };
@@ -0,0 +1,81 @@
1
+ <script setup>
2
+ import { ref, watch, nextTick } from 'vue';
3
+
4
+ const props = defineProps({
5
+ modelValue: { type: String, default: '' },
6
+ });
7
+
8
+ const emit = defineEmits(['update:modelValue', 'complete']);
9
+
10
+ const digits = ref(Array(6).fill(''));
11
+ const inputs = ref([]);
12
+
13
+ function setRef(el, index) {
14
+ if (el) inputs.value[index] = el;
15
+ }
16
+
17
+ function handleInput(index, event) {
18
+ const val = event.target.value.replace(/\D/g, '');
19
+ digits.value[index] = val.slice(-1);
20
+
21
+ const code = digits.value.join('');
22
+ emit('update:modelValue', code);
23
+
24
+ if (val && index < 5) {
25
+ nextTick(() => inputs.value[index + 1]?.focus());
26
+ }
27
+
28
+ if (code.length === 6 && !code.includes('')) {
29
+ emit('complete', code);
30
+ }
31
+ }
32
+
33
+ function handleKeydown(index, event) {
34
+ if (event.key === 'Backspace' && !digits.value[index] && index > 0) {
35
+ nextTick(() => inputs.value[index - 1]?.focus());
36
+ }
37
+ }
38
+
39
+ function handlePaste(event) {
40
+ event.preventDefault();
41
+ const pasted = (event.clipboardData?.getData('text') || '').replace(/\D/g, '').slice(0, 6);
42
+ for (let i = 0; i < 6; i++) {
43
+ digits.value[i] = pasted[i] || '';
44
+ }
45
+ const code = digits.value.join('');
46
+ emit('update:modelValue', code);
47
+
48
+ if (code.length === 6) {
49
+ emit('complete', code);
50
+ } else {
51
+ nextTick(() => inputs.value[Math.min(pasted.length, 5)]?.focus());
52
+ }
53
+ }
54
+
55
+ watch(
56
+ () => props.modelValue,
57
+ (val) => {
58
+ if (!val) {
59
+ digits.value = Array(6).fill('');
60
+ }
61
+ },
62
+ );
63
+ </script>
64
+
65
+ <template>
66
+ <div class="flex gap-2">
67
+ <input
68
+ v-for="(_, index) in 6"
69
+ :key="index"
70
+ :ref="(el) => setRef(el, index)"
71
+ :value="digits[index]"
72
+ type="text"
73
+ inputmode="numeric"
74
+ maxlength="1"
75
+ class="h-12 w-10 rounded-lg border border-white/10 bg-neutral-950 text-center text-lg font-semibold text-neutral-200 focus:border-cyan-500/50 focus:outline-none focus:ring-1 focus:ring-cyan-500/30"
76
+ @input="handleInput(index, $event)"
77
+ @keydown="handleKeydown(index, $event)"
78
+ @paste="handlePaste"
79
+ />
80
+ </div>
81
+ </template>