@gengage/assistant-fe 0.4.4 → 0.4.6
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/README.md +1 -1
- package/dist/api-paths-C4GDpeTf.js +1214 -0
- package/dist/chat/index.d.ts +1 -374
- package/dist/chat/runtime.d.ts +374 -0
- package/dist/chat/types.d.ts +1 -1
- package/dist/chat-BRKK63lt.js +303 -0
- package/dist/chat-runtime.js +13 -0
- package/dist/chat.iife.js +7 -7
- package/dist/chat.js +11 -10
- package/dist/common/config-constants.d.ts +1 -0
- package/dist/common/config-schema.d.ts +0 -1
- package/dist/common/overlay.d.ts +4 -4
- package/dist/common-CEN5OW7E.js +491 -0
- package/dist/common.js +78 -76
- package/dist/{connection-warning-n88bjkqL.js → connection-warning-B6oIU-9s.js} +1 -1
- package/dist/context-VIG4SVcS.js +529 -0
- package/dist/index.js +70 -67
- package/dist/locale-CfqNifrU.js +7 -0
- package/dist/native-webview-DudQ7nHe.js +273 -0
- package/dist/native.iife.js +28 -91
- package/dist/native.js +1 -1
- package/dist/overlay-1EO41ZC7.js +212 -0
- package/dist/overlay.d.ts +4 -0
- package/dist/overlay.js +10 -0
- package/dist/pill-launcher-57nrdLRr.js +364 -0
- package/dist/qna/index.d.ts +1 -61
- package/dist/qna/runtime.d.ts +61 -0
- package/dist/qna-BNvttR6s.js +40 -0
- package/dist/qna-runtime.js +8 -0
- package/dist/qna.iife.js +4 -4
- package/dist/qna.js +6 -5
- package/dist/{simrel-K2TGFi1r.js → runtime-BdwZZIrO.js} +244 -293
- package/dist/{chat-DI7Vm0gh.js → runtime-C0qZk0y7.js} +1644 -2298
- package/dist/{qna-C5Ok3wd0.js → runtime-DDu8Wk0z.js} +87 -121
- package/dist/schemas-CLo8wCjs.js +3207 -0
- package/dist/{simbut-Cb5RfaAp.js → simbut-BMWC6x_t.js} +24 -22
- package/dist/simbut.js +1 -1
- package/dist/simrel/index.d.ts +1 -59
- package/dist/simrel/runtime.d.ts +59 -0
- package/dist/simrel-ohfkluhp.js +55 -0
- package/dist/simrel-runtime.js +8 -0
- package/dist/simrel.iife.js +4 -4
- package/dist/simrel.js +7 -6
- package/dist/widget-base-TgwiA8cD.js +578 -0
- package/package.json +17 -1
- package/dist/common-BxSi3UWt.js +0 -387
- package/dist/locale-MM0U5eeR.js +0 -1109
- package/dist/native-webview-DFqnyus6.js +0 -586
- package/dist/schemas-JpRGzRQT.js +0 -4419
- /package/dist/{price-formatter-CR6VT5z4.js → price-formatter-xI3g9Cd4.js} +0 -0
package/dist/locale-MM0U5eeR.js
DELETED
|
@@ -1,1109 +0,0 @@
|
|
|
1
|
-
function Ee(e, t) {
|
|
2
|
-
const i = {
|
|
3
|
-
event_name: "stream.start",
|
|
4
|
-
account_id: e.account_id,
|
|
5
|
-
session_id: e.session_id,
|
|
6
|
-
correlation_id: e.correlation_id,
|
|
7
|
-
payload: {
|
|
8
|
-
endpoint: t.endpoint,
|
|
9
|
-
request_id: t.request_id
|
|
10
|
-
}
|
|
11
|
-
};
|
|
12
|
-
return e.view_id !== void 0 && (i.view_id = e.view_id), e.user_id !== void 0 && (i.user_id = e.user_id), t.widget !== void 0 && (i.widget = t.widget), e.page_type !== void 0 && (i.page_type = e.page_type), e.sku !== void 0 && (i.sku = e.sku), i;
|
|
13
|
-
}
|
|
14
|
-
function Te(e, t) {
|
|
15
|
-
const i = {
|
|
16
|
-
request_id: t.request_id,
|
|
17
|
-
chunk_index: t.chunk_index
|
|
18
|
-
};
|
|
19
|
-
t.latency_ms !== void 0 && (i.latency_ms = t.latency_ms);
|
|
20
|
-
const n = {
|
|
21
|
-
event_name: "stream.chunk",
|
|
22
|
-
account_id: e.account_id,
|
|
23
|
-
session_id: e.session_id,
|
|
24
|
-
correlation_id: e.correlation_id,
|
|
25
|
-
payload: i
|
|
26
|
-
};
|
|
27
|
-
return e.view_id !== void 0 && (n.view_id = e.view_id), e.user_id !== void 0 && (n.user_id = e.user_id), t.widget !== void 0 && (n.widget = t.widget), e.page_type !== void 0 && (n.page_type = e.page_type), e.sku !== void 0 && (n.sku = e.sku), n;
|
|
28
|
-
}
|
|
29
|
-
function Ae(e, t) {
|
|
30
|
-
const i = {
|
|
31
|
-
event_name: "stream.ui_spec",
|
|
32
|
-
account_id: e.account_id,
|
|
33
|
-
session_id: e.session_id,
|
|
34
|
-
correlation_id: e.correlation_id,
|
|
35
|
-
payload: {
|
|
36
|
-
request_id: t.request_id,
|
|
37
|
-
chunk_index: t.chunk_index,
|
|
38
|
-
component_type: t.component_type
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
return e.view_id !== void 0 && (i.view_id = e.view_id), e.user_id !== void 0 && (i.user_id = e.user_id), t.widget !== void 0 && (i.widget = t.widget), e.page_type !== void 0 && (i.page_type = e.page_type), e.sku !== void 0 && (i.sku = e.sku), i;
|
|
42
|
-
}
|
|
43
|
-
function Ie(e, t) {
|
|
44
|
-
const i = {
|
|
45
|
-
event_name: "stream.done",
|
|
46
|
-
account_id: e.account_id,
|
|
47
|
-
session_id: e.session_id,
|
|
48
|
-
correlation_id: e.correlation_id,
|
|
49
|
-
payload: {
|
|
50
|
-
request_id: t.request_id,
|
|
51
|
-
latency_ms: t.latency_ms,
|
|
52
|
-
chunk_count: t.chunk_count
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
return e.view_id !== void 0 && (i.view_id = e.view_id), e.user_id !== void 0 && (i.user_id = e.user_id), t.widget !== void 0 && (i.widget = t.widget), e.page_type !== void 0 && (i.page_type = e.page_type), e.sku !== void 0 && (i.sku = e.sku), i;
|
|
56
|
-
}
|
|
57
|
-
function Le(e, t) {
|
|
58
|
-
const i = {
|
|
59
|
-
event_name: "stream.error",
|
|
60
|
-
account_id: e.account_id,
|
|
61
|
-
session_id: e.session_id,
|
|
62
|
-
correlation_id: e.correlation_id,
|
|
63
|
-
payload: {
|
|
64
|
-
request_id: t.request_id,
|
|
65
|
-
error_code: t.error_code,
|
|
66
|
-
error_message: t.error_message
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
return e.view_id !== void 0 && (i.view_id = e.view_id), e.user_id !== void 0 && (i.user_id = e.user_id), t.widget !== void 0 && (i.widget = t.widget), e.page_type !== void 0 && (i.page_type = e.page_type), e.sku !== void 0 && (i.sku = e.sku), i;
|
|
70
|
-
}
|
|
71
|
-
function Me(e, t) {
|
|
72
|
-
const i = {
|
|
73
|
-
model: t.model,
|
|
74
|
-
prompt_tokens: t.prompt_tokens,
|
|
75
|
-
completion_tokens: t.completion_tokens,
|
|
76
|
-
total_tokens: t.total_tokens
|
|
77
|
-
};
|
|
78
|
-
t.provider !== void 0 && (i.provider = t.provider);
|
|
79
|
-
const n = {
|
|
80
|
-
event_name: "llm.usage",
|
|
81
|
-
account_id: e.account_id,
|
|
82
|
-
session_id: e.session_id,
|
|
83
|
-
correlation_id: e.correlation_id,
|
|
84
|
-
payload: i
|
|
85
|
-
};
|
|
86
|
-
return e.view_id !== void 0 && (n.view_id = e.view_id), e.user_id !== void 0 && (n.user_id = e.user_id), e.page_type !== void 0 && (n.page_type = e.page_type), e.sku !== void 0 && (n.sku = e.sku), n;
|
|
87
|
-
}
|
|
88
|
-
function qe(e, t) {
|
|
89
|
-
const i = {
|
|
90
|
-
event_name: "metering.increment",
|
|
91
|
-
account_id: e.account_id,
|
|
92
|
-
session_id: e.session_id,
|
|
93
|
-
correlation_id: e.correlation_id,
|
|
94
|
-
payload: {
|
|
95
|
-
meter_key: t.meter_key,
|
|
96
|
-
quantity: t.quantity,
|
|
97
|
-
unit: t.unit
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
return e.view_id !== void 0 && (i.view_id = e.view_id), e.user_id !== void 0 && (i.user_id = e.user_id), e.page_type !== void 0 && (i.page_type = e.page_type), e.sku !== void 0 && (i.sku = e.sku), i;
|
|
101
|
-
}
|
|
102
|
-
function U(e, t) {
|
|
103
|
-
const i = {
|
|
104
|
-
event_name: "metering.summary",
|
|
105
|
-
account_id: e.account_id,
|
|
106
|
-
session_id: e.session_id,
|
|
107
|
-
correlation_id: e.correlation_id,
|
|
108
|
-
payload: {
|
|
109
|
-
meter_key: t.meter_key,
|
|
110
|
-
quantity: t.quantity,
|
|
111
|
-
unit: t.unit
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
|
-
return e.view_id !== void 0 && (i.view_id = e.view_id), e.user_id !== void 0 && (i.user_id = e.user_id), e.page_type !== void 0 && (i.page_type = e.page_type), e.sku !== void 0 && (i.sku = e.sku), i;
|
|
115
|
-
}
|
|
116
|
-
function Re(e, t) {
|
|
117
|
-
const i = {
|
|
118
|
-
event_name: "chat.history.snapshot",
|
|
119
|
-
account_id: e.account_id,
|
|
120
|
-
session_id: e.session_id,
|
|
121
|
-
correlation_id: e.correlation_id,
|
|
122
|
-
payload: {
|
|
123
|
-
message_count: t.message_count,
|
|
124
|
-
history_ref: t.history_ref,
|
|
125
|
-
redaction_level: t.redaction_level
|
|
126
|
-
}
|
|
127
|
-
};
|
|
128
|
-
return e.view_id !== void 0 && (i.view_id = e.view_id), e.user_id !== void 0 && (i.user_id = e.user_id), e.page_type !== void 0 && (i.page_type = e.page_type), e.sku !== void 0 && (i.sku = e.sku), i;
|
|
129
|
-
}
|
|
130
|
-
function Ne(e, t) {
|
|
131
|
-
const i = {
|
|
132
|
-
event_name: "widget.history.snapshot",
|
|
133
|
-
account_id: e.account_id,
|
|
134
|
-
session_id: e.session_id,
|
|
135
|
-
correlation_id: e.correlation_id,
|
|
136
|
-
widget: t.widget,
|
|
137
|
-
payload: {
|
|
138
|
-
message_count: t.message_count,
|
|
139
|
-
history_ref: t.history_ref,
|
|
140
|
-
redaction_level: t.redaction_level
|
|
141
|
-
}
|
|
142
|
-
};
|
|
143
|
-
return e.view_id !== void 0 && (i.view_id = e.view_id), e.user_id !== void 0 && (i.user_id = e.user_id), e.page_type !== void 0 && (i.page_type = e.page_type), e.sku !== void 0 && (i.sku = e.sku), i;
|
|
144
|
-
}
|
|
145
|
-
function Oe(e, t) {
|
|
146
|
-
const i = {
|
|
147
|
-
event_name: "basket.add",
|
|
148
|
-
account_id: e.account_id,
|
|
149
|
-
session_id: e.session_id,
|
|
150
|
-
correlation_id: e.correlation_id,
|
|
151
|
-
widget: t.attribution_source,
|
|
152
|
-
payload: {
|
|
153
|
-
attribution_source: t.attribution_source,
|
|
154
|
-
attribution_action_id: t.attribution_action_id,
|
|
155
|
-
cart_value: t.cart_value,
|
|
156
|
-
currency: t.currency,
|
|
157
|
-
line_items: t.line_items,
|
|
158
|
-
sku: t.sku
|
|
159
|
-
}
|
|
160
|
-
};
|
|
161
|
-
return e.view_id !== void 0 && (i.view_id = e.view_id), e.user_id !== void 0 && (i.user_id = e.user_id), e.page_type !== void 0 && (i.page_type = e.page_type), e.sku !== void 0 && (i.sku = e.sku), i;
|
|
162
|
-
}
|
|
163
|
-
function W(e, t) {
|
|
164
|
-
const i = {
|
|
165
|
-
event_name: "checkout.start",
|
|
166
|
-
account_id: e.account_id,
|
|
167
|
-
session_id: e.session_id,
|
|
168
|
-
correlation_id: e.correlation_id,
|
|
169
|
-
widget: t.attribution_source,
|
|
170
|
-
payload: {
|
|
171
|
-
attribution_source: t.attribution_source,
|
|
172
|
-
attribution_action_id: t.attribution_action_id,
|
|
173
|
-
cart_value: t.cart_value,
|
|
174
|
-
currency: t.currency,
|
|
175
|
-
line_items: t.line_items
|
|
176
|
-
}
|
|
177
|
-
};
|
|
178
|
-
return e.view_id !== void 0 && (i.view_id = e.view_id), e.user_id !== void 0 && (i.user_id = e.user_id), e.page_type !== void 0 && (i.page_type = e.page_type), e.sku !== void 0 && (i.sku = e.sku), i;
|
|
179
|
-
}
|
|
180
|
-
function z(e, t) {
|
|
181
|
-
const i = {
|
|
182
|
-
event_name: "checkout.complete",
|
|
183
|
-
account_id: e.account_id,
|
|
184
|
-
session_id: e.session_id,
|
|
185
|
-
correlation_id: e.correlation_id,
|
|
186
|
-
widget: t.attribution_source,
|
|
187
|
-
payload: {
|
|
188
|
-
attribution_source: t.attribution_source,
|
|
189
|
-
attribution_action_id: t.attribution_action_id,
|
|
190
|
-
cart_value: t.cart_value,
|
|
191
|
-
currency: t.currency,
|
|
192
|
-
line_items: t.line_items
|
|
193
|
-
}
|
|
194
|
-
};
|
|
195
|
-
return e.view_id !== void 0 && (i.view_id = e.view_id), e.user_id !== void 0 && (i.user_id = e.user_id), e.page_type !== void 0 && (i.page_type = e.page_type), e.sku !== void 0 && (i.sku = e.sku), i;
|
|
196
|
-
}
|
|
197
|
-
var x = /* @__PURE__ */ new Set([
|
|
198
|
-
"p",
|
|
199
|
-
"br",
|
|
200
|
-
"a",
|
|
201
|
-
"strong",
|
|
202
|
-
"b",
|
|
203
|
-
"em",
|
|
204
|
-
"i",
|
|
205
|
-
"u",
|
|
206
|
-
"ul",
|
|
207
|
-
"ol",
|
|
208
|
-
"li",
|
|
209
|
-
"h1",
|
|
210
|
-
"h2",
|
|
211
|
-
"h3",
|
|
212
|
-
"h4",
|
|
213
|
-
"h5",
|
|
214
|
-
"h6",
|
|
215
|
-
"span",
|
|
216
|
-
"div",
|
|
217
|
-
"table",
|
|
218
|
-
"thead",
|
|
219
|
-
"tbody",
|
|
220
|
-
"tr",
|
|
221
|
-
"th",
|
|
222
|
-
"td",
|
|
223
|
-
"hr",
|
|
224
|
-
"code",
|
|
225
|
-
"pre",
|
|
226
|
-
"blockquote",
|
|
227
|
-
"img",
|
|
228
|
-
"sup",
|
|
229
|
-
"sub"
|
|
230
|
-
]), F = /* @__PURE__ */ new Set([
|
|
231
|
-
"script",
|
|
232
|
-
"iframe",
|
|
233
|
-
"object",
|
|
234
|
-
"embed",
|
|
235
|
-
"form",
|
|
236
|
-
"input",
|
|
237
|
-
"textarea",
|
|
238
|
-
"select",
|
|
239
|
-
"button",
|
|
240
|
-
"style",
|
|
241
|
-
"link",
|
|
242
|
-
"meta",
|
|
243
|
-
"template",
|
|
244
|
-
"noscript"
|
|
245
|
-
]), E = {
|
|
246
|
-
"*": /* @__PURE__ */ new Set(["class"]),
|
|
247
|
-
a: /* @__PURE__ */ new Set([
|
|
248
|
-
"href",
|
|
249
|
-
"target",
|
|
250
|
-
"rel"
|
|
251
|
-
]),
|
|
252
|
-
img: /* @__PURE__ */ new Set([
|
|
253
|
-
"src",
|
|
254
|
-
"alt",
|
|
255
|
-
"width",
|
|
256
|
-
"height"
|
|
257
|
-
]),
|
|
258
|
-
div: /* @__PURE__ */ new Set(["style"]),
|
|
259
|
-
span: /* @__PURE__ */ new Set(["style"]),
|
|
260
|
-
p: /* @__PURE__ */ new Set(["style"])
|
|
261
|
-
};
|
|
262
|
-
function H(e) {
|
|
263
|
-
return /^\s*javascript\s*:/i.test(e);
|
|
264
|
-
}
|
|
265
|
-
var V = /* @__PURE__ */ new Set([
|
|
266
|
-
"color",
|
|
267
|
-
"background-color",
|
|
268
|
-
"font-size",
|
|
269
|
-
"font-weight",
|
|
270
|
-
"font-style",
|
|
271
|
-
"font-family",
|
|
272
|
-
"text-align",
|
|
273
|
-
"text-decoration",
|
|
274
|
-
"line-height",
|
|
275
|
-
"letter-spacing",
|
|
276
|
-
"margin",
|
|
277
|
-
"margin-top",
|
|
278
|
-
"margin-right",
|
|
279
|
-
"margin-bottom",
|
|
280
|
-
"margin-left",
|
|
281
|
-
"padding",
|
|
282
|
-
"padding-top",
|
|
283
|
-
"padding-right",
|
|
284
|
-
"padding-bottom",
|
|
285
|
-
"padding-left",
|
|
286
|
-
"border",
|
|
287
|
-
"border-top",
|
|
288
|
-
"border-right",
|
|
289
|
-
"border-bottom",
|
|
290
|
-
"border-left",
|
|
291
|
-
"border-radius",
|
|
292
|
-
"border-color",
|
|
293
|
-
"border-width",
|
|
294
|
-
"border-style",
|
|
295
|
-
"width",
|
|
296
|
-
"max-width",
|
|
297
|
-
"min-width",
|
|
298
|
-
"height",
|
|
299
|
-
"max-height",
|
|
300
|
-
"min-height",
|
|
301
|
-
"display",
|
|
302
|
-
"vertical-align",
|
|
303
|
-
"white-space",
|
|
304
|
-
"word-break",
|
|
305
|
-
"overflow",
|
|
306
|
-
"opacity",
|
|
307
|
-
"visibility",
|
|
308
|
-
"list-style",
|
|
309
|
-
"list-style-type",
|
|
310
|
-
"text-transform",
|
|
311
|
-
"text-indent",
|
|
312
|
-
"text-overflow",
|
|
313
|
-
"box-sizing",
|
|
314
|
-
"flex",
|
|
315
|
-
"flex-direction",
|
|
316
|
-
"flex-wrap",
|
|
317
|
-
"justify-content",
|
|
318
|
-
"align-items",
|
|
319
|
-
"gap"
|
|
320
|
-
]), B = /url\s*\(|expression\s*\(|javascript\s*:|\bimport\b|-moz-binding|behavior\s*:/i;
|
|
321
|
-
function G(e) {
|
|
322
|
-
const t = [];
|
|
323
|
-
for (const i of e.split(";")) {
|
|
324
|
-
const n = i.trim();
|
|
325
|
-
if (!n) continue;
|
|
326
|
-
const r = n.indexOf(":");
|
|
327
|
-
if (r === -1) continue;
|
|
328
|
-
const s = n.slice(0, r).trim().toLowerCase(), c = n.slice(r + 1).trim();
|
|
329
|
-
V.has(s) && (B.test(c) || t.push(n));
|
|
330
|
-
}
|
|
331
|
-
return t.join("; ");
|
|
332
|
-
}
|
|
333
|
-
function k(e, t) {
|
|
334
|
-
if (e.nodeType === Node.TEXT_NODE) return;
|
|
335
|
-
if (e.nodeType !== Node.ELEMENT_NODE) {
|
|
336
|
-
e.parentNode?.removeChild(e);
|
|
337
|
-
return;
|
|
338
|
-
}
|
|
339
|
-
const i = e, n = i.tagName.toLowerCase();
|
|
340
|
-
if (F.has(n)) {
|
|
341
|
-
i.parentNode?.removeChild(i);
|
|
342
|
-
return;
|
|
343
|
-
}
|
|
344
|
-
if (!x.has(n)) {
|
|
345
|
-
const a = Array.from(i.childNodes);
|
|
346
|
-
for (const d of a) t.insertBefore(d, i);
|
|
347
|
-
t.removeChild(i);
|
|
348
|
-
for (const d of a) k(d, t);
|
|
349
|
-
return;
|
|
350
|
-
}
|
|
351
|
-
const r = E["*"] ?? /* @__PURE__ */ new Set(), s = E[n] ?? /* @__PURE__ */ new Set(), c = Array.from(i.attributes);
|
|
352
|
-
for (const a of c) {
|
|
353
|
-
const d = a.name.toLowerCase();
|
|
354
|
-
if (!r.has(d) && !s.has(d)) {
|
|
355
|
-
i.removeAttribute(a.name);
|
|
356
|
-
continue;
|
|
357
|
-
}
|
|
358
|
-
if (H(a.value)) {
|
|
359
|
-
i.removeAttribute(a.name);
|
|
360
|
-
continue;
|
|
361
|
-
}
|
|
362
|
-
if (d === "style") {
|
|
363
|
-
const h = G(a.value);
|
|
364
|
-
h ? i.setAttribute("style", h) : i.removeAttribute("style");
|
|
365
|
-
continue;
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
if (n === "a") {
|
|
369
|
-
const a = i.getAttribute("href");
|
|
370
|
-
if (a !== null) {
|
|
371
|
-
const d = a.trim().toLowerCase();
|
|
372
|
-
!d.startsWith("http://") && !d.startsWith("https://") && !d.startsWith("mailto:") && i.removeAttribute("href");
|
|
373
|
-
}
|
|
374
|
-
i.setAttribute("target", "_blank"), i.setAttribute("rel", "noopener noreferrer");
|
|
375
|
-
}
|
|
376
|
-
if (n === "img") {
|
|
377
|
-
const a = i.getAttribute("src");
|
|
378
|
-
a !== null && (a.trim().toLowerCase().startsWith("https://") || i.removeAttribute("src"));
|
|
379
|
-
}
|
|
380
|
-
const p = Array.from(i.childNodes);
|
|
381
|
-
for (const a of p) k(a, i);
|
|
382
|
-
}
|
|
383
|
-
var R = ["http:", "https:"];
|
|
384
|
-
function Pe(e) {
|
|
385
|
-
try {
|
|
386
|
-
return R.includes(new URL(e).protocol);
|
|
387
|
-
} catch {
|
|
388
|
-
return !1;
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
function N(e) {
|
|
392
|
-
if (e.startsWith("/") && !e.startsWith("//")) return !0;
|
|
393
|
-
try {
|
|
394
|
-
const t = new URL(e);
|
|
395
|
-
return R.includes(t.protocol);
|
|
396
|
-
} catch {
|
|
397
|
-
return !1;
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
function De(e, t, i) {
|
|
401
|
-
(t === "href" || t === "src") && !N(i) || e.setAttribute(t, i);
|
|
402
|
-
}
|
|
403
|
-
function $e(e) {
|
|
404
|
-
if (!e) return "";
|
|
405
|
-
const t = new DOMParser().parseFromString(e, "text/html").body, i = Array.from(t.childNodes);
|
|
406
|
-
for (const n of i) k(n, t);
|
|
407
|
-
return t.innerHTML;
|
|
408
|
-
}
|
|
409
|
-
function j() {
|
|
410
|
-
return typeof window < "u" && Array.isArray(window.dataLayer);
|
|
411
|
-
}
|
|
412
|
-
function o(e, t) {
|
|
413
|
-
const i = {
|
|
414
|
-
event: e,
|
|
415
|
-
...t
|
|
416
|
-
};
|
|
417
|
-
j() && window.dataLayer.push(i);
|
|
418
|
-
}
|
|
419
|
-
function Q(e) {
|
|
420
|
-
o("gengage-on-init", { gengage_widget: e });
|
|
421
|
-
}
|
|
422
|
-
function T(e) {
|
|
423
|
-
o("gengage-show", { gengage_widget: e });
|
|
424
|
-
}
|
|
425
|
-
function Y(e) {
|
|
426
|
-
o("gengage-hide", { gengage_widget: e });
|
|
427
|
-
}
|
|
428
|
-
function J(e, t) {
|
|
429
|
-
o("gengage-suggested-question", {
|
|
430
|
-
gengage_question_title: e,
|
|
431
|
-
gengage_action_type: t
|
|
432
|
-
});
|
|
433
|
-
}
|
|
434
|
-
function Ue(e) {
|
|
435
|
-
o("gengage-find-similars", { gengage_sku: e });
|
|
436
|
-
}
|
|
437
|
-
function We(e) {
|
|
438
|
-
o("gengage-compare-preselection", { gengage_sku: e });
|
|
439
|
-
}
|
|
440
|
-
function ze(e) {
|
|
441
|
-
o("gengage-compare-selected", {
|
|
442
|
-
gengage_skus: e,
|
|
443
|
-
gengage_product_count: e.length
|
|
444
|
-
});
|
|
445
|
-
}
|
|
446
|
-
function xe() {
|
|
447
|
-
o("gengage-compare-clear");
|
|
448
|
-
}
|
|
449
|
-
function Fe(e) {
|
|
450
|
-
o("gengage-compare-received", { gengage_product_count: e });
|
|
451
|
-
}
|
|
452
|
-
function He(e) {
|
|
453
|
-
o("gengage-like-product", { gengage_sku: e });
|
|
454
|
-
}
|
|
455
|
-
function Ve() {
|
|
456
|
-
o("gengage-like-list");
|
|
457
|
-
}
|
|
458
|
-
function Be(e, t) {
|
|
459
|
-
o("gengage-search", {
|
|
460
|
-
gengage_search_query: e,
|
|
461
|
-
gengage_result_count: t
|
|
462
|
-
});
|
|
463
|
-
}
|
|
464
|
-
function Ge(e, t) {
|
|
465
|
-
o("gengage-product-detail", {
|
|
466
|
-
gengage_sku: e,
|
|
467
|
-
gengage_product_name: t
|
|
468
|
-
});
|
|
469
|
-
}
|
|
470
|
-
function K(e, t) {
|
|
471
|
-
o("gengage-similar-product-click", {
|
|
472
|
-
gengage_sku: e,
|
|
473
|
-
...t?.url !== void 0 ? { gengage_product_url: t.url } : {},
|
|
474
|
-
...t?.name !== void 0 ? { gengage_product_name: t.name } : {},
|
|
475
|
-
...t?.session_id !== void 0 ? { gengage_session_id: t.session_id } : {}
|
|
476
|
-
});
|
|
477
|
-
}
|
|
478
|
-
function X(e, t) {
|
|
479
|
-
o("gengage-similar-grouping-click", {
|
|
480
|
-
gengage_grouping_label: e,
|
|
481
|
-
gengage_grouping_index: t
|
|
482
|
-
});
|
|
483
|
-
}
|
|
484
|
-
function Z(e) {
|
|
485
|
-
o("gengage-similar-products-impression", {
|
|
486
|
-
gengage_source_sku: e.source_sku,
|
|
487
|
-
gengage_product_count: e.product_count,
|
|
488
|
-
gengage_grouped: e.grouped,
|
|
489
|
-
...e.session_id !== void 0 ? { gengage_session_id: e.session_id } : {}
|
|
490
|
-
});
|
|
491
|
-
}
|
|
492
|
-
function je(e) {
|
|
493
|
-
o("gengage-compare-product", {
|
|
494
|
-
gengage_skus: e,
|
|
495
|
-
gengage_product_count: e.length
|
|
496
|
-
});
|
|
497
|
-
}
|
|
498
|
-
function Qe() {
|
|
499
|
-
o("gengage-chatbot-maximized");
|
|
500
|
-
}
|
|
501
|
-
function ee(e) {
|
|
502
|
-
o("gengage-interface-not-ready", {
|
|
503
|
-
...e?.reason !== void 0 ? { gengage_reason: e.reason } : {},
|
|
504
|
-
...e?.attempts !== void 0 ? { gengage_attempts: e.attempts } : {},
|
|
505
|
-
...e?.message !== void 0 ? { gengage_message: e.message } : {}
|
|
506
|
-
});
|
|
507
|
-
}
|
|
508
|
-
function te(e, t) {
|
|
509
|
-
o("gengage-cart-add", {
|
|
510
|
-
gengage_sku: e,
|
|
511
|
-
gengage_quantity: t
|
|
512
|
-
});
|
|
513
|
-
}
|
|
514
|
-
function Ye() {
|
|
515
|
-
o("gengage-message-sent");
|
|
516
|
-
}
|
|
517
|
-
function Je() {
|
|
518
|
-
o("gengage-message-received");
|
|
519
|
-
}
|
|
520
|
-
function Ke() {
|
|
521
|
-
o("gengage-conversation-start");
|
|
522
|
-
}
|
|
523
|
-
function ie() {
|
|
524
|
-
o("gengage-voice-input");
|
|
525
|
-
}
|
|
526
|
-
function ne(e, t) {
|
|
527
|
-
o("gengage-error", {
|
|
528
|
-
gengage_widget: e,
|
|
529
|
-
gengage_error: t
|
|
530
|
-
});
|
|
531
|
-
}
|
|
532
|
-
var m = null;
|
|
533
|
-
function Xe() {
|
|
534
|
-
if (typeof window > "u") return () => {
|
|
535
|
-
};
|
|
536
|
-
if (m) return m;
|
|
537
|
-
const e = [];
|
|
538
|
-
function t(i, n) {
|
|
539
|
-
const r = (s) => n(s.detail);
|
|
540
|
-
window.addEventListener(i, r), e.push(() => window.removeEventListener(i, r));
|
|
541
|
-
}
|
|
542
|
-
return t("gengage:chat:open", () => T("chat")), t("gengage:chat:close", () => Y("chat")), t("gengage:chat:ready", () => Q("chat")), t("gengage:similar:add-to-cart", ({ sku: i, quantity: n }) => {
|
|
543
|
-
te(i, n);
|
|
544
|
-
}), t("gengage:similar:product-click", ({ sku: i, url: n, sessionId: r, productName: s }) => {
|
|
545
|
-
const c = {
|
|
546
|
-
url: n,
|
|
547
|
-
session_id: r
|
|
548
|
-
};
|
|
549
|
-
s !== void 0 && s !== "" && (c.name = s), K(i, c);
|
|
550
|
-
}), t("gengage:similar:grouping-click", ({ grouping_label: i, grouping_index: n }) => {
|
|
551
|
-
X(i, n);
|
|
552
|
-
}), t("gengage:similar:products-impression", ({ source_sku: i, product_count: n, grouped: r, sessionId: s }) => {
|
|
553
|
-
Z({
|
|
554
|
-
source_sku: i,
|
|
555
|
-
product_count: n,
|
|
556
|
-
grouped: r,
|
|
557
|
-
session_id: s
|
|
558
|
-
});
|
|
559
|
-
}), t("gengage:qna:action", ({ title: i, type: n }) => {
|
|
560
|
-
J(i, n);
|
|
561
|
-
}), t("gengage:chat:voice", () => ie()), t("gengage:qna:open-chat", () => T("chat")), t("gengage:global:error", ({ source: i, message: n }) => {
|
|
562
|
-
ne(i, n);
|
|
563
|
-
}), m = () => {
|
|
564
|
-
for (const i of e) i();
|
|
565
|
-
e.length = 0, m = null;
|
|
566
|
-
}, m;
|
|
567
|
-
}
|
|
568
|
-
function Ze(e, t) {
|
|
569
|
-
window.dispatchEvent(new CustomEvent(e, {
|
|
570
|
-
detail: t,
|
|
571
|
-
bubbles: !1
|
|
572
|
-
}));
|
|
573
|
-
}
|
|
574
|
-
function w(e, t) {
|
|
575
|
-
const i = (n) => {
|
|
576
|
-
t(n.detail);
|
|
577
|
-
};
|
|
578
|
-
return window.addEventListener(e, i), () => window.removeEventListener(e, i);
|
|
579
|
-
}
|
|
580
|
-
function re(e) {
|
|
581
|
-
if (e.type !== "user_message" && e.type !== "inputText") return null;
|
|
582
|
-
if (typeof e.payload == "string" && e.payload.trim().length > 0) return e.payload.trim();
|
|
583
|
-
if (typeof e.payload == "object" && e.payload !== null) {
|
|
584
|
-
const t = e.payload;
|
|
585
|
-
if (typeof t.text == "string") {
|
|
586
|
-
const i = t.text.trim();
|
|
587
|
-
if (i.length > 0) return i;
|
|
588
|
-
}
|
|
589
|
-
}
|
|
590
|
-
return typeof e.title == "string" && e.title.trim().length > 0 ? e.title.trim() : null;
|
|
591
|
-
}
|
|
592
|
-
function oe(e) {
|
|
593
|
-
if (e.type !== "inputText" && e.type !== "user_message") return e;
|
|
594
|
-
const t = typeof e.payload == "string" ? { text: e.payload.trim() } : e.payload != null && typeof e.payload == "object" && !Array.isArray(e.payload) ? { ...e.payload } : {};
|
|
595
|
-
if (typeof t.text != "string" || !t.text.trim()) {
|
|
596
|
-
const i = e.title?.trim();
|
|
597
|
-
i && (t.text = i);
|
|
598
|
-
}
|
|
599
|
-
return "is_launcher" in t || (t.is_launcher = 1), "is_suggested_text" in t || (t.is_suggested_text = 1), {
|
|
600
|
-
...e,
|
|
601
|
-
payload: t
|
|
602
|
-
};
|
|
603
|
-
}
|
|
604
|
-
function et(e) {
|
|
605
|
-
let t = !1;
|
|
606
|
-
const i = [];
|
|
607
|
-
let n = 0, r = null, s = 0;
|
|
608
|
-
const c = 500, p = 10;
|
|
609
|
-
function a() {
|
|
610
|
-
return window.gengage?.chat ?? null;
|
|
611
|
-
}
|
|
612
|
-
function d() {
|
|
613
|
-
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?.();
|
|
614
|
-
}
|
|
615
|
-
function h(g, l) {
|
|
616
|
-
if (g.openWithAction) {
|
|
617
|
-
const $ = l.type === "inputText" || l.type === "user_message" ? oe(l) : l;
|
|
618
|
-
g.openWithAction($);
|
|
619
|
-
return;
|
|
620
|
-
}
|
|
621
|
-
const y = re(l);
|
|
622
|
-
if (y && g.sendMessage) {
|
|
623
|
-
g.open?.(), g.sendMessage(y);
|
|
624
|
-
return;
|
|
625
|
-
}
|
|
626
|
-
}
|
|
627
|
-
function b() {
|
|
628
|
-
r !== null && (window.clearInterval(r), r = null);
|
|
629
|
-
}
|
|
630
|
-
function O() {
|
|
631
|
-
const g = a();
|
|
632
|
-
if (!g) return !1;
|
|
633
|
-
if (n > 0 && (g.open?.(), n = 0), i.length > 0) {
|
|
634
|
-
const l = i.splice(0, i.length);
|
|
635
|
-
for (const y of l) h(g, y);
|
|
636
|
-
}
|
|
637
|
-
return b(), !0;
|
|
638
|
-
}
|
|
639
|
-
function S() {
|
|
640
|
-
r === null && (s = 0, r = window.setInterval(() => {
|
|
641
|
-
O() || (s += 1, s >= p && ((i.length > 0 || n > 0) && ee({
|
|
642
|
-
reason: "chat_unavailable_after_poll",
|
|
643
|
-
attempts: p
|
|
644
|
-
}), i.length = 0, n = 0, b()));
|
|
645
|
-
}, c));
|
|
646
|
-
}
|
|
647
|
-
const P = w("gengage:qna:action", (g) => {
|
|
648
|
-
const l = a();
|
|
649
|
-
if (l) {
|
|
650
|
-
h(l, g);
|
|
651
|
-
return;
|
|
652
|
-
}
|
|
653
|
-
d(), i.length >= 20 && i.shift(), i.push(g), S();
|
|
654
|
-
}), D = w("gengage:qna:open-chat", () => {
|
|
655
|
-
const g = a();
|
|
656
|
-
if (g) {
|
|
657
|
-
g.open?.();
|
|
658
|
-
return;
|
|
659
|
-
}
|
|
660
|
-
d(), n += 1, S();
|
|
661
|
-
});
|
|
662
|
-
return () => {
|
|
663
|
-
P(), D(), i.length = 0, n = 0, b();
|
|
664
|
-
};
|
|
665
|
-
}
|
|
666
|
-
function tt() {
|
|
667
|
-
return w("gengage:similar:product-click", ({ sku: e, url: t, sessionId: i }) => {
|
|
668
|
-
i && window.gengage?.chat?.saveSession(i, e), N(t) && (window.location.href = t);
|
|
669
|
-
});
|
|
670
|
-
}
|
|
671
|
-
function se() {
|
|
672
|
-
const e = window.__gengageSessionId ?? sessionStorage.getItem("gengage_session_id") ?? null ?? crypto.randomUUID();
|
|
673
|
-
return window.__gengageSessionId = e, sessionStorage.setItem("gengage_session_id", e), window.gengage || (window.gengage = {}), window.gengage.sessionId = e, e;
|
|
674
|
-
}
|
|
675
|
-
function it() {
|
|
676
|
-
return window.gengage?.pageContext ?? null;
|
|
677
|
-
}
|
|
678
|
-
function nt(e) {
|
|
679
|
-
window.gengage || (window.gengage = {}), window.gengage.pageContext = {
|
|
680
|
-
pageType: "other",
|
|
681
|
-
...window.gengage.pageContext,
|
|
682
|
-
...e
|
|
683
|
-
}, window.dispatchEvent(new CustomEvent("gengage:context:update", { detail: e }));
|
|
684
|
-
}
|
|
685
|
-
function ae(e) {
|
|
686
|
-
return {
|
|
687
|
-
sessionId: e?.sessionId ?? se(),
|
|
688
|
-
...e
|
|
689
|
-
};
|
|
690
|
-
}
|
|
691
|
-
var A = {
|
|
692
|
-
"--gengage-chat-offset": "20px",
|
|
693
|
-
"--gengage-chat-launcher-size": "56px",
|
|
694
|
-
"--gengage-chat-width": "400px",
|
|
695
|
-
"--gengage-chat-shell-radius": "1rem",
|
|
696
|
-
"--gengage-chat-header-height": "72px",
|
|
697
|
-
"--gengage-chat-conversation-width": "396px",
|
|
698
|
-
"--gengage-chat-panel-min-width": "320px",
|
|
699
|
-
"--gengage-chat-panel-max-width": "1200px",
|
|
700
|
-
"--gengage-chat-input-height": "48px",
|
|
701
|
-
"--gengage-qna-pill-radius": "999px",
|
|
702
|
-
"--gengage-qna-input-radius": "12px",
|
|
703
|
-
"--gengage-simrel-card-radius": "0.75rem",
|
|
704
|
-
"--radius-control": "12px",
|
|
705
|
-
"--radius-card": "16px",
|
|
706
|
-
"--radius-panel": "24px",
|
|
707
|
-
"--radius-pill": "999px",
|
|
708
|
-
"--surface-card-muted": "#f8fafc",
|
|
709
|
-
"--text-secondary": "#4b5563",
|
|
710
|
-
"--text-muted": "#6b7280",
|
|
711
|
-
"--border-default": "rgba(17, 24, 39, 0.10)"
|
|
712
|
-
};
|
|
713
|
-
function ge(e) {
|
|
714
|
-
return e ? {
|
|
715
|
-
...A,
|
|
716
|
-
...e
|
|
717
|
-
} : { ...A };
|
|
718
|
-
}
|
|
719
|
-
var u = {
|
|
720
|
-
primaryColor: "#b7102a",
|
|
721
|
-
primaryForeground: "#ffffff",
|
|
722
|
-
backgroundColor: "#ffffff",
|
|
723
|
-
foregroundColor: "#111827",
|
|
724
|
-
borderRadius: "0.75rem",
|
|
725
|
-
fontFamily: '"Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
|
|
726
|
-
fontSize: "14px",
|
|
727
|
-
zIndex: "1000",
|
|
728
|
-
"--glov-chatbot-width": "420px",
|
|
729
|
-
"--glov-left-spacing": "260px",
|
|
730
|
-
"--chatbot-padding": "16px",
|
|
731
|
-
"--root-wrapper-background-color": "#f8f9fa",
|
|
732
|
-
"--root-wrapper-border-color": "#edeeef",
|
|
733
|
-
"--gengage-chat-width": "400px",
|
|
734
|
-
"--gengage-chat-shell-radius": "1rem",
|
|
735
|
-
"--gengage-chat-header-height": "72px",
|
|
736
|
-
"--gengage-chat-conversation-width": "396px",
|
|
737
|
-
"--gengage-chat-panel-min-width": "320px",
|
|
738
|
-
"--gengage-chat-panel-max-width": "1200px",
|
|
739
|
-
"--gengage-chat-input-height": "48px",
|
|
740
|
-
"--gengage-qna-pill-radius": "999px",
|
|
741
|
-
"--gengage-qna-input-radius": "0.75rem",
|
|
742
|
-
"--gengage-simrel-card-radius": "0.75rem",
|
|
743
|
-
"--client-primary": "#b7102a",
|
|
744
|
-
"--client-primary-hover": "color-mix(in srgb, #b7102a 88%, black 12%)",
|
|
745
|
-
"--client-primary-active": "color-mix(in srgb, #b7102a 78%, black 22%)",
|
|
746
|
-
"--client-primary-subtle": "color-mix(in srgb, #b7102a 12%, white)",
|
|
747
|
-
"--client-primary-soft": "color-mix(in srgb, #b7102a 20%, white)",
|
|
748
|
-
"--client-on-primary": "#ffffff",
|
|
749
|
-
"--client-focus-ring": "color-mix(in srgb, #b7102a 32%, transparent)",
|
|
750
|
-
"--surface-page": "#f6f7fb",
|
|
751
|
-
"--surface-shell": "#10131a",
|
|
752
|
-
"--surface-card": "#ffffff",
|
|
753
|
-
"--surface-card-muted": "#f8fafc",
|
|
754
|
-
"--surface-card-soft": "#f8fafc",
|
|
755
|
-
"--surface-elevated": "#ffffff",
|
|
756
|
-
"--surface-input": "#ffffff",
|
|
757
|
-
"--surface-overlay": "rgba(16, 19, 26, 0.52)",
|
|
758
|
-
"--text-primary": "#111827",
|
|
759
|
-
"--text-secondary": "#4b5563",
|
|
760
|
-
"--text-muted": "#6b7280",
|
|
761
|
-
"--text-inverse": "#f9fafb",
|
|
762
|
-
"--border-subtle": "rgba(17, 24, 39, 0.06)",
|
|
763
|
-
"--border-default": "rgba(17, 24, 39, 0.10)",
|
|
764
|
-
"--border-strong": "rgba(17, 24, 39, 0.18)",
|
|
765
|
-
"--shadow-1": "0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06)",
|
|
766
|
-
"--shadow-2": "0 4px 12px rgba(16, 24, 40, 0.08)",
|
|
767
|
-
"--shadow-3": "0 10px 24px rgba(16, 24, 40, 0.12)",
|
|
768
|
-
"--radius-control": "12px",
|
|
769
|
-
"--radius-card": "16px",
|
|
770
|
-
"--radius-panel": "24px",
|
|
771
|
-
"--radius-pill": "999px",
|
|
772
|
-
"--success": "#16a34a",
|
|
773
|
-
"--warning": "#d97706",
|
|
774
|
-
"--error": "#dc2626",
|
|
775
|
-
"--info": "#2563eb",
|
|
776
|
-
"--rating": "#f5b301",
|
|
777
|
-
"--ai-accent-start": "#0b24d6",
|
|
778
|
-
"--ai-accent-end": "#f768f2",
|
|
779
|
-
"--ai-accent-soft": "linear-gradient(135deg, rgba(11, 36, 214, 0.08), rgba(247, 104, 242, 0.08))"
|
|
780
|
-
};
|
|
781
|
-
function rt(e) {
|
|
782
|
-
return {
|
|
783
|
-
...u,
|
|
784
|
-
...e
|
|
785
|
-
};
|
|
786
|
-
}
|
|
787
|
-
var f = "gengage-global-toast-root", I = "gengage-global-toast-style", C = "gengage-global-toast-root--visible", de = 4200, ue = 1500, ce = 15e3, le = [
|
|
788
|
-
"--gengage-font-family",
|
|
789
|
-
"--surface-card",
|
|
790
|
-
"--text-primary",
|
|
791
|
-
"--text-muted",
|
|
792
|
-
"--border-default",
|
|
793
|
-
"--radius-card",
|
|
794
|
-
"--shadow-3",
|
|
795
|
-
"--error",
|
|
796
|
-
"--ds-toast-error-bg",
|
|
797
|
-
"--ds-toast-error-border",
|
|
798
|
-
"--ds-toast-error-accent",
|
|
799
|
-
"--ds-toast-error-fg",
|
|
800
|
-
"--ds-toast-error-shadow"
|
|
801
|
-
], L = !1, _ = null, fe = [
|
|
802
|
-
/failed to fetch/i,
|
|
803
|
-
/networkerror/i,
|
|
804
|
-
/network request failed/i,
|
|
805
|
-
/load failed/i,
|
|
806
|
-
/err_network/i,
|
|
807
|
-
/fetch failed/i,
|
|
808
|
-
/network error/i
|
|
809
|
-
];
|
|
810
|
-
function M(e) {
|
|
811
|
-
return typeof e == "string" && e.toLowerCase().startsWith("tr");
|
|
812
|
-
}
|
|
813
|
-
function _e(e) {
|
|
814
|
-
if (typeof navigator < "u" && navigator.onLine === !1) return !0;
|
|
815
|
-
const t = e instanceof Error ? e.message.trim() : "";
|
|
816
|
-
return t ? fe.some((i) => i.test(t)) : !1;
|
|
817
|
-
}
|
|
818
|
-
function ot(e, t) {
|
|
819
|
-
return _e(t) ? M(e) ? "Bağlantı sorunu oluştu. Lütfen tekrar deneyin." : "Connection issue. Please try again." : M(e) ? "Bir hata oluştu. Lütfen tekrar deneyin." : "Something went wrong. Please try again.";
|
|
820
|
-
}
|
|
821
|
-
function pe() {
|
|
822
|
-
L || typeof window > "u" || typeof document > "u" || (L = !0, w("gengage:global:error", (e) => {
|
|
823
|
-
he(e);
|
|
824
|
-
}));
|
|
825
|
-
}
|
|
826
|
-
function he(e) {
|
|
827
|
-
if (typeof document > "u") return;
|
|
828
|
-
const t = e.message.trim();
|
|
829
|
-
if (!t) return;
|
|
830
|
-
ke();
|
|
831
|
-
const i = we();
|
|
832
|
-
ye(i), i.innerHTML = "";
|
|
833
|
-
const n = document.createElement("section");
|
|
834
|
-
n.className = "gengage-global-toast gengage-global-toast--error", n.setAttribute("role", "status"), n.setAttribute("aria-live", "polite");
|
|
835
|
-
const r = document.createElement("div");
|
|
836
|
-
r.className = "gengage-global-toast-title", r.textContent = ve(e.source);
|
|
837
|
-
const s = document.createElement("div");
|
|
838
|
-
s.className = "gengage-global-toast-message", s.textContent = t, n.appendChild(r), n.appendChild(s), i.appendChild(n), i.classList.add(C), _ && (clearTimeout(_), _ = null), e.sticky !== !0 && (_ = setTimeout(() => {
|
|
839
|
-
me();
|
|
840
|
-
}, be(e.durationMs)));
|
|
841
|
-
}
|
|
842
|
-
function me() {
|
|
843
|
-
if (typeof document > "u") return;
|
|
844
|
-
const e = document.getElementById(f);
|
|
845
|
-
e && (e.classList.remove(C), e.innerHTML = "", _ && (clearTimeout(_), _ = null));
|
|
846
|
-
}
|
|
847
|
-
function ve(e) {
|
|
848
|
-
switch (e) {
|
|
849
|
-
case "chat":
|
|
850
|
-
return "Chat warning";
|
|
851
|
-
case "qna":
|
|
852
|
-
return "QnA warning";
|
|
853
|
-
case "simrel":
|
|
854
|
-
return "Widget warning";
|
|
855
|
-
default:
|
|
856
|
-
return "Connection warning";
|
|
857
|
-
}
|
|
858
|
-
}
|
|
859
|
-
function we() {
|
|
860
|
-
const e = document.getElementById(f);
|
|
861
|
-
if (e instanceof HTMLElement) return e;
|
|
862
|
-
const t = document.createElement("div");
|
|
863
|
-
return t.id = f, t.className = "gengage-global-toast-root", document.body.appendChild(t), t;
|
|
864
|
-
}
|
|
865
|
-
function ye(e) {
|
|
866
|
-
if (typeof document > "u" || typeof window > "u") return;
|
|
867
|
-
const t = document.querySelector(".gengage-chat-root, .gengage-qna-container, .gengage-simrel-container, .gengage-simbut-root");
|
|
868
|
-
if (!t) return;
|
|
869
|
-
const i = window.getComputedStyle(t);
|
|
870
|
-
for (const n of le) {
|
|
871
|
-
const r = i.getPropertyValue(n).trim();
|
|
872
|
-
r ? e.style.setProperty(n, r) : e.style.removeProperty(n);
|
|
873
|
-
}
|
|
874
|
-
}
|
|
875
|
-
function be(e) {
|
|
876
|
-
return typeof e != "number" || !Number.isFinite(e) ? de : Math.min(ce, Math.max(ue, Math.round(e)));
|
|
877
|
-
}
|
|
878
|
-
function ke() {
|
|
879
|
-
if (document.getElementById(I)) return;
|
|
880
|
-
const e = document.createElement("style");
|
|
881
|
-
e.id = I;
|
|
882
|
-
const t = u["--surface-card"] ?? u.backgroundColor ?? "#ffffff", i = u["--text-primary"] ?? u.foregroundColor ?? "#111827", n = u["--border-default"] ?? "rgba(17, 24, 39, 0.10)", r = u["--error"] ?? "#dc2626", s = u["--shadow-3"] ?? "0 10px 24px rgba(16, 24, 40, 0.12)", c = u["--radius-card"] ?? "16px", p = u["--text-muted"] ?? "#6b7280";
|
|
883
|
-
e.textContent = `
|
|
884
|
-
#${f} {
|
|
885
|
-
position: fixed;
|
|
886
|
-
top: 16px;
|
|
887
|
-
right: 16px;
|
|
888
|
-
z-index: 2147483646;
|
|
889
|
-
pointer-events: none;
|
|
890
|
-
}
|
|
891
|
-
#${f}.${C} {
|
|
892
|
-
pointer-events: auto;
|
|
893
|
-
}
|
|
894
|
-
#${f} .gengage-global-toast {
|
|
895
|
-
min-width: 260px;
|
|
896
|
-
max-width: min(92vw, 420px);
|
|
897
|
-
border-radius: var(--radius-card, ${c});
|
|
898
|
-
border: 1px solid var(--ds-toast-error-border, color-mix(in srgb, var(--error, ${r}) 18%, var(--border-default, ${n})));
|
|
899
|
-
border-left: 4px solid var(--ds-toast-error-accent, var(--error, ${r}));
|
|
900
|
-
background: var(--ds-toast-error-bg, color-mix(in srgb, var(--error, ${r}) 5%, var(--surface-card, ${t})));
|
|
901
|
-
color: var(--ds-toast-error-fg, color-mix(in srgb, var(--error, ${r}) 22%, var(--text-primary, ${i})));
|
|
902
|
-
box-shadow: var(--ds-toast-error-shadow, var(--shadow-3, ${s}));
|
|
903
|
-
padding: 10px 12px;
|
|
904
|
-
font-family: var(--gengage-font-family, ${JSON.stringify(u.fontFamily ?? '-apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif')});
|
|
905
|
-
font-size: 13px;
|
|
906
|
-
line-height: 1.4;
|
|
907
|
-
animation: gengage-global-toast-in 180ms ease-out forwards;
|
|
908
|
-
}
|
|
909
|
-
#${f} .gengage-global-toast-title {
|
|
910
|
-
margin: 0 0 4px;
|
|
911
|
-
font-size: 12px;
|
|
912
|
-
font-weight: 700;
|
|
913
|
-
color: var(--text-muted, ${p});
|
|
914
|
-
}
|
|
915
|
-
#${f} .gengage-global-toast-message {
|
|
916
|
-
margin: 0;
|
|
917
|
-
font-weight: 500;
|
|
918
|
-
}
|
|
919
|
-
@keyframes gengage-global-toast-in {
|
|
920
|
-
from {
|
|
921
|
-
opacity: 0;
|
|
922
|
-
transform: translateY(-8px);
|
|
923
|
-
}
|
|
924
|
-
to {
|
|
925
|
-
opacity: 1;
|
|
926
|
-
transform: translateY(0);
|
|
927
|
-
}
|
|
928
|
-
}
|
|
929
|
-
`, document.head.appendChild(e);
|
|
930
|
-
}
|
|
931
|
-
var v = null;
|
|
932
|
-
function Ce() {
|
|
933
|
-
if (v !== null) return v;
|
|
934
|
-
try {
|
|
935
|
-
v = localStorage.getItem("gengage:debug") === "1";
|
|
936
|
-
} catch {
|
|
937
|
-
v = !1;
|
|
938
|
-
}
|
|
939
|
-
return v;
|
|
940
|
-
}
|
|
941
|
-
function q(e, t, i) {
|
|
942
|
-
if (!Ce()) return;
|
|
943
|
-
const n = [`[gengage:${e}]`, t];
|
|
944
|
-
i !== void 0 && n.push(i), console.debug(...n);
|
|
945
|
-
}
|
|
946
|
-
var st = class {
|
|
947
|
-
constructor() {
|
|
948
|
-
this.isVisible = !1, this.isInitialised = !1, this._handlers = /* @__PURE__ */ new Map(), this._cleanups = [], this._ownsRoot = !1, this._destroying = !1;
|
|
949
|
-
}
|
|
950
|
-
async init(e) {
|
|
951
|
-
if (this.isInitialised) {
|
|
952
|
-
console.warn("[gengage] Widget already initialised. Call update() instead.");
|
|
953
|
-
return;
|
|
954
|
-
}
|
|
955
|
-
const t = ge(e.theme);
|
|
956
|
-
this.config = {
|
|
957
|
-
...e,
|
|
958
|
-
theme: t,
|
|
959
|
-
session: ae(e.session)
|
|
960
|
-
}, this.root = this._resolveMount(e.mountTarget), this._applyTheme(t), pe();
|
|
961
|
-
const i = w("gengage:context:update", (n) => this.update(n));
|
|
962
|
-
this._cleanups.push(i), q("lifecycle", `${this.constructor.name}.init`, {
|
|
963
|
-
accountId: e.accountId,
|
|
964
|
-
sku: e.pageContext?.sku
|
|
965
|
-
});
|
|
966
|
-
try {
|
|
967
|
-
await this.onInit(this.config);
|
|
968
|
-
} catch (n) {
|
|
969
|
-
throw this.destroy(), n;
|
|
970
|
-
}
|
|
971
|
-
this._destroying || (this.isInitialised = !0, q("lifecycle", `${this.constructor.name} ready`), this.emit("ready"));
|
|
972
|
-
}
|
|
973
|
-
update(e) {
|
|
974
|
-
this.isInitialised && (this.config.pageContext ? this.config = {
|
|
975
|
-
...this.config,
|
|
976
|
-
pageContext: {
|
|
977
|
-
...this.config.pageContext,
|
|
978
|
-
...e
|
|
979
|
-
}
|
|
980
|
-
} : e.pageType !== void 0 && (this.config = {
|
|
981
|
-
...this.config,
|
|
982
|
-
pageContext: e
|
|
983
|
-
}), this.onUpdate(e), this.emit("context-update", this.config.pageContext));
|
|
984
|
-
}
|
|
985
|
-
show() {
|
|
986
|
-
this.isVisible || (this.isVisible = !0, this.root.style.display = "", this.onShow(), this.emit("show"));
|
|
987
|
-
}
|
|
988
|
-
hide() {
|
|
989
|
-
this.isVisible && (this.isVisible = !1, this.root.style.display = "none", this.onHide(), this.emit("hide"));
|
|
990
|
-
}
|
|
991
|
-
destroy() {
|
|
992
|
-
this._destroying || (this._destroying = !0, this.emit("destroy"), this._cleanups.forEach((e) => e()), this._cleanups.length = 0, this._handlers.clear(), this.onDestroy(), this.config.analyticsClient?.destroy(), this._cleanupRoot(), this.isInitialised = !1);
|
|
993
|
-
}
|
|
994
|
-
_cleanupRoot() {
|
|
995
|
-
this._ownsRoot ? this.root.remove() : this.root.innerHTML = "";
|
|
996
|
-
}
|
|
997
|
-
on(e, t) {
|
|
998
|
-
return this._handlers.has(e) || this._handlers.set(e, /* @__PURE__ */ new Set()), this._handlers.get(e).add(t), () => this._handlers.get(e)?.delete(t);
|
|
999
|
-
}
|
|
1000
|
-
trackCheckout(e, t) {
|
|
1001
|
-
const i = e === "start" ? W : z;
|
|
1002
|
-
this.track(i(this.analyticsContext(), t));
|
|
1003
|
-
}
|
|
1004
|
-
flushMeteringSummary(e) {
|
|
1005
|
-
this.track(U(this.analyticsContext(), e));
|
|
1006
|
-
}
|
|
1007
|
-
emit(e, ...t) {
|
|
1008
|
-
this._handlers.get(e)?.forEach((i) => i(...t));
|
|
1009
|
-
}
|
|
1010
|
-
addCleanup(e) {
|
|
1011
|
-
this._cleanups.push(e);
|
|
1012
|
-
}
|
|
1013
|
-
track(e) {
|
|
1014
|
-
this.config.analyticsClient?.track(e);
|
|
1015
|
-
}
|
|
1016
|
-
analyticsContext() {
|
|
1017
|
-
const e = {
|
|
1018
|
-
account_id: this.config.accountId,
|
|
1019
|
-
session_id: this.config.session?.sessionId ?? "",
|
|
1020
|
-
correlation_id: this.config.session?.sessionId ?? ""
|
|
1021
|
-
};
|
|
1022
|
-
return this.config.session?.viewId !== void 0 && (e.view_id = this.config.session.viewId), this.config.session?.userId !== void 0 && (e.user_id = this.config.session.userId), this.config.pageContext?.pageType !== void 0 && (e.page_type = this.config.pageContext.pageType), this.config.pageContext?.sku !== void 0 && (e.sku = this.config.pageContext.sku), this.config.session?.abTestVariant !== void 0 && (e.ab_test_variant = this.config.session.abTestVariant), this.config.session?.abTestExperimentId !== void 0 && (e.ab_test_experiment_id = this.config.session.abTestExperimentId), e;
|
|
1023
|
-
}
|
|
1024
|
-
_resolveMount(e) {
|
|
1025
|
-
if (e instanceof HTMLElement) return e;
|
|
1026
|
-
if (typeof e == "string") {
|
|
1027
|
-
const i = document.querySelector(e);
|
|
1028
|
-
if (!i) throw new Error(`[gengage] Mount target not found: "${e}"`);
|
|
1029
|
-
return i;
|
|
1030
|
-
}
|
|
1031
|
-
const t = document.createElement("div");
|
|
1032
|
-
return t.dataset.gengageWidget = this.constructor.name.toLowerCase(), document.body.insertBefore(t, document.body.firstChild), this._ownsRoot = !0, t;
|
|
1033
|
-
}
|
|
1034
|
-
_applyTheme(e) {
|
|
1035
|
-
if (e) {
|
|
1036
|
-
for (const [t, i] of Object.entries(e)) if (i !== void 0) {
|
|
1037
|
-
const n = t.startsWith("--") ? t : `--gengage-${Se(t)}`;
|
|
1038
|
-
this.root.style.setProperty(n, i);
|
|
1039
|
-
}
|
|
1040
|
-
}
|
|
1041
|
-
}
|
|
1042
|
-
};
|
|
1043
|
-
function Se(e) {
|
|
1044
|
-
return e.replace(/([A-Z])/g, "-$1").toLowerCase();
|
|
1045
|
-
}
|
|
1046
|
-
function at(e) {
|
|
1047
|
-
const t = e?.trim();
|
|
1048
|
-
return t || "tr";
|
|
1049
|
-
}
|
|
1050
|
-
export {
|
|
1051
|
-
Te as $,
|
|
1052
|
-
Q as A,
|
|
1053
|
-
ie as B,
|
|
1054
|
-
xe as C,
|
|
1055
|
-
ze as D,
|
|
1056
|
-
Fe as E,
|
|
1057
|
-
Ye as F,
|
|
1058
|
-
$e as G,
|
|
1059
|
-
Pe as H,
|
|
1060
|
-
Ge as I,
|
|
1061
|
-
z as J,
|
|
1062
|
-
Oe as K,
|
|
1063
|
-
Be as L,
|
|
1064
|
-
Ve as M,
|
|
1065
|
-
He as N,
|
|
1066
|
-
Ke as O,
|
|
1067
|
-
Je as P,
|
|
1068
|
-
U as Q,
|
|
1069
|
-
T as R,
|
|
1070
|
-
Qe as S,
|
|
1071
|
-
je as T,
|
|
1072
|
-
N as U,
|
|
1073
|
-
Xe as V,
|
|
1074
|
-
De as W,
|
|
1075
|
-
Me as X,
|
|
1076
|
-
W as Y,
|
|
1077
|
-
qe as Z,
|
|
1078
|
-
Ze as _,
|
|
1079
|
-
ot as a,
|
|
1080
|
-
tt as b,
|
|
1081
|
-
he as c,
|
|
1082
|
-
A as d,
|
|
1083
|
-
Ie as et,
|
|
1084
|
-
ge as f,
|
|
1085
|
-
nt as g,
|
|
1086
|
-
ae as h,
|
|
1087
|
-
me as i,
|
|
1088
|
-
Ne as it,
|
|
1089
|
-
ee as j,
|
|
1090
|
-
Ue as k,
|
|
1091
|
-
u as l,
|
|
1092
|
-
it as m,
|
|
1093
|
-
st as n,
|
|
1094
|
-
Ee as nt,
|
|
1095
|
-
_e as o,
|
|
1096
|
-
se as p,
|
|
1097
|
-
Re as q,
|
|
1098
|
-
q as r,
|
|
1099
|
-
Ae as rt,
|
|
1100
|
-
pe as s,
|
|
1101
|
-
at as t,
|
|
1102
|
-
Le as tt,
|
|
1103
|
-
rt as u,
|
|
1104
|
-
w as v,
|
|
1105
|
-
We as w,
|
|
1106
|
-
te as x,
|
|
1107
|
-
et as y,
|
|
1108
|
-
J as z
|
|
1109
|
-
};
|