@gengage/assistant-fe 0.6.49 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chat/api.d.ts +1 -1
- package/dist/chat/components/ChatDrawer.d.ts +3 -1
- package/dist/chat/features/beauty-consulting/mode-controller.d.ts +1 -1
- package/dist/chat/features/beauty-consulting/stream-handler.d.ts +7 -1
- package/dist/chat/history-storage.d.ts +36 -4
- package/dist/chat/runtime.d.ts +73 -3
- package/dist/chat/utils/chat-presentation-debug.d.ts +0 -14
- package/dist/chat-runtime.js +1 -1
- package/dist/chat.iife.js +72 -72
- package/dist/chat.js +1 -1
- package/dist/common/connection-warning.d.ts +10 -0
- package/dist/common/indexed-db.d.ts +35 -2
- package/dist/common/native-webview.d.ts +1 -1
- package/dist/common/streaming.d.ts +6 -1
- package/dist/common/transport.d.ts +2 -1
- package/dist/common/types.d.ts +16 -0
- package/dist/{common-nAeMxZrn.js → common-CeuGSwJL.js} +61 -65
- package/dist/common.js +30 -30
- package/dist/{connection-warning-CDtUX-ol.js → connection-warning-C0e2byq5.js} +31 -25
- package/dist/{fastIntent-D45C2rEO.js → fastIntent-BI7l1oDv.js} +2 -2
- package/dist/global-error-toast-DvaKvPNA.js +798 -0
- package/dist/index.js +29 -29
- package/dist/native-webview-CHKpwixw.js +303 -0
- package/dist/native.iife.js +30 -30
- package/dist/native.js +1 -1
- package/dist/{overlay-BPZEIyo_.js → overlay-C3XzoSKd.js} +51 -32
- package/dist/overlay.js +6 -6
- package/dist/{price-formatter-CHUmYq8I.js → price-formatter-Q3wUKrl1.js} +2 -1
- package/dist/qna/runtime.d.ts +1 -0
- package/dist/qna-runtime.js +1 -1
- package/dist/qna.iife.js +32 -32
- package/dist/qna.js +1 -1
- package/dist/{request-response-cache-CGxwN0CV.js → request-response-cache-BLQy7llq.js} +478 -454
- package/dist/{runtime-CNlICVeC.js → runtime-BC8-a6Ql.js} +231 -219
- package/dist/runtime-BSIrZhF2.js +8889 -0
- package/dist/{runtime-Cg-6aUps.js → runtime-DiONTdBz.js} +230 -212
- package/dist/{simbut-BtaGMLLn.js → simbut-BDbb3nMH.js} +5 -5
- package/dist/simbut.iife.js +2 -2
- package/dist/simbut.js +1 -1
- package/dist/simrel/components/GroupTabs.d.ts +6 -0
- package/dist/simrel/runtime.d.ts +8 -0
- package/dist/{simrel-iGl2aXiY.js → simrel-CdxDIKu3.js} +15 -15
- package/dist/simrel-runtime.js +1 -1
- package/dist/simrel.iife.js +22 -22
- package/dist/simrel.js +2 -2
- package/dist/widget-base-Cvxdrqqt.js +141 -0
- package/package.json +1 -1
- package/dist/context-UTzCGyR9.js +0 -543
- package/dist/native-webview-CYX30O3Q.js +0 -273
- package/dist/runtime-COLQGOkl.js +0 -8708
- package/dist/widget-base-AuwRxs2X.js +0 -365
|
@@ -0,0 +1,798 @@
|
|
|
1
|
+
var U = /* @__PURE__ */ new Set([
|
|
2
|
+
"p",
|
|
3
|
+
"br",
|
|
4
|
+
"a",
|
|
5
|
+
"strong",
|
|
6
|
+
"b",
|
|
7
|
+
"em",
|
|
8
|
+
"i",
|
|
9
|
+
"u",
|
|
10
|
+
"ul",
|
|
11
|
+
"ol",
|
|
12
|
+
"li",
|
|
13
|
+
"h1",
|
|
14
|
+
"h2",
|
|
15
|
+
"h3",
|
|
16
|
+
"h4",
|
|
17
|
+
"h5",
|
|
18
|
+
"h6",
|
|
19
|
+
"span",
|
|
20
|
+
"div",
|
|
21
|
+
"table",
|
|
22
|
+
"thead",
|
|
23
|
+
"tbody",
|
|
24
|
+
"tr",
|
|
25
|
+
"th",
|
|
26
|
+
"td",
|
|
27
|
+
"hr",
|
|
28
|
+
"code",
|
|
29
|
+
"pre",
|
|
30
|
+
"blockquote",
|
|
31
|
+
"img",
|
|
32
|
+
"sup",
|
|
33
|
+
"sub",
|
|
34
|
+
"button"
|
|
35
|
+
]), W = /* @__PURE__ */ new Set([
|
|
36
|
+
"script",
|
|
37
|
+
"iframe",
|
|
38
|
+
"object",
|
|
39
|
+
"embed",
|
|
40
|
+
"form",
|
|
41
|
+
"input",
|
|
42
|
+
"textarea",
|
|
43
|
+
"select",
|
|
44
|
+
"style",
|
|
45
|
+
"link",
|
|
46
|
+
"meta",
|
|
47
|
+
"template",
|
|
48
|
+
"noscript"
|
|
49
|
+
]), C = {
|
|
50
|
+
"*": /* @__PURE__ */ new Set(["class"]),
|
|
51
|
+
a: /* @__PURE__ */ new Set([
|
|
52
|
+
"href",
|
|
53
|
+
"target",
|
|
54
|
+
"rel"
|
|
55
|
+
]),
|
|
56
|
+
img: /* @__PURE__ */ new Set([
|
|
57
|
+
"src",
|
|
58
|
+
"alt",
|
|
59
|
+
"width",
|
|
60
|
+
"height"
|
|
61
|
+
]),
|
|
62
|
+
button: /* @__PURE__ */ new Set([
|
|
63
|
+
"type",
|
|
64
|
+
"disabled",
|
|
65
|
+
"aria-label",
|
|
66
|
+
"aria-hidden",
|
|
67
|
+
"title"
|
|
68
|
+
]),
|
|
69
|
+
div: /* @__PURE__ */ new Set(["style"]),
|
|
70
|
+
span: /* @__PURE__ */ new Set(["style"]),
|
|
71
|
+
p: /* @__PURE__ */ new Set(["style"])
|
|
72
|
+
};
|
|
73
|
+
function z(e) {
|
|
74
|
+
return /^\s*javascript\s*:/i.test(e);
|
|
75
|
+
}
|
|
76
|
+
var $ = /* @__PURE__ */ new Set([
|
|
77
|
+
"color",
|
|
78
|
+
"background-color",
|
|
79
|
+
"font-size",
|
|
80
|
+
"font-weight",
|
|
81
|
+
"font-style",
|
|
82
|
+
"font-family",
|
|
83
|
+
"text-align",
|
|
84
|
+
"text-decoration",
|
|
85
|
+
"line-height",
|
|
86
|
+
"letter-spacing",
|
|
87
|
+
"margin",
|
|
88
|
+
"margin-top",
|
|
89
|
+
"margin-right",
|
|
90
|
+
"margin-bottom",
|
|
91
|
+
"margin-left",
|
|
92
|
+
"padding",
|
|
93
|
+
"padding-top",
|
|
94
|
+
"padding-right",
|
|
95
|
+
"padding-bottom",
|
|
96
|
+
"padding-left",
|
|
97
|
+
"border",
|
|
98
|
+
"border-top",
|
|
99
|
+
"border-right",
|
|
100
|
+
"border-bottom",
|
|
101
|
+
"border-left",
|
|
102
|
+
"border-radius",
|
|
103
|
+
"border-color",
|
|
104
|
+
"border-width",
|
|
105
|
+
"border-style",
|
|
106
|
+
"width",
|
|
107
|
+
"max-width",
|
|
108
|
+
"min-width",
|
|
109
|
+
"height",
|
|
110
|
+
"max-height",
|
|
111
|
+
"min-height",
|
|
112
|
+
"display",
|
|
113
|
+
"vertical-align",
|
|
114
|
+
"white-space",
|
|
115
|
+
"word-break",
|
|
116
|
+
"overflow",
|
|
117
|
+
"opacity",
|
|
118
|
+
"visibility",
|
|
119
|
+
"list-style",
|
|
120
|
+
"list-style-type",
|
|
121
|
+
"text-transform",
|
|
122
|
+
"text-indent",
|
|
123
|
+
"text-overflow",
|
|
124
|
+
"box-sizing",
|
|
125
|
+
"flex",
|
|
126
|
+
"flex-direction",
|
|
127
|
+
"flex-wrap",
|
|
128
|
+
"justify-content",
|
|
129
|
+
"align-items",
|
|
130
|
+
"gap"
|
|
131
|
+
]), q = /url\s*\(|expression\s*\(|javascript\s*:|\bimport\b|-moz-binding|behavior\s*:/i, F = /* @__PURE__ */ new Set([
|
|
132
|
+
"color",
|
|
133
|
+
"background-color",
|
|
134
|
+
"border",
|
|
135
|
+
"border-top",
|
|
136
|
+
"border-right",
|
|
137
|
+
"border-bottom",
|
|
138
|
+
"border-left",
|
|
139
|
+
"border-color",
|
|
140
|
+
"width",
|
|
141
|
+
"max-width",
|
|
142
|
+
"min-width",
|
|
143
|
+
"height",
|
|
144
|
+
"max-height",
|
|
145
|
+
"min-height",
|
|
146
|
+
"margin",
|
|
147
|
+
"margin-top",
|
|
148
|
+
"margin-right",
|
|
149
|
+
"margin-bottom",
|
|
150
|
+
"margin-left",
|
|
151
|
+
"padding",
|
|
152
|
+
"padding-top",
|
|
153
|
+
"padding-right",
|
|
154
|
+
"padding-bottom",
|
|
155
|
+
"padding-left",
|
|
156
|
+
"line-height",
|
|
157
|
+
"letter-spacing",
|
|
158
|
+
"gap",
|
|
159
|
+
"font-size"
|
|
160
|
+
]);
|
|
161
|
+
function B(e) {
|
|
162
|
+
const t = [];
|
|
163
|
+
for (const n of e.split(";")) {
|
|
164
|
+
const r = n.trim();
|
|
165
|
+
if (!r) continue;
|
|
166
|
+
const a = r.indexOf(":");
|
|
167
|
+
if (a === -1) continue;
|
|
168
|
+
const i = r.slice(0, a).trim().toLowerCase(), u = r.slice(a + 1).trim();
|
|
169
|
+
if (!$.has(i)) continue;
|
|
170
|
+
const f = u.replace(/\/\*[\s\S]*?\*\//g, "");
|
|
171
|
+
q.test(f) || f.includes("\\") && !F.has(i) || (i === "list-style" || i === "list-style-type") && /url/i.test(f) || t.push(r);
|
|
172
|
+
}
|
|
173
|
+
return t.join("; ");
|
|
174
|
+
}
|
|
175
|
+
function x(e, t) {
|
|
176
|
+
if (e.nodeType === Node.TEXT_NODE) return;
|
|
177
|
+
if (e.nodeType !== Node.ELEMENT_NODE) {
|
|
178
|
+
e.parentNode?.removeChild(e);
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
const n = e, r = n.tagName.toLowerCase();
|
|
182
|
+
if (W.has(r)) {
|
|
183
|
+
n.parentNode?.removeChild(n);
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
if (!U.has(r)) {
|
|
187
|
+
const s = Array.from(n.childNodes);
|
|
188
|
+
for (const c of s) t.insertBefore(c, n);
|
|
189
|
+
t.removeChild(n);
|
|
190
|
+
for (const c of s) x(c, t);
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
const a = C["*"] ?? /* @__PURE__ */ new Set(), i = C[r] ?? /* @__PURE__ */ new Set(), u = Array.from(n.attributes);
|
|
194
|
+
for (const s of u) {
|
|
195
|
+
const c = s.name.toLowerCase();
|
|
196
|
+
if (!a.has(c) && !i.has(c)) {
|
|
197
|
+
n.removeAttribute(s.name);
|
|
198
|
+
continue;
|
|
199
|
+
}
|
|
200
|
+
if (z(s.value)) {
|
|
201
|
+
n.removeAttribute(s.name);
|
|
202
|
+
continue;
|
|
203
|
+
}
|
|
204
|
+
if (c === "style") {
|
|
205
|
+
const h = B(s.value);
|
|
206
|
+
h ? n.setAttribute("style", h) : n.removeAttribute("style");
|
|
207
|
+
continue;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
if (r === "a") {
|
|
211
|
+
const s = n.getAttribute("href");
|
|
212
|
+
if (s !== null) {
|
|
213
|
+
const c = s.trim().toLowerCase();
|
|
214
|
+
!c.startsWith("http://") && !c.startsWith("https://") && !c.startsWith("mailto:") && n.removeAttribute("href");
|
|
215
|
+
}
|
|
216
|
+
n.setAttribute("target", "_blank"), n.setAttribute("rel", "noopener noreferrer");
|
|
217
|
+
}
|
|
218
|
+
if (r === "img") {
|
|
219
|
+
const s = n.getAttribute("src");
|
|
220
|
+
s !== null && (s.trim().toLowerCase().startsWith("https://") || n.removeAttribute("src"));
|
|
221
|
+
}
|
|
222
|
+
if (r === "button") {
|
|
223
|
+
const s = n.getAttribute("type")?.trim().toLowerCase();
|
|
224
|
+
(!s || s !== "button") && n.setAttribute("type", "button");
|
|
225
|
+
}
|
|
226
|
+
const f = Array.from(n.childNodes);
|
|
227
|
+
for (const s of f) x(s, n);
|
|
228
|
+
}
|
|
229
|
+
var N = ["http:", "https:"];
|
|
230
|
+
function he(e) {
|
|
231
|
+
const t = e.trim();
|
|
232
|
+
if (!t) return !1;
|
|
233
|
+
if (t.startsWith("/") && !t.startsWith("//")) return !0;
|
|
234
|
+
try {
|
|
235
|
+
return N.includes(new URL(t).protocol);
|
|
236
|
+
} catch {
|
|
237
|
+
return !1;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
function O(e) {
|
|
241
|
+
if (e.startsWith("/") && !e.startsWith("//")) return !0;
|
|
242
|
+
try {
|
|
243
|
+
const t = new URL(e);
|
|
244
|
+
return N.includes(t.protocol);
|
|
245
|
+
} catch {
|
|
246
|
+
return !1;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
function be(e, t, n) {
|
|
250
|
+
(t === "href" || t === "src") && !O(n) || e.setAttribute(t, n);
|
|
251
|
+
}
|
|
252
|
+
function we(e) {
|
|
253
|
+
if (!e) return "";
|
|
254
|
+
const t = new DOMParser().parseFromString(e, "text/html").body, n = Array.from(t.childNodes);
|
|
255
|
+
for (const r of n) x(r, t);
|
|
256
|
+
return t.innerHTML;
|
|
257
|
+
}
|
|
258
|
+
function G() {
|
|
259
|
+
return typeof window < "u" && Array.isArray(window.dataLayer);
|
|
260
|
+
}
|
|
261
|
+
function o(e, t) {
|
|
262
|
+
const n = {
|
|
263
|
+
event: e,
|
|
264
|
+
...t
|
|
265
|
+
};
|
|
266
|
+
G() && window.dataLayer.push(n);
|
|
267
|
+
}
|
|
268
|
+
function j(e) {
|
|
269
|
+
o("gengage-on-init", { gengage_widget: e });
|
|
270
|
+
}
|
|
271
|
+
function A(e) {
|
|
272
|
+
o("gengage-show", { gengage_widget: e });
|
|
273
|
+
}
|
|
274
|
+
function H(e) {
|
|
275
|
+
o("gengage-hide", { gengage_widget: e });
|
|
276
|
+
}
|
|
277
|
+
function V(e, t) {
|
|
278
|
+
o("gengage-suggested-question", {
|
|
279
|
+
gengage_question_title: e,
|
|
280
|
+
gengage_action_type: t
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
function ye(e) {
|
|
284
|
+
o("gengage-find-similars", { gengage_sku: e });
|
|
285
|
+
}
|
|
286
|
+
function ve(e) {
|
|
287
|
+
o("gengage-compare-preselection", { gengage_sku: e });
|
|
288
|
+
}
|
|
289
|
+
function xe(e) {
|
|
290
|
+
o("gengage-compare-selected", {
|
|
291
|
+
gengage_skus: e,
|
|
292
|
+
gengage_product_count: e.length
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
function _e() {
|
|
296
|
+
o("gengage-compare-clear");
|
|
297
|
+
}
|
|
298
|
+
function Se(e) {
|
|
299
|
+
o("gengage-compare-received", { gengage_product_count: e });
|
|
300
|
+
}
|
|
301
|
+
function ke(e) {
|
|
302
|
+
o("gengage-like-product", { gengage_sku: e });
|
|
303
|
+
}
|
|
304
|
+
function Ce() {
|
|
305
|
+
o("gengage-like-list");
|
|
306
|
+
}
|
|
307
|
+
function Ae(e, t) {
|
|
308
|
+
o("gengage-search", {
|
|
309
|
+
gengage_search_query: e,
|
|
310
|
+
gengage_result_count: t
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
function Te(e, t) {
|
|
314
|
+
o("gengage-product-detail", {
|
|
315
|
+
gengage_sku: e,
|
|
316
|
+
gengage_product_name: t
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
function Q(e, t) {
|
|
320
|
+
o("gengage-similar-product-click", {
|
|
321
|
+
gengage_sku: e,
|
|
322
|
+
...t?.url !== void 0 ? { gengage_product_url: t.url } : {},
|
|
323
|
+
...t?.name !== void 0 ? { gengage_product_name: t.name } : {},
|
|
324
|
+
...t?.session_id !== void 0 ? { gengage_session_id: t.session_id } : {}
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
function Y(e, t) {
|
|
328
|
+
o("gengage-similar-grouping-click", {
|
|
329
|
+
gengage_grouping_label: e,
|
|
330
|
+
gengage_grouping_index: t
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
function J(e) {
|
|
334
|
+
o("gengage-similar-products-impression", {
|
|
335
|
+
gengage_source_sku: e.source_sku,
|
|
336
|
+
gengage_product_count: e.product_count,
|
|
337
|
+
gengage_grouped: e.grouped,
|
|
338
|
+
...e.session_id !== void 0 ? { gengage_session_id: e.session_id } : {}
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
function Ee(e) {
|
|
342
|
+
o("gengage-compare-product", {
|
|
343
|
+
gengage_skus: e,
|
|
344
|
+
gengage_product_count: e.length
|
|
345
|
+
});
|
|
346
|
+
}
|
|
347
|
+
function Le() {
|
|
348
|
+
o("gengage-chatbot-maximized");
|
|
349
|
+
}
|
|
350
|
+
function X(e) {
|
|
351
|
+
o("gengage-interface-not-ready", {
|
|
352
|
+
...e?.reason !== void 0 ? { gengage_reason: e.reason } : {},
|
|
353
|
+
...e?.attempts !== void 0 ? { gengage_attempts: e.attempts } : {},
|
|
354
|
+
...e?.message !== void 0 ? { gengage_message: e.message } : {}
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
function K(e, t) {
|
|
358
|
+
o("gengage-cart-add", {
|
|
359
|
+
gengage_sku: e,
|
|
360
|
+
gengage_quantity: t
|
|
361
|
+
});
|
|
362
|
+
}
|
|
363
|
+
function Ie() {
|
|
364
|
+
o("gengage-message-sent");
|
|
365
|
+
}
|
|
366
|
+
function Ne() {
|
|
367
|
+
o("gengage-message-received");
|
|
368
|
+
}
|
|
369
|
+
function Oe() {
|
|
370
|
+
o("gengage-conversation-start");
|
|
371
|
+
}
|
|
372
|
+
function Z() {
|
|
373
|
+
o("gengage-voice-input");
|
|
374
|
+
}
|
|
375
|
+
function ee(e, t) {
|
|
376
|
+
o("gengage-error", {
|
|
377
|
+
gengage_widget: e,
|
|
378
|
+
gengage_error: t
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
var b = null;
|
|
382
|
+
function Re() {
|
|
383
|
+
if (typeof window > "u") return () => {
|
|
384
|
+
};
|
|
385
|
+
if (b) return b;
|
|
386
|
+
const e = [];
|
|
387
|
+
function t(n, r) {
|
|
388
|
+
const a = (i) => r(i.detail);
|
|
389
|
+
window.addEventListener(n, a), e.push(() => window.removeEventListener(n, a));
|
|
390
|
+
}
|
|
391
|
+
return t("gengage:chat:open", () => A("chat")), t("gengage:chat:close", () => H("chat")), t("gengage:chat:ready", () => j("chat")), t("gengage:similar:add-to-cart", ({ sku: n, quantity: r }) => {
|
|
392
|
+
K(n, r);
|
|
393
|
+
}), t("gengage:similar:product-click", ({ sku: n, url: r, sessionId: a, productName: i }) => {
|
|
394
|
+
const u = {
|
|
395
|
+
url: r,
|
|
396
|
+
session_id: a
|
|
397
|
+
};
|
|
398
|
+
i !== void 0 && i !== "" && (u.name = i), Q(n, u);
|
|
399
|
+
}), t("gengage:similar:grouping-click", ({ grouping_label: n, grouping_index: r }) => {
|
|
400
|
+
Y(n, r);
|
|
401
|
+
}), t("gengage:similar:products-impression", ({ source_sku: n, product_count: r, grouped: a, sessionId: i }) => {
|
|
402
|
+
J({
|
|
403
|
+
source_sku: n,
|
|
404
|
+
product_count: r,
|
|
405
|
+
grouped: a,
|
|
406
|
+
session_id: i
|
|
407
|
+
});
|
|
408
|
+
}), t("gengage:qna:action", ({ title: n, type: r }) => {
|
|
409
|
+
V(n, r);
|
|
410
|
+
}), t("gengage:chat:voice", () => Z()), t("gengage:qna:open-chat", () => A("chat")), t("gengage:global:error", ({ source: n, message: r }) => {
|
|
411
|
+
ee(n, r);
|
|
412
|
+
}), b = () => {
|
|
413
|
+
for (const n of e) n();
|
|
414
|
+
e.length = 0, b = null;
|
|
415
|
+
}, b;
|
|
416
|
+
}
|
|
417
|
+
function Pe(e, t) {
|
|
418
|
+
window.dispatchEvent(new CustomEvent(e, {
|
|
419
|
+
detail: t,
|
|
420
|
+
bubbles: !1
|
|
421
|
+
}));
|
|
422
|
+
}
|
|
423
|
+
function y(e, t) {
|
|
424
|
+
const n = (r) => {
|
|
425
|
+
t(r.detail);
|
|
426
|
+
};
|
|
427
|
+
return window.addEventListener(e, n), () => window.removeEventListener(e, n);
|
|
428
|
+
}
|
|
429
|
+
function T(e) {
|
|
430
|
+
if (e.type !== "user_message" && e.type !== "inputText") return null;
|
|
431
|
+
if (typeof e.payload == "string" && e.payload.trim().length > 0) return e.payload.trim();
|
|
432
|
+
if (typeof e.payload == "object" && e.payload !== null) {
|
|
433
|
+
const t = e.payload;
|
|
434
|
+
if (typeof t.text == "string") {
|
|
435
|
+
const n = t.text.trim();
|
|
436
|
+
if (n.length > 0) return n;
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
return typeof e.title == "string" && e.title.trim().length > 0 ? e.title.trim() : null;
|
|
440
|
+
}
|
|
441
|
+
function te(e) {
|
|
442
|
+
if (e.type !== "inputText" && e.type !== "user_message") return e;
|
|
443
|
+
const t = typeof e.payload == "string" ? { text: e.payload.trim() } : e.payload != null && typeof e.payload == "object" && !Array.isArray(e.payload) ? { ...e.payload } : {};
|
|
444
|
+
if (typeof t.text != "string" || !t.text.trim()) {
|
|
445
|
+
const n = e.title?.trim();
|
|
446
|
+
n && (t.text = n);
|
|
447
|
+
}
|
|
448
|
+
return "is_launcher" in t || (t.is_launcher = 1), "is_suggested_text" in t || (t.is_suggested_text = 1), {
|
|
449
|
+
...e,
|
|
450
|
+
payload: t
|
|
451
|
+
};
|
|
452
|
+
}
|
|
453
|
+
function Me(e) {
|
|
454
|
+
let t = !1;
|
|
455
|
+
const n = [];
|
|
456
|
+
let r = 0, a = null, i = 0;
|
|
457
|
+
const u = 500, f = 10;
|
|
458
|
+
function s() {
|
|
459
|
+
return window.gengage?.chat ?? null;
|
|
460
|
+
}
|
|
461
|
+
function c() {
|
|
462
|
+
t || (console.warn("[gengage] QNA tried to open chat, but chat widget is not initialized. Ensure GengageChat is initialized before calling wireQNAToChat()."), t = !0), e?.onChatUnavailable?.();
|
|
463
|
+
}
|
|
464
|
+
function h(g, l) {
|
|
465
|
+
const w = l.type === "inputText" || l.type === "user_message";
|
|
466
|
+
if (w && T(l) === null) return;
|
|
467
|
+
if (g.openWithAction) {
|
|
468
|
+
const D = w ? te(l) : l;
|
|
469
|
+
g.openWithAction(D);
|
|
470
|
+
return;
|
|
471
|
+
}
|
|
472
|
+
const k = T(l);
|
|
473
|
+
if (k && g.sendMessage) {
|
|
474
|
+
g.open?.(), g.sendMessage(k);
|
|
475
|
+
return;
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
function v() {
|
|
479
|
+
a !== null && (window.clearInterval(a), a = null);
|
|
480
|
+
}
|
|
481
|
+
function R() {
|
|
482
|
+
const g = s();
|
|
483
|
+
if (!g) return !1;
|
|
484
|
+
if (r > 0 && (g.open?.(), r = 0), n.length > 0) {
|
|
485
|
+
const l = n.splice(0, n.length);
|
|
486
|
+
for (const w of l) h(g, w);
|
|
487
|
+
}
|
|
488
|
+
return v(), !0;
|
|
489
|
+
}
|
|
490
|
+
function S() {
|
|
491
|
+
a === null && (i = 0, a = window.setInterval(() => {
|
|
492
|
+
R() || (i += 1, i >= f && ((n.length > 0 || r > 0) && X({
|
|
493
|
+
reason: "chat_unavailable_after_poll",
|
|
494
|
+
attempts: f
|
|
495
|
+
}), n.length = 0, r = 0, v()));
|
|
496
|
+
}, u));
|
|
497
|
+
}
|
|
498
|
+
const P = y("gengage:qna:action", (g) => {
|
|
499
|
+
const l = s();
|
|
500
|
+
if (l) {
|
|
501
|
+
h(l, g);
|
|
502
|
+
return;
|
|
503
|
+
}
|
|
504
|
+
c(), n.length >= 20 && n.shift(), n.push(g), S();
|
|
505
|
+
}), M = y("gengage:qna:open-chat", () => {
|
|
506
|
+
const g = s();
|
|
507
|
+
if (g) {
|
|
508
|
+
g.open?.();
|
|
509
|
+
return;
|
|
510
|
+
}
|
|
511
|
+
c(), r += 1, S();
|
|
512
|
+
});
|
|
513
|
+
return () => {
|
|
514
|
+
P(), M(), n.length = 0, r = 0, v();
|
|
515
|
+
};
|
|
516
|
+
}
|
|
517
|
+
function De() {
|
|
518
|
+
return y("gengage:similar:product-click", ({ sku: e, url: t, sessionId: n }) => {
|
|
519
|
+
n && window.gengage?.chat?.saveSession(n, e), O(t) && (window.location.href = t);
|
|
520
|
+
});
|
|
521
|
+
}
|
|
522
|
+
function ne() {
|
|
523
|
+
const e = window.__gengageSessionId ?? sessionStorage.getItem("gengage_session_id") ?? null ?? crypto.randomUUID();
|
|
524
|
+
return window.__gengageSessionId = e, sessionStorage.setItem("gengage_session_id", e), window.gengage || (window.gengage = {}), window.gengage.sessionId = e, e;
|
|
525
|
+
}
|
|
526
|
+
function Ue() {
|
|
527
|
+
return window.gengage?.pageContext ?? null;
|
|
528
|
+
}
|
|
529
|
+
function We(e) {
|
|
530
|
+
window.gengage || (window.gengage = {}), window.gengage.pageContext = {
|
|
531
|
+
pageType: "other",
|
|
532
|
+
...window.gengage.pageContext,
|
|
533
|
+
...e
|
|
534
|
+
}, window.dispatchEvent(new CustomEvent("gengage:context:update", { detail: e }));
|
|
535
|
+
}
|
|
536
|
+
function ze(e) {
|
|
537
|
+
return {
|
|
538
|
+
sessionId: e?.sessionId ?? ne(),
|
|
539
|
+
...e
|
|
540
|
+
};
|
|
541
|
+
}
|
|
542
|
+
var d = {
|
|
543
|
+
primaryColor: "#b7102a",
|
|
544
|
+
primaryForeground: "#ffffff",
|
|
545
|
+
backgroundColor: "#ffffff",
|
|
546
|
+
foregroundColor: "#111827",
|
|
547
|
+
borderRadius: "0.75rem",
|
|
548
|
+
fontFamily: '"Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
|
|
549
|
+
fontSize: "14px",
|
|
550
|
+
zIndex: "1000",
|
|
551
|
+
"--glov-chatbot-width": "420px",
|
|
552
|
+
"--glov-left-spacing": "260px",
|
|
553
|
+
"--chatbot-padding": "16px",
|
|
554
|
+
"--root-wrapper-background-color": "#f8f9fa",
|
|
555
|
+
"--root-wrapper-border-color": "#edeeef",
|
|
556
|
+
"--gengage-chat-width": "400px",
|
|
557
|
+
"--gengage-chat-shell-radius": "1rem",
|
|
558
|
+
"--gengage-chat-header-height": "72px",
|
|
559
|
+
"--gengage-chat-conversation-width": "396px",
|
|
560
|
+
"--gengage-chat-panel-min-width": "320px",
|
|
561
|
+
"--gengage-chat-panel-max-width": "1200px",
|
|
562
|
+
"--gengage-chat-input-height": "48px",
|
|
563
|
+
"--gengage-qna-pill-radius": "999px",
|
|
564
|
+
"--gengage-qna-input-radius": "0.75rem",
|
|
565
|
+
"--gengage-simrel-card-radius": "0.75rem",
|
|
566
|
+
"--client-primary": "#b7102a",
|
|
567
|
+
"--client-primary-hover": "color-mix(in srgb, #b7102a 88%, black 12%)",
|
|
568
|
+
"--client-primary-active": "color-mix(in srgb, #b7102a 78%, black 22%)",
|
|
569
|
+
"--client-primary-subtle": "color-mix(in srgb, #b7102a 12%, white)",
|
|
570
|
+
"--client-primary-soft": "color-mix(in srgb, #b7102a 20%, white)",
|
|
571
|
+
"--client-on-primary": "#ffffff",
|
|
572
|
+
"--client-focus-ring": "color-mix(in srgb, #b7102a 32%, transparent)",
|
|
573
|
+
"--surface-page": "#f6f7fb",
|
|
574
|
+
"--surface-shell": "#10131a",
|
|
575
|
+
"--surface-card": "#ffffff",
|
|
576
|
+
"--surface-card-muted": "#f8fafc",
|
|
577
|
+
"--surface-card-soft": "#f8fafc",
|
|
578
|
+
"--surface-elevated": "#ffffff",
|
|
579
|
+
"--surface-input": "#ffffff",
|
|
580
|
+
"--surface-overlay": "rgba(16, 19, 26, 0.52)",
|
|
581
|
+
"--text-primary": "#111827",
|
|
582
|
+
"--text-secondary": "#4b5563",
|
|
583
|
+
"--text-muted": "#6b7280",
|
|
584
|
+
"--text-inverse": "#f9fafb",
|
|
585
|
+
"--border-subtle": "rgba(17, 24, 39, 0.06)",
|
|
586
|
+
"--border-default": "rgba(17, 24, 39, 0.10)",
|
|
587
|
+
"--border-strong": "rgba(17, 24, 39, 0.18)",
|
|
588
|
+
"--shadow-1": "0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06)",
|
|
589
|
+
"--shadow-2": "0 4px 12px rgba(16, 24, 40, 0.08)",
|
|
590
|
+
"--shadow-3": "0 10px 24px rgba(16, 24, 40, 0.12)",
|
|
591
|
+
"--radius-control": "12px",
|
|
592
|
+
"--radius-card": "16px",
|
|
593
|
+
"--radius-panel": "24px",
|
|
594
|
+
"--radius-pill": "999px",
|
|
595
|
+
"--success": "#16a34a",
|
|
596
|
+
"--warning": "#d97706",
|
|
597
|
+
"--error": "#dc2626",
|
|
598
|
+
"--info": "#2563eb",
|
|
599
|
+
"--rating": "#f5b301",
|
|
600
|
+
"--gengage-brand-accent-start": "#0b24d6",
|
|
601
|
+
"--gengage-brand-accent-mid": "#f768f2",
|
|
602
|
+
"--gengage-brand-accent-end": "#ffed74",
|
|
603
|
+
"--ai-accent-start": "#0b24d6",
|
|
604
|
+
"--ai-accent-end": "#f768f2",
|
|
605
|
+
"--ai-accent-soft": "linear-gradient(135deg, rgba(11, 36, 214, 0.08), rgba(247, 104, 242, 0.08))"
|
|
606
|
+
};
|
|
607
|
+
function $e(e) {
|
|
608
|
+
return {
|
|
609
|
+
...d,
|
|
610
|
+
...e
|
|
611
|
+
};
|
|
612
|
+
}
|
|
613
|
+
var p = "gengage-global-toast-root", E = "gengage-global-toast-style", _ = "gengage-global-toast-root--visible", re = 4200, ae = 1500, oe = 15e3, ie = [
|
|
614
|
+
"--gengage-font-family",
|
|
615
|
+
"--surface-card",
|
|
616
|
+
"--text-primary",
|
|
617
|
+
"--text-muted",
|
|
618
|
+
"--border-default",
|
|
619
|
+
"--radius-card",
|
|
620
|
+
"--shadow-3",
|
|
621
|
+
"--error",
|
|
622
|
+
"--ds-toast-error-bg",
|
|
623
|
+
"--ds-toast-error-border",
|
|
624
|
+
"--ds-toast-error-accent",
|
|
625
|
+
"--ds-toast-error-fg",
|
|
626
|
+
"--ds-toast-error-shadow"
|
|
627
|
+
], L = !1, m = null, se = [
|
|
628
|
+
/failed to fetch/i,
|
|
629
|
+
/networkerror/i,
|
|
630
|
+
/network request failed/i,
|
|
631
|
+
/load failed/i,
|
|
632
|
+
/err_network/i,
|
|
633
|
+
/fetch failed/i,
|
|
634
|
+
/network error/i
|
|
635
|
+
];
|
|
636
|
+
function I(e) {
|
|
637
|
+
return typeof e == "string" && e.toLowerCase().startsWith("tr");
|
|
638
|
+
}
|
|
639
|
+
function ge(e) {
|
|
640
|
+
if (typeof navigator < "u" && navigator.onLine === !1) return !0;
|
|
641
|
+
const t = (e instanceof Error ? e.message : typeof e == "string" ? e : "").trim();
|
|
642
|
+
return t ? se.some((n) => n.test(t)) : !1;
|
|
643
|
+
}
|
|
644
|
+
function qe(e, t) {
|
|
645
|
+
return ge(t) ? I(e) ? "Bağlantı sorunu oluştu. Lütfen tekrar deneyin." : "Connection issue. Please try again." : I(e) ? "Bir hata oluştu. Lütfen tekrar deneyin." : "Something went wrong. Please try again.";
|
|
646
|
+
}
|
|
647
|
+
function Fe() {
|
|
648
|
+
L || typeof window > "u" || typeof document > "u" || (L = !0, y("gengage:global:error", (e) => {
|
|
649
|
+
ce(e);
|
|
650
|
+
}));
|
|
651
|
+
}
|
|
652
|
+
function ce(e) {
|
|
653
|
+
if (typeof document > "u") return;
|
|
654
|
+
const t = e.message.trim();
|
|
655
|
+
if (!t) return;
|
|
656
|
+
me();
|
|
657
|
+
const n = ue();
|
|
658
|
+
fe(n), n.innerHTML = "";
|
|
659
|
+
const r = document.createElement("section");
|
|
660
|
+
r.className = "gengage-global-toast gengage-global-toast--error", r.setAttribute("role", "status"), r.setAttribute("aria-live", "polite");
|
|
661
|
+
const a = document.createElement("div");
|
|
662
|
+
a.className = "gengage-global-toast-title", a.textContent = de(e.source);
|
|
663
|
+
const i = document.createElement("div");
|
|
664
|
+
i.className = "gengage-global-toast-message", i.textContent = t, r.appendChild(a), r.appendChild(i), n.appendChild(r), n.classList.add(_), m && (clearTimeout(m), m = null), e.sticky !== !0 && (m = setTimeout(() => {
|
|
665
|
+
le();
|
|
666
|
+
}, pe(e.durationMs)));
|
|
667
|
+
}
|
|
668
|
+
function le() {
|
|
669
|
+
if (typeof document > "u") return;
|
|
670
|
+
const e = document.getElementById(p);
|
|
671
|
+
e && (e.classList.remove(_), e.innerHTML = "", m && (clearTimeout(m), m = null));
|
|
672
|
+
}
|
|
673
|
+
function de(e) {
|
|
674
|
+
switch (e) {
|
|
675
|
+
case "chat":
|
|
676
|
+
return "Chat warning";
|
|
677
|
+
case "qna":
|
|
678
|
+
return "QnA warning";
|
|
679
|
+
case "simrel":
|
|
680
|
+
return "Widget warning";
|
|
681
|
+
default:
|
|
682
|
+
return "Connection warning";
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
function ue() {
|
|
686
|
+
const e = document.getElementById(p);
|
|
687
|
+
if (e instanceof HTMLElement) return e;
|
|
688
|
+
const t = document.createElement("div");
|
|
689
|
+
return t.id = p, t.className = "gengage-global-toast-root", document.body.appendChild(t), t;
|
|
690
|
+
}
|
|
691
|
+
function fe(e) {
|
|
692
|
+
if (typeof document > "u" || typeof window > "u") return;
|
|
693
|
+
const t = document.querySelector(".gengage-chat-root, .gengage-qna-container, .gengage-simrel-container, .gengage-simbut-root");
|
|
694
|
+
if (!t) return;
|
|
695
|
+
const n = window.getComputedStyle(t);
|
|
696
|
+
for (const r of ie) {
|
|
697
|
+
const a = n.getPropertyValue(r).trim();
|
|
698
|
+
a ? e.style.setProperty(r, a) : e.style.removeProperty(r);
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
function pe(e) {
|
|
702
|
+
return typeof e != "number" || !Number.isFinite(e) ? re : Math.min(oe, Math.max(ae, Math.round(e)));
|
|
703
|
+
}
|
|
704
|
+
function me() {
|
|
705
|
+
if (document.getElementById(E)) return;
|
|
706
|
+
const e = document.createElement("style");
|
|
707
|
+
e.id = E;
|
|
708
|
+
const t = d["--surface-card"] ?? d.backgroundColor ?? "#ffffff", n = d["--text-primary"] ?? d.foregroundColor ?? "#111827", r = d["--border-default"] ?? "rgba(17, 24, 39, 0.10)", a = d["--error"] ?? "#dc2626", i = d["--shadow-3"] ?? "0 10px 24px rgba(16, 24, 40, 0.12)", u = d["--radius-card"] ?? "16px", f = d["--text-muted"] ?? "#6b7280";
|
|
709
|
+
e.textContent = `
|
|
710
|
+
#${p} {
|
|
711
|
+
position: fixed;
|
|
712
|
+
top: 16px;
|
|
713
|
+
right: 16px;
|
|
714
|
+
z-index: 2147483646;
|
|
715
|
+
pointer-events: none;
|
|
716
|
+
}
|
|
717
|
+
#${p}.${_} {
|
|
718
|
+
pointer-events: auto;
|
|
719
|
+
}
|
|
720
|
+
#${p} .gengage-global-toast {
|
|
721
|
+
min-width: 260px;
|
|
722
|
+
max-width: min(92vw, 420px);
|
|
723
|
+
border-radius: var(--radius-card, ${u});
|
|
724
|
+
border: 1px solid var(--ds-toast-error-border, color-mix(in srgb, var(--error, ${a}) 18%, var(--border-default, ${r})));
|
|
725
|
+
border-left: 4px solid var(--ds-toast-error-accent, var(--error, ${a}));
|
|
726
|
+
background: var(--ds-toast-error-bg, color-mix(in srgb, var(--error, ${a}) 5%, var(--surface-card, ${t})));
|
|
727
|
+
color: var(--ds-toast-error-fg, color-mix(in srgb, var(--error, ${a}) 22%, var(--text-primary, ${n})));
|
|
728
|
+
box-shadow: var(--ds-toast-error-shadow, var(--shadow-3, ${i}));
|
|
729
|
+
padding: 10px 12px;
|
|
730
|
+
font-family: var(--gengage-font-family, ${JSON.stringify(d.fontFamily ?? '-apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif')});
|
|
731
|
+
font-size: 13px;
|
|
732
|
+
line-height: 1.4;
|
|
733
|
+
animation: gengage-global-toast-in 180ms ease-out forwards;
|
|
734
|
+
}
|
|
735
|
+
#${p} .gengage-global-toast-title {
|
|
736
|
+
margin: 0 0 4px;
|
|
737
|
+
font-size: 12px;
|
|
738
|
+
font-weight: 700;
|
|
739
|
+
color: var(--text-muted, ${f});
|
|
740
|
+
}
|
|
741
|
+
#${p} .gengage-global-toast-message {
|
|
742
|
+
margin: 0;
|
|
743
|
+
font-weight: 500;
|
|
744
|
+
}
|
|
745
|
+
@keyframes gengage-global-toast-in {
|
|
746
|
+
from {
|
|
747
|
+
opacity: 0;
|
|
748
|
+
transform: translateY(-8px);
|
|
749
|
+
}
|
|
750
|
+
to {
|
|
751
|
+
opacity: 1;
|
|
752
|
+
transform: translateY(0);
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
`, document.head.appendChild(e);
|
|
756
|
+
}
|
|
757
|
+
export {
|
|
758
|
+
Ie as A,
|
|
759
|
+
we as B,
|
|
760
|
+
Oe as C,
|
|
761
|
+
Ce as D,
|
|
762
|
+
X as E,
|
|
763
|
+
Z as F,
|
|
764
|
+
Re as I,
|
|
765
|
+
he as L,
|
|
766
|
+
Ae as M,
|
|
767
|
+
A as N,
|
|
768
|
+
ke as O,
|
|
769
|
+
V as P,
|
|
770
|
+
O as R,
|
|
771
|
+
xe as S,
|
|
772
|
+
j as T,
|
|
773
|
+
Le as _,
|
|
774
|
+
ce as a,
|
|
775
|
+
Ee as b,
|
|
776
|
+
ne as c,
|
|
777
|
+
We as d,
|
|
778
|
+
Pe as f,
|
|
779
|
+
K as g,
|
|
780
|
+
De as h,
|
|
781
|
+
Fe as i,
|
|
782
|
+
Te as j,
|
|
783
|
+
Ne as k,
|
|
784
|
+
Ue as l,
|
|
785
|
+
Me as m,
|
|
786
|
+
qe as n,
|
|
787
|
+
d as o,
|
|
788
|
+
y as p,
|
|
789
|
+
ge as r,
|
|
790
|
+
$e as s,
|
|
791
|
+
le as t,
|
|
792
|
+
ze as u,
|
|
793
|
+
_e as v,
|
|
794
|
+
ye as w,
|
|
795
|
+
Se as x,
|
|
796
|
+
ve as y,
|
|
797
|
+
be as z
|
|
798
|
+
};
|