@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.
Files changed (187) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +125 -2
  3. package/package.json +40 -5
  4. package/src/components/ActiveChatsPanel.vue +246 -0
  5. package/src/components/ActivityTimeline.stories.js +55 -0
  6. package/src/components/ActivityTimeline.vue +83 -66
  7. package/src/components/AdminDashboard.stories.js +1423 -0
  8. package/src/components/AgentLoadIndicator.stories.js +37 -0
  9. package/src/components/AgentLoadIndicator.vue +49 -0
  10. package/src/components/AgentPerformanceCard.vue +44 -0
  11. package/src/components/ArticleEditor.vue +82 -0
  12. package/src/components/AssigneeSelect.vue +37 -23
  13. package/src/components/AttachmentList.vue +65 -37
  14. package/src/components/AuditLogEntry.vue +95 -0
  15. package/src/components/BulkActionBar.vue +166 -97
  16. package/src/components/CategoryTree.vue +89 -0
  17. package/src/components/ChartWidget.vue +46 -0
  18. package/src/components/ChatActionBar.vue +226 -0
  19. package/src/components/ChatBubble.vue +162 -0
  20. package/src/components/ChatComposer.vue +308 -0
  21. package/src/components/ChatQueue.vue +222 -0
  22. package/src/components/ChatThread.vue +197 -0
  23. package/src/components/CollisionWarning.stories.js +30 -0
  24. package/src/components/CollisionWarning.vue +68 -0
  25. package/src/components/ConditionalFieldRules.vue +135 -0
  26. package/src/components/ContextPanel.vue +66 -0
  27. package/src/components/ContextPanelSection.vue +65 -0
  28. package/src/components/CustomFieldRenderer.vue +159 -0
  29. package/src/components/EscalatedLayout.vue +424 -70
  30. package/src/components/FileDropzone.vue +57 -41
  31. package/src/components/FollowButton.stories.js +30 -0
  32. package/src/components/FollowButton.vue +88 -63
  33. package/src/components/KeyboardShortcutHelp.vue +213 -123
  34. package/src/components/KnowledgePanel.vue +122 -0
  35. package/src/components/KpiCard.stories.js +32 -0
  36. package/src/components/KpiCard.vue +88 -0
  37. package/src/components/MacroDropdown.vue +150 -90
  38. package/src/components/MentionDropdown.vue +154 -0
  39. package/src/components/MetricComparison.vue +89 -0
  40. package/src/components/PercentileChart.vue +67 -0
  41. package/src/components/PeriodSelector.vue +98 -0
  42. package/src/components/PermissionMatrix.vue +107 -0
  43. package/src/components/PinnedNotes.vue +129 -90
  44. package/src/components/PluginSlot.vue +68 -62
  45. package/src/components/PresenceIndicator.vue +138 -28
  46. package/src/components/PriorityBadge.stories.js +33 -0
  47. package/src/components/PriorityBadge.vue +46 -39
  48. package/src/components/QuickFilters.vue +65 -49
  49. package/src/components/ReplyComposer.vue +207 -30
  50. package/src/components/ReplyThread.vue +111 -21
  51. package/src/components/ReportChart.vue +395 -0
  52. package/src/components/ReportExportButton.vue +108 -0
  53. package/src/components/SatisfactionRating.vue +180 -128
  54. package/src/components/SaveViewDialog.vue +172 -0
  55. package/src/components/SavedViewSidebar.vue +208 -0
  56. package/src/components/ScheduleEditor.vue +104 -0
  57. package/src/components/SideConversation.vue +165 -0
  58. package/src/components/SideConversationList.vue +147 -0
  59. package/src/components/SkillTagManager.vue +79 -0
  60. package/src/components/SlaComplianceChart.vue +46 -0
  61. package/src/components/SlaTimer.stories.js +35 -0
  62. package/src/components/SlaTimer.vue +62 -49
  63. package/src/components/SnoozeButton.vue +247 -0
  64. package/src/components/StatsCard.stories.js +24 -0
  65. package/src/components/StatsCard.vue +18 -6
  66. package/src/components/StatusBadge.stories.js +53 -0
  67. package/src/components/StatusBadge.vue +78 -46
  68. package/src/components/TagSelect.vue +84 -53
  69. package/src/components/TicketFilters.vue +247 -46
  70. package/src/components/TicketLinkPanel.vue +193 -0
  71. package/src/components/TicketList.vue +536 -74
  72. package/src/components/TicketMergeDialog.vue +157 -0
  73. package/src/components/TicketSidebar.vue +167 -99
  74. package/src/components/TicketSplitDialog.vue +98 -0
  75. package/src/components/TicketTypeSelector.vue +21 -0
  76. package/src/components/TotpInput.stories.js +9 -0
  77. package/src/components/TotpInput.vue +81 -0
  78. package/src/components/TwoFactorSetup.vue +113 -0
  79. package/src/components/VariableTokenInput.vue +111 -0
  80. package/src/components/WorkflowActionConfig.vue +287 -0
  81. package/src/components/WorkflowActionList.vue +350 -0
  82. package/src/components/WorkflowConditionBuilder.vue +265 -0
  83. package/src/components/WorkflowTriggerSelector.vue +125 -0
  84. package/src/composables/useChat.js +187 -0
  85. package/src/composables/useDebouncedSearch.js +38 -0
  86. package/src/composables/useI18n.js +80 -80
  87. package/src/composables/useKeyboardShortcuts.js +46 -46
  88. package/src/composables/useMentions.js +134 -0
  89. package/src/composables/usePluginExtensions.js +159 -67
  90. package/src/composables/usePluginHooks.js +65 -0
  91. package/src/composables/useRealtime.js +182 -0
  92. package/src/defineEscalatedPlugin.js +76 -50
  93. package/src/index.js +77 -28
  94. package/src/locales/ar.json +727 -0
  95. package/src/locales/de.json +678 -430
  96. package/src/locales/en.json +717 -430
  97. package/src/locales/es.json +679 -430
  98. package/src/locales/fr.json +680 -431
  99. package/src/locales/index.js +12 -2
  100. package/src/locales/it.json +727 -0
  101. package/src/locales/ja.json +727 -0
  102. package/src/locales/ko.json +727 -0
  103. package/src/locales/nl.json +727 -0
  104. package/src/locales/pl.json +727 -0
  105. package/src/locales/pt-BR.json +727 -0
  106. package/src/locales/ru.json +727 -0
  107. package/src/locales/tr.json +727 -0
  108. package/src/locales/zh-CN.json +727 -0
  109. package/src/pages/Admin/ApiTokens/Index.vue +381 -217
  110. package/src/pages/Admin/AuditLog/Index.vue +154 -0
  111. package/src/pages/Admin/BusinessHours/Form.vue +172 -0
  112. package/src/pages/Admin/BusinessHours/Index.vue +113 -0
  113. package/src/pages/Admin/CannedResponses/Index.vue +82 -25
  114. package/src/pages/Admin/Capacity/Index.vue +134 -0
  115. package/src/pages/Admin/CustomFields/Form.vue +195 -0
  116. package/src/pages/Admin/CustomFields/Index.vue +134 -0
  117. package/src/pages/Admin/CustomObjects/Form.vue +202 -0
  118. package/src/pages/Admin/CustomObjects/Index.vue +127 -0
  119. package/src/pages/Admin/CustomObjects/Records.vue +228 -0
  120. package/src/pages/Admin/Departments/Form.vue +35 -11
  121. package/src/pages/Admin/Departments/Index.vue +74 -21
  122. package/src/pages/Admin/EscalationRules/Form.vue +86 -25
  123. package/src/pages/Admin/EscalationRules/Index.vue +158 -37
  124. package/src/pages/Admin/Import/Connect.vue +95 -0
  125. package/src/pages/Admin/Import/Index.vue +102 -0
  126. package/src/pages/Admin/Import/Mapping.vue +110 -0
  127. package/src/pages/Admin/Import/Progress.vue +153 -0
  128. package/src/pages/Admin/Import/Review.vue +76 -0
  129. package/src/pages/Admin/KnowledgeBase/Articles/Form.vue +142 -0
  130. package/src/pages/Admin/KnowledgeBase/Articles/Index.vue +195 -0
  131. package/src/pages/Admin/KnowledgeBase/Categories/Index.vue +193 -0
  132. package/src/pages/Admin/Macros/Index.vue +448 -287
  133. package/src/pages/Admin/Plugins/Index.vue +327 -197
  134. package/src/pages/Admin/Reports/AgentDetail.vue +132 -0
  135. package/src/pages/Admin/Reports/AgentMetrics.vue +115 -0
  136. package/src/pages/Admin/Reports/AgentRanking.vue +246 -0
  137. package/src/pages/Admin/Reports/Cohorts.vue +180 -0
  138. package/src/pages/Admin/Reports/Comparison.vue +141 -0
  139. package/src/pages/Admin/Reports/CsatReport.vue +127 -0
  140. package/src/pages/Admin/Reports/Dashboard.vue +226 -0
  141. package/src/pages/Admin/Reports/ResolutionTimes.vue +164 -0
  142. package/src/pages/Admin/Reports/ResponseTimes.vue +164 -0
  143. package/src/pages/Admin/Reports/SlaReport.vue +162 -0
  144. package/src/pages/Admin/Reports/SlaTrends.vue +183 -0
  145. package/src/pages/Admin/Reports.vue +206 -101
  146. package/src/pages/Admin/Roles/Form.vue +71 -0
  147. package/src/pages/Admin/Roles/Index.vue +122 -0
  148. package/src/pages/Admin/Settings/CsatSettings.vue +165 -0
  149. package/src/pages/Admin/Settings/DataRetention.vue +182 -0
  150. package/src/pages/Admin/Settings/EmailSettings.vue +243 -0
  151. package/src/pages/Admin/Settings/Sandbox.vue +135 -0
  152. package/src/pages/Admin/Settings/SsoSettings.vue +218 -0
  153. package/src/pages/Admin/Settings/TwoFactor.vue +110 -0
  154. package/src/pages/Admin/Settings.vue +847 -99
  155. package/src/pages/Admin/Skills/Form.vue +53 -0
  156. package/src/pages/Admin/Skills/Index.vue +94 -0
  157. package/src/pages/Admin/SlaPolicies/Form.vue +62 -19
  158. package/src/pages/Admin/SlaPolicies/Index.vue +85 -23
  159. package/src/pages/Admin/Statuses/Form.vue +114 -0
  160. package/src/pages/Admin/Statuses/Index.vue +153 -0
  161. package/src/pages/Admin/Tags/Index.vue +121 -35
  162. package/src/pages/Admin/Tickets/Index.vue +96 -9
  163. package/src/pages/Admin/Tickets/Show.vue +130 -37
  164. package/src/pages/Admin/Webhooks/DeliveryLog.vue +120 -0
  165. package/src/pages/Admin/Webhooks/Form.vue +110 -0
  166. package/src/pages/Admin/Webhooks/Index.vue +136 -0
  167. package/src/pages/Admin/Workflows/Builder.vue +207 -0
  168. package/src/pages/Admin/Workflows/Index.vue +235 -0
  169. package/src/pages/Admin/Workflows/Logs.vue +286 -0
  170. package/src/pages/Agent/Dashboard.vue +311 -186
  171. package/src/pages/Agent/TicketIndex.vue +80 -6
  172. package/src/pages/Agent/TicketShow.vue +399 -60
  173. package/src/pages/Customer/Create.vue +37 -10
  174. package/src/pages/Customer/Index.vue +9 -2
  175. package/src/pages/Customer/KnowledgeBase/Article.vue +129 -0
  176. package/src/pages/Customer/KnowledgeBase/Index.vue +151 -0
  177. package/src/pages/Customer/Show.vue +69 -63
  178. package/src/pages/Guest/Create.vue +40 -15
  179. package/src/pages/Guest/Show.vue +124 -93
  180. package/src/plugin.js +111 -1
  181. package/src/utils/constants.js +30 -0
  182. package/src/utils/formatting.js +35 -0
  183. package/src/utils/mentionHighlight.js +24 -0
  184. package/src/utils/sanitizeHtml.js +78 -64
  185. package/src/widget/EscalatedWidget.vue +804 -0
  186. package/src/widget/index.js +254 -0
  187. package/src/pages/Admin/Plugins.vue +0 -129
@@ -1,197 +1,327 @@
1
- <script setup>
2
- import EscalatedLayout from '../../../components/EscalatedLayout.vue';
3
- import { router } from '@inertiajs/vue3';
4
- import { ref, computed } from 'vue';
5
-
6
- const props = defineProps({
7
- plugins: { type: Array, default: () => [] },
8
- });
9
-
10
- const confirmingDelete = ref(null);
11
- const uploading = ref(false);
12
- const fileInput = ref(null);
13
-
14
- const activePlugins = computed(() => props.plugins.filter(p => p.active));
15
- const inactivePlugins = computed(() => props.plugins.filter(p => !p.active));
16
-
17
- function togglePlugin(plugin) {
18
- router.post(route('escalated.admin.plugins.toggle', plugin.id), {}, {
19
- preserveScroll: true,
20
- });
21
- }
22
-
23
- function confirmDelete(plugin) {
24
- confirmingDelete.value = plugin.id;
25
- }
26
-
27
- function cancelDelete() {
28
- confirmingDelete.value = null;
29
- }
30
-
31
- function deletePlugin(plugin) {
32
- router.delete(route('escalated.admin.plugins.destroy', plugin.id), {
33
- preserveScroll: true,
34
- onSuccess: () => { confirmingDelete.value = null; },
35
- });
36
- }
37
-
38
- function triggerUpload() {
39
- fileInput.value?.click();
40
- }
41
-
42
- function handleUpload(event) {
43
- const file = event.target.files?.[0];
44
- if (!file) return;
45
-
46
- uploading.value = true;
47
- router.post(route('escalated.admin.plugins.upload'), { file }, {
48
- forceFormData: true,
49
- preserveScroll: true,
50
- onFinish: () => {
51
- uploading.value = false;
52
- if (fileInput.value) fileInput.value.value = '';
53
- },
54
- });
55
- }
56
-
57
- function statusColor(plugin) {
58
- if (plugin.active) return 'bg-emerald-500';
59
- return 'bg-neutral-600';
60
- }
61
-
62
- function statusLabel(plugin) {
63
- return plugin.active ? 'Active' : 'Inactive';
64
- }
65
- </script>
66
-
67
- <template>
68
- <EscalatedLayout title="Plugins">
69
- <!-- Header -->
70
- <div class="mb-6 flex items-center justify-between">
71
- <div>
72
- <p class="text-sm text-neutral-400">
73
- {{ activePlugins.length }} active, {{ inactivePlugins.length }} inactive
74
- </p>
75
- </div>
76
- <div>
77
- <input ref="fileInput" type="file" accept=".zip" class="hidden" @change="handleUpload" />
78
- <button @click="triggerUpload" :disabled="uploading"
79
- class="rounded-lg bg-gradient-to-r from-cyan-500 to-violet-500 px-4 py-2 text-sm font-medium text-white shadow-lg shadow-black/20 transition-all hover:from-cyan-400 hover:to-violet-400 disabled:opacity-50">
80
- <span v-if="uploading" class="flex items-center gap-2">
81
- <svg class="h-4 w-4 animate-spin" fill="none" viewBox="0 0 24 24">
82
- <circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4" />
83
- <path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" />
84
- </svg>
85
- Uploading...
86
- </span>
87
- <span v-else class="flex items-center gap-2">
88
- <svg class="h-4 w-4" fill="none" stroke="currentColor" stroke-width="1.5" viewBox="0 0 24 24">
89
- <path stroke-linecap="round" stroke-linejoin="round" d="M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5m-13.5-9L12 3m0 0l4.5 4.5M12 3v13.5" />
90
- </svg>
91
- Upload Plugin
92
- </span>
93
- </button>
94
- </div>
95
- </div>
96
-
97
- <!-- Empty state -->
98
- <div v-if="!plugins?.length" class="rounded-xl border border-white/[0.06] bg-neutral-900/60 px-6 py-16 text-center">
99
- <svg class="mx-auto mb-4 h-12 w-12 text-neutral-700" fill="none" stroke="currentColor" stroke-width="1.5" viewBox="0 0 24 24">
100
- <path stroke-linecap="round" stroke-linejoin="round" d="M14.25 6.087c0-.355.186-.676.401-.959.221-.29.349-.634.349-1.003 0-1.036-1.007-1.875-2.25-1.875s-2.25.84-2.25 1.875c0 .369.128.713.349 1.003.215.283.401.604.401.959v0a.64.64 0 01-.657.643 48.39 48.39 0 01-4.163-.3c.186 1.613.293 3.25.315 4.907a.656.656 0 01-.658.663v0c-.355 0-.676-.186-.959-.401a1.647 1.647 0 00-1.003-.349c-1.036 0-1.875 1.007-1.875 2.25s.84 2.25 1.875 2.25c.369 0 .713-.128 1.003-.349.283-.215.604-.401.959-.401v0c.31 0 .555.26.532.57a48.039 48.039 0 01-.642 5.056c1.518.19 3.058.309 4.616.354a.64.64 0 00.657-.643v0c0-.355-.186-.676-.401-.959a1.647 1.647 0 01-.349-1.003c0-1.035 1.008-1.875 2.25-1.875 1.243 0 2.25.84 2.25 1.875 0 .369-.128.713-.349 1.003-.215.283-.4.604-.4.959v0c0 .333.277.599.61.58a48.1 48.1 0 005.427-.63 48.05 48.05 0 00.582-4.717.532.532 0 00-.533-.57v0c-.355 0-.676.186-.959.401-.29.221-.634.349-1.003.349-1.035 0-1.875-1.007-1.875-2.25s.84-2.25 1.875-2.25c.37 0 .713.128 1.003.349.283.215.604.401.96.401v0a.656.656 0 00.658-.663 48.422 48.422 0 00-.37-5.36c-1.886.342-3.81.574-5.766.689a.578.578 0 01-.61-.58v0z" />
101
- </svg>
102
- <h3 class="text-sm font-medium text-neutral-300">No plugins installed</h3>
103
- <p class="mt-1 text-xs text-neutral-500">Upload a plugin ZIP to extend Escalated with custom functionality.</p>
104
- </div>
105
-
106
- <!-- Plugin cards -->
107
- <div v-else class="space-y-3">
108
- <div v-for="plugin in plugins" :key="plugin.id"
109
- class="rounded-xl border border-white/[0.06] bg-neutral-900/60 p-5 transition-colors hover:bg-neutral-900/80">
110
- <div class="flex items-start justify-between gap-4">
111
- <!-- Plugin info -->
112
- <div class="min-w-0 flex-1">
113
- <div class="flex items-center gap-3">
114
- <h3 class="text-sm font-semibold text-white">{{ plugin.name }}</h3>
115
- <span :class="['inline-flex items-center gap-1.5 rounded-full px-2 py-0.5 text-[10px] font-semibold',
116
- plugin.active
117
- ? 'bg-emerald-500/10 text-emerald-400'
118
- : 'bg-neutral-500/10 text-neutral-500']">
119
- <span :class="['h-1.5 w-1.5 rounded-full', statusColor(plugin)]"></span>
120
- {{ statusLabel(plugin) }}
121
- </span>
122
- <span v-if="plugin.version" class="text-[11px] text-neutral-600">v{{ plugin.version }}</span>
123
- </div>
124
- <p v-if="plugin.description" class="mt-1 text-sm text-neutral-400">{{ plugin.description }}</p>
125
- <div class="mt-2 flex flex-wrap items-center gap-4 text-xs text-neutral-600">
126
- <span v-if="plugin.author" class="flex items-center gap-1">
127
- <svg class="h-3.5 w-3.5" fill="none" stroke="currentColor" stroke-width="1.5" viewBox="0 0 24 24">
128
- <path stroke-linecap="round" stroke-linejoin="round" d="M15.75 6a3.75 3.75 0 11-7.5 0 3.75 3.75 0 017.5 0zM4.501 20.118a7.5 7.5 0 0114.998 0A17.933 17.933 0 0112 21.75c-2.676 0-5.216-.584-7.499-1.632z" />
129
- </svg>
130
- {{ plugin.author }}
131
- </span>
132
- <span v-if="plugin.homepage" class="flex items-center gap-1">
133
- <svg class="h-3.5 w-3.5" fill="none" stroke="currentColor" stroke-width="1.5" viewBox="0 0 24 24">
134
- <path stroke-linecap="round" stroke-linejoin="round" d="M13.19 8.688a4.5 4.5 0 011.242 7.244l-4.5 4.5a4.5 4.5 0 01-6.364-6.364l1.757-1.757m13.35-.622l1.757-1.757a4.5 4.5 0 00-6.364-6.364l-4.5 4.5a4.5 4.5 0 001.242 7.244" />
135
- </svg>
136
- <a :href="plugin.homepage" target="_blank" rel="noopener" class="hover:text-neutral-400">{{ plugin.homepage }}</a>
137
- </span>
138
- <span v-if="plugin.installed_at" class="flex items-center gap-1">
139
- <svg class="h-3.5 w-3.5" fill="none" stroke="currentColor" stroke-width="1.5" viewBox="0 0 24 24">
140
- <path stroke-linecap="round" stroke-linejoin="round" d="M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 012.25-2.25h13.5A2.25 2.25 0 0121 7.5v11.25m-18 0A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75m-18 0v-7.5A2.25 2.25 0 015.25 9h13.5A2.25 2.25 0 0121 11.25v7.5" />
141
- </svg>
142
- Installed {{ plugin.installed_at }}
143
- </span>
144
- </div>
145
-
146
- <!-- Provided extensions summary -->
147
- <div v-if="plugin.provides" class="mt-3 flex flex-wrap gap-2">
148
- <span v-if="plugin.provides.menu_items"
149
- class="rounded bg-white/[0.04] px-2 py-0.5 text-[10px] text-neutral-500">
150
- {{ plugin.provides.menu_items }} menu item{{ plugin.provides.menu_items !== 1 ? 's' : '' }}
151
- </span>
152
- <span v-if="plugin.provides.widgets"
153
- class="rounded bg-white/[0.04] px-2 py-0.5 text-[10px] text-neutral-500">
154
- {{ plugin.provides.widgets }} widget{{ plugin.provides.widgets !== 1 ? 's' : '' }}
155
- </span>
156
- <span v-if="plugin.provides.page_components"
157
- class="rounded bg-white/[0.04] px-2 py-0.5 text-[10px] text-neutral-500">
158
- {{ plugin.provides.page_components }} page component{{ plugin.provides.page_components !== 1 ? 's' : '' }}
159
- </span>
160
- </div>
161
- </div>
162
-
163
- <!-- Actions -->
164
- <div class="flex shrink-0 items-center gap-2">
165
- <!-- Toggle active/inactive -->
166
- <button @click="togglePlugin(plugin)"
167
- :class="['relative inline-flex h-6 w-11 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors',
168
- plugin.active ? 'bg-emerald-500' : 'bg-neutral-700']"
169
- :title="plugin.active ? 'Deactivate' : 'Activate'">
170
- <span :class="['pointer-events-none inline-block h-5 w-5 transform rounded-full bg-white shadow ring-0 transition-transform',
171
- plugin.active ? 'translate-x-5' : 'translate-x-0']" />
172
- </button>
173
-
174
- <!-- Delete -->
175
- <template v-if="confirmingDelete === plugin.id">
176
- <button @click="deletePlugin(plugin)"
177
- class="rounded-lg bg-rose-500/20 px-3 py-1.5 text-xs font-medium text-rose-400 transition-colors hover:bg-rose-500/30">
178
- Confirm
179
- </button>
180
- <button @click="cancelDelete"
181
- class="rounded-lg border border-white/10 px-3 py-1.5 text-xs font-medium text-neutral-400 transition-colors hover:bg-white/[0.04]">
182
- Cancel
183
- </button>
184
- </template>
185
- <button v-else @click="confirmDelete(plugin)"
186
- class="rounded-lg border border-white/[0.06] p-1.5 text-neutral-600 transition-colors hover:border-rose-500/20 hover:bg-rose-500/5 hover:text-rose-400"
187
- title="Delete plugin">
188
- <svg class="h-4 w-4" fill="none" stroke="currentColor" stroke-width="1.5" viewBox="0 0 24 24">
189
- <path stroke-linecap="round" stroke-linejoin="round" d="M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0" />
190
- </svg>
191
- </button>
192
- </div>
193
- </div>
194
- </div>
195
- </div>
196
- </EscalatedLayout>
197
- </template>
1
+ <script setup>
2
+ import EscalatedLayout from '../../../components/EscalatedLayout.vue';
3
+ import { router } from '@inertiajs/vue3';
4
+ import { ref, computed } from 'vue';
5
+
6
+ const props = defineProps({
7
+ plugins: { type: Array, default: () => [] },
8
+ });
9
+
10
+ const confirmingDelete = ref(null);
11
+ const uploading = ref(false);
12
+ const fileInput = ref(null);
13
+
14
+ const activePlugins = computed(() => props.plugins.filter((p) => p.is_active));
15
+ const inactivePlugins = computed(() => props.plugins.filter((p) => !p.is_active));
16
+
17
+ function activate(slug) {
18
+ router.post(
19
+ route('escalated.admin.plugins.activate', slug),
20
+ {},
21
+ {
22
+ preserveScroll: true,
23
+ },
24
+ );
25
+ }
26
+
27
+ function deactivate(slug) {
28
+ router.post(
29
+ route('escalated.admin.plugins.deactivate', slug),
30
+ {},
31
+ {
32
+ preserveScroll: true,
33
+ },
34
+ );
35
+ }
36
+
37
+ function confirmDelete(plugin) {
38
+ confirmingDelete.value = plugin.slug;
39
+ }
40
+
41
+ function cancelDelete() {
42
+ confirmingDelete.value = null;
43
+ }
44
+
45
+ function deletePlugin(plugin) {
46
+ router.delete(route('escalated.admin.plugins.destroy', plugin.slug), {
47
+ preserveScroll: true,
48
+ onSuccess: () => {
49
+ confirmingDelete.value = null;
50
+ },
51
+ });
52
+ }
53
+
54
+ function triggerUpload() {
55
+ fileInput.value?.click();
56
+ }
57
+
58
+ function handleUpload(event) {
59
+ const file = event.target.files?.[0];
60
+ if (!file) return;
61
+
62
+ uploading.value = true;
63
+ router.post(
64
+ route('escalated.admin.plugins.upload'),
65
+ { plugin: file },
66
+ {
67
+ forceFormData: true,
68
+ preserveScroll: true,
69
+ onFinish: () => {
70
+ uploading.value = false;
71
+ if (fileInput.value) fileInput.value.value = '';
72
+ },
73
+ },
74
+ );
75
+ }
76
+
77
+ function statusColor(plugin) {
78
+ if (plugin.is_active) return 'bg-emerald-500';
79
+ return 'bg-neutral-600';
80
+ }
81
+
82
+ function statusLabel(plugin) {
83
+ return plugin.is_active ? 'Active' : 'Inactive';
84
+ }
85
+ </script>
86
+
87
+ <template>
88
+ <EscalatedLayout title="Plugins">
89
+ <!-- Header -->
90
+ <div class="mb-6 flex items-center justify-between">
91
+ <div>
92
+ <p class="text-sm text-[var(--esc-panel-text-tertiary)]">
93
+ {{ activePlugins.length }} active, {{ inactivePlugins.length }} inactive
94
+ </p>
95
+ </div>
96
+ <div>
97
+ <input ref="fileInput" type="file" accept=".zip" class="hidden" @change="handleUpload" />
98
+ <button
99
+ :disabled="uploading"
100
+ class="rounded-lg bg-gradient-to-r from-[var(--esc-panel-accent)] to-[var(--esc-panel-accent-secondary)] px-4 py-2 text-sm font-medium text-white shadow-lg shadow-[var(--esc-panel-bg)]/20 transition-all hover:from-[var(--esc-panel-accent-hover)] hover:to-[var(--esc-panel-accent-secondary-hover)] disabled:opacity-50"
101
+ @click="triggerUpload"
102
+ >
103
+ <span v-if="uploading" class="flex items-center gap-2">
104
+ <svg class="h-4 w-4 animate-spin" fill="none" viewBox="0 0 24 24">
105
+ <circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4" />
106
+ <path
107
+ class="opacity-75"
108
+ fill="currentColor"
109
+ d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
110
+ />
111
+ </svg>
112
+ Uploading...
113
+ </span>
114
+ <span v-else class="flex items-center gap-2">
115
+ <svg class="h-4 w-4" fill="none" stroke="currentColor" stroke-width="1.5" viewBox="0 0 24 24">
116
+ <path
117
+ stroke-linecap="round"
118
+ stroke-linejoin="round"
119
+ d="M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5m-13.5-9L12 3m0 0l4.5 4.5M12 3v13.5"
120
+ />
121
+ </svg>
122
+ Upload Plugin
123
+ </span>
124
+ </button>
125
+ </div>
126
+ </div>
127
+
128
+ <!-- Empty state -->
129
+ <div
130
+ v-if="!plugins?.length"
131
+ class="rounded-xl border border-[var(--esc-panel-border)] bg-[var(--esc-panel-surface)] px-6 py-16 text-center"
132
+ >
133
+ <svg
134
+ class="mx-auto mb-4 h-12 w-12 text-[var(--esc-panel-text-muted)]"
135
+ fill="none"
136
+ stroke="currentColor"
137
+ stroke-width="1.5"
138
+ viewBox="0 0 24 24"
139
+ >
140
+ <path
141
+ stroke-linecap="round"
142
+ stroke-linejoin="round"
143
+ d="M14.25 6.087c0-.355.186-.676.401-.959.221-.29.349-.634.349-1.003 0-1.036-1.007-1.875-2.25-1.875s-2.25.84-2.25 1.875c0 .369.128.713.349 1.003.215.283.401.604.401.959v0a.64.64 0 01-.657.643 48.39 48.39 0 01-4.163-.3c.186 1.613.293 3.25.315 4.907a.656.656 0 01-.658.663v0c-.355 0-.676-.186-.959-.401a1.647 1.647 0 00-1.003-.349c-1.036 0-1.875 1.007-1.875 2.25s.84 2.25 1.875 2.25c.369 0 .713-.128 1.003-.349.283-.215.604-.401.959-.401v0c.31 0 .555.26.532.57a48.039 48.039 0 01-.642 5.056c1.518.19 3.058.309 4.616.354a.64.64 0 00.657-.643v0c0-.355-.186-.676-.401-.959a1.647 1.647 0 01-.349-1.003c0-1.035 1.008-1.875 2.25-1.875 1.243 0 2.25.84 2.25 1.875 0 .369-.128.713-.349 1.003-.215.283-.4.604-.4.959v0c0 .333.277.599.61.58a48.1 48.1 0 005.427-.63 48.05 48.05 0 00.582-4.717.532.532 0 00-.533-.57v0c-.355 0-.676.186-.959.401-.29.221-.634.349-1.003.349-1.035 0-1.875-1.007-1.875-2.25s.84-2.25 1.875-2.25c.37 0 .713.128 1.003.349.283.215.604.401.96.401v0a.656.656 0 00.658-.663 48.422 48.422 0 00-.37-5.36c-1.886.342-3.81.574-5.766.689a.578.578 0 01-.61-.58v0z"
144
+ />
145
+ </svg>
146
+ <h3 class="text-sm font-medium text-[var(--esc-panel-text-secondary)]">No plugins installed</h3>
147
+ <p class="mt-1 text-xs text-[var(--esc-panel-text-muted)]">
148
+ Upload a plugin ZIP to extend Escalated with custom functionality.
149
+ </p>
150
+ </div>
151
+
152
+ <!-- Plugin cards -->
153
+ <div v-else class="space-y-3">
154
+ <div
155
+ v-for="plugin in plugins"
156
+ :key="plugin.slug"
157
+ class="rounded-xl border border-[var(--esc-panel-border)] bg-[var(--esc-panel-surface)] p-5 transition-colors hover:bg-[var(--esc-panel-surface)]"
158
+ >
159
+ <div class="flex items-start justify-between gap-4">
160
+ <!-- Plugin info -->
161
+ <div class="min-w-0 flex-1">
162
+ <div class="flex items-center gap-3">
163
+ <h3 class="text-sm font-semibold text-[var(--esc-panel-text)]">{{ plugin.name }}</h3>
164
+ <span
165
+ :class="[
166
+ 'inline-flex items-center gap-1.5 rounded-full px-2 py-0.5 text-[10px] font-semibold',
167
+ plugin.is_active
168
+ ? 'bg-emerald-500/10 text-emerald-400'
169
+ : 'bg-neutral-500/10 text-[var(--esc-panel-text-muted)]',
170
+ ]"
171
+ >
172
+ <span :class="['h-1.5 w-1.5 rounded-full', statusColor(plugin)]"></span>
173
+ {{ statusLabel(plugin) }}
174
+ </span>
175
+ <span v-if="plugin.version" class="text-[11px] text-[var(--esc-panel-text-muted)]"
176
+ >v{{ plugin.version }}</span
177
+ >
178
+ </div>
179
+ <p v-if="plugin.description" class="mt-1 text-sm text-[var(--esc-panel-text-tertiary)]">
180
+ {{ plugin.description }}
181
+ </p>
182
+ <div class="mt-2 flex flex-wrap items-center gap-4 text-xs text-[var(--esc-panel-text-muted)]">
183
+ <span v-if="plugin.author" class="flex items-center gap-1">
184
+ <svg
185
+ class="h-3.5 w-3.5"
186
+ fill="none"
187
+ stroke="currentColor"
188
+ stroke-width="1.5"
189
+ viewBox="0 0 24 24"
190
+ >
191
+ <path
192
+ stroke-linecap="round"
193
+ stroke-linejoin="round"
194
+ d="M15.75 6a3.75 3.75 0 11-7.5 0 3.75 3.75 0 017.5 0zM4.501 20.118a7.5 7.5 0 0114.998 0A17.933 17.933 0 0112 21.75c-2.676 0-5.216-.584-7.499-1.632z"
195
+ />
196
+ </svg>
197
+ {{ plugin.author }}
198
+ </span>
199
+ <span v-if="plugin.homepage" class="flex items-center gap-1">
200
+ <svg
201
+ class="h-3.5 w-3.5"
202
+ fill="none"
203
+ stroke="currentColor"
204
+ stroke-width="1.5"
205
+ viewBox="0 0 24 24"
206
+ >
207
+ <path
208
+ stroke-linecap="round"
209
+ stroke-linejoin="round"
210
+ d="M13.19 8.688a4.5 4.5 0 011.242 7.244l-4.5 4.5a4.5 4.5 0 01-6.364-6.364l1.757-1.757m13.35-.622l1.757-1.757a4.5 4.5 0 00-6.364-6.364l-4.5 4.5a4.5 4.5 0 001.242 7.244"
211
+ />
212
+ </svg>
213
+ <a
214
+ :href="plugin.homepage"
215
+ target="_blank"
216
+ rel="noopener"
217
+ class="hover:text-[var(--esc-panel-text-tertiary)]"
218
+ >{{ plugin.homepage }}</a
219
+ >
220
+ </span>
221
+ <span v-if="plugin.installed_at" class="flex items-center gap-1">
222
+ <svg
223
+ class="h-3.5 w-3.5"
224
+ fill="none"
225
+ stroke="currentColor"
226
+ stroke-width="1.5"
227
+ viewBox="0 0 24 24"
228
+ >
229
+ <path
230
+ stroke-linecap="round"
231
+ stroke-linejoin="round"
232
+ d="M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 012.25-2.25h13.5A2.25 2.25 0 0121 7.5v11.25m-18 0A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75m-18 0v-7.5A2.25 2.25 0 015.25 9h13.5A2.25 2.25 0 0121 11.25v7.5"
233
+ />
234
+ </svg>
235
+ Installed {{ plugin.installed_at }}
236
+ </span>
237
+ </div>
238
+
239
+ <!-- Provided extensions summary -->
240
+ <div v-if="plugin.provides" class="mt-3 flex flex-wrap gap-2">
241
+ <span
242
+ v-if="plugin.provides.menu_items"
243
+ class="rounded bg-[var(--esc-panel-hover)] px-2 py-0.5 text-[10px] text-[var(--esc-panel-text-muted)]"
244
+ >
245
+ {{ plugin.provides.menu_items }} menu item{{
246
+ plugin.provides.menu_items !== 1 ? 's' : ''
247
+ }}
248
+ </span>
249
+ <span
250
+ v-if="plugin.provides.widgets"
251
+ class="rounded bg-[var(--esc-panel-hover)] px-2 py-0.5 text-[10px] text-[var(--esc-panel-text-muted)]"
252
+ >
253
+ {{ plugin.provides.widgets }} widget{{ plugin.provides.widgets !== 1 ? 's' : '' }}
254
+ </span>
255
+ <span
256
+ v-if="plugin.provides.page_components"
257
+ class="rounded bg-[var(--esc-panel-hover)] px-2 py-0.5 text-[10px] text-[var(--esc-panel-text-muted)]"
258
+ >
259
+ {{ plugin.provides.page_components }} page component{{
260
+ plugin.provides.page_components !== 1 ? 's' : ''
261
+ }}
262
+ </span>
263
+ </div>
264
+ </div>
265
+
266
+ <!-- Actions -->
267
+ <div class="flex shrink-0 items-center gap-2">
268
+ <!-- Toggle active/inactive -->
269
+ <button
270
+ :class="[
271
+ 'relative inline-flex h-6 w-11 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors',
272
+ plugin.is_active ? 'bg-emerald-500' : 'bg-neutral-700',
273
+ ]"
274
+ :title="plugin.is_active ? 'Deactivate' : 'Activate'"
275
+ @click="plugin.is_active ? deactivate(plugin.slug) : activate(plugin.slug)"
276
+ >
277
+ <span
278
+ :class="[
279
+ 'pointer-events-none inline-block h-5 w-5 transform rounded-full bg-white shadow ring-0 transition-transform',
280
+ plugin.is_active ? 'translate-x-5' : 'translate-x-0',
281
+ ]"
282
+ />
283
+ </button>
284
+
285
+ <!-- Delete (local plugins only) -->
286
+ <template v-if="plugin.source !== 'composer'">
287
+ <template v-if="confirmingDelete === plugin.slug">
288
+ <button
289
+ class="rounded-lg bg-rose-500/20 px-3 py-1.5 text-xs font-medium text-rose-400 transition-colors hover:bg-rose-500/30"
290
+ @click="deletePlugin(plugin)"
291
+ >
292
+ Confirm
293
+ </button>
294
+ <button
295
+ class="rounded-lg border border-[var(--esc-panel-border-input)] px-3 py-1.5 text-xs font-medium text-[var(--esc-panel-text-tertiary)] transition-colors hover:bg-[var(--esc-panel-hover)]"
296
+ @click="cancelDelete"
297
+ >
298
+ Cancel
299
+ </button>
300
+ </template>
301
+ <button
302
+ v-else
303
+ class="rounded-lg border border-[var(--esc-panel-border)] p-1.5 text-[var(--esc-panel-text-muted)] transition-colors hover:border-rose-500/20 hover:bg-rose-500/5 hover:text-rose-400"
304
+ title="Delete plugin"
305
+ @click="confirmDelete(plugin)"
306
+ >
307
+ <svg
308
+ class="h-4 w-4"
309
+ fill="none"
310
+ stroke="currentColor"
311
+ stroke-width="1.5"
312
+ viewBox="0 0 24 24"
313
+ >
314
+ <path
315
+ stroke-linecap="round"
316
+ stroke-linejoin="round"
317
+ d="M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0"
318
+ />
319
+ </svg>
320
+ </button>
321
+ </template>
322
+ </div>
323
+ </div>
324
+ </div>
325
+ </div>
326
+ </EscalatedLayout>
327
+ </template>