@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.
- package/README.md +94 -2
- package/package.json +31 -2
- package/src/components/ActivityTimeline.stories.js +55 -0
- package/src/components/ActivityTimeline.vue +24 -7
- package/src/components/AdminDashboard.stories.js +1095 -0
- package/src/components/AgentLoadIndicator.stories.js +37 -0
- package/src/components/AgentLoadIndicator.vue +49 -0
- package/src/components/AgentPerformanceCard.vue +44 -0
- package/src/components/ArticleEditor.vue +82 -0
- package/src/components/AssigneeSelect.vue +19 -5
- package/src/components/AttachmentList.vue +53 -37
- package/src/components/AuditLogEntry.vue +95 -0
- package/src/components/BulkActionBar.vue +99 -30
- package/src/components/CategoryTree.vue +89 -0
- package/src/components/ChartWidget.vue +46 -0
- package/src/components/CollisionWarning.stories.js +30 -0
- package/src/components/CollisionWarning.vue +68 -0
- package/src/components/ConditionalFieldRules.vue +135 -0
- package/src/components/ContextPanel.vue +66 -0
- package/src/components/ContextPanelSection.vue +65 -0
- package/src/components/CustomFieldRenderer.vue +159 -0
- package/src/components/EscalatedLayout.vue +400 -69
- package/src/components/FileDropzone.vue +26 -10
- package/src/components/FollowButton.stories.js +30 -0
- package/src/components/FollowButton.vue +53 -28
- package/src/components/KeyboardShortcutHelp.vue +129 -39
- package/src/components/KnowledgePanel.vue +122 -0
- package/src/components/KpiCard.stories.js +32 -0
- package/src/components/KpiCard.vue +88 -0
- package/src/components/MacroDropdown.vue +95 -35
- package/src/components/PermissionMatrix.vue +107 -0
- package/src/components/PinnedNotes.vue +70 -31
- package/src/components/PresenceIndicator.vue +93 -27
- package/src/components/PriorityBadge.stories.js +33 -0
- package/src/components/PriorityBadge.vue +9 -2
- package/src/components/QuickFilters.vue +65 -49
- package/src/components/ReplyComposer.vue +144 -30
- package/src/components/ReplyThread.vue +72 -20
- package/src/components/SatisfactionRating.vue +98 -46
- package/src/components/ScheduleEditor.vue +104 -0
- package/src/components/SideConversation.vue +165 -0
- package/src/components/SideConversationList.vue +147 -0
- package/src/components/SkillTagManager.vue +79 -0
- package/src/components/SlaComplianceChart.vue +53 -0
- package/src/components/SlaTimer.stories.js +35 -0
- package/src/components/SlaTimer.vue +17 -4
- package/src/components/StatsCard.stories.js +24 -0
- package/src/components/StatsCard.vue +58 -46
- package/src/components/StatusBadge.stories.js +53 -0
- package/src/components/StatusBadge.vue +36 -4
- package/src/components/TagSelect.vue +43 -12
- package/src/components/TicketFilters.vue +225 -69
- package/src/components/TicketLinkPanel.vue +193 -0
- package/src/components/TicketList.vue +594 -193
- package/src/components/TicketMergeDialog.vue +157 -0
- package/src/components/TicketSidebar.vue +167 -99
- package/src/components/TicketTypeSelector.vue +21 -0
- package/src/components/TotpInput.stories.js +9 -0
- package/src/components/TotpInput.vue +81 -0
- package/src/components/TwoFactorSetup.vue +113 -0
- package/src/composables/useDebouncedSearch.js +38 -0
- package/src/composables/usePluginExtensions.js +95 -3
- package/src/composables/usePluginHooks.js +65 -0
- package/src/defineEscalatedPlugin.js +34 -8
- package/src/index.js +72 -35
- package/src/locales/en.json +25 -0
- package/src/pages/Admin/ApiTokens/Index.vue +231 -67
- package/src/pages/Admin/AuditLog/Index.vue +154 -0
- package/src/pages/Admin/Automations/Form.vue +184 -0
- package/src/pages/Admin/Automations/Index.vue +129 -0
- package/src/pages/Admin/BusinessHours/Form.vue +172 -0
- package/src/pages/Admin/BusinessHours/Index.vue +113 -0
- package/src/pages/Admin/CannedResponses/Index.vue +127 -70
- package/src/pages/Admin/Capacity/Index.vue +134 -0
- package/src/pages/Admin/CustomFields/Form.vue +195 -0
- package/src/pages/Admin/CustomFields/Index.vue +134 -0
- package/src/pages/Admin/CustomObjects/Form.vue +202 -0
- package/src/pages/Admin/CustomObjects/Index.vue +127 -0
- package/src/pages/Admin/CustomObjects/Records.vue +228 -0
- package/src/pages/Admin/Departments/Form.vue +75 -51
- package/src/pages/Admin/Departments/Index.vue +109 -57
- package/src/pages/Admin/EscalationRules/Form.vue +157 -96
- package/src/pages/Admin/EscalationRules/Index.vue +178 -57
- package/src/pages/Admin/Import/Connect.vue +96 -0
- package/src/pages/Admin/Import/Index.vue +102 -0
- package/src/pages/Admin/Import/Mapping.vue +110 -0
- package/src/pages/Admin/Import/Progress.vue +153 -0
- package/src/pages/Admin/Import/Review.vue +76 -0
- package/src/pages/Admin/KnowledgeBase/Articles/Form.vue +142 -0
- package/src/pages/Admin/KnowledgeBase/Articles/Index.vue +195 -0
- package/src/pages/Admin/KnowledgeBase/Categories/Index.vue +193 -0
- package/src/pages/Admin/Macros/Index.vue +250 -89
- package/src/pages/Admin/Plugins/Index.vue +205 -75
- package/src/pages/Admin/Reports/AgentMetrics.vue +115 -0
- package/src/pages/Admin/Reports/CsatReport.vue +127 -0
- package/src/pages/Admin/Reports/Dashboard.vue +211 -0
- package/src/pages/Admin/Reports/SlaReport.vue +166 -0
- package/src/pages/Admin/Reports.vue +139 -34
- package/src/pages/Admin/Roles/Form.vue +71 -0
- package/src/pages/Admin/Roles/Index.vue +122 -0
- package/src/pages/Admin/Settings/CsatSettings.vue +165 -0
- package/src/pages/Admin/Settings/DataRetention.vue +182 -0
- package/src/pages/Admin/Settings/EmailSettings.vue +243 -0
- package/src/pages/Admin/Settings/Sandbox.vue +135 -0
- package/src/pages/Admin/Settings/SsoSettings.vue +218 -0
- package/src/pages/Admin/Settings/TwoFactor.vue +110 -0
- package/src/pages/Admin/Settings.vue +468 -260
- package/src/pages/Admin/Skills/Form.vue +53 -0
- package/src/pages/Admin/Skills/Index.vue +94 -0
- package/src/pages/Admin/SlaPolicies/Form.vue +118 -75
- package/src/pages/Admin/SlaPolicies/Index.vue +120 -59
- package/src/pages/Admin/Statuses/Form.vue +114 -0
- package/src/pages/Admin/Statuses/Index.vue +153 -0
- package/src/pages/Admin/Tags/Index.vue +191 -105
- package/src/pages/Admin/Tickets/Index.vue +91 -39
- package/src/pages/Admin/Tickets/Show.vue +101 -37
- package/src/pages/Admin/Webhooks/DeliveryLog.vue +120 -0
- package/src/pages/Admin/Webhooks/Form.vue +110 -0
- package/src/pages/Admin/Webhooks/Index.vue +136 -0
- package/src/pages/Agent/Dashboard.vue +311 -186
- package/src/pages/Agent/TicketIndex.vue +88 -38
- package/src/pages/Agent/TicketShow.vue +258 -51
- package/src/pages/Customer/Create.vue +36 -9
- package/src/pages/Customer/Index.vue +31 -24
- package/src/pages/Customer/KnowledgeBase/Article.vue +127 -0
- package/src/pages/Customer/KnowledgeBase/Index.vue +151 -0
- package/src/plugin.js +86 -1
- package/src/utils/constants.js +30 -0
- package/src/utils/formatting.js +35 -0
- package/src/pages/Admin/Plugins.vue +0 -129
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { ref, onMounted } from 'vue';
|
|
3
|
+
import { router } from '@inertiajs/vue3';
|
|
4
|
+
import SideConversation from './SideConversation.vue';
|
|
5
|
+
|
|
6
|
+
const props = defineProps({
|
|
7
|
+
ticketReference: { type: String, required: true },
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
const conversations = ref([]);
|
|
11
|
+
const expanded = ref(true);
|
|
12
|
+
const showNew = ref(false);
|
|
13
|
+
const newSubject = ref('');
|
|
14
|
+
const newChannel = ref('internal');
|
|
15
|
+
const newBody = ref('');
|
|
16
|
+
const creating = ref(false);
|
|
17
|
+
|
|
18
|
+
onMounted(() => {
|
|
19
|
+
fetchConversations();
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
async function fetchConversations() {
|
|
23
|
+
try {
|
|
24
|
+
const response = await fetch(route('escalated.admin.tickets.side-conversations.index', props.ticketReference), {
|
|
25
|
+
headers: {
|
|
26
|
+
Accept: 'application/json',
|
|
27
|
+
'X-Requested-With': 'XMLHttpRequest',
|
|
28
|
+
'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]')?.content || '',
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
if (response.ok) {
|
|
32
|
+
const data = await response.json();
|
|
33
|
+
conversations.value = data.conversations || [];
|
|
34
|
+
}
|
|
35
|
+
} catch {
|
|
36
|
+
// silently ignore
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function createConversation() {
|
|
41
|
+
if (!newSubject.value.trim() || !newBody.value.trim() || creating.value) return;
|
|
42
|
+
creating.value = true;
|
|
43
|
+
|
|
44
|
+
router.post(
|
|
45
|
+
route('escalated.admin.tickets.side-conversations.store', props.ticketReference),
|
|
46
|
+
{
|
|
47
|
+
subject: newSubject.value,
|
|
48
|
+
channel: newChannel.value,
|
|
49
|
+
body: newBody.value,
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
preserveScroll: true,
|
|
53
|
+
onSuccess: () => {
|
|
54
|
+
newSubject.value = '';
|
|
55
|
+
newBody.value = '';
|
|
56
|
+
newChannel.value = 'internal';
|
|
57
|
+
showNew.value = false;
|
|
58
|
+
fetchConversations();
|
|
59
|
+
},
|
|
60
|
+
onFinish: () => {
|
|
61
|
+
creating.value = false;
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
</script>
|
|
67
|
+
|
|
68
|
+
<template>
|
|
69
|
+
<div class="rounded-xl border border-white/[0.06] bg-neutral-900/60 p-4">
|
|
70
|
+
<button
|
|
71
|
+
class="flex w-full items-center justify-between text-sm font-semibold text-neutral-200"
|
|
72
|
+
@click="expanded = !expanded"
|
|
73
|
+
>
|
|
74
|
+
<span>Side Conversations ({{ conversations.length }})</span>
|
|
75
|
+
<svg
|
|
76
|
+
:class="['h-4 w-4 text-neutral-500 transition-transform', expanded && 'rotate-180']"
|
|
77
|
+
fill="none"
|
|
78
|
+
stroke="currentColor"
|
|
79
|
+
stroke-width="1.5"
|
|
80
|
+
viewBox="0 0 24 24"
|
|
81
|
+
>
|
|
82
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M19.5 8.25l-7.5 7.5-7.5-7.5" />
|
|
83
|
+
</svg>
|
|
84
|
+
</button>
|
|
85
|
+
|
|
86
|
+
<div v-if="expanded" class="mt-3 space-y-3">
|
|
87
|
+
<SideConversation
|
|
88
|
+
v-for="conv in conversations"
|
|
89
|
+
:key="conv.id"
|
|
90
|
+
:conversation="conv"
|
|
91
|
+
:ticket-reference="ticketReference"
|
|
92
|
+
@updated="fetchConversations"
|
|
93
|
+
/>
|
|
94
|
+
|
|
95
|
+
<div v-if="!conversations.length && !showNew" class="text-xs text-neutral-500">No side conversations.</div>
|
|
96
|
+
|
|
97
|
+
<!-- New conversation form -->
|
|
98
|
+
<div v-if="showNew" class="rounded-lg border border-white/[0.06] bg-white/[0.02] p-3 space-y-2">
|
|
99
|
+
<input
|
|
100
|
+
v-model="newSubject"
|
|
101
|
+
type="text"
|
|
102
|
+
placeholder="Subject..."
|
|
103
|
+
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"
|
|
104
|
+
/>
|
|
105
|
+
<select
|
|
106
|
+
v-model="newChannel"
|
|
107
|
+
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"
|
|
108
|
+
>
|
|
109
|
+
<option value="internal">Internal</option>
|
|
110
|
+
<option value="email">Email</option>
|
|
111
|
+
</select>
|
|
112
|
+
<textarea
|
|
113
|
+
v-model="newBody"
|
|
114
|
+
rows="3"
|
|
115
|
+
placeholder="Write the first message..."
|
|
116
|
+
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"
|
|
117
|
+
></textarea>
|
|
118
|
+
<div class="flex gap-2">
|
|
119
|
+
<button
|
|
120
|
+
:disabled="!newSubject.trim() || !newBody.trim() || creating"
|
|
121
|
+
:class="[
|
|
122
|
+
'rounded-lg bg-gradient-to-r from-cyan-500 to-violet-500 px-3 py-1.5 text-xs font-medium text-white transition-all hover:from-cyan-400 hover:to-violet-400',
|
|
123
|
+
(!newSubject.trim() || !newBody.trim() || creating) && 'cursor-not-allowed opacity-40',
|
|
124
|
+
]"
|
|
125
|
+
@click="createConversation"
|
|
126
|
+
>
|
|
127
|
+
Create
|
|
128
|
+
</button>
|
|
129
|
+
<button
|
|
130
|
+
class="rounded-lg px-3 py-1.5 text-xs text-neutral-400 hover:text-neutral-300"
|
|
131
|
+
@click="showNew = false"
|
|
132
|
+
>
|
|
133
|
+
Cancel
|
|
134
|
+
</button>
|
|
135
|
+
</div>
|
|
136
|
+
</div>
|
|
137
|
+
|
|
138
|
+
<button
|
|
139
|
+
v-if="!showNew"
|
|
140
|
+
class="w-full rounded-lg border border-dashed border-white/[0.08] py-2 text-xs text-neutral-400 transition-colors hover:border-white/[0.15] hover:text-neutral-300"
|
|
141
|
+
@click="showNew = true"
|
|
142
|
+
>
|
|
143
|
+
+ New Side Conversation
|
|
144
|
+
</button>
|
|
145
|
+
</div>
|
|
146
|
+
</div>
|
|
147
|
+
</template>
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { ref, computed } from 'vue';
|
|
3
|
+
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
availableSkills: { type: Array, default: () => [] },
|
|
6
|
+
modelValue: { type: Array, default: () => [] },
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
const emit = defineEmits(['update:modelValue']);
|
|
10
|
+
|
|
11
|
+
const showDropdown = ref(false);
|
|
12
|
+
|
|
13
|
+
const selectedSkills = computed(() => {
|
|
14
|
+
return props.availableSkills.filter((s) => props.modelValue.includes(s.id));
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const unselectedSkills = computed(() => {
|
|
18
|
+
return props.availableSkills.filter((s) => !props.modelValue.includes(s.id));
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
function addSkill(skillId) {
|
|
22
|
+
emit('update:modelValue', [...props.modelValue, skillId]);
|
|
23
|
+
showDropdown.value = false;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function removeSkill(skillId) {
|
|
27
|
+
emit(
|
|
28
|
+
'update:modelValue',
|
|
29
|
+
props.modelValue.filter((id) => id !== skillId),
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
</script>
|
|
33
|
+
|
|
34
|
+
<template>
|
|
35
|
+
<div class="space-y-2">
|
|
36
|
+
<!-- Selected skill tags -->
|
|
37
|
+
<div class="flex flex-wrap gap-1.5">
|
|
38
|
+
<span
|
|
39
|
+
v-for="skill in selectedSkills"
|
|
40
|
+
:key="skill.id"
|
|
41
|
+
class="inline-flex items-center gap-1 rounded-md bg-cyan-500/15 px-2 py-1 text-xs font-medium text-cyan-300 ring-1 ring-cyan-500/20"
|
|
42
|
+
>
|
|
43
|
+
{{ skill.name }}
|
|
44
|
+
<button
|
|
45
|
+
aria-label="Remove skill"
|
|
46
|
+
class="ml-0.5 text-cyan-400 hover:text-cyan-200"
|
|
47
|
+
@click="removeSkill(skill.id)"
|
|
48
|
+
>
|
|
49
|
+
×
|
|
50
|
+
</button>
|
|
51
|
+
</span>
|
|
52
|
+
<span v-if="!selectedSkills.length" class="text-xs text-neutral-500">No skills assigned</span>
|
|
53
|
+
</div>
|
|
54
|
+
|
|
55
|
+
<!-- Add button / dropdown -->
|
|
56
|
+
<div class="relative">
|
|
57
|
+
<button
|
|
58
|
+
v-if="unselectedSkills.length"
|
|
59
|
+
class="rounded-lg border border-dashed border-white/[0.08] px-2 py-1 text-xs text-neutral-400 transition-colors hover:border-white/[0.15] hover:text-neutral-300"
|
|
60
|
+
@click="showDropdown = !showDropdown"
|
|
61
|
+
>
|
|
62
|
+
+ Add Skill
|
|
63
|
+
</button>
|
|
64
|
+
<div
|
|
65
|
+
v-if="showDropdown && unselectedSkills.length"
|
|
66
|
+
class="absolute left-0 top-full z-10 mt-1 max-h-40 w-48 overflow-y-auto rounded-lg border border-white/[0.06] bg-neutral-900 py-1 shadow-xl"
|
|
67
|
+
>
|
|
68
|
+
<button
|
|
69
|
+
v-for="skill in unselectedSkills"
|
|
70
|
+
:key="skill.id"
|
|
71
|
+
class="w-full px-3 py-1.5 text-left text-xs text-neutral-300 transition-colors hover:bg-white/[0.04]"
|
|
72
|
+
@click="addSkill(skill.id)"
|
|
73
|
+
>
|
|
74
|
+
{{ skill.name }}
|
|
75
|
+
</button>
|
|
76
|
+
</div>
|
|
77
|
+
</div>
|
|
78
|
+
</div>
|
|
79
|
+
</template>
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed } from 'vue';
|
|
3
|
+
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
data: { type: Array, default: () => [] },
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
const maxTotal = computed(() => {
|
|
9
|
+
if (!props.data.length) return 1;
|
|
10
|
+
return Math.max(...props.data.map((d) => d.total), 1);
|
|
11
|
+
});
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<template>
|
|
15
|
+
<div class="rounded-xl border border-white/[0.06] bg-neutral-900/60 p-5">
|
|
16
|
+
<h3 class="mb-4 text-sm font-semibold text-neutral-200">SLA Compliance by Policy</h3>
|
|
17
|
+
<div v-if="data.length" class="space-y-4">
|
|
18
|
+
<div v-for="item in data" :key="item.policy_name">
|
|
19
|
+
<div class="mb-1.5 flex items-center justify-between">
|
|
20
|
+
<span class="text-sm font-medium text-neutral-300">{{ item.policy_name }}</span>
|
|
21
|
+
<span class="text-xs text-neutral-500">{{ item.total }} tickets</span>
|
|
22
|
+
</div>
|
|
23
|
+
<div class="flex h-6 overflow-hidden rounded-full bg-white/[0.04]">
|
|
24
|
+
<div
|
|
25
|
+
class="h-full rounded-l-full bg-emerald-500/80 transition-all"
|
|
26
|
+
:style="{ width: item.total > 0 ? `${(item.met / item.total) * 100}%` : '0%' }"
|
|
27
|
+
:title="`Met: ${item.met}`"
|
|
28
|
+
></div>
|
|
29
|
+
<div
|
|
30
|
+
class="h-full bg-red-500/80 transition-all"
|
|
31
|
+
:class="{ 'rounded-r-full': item.met === 0, 'rounded-r-full': true }"
|
|
32
|
+
:style="{ width: item.total > 0 ? `${(item.breached / item.total) * 100}%` : '0%' }"
|
|
33
|
+
:title="`Breached: ${item.breached}`"
|
|
34
|
+
></div>
|
|
35
|
+
</div>
|
|
36
|
+
<div class="mt-1 flex items-center gap-4 text-xs">
|
|
37
|
+
<span class="flex items-center gap-1 text-emerald-400">
|
|
38
|
+
<span class="inline-block h-2 w-2 rounded-full bg-emerald-500"></span>
|
|
39
|
+
Met: {{ item.met }}
|
|
40
|
+
</span>
|
|
41
|
+
<span class="flex items-center gap-1 text-red-400">
|
|
42
|
+
<span class="inline-block h-2 w-2 rounded-full bg-red-500"></span>
|
|
43
|
+
Breached: {{ item.breached }}
|
|
44
|
+
</span>
|
|
45
|
+
<span v-if="item.total > 0" class="text-neutral-500">
|
|
46
|
+
{{ Math.round((item.met / item.total) * 100) }}% compliance
|
|
47
|
+
</span>
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
51
|
+
<div v-else class="py-6 text-center text-sm text-neutral-500">No SLA data available</div>
|
|
52
|
+
</div>
|
|
53
|
+
</template>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import SlaTimer from './SlaTimer.vue';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: 'Components/SlaTimer',
|
|
5
|
+
component: SlaTimer,
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
const inOneHour = new Date(Date.now() + 3600000).toISOString();
|
|
9
|
+
const inFiveHours = new Date(Date.now() + 18000000).toISOString();
|
|
10
|
+
const inThreeDays = new Date(Date.now() + 259200000).toISOString();
|
|
11
|
+
const overdue = new Date(Date.now() - 3600000).toISOString();
|
|
12
|
+
|
|
13
|
+
export const Healthy = { args: { dueAt: inThreeDays, label: 'First Response' } };
|
|
14
|
+
export const Warning = { args: { dueAt: inOneHour, label: 'Resolution Due' } };
|
|
15
|
+
export const Comfortable = { args: { dueAt: inFiveHours, label: 'Next Reply' } };
|
|
16
|
+
export const Overdue = { args: { dueAt: overdue, label: 'Resolution Due' } };
|
|
17
|
+
export const Breached = { args: { dueAt: overdue, breached: true, label: 'First Response' } };
|
|
18
|
+
|
|
19
|
+
export const AllStates = {
|
|
20
|
+
render: () => ({
|
|
21
|
+
components: { SlaTimer },
|
|
22
|
+
setup() {
|
|
23
|
+
return { inThreeDays, inFiveHours, inOneHour, overdue };
|
|
24
|
+
},
|
|
25
|
+
template: `
|
|
26
|
+
<div class="flex flex-wrap gap-3">
|
|
27
|
+
<SlaTimer :dueAt="inThreeDays" label="Healthy" />
|
|
28
|
+
<SlaTimer :dueAt="inFiveHours" label="Comfortable" />
|
|
29
|
+
<SlaTimer :dueAt="inOneHour" label="Warning" />
|
|
30
|
+
<SlaTimer :dueAt="overdue" label="Overdue" />
|
|
31
|
+
<SlaTimer :dueAt="overdue" :breached="true" label="Breached" />
|
|
32
|
+
</div>
|
|
33
|
+
`,
|
|
34
|
+
}),
|
|
35
|
+
};
|
|
@@ -7,7 +7,10 @@ const props = defineProps({
|
|
|
7
7
|
label: { type: String, default: 'Due' },
|
|
8
8
|
});
|
|
9
9
|
|
|
10
|
-
const dark = inject(
|
|
10
|
+
const dark = inject(
|
|
11
|
+
'esc-dark',
|
|
12
|
+
computed(() => false),
|
|
13
|
+
);
|
|
11
14
|
|
|
12
15
|
const timeRemaining = computed(() => {
|
|
13
16
|
if (!props.dueAt) return null;
|
|
@@ -32,14 +35,24 @@ const statusClass = computed(() => {
|
|
|
32
35
|
const due = new Date(props.dueAt);
|
|
33
36
|
const hoursLeft = (due - new Date()) / 3600000;
|
|
34
37
|
if (hoursLeft < 2) {
|
|
35
|
-
return dark
|
|
38
|
+
return dark
|
|
39
|
+
? 'border-amber-500/20 bg-amber-500/10 text-amber-400'
|
|
40
|
+
: 'border-yellow-300 bg-yellow-50 text-yellow-700';
|
|
36
41
|
}
|
|
37
|
-
return dark
|
|
42
|
+
return dark
|
|
43
|
+
? 'border-emerald-500/20 bg-emerald-500/10 text-emerald-400'
|
|
44
|
+
: 'border-green-300 bg-green-50 text-green-700';
|
|
38
45
|
});
|
|
39
46
|
</script>
|
|
40
47
|
|
|
41
48
|
<template>
|
|
42
|
-
<div
|
|
49
|
+
<div
|
|
50
|
+
v-if="dueAt"
|
|
51
|
+
role="timer"
|
|
52
|
+
aria-live="polite"
|
|
53
|
+
aria-label="SLA timer"
|
|
54
|
+
:class="['rounded-lg border px-3 py-2 text-sm', statusClass]"
|
|
55
|
+
>
|
|
43
56
|
<div class="font-medium">{{ label }}</div>
|
|
44
57
|
<div class="text-xs">
|
|
45
58
|
<span v-if="breached">SLA Breached</span>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import StatsCard from './StatsCard.vue';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: 'Components/StatsCard',
|
|
5
|
+
component: StatsCard,
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export const Basic = { args: { label: 'Open Tickets', value: 142 } };
|
|
9
|
+
export const WithTrend = { args: { label: 'Resolved Today', value: 38, trend: '+12% this week' } };
|
|
10
|
+
export const WithColor = { args: { label: 'SLA Breaches', value: 3, trend: '-25% vs last week', color: 'red' } };
|
|
11
|
+
|
|
12
|
+
export const DashboardGrid = {
|
|
13
|
+
render: () => ({
|
|
14
|
+
components: { StatsCard },
|
|
15
|
+
template: `
|
|
16
|
+
<div class="grid grid-cols-2 gap-4" style="max-width: 600px;">
|
|
17
|
+
<StatsCard label="Open Tickets" :value="142" trend="+8% this week" color="blue" />
|
|
18
|
+
<StatsCard label="Resolved Today" :value="38" trend="+12% vs yesterday" color="green" />
|
|
19
|
+
<StatsCard label="Avg Response" value="2h 14m" trend="-18% improvement" color="cyan" />
|
|
20
|
+
<StatsCard label="SLA Breaches" :value="3" trend="-25% vs last week" color="red" />
|
|
21
|
+
</div>
|
|
22
|
+
`,
|
|
23
|
+
}),
|
|
24
|
+
};
|
|
@@ -1,46 +1,58 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import { inject, computed } from 'vue';
|
|
3
|
-
|
|
4
|
-
const props = defineProps({
|
|
5
|
-
label: { type: String, default: '' },
|
|
6
|
-
title: { type: String, default: '' },
|
|
7
|
-
value: { type: [Number, String], required: true },
|
|
8
|
-
trend: { type: String, default: null },
|
|
9
|
-
color: { type: String, default: 'blue' },
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
const escDark = inject(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
</div>
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
</
|
|
1
|
+
<script setup>
|
|
2
|
+
import { inject, computed } from 'vue';
|
|
3
|
+
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
label: { type: String, default: '' },
|
|
6
|
+
title: { type: String, default: '' },
|
|
7
|
+
value: { type: [Number, String], required: true },
|
|
8
|
+
trend: { type: String, default: null },
|
|
9
|
+
color: { type: String, default: 'blue' },
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
const escDark = inject(
|
|
13
|
+
'esc-dark',
|
|
14
|
+
computed(() => false),
|
|
15
|
+
);
|
|
16
|
+
const displayLabel = computed(() => props.label || props.title || '');
|
|
17
|
+
|
|
18
|
+
const lightColorMap = {
|
|
19
|
+
blue: 'bg-blue-50 text-blue-700',
|
|
20
|
+
indigo: 'bg-indigo-50 text-indigo-700',
|
|
21
|
+
green: 'bg-green-50 text-green-700',
|
|
22
|
+
red: 'bg-red-50 text-red-700',
|
|
23
|
+
yellow: 'bg-yellow-50 text-yellow-700',
|
|
24
|
+
gray: 'bg-gray-50 text-gray-700',
|
|
25
|
+
cyan: 'bg-cyan-50 text-cyan-700',
|
|
26
|
+
violet: 'bg-violet-50 text-violet-700',
|
|
27
|
+
amber: 'bg-amber-50 text-amber-700',
|
|
28
|
+
};
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<template>
|
|
32
|
+
<!-- Dark mode -->
|
|
33
|
+
<div v-if="escDark" class="rounded-xl border border-[var(--esc-panel-border)] bg-[var(--esc-panel-surface)] p-5">
|
|
34
|
+
<div class="text-[13px] font-medium text-[var(--esc-panel-text-muted)]">{{ displayLabel }}</div>
|
|
35
|
+
<div class="mt-2 text-2xl font-bold tracking-tight text-[var(--esc-panel-text)]">{{ value }}</div>
|
|
36
|
+
<div
|
|
37
|
+
v-if="trend"
|
|
38
|
+
class="mt-2 inline-flex items-center rounded-full bg-[var(--esc-panel-hover)] px-2 py-0.5 text-xs font-medium text-[var(--esc-panel-text-tertiary)]"
|
|
39
|
+
>
|
|
40
|
+
{{ trend }}
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
43
|
+
|
|
44
|
+
<!-- Light mode -->
|
|
45
|
+
<div v-else class="rounded-lg border border-gray-200 bg-white p-4">
|
|
46
|
+
<div class="text-sm text-gray-500">{{ displayLabel }}</div>
|
|
47
|
+
<div class="mt-1 text-2xl font-bold text-gray-900">{{ value }}</div>
|
|
48
|
+
<div
|
|
49
|
+
v-if="trend"
|
|
50
|
+
:class="[
|
|
51
|
+
'mt-1 inline-block rounded-full px-2 py-0.5 text-xs font-medium',
|
|
52
|
+
lightColorMap[color] || lightColorMap.blue,
|
|
53
|
+
]"
|
|
54
|
+
>
|
|
55
|
+
{{ trend }}
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
58
|
+
</template>
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import StatusBadge from './StatusBadge.vue';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: 'Components/StatusBadge',
|
|
5
|
+
component: StatusBadge,
|
|
6
|
+
argTypes: {
|
|
7
|
+
status: {
|
|
8
|
+
control: 'select',
|
|
9
|
+
options: [
|
|
10
|
+
'open',
|
|
11
|
+
'in_progress',
|
|
12
|
+
'waiting_on_customer',
|
|
13
|
+
'waiting_on_agent',
|
|
14
|
+
'escalated',
|
|
15
|
+
'resolved',
|
|
16
|
+
'closed',
|
|
17
|
+
'reopened',
|
|
18
|
+
],
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const Open = { args: { status: 'open' } };
|
|
24
|
+
export const InProgress = { args: { status: 'in_progress' } };
|
|
25
|
+
export const WaitingOnCustomer = { args: { status: 'waiting_on_customer' } };
|
|
26
|
+
export const Escalated = { args: { status: 'escalated' } };
|
|
27
|
+
export const Resolved = { args: { status: 'resolved' } };
|
|
28
|
+
export const Closed = { args: { status: 'closed' } };
|
|
29
|
+
|
|
30
|
+
export const AllStatuses = {
|
|
31
|
+
render: () => ({
|
|
32
|
+
components: { StatusBadge },
|
|
33
|
+
template: `
|
|
34
|
+
<div class="flex flex-wrap items-center gap-2">
|
|
35
|
+
<StatusBadge status="open" />
|
|
36
|
+
<StatusBadge status="in_progress" />
|
|
37
|
+
<StatusBadge status="waiting_on_customer" />
|
|
38
|
+
<StatusBadge status="waiting_on_agent" />
|
|
39
|
+
<StatusBadge status="escalated" />
|
|
40
|
+
<StatusBadge status="resolved" />
|
|
41
|
+
<StatusBadge status="closed" />
|
|
42
|
+
<StatusBadge status="reopened" />
|
|
43
|
+
</div>
|
|
44
|
+
`,
|
|
45
|
+
}),
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export const CustomStatus = {
|
|
49
|
+
args: {
|
|
50
|
+
status: 'custom_pending_review',
|
|
51
|
+
customStatus: { label: 'Pending Review', color: '#8b5cf6' },
|
|
52
|
+
},
|
|
53
|
+
};
|
|
@@ -3,15 +3,25 @@ import { inject, computed } from 'vue';
|
|
|
3
3
|
|
|
4
4
|
const props = defineProps({
|
|
5
5
|
status: { type: String, required: true },
|
|
6
|
+
customStatus: { type: Object, default: null },
|
|
6
7
|
});
|
|
7
8
|
|
|
8
|
-
const escDark = inject(
|
|
9
|
+
const escDark = inject(
|
|
10
|
+
'esc-dark',
|
|
11
|
+
computed(() => false),
|
|
12
|
+
);
|
|
9
13
|
|
|
10
14
|
const darkConfig = {
|
|
11
15
|
open: { label: 'Open', color: 'bg-cyan-500/10 text-white ring-1 ring-cyan-500/20' },
|
|
12
16
|
in_progress: { label: 'In Progress', color: 'bg-violet-500/10 text-violet-400 ring-1 ring-violet-500/20' },
|
|
13
|
-
waiting_on_customer: {
|
|
14
|
-
|
|
17
|
+
waiting_on_customer: {
|
|
18
|
+
label: 'Waiting on Customer',
|
|
19
|
+
color: 'bg-amber-500/10 text-amber-400 ring-1 ring-amber-500/20',
|
|
20
|
+
},
|
|
21
|
+
waiting_on_agent: {
|
|
22
|
+
label: 'Waiting on Agent',
|
|
23
|
+
color: 'bg-orange-500/10 text-orange-400 ring-1 ring-orange-500/20',
|
|
24
|
+
},
|
|
15
25
|
escalated: { label: 'Escalated', color: 'bg-rose-500/10 text-rose-400 ring-1 ring-rose-500/20' },
|
|
16
26
|
resolved: { label: 'Resolved', color: 'bg-emerald-500/10 text-emerald-400 ring-1 ring-emerald-500/20' },
|
|
17
27
|
closed: { label: 'Closed', color: 'bg-gray-500/10 text-gray-400 ring-1 ring-gray-500/20' },
|
|
@@ -33,6 +43,15 @@ const fallback = { label: props.status, color: 'bg-gray-100 text-gray-800' };
|
|
|
33
43
|
const darkFallback = { label: props.status, color: 'bg-gray-500/10 text-gray-400 ring-1 ring-gray-500/20' };
|
|
34
44
|
|
|
35
45
|
const config = computed(() => {
|
|
46
|
+
// When a customStatus object is provided, use its label and color directly
|
|
47
|
+
if (props.customStatus) {
|
|
48
|
+
const hex = props.customStatus.color || '#6b7280';
|
|
49
|
+
return {
|
|
50
|
+
label: props.customStatus.label || props.status,
|
|
51
|
+
color: '',
|
|
52
|
+
customColor: hex,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
36
55
|
const map = escDark.value ? darkConfig : lightConfig;
|
|
37
56
|
const fb = escDark.value ? darkFallback : fallback;
|
|
38
57
|
return map[props.status] || fb;
|
|
@@ -40,7 +59,20 @@ const config = computed(() => {
|
|
|
40
59
|
</script>
|
|
41
60
|
|
|
42
61
|
<template>
|
|
43
|
-
<span
|
|
62
|
+
<span
|
|
63
|
+
role="status"
|
|
64
|
+
:aria-label="'Status: ' + config.label"
|
|
65
|
+
:class="['inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium', config.color]"
|
|
66
|
+
:style="
|
|
67
|
+
config.customColor
|
|
68
|
+
? {
|
|
69
|
+
backgroundColor: config.customColor + '1a',
|
|
70
|
+
color: config.customColor,
|
|
71
|
+
boxShadow: 'inset 0 0 0 1px ' + config.customColor + '33',
|
|
72
|
+
}
|
|
73
|
+
: {}
|
|
74
|
+
"
|
|
75
|
+
>
|
|
44
76
|
{{ config.label }}
|
|
45
77
|
</span>
|
|
46
78
|
</template>
|