@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
|
@@ -1,24 +1,31 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import EscalatedLayout from '../../components/EscalatedLayout.vue';
|
|
3
|
-
import TicketList from '../../components/TicketList.vue';
|
|
4
|
-
import TicketFilters from '../../components/TicketFilters.vue';
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
1
|
+
<script setup>
|
|
2
|
+
import EscalatedLayout from '../../components/EscalatedLayout.vue';
|
|
3
|
+
import TicketList from '../../components/TicketList.vue';
|
|
4
|
+
import TicketFilters from '../../components/TicketFilters.vue';
|
|
5
|
+
import PluginSlot from '../../components/PluginSlot.vue';
|
|
6
|
+
import { Link } from '@inertiajs/vue3';
|
|
7
|
+
import { usePluginExtensions } from '../../composables/usePluginExtensions';
|
|
8
|
+
|
|
9
|
+
defineProps({
|
|
10
|
+
tickets: Object,
|
|
11
|
+
filters: Object,
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
const { getPageComponents } = usePluginExtensions();
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<template>
|
|
18
|
+
<EscalatedLayout title="My Tickets">
|
|
19
|
+
<PluginSlot slot="customer.index.header" :components="getPageComponents('customer.index', 'header')" />
|
|
20
|
+
<div class="mb-6 flex items-center justify-between">
|
|
21
|
+
<TicketFilters :filters="filters" :route="route('escalated.customer.tickets.index')" />
|
|
22
|
+
<Link
|
|
23
|
+
:href="route('escalated.customer.tickets.create')"
|
|
24
|
+
class="rounded-lg bg-indigo-600 px-4 py-2 text-sm font-medium text-white hover:bg-indigo-700"
|
|
25
|
+
>
|
|
26
|
+
New Ticket
|
|
27
|
+
</Link>
|
|
28
|
+
</div>
|
|
29
|
+
<TicketList :tickets="tickets" route-prefix="escalated.customer.tickets" />
|
|
30
|
+
</EscalatedLayout>
|
|
31
|
+
</template>
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import EscalatedLayout from '../../../components/EscalatedLayout.vue';
|
|
3
|
+
import { router, Link } from '@inertiajs/vue3';
|
|
4
|
+
import { ref } from 'vue';
|
|
5
|
+
|
|
6
|
+
const props = defineProps({
|
|
7
|
+
article: Object,
|
|
8
|
+
related: Array,
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
const feedbackSent = ref(false);
|
|
12
|
+
|
|
13
|
+
function sendFeedback(helpful) {
|
|
14
|
+
router.post(
|
|
15
|
+
route('escalated.customer.kb.feedback', props.article.slug),
|
|
16
|
+
{
|
|
17
|
+
helpful,
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
preserveScroll: true,
|
|
21
|
+
onSuccess: () => {
|
|
22
|
+
feedbackSent.value = true;
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<template>
|
|
30
|
+
<EscalatedLayout :title="article.title">
|
|
31
|
+
<div class="mx-auto max-w-3xl">
|
|
32
|
+
<div class="mb-6">
|
|
33
|
+
<Link :href="route('escalated.customer.kb.index')" class="text-sm text-gray-500 hover:text-gray-700">
|
|
34
|
+
← Back to Knowledge Base
|
|
35
|
+
</Link>
|
|
36
|
+
</div>
|
|
37
|
+
|
|
38
|
+
<!-- Breadcrumb -->
|
|
39
|
+
<div v-if="article.category" class="mb-4 flex items-center gap-2 text-xs text-gray-500">
|
|
40
|
+
<Link :href="route('escalated.customer.kb.index')" class="hover:text-gray-700">Knowledge Base</Link>
|
|
41
|
+
<span>/</span>
|
|
42
|
+
<Link
|
|
43
|
+
:href="route('escalated.customer.kb.index', { category: article.category.id })"
|
|
44
|
+
class="hover:text-gray-700"
|
|
45
|
+
>{{ article.category.name }}</Link
|
|
46
|
+
>
|
|
47
|
+
</div>
|
|
48
|
+
|
|
49
|
+
<!-- Article -->
|
|
50
|
+
<article class="rounded-lg border border-gray-200 bg-white p-8">
|
|
51
|
+
<h1 class="mb-4 text-2xl font-bold text-gray-900">{{ article.title }}</h1>
|
|
52
|
+
<div class="mb-6 flex items-center gap-4 text-xs text-gray-500">
|
|
53
|
+
<span>{{ article.view_count }} views</span>
|
|
54
|
+
<span v-if="article.published_at"
|
|
55
|
+
>Published {{ new Date(article.published_at).toLocaleDateString() }}</span
|
|
56
|
+
>
|
|
57
|
+
</div>
|
|
58
|
+
|
|
59
|
+
<!-- Article body rendered as HTML -->
|
|
60
|
+
<div class="prose prose-gray max-w-none text-gray-700" v-html="article.body"></div>
|
|
61
|
+
</article>
|
|
62
|
+
|
|
63
|
+
<!-- Feedback -->
|
|
64
|
+
<div class="mt-6 rounded-lg border border-gray-200 bg-white p-6 text-center">
|
|
65
|
+
<template v-if="!feedbackSent">
|
|
66
|
+
<p class="mb-3 text-sm font-medium text-gray-700">Was this article helpful?</p>
|
|
67
|
+
<div class="flex items-center justify-center gap-3">
|
|
68
|
+
<button
|
|
69
|
+
class="inline-flex items-center gap-2 rounded-lg border border-gray-200 px-4 py-2 text-sm font-medium text-gray-700 transition-colors hover:border-green-300 hover:bg-green-50 hover:text-green-700"
|
|
70
|
+
@click="sendFeedback(true)"
|
|
71
|
+
>
|
|
72
|
+
<svg
|
|
73
|
+
class="h-4 w-4"
|
|
74
|
+
fill="none"
|
|
75
|
+
stroke="currentColor"
|
|
76
|
+
stroke-width="1.5"
|
|
77
|
+
viewBox="0 0 24 24"
|
|
78
|
+
>
|
|
79
|
+
<path
|
|
80
|
+
stroke-linecap="round"
|
|
81
|
+
stroke-linejoin="round"
|
|
82
|
+
d="M6.633 10.5c.806 0 1.533-.446 2.031-1.08a9.041 9.041 0 012.861-2.4c.723-.384 1.35-.956 1.653-1.715a4.498 4.498 0 00.322-1.672V3a.75.75 0 01.75-.75A2.25 2.25 0 0116.5 4.5c0 1.152-.26 2.243-.723 3.218-.266.558.107 1.282.725 1.282h3.126c1.026 0 1.945.694 2.054 1.715.045.422.068.85.068 1.285a11.95 11.95 0 01-2.649 7.521c-.388.482-.987.729-1.605.729H13.48c-.483 0-.964-.078-1.423-.23l-3.114-1.04a4.501 4.501 0 00-1.423-.23H5.904M14.25 9h2.25M5.904 18.75c.083.205.173.405.27.602.197.4-.078.898-.523.898h-.908c-.889 0-1.713-.518-1.972-1.368a12 12 0 01-.521-3.507c0-1.553.295-3.036.831-4.398C3.387 9.953 4.167 9.5 5 9.5h.904"
|
|
83
|
+
/>
|
|
84
|
+
</svg>
|
|
85
|
+
Yes
|
|
86
|
+
</button>
|
|
87
|
+
<button
|
|
88
|
+
class="inline-flex items-center gap-2 rounded-lg border border-gray-200 px-4 py-2 text-sm font-medium text-gray-700 transition-colors hover:border-red-300 hover:bg-red-50 hover:text-red-700"
|
|
89
|
+
@click="sendFeedback(false)"
|
|
90
|
+
>
|
|
91
|
+
<svg
|
|
92
|
+
class="h-4 w-4"
|
|
93
|
+
fill="none"
|
|
94
|
+
stroke="currentColor"
|
|
95
|
+
stroke-width="1.5"
|
|
96
|
+
viewBox="0 0 24 24"
|
|
97
|
+
>
|
|
98
|
+
<path
|
|
99
|
+
stroke-linecap="round"
|
|
100
|
+
stroke-linejoin="round"
|
|
101
|
+
d="M7.5 15h2.25m8.024-9.75c.011.05.028.1.052.148.591 1.2.924 2.55.924 3.977a8.96 8.96 0 01-.999 4.125m.023-8.25c-.076-.365.183-.75.575-.75h.908c.889 0 1.713.518 1.972 1.368.339 1.11.521 2.287.521 3.507 0 1.553-.295 3.036-.831 4.398C20.613 14.547 19.833 15 19 15h-.904c-.26 0-.507-.098-.672-.28a5.002 5.002 0 01-.188-.226M7.5 15c-.863 0-1.706-.12-2.514-.348m2.514.348c.26.044.507.22.672.44a4.992 4.992 0 001.423 1.305M4.986 14.652a4.5 4.5 0 01-.236-.442m.236.442c-.31.652-.762 1.168-1.285 1.5m4.78-1.5a11.92 11.92 0 01-.813 1.25m.813-1.25c-.418.593-.91 1.098-1.459 1.5m1.459-1.5a6.12 6.12 0 01-.813 1.25m-2.606 0c-.5.338-1.1.5-1.71.5h-.908c-.889 0-1.713-.518-1.972-1.368a12 12 0 01-.521-3.507c0-1.553.295-3.036.831-4.398C3.387 9.953 4.167 9.5 5 9.5h.904"
|
|
102
|
+
/>
|
|
103
|
+
</svg>
|
|
104
|
+
No
|
|
105
|
+
</button>
|
|
106
|
+
</div>
|
|
107
|
+
</template>
|
|
108
|
+
<p v-else class="text-sm text-green-600">Thank you for your feedback!</p>
|
|
109
|
+
</div>
|
|
110
|
+
|
|
111
|
+
<!-- Related Articles -->
|
|
112
|
+
<div v-if="related?.length" class="mt-6">
|
|
113
|
+
<h3 class="mb-3 text-sm font-semibold text-gray-900">Related Articles</h3>
|
|
114
|
+
<div class="space-y-2">
|
|
115
|
+
<Link
|
|
116
|
+
v-for="item in related"
|
|
117
|
+
:key="item.id"
|
|
118
|
+
:href="route('escalated.customer.kb.show', item.slug)"
|
|
119
|
+
class="block rounded-lg border border-gray-200 bg-white px-4 py-3 text-sm text-gray-700 transition-colors hover:border-gray-300 hover:bg-gray-50"
|
|
120
|
+
>
|
|
121
|
+
{{ item.title }}
|
|
122
|
+
</Link>
|
|
123
|
+
</div>
|
|
124
|
+
</div>
|
|
125
|
+
</div>
|
|
126
|
+
</EscalatedLayout>
|
|
127
|
+
</template>
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import EscalatedLayout from '../../../components/EscalatedLayout.vue';
|
|
3
|
+
import { router, Link } from '@inertiajs/vue3';
|
|
4
|
+
import { ref, watch } from 'vue';
|
|
5
|
+
|
|
6
|
+
const props = defineProps({
|
|
7
|
+
categories: Array,
|
|
8
|
+
articles: Object,
|
|
9
|
+
filters: Object,
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
const search = ref(props.filters?.search || '');
|
|
13
|
+
const selectedCategory = ref(props.filters?.category || '');
|
|
14
|
+
|
|
15
|
+
let debounceTimer;
|
|
16
|
+
function applyFilters() {
|
|
17
|
+
clearTimeout(debounceTimer);
|
|
18
|
+
debounceTimer = setTimeout(() => {
|
|
19
|
+
router.get(
|
|
20
|
+
route('escalated.customer.kb.index'),
|
|
21
|
+
{
|
|
22
|
+
search: search.value || undefined,
|
|
23
|
+
category: selectedCategory.value || undefined,
|
|
24
|
+
},
|
|
25
|
+
{ preserveState: true, preserveScroll: true },
|
|
26
|
+
);
|
|
27
|
+
}, 300);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
watch([search, selectedCategory], applyFilters);
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
<template>
|
|
34
|
+
<EscalatedLayout title="Knowledge Base">
|
|
35
|
+
<!-- Search -->
|
|
36
|
+
<div class="mb-8 text-center">
|
|
37
|
+
<h1 class="mb-3 text-2xl font-bold text-gray-900">How can we help you?</h1>
|
|
38
|
+
<div class="mx-auto max-w-lg">
|
|
39
|
+
<input
|
|
40
|
+
v-model="search"
|
|
41
|
+
type="text"
|
|
42
|
+
placeholder="Search articles..."
|
|
43
|
+
class="w-full rounded-lg border border-gray-300 bg-white px-4 py-3 text-sm text-gray-900 shadow-sm placeholder-gray-400 focus:border-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/20"
|
|
44
|
+
/>
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
|
|
48
|
+
<!-- Categories -->
|
|
49
|
+
<div v-if="categories?.length && !search" class="mb-8 grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3">
|
|
50
|
+
<button
|
|
51
|
+
v-for="cat in categories"
|
|
52
|
+
:key="cat.id"
|
|
53
|
+
:class="[
|
|
54
|
+
'rounded-lg border p-5 text-left transition-all',
|
|
55
|
+
selectedCategory == cat.id
|
|
56
|
+
? 'border-indigo-500 bg-indigo-50 shadow-sm'
|
|
57
|
+
: 'border-gray-200 bg-white hover:border-gray-300 hover:shadow-sm',
|
|
58
|
+
]"
|
|
59
|
+
@click="selectedCategory = selectedCategory == cat.id ? '' : cat.id"
|
|
60
|
+
>
|
|
61
|
+
<div class="flex items-center gap-3">
|
|
62
|
+
<div
|
|
63
|
+
:class="[
|
|
64
|
+
'flex h-10 w-10 items-center justify-center rounded-lg',
|
|
65
|
+
selectedCategory == cat.id ? 'bg-indigo-100' : 'bg-gray-100',
|
|
66
|
+
]"
|
|
67
|
+
>
|
|
68
|
+
<svg
|
|
69
|
+
:class="['h-5 w-5', selectedCategory == cat.id ? 'text-indigo-600' : 'text-gray-500']"
|
|
70
|
+
fill="none"
|
|
71
|
+
stroke="currentColor"
|
|
72
|
+
stroke-width="1.5"
|
|
73
|
+
viewBox="0 0 24 24"
|
|
74
|
+
>
|
|
75
|
+
<path
|
|
76
|
+
stroke-linecap="round"
|
|
77
|
+
stroke-linejoin="round"
|
|
78
|
+
d="M2.25 12.75V12A2.25 2.25 0 014.5 9.75h15A2.25 2.25 0 0121.75 12v.75m-8.69-6.44l-2.12-2.12a1.5 1.5 0 00-1.061-.44H4.5A2.25 2.25 0 002.25 6v12a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9a2.25 2.25 0 00-2.25-2.25h-5.379a1.5 1.5 0 01-1.06-.44z"
|
|
79
|
+
/>
|
|
80
|
+
</svg>
|
|
81
|
+
</div>
|
|
82
|
+
<div>
|
|
83
|
+
<h3
|
|
84
|
+
:class="[
|
|
85
|
+
'text-sm font-semibold',
|
|
86
|
+
selectedCategory == cat.id ? 'text-indigo-900' : 'text-gray-900',
|
|
87
|
+
]"
|
|
88
|
+
>
|
|
89
|
+
{{ cat.name }}
|
|
90
|
+
</h3>
|
|
91
|
+
<p class="text-xs text-gray-500">{{ cat.articles_count }} articles</p>
|
|
92
|
+
</div>
|
|
93
|
+
</div>
|
|
94
|
+
<p v-if="cat.description" class="mt-2 text-xs text-gray-500">{{ cat.description }}</p>
|
|
95
|
+
</button>
|
|
96
|
+
</div>
|
|
97
|
+
|
|
98
|
+
<!-- Articles -->
|
|
99
|
+
<div class="space-y-3">
|
|
100
|
+
<Link
|
|
101
|
+
v-for="article in articles.data"
|
|
102
|
+
:key="article.id"
|
|
103
|
+
:href="route('escalated.customer.kb.show', article.slug)"
|
|
104
|
+
class="block rounded-lg border border-gray-200 bg-white p-4 transition-all hover:border-gray-300 hover:shadow-sm"
|
|
105
|
+
>
|
|
106
|
+
<h3 class="text-sm font-semibold text-gray-900">{{ article.title }}</h3>
|
|
107
|
+
<div class="mt-1 flex items-center gap-3 text-xs text-gray-500">
|
|
108
|
+
<span v-if="article.category">{{ article.category.name }}</span>
|
|
109
|
+
<span>{{ article.view_count }} views</span>
|
|
110
|
+
</div>
|
|
111
|
+
</Link>
|
|
112
|
+
</div>
|
|
113
|
+
|
|
114
|
+
<div v-if="!articles.data?.length" class="py-12 text-center">
|
|
115
|
+
<svg
|
|
116
|
+
class="mx-auto mb-3 h-10 w-10 text-gray-300"
|
|
117
|
+
fill="none"
|
|
118
|
+
stroke="currentColor"
|
|
119
|
+
stroke-width="1.5"
|
|
120
|
+
viewBox="0 0 24 24"
|
|
121
|
+
>
|
|
122
|
+
<path
|
|
123
|
+
stroke-linecap="round"
|
|
124
|
+
stroke-linejoin="round"
|
|
125
|
+
d="M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m0 12.75h7.5m-7.5 3H12M10.5 2.25H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"
|
|
126
|
+
/>
|
|
127
|
+
</svg>
|
|
128
|
+
<p class="text-sm text-gray-500">No articles found.</p>
|
|
129
|
+
</div>
|
|
130
|
+
|
|
131
|
+
<!-- Pagination -->
|
|
132
|
+
<div v-if="articles.links && articles.last_page > 1" class="mt-6 flex items-center justify-center gap-1">
|
|
133
|
+
<Link
|
|
134
|
+
v-for="link in articles.links"
|
|
135
|
+
:key="link.label"
|
|
136
|
+
:href="link.url || '#'"
|
|
137
|
+
:class="[
|
|
138
|
+
'rounded-lg px-3 py-1.5 text-sm transition-colors',
|
|
139
|
+
link.active
|
|
140
|
+
? 'bg-indigo-600 text-white'
|
|
141
|
+
: link.url
|
|
142
|
+
? 'border border-gray-200 text-gray-600 hover:bg-gray-50'
|
|
143
|
+
: 'cursor-default text-gray-300',
|
|
144
|
+
]"
|
|
145
|
+
preserve-scroll
|
|
146
|
+
>
|
|
147
|
+
<!-- eslint-disable-next-line vue/no-v-html --><span v-html="link.label" />
|
|
148
|
+
</Link>
|
|
149
|
+
</div>
|
|
150
|
+
</EscalatedLayout>
|
|
151
|
+
</template>
|
package/src/plugin.js
CHANGED
|
@@ -24,6 +24,16 @@ export const EscalatedPlugin = {
|
|
|
24
24
|
if (options.theme) {
|
|
25
25
|
app.provide('escalated-theme', options.theme);
|
|
26
26
|
applyTheme(options.theme);
|
|
27
|
+
|
|
28
|
+
if (options.theme.panel) {
|
|
29
|
+
const panelConfig = options.theme.panel;
|
|
30
|
+
applyPanelTheme(panelConfig);
|
|
31
|
+
app.provide('escalated-panel', {
|
|
32
|
+
appName: panelConfig.appName || 'Escalated',
|
|
33
|
+
logo: panelConfig.logo || null,
|
|
34
|
+
mode: panelConfig.mode || 'dark',
|
|
35
|
+
});
|
|
36
|
+
}
|
|
27
37
|
}
|
|
28
38
|
},
|
|
29
39
|
};
|
|
@@ -55,7 +65,7 @@ function darken(hex, percent) {
|
|
|
55
65
|
const r = Math.max(0, (num >> 16) - Math.round(2.55 * percent));
|
|
56
66
|
const g = Math.max(0, ((num >> 8) & 0x00ff) - Math.round(2.55 * percent));
|
|
57
67
|
const b = Math.max(0, (num & 0x0000ff) - Math.round(2.55 * percent));
|
|
58
|
-
return `#${(r << 16 | g << 8 | b).toString(16).padStart(6, '0')}`;
|
|
68
|
+
return `#${((r << 16) | (g << 8) | b).toString(16).padStart(6, '0')}`;
|
|
59
69
|
}
|
|
60
70
|
|
|
61
71
|
function scaleBorderRadius(radius, factor) {
|
|
@@ -63,3 +73,78 @@ function scaleBorderRadius(radius, factor) {
|
|
|
63
73
|
if (!match) return radius;
|
|
64
74
|
return `${(parseFloat(match[1]) * factor).toFixed(2)}${match[2] || 'rem'}`;
|
|
65
75
|
}
|
|
76
|
+
|
|
77
|
+
const panelDarkDefaults = {
|
|
78
|
+
bg: '#000000',
|
|
79
|
+
sidebarBg: '#0a0a0a',
|
|
80
|
+
topbarBg: 'rgba(0,0,0,0.8)',
|
|
81
|
+
surface: 'rgba(23,23,23,0.6)',
|
|
82
|
+
surfaceAlt: '#0a0a0a',
|
|
83
|
+
border: 'rgba(255,255,255,0.06)',
|
|
84
|
+
borderInput: 'rgba(255,255,255,0.1)',
|
|
85
|
+
text: '#ffffff',
|
|
86
|
+
textSecondary: '#e5e5e5',
|
|
87
|
+
textTertiary: '#a3a3a3',
|
|
88
|
+
textMuted: '#737373',
|
|
89
|
+
accent: '#06b6d4',
|
|
90
|
+
accentSecondary: '#8b5cf6',
|
|
91
|
+
accentHover: '#22d3ee',
|
|
92
|
+
accentSecondaryHover: '#a78bfa',
|
|
93
|
+
hover: 'rgba(255,255,255,0.03)',
|
|
94
|
+
active: 'rgba(255,255,255,0.08)',
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
const panelLightDefaults = {
|
|
98
|
+
bg: '#f9fafb',
|
|
99
|
+
sidebarBg: '#ffffff',
|
|
100
|
+
topbarBg: 'rgba(255,255,255,0.95)',
|
|
101
|
+
surface: '#ffffff',
|
|
102
|
+
surfaceAlt: '#f9fafb',
|
|
103
|
+
border: '#e5e7eb',
|
|
104
|
+
borderInput: '#d1d5db',
|
|
105
|
+
text: '#111827',
|
|
106
|
+
textSecondary: '#374151',
|
|
107
|
+
textTertiary: '#6b7280',
|
|
108
|
+
textMuted: '#9ca3af',
|
|
109
|
+
accent: '#3b82f6',
|
|
110
|
+
accentSecondary: '#6366f1',
|
|
111
|
+
accentHover: '#2563eb',
|
|
112
|
+
accentSecondaryHover: '#818cf8',
|
|
113
|
+
hover: 'rgba(0,0,0,0.02)',
|
|
114
|
+
active: '#eff6ff',
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
const panelTokenMap = {
|
|
118
|
+
bg: '--esc-panel-bg',
|
|
119
|
+
sidebarBg: '--esc-panel-sidebar-bg',
|
|
120
|
+
topbarBg: '--esc-panel-topbar-bg',
|
|
121
|
+
surface: '--esc-panel-surface',
|
|
122
|
+
surfaceAlt: '--esc-panel-surface-alt',
|
|
123
|
+
border: '--esc-panel-border',
|
|
124
|
+
borderInput: '--esc-panel-border-input',
|
|
125
|
+
text: '--esc-panel-text',
|
|
126
|
+
textSecondary: '--esc-panel-text-secondary',
|
|
127
|
+
textTertiary: '--esc-panel-text-tertiary',
|
|
128
|
+
textMuted: '--esc-panel-text-muted',
|
|
129
|
+
accent: '--esc-panel-accent',
|
|
130
|
+
accentSecondary: '--esc-panel-accent-secondary',
|
|
131
|
+
accentHover: '--esc-panel-accent-hover',
|
|
132
|
+
accentSecondaryHover: '--esc-panel-accent-secondary-hover',
|
|
133
|
+
hover: '--esc-panel-hover',
|
|
134
|
+
active: '--esc-panel-active',
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
function applyPanelTheme(panelConfig) {
|
|
138
|
+
const defaults = panelConfig.mode === 'light' ? panelLightDefaults : panelDarkDefaults;
|
|
139
|
+
const overrides = {};
|
|
140
|
+
for (const key of Object.keys(panelTokenMap)) {
|
|
141
|
+
if (panelConfig[key] !== undefined) {
|
|
142
|
+
overrides[key] = panelConfig[key];
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
const merged = { ...defaults, ...overrides };
|
|
146
|
+
const style = document.documentElement.style;
|
|
147
|
+
for (const [key, cssVar] of Object.entries(panelTokenMap)) {
|
|
148
|
+
style.setProperty(cssVar, merged[key]);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared ticket constants used across multiple components.
|
|
3
|
+
* Single source of truth for statuses, priorities, and types.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export const TICKET_STATUSES = [
|
|
7
|
+
'open',
|
|
8
|
+
'in_progress',
|
|
9
|
+
'waiting_on_customer',
|
|
10
|
+
'waiting_on_agent',
|
|
11
|
+
'escalated',
|
|
12
|
+
'resolved',
|
|
13
|
+
'closed',
|
|
14
|
+
];
|
|
15
|
+
|
|
16
|
+
export const TICKET_PRIORITIES = ['low', 'medium', 'high', 'urgent', 'critical'];
|
|
17
|
+
|
|
18
|
+
export const TICKET_TYPES = [
|
|
19
|
+
{ value: 'question', label: 'Question', color: 'text-cyan-400' },
|
|
20
|
+
{ value: 'problem', label: 'Problem', color: 'text-rose-400' },
|
|
21
|
+
{ value: 'incident', label: 'Incident', color: 'text-amber-400' },
|
|
22
|
+
{ value: 'task', label: 'Task', color: 'text-violet-400' },
|
|
23
|
+
];
|
|
24
|
+
|
|
25
|
+
export const TICKET_TYPE_COLORS = {
|
|
26
|
+
question: { dark: 'bg-cyan-500/20 text-cyan-400', light: 'bg-cyan-100 text-cyan-700' },
|
|
27
|
+
problem: { dark: 'bg-rose-500/20 text-rose-400', light: 'bg-rose-100 text-rose-700' },
|
|
28
|
+
incident: { dark: 'bg-amber-500/20 text-amber-400', light: 'bg-amber-100 text-amber-700' },
|
|
29
|
+
task: { dark: 'bg-violet-500/20 text-violet-400', light: 'bg-violet-100 text-violet-700' },
|
|
30
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared formatting utilities for ticket display.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Returns a human-readable relative time string (e.g. "5m ago", "3h ago", "2d ago").
|
|
7
|
+
* @param {string|Date} date
|
|
8
|
+
* @returns {string}
|
|
9
|
+
*/
|
|
10
|
+
export function timeAgo(date) {
|
|
11
|
+
if (!date) return '';
|
|
12
|
+
const diff = Date.now() - new Date(date).getTime();
|
|
13
|
+
const mins = Math.floor(diff / 60000);
|
|
14
|
+
if (mins < 60) return `${mins}m ago`;
|
|
15
|
+
const hrs = Math.floor(mins / 60);
|
|
16
|
+
if (hrs < 24) return `${hrs}h ago`;
|
|
17
|
+
const days = Math.floor(hrs / 24);
|
|
18
|
+
return `${days}d ago`;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Returns a Tailwind CSS class for the SLA indicator dot based on ticket SLA state.
|
|
23
|
+
* @param {Object} ticket
|
|
24
|
+
* @returns {string}
|
|
25
|
+
*/
|
|
26
|
+
export function slaClass(ticket) {
|
|
27
|
+
if (ticket.sla_first_response_breached || ticket.sla_resolution_breached) return 'bg-rose-500';
|
|
28
|
+
if (ticket.first_response_due_at || ticket.resolution_due_at) {
|
|
29
|
+
const due = ticket.resolution_due_at || ticket.first_response_due_at;
|
|
30
|
+
const mins = (new Date(due) - Date.now()) / 60000;
|
|
31
|
+
if (mins < 30) return 'bg-amber-500';
|
|
32
|
+
return 'bg-emerald-500';
|
|
33
|
+
}
|
|
34
|
+
return '';
|
|
35
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sanitize HTML to prevent stored XSS.
|
|
3
|
+
*
|
|
4
|
+
* Uses the DOM parser to walk the tree and strip dangerous elements and
|
|
5
|
+
* attributes rather than regex, which avoids incomplete-sanitization pitfalls.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const DANGEROUS_TAGS = new Set([
|
|
9
|
+
'script', 'style', 'iframe', 'object', 'embed', 'form', 'input',
|
|
10
|
+
'textarea', 'button', 'select', 'option', 'link', 'meta', 'base',
|
|
11
|
+
'applet', 'noscript', 'noframes',
|
|
12
|
+
])
|
|
13
|
+
|
|
14
|
+
const URI_ATTRS = new Set(['href', 'src', 'action', 'formaction', 'xlink:href'])
|
|
15
|
+
|
|
16
|
+
export function sanitizeHtml(html) {
|
|
17
|
+
if (!html) return ''
|
|
18
|
+
|
|
19
|
+
const doc = new DOMParser().parseFromString(html, 'text/html')
|
|
20
|
+
|
|
21
|
+
// Remove dangerous elements
|
|
22
|
+
for (const tag of DANGEROUS_TAGS) {
|
|
23
|
+
const els = doc.body.getElementsByTagName(tag)
|
|
24
|
+
while (els.length) els[0].remove()
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Walk all remaining elements and strip dangerous attributes
|
|
28
|
+
const all = doc.body.querySelectorAll('*')
|
|
29
|
+
for (let i = 0; i < all.length; i++) {
|
|
30
|
+
const el = all[i]
|
|
31
|
+
const attrs = [...el.attributes]
|
|
32
|
+
for (let j = 0; j < attrs.length; j++) {
|
|
33
|
+
const name = attrs[j].name.toLowerCase()
|
|
34
|
+
|
|
35
|
+
// Remove event handlers (onclick, onerror, etc.)
|
|
36
|
+
if (name.startsWith('on')) {
|
|
37
|
+
el.removeAttribute(attrs[j].name)
|
|
38
|
+
continue
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Remove javascript: / vbscript: / dangerous data: URIs
|
|
42
|
+
if (URI_ATTRS.has(name)) {
|
|
43
|
+
const val = (attrs[j].value || '').replace(/[\s\u0000-\u001F]+/g, '').toLowerCase()
|
|
44
|
+
if (
|
|
45
|
+
val.startsWith('javascript:') ||
|
|
46
|
+
val.startsWith('vbscript:') ||
|
|
47
|
+
(val.startsWith('data:') && !val.startsWith('data:image/'))
|
|
48
|
+
) {
|
|
49
|
+
el.removeAttribute(attrs[j].name)
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Remove style attributes containing expressions or javascript
|
|
54
|
+
if (name === 'style') {
|
|
55
|
+
const val = (attrs[j].value || '').toLowerCase()
|
|
56
|
+
if (val.includes('expression(') || val.includes('javascript:') || val.includes('url(')) {
|
|
57
|
+
el.removeAttribute(attrs[j].name)
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return doc.body.innerHTML
|
|
64
|
+
}
|