@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.
- package/LICENSE +21 -21
- package/README.md +125 -2
- package/package.json +40 -5
- package/src/components/ActiveChatsPanel.vue +246 -0
- package/src/components/ActivityTimeline.stories.js +55 -0
- package/src/components/ActivityTimeline.vue +83 -66
- package/src/components/AdminDashboard.stories.js +1423 -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 +65 -37
- package/src/components/AuditLogEntry.vue +95 -0
- package/src/components/BulkActionBar.vue +166 -97
- package/src/components/CategoryTree.vue +89 -0
- package/src/components/ChartWidget.vue +46 -0
- package/src/components/ChatActionBar.vue +226 -0
- package/src/components/ChatBubble.vue +162 -0
- package/src/components/ChatComposer.vue +308 -0
- package/src/components/ChatQueue.vue +222 -0
- package/src/components/ChatThread.vue +197 -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 +424 -70
- package/src/components/FileDropzone.vue +57 -41
- package/src/components/FollowButton.stories.js +30 -0
- package/src/components/FollowButton.vue +88 -63
- package/src/components/KeyboardShortcutHelp.vue +213 -123
- 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 +150 -90
- package/src/components/MentionDropdown.vue +154 -0
- package/src/components/MetricComparison.vue +89 -0
- package/src/components/PercentileChart.vue +67 -0
- package/src/components/PeriodSelector.vue +98 -0
- package/src/components/PermissionMatrix.vue +107 -0
- package/src/components/PinnedNotes.vue +129 -90
- package/src/components/PluginSlot.vue +68 -62
- package/src/components/PresenceIndicator.vue +138 -28
- 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 +207 -30
- package/src/components/ReplyThread.vue +111 -21
- package/src/components/ReportChart.vue +395 -0
- package/src/components/ReportExportButton.vue +108 -0
- package/src/components/SatisfactionRating.vue +180 -128
- package/src/components/SaveViewDialog.vue +172 -0
- package/src/components/SavedViewSidebar.vue +208 -0
- 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 +46 -0
- package/src/components/SlaTimer.stories.js +35 -0
- package/src/components/SlaTimer.vue +62 -49
- package/src/components/SnoozeButton.vue +247 -0
- package/src/components/StatsCard.stories.js +24 -0
- package/src/components/StatsCard.vue +18 -6
- 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 +247 -46
- package/src/components/TicketLinkPanel.vue +193 -0
- package/src/components/TicketList.vue +536 -74
- package/src/components/TicketMergeDialog.vue +157 -0
- package/src/components/TicketSidebar.vue +167 -99
- package/src/components/TicketSplitDialog.vue +98 -0
- 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/components/VariableTokenInput.vue +111 -0
- package/src/components/WorkflowActionConfig.vue +287 -0
- package/src/components/WorkflowActionList.vue +350 -0
- package/src/components/WorkflowConditionBuilder.vue +265 -0
- package/src/components/WorkflowTriggerSelector.vue +125 -0
- package/src/composables/useChat.js +187 -0
- package/src/composables/useDebouncedSearch.js +38 -0
- package/src/composables/useI18n.js +80 -80
- package/src/composables/useKeyboardShortcuts.js +46 -46
- package/src/composables/useMentions.js +134 -0
- package/src/composables/usePluginExtensions.js +159 -67
- package/src/composables/usePluginHooks.js +65 -0
- package/src/composables/useRealtime.js +182 -0
- package/src/defineEscalatedPlugin.js +76 -50
- package/src/index.js +77 -28
- package/src/locales/ar.json +727 -0
- package/src/locales/de.json +678 -430
- package/src/locales/en.json +717 -430
- package/src/locales/es.json +679 -430
- package/src/locales/fr.json +680 -431
- package/src/locales/index.js +12 -2
- package/src/locales/it.json +727 -0
- package/src/locales/ja.json +727 -0
- package/src/locales/ko.json +727 -0
- package/src/locales/nl.json +727 -0
- package/src/locales/pl.json +727 -0
- package/src/locales/pt-BR.json +727 -0
- package/src/locales/ru.json +727 -0
- package/src/locales/tr.json +727 -0
- package/src/locales/zh-CN.json +727 -0
- package/src/pages/Admin/ApiTokens/Index.vue +381 -217
- package/src/pages/Admin/AuditLog/Index.vue +154 -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 +82 -25
- 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 +35 -11
- package/src/pages/Admin/Departments/Index.vue +74 -21
- package/src/pages/Admin/EscalationRules/Form.vue +86 -25
- package/src/pages/Admin/EscalationRules/Index.vue +158 -37
- package/src/pages/Admin/Import/Connect.vue +95 -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 +448 -287
- package/src/pages/Admin/Plugins/Index.vue +327 -197
- package/src/pages/Admin/Reports/AgentDetail.vue +132 -0
- package/src/pages/Admin/Reports/AgentMetrics.vue +115 -0
- package/src/pages/Admin/Reports/AgentRanking.vue +246 -0
- package/src/pages/Admin/Reports/Cohorts.vue +180 -0
- package/src/pages/Admin/Reports/Comparison.vue +141 -0
- package/src/pages/Admin/Reports/CsatReport.vue +127 -0
- package/src/pages/Admin/Reports/Dashboard.vue +226 -0
- package/src/pages/Admin/Reports/ResolutionTimes.vue +164 -0
- package/src/pages/Admin/Reports/ResponseTimes.vue +164 -0
- package/src/pages/Admin/Reports/SlaReport.vue +162 -0
- package/src/pages/Admin/Reports/SlaTrends.vue +183 -0
- package/src/pages/Admin/Reports.vue +206 -101
- 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 +847 -99
- 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 +62 -19
- package/src/pages/Admin/SlaPolicies/Index.vue +85 -23
- 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 +121 -35
- package/src/pages/Admin/Tickets/Index.vue +96 -9
- package/src/pages/Admin/Tickets/Show.vue +130 -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/Admin/Workflows/Builder.vue +207 -0
- package/src/pages/Admin/Workflows/Index.vue +235 -0
- package/src/pages/Admin/Workflows/Logs.vue +286 -0
- package/src/pages/Agent/Dashboard.vue +311 -186
- package/src/pages/Agent/TicketIndex.vue +80 -6
- package/src/pages/Agent/TicketShow.vue +399 -60
- package/src/pages/Customer/Create.vue +37 -10
- package/src/pages/Customer/Index.vue +9 -2
- package/src/pages/Customer/KnowledgeBase/Article.vue +129 -0
- package/src/pages/Customer/KnowledgeBase/Index.vue +151 -0
- package/src/pages/Customer/Show.vue +69 -63
- package/src/pages/Guest/Create.vue +40 -15
- package/src/pages/Guest/Show.vue +124 -93
- package/src/plugin.js +111 -1
- package/src/utils/constants.js +30 -0
- package/src/utils/formatting.js +35 -0
- package/src/utils/mentionHighlight.js +24 -0
- package/src/utils/sanitizeHtml.js +78 -64
- package/src/widget/EscalatedWidget.vue +804 -0
- package/src/widget/index.js +254 -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,46 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
defineProps({
|
|
3
|
+
data: { type: Array, default: () => [] },
|
|
4
|
+
});
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<template>
|
|
8
|
+
<div class="rounded-xl border border-white/[0.06] bg-neutral-900/60 p-5">
|
|
9
|
+
<h3 class="mb-4 text-sm font-semibold text-neutral-200">SLA Compliance by Policy</h3>
|
|
10
|
+
<div v-if="data.length" class="space-y-4">
|
|
11
|
+
<div v-for="item in data" :key="item.policy_name">
|
|
12
|
+
<div class="mb-1.5 flex items-center justify-between">
|
|
13
|
+
<span class="text-sm font-medium text-neutral-300">{{ item.policy_name }}</span>
|
|
14
|
+
<span class="text-xs text-neutral-500">{{ item.total }} tickets</span>
|
|
15
|
+
</div>
|
|
16
|
+
<div class="flex h-6 overflow-hidden rounded-full bg-white/[0.04]">
|
|
17
|
+
<div
|
|
18
|
+
class="h-full rounded-l-full bg-emerald-500/80 transition-all"
|
|
19
|
+
:style="{ width: item.total > 0 ? `${(item.met / item.total) * 100}%` : '0%' }"
|
|
20
|
+
:title="`Met: ${item.met}`"
|
|
21
|
+
></div>
|
|
22
|
+
<div
|
|
23
|
+
class="h-full bg-red-500/80 transition-all"
|
|
24
|
+
:class="{ 'rounded-r-full': item.met === 0, 'rounded-r-full': true }"
|
|
25
|
+
:style="{ width: item.total > 0 ? `${(item.breached / item.total) * 100}%` : '0%' }"
|
|
26
|
+
:title="`Breached: ${item.breached}`"
|
|
27
|
+
></div>
|
|
28
|
+
</div>
|
|
29
|
+
<div class="mt-1 flex items-center gap-4 text-xs">
|
|
30
|
+
<span class="flex items-center gap-1 text-emerald-400">
|
|
31
|
+
<span class="inline-block h-2 w-2 rounded-full bg-emerald-500"></span>
|
|
32
|
+
Met: {{ item.met }}
|
|
33
|
+
</span>
|
|
34
|
+
<span class="flex items-center gap-1 text-red-400">
|
|
35
|
+
<span class="inline-block h-2 w-2 rounded-full bg-red-500"></span>
|
|
36
|
+
Breached: {{ item.breached }}
|
|
37
|
+
</span>
|
|
38
|
+
<span v-if="item.total > 0" class="text-neutral-500">
|
|
39
|
+
{{ Math.round((item.met / item.total) * 100) }}% compliance
|
|
40
|
+
</span>
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|
|
44
|
+
<div v-else class="py-6 text-center text-sm text-neutral-500">No SLA data available</div>
|
|
45
|
+
</div>
|
|
46
|
+
</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,247 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { inject, computed, ref } from 'vue';
|
|
3
|
+
import { router, useForm } from '@inertiajs/vue3';
|
|
4
|
+
|
|
5
|
+
const props = defineProps({
|
|
6
|
+
ticket: { type: Object, required: true },
|
|
7
|
+
routePrefix: { type: String, default: 'escalated.admin' },
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
const escDark = inject(
|
|
11
|
+
'esc-dark',
|
|
12
|
+
computed(() => false),
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
const showMenu = ref(false);
|
|
16
|
+
const showCustom = ref(false);
|
|
17
|
+
const customDatetime = ref('');
|
|
18
|
+
|
|
19
|
+
const snoozeForm = useForm({ snoozed_until: '' });
|
|
20
|
+
|
|
21
|
+
function snoozeUntil(datetime) {
|
|
22
|
+
snoozeForm.snoozed_until = datetime;
|
|
23
|
+
snoozeForm.post(route(`${props.routePrefix}.tickets.snooze`, props.ticket.reference), {
|
|
24
|
+
preserveScroll: true,
|
|
25
|
+
onSuccess: () => {
|
|
26
|
+
showMenu.value = false;
|
|
27
|
+
showCustom.value = false;
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function snoozePreset(hours) {
|
|
33
|
+
const dt = new Date(Date.now() + hours * 3600 * 1000);
|
|
34
|
+
snoozeUntil(dt.toISOString());
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function snoozeTomorrow9am() {
|
|
38
|
+
const dt = new Date();
|
|
39
|
+
dt.setDate(dt.getDate() + 1);
|
|
40
|
+
dt.setHours(9, 0, 0, 0);
|
|
41
|
+
snoozeUntil(dt.toISOString());
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function snoozeNextMonday9am() {
|
|
45
|
+
const dt = new Date();
|
|
46
|
+
const day = dt.getDay();
|
|
47
|
+
const daysUntilMonday = day === 0 ? 1 : 8 - day;
|
|
48
|
+
dt.setDate(dt.getDate() + daysUntilMonday);
|
|
49
|
+
dt.setHours(9, 0, 0, 0);
|
|
50
|
+
snoozeUntil(dt.toISOString());
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function snoozeCustom() {
|
|
54
|
+
if (customDatetime.value) {
|
|
55
|
+
snoozeUntil(new Date(customDatetime.value).toISOString());
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function unsnooze() {
|
|
60
|
+
router.post(route(`${props.routePrefix}.tickets.unsnooze`, props.ticket.reference), {}, { preserveScroll: true });
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function formatSnoozedUntil(dateStr) {
|
|
64
|
+
if (!dateStr) return '';
|
|
65
|
+
const dt = new Date(dateStr);
|
|
66
|
+
return dt.toLocaleString(undefined, {
|
|
67
|
+
month: 'short',
|
|
68
|
+
day: 'numeric',
|
|
69
|
+
year: 'numeric',
|
|
70
|
+
hour: 'numeric',
|
|
71
|
+
minute: '2-digit',
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Close menu on outside click
|
|
76
|
+
function onClickOutside(e) {
|
|
77
|
+
if (!e.target.closest('[data-snooze-menu]')) {
|
|
78
|
+
showMenu.value = false;
|
|
79
|
+
showCustom.value = false;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
import { watch } from 'vue';
|
|
84
|
+
watch(showMenu, (val) => {
|
|
85
|
+
if (val) {
|
|
86
|
+
document.addEventListener('click', onClickOutside, true);
|
|
87
|
+
} else {
|
|
88
|
+
document.removeEventListener('click', onClickOutside, true);
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
</script>
|
|
92
|
+
|
|
93
|
+
<template>
|
|
94
|
+
<!-- Snoozed banner -->
|
|
95
|
+
<div
|
|
96
|
+
v-if="ticket.is_snoozed || (ticket.snoozed_until && new Date(ticket.snoozed_until) > new Date())"
|
|
97
|
+
:class="[
|
|
98
|
+
'flex items-center gap-3 rounded-lg px-4 py-2.5 text-sm font-medium',
|
|
99
|
+
escDark
|
|
100
|
+
? 'border border-amber-500/20 bg-amber-500/10 text-amber-300'
|
|
101
|
+
: 'border border-amber-200 bg-amber-50 text-amber-800',
|
|
102
|
+
]"
|
|
103
|
+
>
|
|
104
|
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 shrink-0" viewBox="0 0 20 20" fill="currentColor">
|
|
105
|
+
<path
|
|
106
|
+
fill-rule="evenodd"
|
|
107
|
+
d="M10 18a8 8 0 100-16 8 8 0 000 16zm1-12a1 1 0 10-2 0v4a1 1 0 00.293.707l2.828 2.828a1 1 0 101.415-1.414L11 9.586V6z"
|
|
108
|
+
clip-rule="evenodd"
|
|
109
|
+
/>
|
|
110
|
+
</svg>
|
|
111
|
+
<span>Snoozed until {{ formatSnoozedUntil(ticket.snoozed_until) }}</span>
|
|
112
|
+
<button
|
|
113
|
+
:class="[
|
|
114
|
+
'ml-auto rounded-md px-3 py-1 text-xs font-semibold transition-colors',
|
|
115
|
+
escDark
|
|
116
|
+
? 'bg-amber-500/20 text-amber-300 hover:bg-amber-500/30'
|
|
117
|
+
: 'bg-amber-200 text-amber-900 hover:bg-amber-300',
|
|
118
|
+
]"
|
|
119
|
+
@click="unsnooze"
|
|
120
|
+
>
|
|
121
|
+
Unsnooze
|
|
122
|
+
</button>
|
|
123
|
+
</div>
|
|
124
|
+
|
|
125
|
+
<!-- Snooze button with dropdown -->
|
|
126
|
+
<div
|
|
127
|
+
v-if="!ticket.is_snoozed && !(ticket.snoozed_until && new Date(ticket.snoozed_until) > new Date())"
|
|
128
|
+
class="relative"
|
|
129
|
+
data-snooze-menu
|
|
130
|
+
>
|
|
131
|
+
<button
|
|
132
|
+
:class="[
|
|
133
|
+
'inline-flex items-center gap-1.5 rounded-lg px-3 py-1.5 text-sm font-medium transition-colors',
|
|
134
|
+
escDark
|
|
135
|
+
? 'border border-[var(--esc-panel-border-input)] bg-[var(--esc-panel-surface-alt)] text-[var(--esc-panel-text-secondary)] hover:bg-[var(--esc-panel-surface)]'
|
|
136
|
+
: 'border border-gray-300 bg-white text-gray-700 hover:bg-gray-50',
|
|
137
|
+
]"
|
|
138
|
+
@click.stop="showMenu = !showMenu"
|
|
139
|
+
>
|
|
140
|
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" viewBox="0 0 20 20" fill="currentColor">
|
|
141
|
+
<path
|
|
142
|
+
fill-rule="evenodd"
|
|
143
|
+
d="M10 18a8 8 0 100-16 8 8 0 000 16zm1-12a1 1 0 10-2 0v4a1 1 0 00.293.707l2.828 2.828a1 1 0 101.415-1.414L11 9.586V6z"
|
|
144
|
+
clip-rule="evenodd"
|
|
145
|
+
/>
|
|
146
|
+
</svg>
|
|
147
|
+
Snooze
|
|
148
|
+
</button>
|
|
149
|
+
<div
|
|
150
|
+
v-if="showMenu"
|
|
151
|
+
:class="[
|
|
152
|
+
'absolute right-0 top-full z-50 mt-1 w-56 rounded-lg border py-1 shadow-xl',
|
|
153
|
+
escDark ? 'border-white/[0.08] bg-neutral-800' : 'border-gray-200 bg-white',
|
|
154
|
+
]"
|
|
155
|
+
>
|
|
156
|
+
<button
|
|
157
|
+
v-if="!showCustom"
|
|
158
|
+
:class="[
|
|
159
|
+
'flex w-full items-center gap-2 px-3 py-2 text-left text-sm transition-colors',
|
|
160
|
+
escDark ? 'text-neutral-300 hover:bg-white/[0.06]' : 'text-gray-700 hover:bg-gray-50',
|
|
161
|
+
]"
|
|
162
|
+
@click="snoozePreset(1)"
|
|
163
|
+
>
|
|
164
|
+
1 hour
|
|
165
|
+
</button>
|
|
166
|
+
<button
|
|
167
|
+
v-if="!showCustom"
|
|
168
|
+
:class="[
|
|
169
|
+
'flex w-full items-center gap-2 px-3 py-2 text-left text-sm transition-colors',
|
|
170
|
+
escDark ? 'text-neutral-300 hover:bg-white/[0.06]' : 'text-gray-700 hover:bg-gray-50',
|
|
171
|
+
]"
|
|
172
|
+
@click="snoozePreset(4)"
|
|
173
|
+
>
|
|
174
|
+
4 hours
|
|
175
|
+
</button>
|
|
176
|
+
<button
|
|
177
|
+
v-if="!showCustom"
|
|
178
|
+
:class="[
|
|
179
|
+
'flex w-full items-center gap-2 px-3 py-2 text-left text-sm transition-colors',
|
|
180
|
+
escDark ? 'text-neutral-300 hover:bg-white/[0.06]' : 'text-gray-700 hover:bg-gray-50',
|
|
181
|
+
]"
|
|
182
|
+
@click="snoozeTomorrow9am"
|
|
183
|
+
>
|
|
184
|
+
Tomorrow 9am
|
|
185
|
+
</button>
|
|
186
|
+
<button
|
|
187
|
+
v-if="!showCustom"
|
|
188
|
+
:class="[
|
|
189
|
+
'flex w-full items-center gap-2 px-3 py-2 text-left text-sm transition-colors',
|
|
190
|
+
escDark ? 'text-neutral-300 hover:bg-white/[0.06]' : 'text-gray-700 hover:bg-gray-50',
|
|
191
|
+
]"
|
|
192
|
+
@click="snoozeNextMonday9am"
|
|
193
|
+
>
|
|
194
|
+
Next Monday 9am
|
|
195
|
+
</button>
|
|
196
|
+
<div
|
|
197
|
+
v-if="!showCustom"
|
|
198
|
+
:class="['my-1 border-t', escDark ? 'border-white/[0.06]' : 'border-gray-100']"
|
|
199
|
+
></div>
|
|
200
|
+
<button
|
|
201
|
+
v-if="!showCustom"
|
|
202
|
+
:class="[
|
|
203
|
+
'flex w-full items-center gap-2 px-3 py-2 text-left text-sm transition-colors',
|
|
204
|
+
escDark ? 'text-neutral-300 hover:bg-white/[0.06]' : 'text-gray-700 hover:bg-gray-50',
|
|
205
|
+
]"
|
|
206
|
+
@click.stop="showCustom = true"
|
|
207
|
+
>
|
|
208
|
+
Custom date/time...
|
|
209
|
+
</button>
|
|
210
|
+
<div v-if="showCustom" class="px-3 py-2 space-y-2">
|
|
211
|
+
<input
|
|
212
|
+
v-model="customDatetime"
|
|
213
|
+
type="datetime-local"
|
|
214
|
+
:class="[
|
|
215
|
+
'w-full rounded-md border px-2 py-1.5 text-sm',
|
|
216
|
+
escDark
|
|
217
|
+
? 'border-white/10 bg-neutral-900 text-neutral-200'
|
|
218
|
+
: 'border-gray-300 bg-white text-gray-900',
|
|
219
|
+
]"
|
|
220
|
+
/>
|
|
221
|
+
<div class="flex gap-2">
|
|
222
|
+
<button
|
|
223
|
+
:class="[
|
|
224
|
+
'flex-1 rounded-md px-2 py-1 text-xs font-medium transition-colors',
|
|
225
|
+
escDark
|
|
226
|
+
? 'bg-white/[0.06] text-neutral-300 hover:bg-white/[0.1]'
|
|
227
|
+
: 'bg-gray-100 text-gray-600 hover:bg-gray-200',
|
|
228
|
+
]"
|
|
229
|
+
@click.stop="showCustom = false"
|
|
230
|
+
>
|
|
231
|
+
Back
|
|
232
|
+
</button>
|
|
233
|
+
<button
|
|
234
|
+
:class="[
|
|
235
|
+
'flex-1 rounded-md px-2 py-1 text-xs font-medium text-white transition-colors',
|
|
236
|
+
escDark ? 'bg-cyan-600 hover:bg-cyan-500' : 'bg-indigo-600 hover:bg-indigo-500',
|
|
237
|
+
]"
|
|
238
|
+
:disabled="!customDatetime"
|
|
239
|
+
@click="snoozeCustom"
|
|
240
|
+
>
|
|
241
|
+
Snooze
|
|
242
|
+
</button>
|
|
243
|
+
</div>
|
|
244
|
+
</div>
|
|
245
|
+
</div>
|
|
246
|
+
</div>
|
|
247
|
+
</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
|
+
};
|
|
@@ -9,7 +9,10 @@ const props = defineProps({
|
|
|
9
9
|
color: { type: String, default: 'blue' },
|
|
10
10
|
});
|
|
11
11
|
|
|
12
|
-
const escDark = inject(
|
|
12
|
+
const escDark = inject(
|
|
13
|
+
'esc-dark',
|
|
14
|
+
computed(() => false),
|
|
15
|
+
);
|
|
13
16
|
const displayLabel = computed(() => props.label || props.title || '');
|
|
14
17
|
|
|
15
18
|
const lightColorMap = {
|
|
@@ -27,10 +30,13 @@ const lightColorMap = {
|
|
|
27
30
|
|
|
28
31
|
<template>
|
|
29
32
|
<!-- Dark mode -->
|
|
30
|
-
<div v-if="escDark" class="rounded-xl border border-
|
|
31
|
-
<div class="text-[13px] font-medium text-
|
|
32
|
-
<div class="mt-2 text-2xl font-bold tracking-tight text-
|
|
33
|
-
<div
|
|
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
|
+
>
|
|
34
40
|
{{ trend }}
|
|
35
41
|
</div>
|
|
36
42
|
</div>
|
|
@@ -39,7 +45,13 @@ const lightColorMap = {
|
|
|
39
45
|
<div v-else class="rounded-lg border border-gray-200 bg-white p-4">
|
|
40
46
|
<div class="text-sm text-gray-500">{{ displayLabel }}</div>
|
|
41
47
|
<div class="mt-1 text-2xl font-bold text-gray-900">{{ value }}</div>
|
|
42
|
-
<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
|
+
>
|
|
43
55
|
{{ trend }}
|
|
44
56
|
</div>
|
|
45
57
|
</div>
|
|
@@ -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
|
+
};
|