@escalated-dev/escalated 0.5.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 +102 -0
- package/package.json +37 -6
- package/src/components/ActivityTimeline.stories.js +55 -0
- package/src/components/ActivityTimeline.vue +83 -66
- 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 +37 -23
- 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 +57 -41
- 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 +75 -33
- package/src/components/PresenceIndicator.vue +93 -27
- package/src/components/PriorityBadge.stories.js +33 -0
- package/src/components/PriorityBadge.vue +46 -39
- package/src/components/QuickFilters.vue +65 -49
- package/src/components/ReplyComposer.vue +273 -159
- package/src/components/ReplyThread.vue +78 -23
- 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 +62 -49
- 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 +78 -46
- package/src/components/TagSelect.vue +84 -53
- 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/useI18n.js +80 -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/de.json +442 -0
- package/src/locales/en.json +467 -0
- package/src/locales/es.json +442 -0
- package/src/locales/fr.json +442 -0
- package/src/locales/index.js +6 -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/utils/sanitizeHtml.js +64 -0
- package/src/pages/Admin/Plugins.vue +0 -129
|
@@ -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
|
+
};
|
|
@@ -1,49 +1,62 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import { computed, inject } from 'vue';
|
|
3
|
-
|
|
4
|
-
const props = defineProps({
|
|
5
|
-
dueAt: { type: String, default: null },
|
|
6
|
-
breached: { type: Boolean, default: false },
|
|
7
|
-
label: { type: String, default: 'Due' },
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
const dark = inject(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed, inject } from 'vue';
|
|
3
|
+
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
dueAt: { type: String, default: null },
|
|
6
|
+
breached: { type: Boolean, default: false },
|
|
7
|
+
label: { type: String, default: 'Due' },
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
const dark = inject(
|
|
11
|
+
'esc-dark',
|
|
12
|
+
computed(() => false),
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
const timeRemaining = computed(() => {
|
|
16
|
+
if (!props.dueAt) return null;
|
|
17
|
+
const now = new Date();
|
|
18
|
+
const due = new Date(props.dueAt);
|
|
19
|
+
const diff = due - now;
|
|
20
|
+
if (diff <= 0) return { text: 'Overdue', overdue: true };
|
|
21
|
+
|
|
22
|
+
const hours = Math.floor(diff / 3600000);
|
|
23
|
+
const minutes = Math.floor((diff % 3600000) / 60000);
|
|
24
|
+
if (hours > 24) {
|
|
25
|
+
const days = Math.floor(hours / 24);
|
|
26
|
+
return { text: `${days}d ${hours % 24}h`, overdue: false };
|
|
27
|
+
}
|
|
28
|
+
return { text: `${hours}h ${minutes}m`, overdue: false };
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const statusClass = computed(() => {
|
|
32
|
+
if (props.breached || timeRemaining.value?.overdue) {
|
|
33
|
+
return dark ? 'border-rose-500/20 bg-rose-500/10 text-rose-400' : 'border-red-300 bg-red-50 text-red-700';
|
|
34
|
+
}
|
|
35
|
+
const due = new Date(props.dueAt);
|
|
36
|
+
const hoursLeft = (due - new Date()) / 3600000;
|
|
37
|
+
if (hoursLeft < 2) {
|
|
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';
|
|
41
|
+
}
|
|
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';
|
|
45
|
+
});
|
|
46
|
+
</script>
|
|
47
|
+
|
|
48
|
+
<template>
|
|
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
|
+
>
|
|
56
|
+
<div class="font-medium">{{ label }}</div>
|
|
57
|
+
<div class="text-xs">
|
|
58
|
+
<span v-if="breached">SLA Breached</span>
|
|
59
|
+
<span v-else>{{ timeRemaining?.text }}</span>
|
|
60
|
+
</div>
|
|
61
|
+
</div>
|
|
62
|
+
</template>
|
|
@@ -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
|
+
};
|
|
@@ -1,46 +1,78 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import { inject, computed } from 'vue';
|
|
3
|
-
|
|
4
|
-
const props = defineProps({
|
|
5
|
-
status: { type: String, required: true },
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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
|
+
status: { type: String, required: true },
|
|
6
|
+
customStatus: { type: Object, default: null },
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
const escDark = inject(
|
|
10
|
+
'esc-dark',
|
|
11
|
+
computed(() => false),
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
const darkConfig = {
|
|
15
|
+
open: { label: 'Open', color: 'bg-cyan-500/10 text-white ring-1 ring-cyan-500/20' },
|
|
16
|
+
in_progress: { label: 'In Progress', color: 'bg-violet-500/10 text-violet-400 ring-1 ring-violet-500/20' },
|
|
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
|
+
},
|
|
25
|
+
escalated: { label: 'Escalated', color: 'bg-rose-500/10 text-rose-400 ring-1 ring-rose-500/20' },
|
|
26
|
+
resolved: { label: 'Resolved', color: 'bg-emerald-500/10 text-emerald-400 ring-1 ring-emerald-500/20' },
|
|
27
|
+
closed: { label: 'Closed', color: 'bg-gray-500/10 text-gray-400 ring-1 ring-gray-500/20' },
|
|
28
|
+
reopened: { label: 'Reopened', color: 'bg-cyan-500/10 text-white ring-1 ring-cyan-500/20' },
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const lightConfig = {
|
|
32
|
+
open: { label: 'Open', color: 'bg-blue-100 text-blue-800' },
|
|
33
|
+
in_progress: { label: 'In Progress', color: 'bg-purple-100 text-purple-800' },
|
|
34
|
+
waiting_on_customer: { label: 'Waiting on Customer', color: 'bg-yellow-100 text-yellow-800' },
|
|
35
|
+
waiting_on_agent: { label: 'Waiting on Agent', color: 'bg-orange-100 text-orange-800' },
|
|
36
|
+
escalated: { label: 'Escalated', color: 'bg-red-100 text-red-800' },
|
|
37
|
+
resolved: { label: 'Resolved', color: 'bg-green-100 text-green-800' },
|
|
38
|
+
closed: { label: 'Closed', color: 'bg-gray-100 text-gray-800' },
|
|
39
|
+
reopened: { label: 'Reopened', color: 'bg-blue-100 text-blue-800' },
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const fallback = { label: props.status, color: 'bg-gray-100 text-gray-800' };
|
|
43
|
+
const darkFallback = { label: props.status, color: 'bg-gray-500/10 text-gray-400 ring-1 ring-gray-500/20' };
|
|
44
|
+
|
|
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
|
+
}
|
|
55
|
+
const map = escDark.value ? darkConfig : lightConfig;
|
|
56
|
+
const fb = escDark.value ? darkFallback : fallback;
|
|
57
|
+
return map[props.status] || fb;
|
|
58
|
+
});
|
|
59
|
+
</script>
|
|
60
|
+
|
|
61
|
+
<template>
|
|
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
|
+
>
|
|
76
|
+
{{ config.label }}
|
|
77
|
+
</span>
|
|
78
|
+
</template>
|