@gengage/assistant-fe 0.4.5 → 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-BRKK63lt.js +303 -0
- package/dist/chat-runtime.js +13 -0
- package/dist/chat.iife.js +6 -6
- 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-B1lLKIxj.js → runtime-C0qZk0y7.js} +1643 -2297
- 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-C5e2gLuG.js +0 -387
- package/dist/locale-MM0U5eeR.js +0 -1109
- package/dist/native-webview-niMtkiHX.js +0 -586
- package/dist/schemas-JpRGzRQT.js +0 -4419
- /package/dist/{price-formatter-CR6VT5z4.js → price-formatter-xI3g9Cd4.js} +0 -0
package/dist/common.js
CHANGED
|
@@ -1,86 +1,88 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { a as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { a, c as t, d as s, f as r, i, l as n, m as o, n as c, o as m, p as l, r as g, t as d, u as p } from "./api-paths-C4GDpeTf.js";
|
|
2
|
+
import { C as E, S, _ as h, b as v, c as f, d as y, f as C, g as A, h as T, i as w, l as U, m as W, o as I, p as P, r as k, s as D, t as R, u as b, v as G, w as N, x as O, y as _ } from "./widget-base-TgwiA8cD.js";
|
|
3
|
+
import { N as L, a as M, c as z, i as B, k as H, n as F, o as K, r as V, s as Q, t as q } from "./context-VIG4SVcS.js";
|
|
4
|
+
import { a as j, n as J, r as X, t as Y } from "./pill-launcher-57nrdLRr.js";
|
|
5
|
+
import { n as ee, t as ae } from "./connection-warning-B6oIU-9s.js";
|
|
6
|
+
import { i as se, n as re, r as ie, t as ne } from "./overlay-1EO41ZC7.js";
|
|
7
|
+
import { a as ce, i as me, n as le, r as ge } from "./native-webview-DudQ7nHe.js";
|
|
8
|
+
import { _ as pe, a as ue, c as Ee, d as Se, f as he, g as ve, h as fe, i as ye, l as Ce, m as Ae, n as Te, o as we, p as Ue, r as We, s as Ie, t as Pe, u as ke, v as De, y as Re } from "./common-CEN5OW7E.js";
|
|
7
9
|
export {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
Ae as AccountRuntimeConfigSchema,
|
|
11
|
+
fe as AnalyticsAuthModeSchema,
|
|
12
|
+
he as AnalyticsClient,
|
|
13
|
+
f as BASE_WIDGET_THEME,
|
|
14
|
+
R as BaseWidget,
|
|
13
15
|
we as DEFAULT_CUSTOMIZATION_LOCALE,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
b as DEFAULT_WIDGET_THEME_TOKENS,
|
|
17
|
+
ve as UnknownActionPolicySchema,
|
|
18
|
+
J as VoiceInput,
|
|
19
|
+
g as adaptBackendEvent,
|
|
18
20
|
le as applyNativeSession,
|
|
19
21
|
Pe as autoDetectPageContext,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
22
|
+
C as basketAddEvent,
|
|
23
|
+
q as bootstrapSession,
|
|
24
|
+
d as buildChatEndpointUrl,
|
|
25
|
+
ne as buildOverlayIdempotencyKey,
|
|
26
|
+
P as chatHistorySnapshotEvent,
|
|
27
|
+
W as checkoutCompleteEvent,
|
|
28
|
+
T as checkoutStartEvent,
|
|
29
|
+
ae as configureConnectionWarning,
|
|
30
|
+
p as consumeStream,
|
|
29
31
|
Ie as createAccountIdentity,
|
|
30
32
|
Ue as createAnalyticsClient,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
33
|
+
pe as createDefaultAccountRuntimeConfig,
|
|
34
|
+
Ee as createDefaultAnalyticsConfig,
|
|
35
|
+
Ce as createFloatingChatConfig,
|
|
36
|
+
ge as createNativeWebViewBridge,
|
|
37
|
+
ke as createPdpQnaConfig,
|
|
38
|
+
Se as createPdpSimRelConfig,
|
|
39
|
+
l as defaultUnknownUISpecRenderer,
|
|
40
|
+
re as destroyOverlayWidgets,
|
|
41
|
+
me as detectNativeEnvironment,
|
|
40
42
|
Te as detectPageType,
|
|
41
|
-
|
|
42
|
-
|
|
43
|
+
k as dismissGlobalErrorToast,
|
|
44
|
+
M as dispatch,
|
|
43
45
|
We as extractSkuFromUrl,
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
46
|
+
w as getGlobalErrorMessage,
|
|
47
|
+
ie as getOverlayWidgets,
|
|
48
|
+
t as getSuggestedSearchKeywords,
|
|
49
|
+
n as getSuggestedSearchKeywordsText,
|
|
50
|
+
F as getWindowPageContext,
|
|
51
|
+
ye as initGengageClient,
|
|
52
|
+
ce as initNativeOverlayWidgets,
|
|
53
|
+
se as initOverlayWidgets,
|
|
54
|
+
X as isVoiceInputSupported,
|
|
55
|
+
K as listen,
|
|
56
|
+
A as llmUsageEvent,
|
|
57
|
+
Y as makePillLauncher,
|
|
58
|
+
r as mergeUISpecRegistry,
|
|
59
|
+
h as meteringIncrementEvent,
|
|
60
|
+
G as meteringSummaryEvent,
|
|
61
|
+
c as normalizeMiddlewareUrl,
|
|
62
|
+
i as normalizeProductGroupingsResponse,
|
|
63
|
+
a as normalizeSimilarProductsResponse,
|
|
64
|
+
De as parseAccountRuntimeConfig,
|
|
65
|
+
ue as preflightDiagnostics,
|
|
66
|
+
m as productToNormalized,
|
|
67
|
+
I as registerGlobalErrorToastListener,
|
|
68
|
+
o as renderUISpecWithRegistry,
|
|
69
|
+
V as resolveSession,
|
|
70
|
+
j as routeStreamAction,
|
|
71
|
+
Re as safeParseAccountRuntimeConfig,
|
|
72
|
+
L as sanitizeHtml,
|
|
73
|
+
D as showGlobalErrorToast,
|
|
74
|
+
_ as streamChunkEvent,
|
|
75
|
+
v as streamDoneEvent,
|
|
76
|
+
O as streamErrorEvent,
|
|
77
|
+
s as streamPost,
|
|
78
|
+
S as streamStartEvent,
|
|
79
|
+
E as streamUiSpecEvent,
|
|
80
|
+
ee as trackConnectionWarningRequest,
|
|
81
|
+
B as updatePageContext,
|
|
82
|
+
N as widgetHistorySnapshotEvent,
|
|
83
|
+
H as wireGADataLayer,
|
|
82
84
|
Q as wireQNAToChat,
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
85
|
+
z as wireSimilarToChat,
|
|
86
|
+
U as withBaseTheme,
|
|
87
|
+
y as withDefaultWidgetTheme
|
|
86
88
|
};
|
|
@@ -0,0 +1,529 @@
|
|
|
1
|
+
var T = /* @__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
|
+
]), E = /* @__PURE__ */ new Set([
|
|
35
|
+
"script",
|
|
36
|
+
"iframe",
|
|
37
|
+
"object",
|
|
38
|
+
"embed",
|
|
39
|
+
"form",
|
|
40
|
+
"input",
|
|
41
|
+
"textarea",
|
|
42
|
+
"select",
|
|
43
|
+
"button",
|
|
44
|
+
"style",
|
|
45
|
+
"link",
|
|
46
|
+
"meta",
|
|
47
|
+
"template",
|
|
48
|
+
"noscript"
|
|
49
|
+
]), b = {
|
|
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
|
+
div: /* @__PURE__ */ new Set(["style"]),
|
|
63
|
+
span: /* @__PURE__ */ new Set(["style"]),
|
|
64
|
+
p: /* @__PURE__ */ new Set(["style"])
|
|
65
|
+
};
|
|
66
|
+
function I(e) {
|
|
67
|
+
return /^\s*javascript\s*:/i.test(e);
|
|
68
|
+
}
|
|
69
|
+
var O = /* @__PURE__ */ new Set([
|
|
70
|
+
"color",
|
|
71
|
+
"background-color",
|
|
72
|
+
"font-size",
|
|
73
|
+
"font-weight",
|
|
74
|
+
"font-style",
|
|
75
|
+
"font-family",
|
|
76
|
+
"text-align",
|
|
77
|
+
"text-decoration",
|
|
78
|
+
"line-height",
|
|
79
|
+
"letter-spacing",
|
|
80
|
+
"margin",
|
|
81
|
+
"margin-top",
|
|
82
|
+
"margin-right",
|
|
83
|
+
"margin-bottom",
|
|
84
|
+
"margin-left",
|
|
85
|
+
"padding",
|
|
86
|
+
"padding-top",
|
|
87
|
+
"padding-right",
|
|
88
|
+
"padding-bottom",
|
|
89
|
+
"padding-left",
|
|
90
|
+
"border",
|
|
91
|
+
"border-top",
|
|
92
|
+
"border-right",
|
|
93
|
+
"border-bottom",
|
|
94
|
+
"border-left",
|
|
95
|
+
"border-radius",
|
|
96
|
+
"border-color",
|
|
97
|
+
"border-width",
|
|
98
|
+
"border-style",
|
|
99
|
+
"width",
|
|
100
|
+
"max-width",
|
|
101
|
+
"min-width",
|
|
102
|
+
"height",
|
|
103
|
+
"max-height",
|
|
104
|
+
"min-height",
|
|
105
|
+
"display",
|
|
106
|
+
"vertical-align",
|
|
107
|
+
"white-space",
|
|
108
|
+
"word-break",
|
|
109
|
+
"overflow",
|
|
110
|
+
"opacity",
|
|
111
|
+
"visibility",
|
|
112
|
+
"list-style",
|
|
113
|
+
"list-style-type",
|
|
114
|
+
"text-transform",
|
|
115
|
+
"text-indent",
|
|
116
|
+
"text-overflow",
|
|
117
|
+
"box-sizing",
|
|
118
|
+
"flex",
|
|
119
|
+
"flex-direction",
|
|
120
|
+
"flex-wrap",
|
|
121
|
+
"justify-content",
|
|
122
|
+
"align-items",
|
|
123
|
+
"gap"
|
|
124
|
+
]), P = /url\s*\(|expression\s*\(|javascript\s*:|\bimport\b|-moz-binding|behavior\s*:/i;
|
|
125
|
+
function N(e) {
|
|
126
|
+
const t = [];
|
|
127
|
+
for (const n of e.split(";")) {
|
|
128
|
+
const i = n.trim();
|
|
129
|
+
if (!i) continue;
|
|
130
|
+
const a = i.indexOf(":");
|
|
131
|
+
if (a === -1) continue;
|
|
132
|
+
const g = i.slice(0, a).trim().toLowerCase(), u = i.slice(a + 1).trim();
|
|
133
|
+
O.has(g) && (P.test(u) || t.push(i));
|
|
134
|
+
}
|
|
135
|
+
return t.join("; ");
|
|
136
|
+
}
|
|
137
|
+
function w(e, t) {
|
|
138
|
+
if (e.nodeType === Node.TEXT_NODE) return;
|
|
139
|
+
if (e.nodeType !== Node.ELEMENT_NODE) {
|
|
140
|
+
e.parentNode?.removeChild(e);
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
const n = e, i = n.tagName.toLowerCase();
|
|
144
|
+
if (E.has(i)) {
|
|
145
|
+
n.parentNode?.removeChild(n);
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
if (!T.has(i)) {
|
|
149
|
+
const r = Array.from(n.childNodes);
|
|
150
|
+
for (const c of r) t.insertBefore(c, n);
|
|
151
|
+
t.removeChild(n);
|
|
152
|
+
for (const c of r) w(c, t);
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
const a = b["*"] ?? /* @__PURE__ */ new Set(), g = b[i] ?? /* @__PURE__ */ new Set(), u = Array.from(n.attributes);
|
|
156
|
+
for (const r of u) {
|
|
157
|
+
const c = r.name.toLowerCase();
|
|
158
|
+
if (!a.has(c) && !g.has(c)) {
|
|
159
|
+
n.removeAttribute(r.name);
|
|
160
|
+
continue;
|
|
161
|
+
}
|
|
162
|
+
if (I(r.value)) {
|
|
163
|
+
n.removeAttribute(r.name);
|
|
164
|
+
continue;
|
|
165
|
+
}
|
|
166
|
+
if (c === "style") {
|
|
167
|
+
const d = N(r.value);
|
|
168
|
+
d ? n.setAttribute("style", d) : n.removeAttribute("style");
|
|
169
|
+
continue;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
if (i === "a") {
|
|
173
|
+
const r = n.getAttribute("href");
|
|
174
|
+
if (r !== null) {
|
|
175
|
+
const c = r.trim().toLowerCase();
|
|
176
|
+
!c.startsWith("http://") && !c.startsWith("https://") && !c.startsWith("mailto:") && n.removeAttribute("href");
|
|
177
|
+
}
|
|
178
|
+
n.setAttribute("target", "_blank"), n.setAttribute("rel", "noopener noreferrer");
|
|
179
|
+
}
|
|
180
|
+
if (i === "img") {
|
|
181
|
+
const r = n.getAttribute("src");
|
|
182
|
+
r !== null && (r.trim().toLowerCase().startsWith("https://") || n.removeAttribute("src"));
|
|
183
|
+
}
|
|
184
|
+
const p = Array.from(n.childNodes);
|
|
185
|
+
for (const r of p) w(r, n);
|
|
186
|
+
}
|
|
187
|
+
var k = ["http:", "https:"];
|
|
188
|
+
function J(e) {
|
|
189
|
+
try {
|
|
190
|
+
return k.includes(new URL(e).protocol);
|
|
191
|
+
} catch {
|
|
192
|
+
return !1;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
function S(e) {
|
|
196
|
+
if (e.startsWith("/") && !e.startsWith("//")) return !0;
|
|
197
|
+
try {
|
|
198
|
+
const t = new URL(e);
|
|
199
|
+
return k.includes(t.protocol);
|
|
200
|
+
} catch {
|
|
201
|
+
return !1;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
function X(e, t, n) {
|
|
205
|
+
(t === "href" || t === "src") && !S(n) || e.setAttribute(t, n);
|
|
206
|
+
}
|
|
207
|
+
function K(e) {
|
|
208
|
+
if (!e) return "";
|
|
209
|
+
const t = new DOMParser().parseFromString(e, "text/html").body, n = Array.from(t.childNodes);
|
|
210
|
+
for (const i of n) w(i, t);
|
|
211
|
+
return t.innerHTML;
|
|
212
|
+
}
|
|
213
|
+
function W() {
|
|
214
|
+
return typeof window < "u" && Array.isArray(window.dataLayer);
|
|
215
|
+
}
|
|
216
|
+
function o(e, t) {
|
|
217
|
+
const n = {
|
|
218
|
+
event: e,
|
|
219
|
+
...t
|
|
220
|
+
};
|
|
221
|
+
W() && window.dataLayer.push(n);
|
|
222
|
+
}
|
|
223
|
+
function D(e) {
|
|
224
|
+
o("gengage-on-init", { gengage_widget: e });
|
|
225
|
+
}
|
|
226
|
+
function v(e) {
|
|
227
|
+
o("gengage-show", { gengage_widget: e });
|
|
228
|
+
}
|
|
229
|
+
function U(e) {
|
|
230
|
+
o("gengage-hide", { gengage_widget: e });
|
|
231
|
+
}
|
|
232
|
+
function z(e, t) {
|
|
233
|
+
o("gengage-suggested-question", {
|
|
234
|
+
gengage_question_title: e,
|
|
235
|
+
gengage_action_type: t
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
function Y(e) {
|
|
239
|
+
o("gengage-find-similars", { gengage_sku: e });
|
|
240
|
+
}
|
|
241
|
+
function Z(e) {
|
|
242
|
+
o("gengage-compare-preselection", { gengage_sku: e });
|
|
243
|
+
}
|
|
244
|
+
function $(e) {
|
|
245
|
+
o("gengage-compare-selected", {
|
|
246
|
+
gengage_skus: e,
|
|
247
|
+
gengage_product_count: e.length
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
function ee() {
|
|
251
|
+
o("gengage-compare-clear");
|
|
252
|
+
}
|
|
253
|
+
function te(e) {
|
|
254
|
+
o("gengage-compare-received", { gengage_product_count: e });
|
|
255
|
+
}
|
|
256
|
+
function ne(e) {
|
|
257
|
+
o("gengage-like-product", { gengage_sku: e });
|
|
258
|
+
}
|
|
259
|
+
function ie() {
|
|
260
|
+
o("gengage-like-list");
|
|
261
|
+
}
|
|
262
|
+
function oe(e, t) {
|
|
263
|
+
o("gengage-search", {
|
|
264
|
+
gengage_search_query: e,
|
|
265
|
+
gengage_result_count: t
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
function re(e, t) {
|
|
269
|
+
o("gengage-product-detail", {
|
|
270
|
+
gengage_sku: e,
|
|
271
|
+
gengage_product_name: t
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
function M(e, t) {
|
|
275
|
+
o("gengage-similar-product-click", {
|
|
276
|
+
gengage_sku: e,
|
|
277
|
+
...t?.url !== void 0 ? { gengage_product_url: t.url } : {},
|
|
278
|
+
...t?.name !== void 0 ? { gengage_product_name: t.name } : {},
|
|
279
|
+
...t?.session_id !== void 0 ? { gengage_session_id: t.session_id } : {}
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
function R(e, t) {
|
|
283
|
+
o("gengage-similar-grouping-click", {
|
|
284
|
+
gengage_grouping_label: e,
|
|
285
|
+
gengage_grouping_index: t
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
function j(e) {
|
|
289
|
+
o("gengage-similar-products-impression", {
|
|
290
|
+
gengage_source_sku: e.source_sku,
|
|
291
|
+
gengage_product_count: e.product_count,
|
|
292
|
+
gengage_grouped: e.grouped,
|
|
293
|
+
...e.session_id !== void 0 ? { gengage_session_id: e.session_id } : {}
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
function ae(e) {
|
|
297
|
+
o("gengage-compare-product", {
|
|
298
|
+
gengage_skus: e,
|
|
299
|
+
gengage_product_count: e.length
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
function ge() {
|
|
303
|
+
o("gengage-chatbot-maximized");
|
|
304
|
+
}
|
|
305
|
+
function q(e) {
|
|
306
|
+
o("gengage-interface-not-ready", {
|
|
307
|
+
...e?.reason !== void 0 ? { gengage_reason: e.reason } : {},
|
|
308
|
+
...e?.attempts !== void 0 ? { gengage_attempts: e.attempts } : {},
|
|
309
|
+
...e?.message !== void 0 ? { gengage_message: e.message } : {}
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
function G(e, t) {
|
|
313
|
+
o("gengage-cart-add", {
|
|
314
|
+
gengage_sku: e,
|
|
315
|
+
gengage_quantity: t
|
|
316
|
+
});
|
|
317
|
+
}
|
|
318
|
+
function se() {
|
|
319
|
+
o("gengage-message-sent");
|
|
320
|
+
}
|
|
321
|
+
function ce() {
|
|
322
|
+
o("gengage-message-received");
|
|
323
|
+
}
|
|
324
|
+
function le() {
|
|
325
|
+
o("gengage-conversation-start");
|
|
326
|
+
}
|
|
327
|
+
function F() {
|
|
328
|
+
o("gengage-voice-input");
|
|
329
|
+
}
|
|
330
|
+
function Q(e, t) {
|
|
331
|
+
o("gengage-error", {
|
|
332
|
+
gengage_widget: e,
|
|
333
|
+
gengage_error: t
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
var f = null;
|
|
337
|
+
function ue() {
|
|
338
|
+
if (typeof window > "u") return () => {
|
|
339
|
+
};
|
|
340
|
+
if (f) return f;
|
|
341
|
+
const e = [];
|
|
342
|
+
function t(n, i) {
|
|
343
|
+
const a = (g) => i(g.detail);
|
|
344
|
+
window.addEventListener(n, a), e.push(() => window.removeEventListener(n, a));
|
|
345
|
+
}
|
|
346
|
+
return t("gengage:chat:open", () => v("chat")), t("gengage:chat:close", () => U("chat")), t("gengage:chat:ready", () => D("chat")), t("gengage:similar:add-to-cart", ({ sku: n, quantity: i }) => {
|
|
347
|
+
G(n, i);
|
|
348
|
+
}), t("gengage:similar:product-click", ({ sku: n, url: i, sessionId: a, productName: g }) => {
|
|
349
|
+
const u = {
|
|
350
|
+
url: i,
|
|
351
|
+
session_id: a
|
|
352
|
+
};
|
|
353
|
+
g !== void 0 && g !== "" && (u.name = g), M(n, u);
|
|
354
|
+
}), t("gengage:similar:grouping-click", ({ grouping_label: n, grouping_index: i }) => {
|
|
355
|
+
R(n, i);
|
|
356
|
+
}), t("gengage:similar:products-impression", ({ source_sku: n, product_count: i, grouped: a, sessionId: g }) => {
|
|
357
|
+
j({
|
|
358
|
+
source_sku: n,
|
|
359
|
+
product_count: i,
|
|
360
|
+
grouped: a,
|
|
361
|
+
session_id: g
|
|
362
|
+
});
|
|
363
|
+
}), t("gengage:qna:action", ({ title: n, type: i }) => {
|
|
364
|
+
z(n, i);
|
|
365
|
+
}), t("gengage:chat:voice", () => F()), t("gengage:qna:open-chat", () => v("chat")), t("gengage:global:error", ({ source: n, message: i }) => {
|
|
366
|
+
Q(n, i);
|
|
367
|
+
}), f = () => {
|
|
368
|
+
for (const n of e) n();
|
|
369
|
+
e.length = 0, f = null;
|
|
370
|
+
}, f;
|
|
371
|
+
}
|
|
372
|
+
function de(e, t) {
|
|
373
|
+
window.dispatchEvent(new CustomEvent(e, {
|
|
374
|
+
detail: t,
|
|
375
|
+
bubbles: !1
|
|
376
|
+
}));
|
|
377
|
+
}
|
|
378
|
+
function _(e, t) {
|
|
379
|
+
const n = (i) => {
|
|
380
|
+
t(i.detail);
|
|
381
|
+
};
|
|
382
|
+
return window.addEventListener(e, n), () => window.removeEventListener(e, n);
|
|
383
|
+
}
|
|
384
|
+
function H(e) {
|
|
385
|
+
if (e.type !== "user_message" && e.type !== "inputText") return null;
|
|
386
|
+
if (typeof e.payload == "string" && e.payload.trim().length > 0) return e.payload.trim();
|
|
387
|
+
if (typeof e.payload == "object" && e.payload !== null) {
|
|
388
|
+
const t = e.payload;
|
|
389
|
+
if (typeof t.text == "string") {
|
|
390
|
+
const n = t.text.trim();
|
|
391
|
+
if (n.length > 0) return n;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
return typeof e.title == "string" && e.title.trim().length > 0 ? e.title.trim() : null;
|
|
395
|
+
}
|
|
396
|
+
function V(e) {
|
|
397
|
+
if (e.type !== "inputText" && e.type !== "user_message") return e;
|
|
398
|
+
const t = typeof e.payload == "string" ? { text: e.payload.trim() } : e.payload != null && typeof e.payload == "object" && !Array.isArray(e.payload) ? { ...e.payload } : {};
|
|
399
|
+
if (typeof t.text != "string" || !t.text.trim()) {
|
|
400
|
+
const n = e.title?.trim();
|
|
401
|
+
n && (t.text = n);
|
|
402
|
+
}
|
|
403
|
+
return "is_launcher" in t || (t.is_launcher = 1), "is_suggested_text" in t || (t.is_suggested_text = 1), {
|
|
404
|
+
...e,
|
|
405
|
+
payload: t
|
|
406
|
+
};
|
|
407
|
+
}
|
|
408
|
+
function fe(e) {
|
|
409
|
+
let t = !1;
|
|
410
|
+
const n = [];
|
|
411
|
+
let i = 0, a = null, g = 0;
|
|
412
|
+
const u = 500, p = 10;
|
|
413
|
+
function r() {
|
|
414
|
+
return window.gengage?.chat ?? null;
|
|
415
|
+
}
|
|
416
|
+
function c() {
|
|
417
|
+
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?.();
|
|
418
|
+
}
|
|
419
|
+
function d(s, l) {
|
|
420
|
+
if (s.openWithAction) {
|
|
421
|
+
const L = l.type === "inputText" || l.type === "user_message" ? V(l) : l;
|
|
422
|
+
s.openWithAction(L);
|
|
423
|
+
return;
|
|
424
|
+
}
|
|
425
|
+
const h = H(l);
|
|
426
|
+
if (h && s.sendMessage) {
|
|
427
|
+
s.open?.(), s.sendMessage(h);
|
|
428
|
+
return;
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
function m() {
|
|
432
|
+
a !== null && (window.clearInterval(a), a = null);
|
|
433
|
+
}
|
|
434
|
+
function A() {
|
|
435
|
+
const s = r();
|
|
436
|
+
if (!s) return !1;
|
|
437
|
+
if (i > 0 && (s.open?.(), i = 0), n.length > 0) {
|
|
438
|
+
const l = n.splice(0, n.length);
|
|
439
|
+
for (const h of l) d(s, h);
|
|
440
|
+
}
|
|
441
|
+
return m(), !0;
|
|
442
|
+
}
|
|
443
|
+
function y() {
|
|
444
|
+
a === null && (g = 0, a = window.setInterval(() => {
|
|
445
|
+
A() || (g += 1, g >= p && ((n.length > 0 || i > 0) && q({
|
|
446
|
+
reason: "chat_unavailable_after_poll",
|
|
447
|
+
attempts: p
|
|
448
|
+
}), n.length = 0, i = 0, m()));
|
|
449
|
+
}, u));
|
|
450
|
+
}
|
|
451
|
+
const C = _("gengage:qna:action", (s) => {
|
|
452
|
+
const l = r();
|
|
453
|
+
if (l) {
|
|
454
|
+
d(l, s);
|
|
455
|
+
return;
|
|
456
|
+
}
|
|
457
|
+
c(), n.length >= 20 && n.shift(), n.push(s), y();
|
|
458
|
+
}), x = _("gengage:qna:open-chat", () => {
|
|
459
|
+
const s = r();
|
|
460
|
+
if (s) {
|
|
461
|
+
s.open?.();
|
|
462
|
+
return;
|
|
463
|
+
}
|
|
464
|
+
c(), i += 1, y();
|
|
465
|
+
});
|
|
466
|
+
return () => {
|
|
467
|
+
C(), x(), n.length = 0, i = 0, m();
|
|
468
|
+
};
|
|
469
|
+
}
|
|
470
|
+
function pe() {
|
|
471
|
+
return _("gengage:similar:product-click", ({ sku: e, url: t, sessionId: n }) => {
|
|
472
|
+
n && window.gengage?.chat?.saveSession(n, e), S(t) && (window.location.href = t);
|
|
473
|
+
});
|
|
474
|
+
}
|
|
475
|
+
function B() {
|
|
476
|
+
const e = window.__gengageSessionId ?? sessionStorage.getItem("gengage_session_id") ?? null ?? crypto.randomUUID();
|
|
477
|
+
return window.__gengageSessionId = e, sessionStorage.setItem("gengage_session_id", e), window.gengage || (window.gengage = {}), window.gengage.sessionId = e, e;
|
|
478
|
+
}
|
|
479
|
+
function he() {
|
|
480
|
+
return window.gengage?.pageContext ?? null;
|
|
481
|
+
}
|
|
482
|
+
function me(e) {
|
|
483
|
+
window.gengage || (window.gengage = {}), window.gengage.pageContext = {
|
|
484
|
+
pageType: "other",
|
|
485
|
+
...window.gengage.pageContext,
|
|
486
|
+
...e
|
|
487
|
+
}, window.dispatchEvent(new CustomEvent("gengage:context:update", { detail: e }));
|
|
488
|
+
}
|
|
489
|
+
function we(e) {
|
|
490
|
+
return {
|
|
491
|
+
sessionId: e?.sessionId ?? B(),
|
|
492
|
+
...e
|
|
493
|
+
};
|
|
494
|
+
}
|
|
495
|
+
export {
|
|
496
|
+
J as A,
|
|
497
|
+
se as C,
|
|
498
|
+
z as D,
|
|
499
|
+
v as E,
|
|
500
|
+
X as M,
|
|
501
|
+
K as N,
|
|
502
|
+
F as O,
|
|
503
|
+
ce as S,
|
|
504
|
+
oe as T,
|
|
505
|
+
Y as _,
|
|
506
|
+
de as a,
|
|
507
|
+
ie as b,
|
|
508
|
+
pe as c,
|
|
509
|
+
ee as d,
|
|
510
|
+
Z as f,
|
|
511
|
+
le as g,
|
|
512
|
+
$ as h,
|
|
513
|
+
me as i,
|
|
514
|
+
S as j,
|
|
515
|
+
ue as k,
|
|
516
|
+
G as l,
|
|
517
|
+
te as m,
|
|
518
|
+
he as n,
|
|
519
|
+
_ as o,
|
|
520
|
+
ae as p,
|
|
521
|
+
we as r,
|
|
522
|
+
fe as s,
|
|
523
|
+
B as t,
|
|
524
|
+
ge as u,
|
|
525
|
+
D as v,
|
|
526
|
+
re as w,
|
|
527
|
+
ne as x,
|
|
528
|
+
q as y
|
|
529
|
+
};
|