@escalated-dev/escalated 0.6.0 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +125 -2
- package/package.json +40 -5
- package/src/components/ActiveChatsPanel.vue +246 -0
- package/src/components/ActivityTimeline.stories.js +55 -0
- package/src/components/ActivityTimeline.vue +83 -66
- package/src/components/AdminDashboard.stories.js +1423 -0
- package/src/components/AgentLoadIndicator.stories.js +37 -0
- package/src/components/AgentLoadIndicator.vue +49 -0
- package/src/components/AgentPerformanceCard.vue +44 -0
- package/src/components/ArticleEditor.vue +82 -0
- package/src/components/AssigneeSelect.vue +37 -23
- package/src/components/AttachmentList.vue +65 -37
- package/src/components/AuditLogEntry.vue +95 -0
- package/src/components/BulkActionBar.vue +166 -97
- package/src/components/CategoryTree.vue +89 -0
- package/src/components/ChartWidget.vue +46 -0
- package/src/components/ChatActionBar.vue +226 -0
- package/src/components/ChatBubble.vue +162 -0
- package/src/components/ChatComposer.vue +308 -0
- package/src/components/ChatQueue.vue +222 -0
- package/src/components/ChatThread.vue +197 -0
- package/src/components/CollisionWarning.stories.js +30 -0
- package/src/components/CollisionWarning.vue +68 -0
- package/src/components/ConditionalFieldRules.vue +135 -0
- package/src/components/ContextPanel.vue +66 -0
- package/src/components/ContextPanelSection.vue +65 -0
- package/src/components/CustomFieldRenderer.vue +159 -0
- package/src/components/EscalatedLayout.vue +424 -70
- package/src/components/FileDropzone.vue +57 -41
- package/src/components/FollowButton.stories.js +30 -0
- package/src/components/FollowButton.vue +88 -63
- package/src/components/KeyboardShortcutHelp.vue +213 -123
- package/src/components/KnowledgePanel.vue +122 -0
- package/src/components/KpiCard.stories.js +32 -0
- package/src/components/KpiCard.vue +88 -0
- package/src/components/MacroDropdown.vue +150 -90
- package/src/components/MentionDropdown.vue +154 -0
- package/src/components/MetricComparison.vue +89 -0
- package/src/components/PercentileChart.vue +67 -0
- package/src/components/PeriodSelector.vue +98 -0
- package/src/components/PermissionMatrix.vue +107 -0
- package/src/components/PinnedNotes.vue +129 -90
- package/src/components/PluginSlot.vue +68 -62
- package/src/components/PresenceIndicator.vue +138 -28
- package/src/components/PriorityBadge.stories.js +33 -0
- package/src/components/PriorityBadge.vue +46 -39
- package/src/components/QuickFilters.vue +65 -49
- package/src/components/ReplyComposer.vue +207 -30
- package/src/components/ReplyThread.vue +111 -21
- package/src/components/ReportChart.vue +395 -0
- package/src/components/ReportExportButton.vue +108 -0
- package/src/components/SatisfactionRating.vue +180 -128
- package/src/components/SaveViewDialog.vue +172 -0
- package/src/components/SavedViewSidebar.vue +208 -0
- package/src/components/ScheduleEditor.vue +104 -0
- package/src/components/SideConversation.vue +165 -0
- package/src/components/SideConversationList.vue +147 -0
- package/src/components/SkillTagManager.vue +79 -0
- package/src/components/SlaComplianceChart.vue +46 -0
- package/src/components/SlaTimer.stories.js +35 -0
- package/src/components/SlaTimer.vue +62 -49
- package/src/components/SnoozeButton.vue +247 -0
- package/src/components/StatsCard.stories.js +24 -0
- package/src/components/StatsCard.vue +18 -6
- package/src/components/StatusBadge.stories.js +53 -0
- package/src/components/StatusBadge.vue +78 -46
- package/src/components/TagSelect.vue +84 -53
- package/src/components/TicketFilters.vue +247 -46
- package/src/components/TicketLinkPanel.vue +193 -0
- package/src/components/TicketList.vue +536 -74
- package/src/components/TicketMergeDialog.vue +157 -0
- package/src/components/TicketSidebar.vue +167 -99
- package/src/components/TicketSplitDialog.vue +98 -0
- package/src/components/TicketTypeSelector.vue +21 -0
- package/src/components/TotpInput.stories.js +9 -0
- package/src/components/TotpInput.vue +81 -0
- package/src/components/TwoFactorSetup.vue +113 -0
- package/src/components/VariableTokenInput.vue +111 -0
- package/src/components/WorkflowActionConfig.vue +287 -0
- package/src/components/WorkflowActionList.vue +350 -0
- package/src/components/WorkflowConditionBuilder.vue +265 -0
- package/src/components/WorkflowTriggerSelector.vue +125 -0
- package/src/composables/useChat.js +187 -0
- package/src/composables/useDebouncedSearch.js +38 -0
- package/src/composables/useI18n.js +80 -80
- package/src/composables/useKeyboardShortcuts.js +46 -46
- package/src/composables/useMentions.js +134 -0
- package/src/composables/usePluginExtensions.js +159 -67
- package/src/composables/usePluginHooks.js +65 -0
- package/src/composables/useRealtime.js +182 -0
- package/src/defineEscalatedPlugin.js +76 -50
- package/src/index.js +77 -28
- package/src/locales/ar.json +727 -0
- package/src/locales/de.json +678 -430
- package/src/locales/en.json +717 -430
- package/src/locales/es.json +679 -430
- package/src/locales/fr.json +680 -431
- package/src/locales/index.js +12 -2
- package/src/locales/it.json +727 -0
- package/src/locales/ja.json +727 -0
- package/src/locales/ko.json +727 -0
- package/src/locales/nl.json +727 -0
- package/src/locales/pl.json +727 -0
- package/src/locales/pt-BR.json +727 -0
- package/src/locales/ru.json +727 -0
- package/src/locales/tr.json +727 -0
- package/src/locales/zh-CN.json +727 -0
- package/src/pages/Admin/ApiTokens/Index.vue +381 -217
- package/src/pages/Admin/AuditLog/Index.vue +154 -0
- package/src/pages/Admin/BusinessHours/Form.vue +172 -0
- package/src/pages/Admin/BusinessHours/Index.vue +113 -0
- package/src/pages/Admin/CannedResponses/Index.vue +82 -25
- package/src/pages/Admin/Capacity/Index.vue +134 -0
- package/src/pages/Admin/CustomFields/Form.vue +195 -0
- package/src/pages/Admin/CustomFields/Index.vue +134 -0
- package/src/pages/Admin/CustomObjects/Form.vue +202 -0
- package/src/pages/Admin/CustomObjects/Index.vue +127 -0
- package/src/pages/Admin/CustomObjects/Records.vue +228 -0
- package/src/pages/Admin/Departments/Form.vue +35 -11
- package/src/pages/Admin/Departments/Index.vue +74 -21
- package/src/pages/Admin/EscalationRules/Form.vue +86 -25
- package/src/pages/Admin/EscalationRules/Index.vue +158 -37
- package/src/pages/Admin/Import/Connect.vue +95 -0
- package/src/pages/Admin/Import/Index.vue +102 -0
- package/src/pages/Admin/Import/Mapping.vue +110 -0
- package/src/pages/Admin/Import/Progress.vue +153 -0
- package/src/pages/Admin/Import/Review.vue +76 -0
- package/src/pages/Admin/KnowledgeBase/Articles/Form.vue +142 -0
- package/src/pages/Admin/KnowledgeBase/Articles/Index.vue +195 -0
- package/src/pages/Admin/KnowledgeBase/Categories/Index.vue +193 -0
- package/src/pages/Admin/Macros/Index.vue +448 -287
- package/src/pages/Admin/Plugins/Index.vue +327 -197
- package/src/pages/Admin/Reports/AgentDetail.vue +132 -0
- package/src/pages/Admin/Reports/AgentMetrics.vue +115 -0
- package/src/pages/Admin/Reports/AgentRanking.vue +246 -0
- package/src/pages/Admin/Reports/Cohorts.vue +180 -0
- package/src/pages/Admin/Reports/Comparison.vue +141 -0
- package/src/pages/Admin/Reports/CsatReport.vue +127 -0
- package/src/pages/Admin/Reports/Dashboard.vue +226 -0
- package/src/pages/Admin/Reports/ResolutionTimes.vue +164 -0
- package/src/pages/Admin/Reports/ResponseTimes.vue +164 -0
- package/src/pages/Admin/Reports/SlaReport.vue +162 -0
- package/src/pages/Admin/Reports/SlaTrends.vue +183 -0
- package/src/pages/Admin/Reports.vue +206 -101
- package/src/pages/Admin/Roles/Form.vue +71 -0
- package/src/pages/Admin/Roles/Index.vue +122 -0
- package/src/pages/Admin/Settings/CsatSettings.vue +165 -0
- package/src/pages/Admin/Settings/DataRetention.vue +182 -0
- package/src/pages/Admin/Settings/EmailSettings.vue +243 -0
- package/src/pages/Admin/Settings/Sandbox.vue +135 -0
- package/src/pages/Admin/Settings/SsoSettings.vue +218 -0
- package/src/pages/Admin/Settings/TwoFactor.vue +110 -0
- package/src/pages/Admin/Settings.vue +847 -99
- package/src/pages/Admin/Skills/Form.vue +53 -0
- package/src/pages/Admin/Skills/Index.vue +94 -0
- package/src/pages/Admin/SlaPolicies/Form.vue +62 -19
- package/src/pages/Admin/SlaPolicies/Index.vue +85 -23
- package/src/pages/Admin/Statuses/Form.vue +114 -0
- package/src/pages/Admin/Statuses/Index.vue +153 -0
- package/src/pages/Admin/Tags/Index.vue +121 -35
- package/src/pages/Admin/Tickets/Index.vue +96 -9
- package/src/pages/Admin/Tickets/Show.vue +130 -37
- package/src/pages/Admin/Webhooks/DeliveryLog.vue +120 -0
- package/src/pages/Admin/Webhooks/Form.vue +110 -0
- package/src/pages/Admin/Webhooks/Index.vue +136 -0
- package/src/pages/Admin/Workflows/Builder.vue +207 -0
- package/src/pages/Admin/Workflows/Index.vue +235 -0
- package/src/pages/Admin/Workflows/Logs.vue +286 -0
- package/src/pages/Agent/Dashboard.vue +311 -186
- package/src/pages/Agent/TicketIndex.vue +80 -6
- package/src/pages/Agent/TicketShow.vue +399 -60
- package/src/pages/Customer/Create.vue +37 -10
- package/src/pages/Customer/Index.vue +9 -2
- package/src/pages/Customer/KnowledgeBase/Article.vue +129 -0
- package/src/pages/Customer/KnowledgeBase/Index.vue +151 -0
- package/src/pages/Customer/Show.vue +69 -63
- package/src/pages/Guest/Create.vue +40 -15
- package/src/pages/Guest/Show.vue +124 -93
- package/src/plugin.js +111 -1
- package/src/utils/constants.js +30 -0
- package/src/utils/formatting.js +35 -0
- package/src/utils/mentionHighlight.js +24 -0
- package/src/utils/sanitizeHtml.js +78 -64
- package/src/widget/EscalatedWidget.vue +804 -0
- package/src/widget/index.js +254 -0
- package/src/pages/Admin/Plugins.vue +0 -129
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
import { ref, computed, inject } from 'vue';
|
|
3
3
|
import { router } from '@inertiajs/vue3';
|
|
4
4
|
import FileDropzone from './FileDropzone.vue';
|
|
5
|
+
import MentionDropdown from './MentionDropdown.vue';
|
|
6
|
+
import { useMentions } from '../composables/useMentions';
|
|
5
7
|
|
|
6
8
|
const props = defineProps({
|
|
7
9
|
action: { type: String, required: true },
|
|
@@ -9,15 +11,87 @@ const props = defineProps({
|
|
|
9
11
|
allowNotes: { type: Boolean, default: false },
|
|
10
12
|
placeholder: { type: String, default: 'Type your reply...' },
|
|
11
13
|
submitLabel: { type: String, default: null },
|
|
14
|
+
typingEndpoint: { type: String, default: '' },
|
|
12
15
|
});
|
|
13
16
|
|
|
14
17
|
const emit = defineEmits(['submit']);
|
|
15
|
-
const escDark = inject(
|
|
18
|
+
const escDark = inject(
|
|
19
|
+
'esc-dark',
|
|
20
|
+
computed(() => false),
|
|
21
|
+
);
|
|
16
22
|
|
|
17
23
|
const body = ref('');
|
|
18
24
|
const isNote = ref(false);
|
|
19
25
|
const files = ref([]);
|
|
20
26
|
const submitting = ref(false);
|
|
27
|
+
const textareaRef = ref(null);
|
|
28
|
+
const mentionDropdownRef = ref(null);
|
|
29
|
+
|
|
30
|
+
const {
|
|
31
|
+
suggestions,
|
|
32
|
+
isActive: mentionActive,
|
|
33
|
+
loading: mentionLoading,
|
|
34
|
+
onTextChange,
|
|
35
|
+
insertMention,
|
|
36
|
+
close: closeMentions,
|
|
37
|
+
} = useMentions();
|
|
38
|
+
|
|
39
|
+
function onMentionInput() {
|
|
40
|
+
if (textareaRef.value) {
|
|
41
|
+
onTextChange(textareaRef.value, body.value);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function handleMentionSelect(agent) {
|
|
46
|
+
body.value = insertMention(body.value, agent);
|
|
47
|
+
textareaRef.value?.focus();
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function handleMentionKeydown(e) {
|
|
51
|
+
if (mentionActive.value && mentionDropdownRef.value) {
|
|
52
|
+
const handled = mentionDropdownRef.value.onKeydown(e);
|
|
53
|
+
if (handled) return;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// Typing indicator: debounced POST every 5 seconds while typing
|
|
58
|
+
let lastTypingSent = 0;
|
|
59
|
+
let typingTimer = null;
|
|
60
|
+
|
|
61
|
+
function onTyping() {
|
|
62
|
+
if (!props.typingEndpoint) return;
|
|
63
|
+
const now = Date.now();
|
|
64
|
+
if (now - lastTypingSent < 5000) return;
|
|
65
|
+
lastTypingSent = now;
|
|
66
|
+
sendTypingIndicator();
|
|
67
|
+
|
|
68
|
+
// Clear typing after 6 seconds of inactivity
|
|
69
|
+
window.clearTimeout(typingTimer);
|
|
70
|
+
typingTimer = window.setTimeout(() => {
|
|
71
|
+
lastTypingSent = 0;
|
|
72
|
+
}, 6000);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
async function sendTypingIndicator() {
|
|
76
|
+
try {
|
|
77
|
+
await fetch(props.typingEndpoint, {
|
|
78
|
+
method: 'POST',
|
|
79
|
+
headers: {
|
|
80
|
+
Accept: 'application/json',
|
|
81
|
+
'Content-Type': 'application/json',
|
|
82
|
+
'X-Requested-With': 'XMLHttpRequest',
|
|
83
|
+
'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]')?.content || '',
|
|
84
|
+
},
|
|
85
|
+
});
|
|
86
|
+
} catch {
|
|
87
|
+
// silently ignore
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function onBlur() {
|
|
92
|
+
window.clearTimeout(typingTimer);
|
|
93
|
+
lastTypingSent = 0;
|
|
94
|
+
}
|
|
21
95
|
|
|
22
96
|
function insertCanned(response) {
|
|
23
97
|
body.value += response.body;
|
|
@@ -34,6 +108,8 @@ function removeFile(index) {
|
|
|
34
108
|
function submit() {
|
|
35
109
|
if (!body.value.trim() || submitting.value) return;
|
|
36
110
|
submitting.value = true;
|
|
111
|
+
window.clearTimeout(typingTimer);
|
|
112
|
+
lastTypingSent = 0;
|
|
37
113
|
|
|
38
114
|
const payload = {
|
|
39
115
|
body: body.value,
|
|
@@ -66,45 +142,100 @@ const buttonLabel = computed(() => {
|
|
|
66
142
|
<!-- Dark mode -->
|
|
67
143
|
<div v-if="escDark" class="rounded-xl border border-white/[0.06] bg-neutral-900/60 p-4">
|
|
68
144
|
<div v-if="allowNotes" class="mb-3 flex gap-2">
|
|
69
|
-
<button
|
|
70
|
-
|
|
145
|
+
<button
|
|
146
|
+
:class="[
|
|
147
|
+
'rounded-lg px-3 py-1.5 text-sm font-medium transition-colors',
|
|
148
|
+
!isNote
|
|
149
|
+
? 'bg-cyan-500/15 text-white ring-1 ring-cyan-500/20'
|
|
150
|
+
: 'text-gray-400 hover:bg-white/[0.04]',
|
|
151
|
+
]"
|
|
152
|
+
@click="isNote = false"
|
|
153
|
+
>
|
|
71
154
|
Reply
|
|
72
155
|
</button>
|
|
73
|
-
<button
|
|
74
|
-
|
|
156
|
+
<button
|
|
157
|
+
:class="[
|
|
158
|
+
'rounded-lg px-3 py-1.5 text-sm font-medium transition-colors',
|
|
159
|
+
isNote
|
|
160
|
+
? 'bg-amber-500/15 text-amber-400 ring-1 ring-amber-500/20'
|
|
161
|
+
: 'text-gray-400 hover:bg-white/[0.04]',
|
|
162
|
+
]"
|
|
163
|
+
aria-label="Internal note"
|
|
164
|
+
@click="isNote = true"
|
|
165
|
+
>
|
|
75
166
|
Internal Note
|
|
76
167
|
</button>
|
|
77
168
|
</div>
|
|
78
169
|
|
|
79
|
-
<div
|
|
170
|
+
<div
|
|
171
|
+
v-if="isNote"
|
|
172
|
+
class="mb-2 rounded-lg bg-amber-500/10 px-3 py-1.5 text-xs text-amber-400 ring-1 ring-amber-500/20"
|
|
173
|
+
>
|
|
80
174
|
This note is only visible to agents.
|
|
81
175
|
</div>
|
|
82
176
|
|
|
83
|
-
<
|
|
84
|
-
|
|
177
|
+
<div class="relative">
|
|
178
|
+
<textarea
|
|
179
|
+
ref="textareaRef"
|
|
180
|
+
v-model="body"
|
|
181
|
+
rows="4"
|
|
182
|
+
:placeholder="placeholder"
|
|
183
|
+
aria-label="Reply message"
|
|
184
|
+
class="w-full rounded-lg border border-white/10 bg-neutral-950 px-3 py-2 text-sm text-gray-200 placeholder-gray-500 focus:border-white/20 focus:outline-none focus:ring-1 focus:ring-white/10"
|
|
185
|
+
@keydown="
|
|
186
|
+
handleMentionKeydown($event);
|
|
187
|
+
onTyping();
|
|
188
|
+
"
|
|
189
|
+
@input="onMentionInput"
|
|
190
|
+
@blur="onBlur"
|
|
191
|
+
></textarea>
|
|
192
|
+
<MentionDropdown
|
|
193
|
+
ref="mentionDropdownRef"
|
|
194
|
+
:suggestions="suggestions"
|
|
195
|
+
:visible="mentionActive"
|
|
196
|
+
:loading="mentionLoading"
|
|
197
|
+
class="bottom-0 left-0 translate-y-full"
|
|
198
|
+
@select="handleMentionSelect"
|
|
199
|
+
@close="closeMentions"
|
|
200
|
+
/>
|
|
201
|
+
</div>
|
|
85
202
|
|
|
86
|
-
<FileDropzone
|
|
203
|
+
<FileDropzone class="mt-2" @files="handleFiles" />
|
|
87
204
|
|
|
88
205
|
<div v-if="files.length" class="mt-2 space-y-1">
|
|
89
206
|
<div v-for="(file, i) in files" :key="i" class="flex items-center gap-2 text-sm text-gray-400">
|
|
90
207
|
<span>{{ file.name }}</span>
|
|
91
|
-
<button
|
|
208
|
+
<button aria-label="Remove attachment" class="text-rose-400 hover:text-rose-300" @click="removeFile(i)">
|
|
209
|
+
×
|
|
210
|
+
</button>
|
|
92
211
|
</div>
|
|
93
212
|
</div>
|
|
94
213
|
|
|
95
214
|
<div class="mt-3 flex items-center justify-between">
|
|
96
215
|
<div v-if="cannedResponses.length">
|
|
97
|
-
<select
|
|
98
|
-
|
|
216
|
+
<select
|
|
217
|
+
class="rounded-lg border border-white/10 bg-gray-900 px-2 py-1 text-xs text-gray-400"
|
|
218
|
+
@change="
|
|
219
|
+
insertCanned(cannedResponses[$event.target.value]);
|
|
220
|
+
$event.target.value = '';
|
|
221
|
+
"
|
|
222
|
+
>
|
|
99
223
|
<option value="">Canned responses...</option>
|
|
100
224
|
<option v-for="(cr, i) in cannedResponses" :key="cr.id" :value="i">{{ cr.title }}</option>
|
|
101
225
|
</select>
|
|
102
226
|
</div>
|
|
103
227
|
<div v-else></div>
|
|
104
|
-
<button
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
228
|
+
<button
|
|
229
|
+
:disabled="!body.trim() || submitting"
|
|
230
|
+
:class="[
|
|
231
|
+
'rounded-lg px-4 py-2 text-sm font-medium text-white transition-all',
|
|
232
|
+
isNote
|
|
233
|
+
? 'bg-amber-500 hover:bg-amber-400'
|
|
234
|
+
: 'bg-gradient-to-r from-cyan-500 to-violet-500 hover:from-cyan-400 hover:to-violet-400',
|
|
235
|
+
(!body.trim() || submitting) && 'cursor-not-allowed opacity-40',
|
|
236
|
+
]"
|
|
237
|
+
@click="submit"
|
|
238
|
+
>
|
|
108
239
|
{{ buttonLabel }}
|
|
109
240
|
</button>
|
|
110
241
|
</div>
|
|
@@ -113,12 +244,23 @@ const buttonLabel = computed(() => {
|
|
|
113
244
|
<!-- Light mode -->
|
|
114
245
|
<div v-else class="rounded-lg border border-gray-200 bg-white p-4">
|
|
115
246
|
<div v-if="allowNotes" class="mb-3 flex gap-2">
|
|
116
|
-
<button
|
|
117
|
-
|
|
247
|
+
<button
|
|
248
|
+
:class="[
|
|
249
|
+
'rounded-md px-3 py-1 text-sm font-medium',
|
|
250
|
+
!isNote ? 'bg-blue-100 text-blue-700' : 'text-gray-500 hover:bg-gray-100',
|
|
251
|
+
]"
|
|
252
|
+
@click="isNote = false"
|
|
253
|
+
>
|
|
118
254
|
Reply
|
|
119
255
|
</button>
|
|
120
|
-
<button
|
|
121
|
-
|
|
256
|
+
<button
|
|
257
|
+
:class="[
|
|
258
|
+
'rounded-md px-3 py-1 text-sm font-medium',
|
|
259
|
+
isNote ? 'bg-yellow-100 text-yellow-700' : 'text-gray-500 hover:bg-gray-100',
|
|
260
|
+
]"
|
|
261
|
+
aria-label="Internal note"
|
|
262
|
+
@click="isNote = true"
|
|
263
|
+
>
|
|
122
264
|
Internal Note
|
|
123
265
|
</button>
|
|
124
266
|
</div>
|
|
@@ -127,31 +269,66 @@ const buttonLabel = computed(() => {
|
|
|
127
269
|
This note is only visible to agents.
|
|
128
270
|
</div>
|
|
129
271
|
|
|
130
|
-
<
|
|
131
|
-
|
|
272
|
+
<div class="relative">
|
|
273
|
+
<textarea
|
|
274
|
+
ref="textareaRef"
|
|
275
|
+
v-model="body"
|
|
276
|
+
rows="4"
|
|
277
|
+
:placeholder="placeholder"
|
|
278
|
+
aria-label="Reply message"
|
|
279
|
+
class="w-full rounded-md border border-gray-300 px-3 py-2 text-sm focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500"
|
|
280
|
+
@keydown="
|
|
281
|
+
handleMentionKeydown($event);
|
|
282
|
+
onTyping();
|
|
283
|
+
"
|
|
284
|
+
@input="onMentionInput"
|
|
285
|
+
@blur="onBlur"
|
|
286
|
+
></textarea>
|
|
287
|
+
<MentionDropdown
|
|
288
|
+
ref="mentionDropdownRef"
|
|
289
|
+
:suggestions="suggestions"
|
|
290
|
+
:visible="mentionActive"
|
|
291
|
+
:loading="mentionLoading"
|
|
292
|
+
class="bottom-0 left-0 translate-y-full"
|
|
293
|
+
@select="handleMentionSelect"
|
|
294
|
+
@close="closeMentions"
|
|
295
|
+
/>
|
|
296
|
+
</div>
|
|
132
297
|
|
|
133
|
-
<FileDropzone
|
|
298
|
+
<FileDropzone class="mt-2" @files="handleFiles" />
|
|
134
299
|
|
|
135
300
|
<div v-if="files.length" class="mt-2 space-y-1">
|
|
136
301
|
<div v-for="(file, i) in files" :key="i" class="flex items-center gap-2 text-sm text-gray-600">
|
|
137
302
|
<span>{{ file.name }}</span>
|
|
138
|
-
<button
|
|
303
|
+
<button aria-label="Remove attachment" class="text-red-500 hover:text-red-700" @click="removeFile(i)">
|
|
304
|
+
×
|
|
305
|
+
</button>
|
|
139
306
|
</div>
|
|
140
307
|
</div>
|
|
141
308
|
|
|
142
309
|
<div class="mt-3 flex items-center justify-between">
|
|
143
310
|
<div v-if="cannedResponses.length">
|
|
144
|
-
<select
|
|
145
|
-
|
|
311
|
+
<select
|
|
312
|
+
class="rounded border border-gray-300 px-2 py-1 text-xs text-gray-600"
|
|
313
|
+
@change="
|
|
314
|
+
insertCanned(cannedResponses[$event.target.value]);
|
|
315
|
+
$event.target.value = '';
|
|
316
|
+
"
|
|
317
|
+
>
|
|
146
318
|
<option value="">Canned responses...</option>
|
|
147
319
|
<option v-for="(cr, i) in cannedResponses" :key="cr.id" :value="i">{{ cr.title }}</option>
|
|
148
320
|
</select>
|
|
149
321
|
</div>
|
|
150
322
|
<div v-else></div>
|
|
151
|
-
<button
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
323
|
+
<button
|
|
324
|
+
:disabled="!body.trim() || submitting"
|
|
325
|
+
:class="[
|
|
326
|
+
'rounded-md px-4 py-2 text-sm font-medium text-white',
|
|
327
|
+
isNote ? 'bg-yellow-500 hover:bg-yellow-600' : 'bg-blue-600 hover:bg-blue-700',
|
|
328
|
+
(!body.trim() || submitting) && 'cursor-not-allowed opacity-50',
|
|
329
|
+
]"
|
|
330
|
+
@click="submit"
|
|
331
|
+
>
|
|
155
332
|
{{ buttonLabel }}
|
|
156
333
|
</button>
|
|
157
334
|
</div>
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { inject, computed } from 'vue';
|
|
2
|
+
import { ref, inject, computed } from 'vue';
|
|
3
3
|
import { router } from '@inertiajs/vue3';
|
|
4
4
|
import AttachmentList from './AttachmentList.vue';
|
|
5
|
+
import TicketSplitDialog from './TicketSplitDialog.vue';
|
|
5
6
|
import { sanitizeHtml } from '../utils/sanitizeHtml';
|
|
7
|
+
import { highlightMentions } from '../utils/mentionHighlight';
|
|
6
8
|
import { useI18n } from '../composables/useI18n';
|
|
7
9
|
|
|
8
10
|
const props = defineProps({
|
|
@@ -11,9 +13,28 @@ const props = defineProps({
|
|
|
11
13
|
ticketReference: { type: String, default: '' },
|
|
12
14
|
routePrefix: { type: String, default: '' },
|
|
13
15
|
pinnable: { type: Boolean, default: false },
|
|
16
|
+
splittable: { type: Boolean, default: false },
|
|
14
17
|
});
|
|
15
18
|
|
|
16
|
-
const
|
|
19
|
+
const splitReply = ref(null);
|
|
20
|
+
|
|
21
|
+
function openSplitDialog(reply) {
|
|
22
|
+
splitReply.value = reply;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function closeSplitDialog() {
|
|
26
|
+
splitReply.value = null;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function stripHtml(html) {
|
|
30
|
+
const doc = new DOMParser().parseFromString(html, 'text/html');
|
|
31
|
+
return doc.body.textContent || '';
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const escDark = inject(
|
|
35
|
+
'esc-dark',
|
|
36
|
+
computed(() => false),
|
|
37
|
+
);
|
|
17
38
|
const { t } = useI18n();
|
|
18
39
|
|
|
19
40
|
function formatDate(date) {
|
|
@@ -22,42 +43,111 @@ function formatDate(date) {
|
|
|
22
43
|
|
|
23
44
|
function togglePin(reply) {
|
|
24
45
|
if (!props.routePrefix || !props.ticketReference) return;
|
|
25
|
-
router.post(
|
|
46
|
+
router.post(
|
|
47
|
+
route(`${props.routePrefix}.tickets.pin`, [props.ticketReference, reply.id]),
|
|
48
|
+
{},
|
|
49
|
+
{ preserveScroll: true },
|
|
50
|
+
);
|
|
26
51
|
}
|
|
27
52
|
</script>
|
|
28
53
|
|
|
29
54
|
<template>
|
|
30
|
-
<div class="space-y-4">
|
|
31
|
-
<div
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
55
|
+
<div class="space-y-4" role="feed" aria-label="Reply thread">
|
|
56
|
+
<div
|
|
57
|
+
v-for="reply in replies"
|
|
58
|
+
:key="reply.id"
|
|
59
|
+
:class="[
|
|
60
|
+
'rounded-xl border p-4',
|
|
61
|
+
escDark
|
|
62
|
+
? reply.is_internal_note
|
|
63
|
+
? 'border-amber-500/20 bg-amber-500/5'
|
|
64
|
+
: 'border-[var(--esc-panel-border)] bg-[var(--esc-panel-surface)]'
|
|
65
|
+
: reply.is_internal_note
|
|
66
|
+
? 'border-yellow-200 bg-yellow-50'
|
|
67
|
+
: 'border-gray-200 bg-white',
|
|
68
|
+
]"
|
|
69
|
+
>
|
|
35
70
|
<div class="mb-2 flex items-center justify-between">
|
|
36
71
|
<div class="flex items-center gap-2">
|
|
37
|
-
<span
|
|
38
|
-
|
|
39
|
-
|
|
72
|
+
<span
|
|
73
|
+
:class="['font-medium', escDark ? 'text-[var(--esc-panel-text-secondary)]' : 'text-gray-900']"
|
|
74
|
+
>{{ reply.author?.name || t('ticket.unknown') }}</span
|
|
75
|
+
>
|
|
76
|
+
<span
|
|
77
|
+
v-if="reply.is_internal_note"
|
|
78
|
+
:class="[
|
|
79
|
+
'rounded px-1.5 py-0.5 text-xs font-medium',
|
|
80
|
+
escDark ? 'bg-amber-500/15 text-amber-400' : 'bg-yellow-200 text-yellow-800',
|
|
81
|
+
]"
|
|
82
|
+
>
|
|
40
83
|
{{ t('reply.internal_note') }}
|
|
41
84
|
</span>
|
|
42
|
-
<span
|
|
43
|
-
|
|
85
|
+
<span
|
|
86
|
+
v-if="reply.is_pinned"
|
|
87
|
+
:class="[
|
|
88
|
+
'rounded px-1.5 py-0.5 text-xs font-medium',
|
|
89
|
+
escDark ? 'bg-cyan-500/15 text-cyan-400' : 'bg-blue-100 text-blue-700',
|
|
90
|
+
]"
|
|
91
|
+
>
|
|
44
92
|
{{ t('reply.pinned') }}
|
|
45
93
|
</span>
|
|
46
94
|
</div>
|
|
47
95
|
<div class="flex items-center gap-2">
|
|
48
|
-
<button
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
96
|
+
<button
|
|
97
|
+
v-if="splittable && !reply.is_internal_note"
|
|
98
|
+
:class="[
|
|
99
|
+
'rounded px-2 py-0.5 text-xs font-medium transition-colors',
|
|
100
|
+
escDark
|
|
101
|
+
? 'text-[var(--esc-panel-text-muted)] hover:bg-[var(--esc-panel-hover)] hover:text-[var(--esc-panel-text-secondary)]'
|
|
102
|
+
: 'text-gray-400 hover:bg-gray-100 hover:text-gray-600',
|
|
103
|
+
]"
|
|
104
|
+
@click="openSplitDialog(reply)"
|
|
105
|
+
>
|
|
106
|
+
{{ t('reply.split') }}
|
|
107
|
+
</button>
|
|
108
|
+
<button
|
|
109
|
+
v-if="pinnable && reply.is_internal_note"
|
|
110
|
+
:class="[
|
|
111
|
+
'rounded px-2 py-0.5 text-xs font-medium transition-colors',
|
|
112
|
+
escDark
|
|
113
|
+
? reply.is_pinned
|
|
114
|
+
? 'bg-cyan-500/15 text-cyan-400 hover:bg-cyan-500/25'
|
|
115
|
+
: 'text-[var(--esc-panel-text-muted)] hover:bg-[var(--esc-panel-hover)] hover:text-[var(--esc-panel-text-secondary)]'
|
|
116
|
+
: reply.is_pinned
|
|
117
|
+
? 'bg-blue-100 text-blue-700 hover:bg-blue-200'
|
|
118
|
+
: 'text-gray-400 hover:bg-gray-100 hover:text-gray-600',
|
|
119
|
+
]"
|
|
120
|
+
@click="togglePin(reply)"
|
|
121
|
+
>
|
|
53
122
|
{{ reply.is_pinned ? t('reply.unpin') : t('reply.pin') }}
|
|
54
123
|
</button>
|
|
55
|
-
<span :class="['text-xs', escDark ? 'text-
|
|
124
|
+
<span :class="['text-xs', escDark ? 'text-[var(--esc-panel-text-muted)]' : 'text-gray-500']">{{
|
|
125
|
+
formatDate(reply.created_at)
|
|
126
|
+
}}</span>
|
|
56
127
|
</div>
|
|
57
128
|
</div>
|
|
58
|
-
<div
|
|
129
|
+
<div
|
|
130
|
+
:class="[
|
|
131
|
+
'prose prose-sm max-w-none',
|
|
132
|
+
escDark ? 'prose-invert text-[var(--esc-panel-text-secondary)]' : 'text-gray-700',
|
|
133
|
+
]"
|
|
134
|
+
v-html="highlightMentions(sanitizeHtml(reply.body), escDark)"
|
|
135
|
+
></div>
|
|
59
136
|
<AttachmentList v-if="reply.attachments?.length" :attachments="reply.attachments" class="mt-3" />
|
|
60
137
|
</div>
|
|
61
|
-
<div
|
|
138
|
+
<div
|
|
139
|
+
v-if="!replies?.length"
|
|
140
|
+
:class="['py-8 text-center text-sm', escDark ? 'text-[var(--esc-panel-text-muted)]' : 'text-gray-500']"
|
|
141
|
+
>
|
|
142
|
+
{{ t('ticket.no_replies') }}
|
|
143
|
+
</div>
|
|
144
|
+
<TicketSplitDialog
|
|
145
|
+
v-if="splitReply"
|
|
146
|
+
:ticket-reference="ticketReference"
|
|
147
|
+
:reply-id="splitReply.id"
|
|
148
|
+
:reply-author="splitReply.author?.name || ''"
|
|
149
|
+
:reply-excerpt="stripHtml(splitReply.body)"
|
|
150
|
+
@close="closeSplitDialog"
|
|
151
|
+
/>
|
|
62
152
|
</div>
|
|
63
153
|
</template>
|