@escalated-dev/escalated 0.7.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 +31 -0
- package/package.json +12 -6
- package/src/components/ActiveChatsPanel.vue +246 -0
- package/src/components/ActivityTimeline.stories.js +55 -55
- package/src/components/ActivityTimeline.vue +83 -83
- package/src/components/AdminDashboard.stories.js +1423 -1095
- package/src/components/AgentLoadIndicator.stories.js +37 -37
- package/src/components/AgentLoadIndicator.vue +49 -49
- package/src/components/AgentPerformanceCard.vue +44 -44
- package/src/components/ArticleEditor.vue +82 -82
- package/src/components/AssigneeSelect.vue +37 -37
- package/src/components/AttachmentList.vue +13 -1
- package/src/components/AuditLogEntry.vue +95 -95
- package/src/components/BulkActionBar.vue +166 -166
- package/src/components/CategoryTree.vue +89 -89
- package/src/components/ChartWidget.vue +46 -46
- 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 -30
- package/src/components/CollisionWarning.vue +68 -68
- package/src/components/ConditionalFieldRules.vue +135 -135
- package/src/components/ContextPanel.vue +66 -66
- package/src/components/ContextPanelSection.vue +65 -65
- package/src/components/CustomFieldRenderer.vue +159 -159
- package/src/components/EscalatedLayout.vue +29 -6
- package/src/components/FileDropzone.vue +57 -57
- package/src/components/FollowButton.stories.js +30 -30
- package/src/components/FollowButton.vue +88 -88
- package/src/components/KeyboardShortcutHelp.vue +213 -213
- package/src/components/KnowledgePanel.vue +122 -122
- package/src/components/KpiCard.stories.js +32 -32
- package/src/components/KpiCard.vue +88 -88
- package/src/components/MacroDropdown.vue +150 -150
- 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 -107
- package/src/components/PinnedNotes.vue +129 -129
- package/src/components/PluginSlot.vue +68 -62
- package/src/components/PresenceIndicator.vue +46 -2
- package/src/components/PriorityBadge.stories.js +33 -33
- package/src/components/PriorityBadge.vue +46 -46
- package/src/components/ReplyComposer.vue +81 -18
- package/src/components/ReplyThread.vue +40 -2
- package/src/components/ReportChart.vue +395 -0
- package/src/components/ReportExportButton.vue +108 -0
- package/src/components/SatisfactionRating.vue +180 -180
- package/src/components/SaveViewDialog.vue +172 -0
- package/src/components/SavedViewSidebar.vue +208 -0
- package/src/components/ScheduleEditor.vue +104 -104
- package/src/components/SideConversation.vue +165 -165
- package/src/components/SideConversationList.vue +147 -147
- package/src/components/SkillTagManager.vue +79 -79
- package/src/components/SlaComplianceChart.vue +46 -53
- package/src/components/SlaTimer.stories.js +35 -35
- package/src/components/SlaTimer.vue +62 -62
- package/src/components/SnoozeButton.vue +247 -0
- package/src/components/StatsCard.stories.js +24 -24
- package/src/components/StatsCard.vue +58 -58
- package/src/components/StatusBadge.stories.js +53 -53
- package/src/components/StatusBadge.vue +78 -78
- package/src/components/TagSelect.vue +84 -84
- package/src/components/TicketFilters.vue +270 -225
- package/src/components/TicketLinkPanel.vue +193 -193
- package/src/components/TicketList.vue +655 -594
- package/src/components/TicketMergeDialog.vue +157 -157
- package/src/components/TicketSplitDialog.vue +98 -0
- package/src/components/TotpInput.stories.js +9 -9
- package/src/components/TotpInput.vue +81 -81
- package/src/components/TwoFactorSetup.vue +113 -113
- 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/useI18n.js +80 -80
- package/src/composables/useKeyboardShortcuts.js +46 -46
- package/src/composables/useMentions.js +134 -0
- package/src/composables/usePluginExtensions.js +159 -159
- package/src/composables/usePluginHooks.js +65 -65
- package/src/composables/useRealtime.js +182 -0
- package/src/defineEscalatedPlugin.js +76 -76
- package/src/index.js +84 -72
- package/src/locales/ar.json +727 -0
- package/src/locales/de.json +678 -430
- package/src/locales/en.json +717 -455
- 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 -381
- package/src/pages/Admin/AuditLog/Index.vue +154 -154
- package/src/pages/Admin/BusinessHours/Form.vue +172 -172
- package/src/pages/Admin/BusinessHours/Index.vue +113 -113
- package/src/pages/Admin/CannedResponses/Index.vue +127 -127
- package/src/pages/Admin/Capacity/Index.vue +134 -134
- package/src/pages/Admin/CustomFields/Form.vue +195 -195
- package/src/pages/Admin/CustomFields/Index.vue +134 -134
- package/src/pages/Admin/CustomObjects/Form.vue +202 -202
- package/src/pages/Admin/CustomObjects/Index.vue +127 -127
- package/src/pages/Admin/CustomObjects/Records.vue +228 -228
- package/src/pages/Admin/Departments/Form.vue +75 -75
- package/src/pages/Admin/Departments/Index.vue +110 -109
- package/src/pages/Admin/EscalationRules/Form.vue +157 -157
- package/src/pages/Admin/EscalationRules/Index.vue +178 -178
- package/src/pages/Admin/Import/Connect.vue +0 -1
- package/src/pages/Admin/Import/Index.vue +1 -1
- package/src/pages/Admin/Import/Progress.vue +1 -1
- package/src/pages/Admin/KnowledgeBase/Articles/Form.vue +142 -142
- package/src/pages/Admin/KnowledgeBase/Articles/Index.vue +195 -195
- package/src/pages/Admin/KnowledgeBase/Categories/Index.vue +193 -193
- package/src/pages/Admin/Macros/Index.vue +448 -448
- package/src/pages/Admin/Plugins/Index.vue +327 -327
- package/src/pages/Admin/Reports/AgentDetail.vue +132 -0
- package/src/pages/Admin/Reports/AgentMetrics.vue +115 -115
- 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 -127
- package/src/pages/Admin/Reports/Dashboard.vue +36 -21
- 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 -166
- package/src/pages/Admin/Reports/SlaTrends.vue +183 -0
- package/src/pages/Admin/Reports.vue +206 -206
- package/src/pages/Admin/Roles/Form.vue +71 -71
- package/src/pages/Admin/Roles/Index.vue +122 -122
- package/src/pages/Admin/Settings/CsatSettings.vue +165 -165
- package/src/pages/Admin/Settings/DataRetention.vue +182 -182
- package/src/pages/Admin/Settings/EmailSettings.vue +243 -243
- package/src/pages/Admin/Settings/Sandbox.vue +135 -135
- package/src/pages/Admin/Settings/SsoSettings.vue +218 -218
- package/src/pages/Admin/Settings/TwoFactor.vue +110 -110
- package/src/pages/Admin/Settings.vue +1008 -468
- package/src/pages/Admin/Skills/Form.vue +53 -53
- package/src/pages/Admin/Skills/Index.vue +94 -94
- package/src/pages/Admin/SlaPolicies/Form.vue +118 -118
- package/src/pages/Admin/SlaPolicies/Index.vue +121 -120
- package/src/pages/Admin/Statuses/Form.vue +114 -114
- package/src/pages/Admin/Statuses/Index.vue +153 -153
- package/src/pages/Admin/Tags/Index.vue +191 -191
- package/src/pages/Admin/Tickets/Index.vue +126 -91
- package/src/pages/Admin/Tickets/Show.vue +29 -0
- package/src/pages/Admin/Webhooks/DeliveryLog.vue +120 -120
- package/src/pages/Admin/Webhooks/Form.vue +110 -110
- package/src/pages/Admin/Webhooks/Index.vue +136 -136
- 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/TicketIndex.vue +112 -88
- package/src/pages/Agent/TicketShow.vue +192 -60
- package/src/pages/Customer/Create.vue +1 -1
- package/src/pages/Customer/Index.vue +31 -31
- package/src/pages/Customer/KnowledgeBase/Article.vue +4 -2
- package/src/pages/Customer/KnowledgeBase/Index.vue +151 -151
- 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 +25 -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/Automations/Form.vue +0 -184
- package/src/pages/Admin/Automations/Index.vue +0 -129
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { ref, computed, inject, watch, nextTick, onMounted } from 'vue';
|
|
3
|
+
import ChatBubble from './ChatBubble.vue';
|
|
4
|
+
import { useI18n } from '../composables/useI18n';
|
|
5
|
+
|
|
6
|
+
const props = defineProps({
|
|
7
|
+
messages: { type: Array, default: () => [] },
|
|
8
|
+
typingUser: { type: String, default: null },
|
|
9
|
+
currentUserId: { type: [Number, String], default: null },
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
const { t } = useI18n();
|
|
13
|
+
const escDark = inject(
|
|
14
|
+
'esc-dark',
|
|
15
|
+
computed(() => false),
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
const threadContainer = ref(null);
|
|
19
|
+
const isScrolledUp = ref(false);
|
|
20
|
+
const hasNewMessages = ref(false);
|
|
21
|
+
|
|
22
|
+
// Determine if user is near bottom of scroll
|
|
23
|
+
function isNearBottom() {
|
|
24
|
+
const el = threadContainer.value;
|
|
25
|
+
if (!el) return true;
|
|
26
|
+
return el.scrollHeight - el.scrollTop - el.clientHeight < 80;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function onScroll() {
|
|
30
|
+
isScrolledUp.value = !isNearBottom();
|
|
31
|
+
if (!isScrolledUp.value) {
|
|
32
|
+
hasNewMessages.value = false;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function scrollToBottom() {
|
|
37
|
+
const el = threadContainer.value;
|
|
38
|
+
if (!el) return;
|
|
39
|
+
el.scrollTop = el.scrollHeight;
|
|
40
|
+
isScrolledUp.value = false;
|
|
41
|
+
hasNewMessages.value = false;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Auto-scroll on new messages
|
|
45
|
+
watch(
|
|
46
|
+
() => props.messages.length,
|
|
47
|
+
async () => {
|
|
48
|
+
await nextTick();
|
|
49
|
+
if (isNearBottom()) {
|
|
50
|
+
scrollToBottom();
|
|
51
|
+
} else {
|
|
52
|
+
hasNewMessages.value = true;
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
onMounted(() => {
|
|
58
|
+
nextTick(() => scrollToBottom());
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Determine whether to show avatar for a message:
|
|
63
|
+
* Show on the first message of a consecutive group by the same author.
|
|
64
|
+
*/
|
|
65
|
+
function shouldShowAvatar(index) {
|
|
66
|
+
if (index === 0) return true;
|
|
67
|
+
const prev = props.messages[index - 1];
|
|
68
|
+
const curr = props.messages[index];
|
|
69
|
+
return prev.author?.id !== curr.author?.id;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Determine whether to show a time separator between messages.
|
|
74
|
+
* Show when there's a >5 minute gap.
|
|
75
|
+
*/
|
|
76
|
+
function shouldShowTimeSeparator(index) {
|
|
77
|
+
if (index === 0) return true;
|
|
78
|
+
const prev = props.messages[index - 1];
|
|
79
|
+
const curr = props.messages[index];
|
|
80
|
+
if (!prev.created_at || !curr.created_at) return false;
|
|
81
|
+
const gap = new Date(curr.created_at) - new Date(prev.created_at);
|
|
82
|
+
return gap > 5 * 60 * 1000;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Show timestamp on the last message of a group or when there's a time gap.
|
|
87
|
+
*/
|
|
88
|
+
function shouldShowTimestamp(index) {
|
|
89
|
+
if (index === props.messages.length - 1) return true;
|
|
90
|
+
return shouldShowTimeSeparator(index + 1);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function formatTimeSeparator(dateStr) {
|
|
94
|
+
const date = new Date(dateStr);
|
|
95
|
+
const now = new Date();
|
|
96
|
+
const diffDays = Math.floor((now - date) / 86400000);
|
|
97
|
+
|
|
98
|
+
if (diffDays === 0) {
|
|
99
|
+
return date.toLocaleTimeString(undefined, { hour: '2-digit', minute: '2-digit' });
|
|
100
|
+
}
|
|
101
|
+
if (diffDays === 1) {
|
|
102
|
+
return 'Yesterday ' + date.toLocaleTimeString(undefined, { hour: '2-digit', minute: '2-digit' });
|
|
103
|
+
}
|
|
104
|
+
return date.toLocaleDateString(undefined, {
|
|
105
|
+
month: 'short',
|
|
106
|
+
day: 'numeric',
|
|
107
|
+
hour: '2-digit',
|
|
108
|
+
minute: '2-digit',
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function isAgentMessage(message) {
|
|
113
|
+
if (message.is_agent !== undefined) return message.is_agent;
|
|
114
|
+
if (props.currentUserId && message.author?.id) {
|
|
115
|
+
return String(message.author.id) === String(props.currentUserId);
|
|
116
|
+
}
|
|
117
|
+
return false;
|
|
118
|
+
}
|
|
119
|
+
</script>
|
|
120
|
+
|
|
121
|
+
<template>
|
|
122
|
+
<div class="relative flex flex-col" style="min-height: 200px">
|
|
123
|
+
<div
|
|
124
|
+
ref="threadContainer"
|
|
125
|
+
class="flex-1 space-y-1 overflow-y-auto p-4"
|
|
126
|
+
style="max-height: 500px"
|
|
127
|
+
@scroll="onScroll"
|
|
128
|
+
>
|
|
129
|
+
<!-- Empty state -->
|
|
130
|
+
<div
|
|
131
|
+
v-if="!messages.length"
|
|
132
|
+
:class="['py-12 text-center text-sm', escDark ? 'text-neutral-600' : 'text-gray-400']"
|
|
133
|
+
>
|
|
134
|
+
{{ t('chat.empty_state') }}
|
|
135
|
+
</div>
|
|
136
|
+
|
|
137
|
+
<template v-for="(message, index) in messages" :key="message.id || index">
|
|
138
|
+
<!-- Time separator -->
|
|
139
|
+
<div
|
|
140
|
+
v-if="shouldShowTimeSeparator(index)"
|
|
141
|
+
:class="['flex items-center gap-3 py-2', escDark ? 'text-neutral-600' : 'text-gray-400']"
|
|
142
|
+
>
|
|
143
|
+
<div :class="['flex-1 border-t', escDark ? 'border-neutral-800' : 'border-gray-200']"></div>
|
|
144
|
+
<span class="text-[10px] font-medium">
|
|
145
|
+
{{ formatTimeSeparator(message.created_at) }}
|
|
146
|
+
</span>
|
|
147
|
+
<div :class="['flex-1 border-t', escDark ? 'border-neutral-800' : 'border-gray-200']"></div>
|
|
148
|
+
</div>
|
|
149
|
+
|
|
150
|
+
<!-- Chat bubble -->
|
|
151
|
+
<ChatBubble
|
|
152
|
+
:message="message"
|
|
153
|
+
:is-agent="isAgentMessage(message)"
|
|
154
|
+
:show-avatar="shouldShowAvatar(index)"
|
|
155
|
+
:show-timestamp="shouldShowTimestamp(index)"
|
|
156
|
+
/>
|
|
157
|
+
</template>
|
|
158
|
+
|
|
159
|
+
<!-- Typing indicator -->
|
|
160
|
+
<div v-if="typingUser" class="flex items-center gap-2 pl-10 pt-1">
|
|
161
|
+
<div
|
|
162
|
+
:class="[
|
|
163
|
+
'flex items-center gap-1 rounded-2xl px-4 py-2',
|
|
164
|
+
escDark ? 'bg-neutral-800' : 'bg-gray-100',
|
|
165
|
+
]"
|
|
166
|
+
>
|
|
167
|
+
<div class="flex gap-1">
|
|
168
|
+
<span
|
|
169
|
+
v-for="i in 3"
|
|
170
|
+
:key="i"
|
|
171
|
+
:class="[
|
|
172
|
+
'inline-block h-1.5 w-1.5 rounded-full animate-bounce',
|
|
173
|
+
escDark ? 'bg-neutral-500' : 'bg-gray-400',
|
|
174
|
+
]"
|
|
175
|
+
:style="{ animationDelay: `${(i - 1) * 150}ms` }"
|
|
176
|
+
></span>
|
|
177
|
+
</div>
|
|
178
|
+
<span :class="['ml-2 text-xs', escDark ? 'text-neutral-500' : 'text-gray-500']">
|
|
179
|
+
{{ t('chat.typing', { name: typingUser }) }}
|
|
180
|
+
</span>
|
|
181
|
+
</div>
|
|
182
|
+
</div>
|
|
183
|
+
</div>
|
|
184
|
+
|
|
185
|
+
<!-- New messages pill -->
|
|
186
|
+
<button
|
|
187
|
+
v-if="hasNewMessages"
|
|
188
|
+
:class="[
|
|
189
|
+
'absolute bottom-4 left-1/2 -translate-x-1/2 rounded-full px-4 py-1.5 text-xs font-medium shadow-lg transition-all',
|
|
190
|
+
escDark ? 'bg-cyan-500 text-white hover:bg-cyan-400' : 'bg-blue-600 text-white hover:bg-blue-500',
|
|
191
|
+
]"
|
|
192
|
+
@click="scrollToBottom"
|
|
193
|
+
>
|
|
194
|
+
{{ t('chat.new_messages') }}
|
|
195
|
+
</button>
|
|
196
|
+
</div>
|
|
197
|
+
</template>
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import CollisionWarning from './CollisionWarning.vue';
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
title: 'Components/CollisionWarning',
|
|
5
|
-
component: CollisionWarning,
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export const SingleTyper = {
|
|
9
|
-
args: {
|
|
10
|
-
typers: [{ name: 'Alice Chen' }],
|
|
11
|
-
},
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export const TwoTypers = {
|
|
15
|
-
args: {
|
|
16
|
-
typers: [{ name: 'Alice Chen' }, { name: 'Bob Smith' }],
|
|
17
|
-
},
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export const ManyTypers = {
|
|
21
|
-
args: {
|
|
22
|
-
typers: [{ name: 'Alice Chen' }, { name: 'Bob Smith' }, { name: 'Carol Davis' }, { name: 'Dan Lee' }],
|
|
23
|
-
},
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export const NoTypers = {
|
|
27
|
-
args: {
|
|
28
|
-
typers: [],
|
|
29
|
-
},
|
|
30
|
-
};
|
|
1
|
+
import CollisionWarning from './CollisionWarning.vue';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: 'Components/CollisionWarning',
|
|
5
|
+
component: CollisionWarning,
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export const SingleTyper = {
|
|
9
|
+
args: {
|
|
10
|
+
typers: [{ name: 'Alice Chen' }],
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const TwoTypers = {
|
|
15
|
+
args: {
|
|
16
|
+
typers: [{ name: 'Alice Chen' }, { name: 'Bob Smith' }],
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const ManyTypers = {
|
|
21
|
+
args: {
|
|
22
|
+
typers: [{ name: 'Alice Chen' }, { name: 'Bob Smith' }, { name: 'Carol Davis' }, { name: 'Dan Lee' }],
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const NoTypers = {
|
|
27
|
+
args: {
|
|
28
|
+
typers: [],
|
|
29
|
+
},
|
|
30
|
+
};
|
|
@@ -1,68 +1,68 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import { inject, computed } from 'vue';
|
|
3
|
-
|
|
4
|
-
defineProps({
|
|
5
|
-
typers: { type: Array, default: () => [] },
|
|
6
|
-
});
|
|
7
|
-
|
|
8
|
-
const escDark = inject(
|
|
9
|
-
'esc-dark',
|
|
10
|
-
computed(() => false),
|
|
11
|
-
);
|
|
12
|
-
|
|
13
|
-
function typersText(typers) {
|
|
14
|
-
const names = typers.map((t) => t.name);
|
|
15
|
-
if (names.length === 1) return `${names[0]} is typing a reply...`;
|
|
16
|
-
if (names.length === 2) return `${names[0]} and ${names[1]} are typing replies...`;
|
|
17
|
-
return `${names[0]} and ${names.length - 1} others are typing replies...`;
|
|
18
|
-
}
|
|
19
|
-
</script>
|
|
20
|
-
|
|
21
|
-
<template>
|
|
22
|
-
<Transition
|
|
23
|
-
enter-active-class="transition duration-200 ease-out"
|
|
24
|
-
enter-from-class="opacity-0 -translate-y-2"
|
|
25
|
-
enter-to-class="opacity-100 translate-y-0"
|
|
26
|
-
leave-active-class="transition duration-150 ease-in"
|
|
27
|
-
leave-from-class="opacity-100 translate-y-0"
|
|
28
|
-
leave-to-class="opacity-0 -translate-y-2"
|
|
29
|
-
>
|
|
30
|
-
<div
|
|
31
|
-
v-if="typers.length > 0"
|
|
32
|
-
role="alert"
|
|
33
|
-
aria-live="assertive"
|
|
34
|
-
:class="[
|
|
35
|
-
'flex items-center gap-2 rounded-lg px-3 py-2 ring-1',
|
|
36
|
-
escDark ? 'bg-amber-500/10 ring-amber-500/20' : 'bg-amber-50 ring-amber-200',
|
|
37
|
-
]"
|
|
38
|
-
>
|
|
39
|
-
<!-- Pulsing indicator -->
|
|
40
|
-
<span class="relative flex h-2.5 w-2.5">
|
|
41
|
-
<span
|
|
42
|
-
class="absolute inline-flex h-full w-full animate-ping rounded-full bg-amber-400 opacity-75"
|
|
43
|
-
></span>
|
|
44
|
-
<span class="relative inline-flex h-2.5 w-2.5 rounded-full bg-amber-500"></span>
|
|
45
|
-
</span>
|
|
46
|
-
|
|
47
|
-
<!-- Avatars -->
|
|
48
|
-
<div class="flex -space-x-1.5">
|
|
49
|
-
<div
|
|
50
|
-
v-for="typer in typers.slice(0, 3)"
|
|
51
|
-
:key="typer.name"
|
|
52
|
-
:class="[
|
|
53
|
-
'flex h-6 w-6 items-center justify-center rounded-full text-[10px] font-semibold ring-1',
|
|
54
|
-
escDark
|
|
55
|
-
? 'bg-amber-500/30 text-amber-300 ring-amber-500/40'
|
|
56
|
-
: 'bg-amber-100 text-amber-700 ring-amber-300',
|
|
57
|
-
]"
|
|
58
|
-
>
|
|
59
|
-
{{ (typer.name || '?').charAt(0).toUpperCase() }}
|
|
60
|
-
</div>
|
|
61
|
-
</div>
|
|
62
|
-
|
|
63
|
-
<span :class="['text-xs font-medium', escDark ? 'text-amber-400' : 'text-amber-700']">
|
|
64
|
-
{{ typersText(typers) }}
|
|
65
|
-
</span>
|
|
66
|
-
</div>
|
|
67
|
-
</Transition>
|
|
68
|
-
</template>
|
|
1
|
+
<script setup>
|
|
2
|
+
import { inject, computed } from 'vue';
|
|
3
|
+
|
|
4
|
+
defineProps({
|
|
5
|
+
typers: { type: Array, default: () => [] },
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
const escDark = inject(
|
|
9
|
+
'esc-dark',
|
|
10
|
+
computed(() => false),
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
function typersText(typers) {
|
|
14
|
+
const names = typers.map((t) => t.name);
|
|
15
|
+
if (names.length === 1) return `${names[0]} is typing a reply...`;
|
|
16
|
+
if (names.length === 2) return `${names[0]} and ${names[1]} are typing replies...`;
|
|
17
|
+
return `${names[0]} and ${names.length - 1} others are typing replies...`;
|
|
18
|
+
}
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<template>
|
|
22
|
+
<Transition
|
|
23
|
+
enter-active-class="transition duration-200 ease-out"
|
|
24
|
+
enter-from-class="opacity-0 -translate-y-2"
|
|
25
|
+
enter-to-class="opacity-100 translate-y-0"
|
|
26
|
+
leave-active-class="transition duration-150 ease-in"
|
|
27
|
+
leave-from-class="opacity-100 translate-y-0"
|
|
28
|
+
leave-to-class="opacity-0 -translate-y-2"
|
|
29
|
+
>
|
|
30
|
+
<div
|
|
31
|
+
v-if="typers.length > 0"
|
|
32
|
+
role="alert"
|
|
33
|
+
aria-live="assertive"
|
|
34
|
+
:class="[
|
|
35
|
+
'flex items-center gap-2 rounded-lg px-3 py-2 ring-1',
|
|
36
|
+
escDark ? 'bg-amber-500/10 ring-amber-500/20' : 'bg-amber-50 ring-amber-200',
|
|
37
|
+
]"
|
|
38
|
+
>
|
|
39
|
+
<!-- Pulsing indicator -->
|
|
40
|
+
<span class="relative flex h-2.5 w-2.5">
|
|
41
|
+
<span
|
|
42
|
+
class="absolute inline-flex h-full w-full animate-ping rounded-full bg-amber-400 opacity-75"
|
|
43
|
+
></span>
|
|
44
|
+
<span class="relative inline-flex h-2.5 w-2.5 rounded-full bg-amber-500"></span>
|
|
45
|
+
</span>
|
|
46
|
+
|
|
47
|
+
<!-- Avatars -->
|
|
48
|
+
<div class="flex -space-x-1.5">
|
|
49
|
+
<div
|
|
50
|
+
v-for="typer in typers.slice(0, 3)"
|
|
51
|
+
:key="typer.name"
|
|
52
|
+
:class="[
|
|
53
|
+
'flex h-6 w-6 items-center justify-center rounded-full text-[10px] font-semibold ring-1',
|
|
54
|
+
escDark
|
|
55
|
+
? 'bg-amber-500/30 text-amber-300 ring-amber-500/40'
|
|
56
|
+
: 'bg-amber-100 text-amber-700 ring-amber-300',
|
|
57
|
+
]"
|
|
58
|
+
>
|
|
59
|
+
{{ (typer.name || '?').charAt(0).toUpperCase() }}
|
|
60
|
+
</div>
|
|
61
|
+
</div>
|
|
62
|
+
|
|
63
|
+
<span :class="['text-xs font-medium', escDark ? 'text-amber-400' : 'text-amber-700']">
|
|
64
|
+
{{ typersText(typers) }}
|
|
65
|
+
</span>
|
|
66
|
+
</div>
|
|
67
|
+
</Transition>
|
|
68
|
+
</template>
|
|
@@ -1,135 +1,135 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import { computed } from 'vue';
|
|
3
|
-
|
|
4
|
-
const props = defineProps({
|
|
5
|
-
availableFields: { type: Array, default: () => [] },
|
|
6
|
-
modelValue: { type: Array, default: () => [] },
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
const emit = defineEmits(['update:modelValue']);
|
|
10
|
-
|
|
11
|
-
const rules = computed({
|
|
12
|
-
get: () => props.modelValue,
|
|
13
|
-
set: (val) => emit('update:modelValue', val),
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
function addRule() {
|
|
17
|
-
const updated = [
|
|
18
|
-
...rules.value,
|
|
19
|
-
{
|
|
20
|
-
field: '',
|
|
21
|
-
operator: 'equals',
|
|
22
|
-
value: '',
|
|
23
|
-
target_field: '',
|
|
24
|
-
},
|
|
25
|
-
];
|
|
26
|
-
emit('update:modelValue', updated);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function removeRule(index) {
|
|
30
|
-
const updated = rules.value.filter((_, i) => i !== index);
|
|
31
|
-
emit('update:modelValue', updated);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function updateRule(index, key, value) {
|
|
35
|
-
const updated = rules.value.map((rule, i) => (i === index ? { ...rule, [key]: value } : rule));
|
|
36
|
-
emit('update:modelValue', updated);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function getFieldOptions(fieldName) {
|
|
40
|
-
const field = props.availableFields.find((f) => f.name === fieldName || f.slug === fieldName);
|
|
41
|
-
return field?.options || [];
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
const operatorOptions = [
|
|
45
|
-
{ value: 'equals', label: 'equals' },
|
|
46
|
-
{ value: 'not_equals', label: 'does not equal' },
|
|
47
|
-
{ value: 'contains', label: 'contains' },
|
|
48
|
-
{ value: 'is_empty', label: 'is empty' },
|
|
49
|
-
{ value: 'is_not_empty', label: 'is not empty' },
|
|
50
|
-
];
|
|
51
|
-
</script>
|
|
52
|
-
|
|
53
|
-
<template>
|
|
54
|
-
<div class="space-y-3">
|
|
55
|
-
<div
|
|
56
|
-
v-for="(rule, index) in rules"
|
|
57
|
-
:key="index"
|
|
58
|
-
class="flex flex-wrap items-center gap-2 rounded-lg border border-white/[0.06] bg-neutral-950 p-3"
|
|
59
|
-
>
|
|
60
|
-
<span class="text-xs font-medium text-neutral-500">When</span>
|
|
61
|
-
<select
|
|
62
|
-
:value="rule.field"
|
|
63
|
-
class="rounded-lg border border-white/10 bg-neutral-900 px-2 py-1.5 text-sm text-neutral-200 focus:border-white/20 focus:outline-none focus:ring-1 focus:ring-white/10"
|
|
64
|
-
@change="updateRule(index, 'field', $event.target.value)"
|
|
65
|
-
>
|
|
66
|
-
<option value="">Select field...</option>
|
|
67
|
-
<option v-for="f in availableFields" :key="f.name || f.slug" :value="f.name || f.slug">
|
|
68
|
-
{{ f.label || f.name }}
|
|
69
|
-
</option>
|
|
70
|
-
</select>
|
|
71
|
-
|
|
72
|
-
<select
|
|
73
|
-
:value="rule.operator"
|
|
74
|
-
class="rounded-lg border border-white/10 bg-neutral-900 px-2 py-1.5 text-sm text-neutral-200 focus:border-white/20 focus:outline-none focus:ring-1 focus:ring-white/10"
|
|
75
|
-
@change="updateRule(index, 'operator', $event.target.value)"
|
|
76
|
-
>
|
|
77
|
-
<option v-for="op in operatorOptions" :key="op.value" :value="op.value">
|
|
78
|
-
{{ op.label }}
|
|
79
|
-
</option>
|
|
80
|
-
</select>
|
|
81
|
-
|
|
82
|
-
<template v-if="rule.operator !== 'is_empty' && rule.operator !== 'is_not_empty'">
|
|
83
|
-
<select
|
|
84
|
-
v-if="getFieldOptions(rule.field).length"
|
|
85
|
-
:value="rule.value"
|
|
86
|
-
class="rounded-lg border border-white/10 bg-neutral-900 px-2 py-1.5 text-sm text-neutral-200 focus:border-white/20 focus:outline-none focus:ring-1 focus:ring-white/10"
|
|
87
|
-
@change="updateRule(index, 'value', $event.target.value)"
|
|
88
|
-
>
|
|
89
|
-
<option value="">Select value...</option>
|
|
90
|
-
<option v-for="opt in getFieldOptions(rule.field)" :key="opt" :value="opt">
|
|
91
|
-
{{ opt }}
|
|
92
|
-
</option>
|
|
93
|
-
</select>
|
|
94
|
-
<input
|
|
95
|
-
v-else
|
|
96
|
-
:value="rule.value"
|
|
97
|
-
type="text"
|
|
98
|
-
placeholder="Value"
|
|
99
|
-
class="w-32 rounded-lg border border-white/10 bg-neutral-900 px-2 py-1.5 text-sm text-neutral-200 placeholder-neutral-600 focus:border-white/20 focus:outline-none focus:ring-1 focus:ring-white/10"
|
|
100
|
-
@input="updateRule(index, 'value', $event.target.value)"
|
|
101
|
-
/>
|
|
102
|
-
</template>
|
|
103
|
-
|
|
104
|
-
<span class="text-xs font-medium text-neutral-500">show</span>
|
|
105
|
-
<select
|
|
106
|
-
:value="rule.target_field"
|
|
107
|
-
class="rounded-lg border border-white/10 bg-neutral-900 px-2 py-1.5 text-sm text-neutral-200 focus:border-white/20 focus:outline-none focus:ring-1 focus:ring-white/10"
|
|
108
|
-
@change="updateRule(index, 'target_field', $event.target.value)"
|
|
109
|
-
>
|
|
110
|
-
<option value="">Select target field...</option>
|
|
111
|
-
<option v-for="f in availableFields" :key="f.name || f.slug" :value="f.name || f.slug">
|
|
112
|
-
{{ f.label || f.name }}
|
|
113
|
-
</option>
|
|
114
|
-
</select>
|
|
115
|
-
|
|
116
|
-
<button
|
|
117
|
-
type="button"
|
|
118
|
-
class="ml-auto rounded p-1 text-neutral-500 hover:bg-red-500/10 hover:text-red-400"
|
|
119
|
-
@click="removeRule(index)"
|
|
120
|
-
>
|
|
121
|
-
<svg class="h-4 w-4" fill="none" stroke="currentColor" stroke-width="1.5" viewBox="0 0 24 24">
|
|
122
|
-
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" />
|
|
123
|
-
</svg>
|
|
124
|
-
</button>
|
|
125
|
-
</div>
|
|
126
|
-
|
|
127
|
-
<button
|
|
128
|
-
type="button"
|
|
129
|
-
class="rounded-lg border border-dashed border-white/10 px-4 py-2 text-sm text-neutral-500 hover:border-white/20 hover:text-neutral-300"
|
|
130
|
-
@click="addRule"
|
|
131
|
-
>
|
|
132
|
-
+ Add Condition
|
|
133
|
-
</button>
|
|
134
|
-
</div>
|
|
135
|
-
</template>
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed } from 'vue';
|
|
3
|
+
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
availableFields: { type: Array, default: () => [] },
|
|
6
|
+
modelValue: { type: Array, default: () => [] },
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
const emit = defineEmits(['update:modelValue']);
|
|
10
|
+
|
|
11
|
+
const rules = computed({
|
|
12
|
+
get: () => props.modelValue,
|
|
13
|
+
set: (val) => emit('update:modelValue', val),
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
function addRule() {
|
|
17
|
+
const updated = [
|
|
18
|
+
...rules.value,
|
|
19
|
+
{
|
|
20
|
+
field: '',
|
|
21
|
+
operator: 'equals',
|
|
22
|
+
value: '',
|
|
23
|
+
target_field: '',
|
|
24
|
+
},
|
|
25
|
+
];
|
|
26
|
+
emit('update:modelValue', updated);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function removeRule(index) {
|
|
30
|
+
const updated = rules.value.filter((_, i) => i !== index);
|
|
31
|
+
emit('update:modelValue', updated);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function updateRule(index, key, value) {
|
|
35
|
+
const updated = rules.value.map((rule, i) => (i === index ? { ...rule, [key]: value } : rule));
|
|
36
|
+
emit('update:modelValue', updated);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function getFieldOptions(fieldName) {
|
|
40
|
+
const field = props.availableFields.find((f) => f.name === fieldName || f.slug === fieldName);
|
|
41
|
+
return field?.options || [];
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const operatorOptions = [
|
|
45
|
+
{ value: 'equals', label: 'equals' },
|
|
46
|
+
{ value: 'not_equals', label: 'does not equal' },
|
|
47
|
+
{ value: 'contains', label: 'contains' },
|
|
48
|
+
{ value: 'is_empty', label: 'is empty' },
|
|
49
|
+
{ value: 'is_not_empty', label: 'is not empty' },
|
|
50
|
+
];
|
|
51
|
+
</script>
|
|
52
|
+
|
|
53
|
+
<template>
|
|
54
|
+
<div class="space-y-3">
|
|
55
|
+
<div
|
|
56
|
+
v-for="(rule, index) in rules"
|
|
57
|
+
:key="index"
|
|
58
|
+
class="flex flex-wrap items-center gap-2 rounded-lg border border-white/[0.06] bg-neutral-950 p-3"
|
|
59
|
+
>
|
|
60
|
+
<span class="text-xs font-medium text-neutral-500">When</span>
|
|
61
|
+
<select
|
|
62
|
+
:value="rule.field"
|
|
63
|
+
class="rounded-lg border border-white/10 bg-neutral-900 px-2 py-1.5 text-sm text-neutral-200 focus:border-white/20 focus:outline-none focus:ring-1 focus:ring-white/10"
|
|
64
|
+
@change="updateRule(index, 'field', $event.target.value)"
|
|
65
|
+
>
|
|
66
|
+
<option value="">Select field...</option>
|
|
67
|
+
<option v-for="f in availableFields" :key="f.name || f.slug" :value="f.name || f.slug">
|
|
68
|
+
{{ f.label || f.name }}
|
|
69
|
+
</option>
|
|
70
|
+
</select>
|
|
71
|
+
|
|
72
|
+
<select
|
|
73
|
+
:value="rule.operator"
|
|
74
|
+
class="rounded-lg border border-white/10 bg-neutral-900 px-2 py-1.5 text-sm text-neutral-200 focus:border-white/20 focus:outline-none focus:ring-1 focus:ring-white/10"
|
|
75
|
+
@change="updateRule(index, 'operator', $event.target.value)"
|
|
76
|
+
>
|
|
77
|
+
<option v-for="op in operatorOptions" :key="op.value" :value="op.value">
|
|
78
|
+
{{ op.label }}
|
|
79
|
+
</option>
|
|
80
|
+
</select>
|
|
81
|
+
|
|
82
|
+
<template v-if="rule.operator !== 'is_empty' && rule.operator !== 'is_not_empty'">
|
|
83
|
+
<select
|
|
84
|
+
v-if="getFieldOptions(rule.field).length"
|
|
85
|
+
:value="rule.value"
|
|
86
|
+
class="rounded-lg border border-white/10 bg-neutral-900 px-2 py-1.5 text-sm text-neutral-200 focus:border-white/20 focus:outline-none focus:ring-1 focus:ring-white/10"
|
|
87
|
+
@change="updateRule(index, 'value', $event.target.value)"
|
|
88
|
+
>
|
|
89
|
+
<option value="">Select value...</option>
|
|
90
|
+
<option v-for="opt in getFieldOptions(rule.field)" :key="opt" :value="opt">
|
|
91
|
+
{{ opt }}
|
|
92
|
+
</option>
|
|
93
|
+
</select>
|
|
94
|
+
<input
|
|
95
|
+
v-else
|
|
96
|
+
:value="rule.value"
|
|
97
|
+
type="text"
|
|
98
|
+
placeholder="Value"
|
|
99
|
+
class="w-32 rounded-lg border border-white/10 bg-neutral-900 px-2 py-1.5 text-sm text-neutral-200 placeholder-neutral-600 focus:border-white/20 focus:outline-none focus:ring-1 focus:ring-white/10"
|
|
100
|
+
@input="updateRule(index, 'value', $event.target.value)"
|
|
101
|
+
/>
|
|
102
|
+
</template>
|
|
103
|
+
|
|
104
|
+
<span class="text-xs font-medium text-neutral-500">show</span>
|
|
105
|
+
<select
|
|
106
|
+
:value="rule.target_field"
|
|
107
|
+
class="rounded-lg border border-white/10 bg-neutral-900 px-2 py-1.5 text-sm text-neutral-200 focus:border-white/20 focus:outline-none focus:ring-1 focus:ring-white/10"
|
|
108
|
+
@change="updateRule(index, 'target_field', $event.target.value)"
|
|
109
|
+
>
|
|
110
|
+
<option value="">Select target field...</option>
|
|
111
|
+
<option v-for="f in availableFields" :key="f.name || f.slug" :value="f.name || f.slug">
|
|
112
|
+
{{ f.label || f.name }}
|
|
113
|
+
</option>
|
|
114
|
+
</select>
|
|
115
|
+
|
|
116
|
+
<button
|
|
117
|
+
type="button"
|
|
118
|
+
class="ml-auto rounded p-1 text-neutral-500 hover:bg-red-500/10 hover:text-red-400"
|
|
119
|
+
@click="removeRule(index)"
|
|
120
|
+
>
|
|
121
|
+
<svg class="h-4 w-4" fill="none" stroke="currentColor" stroke-width="1.5" viewBox="0 0 24 24">
|
|
122
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" />
|
|
123
|
+
</svg>
|
|
124
|
+
</button>
|
|
125
|
+
</div>
|
|
126
|
+
|
|
127
|
+
<button
|
|
128
|
+
type="button"
|
|
129
|
+
class="rounded-lg border border-dashed border-white/10 px-4 py-2 text-sm text-neutral-500 hover:border-white/20 hover:text-neutral-300"
|
|
130
|
+
@click="addRule"
|
|
131
|
+
>
|
|
132
|
+
+ Add Condition
|
|
133
|
+
</button>
|
|
134
|
+
</div>
|
|
135
|
+
</template>
|