@escalated-dev/escalated 0.7.0 → 0.8.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.
Files changed (181) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +36 -1
  3. package/package.json +16 -7
  4. package/src/components/ActiveChatsPanel.vue +246 -0
  5. package/src/components/ActivityTimeline.stories.js +55 -55
  6. package/src/components/ActivityTimeline.vue +83 -83
  7. package/src/components/AdminDashboard.stories.js +1423 -1095
  8. package/src/components/AgentLoadIndicator.stories.js +37 -37
  9. package/src/components/AgentLoadIndicator.vue +49 -49
  10. package/src/components/AgentPerformanceCard.vue +44 -44
  11. package/src/components/ArticleEditor.vue +82 -82
  12. package/src/components/AssigneeSelect.vue +37 -37
  13. package/src/components/AttachmentList.vue +13 -1
  14. package/src/components/AuditLogEntry.vue +95 -95
  15. package/src/components/BulkActionBar.vue +166 -166
  16. package/src/components/CategoryTree.vue +89 -89
  17. package/src/components/ChartWidget.vue +46 -46
  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 -30
  24. package/src/components/CollisionWarning.vue +68 -68
  25. package/src/components/ConditionalFieldRules.vue +135 -135
  26. package/src/components/ContextPanel.vue +66 -66
  27. package/src/components/ContextPanelSection.vue +65 -65
  28. package/src/components/CustomFieldRenderer.vue +159 -159
  29. package/src/components/EscalatedLayout.vue +35 -6
  30. package/src/components/FileDropzone.vue +57 -57
  31. package/src/components/FollowButton.stories.js +30 -30
  32. package/src/components/FollowButton.vue +88 -88
  33. package/src/components/KeyboardShortcutHelp.vue +213 -213
  34. package/src/components/KnowledgePanel.vue +122 -122
  35. package/src/components/KpiCard.stories.js +32 -32
  36. package/src/components/KpiCard.vue +88 -88
  37. package/src/components/MacroDropdown.vue +150 -150
  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 -107
  43. package/src/components/PinnedNotes.vue +129 -129
  44. package/src/components/PluginSlot.vue +68 -62
  45. package/src/components/PresenceIndicator.vue +46 -2
  46. package/src/components/PriorityBadge.stories.js +33 -33
  47. package/src/components/PriorityBadge.vue +46 -46
  48. package/src/components/ReplyComposer.vue +81 -18
  49. package/src/components/ReplyThread.vue +40 -2
  50. package/src/components/ReportChart.vue +395 -0
  51. package/src/components/ReportExportButton.vue +108 -0
  52. package/src/components/SatisfactionRating.vue +180 -180
  53. package/src/components/SaveViewDialog.vue +172 -0
  54. package/src/components/SavedViewSidebar.vue +208 -0
  55. package/src/components/ScheduleEditor.vue +104 -104
  56. package/src/components/SideConversation.vue +165 -165
  57. package/src/components/SideConversationList.vue +147 -147
  58. package/src/components/SkillTagManager.vue +83 -79
  59. package/src/components/SlaComplianceChart.vue +46 -53
  60. package/src/components/SlaTimer.stories.js +35 -35
  61. package/src/components/SlaTimer.vue +62 -62
  62. package/src/components/SnoozeButton.vue +247 -0
  63. package/src/components/StatsCard.stories.js +24 -24
  64. package/src/components/StatsCard.vue +58 -58
  65. package/src/components/StatusBadge.stories.js +53 -53
  66. package/src/components/StatusBadge.vue +78 -78
  67. package/src/components/TagSelect.vue +84 -84
  68. package/src/components/TicketFilters.vue +270 -225
  69. package/src/components/TicketLinkPanel.vue +193 -193
  70. package/src/components/TicketList.vue +655 -594
  71. package/src/components/TicketMergeDialog.vue +157 -157
  72. package/src/components/TicketSplitDialog.vue +98 -0
  73. package/src/components/TotpInput.stories.js +9 -9
  74. package/src/components/TotpInput.vue +81 -81
  75. package/src/components/TwoFactorSetup.vue +113 -113
  76. package/src/components/VariableTokenInput.vue +111 -0
  77. package/src/components/WorkflowActionConfig.vue +287 -0
  78. package/src/components/WorkflowActionList.vue +350 -0
  79. package/src/components/WorkflowConditionBuilder.vue +265 -0
  80. package/src/components/WorkflowTriggerSelector.vue +125 -0
  81. package/src/composables/useChat.js +187 -0
  82. package/src/composables/useI18n.js +30 -8
  83. package/src/composables/useKeyboardShortcuts.js +46 -46
  84. package/src/composables/useMentions.js +134 -0
  85. package/src/composables/usePluginExtensions.js +159 -159
  86. package/src/composables/usePluginHooks.js +65 -65
  87. package/src/composables/useRealtime.js +182 -0
  88. package/src/defineEscalatedPlugin.js +76 -76
  89. package/src/index.js +84 -72
  90. package/src/locales/README.md +13 -0
  91. package/src/locales/ar.json +727 -0
  92. package/src/locales/de.json +678 -430
  93. package/src/locales/en.json +717 -455
  94. package/src/locales/es.json +679 -430
  95. package/src/locales/fr.json +680 -431
  96. package/src/locales/index.js +12 -2
  97. package/src/locales/it.json +727 -0
  98. package/src/locales/ja.json +727 -0
  99. package/src/locales/ko.json +727 -0
  100. package/src/locales/nl.json +727 -0
  101. package/src/locales/pl.json +727 -0
  102. package/src/locales/pt-BR.json +727 -0
  103. package/src/locales/ru.json +727 -0
  104. package/src/locales/tr.json +727 -0
  105. package/src/locales/zh-CN.json +727 -0
  106. package/src/pages/Admin/ApiTokens/Index.vue +381 -381
  107. package/src/pages/Admin/AuditLog/Index.vue +154 -154
  108. package/src/pages/Admin/BusinessHours/Form.vue +172 -172
  109. package/src/pages/Admin/BusinessHours/Index.vue +113 -113
  110. package/src/pages/Admin/CannedResponses/Index.vue +127 -127
  111. package/src/pages/Admin/Capacity/Index.vue +134 -134
  112. package/src/pages/Admin/CustomFields/Form.vue +195 -195
  113. package/src/pages/Admin/CustomFields/Index.vue +134 -134
  114. package/src/pages/Admin/CustomObjects/Form.vue +202 -202
  115. package/src/pages/Admin/CustomObjects/Index.vue +127 -127
  116. package/src/pages/Admin/CustomObjects/Records.vue +228 -228
  117. package/src/pages/Admin/Departments/Form.vue +75 -75
  118. package/src/pages/Admin/Departments/Index.vue +110 -109
  119. package/src/pages/Admin/EscalationRules/Form.vue +157 -157
  120. package/src/pages/Admin/EscalationRules/Index.vue +178 -178
  121. package/src/pages/Admin/Import/Connect.vue +0 -1
  122. package/src/pages/Admin/Import/Index.vue +1 -1
  123. package/src/pages/Admin/Import/Progress.vue +1 -1
  124. package/src/pages/Admin/KnowledgeBase/Articles/Form.vue +142 -142
  125. package/src/pages/Admin/KnowledgeBase/Articles/Index.vue +195 -195
  126. package/src/pages/Admin/KnowledgeBase/Categories/Index.vue +193 -193
  127. package/src/pages/Admin/Macros/Index.vue +448 -448
  128. package/src/pages/Admin/Plugins/Index.vue +327 -327
  129. package/src/pages/Admin/Reports/AgentDetail.vue +132 -0
  130. package/src/pages/Admin/Reports/AgentMetrics.vue +115 -115
  131. package/src/pages/Admin/Reports/AgentRanking.vue +246 -0
  132. package/src/pages/Admin/Reports/Cohorts.vue +180 -0
  133. package/src/pages/Admin/Reports/Comparison.vue +141 -0
  134. package/src/pages/Admin/Reports/CsatReport.vue +127 -127
  135. package/src/pages/Admin/Reports/Dashboard.vue +36 -21
  136. package/src/pages/Admin/Reports/ResolutionTimes.vue +164 -0
  137. package/src/pages/Admin/Reports/ResponseTimes.vue +164 -0
  138. package/src/pages/Admin/Reports/SlaReport.vue +162 -166
  139. package/src/pages/Admin/Reports/SlaTrends.vue +183 -0
  140. package/src/pages/Admin/Reports.vue +206 -206
  141. package/src/pages/Admin/Roles/Form.vue +71 -71
  142. package/src/pages/Admin/Roles/Index.vue +122 -122
  143. package/src/pages/Admin/Settings/CsatSettings.vue +165 -165
  144. package/src/pages/Admin/Settings/DataRetention.vue +182 -182
  145. package/src/pages/Admin/Settings/EmailSettings.vue +243 -243
  146. package/src/pages/Admin/Settings/Sandbox.vue +135 -135
  147. package/src/pages/Admin/Settings/SsoSettings.vue +218 -218
  148. package/src/pages/Admin/Settings/TwoFactor.vue +110 -110
  149. package/src/pages/Admin/Settings.vue +1008 -468
  150. package/src/pages/Admin/Skills/Form.vue +193 -53
  151. package/src/pages/Admin/Skills/Index.vue +105 -94
  152. package/src/pages/Admin/SlaPolicies/Form.vue +118 -118
  153. package/src/pages/Admin/SlaPolicies/Index.vue +121 -120
  154. package/src/pages/Admin/Statuses/Form.vue +114 -114
  155. package/src/pages/Admin/Statuses/Index.vue +153 -153
  156. package/src/pages/Admin/Tags/Index.vue +191 -191
  157. package/src/pages/Admin/Tickets/Index.vue +126 -91
  158. package/src/pages/Admin/Tickets/Show.vue +29 -0
  159. package/src/pages/Admin/Users/Index.vue +145 -0
  160. package/src/pages/Admin/Webhooks/DeliveryLog.vue +120 -120
  161. package/src/pages/Admin/Webhooks/Form.vue +110 -110
  162. package/src/pages/Admin/Webhooks/Index.vue +136 -136
  163. package/src/pages/Admin/Workflows/Builder.vue +207 -0
  164. package/src/pages/Admin/Workflows/Index.vue +235 -0
  165. package/src/pages/Admin/Workflows/Logs.vue +286 -0
  166. package/src/pages/Agent/TicketIndex.vue +112 -88
  167. package/src/pages/Agent/TicketShow.vue +192 -60
  168. package/src/pages/Customer/Create.vue +1 -1
  169. package/src/pages/Customer/Index.vue +26 -1
  170. package/src/pages/Customer/KnowledgeBase/Article.vue +4 -2
  171. package/src/pages/Customer/KnowledgeBase/Index.vue +151 -151
  172. package/src/pages/Customer/Show.vue +69 -63
  173. package/src/pages/Guest/Create.vue +40 -15
  174. package/src/pages/Guest/Show.vue +124 -93
  175. package/src/plugin.js +26 -1
  176. package/src/utils/mentionHighlight.js +24 -0
  177. package/src/utils/sanitizeHtml.js +78 -64
  178. package/src/widget/EscalatedWidget.vue +804 -0
  179. package/src/widget/index.js +254 -0
  180. package/src/pages/Admin/Automations/Form.vue +0 -184
  181. package/src/pages/Admin/Automations/Index.vue +0 -129
@@ -1,327 +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.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>
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>