@escalated-dev/escalated 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. package/README.md +94 -2
  2. package/package.json +31 -2
  3. package/src/components/ActivityTimeline.stories.js +55 -0
  4. package/src/components/ActivityTimeline.vue +24 -7
  5. package/src/components/AdminDashboard.stories.js +1095 -0
  6. package/src/components/AgentLoadIndicator.stories.js +37 -0
  7. package/src/components/AgentLoadIndicator.vue +49 -0
  8. package/src/components/AgentPerformanceCard.vue +44 -0
  9. package/src/components/ArticleEditor.vue +82 -0
  10. package/src/components/AssigneeSelect.vue +19 -5
  11. package/src/components/AttachmentList.vue +53 -37
  12. package/src/components/AuditLogEntry.vue +95 -0
  13. package/src/components/BulkActionBar.vue +99 -30
  14. package/src/components/CategoryTree.vue +89 -0
  15. package/src/components/ChartWidget.vue +46 -0
  16. package/src/components/CollisionWarning.stories.js +30 -0
  17. package/src/components/CollisionWarning.vue +68 -0
  18. package/src/components/ConditionalFieldRules.vue +135 -0
  19. package/src/components/ContextPanel.vue +66 -0
  20. package/src/components/ContextPanelSection.vue +65 -0
  21. package/src/components/CustomFieldRenderer.vue +159 -0
  22. package/src/components/EscalatedLayout.vue +400 -69
  23. package/src/components/FileDropzone.vue +26 -10
  24. package/src/components/FollowButton.stories.js +30 -0
  25. package/src/components/FollowButton.vue +53 -28
  26. package/src/components/KeyboardShortcutHelp.vue +129 -39
  27. package/src/components/KnowledgePanel.vue +122 -0
  28. package/src/components/KpiCard.stories.js +32 -0
  29. package/src/components/KpiCard.vue +88 -0
  30. package/src/components/MacroDropdown.vue +95 -35
  31. package/src/components/PermissionMatrix.vue +107 -0
  32. package/src/components/PinnedNotes.vue +70 -31
  33. package/src/components/PresenceIndicator.vue +93 -27
  34. package/src/components/PriorityBadge.stories.js +33 -0
  35. package/src/components/PriorityBadge.vue +9 -2
  36. package/src/components/QuickFilters.vue +65 -49
  37. package/src/components/ReplyComposer.vue +144 -30
  38. package/src/components/ReplyThread.vue +72 -20
  39. package/src/components/SatisfactionRating.vue +98 -46
  40. package/src/components/ScheduleEditor.vue +104 -0
  41. package/src/components/SideConversation.vue +165 -0
  42. package/src/components/SideConversationList.vue +147 -0
  43. package/src/components/SkillTagManager.vue +79 -0
  44. package/src/components/SlaComplianceChart.vue +53 -0
  45. package/src/components/SlaTimer.stories.js +35 -0
  46. package/src/components/SlaTimer.vue +17 -4
  47. package/src/components/StatsCard.stories.js +24 -0
  48. package/src/components/StatsCard.vue +58 -46
  49. package/src/components/StatusBadge.stories.js +53 -0
  50. package/src/components/StatusBadge.vue +36 -4
  51. package/src/components/TagSelect.vue +43 -12
  52. package/src/components/TicketFilters.vue +225 -69
  53. package/src/components/TicketLinkPanel.vue +193 -0
  54. package/src/components/TicketList.vue +594 -193
  55. package/src/components/TicketMergeDialog.vue +157 -0
  56. package/src/components/TicketSidebar.vue +167 -99
  57. package/src/components/TicketTypeSelector.vue +21 -0
  58. package/src/components/TotpInput.stories.js +9 -0
  59. package/src/components/TotpInput.vue +81 -0
  60. package/src/components/TwoFactorSetup.vue +113 -0
  61. package/src/composables/useDebouncedSearch.js +38 -0
  62. package/src/composables/usePluginExtensions.js +95 -3
  63. package/src/composables/usePluginHooks.js +65 -0
  64. package/src/defineEscalatedPlugin.js +34 -8
  65. package/src/index.js +72 -35
  66. package/src/locales/en.json +25 -0
  67. package/src/pages/Admin/ApiTokens/Index.vue +231 -67
  68. package/src/pages/Admin/AuditLog/Index.vue +154 -0
  69. package/src/pages/Admin/Automations/Form.vue +184 -0
  70. package/src/pages/Admin/Automations/Index.vue +129 -0
  71. package/src/pages/Admin/BusinessHours/Form.vue +172 -0
  72. package/src/pages/Admin/BusinessHours/Index.vue +113 -0
  73. package/src/pages/Admin/CannedResponses/Index.vue +127 -70
  74. package/src/pages/Admin/Capacity/Index.vue +134 -0
  75. package/src/pages/Admin/CustomFields/Form.vue +195 -0
  76. package/src/pages/Admin/CustomFields/Index.vue +134 -0
  77. package/src/pages/Admin/CustomObjects/Form.vue +202 -0
  78. package/src/pages/Admin/CustomObjects/Index.vue +127 -0
  79. package/src/pages/Admin/CustomObjects/Records.vue +228 -0
  80. package/src/pages/Admin/Departments/Form.vue +75 -51
  81. package/src/pages/Admin/Departments/Index.vue +109 -57
  82. package/src/pages/Admin/EscalationRules/Form.vue +157 -96
  83. package/src/pages/Admin/EscalationRules/Index.vue +178 -57
  84. package/src/pages/Admin/Import/Connect.vue +96 -0
  85. package/src/pages/Admin/Import/Index.vue +102 -0
  86. package/src/pages/Admin/Import/Mapping.vue +110 -0
  87. package/src/pages/Admin/Import/Progress.vue +153 -0
  88. package/src/pages/Admin/Import/Review.vue +76 -0
  89. package/src/pages/Admin/KnowledgeBase/Articles/Form.vue +142 -0
  90. package/src/pages/Admin/KnowledgeBase/Articles/Index.vue +195 -0
  91. package/src/pages/Admin/KnowledgeBase/Categories/Index.vue +193 -0
  92. package/src/pages/Admin/Macros/Index.vue +250 -89
  93. package/src/pages/Admin/Plugins/Index.vue +205 -75
  94. package/src/pages/Admin/Reports/AgentMetrics.vue +115 -0
  95. package/src/pages/Admin/Reports/CsatReport.vue +127 -0
  96. package/src/pages/Admin/Reports/Dashboard.vue +211 -0
  97. package/src/pages/Admin/Reports/SlaReport.vue +166 -0
  98. package/src/pages/Admin/Reports.vue +139 -34
  99. package/src/pages/Admin/Roles/Form.vue +71 -0
  100. package/src/pages/Admin/Roles/Index.vue +122 -0
  101. package/src/pages/Admin/Settings/CsatSettings.vue +165 -0
  102. package/src/pages/Admin/Settings/DataRetention.vue +182 -0
  103. package/src/pages/Admin/Settings/EmailSettings.vue +243 -0
  104. package/src/pages/Admin/Settings/Sandbox.vue +135 -0
  105. package/src/pages/Admin/Settings/SsoSettings.vue +218 -0
  106. package/src/pages/Admin/Settings/TwoFactor.vue +110 -0
  107. package/src/pages/Admin/Settings.vue +468 -260
  108. package/src/pages/Admin/Skills/Form.vue +53 -0
  109. package/src/pages/Admin/Skills/Index.vue +94 -0
  110. package/src/pages/Admin/SlaPolicies/Form.vue +118 -75
  111. package/src/pages/Admin/SlaPolicies/Index.vue +120 -59
  112. package/src/pages/Admin/Statuses/Form.vue +114 -0
  113. package/src/pages/Admin/Statuses/Index.vue +153 -0
  114. package/src/pages/Admin/Tags/Index.vue +191 -105
  115. package/src/pages/Admin/Tickets/Index.vue +91 -39
  116. package/src/pages/Admin/Tickets/Show.vue +101 -37
  117. package/src/pages/Admin/Webhooks/DeliveryLog.vue +120 -0
  118. package/src/pages/Admin/Webhooks/Form.vue +110 -0
  119. package/src/pages/Admin/Webhooks/Index.vue +136 -0
  120. package/src/pages/Agent/Dashboard.vue +311 -186
  121. package/src/pages/Agent/TicketIndex.vue +88 -38
  122. package/src/pages/Agent/TicketShow.vue +258 -51
  123. package/src/pages/Customer/Create.vue +36 -9
  124. package/src/pages/Customer/Index.vue +31 -24
  125. package/src/pages/Customer/KnowledgeBase/Article.vue +127 -0
  126. package/src/pages/Customer/KnowledgeBase/Index.vue +151 -0
  127. package/src/plugin.js +86 -1
  128. package/src/utils/constants.js +30 -0
  129. package/src/utils/formatting.js +35 -0
  130. 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,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>
@@ -0,0 +1,113 @@
1
+ <script setup>
2
+ import { ref } from 'vue';
3
+ import TotpInput from './TotpInput.vue';
4
+
5
+ const props = defineProps({
6
+ qrUri: { type: String, default: '' },
7
+ recoveryCodes: { type: Array, default: () => [] },
8
+ });
9
+
10
+ const emit = defineEmits(['confirm', 'cancel']);
11
+
12
+ const step = ref(1);
13
+ const code = ref('');
14
+ const error = ref('');
15
+
16
+ function onCodeComplete(val) {
17
+ code.value = val;
18
+ }
19
+
20
+ function confirmCode() {
21
+ if (code.value.length !== 6) {
22
+ error.value = 'Please enter the full 6-digit code.';
23
+ return;
24
+ }
25
+ error.value = '';
26
+ emit('confirm', code.value);
27
+ step.value = 3;
28
+ }
29
+
30
+ function copyRecoveryCodes() {
31
+ const text = props.recoveryCodes.join('\n');
32
+ navigator.clipboard?.writeText(text);
33
+ }
34
+ </script>
35
+
36
+ <template>
37
+ <div class="space-y-6">
38
+ <!-- Step 1: QR Code -->
39
+ <div v-if="step === 1">
40
+ <h3 class="mb-4 text-sm font-semibold text-white">Step 1: Scan QR Code</h3>
41
+ <p class="mb-4 text-sm text-neutral-400">
42
+ Scan the code below with your authenticator app (Google Authenticator, Authy, etc.), or manually enter
43
+ the setup key.
44
+ </p>
45
+ <div class="rounded-lg border border-white/[0.06] bg-neutral-950 p-4">
46
+ <p class="mb-2 text-xs font-medium text-neutral-500">Setup URI (enter manually if needed):</p>
47
+ <code class="block break-all text-xs text-cyan-400">{{ qrUri }}</code>
48
+ </div>
49
+ <button
50
+ type="button"
51
+ class="mt-4 rounded-lg bg-gradient-to-r from-cyan-500 to-violet-500 px-5 py-2 text-sm font-medium text-white shadow-lg shadow-black/20 transition-all hover:from-cyan-400 hover:to-violet-400"
52
+ @click="step = 2"
53
+ >
54
+ Next: Verify Code
55
+ </button>
56
+ </div>
57
+
58
+ <!-- Step 2: Verify TOTP -->
59
+ <div v-if="step === 2">
60
+ <h3 class="mb-4 text-sm font-semibold text-white">Step 2: Verify Code</h3>
61
+ <p class="mb-4 text-sm text-neutral-400">
62
+ Enter the 6-digit code from your authenticator app to confirm setup.
63
+ </p>
64
+ <TotpInput v-model="code" @complete="onCodeComplete" />
65
+ <p v-if="error" class="mt-2 text-sm text-rose-400">{{ error }}</p>
66
+ <div class="mt-4 flex gap-3">
67
+ <button
68
+ type="button"
69
+ class="rounded-lg bg-gradient-to-r from-cyan-500 to-violet-500 px-5 py-2 text-sm font-medium text-white shadow-lg shadow-black/20 transition-all hover:from-cyan-400 hover:to-violet-400"
70
+ @click="confirmCode"
71
+ >
72
+ Confirm & Enable 2FA
73
+ </button>
74
+ <button
75
+ type="button"
76
+ class="rounded-lg border border-white/10 px-4 py-2 text-sm text-neutral-400 hover:text-neutral-200"
77
+ @click="emit('cancel')"
78
+ >
79
+ Cancel
80
+ </button>
81
+ </div>
82
+ </div>
83
+
84
+ <!-- Step 3: Recovery Codes -->
85
+ <div v-if="step === 3">
86
+ <h3 class="mb-4 text-sm font-semibold text-white">Step 3: Save Recovery Codes</h3>
87
+ <p class="mb-4 text-sm text-neutral-400">
88
+ Save these recovery codes in a safe place. Each code can only be used once to access your account if you
89
+ lose your authenticator device.
90
+ </p>
91
+ <div class="rounded-lg border border-white/[0.06] bg-neutral-950 p-4">
92
+ <div class="grid grid-cols-2 gap-2">
93
+ <code
94
+ v-for="(rc, idx) in recoveryCodes"
95
+ :key="idx"
96
+ class="rounded bg-neutral-900 px-3 py-1.5 text-center text-sm font-mono text-neutral-200"
97
+ >
98
+ {{ rc }}
99
+ </code>
100
+ </div>
101
+ </div>
102
+ <div class="mt-4 flex gap-3">
103
+ <button
104
+ type="button"
105
+ class="rounded-lg border border-white/10 px-4 py-2 text-sm text-neutral-400 hover:text-neutral-200"
106
+ @click="copyRecoveryCodes"
107
+ >
108
+ Copy Codes
109
+ </button>
110
+ </div>
111
+ </div>
112
+ </div>
113
+ </template>