@gengage/assistant-fe 0.6.22 → 0.6.24
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/{api-paths-DE3_TyTw.js → api-paths-Bgg7-gUO.js} +144 -154
- package/dist/chat/catalog.d.ts +8 -0
- package/dist/chat/types.d.ts +2 -1
- package/dist/{chat-rvSffJXw.js → chat-CIfQyuBl.js} +26 -21
- package/dist/chat-runtime.js +1 -1
- package/dist/chat.iife.js +44 -44
- package/dist/chat.js +2 -2
- package/dist/{common-BWnFHbvv.js → common-CzYj5Rg3.js} +1 -1
- package/dist/common.js +5 -5
- package/dist/{connection-warning-Tk4ZjgMi.js → connection-warning-B1BbjAAP.js} +1 -1
- package/dist/{fastIntent-DIhMlxVd.js → fastIntent-DtvKVSIo.js} +1 -1
- package/dist/index.js +10 -10
- package/dist/native.iife.js +17 -17
- package/dist/qna-runtime.js +1 -1
- package/dist/qna.iife.js +7 -7
- package/dist/qna.js +1 -1
- package/dist/{runtime-wEP7N2Hr.js → runtime-BwKxrcVs.js} +3 -3
- package/dist/{runtime-H5hNQQKm.js → runtime-C2RFDcMJ.js} +1816 -1778
- package/dist/{runtime-CjJy8KKu.js → runtime-DLqO5X8q.js} +3 -3
- package/dist/{simbut-BlBLtgVy.js → simbut-C5AbbA4L.js} +1 -1
- package/dist/simbut.iife.js +1 -1
- package/dist/simbut.js +1 -1
- package/dist/{simrel-S6-OsWJ9.js → simrel-mH70kmF9.js} +1 -1
- package/dist/simrel-runtime.js +1 -1
- package/dist/simrel.iife.js +6 -6
- package/dist/simrel.js +2 -2
- package/dist/{widget-base-e4JwEf2I.js → widget-base-Cfjsry5x.js} +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as
|
|
2
|
-
var
|
|
1
|
+
import { i as z } from "./widget-base-Cfjsry5x.js";
|
|
2
|
+
var G = ({ element: e, renderElement: t }) => {
|
|
3
3
|
if (!e.children || e.children.length === 0) return null;
|
|
4
4
|
const r = document.createElement("div");
|
|
5
5
|
for (const n of e.children) {
|
|
@@ -8,10 +8,10 @@ var z = ({ element: e, renderElement: t }) => {
|
|
|
8
8
|
}
|
|
9
9
|
return r;
|
|
10
10
|
};
|
|
11
|
-
function
|
|
11
|
+
function Ue(e) {
|
|
12
12
|
const t = document.createElement("div");
|
|
13
13
|
if (t.className = e.containerClassName, !e.spec.elements[e.spec.root]) return t;
|
|
14
|
-
const r = e.unknownRenderer ??
|
|
14
|
+
const r = e.unknownRenderer ?? G, n = (i) => {
|
|
15
15
|
const s = e.spec.elements[i];
|
|
16
16
|
if (!s) return null;
|
|
17
17
|
const a = e.registry[s.type];
|
|
@@ -31,7 +31,7 @@ function He(e) {
|
|
|
31
31
|
}, o = n(e.spec.root);
|
|
32
32
|
return o && t.appendChild(o), t;
|
|
33
33
|
}
|
|
34
|
-
function
|
|
34
|
+
function ze(e, t) {
|
|
35
35
|
if (!t) return e;
|
|
36
36
|
const r = { ...e };
|
|
37
37
|
for (const [n, o] of Object.entries(t))
|
|
@@ -41,7 +41,7 @@ function Ue(e, t) {
|
|
|
41
41
|
function v(e) {
|
|
42
42
|
return typeof e == "object" && e !== null && typeof e.type == "string";
|
|
43
43
|
}
|
|
44
|
-
function
|
|
44
|
+
function j(e) {
|
|
45
45
|
const t = [];
|
|
46
46
|
let r = 0, n = !1, o = !1, i = 0;
|
|
47
47
|
for (let s = 0; s < e.length; s++) {
|
|
@@ -70,9 +70,9 @@ function I(e, t) {
|
|
|
70
70
|
return t.onDone?.(), !0;
|
|
71
71
|
try {
|
|
72
72
|
const o = JSON.parse(n);
|
|
73
|
-
return v(o) ? (
|
|
73
|
+
return v(o) ? (z("stream", `event: ${o.type}`, o), t.onEvent(o), o.type === "done" ? (t.onDone?.(), !0) : !1) : !1;
|
|
74
74
|
} catch {
|
|
75
|
-
const o =
|
|
75
|
+
const o = j(n);
|
|
76
76
|
if (o.length > 1) {
|
|
77
77
|
for (const i of o) try {
|
|
78
78
|
const s = JSON.parse(i);
|
|
@@ -86,7 +86,7 @@ function I(e, t) {
|
|
|
86
86
|
return !1;
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
|
-
async function
|
|
89
|
+
async function M(e, t) {
|
|
90
90
|
if (!e.ok) {
|
|
91
91
|
t.onError?.(/* @__PURE__ */ new Error(`HTTP ${e.status}: ${e.statusText}`));
|
|
92
92
|
return;
|
|
@@ -128,8 +128,8 @@ async function j(e, t) {
|
|
|
128
128
|
}
|
|
129
129
|
t.onDone?.();
|
|
130
130
|
}
|
|
131
|
-
function
|
|
132
|
-
const n = new AbortController(), o = r.signal ?
|
|
131
|
+
function Ge(e, t, r) {
|
|
132
|
+
const n = new AbortController(), o = r.signal ? $([r.signal, n.signal]) : n.signal;
|
|
133
133
|
return fetch(e, {
|
|
134
134
|
method: "POST",
|
|
135
135
|
headers: {
|
|
@@ -138,14 +138,14 @@ function ze(e, t, r) {
|
|
|
138
138
|
},
|
|
139
139
|
body: JSON.stringify(t),
|
|
140
140
|
signal: o
|
|
141
|
-
}).then((i) =>
|
|
141
|
+
}).then((i) => M(i, {
|
|
142
142
|
...r,
|
|
143
143
|
signal: o
|
|
144
144
|
})).catch((i) => {
|
|
145
145
|
i instanceof DOMException && i.name === "AbortError" || r.onError?.(i instanceof Error ? i : new Error(String(i)));
|
|
146
146
|
}), n;
|
|
147
147
|
}
|
|
148
|
-
function
|
|
148
|
+
function $(e) {
|
|
149
149
|
const t = new AbortController(), r = [];
|
|
150
150
|
for (const n of e) {
|
|
151
151
|
if (n.aborted)
|
|
@@ -157,22 +157,22 @@ function M(e) {
|
|
|
157
157
|
for (const n of r) n();
|
|
158
158
|
}, { once: !0 }), t.signal;
|
|
159
159
|
}
|
|
160
|
-
var N = 3,
|
|
160
|
+
var N = 3, B = (e, t) => {
|
|
161
161
|
const r = e.replace(/\s+/g, " ").trim().replace(/^[,.;:!?•-]+|[,.;:!?•-]+$/g, "");
|
|
162
162
|
if (!r) return "";
|
|
163
163
|
const n = t?.stripLeadingStopWords ? r.replace(/^(?:daha|için)\s+/i, "").trim() : r;
|
|
164
164
|
return n ? n.split(/\s+/).slice(0, 3).join(" ").trim() : "";
|
|
165
|
-
}, x = (e, t) => e ? e.split(/[•,;:/()]|(?:\sve\s)|(?:\sand\s)|(?:\sile\s)|(?:\sfor\s)|(?:\swith\s)/i).map((r) =>
|
|
166
|
-
function
|
|
165
|
+
}, x = (e, t) => e ? e.split(/[•,;:/()]|(?:\sve\s)|(?:\sand\s)|(?:\sile\s)|(?:\sfor\s)|(?:\swith\s)/i).map((r) => B(r, t)).filter(Boolean) : [];
|
|
166
|
+
function K(e) {
|
|
167
167
|
const t = (e.display_keywords ?? []).flatMap((o) => x(o, { stripLeadingStopWords: !0 })), r = t.filter((o, i) => t.indexOf(o) === i);
|
|
168
168
|
if (r.length > 0) return r.slice(0, N);
|
|
169
169
|
const n = [...x(e.chosen_attribute, { stripLeadingStopWords: !0 }), ...x(e.short_name)];
|
|
170
170
|
return n.filter((o, i) => n.indexOf(o) === i).slice(0, N);
|
|
171
171
|
}
|
|
172
|
-
function K(e) {
|
|
173
|
-
return B(e).join(" • ");
|
|
174
|
-
}
|
|
175
172
|
function V(e) {
|
|
173
|
+
return K(e).join(" • ");
|
|
174
|
+
}
|
|
175
|
+
function W(e) {
|
|
176
176
|
return e === "beauty_consulting" || e === "account_expert";
|
|
177
177
|
}
|
|
178
178
|
function P(...e) {
|
|
@@ -194,85 +194,85 @@ function R(e) {
|
|
|
194
194
|
}
|
|
195
195
|
return t;
|
|
196
196
|
}
|
|
197
|
-
function
|
|
197
|
+
function je(e) {
|
|
198
198
|
if (typeof e.type != "string") return null;
|
|
199
|
-
if (
|
|
199
|
+
if (F(e)) return e;
|
|
200
200
|
const t = e;
|
|
201
201
|
switch (t.type) {
|
|
202
202
|
case "outputText":
|
|
203
|
-
return F(t);
|
|
204
|
-
case "suggestedActions":
|
|
205
203
|
return Q(t);
|
|
206
|
-
case "
|
|
204
|
+
case "suggestedActions":
|
|
207
205
|
return J(t);
|
|
208
|
-
case "
|
|
206
|
+
case "productList":
|
|
209
207
|
return Y(t);
|
|
210
|
-
case "
|
|
208
|
+
case "productDetails":
|
|
211
209
|
return X(t);
|
|
212
|
-
case "
|
|
210
|
+
case "productDetailsSimilars":
|
|
213
211
|
return Z(t);
|
|
212
|
+
case "comparisonTable":
|
|
213
|
+
return ee(t);
|
|
214
214
|
case "context":
|
|
215
|
-
return
|
|
215
|
+
return ne(t);
|
|
216
216
|
case "chatStreamEnd":
|
|
217
|
-
return
|
|
217
|
+
return ie();
|
|
218
218
|
case "loading":
|
|
219
|
-
return ie(t);
|
|
220
|
-
case "panelLoading":
|
|
221
219
|
return se(t);
|
|
222
|
-
case "
|
|
220
|
+
case "panelLoading":
|
|
223
221
|
return ae(t);
|
|
224
|
-
case "
|
|
222
|
+
case "similarLoading":
|
|
225
223
|
return ce(t);
|
|
226
|
-
case "
|
|
224
|
+
case "redirect":
|
|
227
225
|
return ue(t);
|
|
228
|
-
case "
|
|
226
|
+
case "error":
|
|
229
227
|
return de(t);
|
|
230
|
-
case "
|
|
228
|
+
case "dummy":
|
|
231
229
|
return le(t);
|
|
230
|
+
case "launcherAction":
|
|
231
|
+
return pe(t);
|
|
232
232
|
case "text":
|
|
233
233
|
return T(t);
|
|
234
234
|
case "productItem":
|
|
235
|
-
return
|
|
235
|
+
return fe(t);
|
|
236
236
|
case "text_image":
|
|
237
237
|
return L(t);
|
|
238
238
|
case "quick_qna":
|
|
239
239
|
return D(t);
|
|
240
240
|
case "reviewHighlights":
|
|
241
|
-
return
|
|
241
|
+
return ye(t);
|
|
242
242
|
case "aiProductSuggestions":
|
|
243
|
-
return me(t);
|
|
244
|
-
case "aiProductGroupings":
|
|
245
243
|
return _e(t);
|
|
244
|
+
case "aiProductGroupings":
|
|
245
|
+
return he(t);
|
|
246
246
|
case "aiSuggestedSearches":
|
|
247
|
-
return
|
|
247
|
+
return be(t);
|
|
248
248
|
case "prosAndCons":
|
|
249
|
-
return
|
|
249
|
+
return ge(t);
|
|
250
250
|
case "getGroundingReview":
|
|
251
|
-
return
|
|
251
|
+
return we(t);
|
|
252
252
|
case "voice":
|
|
253
|
-
return
|
|
253
|
+
return Ae(t);
|
|
254
254
|
case "visitorDataResponse":
|
|
255
|
-
return
|
|
255
|
+
return me(t);
|
|
256
256
|
case "productListPreview":
|
|
257
|
-
return
|
|
257
|
+
return Se();
|
|
258
258
|
case "groupList":
|
|
259
|
-
return
|
|
259
|
+
return xe(t);
|
|
260
260
|
case "formGetInfo":
|
|
261
261
|
case "formTestDrive":
|
|
262
262
|
case "formServiceRequest":
|
|
263
263
|
case "launchFormPage":
|
|
264
|
-
return
|
|
264
|
+
return Pe(t);
|
|
265
265
|
case "launcherContent":
|
|
266
|
-
return
|
|
266
|
+
return Te(t);
|
|
267
267
|
case "handoff":
|
|
268
|
-
return
|
|
268
|
+
return Ce(t);
|
|
269
269
|
case "uiSpec":
|
|
270
|
-
return
|
|
270
|
+
return De(t);
|
|
271
271
|
default:
|
|
272
272
|
return null;
|
|
273
273
|
}
|
|
274
274
|
}
|
|
275
|
-
function
|
|
275
|
+
function F(e) {
|
|
276
276
|
const t = e.type;
|
|
277
277
|
if (typeof t != "string") return !1;
|
|
278
278
|
switch (t) {
|
|
@@ -298,7 +298,7 @@ function W(e) {
|
|
|
298
298
|
return !1;
|
|
299
299
|
}
|
|
300
300
|
}
|
|
301
|
-
function
|
|
301
|
+
function Q(e) {
|
|
302
302
|
const t = u(e.payload.text, e.payload.plain_text) ?? "", r = u(e.payload.plain_text, e.payload.text) ?? t;
|
|
303
303
|
if (e.payload.is_error) return {
|
|
304
304
|
type: "error",
|
|
@@ -318,8 +318,8 @@ function F(e) {
|
|
|
318
318
|
const a = e.payload.render_hint;
|
|
319
319
|
return typeof a == "string" && a && (n.renderHint = a), e.payload.kvkk === !0 && (n.kvkk = !0), n;
|
|
320
320
|
}
|
|
321
|
-
function
|
|
322
|
-
return
|
|
321
|
+
function J(e) {
|
|
322
|
+
return O((e.payload.actions ?? []).map((t) => {
|
|
323
323
|
const r = u(t.title) ?? "", n = b(t.requestDetails, r), o = n ? {
|
|
324
324
|
label: r,
|
|
325
325
|
action: n
|
|
@@ -327,7 +327,7 @@ function Q(e) {
|
|
|
327
327
|
return o ? (typeof t.icon == "string" && (o.icon = t.icon), typeof t.image == "string" && (o.image = t.image), o) : null;
|
|
328
328
|
}).filter(A), "chat");
|
|
329
329
|
}
|
|
330
|
-
function
|
|
330
|
+
function Y(e) {
|
|
331
331
|
const t = (Array.isArray(e.payload.style_variations) ? e.payload.style_variations : []).map((s) => {
|
|
332
332
|
const a = u(s.style_label);
|
|
333
333
|
if (!a) return null;
|
|
@@ -347,7 +347,7 @@ function J(e) {
|
|
|
347
347
|
product_list: _,
|
|
348
348
|
recommendation_groups: d
|
|
349
349
|
};
|
|
350
|
-
}).filter(A), r = e.payload.product_list ?? [], n =
|
|
350
|
+
}).filter(A), r = e.payload.product_list ?? [], n = W(e.payload.source) && t.length > 0 ? t[0].product_list : null, o = n ? Ee(n, "chat") : H(r, "chat");
|
|
351
351
|
o.panelHint = "panel";
|
|
352
352
|
const i = o.spec.elements[o.spec.root];
|
|
353
353
|
if (i) {
|
|
@@ -361,9 +361,9 @@ function J(e) {
|
|
|
361
361
|
}
|
|
362
362
|
return o;
|
|
363
363
|
}
|
|
364
|
-
function
|
|
364
|
+
function X(e) {
|
|
365
365
|
const t = e.payload.productDetails;
|
|
366
|
-
if (!t) return
|
|
366
|
+
if (!t) return Ie("chat");
|
|
367
367
|
const r = w(t);
|
|
368
368
|
return {
|
|
369
369
|
type: "ui_spec",
|
|
@@ -381,8 +381,8 @@ function Y(e) {
|
|
|
381
381
|
panelHint: "panel"
|
|
382
382
|
};
|
|
383
383
|
}
|
|
384
|
-
function
|
|
385
|
-
const t =
|
|
384
|
+
function Z(e) {
|
|
385
|
+
const t = H(e.payload.similarProducts ?? [], "chat"), r = t.spec.elements[t.spec.root];
|
|
386
386
|
return r && (r.props = {
|
|
387
387
|
...r.props,
|
|
388
388
|
similarsAppend: !0
|
|
@@ -391,7 +391,7 @@ function X(e) {
|
|
|
391
391
|
panelHint: "panel"
|
|
392
392
|
};
|
|
393
393
|
}
|
|
394
|
-
function
|
|
394
|
+
function ee(e) {
|
|
395
395
|
const t = e.payload.multiple_product_details ?? [], r = e.payload, n = {
|
|
396
396
|
key_differences: r.key_differences,
|
|
397
397
|
recommended_choice: r.recommended_choice,
|
|
@@ -408,13 +408,13 @@ function Z(e) {
|
|
|
408
408
|
const h = w(y);
|
|
409
409
|
s.push(h);
|
|
410
410
|
}
|
|
411
|
-
const a =
|
|
411
|
+
const a = te(o, s, n, i);
|
|
412
412
|
let c;
|
|
413
413
|
n?.recommended_choice_sku ? c = n.recommended_choice_sku : n?.winner_product && n.winner_product.length > 0 && (c = n.winner_product[0]?.product_detail?.sku ?? n.winner_product[0]?.sku);
|
|
414
414
|
const m = c ? s.find((y) => y.sku === c) ?? s[0] : s[0], _ = [];
|
|
415
415
|
if (Array.isArray(n?.key_differences))
|
|
416
416
|
for (const y of n.key_differences) typeof y == "string" && _.push(y);
|
|
417
|
-
const d =
|
|
417
|
+
const d = U(n?.special_considerations), p = n?.recommended_choice, l = n?.winner_hits, g = {};
|
|
418
418
|
for (const y of s) {
|
|
419
419
|
const h = y.sku;
|
|
420
420
|
h && (g[h] = {
|
|
@@ -442,7 +442,7 @@ function Z(e) {
|
|
|
442
442
|
panelHint: "panel"
|
|
443
443
|
};
|
|
444
444
|
}
|
|
445
|
-
function
|
|
445
|
+
function te(e, t, r, n) {
|
|
446
446
|
if (!e) return [];
|
|
447
447
|
const o = Object.entries(e);
|
|
448
448
|
if (o.length === 0) return [];
|
|
@@ -460,13 +460,13 @@ function ee(e, t, r, n) {
|
|
|
460
460
|
}
|
|
461
461
|
return l;
|
|
462
462
|
}
|
|
463
|
-
const s = e, a = t.map((d) => String(d.sku ?? "")).filter((d) => d.length > 0), c = r.criteria_view ?? r.criteria_view_short ?? {}, m = (n && n.length > 0 ? n : r.compared_field_names && r.compared_field_names.length > 0 ? r.compared_field_names :
|
|
463
|
+
const s = e, a = t.map((d) => String(d.sku ?? "")).filter((d) => d.length > 0), c = r.criteria_view ?? r.criteria_view_short ?? {}, m = (n && n.length > 0 ? n : r.compared_field_names && r.compared_field_names.length > 0 ? r.compared_field_names : oe(s)).filter((d) => d !== "name" && d !== "name_short" && !d.endsWith("_short")), _ = [];
|
|
464
464
|
for (const d of m) {
|
|
465
465
|
const p = a.map((g) => {
|
|
466
466
|
const f = s[g];
|
|
467
467
|
if (!f || typeof f != "object") return "";
|
|
468
468
|
const y = f[`${d}_short`], h = f[d];
|
|
469
|
-
return
|
|
469
|
+
return re(y ?? h);
|
|
470
470
|
});
|
|
471
471
|
if (p.every((g) => g.length === 0)) continue;
|
|
472
472
|
const l = c[d] ?? d;
|
|
@@ -477,7 +477,7 @@ function ee(e, t, r, n) {
|
|
|
477
477
|
}
|
|
478
478
|
return _;
|
|
479
479
|
}
|
|
480
|
-
function
|
|
480
|
+
function oe(e) {
|
|
481
481
|
const t = [], r = /* @__PURE__ */ new Set();
|
|
482
482
|
for (const n of Object.values(e))
|
|
483
483
|
if (!(!n || typeof n != "object"))
|
|
@@ -485,10 +485,10 @@ function te(e) {
|
|
|
485
485
|
r.has(o) || (r.add(o), t.push(o));
|
|
486
486
|
return t;
|
|
487
487
|
}
|
|
488
|
-
function
|
|
488
|
+
function re(e) {
|
|
489
489
|
return typeof e == "string" ? e : typeof e == "number" || typeof e == "boolean" ? String(e) : "";
|
|
490
490
|
}
|
|
491
|
-
function
|
|
491
|
+
function ne(e) {
|
|
492
492
|
return {
|
|
493
493
|
type: "metadata",
|
|
494
494
|
sessionId: "",
|
|
@@ -500,10 +500,10 @@ function re(e) {
|
|
|
500
500
|
}
|
|
501
501
|
};
|
|
502
502
|
}
|
|
503
|
-
function
|
|
503
|
+
function ie() {
|
|
504
504
|
return { type: "done" };
|
|
505
505
|
}
|
|
506
|
-
function
|
|
506
|
+
function se(e) {
|
|
507
507
|
return {
|
|
508
508
|
type: "metadata",
|
|
509
509
|
sessionId: "",
|
|
@@ -516,7 +516,7 @@ function ie(e) {
|
|
|
516
516
|
}
|
|
517
517
|
};
|
|
518
518
|
}
|
|
519
|
-
function
|
|
519
|
+
function ae(e) {
|
|
520
520
|
return {
|
|
521
521
|
type: "metadata",
|
|
522
522
|
sessionId: "",
|
|
@@ -529,7 +529,7 @@ function se(e) {
|
|
|
529
529
|
}
|
|
530
530
|
};
|
|
531
531
|
}
|
|
532
|
-
function
|
|
532
|
+
function ce(e) {
|
|
533
533
|
return {
|
|
534
534
|
type: "metadata",
|
|
535
535
|
sessionId: "",
|
|
@@ -542,7 +542,7 @@ function ae(e) {
|
|
|
542
542
|
}
|
|
543
543
|
};
|
|
544
544
|
}
|
|
545
|
-
function
|
|
545
|
+
function ue(e) {
|
|
546
546
|
const t = u(e.payload.url);
|
|
547
547
|
return t ? {
|
|
548
548
|
type: "action",
|
|
@@ -561,14 +561,14 @@ function ce(e) {
|
|
|
561
561
|
}
|
|
562
562
|
};
|
|
563
563
|
}
|
|
564
|
-
function
|
|
564
|
+
function de(e) {
|
|
565
565
|
return {
|
|
566
566
|
type: "error",
|
|
567
567
|
code: "BACKEND_ERROR",
|
|
568
568
|
message: u(e.payload?.text, e.payload?.message, e.payload?.error) ?? "Backend returned an error"
|
|
569
569
|
};
|
|
570
570
|
}
|
|
571
|
-
function
|
|
571
|
+
function le(e) {
|
|
572
572
|
return {
|
|
573
573
|
type: "metadata",
|
|
574
574
|
sessionId: "",
|
|
@@ -576,7 +576,7 @@ function de(e) {
|
|
|
576
576
|
meta: { noop: !0 }
|
|
577
577
|
};
|
|
578
578
|
}
|
|
579
|
-
function
|
|
579
|
+
function pe(e) {
|
|
580
580
|
const t = e.payload ?? {};
|
|
581
581
|
if (Array.isArray(t.action_list)) {
|
|
582
582
|
const o = { action_list: t.action_list }, i = typeof t.type == "string" ? t.type : void 0, s = typeof t.theme == "string" ? t.theme : void 0;
|
|
@@ -622,8 +622,8 @@ function T(e) {
|
|
|
622
622
|
}
|
|
623
623
|
};
|
|
624
624
|
}
|
|
625
|
-
function
|
|
626
|
-
return
|
|
625
|
+
function fe(e) {
|
|
626
|
+
return ve(e.payload, "qna");
|
|
627
627
|
}
|
|
628
628
|
function L(e) {
|
|
629
629
|
const t = u(e.payload.text) ?? "", r = b(e.payload.action, t);
|
|
@@ -651,7 +651,7 @@ function L(e) {
|
|
|
651
651
|
});
|
|
652
652
|
}
|
|
653
653
|
function D(e) {
|
|
654
|
-
return
|
|
654
|
+
return O((e.payload.action_list ?? []).map((t) => {
|
|
655
655
|
const r = u(t.title) ?? "", n = b(t.requestDetails, r), o = n ? {
|
|
656
656
|
label: r,
|
|
657
657
|
action: n
|
|
@@ -659,7 +659,7 @@ function D(e) {
|
|
|
659
659
|
return o ? (typeof t.icon == "string" && (o.icon = t.icon), typeof t.image == "string" && (o.image = t.image), o) : null;
|
|
660
660
|
}).filter(A), "qna");
|
|
661
661
|
}
|
|
662
|
-
function
|
|
662
|
+
function ye(e) {
|
|
663
663
|
const t = { reviews: (e.payload.reviews ?? []).map((r) => {
|
|
664
664
|
const n = {};
|
|
665
665
|
return typeof r.review_class == "string" && (n.review_class = r.review_class), typeof r.review_text == "string" && (n.review_text = r.review_text), (typeof r.review_rating == "string" || typeof r.review_rating == "number") && (n.review_rating = r.review_rating), typeof r.review_tag == "string" && (n.review_tag = r.review_tag), n;
|
|
@@ -676,7 +676,7 @@ function fe(e) {
|
|
|
676
676
|
}
|
|
677
677
|
};
|
|
678
678
|
}
|
|
679
|
-
function
|
|
679
|
+
function ge(e) {
|
|
680
680
|
const t = {};
|
|
681
681
|
return Array.isArray(e.payload.pros) && (t.pros = e.payload.pros), Array.isArray(e.payload.cons) && (t.cons = e.payload.cons), typeof e.payload.product_name == "string" && (t.productName = e.payload.product_name), {
|
|
682
682
|
type: "ui_spec",
|
|
@@ -690,7 +690,7 @@ function ye(e) {
|
|
|
690
690
|
}
|
|
691
691
|
};
|
|
692
692
|
}
|
|
693
|
-
function
|
|
693
|
+
function me(e) {
|
|
694
694
|
return {
|
|
695
695
|
type: "metadata",
|
|
696
696
|
sessionId: "",
|
|
@@ -698,12 +698,12 @@ function ge(e) {
|
|
|
698
698
|
meta: { visitorDataResponse: e.payload }
|
|
699
699
|
};
|
|
700
700
|
}
|
|
701
|
-
function
|
|
701
|
+
function _e(e) {
|
|
702
702
|
const t = e.payload.product_suggestions ?? [], r = [];
|
|
703
703
|
for (let n = 0; n < t.length; n++) {
|
|
704
704
|
const o = t[n];
|
|
705
705
|
if (!o) continue;
|
|
706
|
-
const i =
|
|
706
|
+
const i = Ne(o);
|
|
707
707
|
if (!i) continue;
|
|
708
708
|
const s = { product: i }, a = b(o.requestDetails, i.name);
|
|
709
709
|
a && (s.action = a), typeof o.role == "string" && (s.role = o.role), typeof o.reason == "string" && (s.reason = o.reason), typeof o.review_highlight == "string" && (s.reviewHighlight = o.review_highlight), Array.isArray(o.labels) && (s.labels = o.labels), typeof o.expert_quality_score == "number" && (s.expertQualityScore = o.expert_quality_score), r.push(s);
|
|
@@ -725,12 +725,12 @@ function me(e) {
|
|
|
725
725
|
}
|
|
726
726
|
};
|
|
727
727
|
}
|
|
728
|
-
function
|
|
728
|
+
function he(e) {
|
|
729
729
|
const t = e.payload.product_groupings ?? [], r = [], n = [];
|
|
730
730
|
for (let o = 0; o < t.length; o++) {
|
|
731
731
|
const i = t[o];
|
|
732
732
|
if (!i) continue;
|
|
733
|
-
const s = u(i.name) ?? "", a = u(i.description), c = u(i.highlight), m = Array.isArray(i.labels) ?
|
|
733
|
+
const s = u(i.name) ?? "", a = u(i.description), c = u(i.highlight), m = Array.isArray(i.labels) ? U(i.labels) : [], _ = u(i.sku, i.repr_sku), d = u(i.image, i.repr_image), p = ke(i, s, _), l = (Array.isArray(i.group_products) ? i.group_products : []).map((y) => {
|
|
734
734
|
const h = k(y);
|
|
735
735
|
return h ? E(h) : null;
|
|
736
736
|
}).filter(A), g = d ?? u(...l.map((y) => y.imageUrl));
|
|
@@ -776,7 +776,7 @@ function _e(e) {
|
|
|
776
776
|
}
|
|
777
777
|
};
|
|
778
778
|
}
|
|
779
|
-
function
|
|
779
|
+
function ke(e, t, r) {
|
|
780
780
|
const n = k(e.requestDetails);
|
|
781
781
|
if (n) {
|
|
782
782
|
if (n.type !== "findSimilar") return b(n, t);
|
|
@@ -796,7 +796,7 @@ function he(e, t, r) {
|
|
|
796
796
|
payload: R(o)
|
|
797
797
|
}, t);
|
|
798
798
|
}
|
|
799
|
-
function
|
|
799
|
+
function be(e) {
|
|
800
800
|
const t = e.payload.suggested_searches ?? [], r = [];
|
|
801
801
|
for (let n = 0; n < t.length; n++) {
|
|
802
802
|
const o = t[n];
|
|
@@ -817,7 +817,7 @@ function ke(e) {
|
|
|
817
817
|
action: l
|
|
818
818
|
}, f = u(o.detailed_user_message);
|
|
819
819
|
f && f !== i && (g.detailedMessage = f);
|
|
820
|
-
const y =
|
|
820
|
+
const y = V(o);
|
|
821
821
|
y && y !== i && y !== (f ?? "") && (g.whyDifferent = y), typeof o.image == "string" && (g.image = o.image), r.push(g);
|
|
822
822
|
}
|
|
823
823
|
return r.length === 0 ? {
|
|
@@ -837,7 +837,7 @@ function ke(e) {
|
|
|
837
837
|
}
|
|
838
838
|
};
|
|
839
839
|
}
|
|
840
|
-
function
|
|
840
|
+
function we(e) {
|
|
841
841
|
const t = e.payload, r = b(t.requestDetails ?? t.request_details, u(t.review_count, t.reviewCount, t.text, t.title) ?? "Show product reviews");
|
|
842
842
|
if (!r) return {
|
|
843
843
|
type: "metadata",
|
|
@@ -858,7 +858,7 @@ function be(e) {
|
|
|
858
858
|
}
|
|
859
859
|
};
|
|
860
860
|
}
|
|
861
|
-
function
|
|
861
|
+
function Se() {
|
|
862
862
|
return {
|
|
863
863
|
type: "metadata",
|
|
864
864
|
sessionId: "",
|
|
@@ -866,7 +866,7 @@ function we() {
|
|
|
866
866
|
meta: { analyzeAnimation: !0 }
|
|
867
867
|
};
|
|
868
868
|
}
|
|
869
|
-
function
|
|
869
|
+
function Ae(e) {
|
|
870
870
|
return {
|
|
871
871
|
type: "metadata",
|
|
872
872
|
sessionId: "",
|
|
@@ -874,7 +874,7 @@ function Se(e) {
|
|
|
874
874
|
meta: { voice: e.payload }
|
|
875
875
|
};
|
|
876
876
|
}
|
|
877
|
-
function
|
|
877
|
+
function xe(e) {
|
|
878
878
|
const t = e.payload.group_list ?? [], r = [];
|
|
879
879
|
for (const o of t) {
|
|
880
880
|
const i = o.group_name ?? "", s = (o.product_list ?? []).map(w);
|
|
@@ -906,7 +906,7 @@ function Ae(e) {
|
|
|
906
906
|
panelHint: "panel"
|
|
907
907
|
};
|
|
908
908
|
}
|
|
909
|
-
function
|
|
909
|
+
function Pe(e) {
|
|
910
910
|
return {
|
|
911
911
|
type: "metadata",
|
|
912
912
|
sessionId: "",
|
|
@@ -917,7 +917,7 @@ function xe(e) {
|
|
|
917
917
|
}
|
|
918
918
|
};
|
|
919
919
|
}
|
|
920
|
-
function
|
|
920
|
+
function Ce(e) {
|
|
921
921
|
const t = {};
|
|
922
922
|
return typeof e.payload?.summary == "string" && (t.summary = e.payload.summary), Array.isArray(e.payload?.products_discussed) && (t.products_discussed = e.payload.products_discussed), typeof e.payload?.user_sentiment == "string" && (t.user_sentiment = e.payload.user_sentiment), {
|
|
923
923
|
type: "ui_spec",
|
|
@@ -931,7 +931,7 @@ function Pe(e) {
|
|
|
931
931
|
}
|
|
932
932
|
};
|
|
933
933
|
}
|
|
934
|
-
function
|
|
934
|
+
function Te(e) {
|
|
935
935
|
return {
|
|
936
936
|
type: "metadata",
|
|
937
937
|
sessionId: "",
|
|
@@ -940,6 +940,20 @@ function Ce(e) {
|
|
|
940
940
|
};
|
|
941
941
|
}
|
|
942
942
|
function q(e, t) {
|
|
943
|
+
const r = {
|
|
944
|
+
product: e,
|
|
945
|
+
index: t
|
|
946
|
+
}, n = e, o = typeof n.sku == "string" ? n.sku : void 0;
|
|
947
|
+
return o && (r.action = {
|
|
948
|
+
title: typeof n.name == "string" ? n.name : "",
|
|
949
|
+
type: "launchSingleProduct",
|
|
950
|
+
payload: { sku: o }
|
|
951
|
+
}), {
|
|
952
|
+
type: "ProductCard",
|
|
953
|
+
props: r
|
|
954
|
+
};
|
|
955
|
+
}
|
|
956
|
+
function O(e, t) {
|
|
943
957
|
const r = {}, n = [];
|
|
944
958
|
for (let o = 0; o < e.length; o++) {
|
|
945
959
|
const i = e[o];
|
|
@@ -974,25 +988,13 @@ function q(e, t) {
|
|
|
974
988
|
}
|
|
975
989
|
};
|
|
976
990
|
}
|
|
977
|
-
function
|
|
991
|
+
function H(e, t) {
|
|
978
992
|
const r = {}, n = [];
|
|
979
993
|
for (let o = 0; o < e.length; o++) {
|
|
980
994
|
const i = e[o];
|
|
981
995
|
if (!i) continue;
|
|
982
996
|
const s = w(i), a = `product-${o}`;
|
|
983
|
-
n.push(a);
|
|
984
|
-
const c = {
|
|
985
|
-
product: s,
|
|
986
|
-
index: o
|
|
987
|
-
};
|
|
988
|
-
s.sku && (c.action = {
|
|
989
|
-
title: s.name,
|
|
990
|
-
type: "launchSingleProduct",
|
|
991
|
-
payload: { sku: s.sku }
|
|
992
|
-
}), r[a] = {
|
|
993
|
-
type: "ProductCard",
|
|
994
|
-
props: c
|
|
995
|
-
};
|
|
997
|
+
n.push(a), r[a] = q(s, o);
|
|
996
998
|
}
|
|
997
999
|
return r.root = {
|
|
998
1000
|
type: "ProductGrid",
|
|
@@ -1007,25 +1009,13 @@ function O(e, t) {
|
|
|
1007
1009
|
}
|
|
1008
1010
|
};
|
|
1009
1011
|
}
|
|
1010
|
-
function
|
|
1012
|
+
function Ee(e, t) {
|
|
1011
1013
|
const r = {}, n = [];
|
|
1012
1014
|
for (let o = 0; o < e.length; o++) {
|
|
1013
1015
|
const i = e[o];
|
|
1014
1016
|
if (!i) continue;
|
|
1015
1017
|
const s = `product-${o}`;
|
|
1016
|
-
n.push(s);
|
|
1017
|
-
const a = {
|
|
1018
|
-
product: i,
|
|
1019
|
-
index: o
|
|
1020
|
-
}, c = i.sku;
|
|
1021
|
-
c && (a.action = {
|
|
1022
|
-
title: i.name ?? "",
|
|
1023
|
-
type: "launchSingleProduct",
|
|
1024
|
-
payload: { sku: c }
|
|
1025
|
-
}), r[s] = {
|
|
1026
|
-
type: "ProductCard",
|
|
1027
|
-
props: a
|
|
1028
|
-
};
|
|
1018
|
+
n.push(s), r[s] = q(i, o);
|
|
1029
1019
|
}
|
|
1030
1020
|
return r.root = {
|
|
1031
1021
|
type: "ProductGrid",
|
|
@@ -1040,7 +1030,7 @@ function Te(e, t) {
|
|
|
1040
1030
|
}
|
|
1041
1031
|
};
|
|
1042
1032
|
}
|
|
1043
|
-
function
|
|
1033
|
+
function ve(e, t) {
|
|
1044
1034
|
return {
|
|
1045
1035
|
type: "ui_spec",
|
|
1046
1036
|
widget: t,
|
|
@@ -1056,7 +1046,7 @@ function Ee(e, t) {
|
|
|
1056
1046
|
}
|
|
1057
1047
|
};
|
|
1058
1048
|
}
|
|
1059
|
-
function
|
|
1049
|
+
function Ie(e) {
|
|
1060
1050
|
return {
|
|
1061
1051
|
type: "ui_spec",
|
|
1062
1052
|
widget: e,
|
|
@@ -1070,7 +1060,7 @@ function ve(e) {
|
|
|
1070
1060
|
}
|
|
1071
1061
|
};
|
|
1072
1062
|
}
|
|
1073
|
-
function
|
|
1063
|
+
function Ne(e) {
|
|
1074
1064
|
const t = u(e.sku), r = u(e.short_name), n = { ...k(e.product_item) ?? e }, o = u(e.discount_reason, e.discountReason);
|
|
1075
1065
|
return o && !u(n.discount_reason, n.discountReason) && (n.discount_reason = o), E(n, t, r);
|
|
1076
1066
|
}
|
|
@@ -1084,7 +1074,7 @@ function E(e, t, r) {
|
|
|
1084
1074
|
s && (i.brand = s);
|
|
1085
1075
|
const a = u(e.url);
|
|
1086
1076
|
a && (i.url = a);
|
|
1087
|
-
const c =
|
|
1077
|
+
const c = Re(e.images);
|
|
1088
1078
|
if (c.length > 0) i.images = c;
|
|
1089
1079
|
else {
|
|
1090
1080
|
const f = u(e.image, e.image_url, e.imageUrl);
|
|
@@ -1123,10 +1113,10 @@ function u(...e) {
|
|
|
1123
1113
|
if (r.length > 0) return r;
|
|
1124
1114
|
}
|
|
1125
1115
|
}
|
|
1126
|
-
function
|
|
1116
|
+
function Re(e) {
|
|
1127
1117
|
return Array.isArray(e) ? e.filter((t) => typeof t == "string" && t.length > 0) : [];
|
|
1128
1118
|
}
|
|
1129
|
-
function
|
|
1119
|
+
function U(e) {
|
|
1130
1120
|
if (typeof e == "string") {
|
|
1131
1121
|
const t = e.trim();
|
|
1132
1122
|
return t ? [t] : [];
|
|
@@ -1145,7 +1135,7 @@ function S(e) {
|
|
|
1145
1135
|
function A(e) {
|
|
1146
1136
|
return e != null;
|
|
1147
1137
|
}
|
|
1148
|
-
var
|
|
1138
|
+
var Le = /* @__PURE__ */ new Set([
|
|
1149
1139
|
"sku",
|
|
1150
1140
|
"name",
|
|
1151
1141
|
"brand",
|
|
@@ -1183,13 +1173,13 @@ function w(e) {
|
|
|
1183
1173
|
m && (c.imageUrl = m), e.images && e.images.length > 1 && (c.images = e.images), r != null && r > 0 && (c.price = String(r)), n != null && n > 0 && (c.originalPrice = String(n)), o !== void 0 && (c.discountPercent = o), i !== void 0 && (c.brand = i), e.rating !== void 0 && (c.rating = e.rating), e.review_count !== void 0 && (c.reviewCount = e.review_count), e.cart_code !== void 0 && (c.cartCode = e.cart_code), e.in_stock !== void 0 && (c.inStock = e.in_stock), e.variants && e.variants.length > 0 && (c.variants = e.variants), e.discount_reason !== void 0 && (c.discountReason = e.discount_reason), e.promotions && e.promotions.length > 0 && (c.promotions = e.promotions), e.description !== void 0 && (c.description = e.description), e.description_html !== void 0 && (c.descriptionHtml = e.description_html), e.features && e.features.length > 0 && (c.features = e.features), e.specifications !== void 0 && (c.specifications = e.specifications), e.facet_hits && (c.facetHits = e.facet_hits), e.category_names && e.category_names.length > 0 && (c.categoryNames = e.category_names), e.short_name !== void 0 && (c.shortName = e.short_name);
|
|
1184
1174
|
const _ = e, d = {};
|
|
1185
1175
|
let p = !1;
|
|
1186
|
-
for (const l of Object.keys(_))
|
|
1176
|
+
for (const l of Object.keys(_)) Le.has(l) || (d[l] = _[l], p = !0);
|
|
1187
1177
|
return p && (c.extras = d), c;
|
|
1188
1178
|
}
|
|
1189
|
-
function
|
|
1179
|
+
function Me(e) {
|
|
1190
1180
|
return e.results.map(w);
|
|
1191
1181
|
}
|
|
1192
|
-
function
|
|
1182
|
+
function $e(e) {
|
|
1193
1183
|
return e.product_groupings.map((t) => {
|
|
1194
1184
|
const r = {
|
|
1195
1185
|
name: t.name,
|
|
@@ -1198,7 +1188,7 @@ function Me(e) {
|
|
|
1198
1188
|
return t.highlight !== void 0 && (r.highlight = t.highlight), r;
|
|
1199
1189
|
});
|
|
1200
1190
|
}
|
|
1201
|
-
function
|
|
1191
|
+
function De(e) {
|
|
1202
1192
|
const t = e.payload.type, { type: r, ...n } = e.payload;
|
|
1203
1193
|
return {
|
|
1204
1194
|
type: "ui_spec",
|
|
@@ -1212,34 +1202,34 @@ function Le(e) {
|
|
|
1212
1202
|
}
|
|
1213
1203
|
};
|
|
1214
1204
|
}
|
|
1215
|
-
var
|
|
1205
|
+
var qe = {
|
|
1216
1206
|
process_action: "/process_action",
|
|
1217
1207
|
launcher_action: "/launcher_action",
|
|
1218
1208
|
similar_products: "/similar_products",
|
|
1219
1209
|
product_groupings: "/product_groupings"
|
|
1220
1210
|
};
|
|
1221
|
-
function
|
|
1211
|
+
function Oe(e) {
|
|
1222
1212
|
if (e === void 0) throw new Error("[gengage] middlewareUrl is required. Pass your Gengage backend URL in widget config.");
|
|
1223
1213
|
const t = e.trim();
|
|
1224
1214
|
return t === "" ? "" : t.replace(/\/+$/, "");
|
|
1225
1215
|
}
|
|
1226
|
-
function
|
|
1227
|
-
return `${
|
|
1216
|
+
function Be(e, t) {
|
|
1217
|
+
return `${Oe(t?.middlewareUrl)}/chat${qe[e]}`;
|
|
1228
1218
|
}
|
|
1229
1219
|
export {
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1220
|
+
Me as a,
|
|
1221
|
+
W as c,
|
|
1222
|
+
M as d,
|
|
1223
|
+
Ge as f,
|
|
1224
|
+
Ue as h,
|
|
1225
|
+
$e as i,
|
|
1226
|
+
K as l,
|
|
1227
|
+
G as m,
|
|
1228
|
+
Oe as n,
|
|
1239
1229
|
w as o,
|
|
1240
|
-
|
|
1241
|
-
|
|
1230
|
+
ze as p,
|
|
1231
|
+
je as r,
|
|
1242
1232
|
R as s,
|
|
1243
|
-
|
|
1244
|
-
|
|
1233
|
+
Be as t,
|
|
1234
|
+
V as u
|
|
1245
1235
|
};
|