@vunex/support-chat 1.0.6 → 1.0.8
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/dist/App.vue.d.ts +2 -0
- package/dist/components/ChatMessage.vue.d.ts +2 -0
- package/dist/dev.d.ts +0 -0
- package/dist/gig-support-chat.es.js +610 -259
- package/dist/gig-support-chat.umd.js +1 -1
- package/dist/store/supportChat.d.ts +65 -0
- package/dist/support-chat.css +1 -1
- package/package.json +4 -4
|
@@ -1,241 +1,434 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
import { defineStore as
|
|
3
|
-
import { io as
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
},
|
|
8
|
-
var
|
|
9
|
-
(
|
|
10
|
-
path:
|
|
1
|
+
import { ref as w, defineComponent as q, computed as j, openBlock as c, createElementBlock as v, normalizeClass as L, createElementVNode as e, toDisplayString as T, createTextVNode as re, createCommentVNode as I, Fragment as N, onMounted as ie, onUnmounted as ne, normalizeStyle as ue, createStaticVNode as ge, withModifiers as D, renderList as se, createBlock as oe, unref as y, createVNode as _, Transition as G, withCtx as A, withDirectives as de, withKeys as ce, vModelText as ve, nextTick as me } from "vue";
|
|
2
|
+
import { defineStore as he } from "pinia";
|
|
3
|
+
import { io as pe } from "socket.io-client";
|
|
4
|
+
const J = he("gigSupportChat", () => {
|
|
5
|
+
const n = w(null), k = w([]), l = w(!1), C = w(!1), r = w(0), m = w(""), U = w([]), b = w(!1), a = w(null), p = w(null), z = (g) => {
|
|
6
|
+
p.value = g;
|
|
7
|
+
}, $ = () => {
|
|
8
|
+
var g;
|
|
9
|
+
(g = n.value) != null && g.connected || !p.value || (n.value = pe(p.value.apiUrl, {
|
|
10
|
+
path: p.value.path || "/ws",
|
|
11
11
|
transports: ["websocket", "polling"],
|
|
12
12
|
auth: {
|
|
13
|
-
apiKey:
|
|
14
|
-
uuid:
|
|
15
|
-
metaUser:
|
|
13
|
+
apiKey: p.value.apiKey,
|
|
14
|
+
uuid: p.value.uuid,
|
|
15
|
+
metaUser: p.value.metaUser
|
|
16
16
|
}
|
|
17
|
-
}),
|
|
18
|
-
console.log("[GigSupportChat] Connected"),
|
|
19
|
-
}),
|
|
20
|
-
console.log("[GigSupportChat] Registered as:",
|
|
21
|
-
}),
|
|
22
|
-
console.log("[GigSupportChat] Disconnected"),
|
|
23
|
-
}),
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
17
|
+
}), n.value.on("connect", () => {
|
|
18
|
+
console.log("[GigSupportChat] Connected"), l.value = !0;
|
|
19
|
+
}), n.value.on("connected", (o) => {
|
|
20
|
+
console.log("[GigSupportChat] Registered as:", o.userId), m.value = o.userId, R();
|
|
21
|
+
}), n.value.on("disconnect", () => {
|
|
22
|
+
console.log("[GigSupportChat] Disconnected"), l.value = !1;
|
|
23
|
+
}), n.value.on("new_message", (o) => {
|
|
24
|
+
var d;
|
|
25
|
+
o.status === "SUCCESS" && (k.value.find((M) => M.id === o.message.id) || (k.value.push(o.message), C.value ? o.message.userId !== m.value && ((d = n.value) == null || d.emit("mark_read", { messageIds: [o.message.id] }), o.message.isRead = !0) : o.message.userId !== m.value && r.value++));
|
|
26
|
+
}), n.value.on("message_sent", (o) => {
|
|
27
|
+
o.status === "SUCCESS" && (k.value.find((d) => d.id === o.message.id) || k.value.push(o.message));
|
|
28
|
+
}), n.value.on("history", (o) => {
|
|
29
|
+
if (o.status === "SUCCESS" && (k.value = o.messages, !C.value)) {
|
|
30
|
+
const d = k.value.filter((M) => !M.isRead && M.userId !== m.value);
|
|
31
|
+
r.value = d.length;
|
|
32
|
+
}
|
|
33
|
+
}), n.value.on("error", (o) => {
|
|
34
|
+
console.error("[GigSupportChat] Socket error:", o);
|
|
31
35
|
}));
|
|
32
|
-
},
|
|
33
|
-
|
|
34
|
-
},
|
|
35
|
-
var
|
|
36
|
-
!
|
|
37
|
-
userId:
|
|
38
|
-
text:
|
|
39
|
-
replyToMessageId: (
|
|
40
|
-
metaUser: (
|
|
41
|
-
}),
|
|
42
|
-
},
|
|
43
|
-
!
|
|
44
|
-
userId:
|
|
36
|
+
}, S = () => {
|
|
37
|
+
n.value && (n.value.disconnect(), n.value = null), l.value = !1, k.value = [], r.value = 0, m.value = "";
|
|
38
|
+
}, H = (g) => {
|
|
39
|
+
var o, d;
|
|
40
|
+
!n.value || !l.value || (n.value.emit("send_message", {
|
|
41
|
+
userId: m.value,
|
|
42
|
+
text: g,
|
|
43
|
+
replyToMessageId: (o = a.value) == null ? void 0 : o.id,
|
|
44
|
+
metaUser: (d = p.value) == null ? void 0 : d.metaUser
|
|
45
|
+
}), a.value = null);
|
|
46
|
+
}, R = () => {
|
|
47
|
+
!n.value || !m.value || n.value.emit("get_history", {
|
|
48
|
+
userId: m.value,
|
|
45
49
|
limit: 50,
|
|
46
50
|
offset: 0
|
|
47
51
|
});
|
|
48
52
|
};
|
|
49
53
|
return {
|
|
50
|
-
messages:
|
|
51
|
-
isConnected:
|
|
52
|
-
isWidgetOpen:
|
|
53
|
-
unreadCount:
|
|
54
|
-
currentUserId:
|
|
55
|
-
stickers:
|
|
56
|
-
isLoadingStickers:
|
|
57
|
-
replyingToMessage:
|
|
58
|
-
init:
|
|
59
|
-
connect:
|
|
60
|
-
disconnect:
|
|
61
|
-
sendMessage:
|
|
62
|
-
sendSticker: (
|
|
63
|
-
var
|
|
64
|
-
!
|
|
65
|
-
userId:
|
|
66
|
-
stickerId:
|
|
54
|
+
messages: k,
|
|
55
|
+
isConnected: l,
|
|
56
|
+
isWidgetOpen: C,
|
|
57
|
+
unreadCount: r,
|
|
58
|
+
currentUserId: m,
|
|
59
|
+
stickers: U,
|
|
60
|
+
isLoadingStickers: b,
|
|
61
|
+
replyingToMessage: a,
|
|
62
|
+
init: z,
|
|
63
|
+
connect: $,
|
|
64
|
+
disconnect: S,
|
|
65
|
+
sendMessage: H,
|
|
66
|
+
sendSticker: (g) => {
|
|
67
|
+
var o, d;
|
|
68
|
+
!n.value || !l.value || (n.value.emit("send_message", {
|
|
69
|
+
userId: m.value,
|
|
70
|
+
stickerId: g,
|
|
67
71
|
messageType: "sticker",
|
|
68
|
-
replyToMessageId: (
|
|
69
|
-
metaUser: (
|
|
70
|
-
}),
|
|
72
|
+
replyToMessageId: (o = a.value) == null ? void 0 : o.id,
|
|
73
|
+
metaUser: (d = p.value) == null ? void 0 : d.metaUser
|
|
74
|
+
}), a.value = null);
|
|
71
75
|
},
|
|
72
76
|
fetchStickers: async () => {
|
|
73
|
-
var
|
|
74
|
-
if ((
|
|
75
|
-
|
|
77
|
+
var g;
|
|
78
|
+
if ((g = p.value) != null && g.apiUrl) {
|
|
79
|
+
b.value = !0;
|
|
76
80
|
try {
|
|
77
|
-
const
|
|
81
|
+
const d = await (await fetch(`${p.value.apiUrl}/api/v1.0/stickers?activeOnly=true`, {
|
|
78
82
|
headers: {
|
|
79
|
-
"x-api-key":
|
|
83
|
+
"x-api-key": p.value.apiKey || ""
|
|
80
84
|
}
|
|
81
85
|
})).json();
|
|
82
|
-
|
|
83
|
-
} catch (
|
|
84
|
-
console.error("[GigSupportChat] Error fetching stickers:",
|
|
86
|
+
d.status === "SUCCESS" && (U.value = d.content);
|
|
87
|
+
} catch (o) {
|
|
88
|
+
console.error("[GigSupportChat] Error fetching stickers:", o);
|
|
85
89
|
} finally {
|
|
86
|
-
|
|
90
|
+
b.value = !1;
|
|
87
91
|
}
|
|
88
92
|
}
|
|
89
93
|
},
|
|
90
94
|
toggleWidget: () => {
|
|
91
|
-
|
|
95
|
+
if (C.value = !C.value, C.value) {
|
|
96
|
+
r.value = 0;
|
|
97
|
+
const g = k.value.filter((o) => !o.isRead && o.userId !== m.value);
|
|
98
|
+
if (g.length > 0 && n.value) {
|
|
99
|
+
const o = g.map((d) => d.id);
|
|
100
|
+
n.value.emit("mark_read", { messageIds: o }), k.value.forEach((d) => {
|
|
101
|
+
o.includes(d.id) && (d.isRead = !0);
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
}
|
|
92
105
|
},
|
|
93
|
-
loadHistory:
|
|
94
|
-
startReply: (
|
|
95
|
-
|
|
106
|
+
loadHistory: R,
|
|
107
|
+
startReply: (g) => {
|
|
108
|
+
a.value = g;
|
|
96
109
|
},
|
|
97
110
|
cancelReply: () => {
|
|
98
|
-
|
|
111
|
+
a.value = null;
|
|
99
112
|
}
|
|
100
113
|
};
|
|
101
|
-
}),
|
|
114
|
+
}), fe = ["data-message-id"], ye = { class: "gig-message-group" }, we = {
|
|
102
115
|
key: 0,
|
|
103
116
|
class: "gig-message-author"
|
|
104
|
-
},
|
|
117
|
+
}, ke = { class: "gig-author-avatar" }, xe = { style: { "font-size": "10px", "font-weight": "700", opacity: "0.7", "margin-bottom": "2px" } }, Ce = { style: { "font-size": "11px", opacity: "0.8", "white-space": "nowrap", overflow: "hidden", "text-overflow": "ellipsis", "max-width": "200px" } }, be = ["src", "alt"], Me = ["src", "alt"], $e = {
|
|
118
|
+
key: 1,
|
|
119
|
+
class: "gig-message-attachment-file"
|
|
120
|
+
}, Se = { class: "gig-file-info" }, Te = ["title"], Ie = { class: "gig-file-size" }, Ue = ["innerHTML"], ze = ["innerHTML"], Be = { class: "gig-message-meta-out" }, Re = {
|
|
121
|
+
key: 0,
|
|
122
|
+
viewBox: "0 0 24 24",
|
|
123
|
+
width: "14",
|
|
124
|
+
height: "14",
|
|
125
|
+
fill: "none",
|
|
126
|
+
stroke: "currentColor",
|
|
127
|
+
"stroke-width": "2"
|
|
128
|
+
}, He = {
|
|
129
|
+
key: 1,
|
|
130
|
+
viewBox: "0 0 24 24",
|
|
131
|
+
width: "14",
|
|
132
|
+
height: "14",
|
|
133
|
+
fill: "none",
|
|
134
|
+
stroke: "currentColor",
|
|
135
|
+
"stroke-width": "2"
|
|
136
|
+
}, We = /* @__PURE__ */ q({
|
|
105
137
|
__name: "ChatMessage",
|
|
106
138
|
props: {
|
|
107
139
|
message: {},
|
|
108
140
|
currentUserId: {}
|
|
109
141
|
},
|
|
110
|
-
emits: ["reply", "scroll-to"],
|
|
111
|
-
setup(
|
|
112
|
-
const
|
|
113
|
-
const
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
return
|
|
142
|
+
emits: ["reply", "scroll-to", "open-image"],
|
|
143
|
+
setup(n, { emit: k }) {
|
|
144
|
+
const l = n, C = J(), r = j(() => l.message.userId === l.currentUserId), m = (i) => C.messages.find((t) => t.id === i), U = (i) => i.userId === l.currentUserId ? "Вы" : R(i.userName || "Support"), b = (i) => i.messageType === "sticker" ? "[Стикер]" : i.attachmentName || i.attachmentBase64 || i.attachmentUrl || i.attachment ? "[Вложение]" : i.text || "", a = j(() => {
|
|
145
|
+
const i = l.message, t = i.attachment || i.Attachment || {}, f = l.message.attachmentName || t.name || t.attachmentName || t.attachment_name || "Вложение", g = l.message.attachmentMimeType || t.mimeType || t.mime_type || "application/octet-stream", o = l.message.attachmentSize || t.size || t.attachmentSize || t.attachment_size || 0, d = l.message.attachmentBase64 || t.base64 || t.attachmentBase64 || t.attachment_base64 || null, M = l.message.attachmentUrl || t.url || t.attachmentUrl || t.attachment_url || null;
|
|
146
|
+
if (f !== "Вложение" || o > 0 || d || M) {
|
|
147
|
+
let E = M;
|
|
148
|
+
return d && (E = `data:${g};base64,${d}`), { name: f, mimeType: g, size: Number(o), base64: d, url: M, previewUrl: E };
|
|
149
|
+
}
|
|
150
|
+
return null;
|
|
151
|
+
}), p = j(() => {
|
|
152
|
+
var i;
|
|
153
|
+
return ((i = a.value) == null ? void 0 : i.mimeType.startsWith("image/")) || !1;
|
|
154
|
+
}), z = () => {
|
|
155
|
+
if (!a.value) return;
|
|
156
|
+
const i = a.value, t = document.createElement("a");
|
|
157
|
+
if (t.download = i.name, i.previewUrl)
|
|
158
|
+
t.href = i.previewUrl;
|
|
159
|
+
else if (i.url)
|
|
160
|
+
t.href = i.url, t.target = "_blank", t.rel = "noopener";
|
|
161
|
+
else
|
|
162
|
+
return;
|
|
163
|
+
document.body.appendChild(t), t.click(), document.body.removeChild(t);
|
|
164
|
+
}, $ = (i) => {
|
|
165
|
+
if (i === 0) return "0 B";
|
|
166
|
+
const t = 1024, f = ["B", "KB", "MB", "GB"], g = Math.floor(Math.log(i) / Math.log(t));
|
|
167
|
+
return parseFloat((i / Math.pow(t, g)).toFixed(1)) + " " + f[g];
|
|
168
|
+
}, S = (i, t = 22) => {
|
|
169
|
+
if (!i || i.length <= t) return i;
|
|
170
|
+
const f = i.lastIndexOf(".");
|
|
171
|
+
if (f <= 0) return i.substring(0, t - 3) + "...";
|
|
172
|
+
const g = i.substring(f), o = i.substring(0, f);
|
|
173
|
+
return o.length + g.length <= t ? i : o.substring(0, t - g.length - 3) + "..." + g;
|
|
174
|
+
}, H = (i) => i ? new Date(i).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }) : "", R = (i) => {
|
|
175
|
+
if (!i) return "Support";
|
|
176
|
+
const t = i.trim().split(/\s+/);
|
|
177
|
+
return t.length >= 2 ? `${t[0]} ${t[1][0]}.` : i;
|
|
178
|
+
}, V = (i) => {
|
|
179
|
+
if (i.toLowerCase() === "support") return "GP";
|
|
180
|
+
const t = i.trim().split(/\s+/);
|
|
181
|
+
return t.length >= 2 ? `${t[0][0]}${t[1][0]}`.toUpperCase() : t.length === 1 && t[0].length >= 2 ? t[0].substring(0, 2).toUpperCase() : t[0] ? t[0][0].toUpperCase() : "GP";
|
|
182
|
+
}, W = (i) => {
|
|
183
|
+
if (!i) return "";
|
|
184
|
+
const t = i.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"), f = /(https?:\/\/[^\s]+)/g;
|
|
185
|
+
return t.replace(f, (g) => `<a href="${g}" target="_blank" style="color: inherit; text-decoration: underline;">${g}</a>`);
|
|
119
186
|
};
|
|
120
|
-
return (
|
|
121
|
-
class: L(["gig-message-row",
|
|
122
|
-
"data-message-id":
|
|
187
|
+
return (i, t) => (c(), v("div", {
|
|
188
|
+
class: L(["gig-message-row", r.value ? "sent" : "received"]),
|
|
189
|
+
"data-message-id": n.message.id
|
|
123
190
|
}, [
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
191
|
+
e("div", ye, [
|
|
192
|
+
e("div", {
|
|
193
|
+
class: L(["gig-message-bubble", { "is-sticker": n.message.messageType === "sticker" }])
|
|
194
|
+
}, [
|
|
195
|
+
r.value ? I("", !0) : (c(), v("div", we, [
|
|
196
|
+
e("div", ke, T(V(n.message.userName || "Support")), 1),
|
|
197
|
+
re(" " + T(R(n.message.userName || "Support")), 1)
|
|
198
|
+
])),
|
|
199
|
+
n.message.replyToMessageId && m(n.message.replyToMessageId) ? (c(), v("div", {
|
|
200
|
+
key: 1,
|
|
201
|
+
class: "gig-message-reply-preview",
|
|
202
|
+
onClick: t[0] || (t[0] = (f) => i.$emit("scroll-to", n.message.replyToMessageId))
|
|
203
|
+
}, [
|
|
204
|
+
e("div", xe, T(U(m(n.message.replyToMessageId))), 1),
|
|
205
|
+
e("div", Ce, T(b(m(n.message.replyToMessageId))), 1)
|
|
206
|
+
])) : I("", !0),
|
|
207
|
+
n.message.messageType === "sticker" && n.message.sticker ? (c(), v("img", {
|
|
208
|
+
key: 2,
|
|
209
|
+
src: `data:${n.message.sticker.mimeType || "image/png"};base64,${n.message.sticker.base64}`,
|
|
210
|
+
class: "gig-sticker-img",
|
|
211
|
+
alt: n.message.sticker.name
|
|
212
|
+
}, null, 8, be)) : a.value ? (c(), v(N, { key: 3 }, [
|
|
213
|
+
p.value ? (c(), v("div", {
|
|
214
|
+
key: 0,
|
|
215
|
+
class: "gig-message-attachment-image",
|
|
216
|
+
onClick: t[1] || (t[1] = (f) => i.$emit("open-image", a.value.previewUrl))
|
|
217
|
+
}, [
|
|
218
|
+
e("img", {
|
|
219
|
+
src: a.value.previewUrl,
|
|
220
|
+
alt: a.value.name
|
|
221
|
+
}, null, 8, Me)
|
|
222
|
+
])) : (c(), v("div", $e, [
|
|
223
|
+
t[4] || (t[4] = e("div", { class: "gig-file-icon" }, [
|
|
224
|
+
e("svg", {
|
|
225
|
+
viewBox: "0 0 24 24",
|
|
226
|
+
width: "24",
|
|
227
|
+
height: "24",
|
|
228
|
+
fill: "none",
|
|
229
|
+
stroke: "currentColor",
|
|
230
|
+
"stroke-width": "2"
|
|
231
|
+
}, [
|
|
232
|
+
e("path", { d: "M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z" }),
|
|
233
|
+
e("polyline", { points: "13 2 13 9 20 9" })
|
|
234
|
+
])
|
|
235
|
+
], -1)),
|
|
236
|
+
e("div", Se, [
|
|
237
|
+
e("div", {
|
|
238
|
+
class: "gig-file-name",
|
|
239
|
+
title: a.value.name
|
|
240
|
+
}, T(S(a.value.name)), 9, Te),
|
|
241
|
+
e("div", Ie, T($(a.value.size)), 1)
|
|
242
|
+
]),
|
|
243
|
+
e("button", {
|
|
244
|
+
class: "gig-btn-icon gig-file-download",
|
|
245
|
+
onClick: z
|
|
246
|
+
}, [...t[3] || (t[3] = [
|
|
247
|
+
e("svg", {
|
|
248
|
+
viewBox: "0 0 24 24",
|
|
249
|
+
width: "20",
|
|
250
|
+
height: "20",
|
|
251
|
+
fill: "none",
|
|
252
|
+
stroke: "currentColor",
|
|
253
|
+
"stroke-width": "2"
|
|
254
|
+
}, [
|
|
255
|
+
e("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
|
|
256
|
+
e("polyline", { points: "7 10 12 15 17 10" }),
|
|
257
|
+
e("line", {
|
|
258
|
+
x1: "12",
|
|
259
|
+
y1: "15",
|
|
260
|
+
x2: "12",
|
|
261
|
+
y2: "3"
|
|
262
|
+
})
|
|
263
|
+
], -1)
|
|
264
|
+
])])
|
|
265
|
+
])),
|
|
266
|
+
n.message.text ? (c(), v("div", {
|
|
267
|
+
key: 2,
|
|
268
|
+
innerHTML: W(n.message.text),
|
|
269
|
+
style: { "margin-top": "8px" }
|
|
270
|
+
}, null, 8, Ue)) : I("", !0)
|
|
271
|
+
], 64)) : (c(), v("div", {
|
|
272
|
+
key: 4,
|
|
273
|
+
innerHTML: W(n.message.text || "")
|
|
274
|
+
}, null, 8, ze)),
|
|
275
|
+
e("button", {
|
|
276
|
+
class: L(["gig-message-reply-btn", r.value ? "left-side" : "right-side"]),
|
|
277
|
+
onClick: t[2] || (t[2] = (f) => i.$emit("reply", n.message))
|
|
278
|
+
}, [...t[5] || (t[5] = [
|
|
279
|
+
e("svg", {
|
|
280
|
+
viewBox: "0 0 24 24",
|
|
281
|
+
width: "14",
|
|
282
|
+
height: "14",
|
|
283
|
+
fill: "none",
|
|
284
|
+
stroke: "currentColor",
|
|
285
|
+
"stroke-width": "2.5"
|
|
286
|
+
}, [
|
|
287
|
+
e("polyline", { points: "9 17 4 12 9 7" }),
|
|
288
|
+
e("path", { d: "M20 18v-2a4 4 0 0 0-4-4H4" })
|
|
289
|
+
], -1)
|
|
290
|
+
])], 2)
|
|
291
|
+
], 2),
|
|
292
|
+
e("div", Be, [
|
|
293
|
+
e("span", null, T(H(n.message.createdAt)), 1),
|
|
294
|
+
r.value ? (c(), v(N, { key: 0 }, [
|
|
295
|
+
n.message.isRead ? (c(), v("svg", Re, [...t[6] || (t[6] = [
|
|
296
|
+
e("polyline", { points: "18 6 11 15 7 11" }, null, -1),
|
|
297
|
+
e("polyline", { points: "22 6 15 15 13 13" }, null, -1)
|
|
298
|
+
])])) : (c(), v("svg", He, [...t[7] || (t[7] = [
|
|
299
|
+
e("polyline", { points: "20 6 9 17 4 12" }, null, -1)
|
|
300
|
+
])]))
|
|
301
|
+
], 64)) : I("", !0)
|
|
302
|
+
])
|
|
303
|
+
])
|
|
304
|
+
], 10, fe));
|
|
148
305
|
}
|
|
149
|
-
}),
|
|
150
|
-
const
|
|
151
|
-
for (const [
|
|
152
|
-
|
|
153
|
-
return
|
|
154
|
-
},
|
|
306
|
+
}), Ee = (n, k) => {
|
|
307
|
+
const l = n.__vccOpts || n;
|
|
308
|
+
for (const [C, r] of k)
|
|
309
|
+
l[C] = r;
|
|
310
|
+
return l;
|
|
311
|
+
}, Le = /* @__PURE__ */ Ee(We, [["__scopeId", "data-v-85f97065"]]), _e = {
|
|
155
312
|
key: 0,
|
|
156
313
|
style: { "text-align": "center", color: "#94a3b8", "padding-top": "40px" }
|
|
157
|
-
},
|
|
314
|
+
}, Ge = {
|
|
315
|
+
key: 0,
|
|
316
|
+
class: "gig-sticker-picker"
|
|
317
|
+
}, Ae = { class: "gig-sticker-header" }, Ve = { class: "gig-sticker-body" }, De = {
|
|
318
|
+
key: 0,
|
|
319
|
+
style: { "text-align": "center", color: "#94a3b8", padding: "30px" }
|
|
320
|
+
}, Ne = {
|
|
321
|
+
key: 1,
|
|
322
|
+
style: { "text-align": "center", color: "#94a3b8", padding: "30px" }
|
|
323
|
+
}, Oe = {
|
|
324
|
+
key: 2,
|
|
325
|
+
class: "gig-sticker-grid"
|
|
326
|
+
}, Xe = ["onClick"], Ye = ["src", "alt"], Ke = { class: "gig-input-area" }, Pe = {
|
|
327
|
+
key: 0,
|
|
328
|
+
class: "gig-reply-preview-container"
|
|
329
|
+
}, Fe = { class: "gig-reply-content" }, je = { class: "gig-reply-author" }, qe = { class: "gig-reply-text" }, Je = { class: "gig-input-box" }, Qe = ["onKeydown"], Ze = ["disabled"], et = {
|
|
158
330
|
viewBox: "0 0 24 24",
|
|
159
331
|
width: "18",
|
|
160
332
|
height: "18",
|
|
161
333
|
fill: "none",
|
|
162
334
|
stroke: "currentColor",
|
|
163
335
|
"stroke-width": "2",
|
|
164
|
-
style: { transform: "rotate(45deg)
|
|
165
|
-
},
|
|
336
|
+
style: { transform: "rotate(45deg) translate(-1px, 2px)" }
|
|
337
|
+
}, tt = ["src"], st = /* @__PURE__ */ q({
|
|
166
338
|
__name: "ChatWindow",
|
|
167
339
|
props: {
|
|
168
340
|
messages: {},
|
|
169
341
|
currentUserId: {}
|
|
170
342
|
},
|
|
171
343
|
emits: ["close", "send"],
|
|
172
|
-
setup(
|
|
173
|
-
const
|
|
174
|
-
|
|
344
|
+
setup(n, { emit: k }) {
|
|
345
|
+
const l = n, C = k, r = J(), m = w(""), U = w(null), b = w(null), a = w({ x: 32, y: 112 }), p = w({ width: 440, height: 600 }), z = w(!1), $ = w(null), S = w(!1), H = () => {
|
|
346
|
+
S.value = !S.value, S.value && r.stickers.length === 0 && r.fetchStickers();
|
|
347
|
+
}, R = (u) => {
|
|
348
|
+
r.sendSticker(u), S.value = !1, F();
|
|
349
|
+
}, V = (u) => {
|
|
350
|
+
const s = u.trim().split(/\s+/);
|
|
351
|
+
return s.length >= 2 ? `${s[0]} ${s[1][0]}.` : u;
|
|
352
|
+
}, W = (u) => u.userId === l.currentUserId ? "Вы" : V(u.userName || "Support"), i = (u) => u.messageType === "sticker" ? "[Стикер]" : u.text || "", t = (u) => {
|
|
353
|
+
const s = document.querySelector(`.gig-message-row[data-message-id="${u}"]`);
|
|
354
|
+
s && (s.scrollIntoView({ behavior: "smooth", block: "center" }), s.classList.add("gig-highlighted"), setTimeout(() => s.classList.remove("gig-highlighted"), 1500));
|
|
355
|
+
}, f = w(null), g = (u) => {
|
|
356
|
+
f.value = u;
|
|
357
|
+
}, o = () => {
|
|
358
|
+
f.value = null;
|
|
175
359
|
};
|
|
176
|
-
let
|
|
177
|
-
const
|
|
178
|
-
|
|
179
|
-
},
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
}
|
|
184
|
-
},
|
|
185
|
-
|
|
186
|
-
},
|
|
187
|
-
if (
|
|
188
|
-
const
|
|
189
|
-
if (
|
|
190
|
-
|
|
191
|
-
|
|
360
|
+
let d = 0, M = 0, E = 0, Q = 0, O = 0, X = 0;
|
|
361
|
+
const ae = (u) => {
|
|
362
|
+
u.button === 0 && (z.value = !0, d = u.clientX, M = u.clientY, O = a.value.x, X = a.value.y, window.addEventListener("mousemove", Z), window.addEventListener("mouseup", K));
|
|
363
|
+
}, Z = (u) => {
|
|
364
|
+
if (!z.value) return;
|
|
365
|
+
let s = O - (u.clientX - d), h = X - (u.clientY - M);
|
|
366
|
+
const x = window.innerWidth - p.value.width, B = window.innerHeight - p.value.height;
|
|
367
|
+
s < 0 && (s = 0), s > x && (s = x), h < 0 && (h = 0), h > B && (h = B), a.value = { x: s, y: h };
|
|
368
|
+
}, Y = (u, s) => {
|
|
369
|
+
u.preventDefault(), $.value = s, d = u.clientX, M = u.clientY, E = p.value.width, Q = p.value.height, O = a.value.x, X = a.value.y, window.addEventListener("mousemove", ee), window.addEventListener("mouseup", K);
|
|
370
|
+
}, ee = (u) => {
|
|
371
|
+
if (!$.value) return;
|
|
372
|
+
const s = d - u.clientX, h = M - u.clientY;
|
|
373
|
+
if ($.value === "left" || $.value === "corner") {
|
|
374
|
+
let x = E + s;
|
|
375
|
+
const B = window.innerWidth - a.value.x;
|
|
376
|
+
x > B && (x = B), x >= 320 && (p.value.width = x);
|
|
192
377
|
}
|
|
193
|
-
if (
|
|
194
|
-
|
|
195
|
-
|
|
378
|
+
if ($.value === "top" || $.value === "corner") {
|
|
379
|
+
let x = Q + h;
|
|
380
|
+
const B = window.innerHeight - a.value.y;
|
|
381
|
+
x > B && (x = B), x >= 400 && (p.value.height = x);
|
|
196
382
|
}
|
|
197
|
-
},
|
|
198
|
-
|
|
199
|
-
},
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
383
|
+
}, K = () => {
|
|
384
|
+
z.value = !1, $.value = null, window.removeEventListener("mousemove", Z), window.removeEventListener("mousemove", ee);
|
|
385
|
+
}, P = () => {
|
|
386
|
+
const u = window.innerWidth - p.value.width, s = window.innerHeight - p.value.height;
|
|
387
|
+
a.value.x < 0 && (a.value.x = 0), a.value.x > u && u > 0 ? a.value.x = u : a.value.x > window.innerWidth && (a.value.x = 0), a.value.y < 0 && (a.value.y = 0), a.value.y > s && s > 0 ? a.value.y = s : a.value.y > window.innerHeight && (a.value.y = 0);
|
|
388
|
+
}, te = () => {
|
|
389
|
+
m.value.trim() && (C("send", m.value), m.value = "", b.value && (b.value.style.height = "auto"), F());
|
|
390
|
+
}, le = () => {
|
|
391
|
+
b.value && (b.value.style.height = "auto", b.value.style.height = Math.min(b.value.scrollHeight, 120) + "px");
|
|
392
|
+
}, F = async () => {
|
|
393
|
+
await me(), U.value && (U.value.scrollTop = U.value.scrollHeight);
|
|
205
394
|
};
|
|
206
|
-
return
|
|
395
|
+
return ie(() => {
|
|
396
|
+
F(), window.addEventListener("resize", P), P();
|
|
397
|
+
}), ne(() => {
|
|
398
|
+
K(), window.removeEventListener("resize", P);
|
|
399
|
+
}), (u, s) => (c(), v("div", {
|
|
207
400
|
class: "gig-chat-window",
|
|
208
|
-
style:
|
|
209
|
-
width:
|
|
210
|
-
height:
|
|
211
|
-
bottom:
|
|
212
|
-
right:
|
|
213
|
-
cursor:
|
|
401
|
+
style: ue({
|
|
402
|
+
width: p.value.width + "px",
|
|
403
|
+
height: p.value.height + "px",
|
|
404
|
+
bottom: a.value.y + "px",
|
|
405
|
+
right: a.value.x + "px",
|
|
406
|
+
cursor: z.value ? "grabbing" : "auto"
|
|
214
407
|
})
|
|
215
408
|
}, [
|
|
216
|
-
|
|
409
|
+
e("div", {
|
|
217
410
|
class: "gig-resizer gig-resizer-l",
|
|
218
|
-
onMousedown:
|
|
411
|
+
onMousedown: s[0] || (s[0] = (h) => Y(h, "left"))
|
|
219
412
|
}, null, 32),
|
|
220
|
-
|
|
413
|
+
e("div", {
|
|
221
414
|
class: "gig-resizer gig-resizer-t",
|
|
222
|
-
onMousedown:
|
|
415
|
+
onMousedown: s[1] || (s[1] = (h) => Y(h, "top"))
|
|
223
416
|
}, null, 32),
|
|
224
|
-
|
|
417
|
+
e("div", {
|
|
225
418
|
class: "gig-resizer gig-resizer-tl",
|
|
226
|
-
onMousedown:
|
|
419
|
+
onMousedown: s[2] || (s[2] = (h) => Y(h, "corner"))
|
|
227
420
|
}, null, 32),
|
|
228
|
-
|
|
421
|
+
e("div", {
|
|
229
422
|
class: "gig-chat-header",
|
|
230
|
-
onMousedown:
|
|
423
|
+
onMousedown: ae
|
|
231
424
|
}, [
|
|
232
|
-
|
|
233
|
-
|
|
425
|
+
s[10] || (s[10] = ge('<div class="gig-header-left"><div class="gig-header-icon"><svg viewBox="0 0 24 24" width="22" height="22" stroke="currentColor" fill="none" stroke-width="2"><path d="M3 18v-6a9 9 0 0 1 18 0v6"></path><path d="M21 19a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3zM3 19a2 2 0 0 0 2 2h1a2 2 0 0 0 2-2v-3a2 2 0 0 0-2-2H3z"></path></svg></div><div><h3 class="gig-header-title">Чат поддержки</h3><div class="gig-header-status"><div class="gig-status-dot"></div><span>Мы онлайн!</span></div></div></div>', 1)),
|
|
426
|
+
e("button", {
|
|
234
427
|
class: "gig-btn-icon",
|
|
235
|
-
onClick:
|
|
428
|
+
onClick: s[3] || (s[3] = D((h) => u.$emit("close"), ["stop"])),
|
|
236
429
|
style: { opacity: "0.8" }
|
|
237
|
-
}, [...
|
|
238
|
-
|
|
430
|
+
}, [...s[9] || (s[9] = [
|
|
431
|
+
e("svg", {
|
|
239
432
|
viewBox: "0 0 24 24",
|
|
240
433
|
width: "22",
|
|
241
434
|
height: "22",
|
|
@@ -243,13 +436,13 @@ const ie = se("gigSupportChat", () => {
|
|
|
243
436
|
fill: "none",
|
|
244
437
|
"stroke-width": "2.5"
|
|
245
438
|
}, [
|
|
246
|
-
|
|
439
|
+
e("line", {
|
|
247
440
|
x1: "18",
|
|
248
441
|
y1: "6",
|
|
249
442
|
x2: "6",
|
|
250
443
|
y2: "18"
|
|
251
444
|
}),
|
|
252
|
-
|
|
445
|
+
e("line", {
|
|
253
446
|
x1: "6",
|
|
254
447
|
y1: "6",
|
|
255
448
|
x2: "18",
|
|
@@ -258,25 +451,131 @@ const ie = se("gigSupportChat", () => {
|
|
|
258
451
|
], -1)
|
|
259
452
|
])])
|
|
260
453
|
], 32),
|
|
261
|
-
|
|
454
|
+
e("div", {
|
|
262
455
|
ref_key: "messagesArea",
|
|
263
|
-
ref:
|
|
456
|
+
ref: U,
|
|
264
457
|
class: "gig-messages-area"
|
|
265
458
|
}, [
|
|
266
|
-
|
|
267
|
-
(
|
|
268
|
-
key:
|
|
269
|
-
message:
|
|
270
|
-
"current-user-id":
|
|
459
|
+
n.messages.length === 0 ? (c(), v("div", _e, " Здесь будет история переписки ")) : I("", !0),
|
|
460
|
+
(c(!0), v(N, null, se(n.messages, (h) => (c(), oe(Le, {
|
|
461
|
+
key: h.id,
|
|
462
|
+
message: h,
|
|
463
|
+
"current-user-id": n.currentUserId,
|
|
464
|
+
onReply: s[4] || (s[4] = (x) => y(r).replyingToMessage = x),
|
|
465
|
+
onScrollTo: t,
|
|
466
|
+
onOpenImage: g
|
|
271
467
|
}, null, 8, ["message", "current-user-id"]))), 128))
|
|
272
468
|
], 512),
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
469
|
+
_(G, { name: "gig-fade" }, {
|
|
470
|
+
default: A(() => [
|
|
471
|
+
S.value ? (c(), v("div", Ge, [
|
|
472
|
+
e("div", Ae, [
|
|
473
|
+
s[12] || (s[12] = e("span", { style: { "font-size": "11px", "font-weight": "700", color: "#94a3b8", "text-transform": "uppercase" } }, "Выберите стикер", -1)),
|
|
474
|
+
e("button", {
|
|
475
|
+
class: "gig-btn-icon",
|
|
476
|
+
style: { color: "#94a3b8", width: "24px", height: "24px" },
|
|
477
|
+
onClick: s[5] || (s[5] = (h) => S.value = !1)
|
|
478
|
+
}, [...s[11] || (s[11] = [
|
|
479
|
+
e("svg", {
|
|
480
|
+
viewBox: "0 0 24 24",
|
|
481
|
+
width: "20",
|
|
482
|
+
height: "20",
|
|
483
|
+
stroke: "currentColor",
|
|
484
|
+
fill: "none",
|
|
485
|
+
"stroke-width": "2.5"
|
|
486
|
+
}, [
|
|
487
|
+
e("line", {
|
|
488
|
+
x1: "18",
|
|
489
|
+
y1: "6",
|
|
490
|
+
x2: "6",
|
|
491
|
+
y2: "18"
|
|
492
|
+
}),
|
|
493
|
+
e("line", {
|
|
494
|
+
x1: "6",
|
|
495
|
+
y1: "6",
|
|
496
|
+
x2: "18",
|
|
497
|
+
y2: "18"
|
|
498
|
+
})
|
|
499
|
+
], -1)
|
|
500
|
+
])])
|
|
501
|
+
]),
|
|
502
|
+
e("div", Ve, [
|
|
503
|
+
y(r).isLoadingStickers ? (c(), v("div", De, " Загрузка... ")) : y(r).stickers.length === 0 ? (c(), v("div", Ne, " Стикеры не найдены ")) : (c(), v("div", Oe, [
|
|
504
|
+
(c(!0), v(N, null, se(y(r).stickers, (h) => (c(), v("div", {
|
|
505
|
+
key: h.id,
|
|
506
|
+
class: "gig-sticker-item",
|
|
507
|
+
onClick: (x) => R(h.id)
|
|
508
|
+
}, [
|
|
509
|
+
e("img", {
|
|
510
|
+
src: `data:${h.mimeType || "image/png"};base64,${h.base64}`,
|
|
511
|
+
class: "gig-sticker-thumbnail",
|
|
512
|
+
alt: h.name
|
|
513
|
+
}, null, 8, Ye)
|
|
514
|
+
], 8, Xe))), 128))
|
|
515
|
+
]))
|
|
516
|
+
])
|
|
517
|
+
])) : I("", !0)
|
|
518
|
+
]),
|
|
519
|
+
_: 1
|
|
520
|
+
}),
|
|
521
|
+
e("div", Ke, [
|
|
522
|
+
_(G, { name: "gig-fade" }, {
|
|
523
|
+
default: A(() => [
|
|
524
|
+
y(r).replyingToMessage ? (c(), v("div", Pe, [
|
|
525
|
+
s[14] || (s[14] = e("div", { class: "gig-reply-icon" }, [
|
|
526
|
+
e("svg", {
|
|
527
|
+
viewBox: "0 0 24 24",
|
|
528
|
+
width: "16",
|
|
529
|
+
height: "16",
|
|
530
|
+
fill: "none",
|
|
531
|
+
stroke: "var(--gig-brand-dark-green)",
|
|
532
|
+
"stroke-width": "2.5"
|
|
533
|
+
}, [
|
|
534
|
+
e("polyline", { points: "9 17 4 12 9 7" }),
|
|
535
|
+
e("path", { d: "M20 18v-2a4 4 0 0 0-4-4H4" })
|
|
536
|
+
])
|
|
537
|
+
], -1)),
|
|
538
|
+
e("div", Fe, [
|
|
539
|
+
e("div", je, T(W(y(r).replyingToMessage)), 1),
|
|
540
|
+
e("div", qe, T(i(y(r).replyingToMessage)), 1)
|
|
541
|
+
]),
|
|
542
|
+
e("button", {
|
|
543
|
+
class: "gig-btn-icon gig-reply-close",
|
|
544
|
+
style: { color: "#94a3b8", width: "20px", height: "20px", "flex-shrink": "0" },
|
|
545
|
+
onClick: s[6] || (s[6] = (h) => y(r).replyingToMessage = null)
|
|
546
|
+
}, [...s[13] || (s[13] = [
|
|
547
|
+
e("svg", {
|
|
548
|
+
viewBox: "0 0 24 24",
|
|
549
|
+
width: "16",
|
|
550
|
+
height: "16",
|
|
551
|
+
stroke: "currentColor",
|
|
552
|
+
fill: "none",
|
|
553
|
+
"stroke-width": "2.5"
|
|
554
|
+
}, [
|
|
555
|
+
e("line", {
|
|
556
|
+
x1: "18",
|
|
557
|
+
y1: "6",
|
|
558
|
+
x2: "6",
|
|
559
|
+
y2: "18"
|
|
560
|
+
}),
|
|
561
|
+
e("line", {
|
|
562
|
+
x1: "6",
|
|
563
|
+
y1: "6",
|
|
564
|
+
x2: "18",
|
|
565
|
+
y2: "18"
|
|
566
|
+
})
|
|
567
|
+
], -1)
|
|
568
|
+
])])
|
|
569
|
+
])) : I("", !0)
|
|
570
|
+
]),
|
|
571
|
+
_: 1
|
|
572
|
+
}),
|
|
573
|
+
e("div", Je, [
|
|
574
|
+
e("div", {
|
|
276
575
|
class: "gig-input-star",
|
|
277
|
-
onClick:
|
|
278
|
-
}, [...
|
|
279
|
-
|
|
576
|
+
onClick: H
|
|
577
|
+
}, [...s[15] || (s[15] = [
|
|
578
|
+
e("svg", {
|
|
280
579
|
viewBox: "0 0 24 24",
|
|
281
580
|
width: "20",
|
|
282
581
|
height: "20",
|
|
@@ -284,114 +583,166 @@ const ie = se("gigSupportChat", () => {
|
|
|
284
583
|
stroke: "currentColor",
|
|
285
584
|
"stroke-width": "2"
|
|
286
585
|
}, [
|
|
287
|
-
|
|
586
|
+
e("polygon", { points: "12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2" })
|
|
288
587
|
], -1)
|
|
289
588
|
])]),
|
|
290
|
-
|
|
589
|
+
de(e("textarea", {
|
|
291
590
|
ref_key: "textareaRef",
|
|
292
|
-
ref:
|
|
293
|
-
"onUpdate:modelValue":
|
|
591
|
+
ref: b,
|
|
592
|
+
"onUpdate:modelValue": s[7] || (s[7] = (h) => m.value = h),
|
|
294
593
|
placeholder: "Напишите сообщение...",
|
|
295
594
|
class: "gig-textarea",
|
|
296
595
|
rows: "1",
|
|
297
|
-
onKeydown:
|
|
298
|
-
onInput:
|
|
299
|
-
}, null, 40,
|
|
300
|
-
[
|
|
596
|
+
onKeydown: ce(D(te, ["exact", "prevent"]), ["enter"]),
|
|
597
|
+
onInput: le
|
|
598
|
+
}, null, 40, Qe), [
|
|
599
|
+
[ve, m.value]
|
|
301
600
|
]),
|
|
302
|
-
|
|
303
|
-
class: L(["gig-send-btn", { active:
|
|
304
|
-
disabled: !
|
|
305
|
-
onClick:
|
|
601
|
+
e("button", {
|
|
602
|
+
class: L(["gig-send-btn", { active: m.value.trim() }]),
|
|
603
|
+
disabled: !m.value.trim(),
|
|
604
|
+
onClick: te
|
|
306
605
|
}, [
|
|
307
|
-
(
|
|
308
|
-
|
|
606
|
+
(c(), v("svg", et, [...s[16] || (s[16] = [
|
|
607
|
+
e("path", { d: "M22 2L11 13M22 2l-7 20-4-9-9-4 20-7z" }, null, -1)
|
|
309
608
|
])]))
|
|
310
|
-
], 10,
|
|
609
|
+
], 10, Ze)
|
|
311
610
|
]),
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
611
|
+
s[17] || (s[17] = e("div", { class: "gig-footer" }, [
|
|
612
|
+
e("div", { class: "gig-footer-line" }),
|
|
613
|
+
e("span", { class: "gig-footer-text" }, "Работает на GigSupport"),
|
|
614
|
+
e("div", { class: "gig-footer-line" })
|
|
316
615
|
], -1))
|
|
317
|
-
])
|
|
616
|
+
]),
|
|
617
|
+
_(G, { name: "gig-fade" }, {
|
|
618
|
+
default: A(() => [
|
|
619
|
+
f.value ? (c(), v("div", {
|
|
620
|
+
key: 0,
|
|
621
|
+
class: "gig-image-viewer",
|
|
622
|
+
onClick: o
|
|
623
|
+
}, [
|
|
624
|
+
e("button", {
|
|
625
|
+
class: "gig-btn-icon gig-image-viewer-close",
|
|
626
|
+
onClick: D(o, ["stop"])
|
|
627
|
+
}, [...s[18] || (s[18] = [
|
|
628
|
+
e("svg", {
|
|
629
|
+
viewBox: "0 0 24 24",
|
|
630
|
+
width: "28",
|
|
631
|
+
height: "28",
|
|
632
|
+
stroke: "currentColor",
|
|
633
|
+
fill: "none",
|
|
634
|
+
"stroke-width": "2"
|
|
635
|
+
}, [
|
|
636
|
+
e("line", {
|
|
637
|
+
x1: "18",
|
|
638
|
+
y1: "6",
|
|
639
|
+
x2: "6",
|
|
640
|
+
y2: "18"
|
|
641
|
+
}),
|
|
642
|
+
e("line", {
|
|
643
|
+
x1: "6",
|
|
644
|
+
y1: "6",
|
|
645
|
+
x2: "18",
|
|
646
|
+
y2: "18"
|
|
647
|
+
})
|
|
648
|
+
], -1)
|
|
649
|
+
])]),
|
|
650
|
+
e("img", {
|
|
651
|
+
src: f.value,
|
|
652
|
+
alt: "Просмотр",
|
|
653
|
+
onClick: s[8] || (s[8] = D(() => {
|
|
654
|
+
}, ["stop"]))
|
|
655
|
+
}, null, 8, tt)
|
|
656
|
+
])) : I("", !0)
|
|
657
|
+
]),
|
|
658
|
+
_: 1
|
|
659
|
+
})
|
|
318
660
|
], 4));
|
|
319
661
|
}
|
|
320
|
-
}),
|
|
662
|
+
}), it = { class: "gig-chat-wrapper" }, nt = {
|
|
321
663
|
key: 0,
|
|
322
664
|
class: "gig-chat-badge"
|
|
323
|
-
},
|
|
324
|
-
key:
|
|
665
|
+
}, ot = { class: "gig-trigger-icon-wrapper" }, at = {
|
|
666
|
+
key: 0,
|
|
667
|
+
class: "gig-trigger-icon",
|
|
325
668
|
viewBox: "0 0 24 24",
|
|
326
|
-
width: "
|
|
327
|
-
height: "
|
|
669
|
+
width: "36",
|
|
670
|
+
height: "36",
|
|
328
671
|
fill: "none",
|
|
329
672
|
stroke: "white",
|
|
330
673
|
"stroke-width": "2"
|
|
331
|
-
},
|
|
332
|
-
key:
|
|
674
|
+
}, lt = {
|
|
675
|
+
key: 1,
|
|
676
|
+
class: "gig-trigger-icon",
|
|
333
677
|
viewBox: "0 0 24 24",
|
|
334
|
-
width: "
|
|
335
|
-
height: "
|
|
678
|
+
width: "36",
|
|
679
|
+
height: "36",
|
|
336
680
|
fill: "none",
|
|
337
681
|
stroke: "white",
|
|
338
682
|
"stroke-width": "2"
|
|
339
|
-
},
|
|
683
|
+
}, rt = /* @__PURE__ */ q({
|
|
340
684
|
__name: "GigSupportChat",
|
|
341
685
|
props: {
|
|
342
686
|
config: {}
|
|
343
687
|
},
|
|
344
|
-
setup(
|
|
345
|
-
const
|
|
346
|
-
return
|
|
347
|
-
|
|
348
|
-
}),
|
|
349
|
-
|
|
350
|
-
}), (
|
|
351
|
-
_(
|
|
352
|
-
default:
|
|
353
|
-
|
|
688
|
+
setup(n) {
|
|
689
|
+
const k = n, l = J();
|
|
690
|
+
return ie(() => {
|
|
691
|
+
l.init(k.config), l.connect();
|
|
692
|
+
}), ne(() => {
|
|
693
|
+
l.disconnect();
|
|
694
|
+
}), (C, r) => (c(), v("div", it, [
|
|
695
|
+
_(G, { name: "gig-popup" }, {
|
|
696
|
+
default: A(() => [
|
|
697
|
+
y(l).isWidgetOpen ? (c(), oe(st, {
|
|
354
698
|
key: 0,
|
|
355
|
-
messages:
|
|
356
|
-
"is-connected":
|
|
357
|
-
"current-user-id":
|
|
358
|
-
onSend:
|
|
359
|
-
onClose:
|
|
360
|
-
}, null, 8, ["messages", "is-connected", "current-user-id"])) :
|
|
699
|
+
messages: y(l).messages,
|
|
700
|
+
"is-connected": y(l).isConnected,
|
|
701
|
+
"current-user-id": y(l).currentUserId,
|
|
702
|
+
onSend: r[0] || (r[0] = (m) => y(l).sendMessage(m)),
|
|
703
|
+
onClose: r[1] || (r[1] = (m) => y(l).toggleWidget())
|
|
704
|
+
}, null, 8, ["messages", "is-connected", "current-user-id"])) : I("", !0)
|
|
361
705
|
]),
|
|
362
706
|
_: 1
|
|
363
707
|
}),
|
|
364
|
-
|
|
365
|
-
class: "gig-chat-trigger",
|
|
366
|
-
onClick:
|
|
708
|
+
e("button", {
|
|
709
|
+
class: L(["gig-chat-trigger", { "is-open": y(l).isWidgetOpen }]),
|
|
710
|
+
onClick: r[2] || (r[2] = (m) => y(l).toggleWidget())
|
|
367
711
|
}, [
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
712
|
+
y(l).unreadCount > 0 ? (c(), v("div", nt, T(y(l).unreadCount), 1)) : I("", !0),
|
|
713
|
+
e("div", ot, [
|
|
714
|
+
_(G, { name: "gig-icon-spin" }, {
|
|
715
|
+
default: A(() => [
|
|
716
|
+
y(l).isWidgetOpen ? (c(), v("svg", lt, [...r[4] || (r[4] = [
|
|
717
|
+
e("line", {
|
|
718
|
+
x1: "18",
|
|
719
|
+
y1: "6",
|
|
720
|
+
x2: "6",
|
|
721
|
+
y2: "18"
|
|
722
|
+
}, null, -1),
|
|
723
|
+
e("line", {
|
|
724
|
+
x1: "6",
|
|
725
|
+
y1: "6",
|
|
726
|
+
x2: "18",
|
|
727
|
+
y2: "18"
|
|
728
|
+
}, null, -1)
|
|
729
|
+
])])) : (c(), v("svg", at, [...r[3] || (r[3] = [
|
|
730
|
+
e("path", { d: "M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z" }, null, -1)
|
|
731
|
+
])]))
|
|
732
|
+
]),
|
|
733
|
+
_: 1
|
|
734
|
+
})
|
|
735
|
+
])
|
|
736
|
+
], 2)
|
|
386
737
|
]));
|
|
387
738
|
}
|
|
388
|
-
}),
|
|
389
|
-
install: (
|
|
390
|
-
|
|
739
|
+
}), ct = {
|
|
740
|
+
install: (n) => {
|
|
741
|
+
n.component("GigSupportChat", rt);
|
|
391
742
|
}
|
|
392
743
|
};
|
|
393
744
|
export {
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
745
|
+
rt as GigSupportChat,
|
|
746
|
+
ct as default,
|
|
747
|
+
J as useSupportChat
|
|
397
748
|
};
|