@gengage/assistant-fe 0.6.46 → 0.6.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chat/components/ChatDrawer.d.ts +15 -1
- package/dist/chat-runtime.js +1 -1
- package/dist/chat.iife.js +25 -25
- package/dist/chat.js +1 -1
- package/dist/{common-BYaIofv0.js → common-DzJ8OQwQ.js} +1 -1
- package/dist/common.js +5 -5
- package/dist/{connection-warning-BWCgMHwN.js → connection-warning-DBbES5G-.js} +1 -1
- package/dist/{fastIntent-BfYLNhFF.js → fastIntent-BLDisAcn.js} +1 -1
- package/dist/index.js +10 -10
- package/dist/native.iife.js +8 -8
- package/dist/qna-runtime.js +1 -1
- package/dist/qna.iife.js +1 -1
- package/dist/qna.js +1 -1
- package/dist/{request-response-cache-DxtNGhlh.js → request-response-cache-DVERFkOu.js} +1 -1
- package/dist/{runtime-IlZ-GH68.js → runtime-B7PRSP3B.js} +3 -3
- package/dist/{runtime-DBmJg9TG.js → runtime-CtOsorKK.js} +1049 -1031
- package/dist/{runtime-B9k46n2p.js → runtime-rmM8_uWp.js} +3 -3
- package/dist/{simbut-CobYs9jE.js → simbut-CWtmuhew.js} +1 -1
- package/dist/simbut.iife.js +1 -1
- package/dist/simbut.js +1 -1
- package/dist/{simrel-BEyFl3Ec.js → simrel-BDX9zun1.js} +1 -1
- package/dist/simrel-runtime.js +1 -1
- package/dist/simrel.iife.js +1 -1
- package/dist/simrel.js +2 -2
- package/dist/{widget-base-BsHKmSMq.js → widget-base-CrsfKJMB.js} +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { c as Xt, f as Sa, g as Ea, i as Pa, l as La, m as Ta, n as Aa, t as Ia } from "./request-response-cache-
|
|
1
|
+
import { c as Xt, f as Sa, g as Ea, i as Pa, l as La, m as Ta, n as Aa, t as Ia } from "./request-response-cache-DVERFkOu.js";
|
|
2
2
|
import { A as Ce, C as Ma, D as Na, E as Ba, M as de, N as ve, O as za, S as yt, T as Ra, _ as Ha, a as _e, b as Fa, d as Da, f as Ua, g as Oa, h as ja, j as he, l as qa, m as $a, p as Va, u as Ga, v as Wa, w as at, x as Ka } from "./context-UTzCGyR9.js";
|
|
3
|
-
import { i as ze, s as Qt, t as Ya } from "./widget-base-
|
|
4
|
-
import { d as ue, f as Za, i as Xa, n as Qa, p as Ja, r as en, t as wt, u as tn } from "./fastIntent-
|
|
3
|
+
import { i as ze, s as Qt, t as Ya } from "./widget-base-CrsfKJMB.js";
|
|
4
|
+
import { d as ue, f as Za, i as Xa, n as Qa, p as Ja, r as en, t as wt, u as tn } from "./fastIntent-BLDisAcn.js";
|
|
5
5
|
import { t as Oe } from "./locale-uQ5XZ2yS.js";
|
|
6
6
|
import { a as Jt, i as ea, n as xe, r as ta, t as ae } from "./price-formatter-CHUmYq8I.js";
|
|
7
7
|
function _t() {
|
|
@@ -85,15 +85,15 @@ function cn(t, e) {
|
|
|
85
85
|
case "inputText": {
|
|
86
86
|
const i = typeof t.payload == "string", o = i ? { text: t.payload } : t.payload != null && typeof t.payload == "object" && !Array.isArray(t.payload) ? t.payload : n, s = e.genericNonPdpLaunch === !0 && e.pageContext?.pageType !== "pdp" && (o.is_entry_question === 1 || o.is_entry_question === !0), c = o.is_search_suggestion === 1 || o.is_search_suggestion === !0, l = { is_launcher: 0 };
|
|
87
87
|
if (!s && e.pageContext?.extra && (l.page_details = e.pageContext.extra), !s && !c && !i && !("sku_list" in o)) {
|
|
88
|
-
const
|
|
89
|
-
|
|
88
|
+
const g = e.pageContext?.skuList && e.pageContext.skuList.length > 0 ? e.pageContext.skuList : e.pageContext?.sku ? [e.pageContext.sku] : void 0;
|
|
89
|
+
g && g.length > 0 && (l.sku_list = g);
|
|
90
90
|
}
|
|
91
91
|
"is_suggested_text" in o || (l.is_suggested_text = 0);
|
|
92
|
-
const
|
|
93
|
-
for (const [
|
|
92
|
+
const p = { ...o };
|
|
93
|
+
for (const [g, h] of Object.entries(l)) g in p || (p[g] = h);
|
|
94
94
|
return {
|
|
95
95
|
...t,
|
|
96
|
-
payload:
|
|
96
|
+
payload: p
|
|
97
97
|
};
|
|
98
98
|
}
|
|
99
99
|
case "findSimilar": {
|
|
@@ -206,25 +206,25 @@ function pn(t, e, a) {
|
|
|
206
206
|
body: s,
|
|
207
207
|
signal: n.signal
|
|
208
208
|
};
|
|
209
|
-
const
|
|
210
|
-
if (!
|
|
211
|
-
let h =
|
|
209
|
+
const p = c ? await fetch(o, l) : await Ia(o, l);
|
|
210
|
+
if (!p.ok) {
|
|
211
|
+
let h = p.statusText;
|
|
212
212
|
try {
|
|
213
|
-
const m = await
|
|
213
|
+
const m = await p.json(), x = m.detail ?? m.message ?? m.error;
|
|
214
214
|
typeof x == "string" && (h = x);
|
|
215
215
|
} catch {
|
|
216
216
|
}
|
|
217
|
-
e.onError(/* @__PURE__ */ new Error(`HTTP ${
|
|
217
|
+
e.onError(/* @__PURE__ */ new Error(`HTTP ${p.status}: ${h}`));
|
|
218
218
|
return;
|
|
219
219
|
}
|
|
220
|
-
const
|
|
221
|
-
await Sa(
|
|
220
|
+
const g = kt(e);
|
|
221
|
+
await Sa(p, {
|
|
222
222
|
onEvent: (h) => {
|
|
223
223
|
const m = Pa(h);
|
|
224
224
|
if (m)
|
|
225
225
|
switch (m.type) {
|
|
226
226
|
case "text_chunk":
|
|
227
|
-
|
|
227
|
+
g.callbacks.onTextChunk(m.content, m.final === !0, {
|
|
228
228
|
productMentions: m.productMentions,
|
|
229
229
|
skuToProductItem: m.skuToProductItem,
|
|
230
230
|
conversationMode: m.conversationMode,
|
|
@@ -233,25 +233,25 @@ function pn(t, e, a) {
|
|
|
233
233
|
});
|
|
234
234
|
break;
|
|
235
235
|
case "ui_spec":
|
|
236
|
-
|
|
236
|
+
g.callbacks.onUISpec(m.spec, m.widget, m.panelHint, m.clearPanel === !0);
|
|
237
237
|
break;
|
|
238
238
|
case "action":
|
|
239
|
-
|
|
239
|
+
g.callbacks.onAction(m);
|
|
240
240
|
break;
|
|
241
241
|
case "metadata":
|
|
242
|
-
|
|
242
|
+
g.callbacks.onMetadata(m);
|
|
243
243
|
break;
|
|
244
244
|
case "error":
|
|
245
|
-
|
|
245
|
+
g.callbacks.onError(new Error(m.message));
|
|
246
246
|
break;
|
|
247
247
|
case "done":
|
|
248
|
-
|
|
248
|
+
g.fireDone();
|
|
249
249
|
break;
|
|
250
250
|
}
|
|
251
251
|
},
|
|
252
252
|
onError: e.onError,
|
|
253
253
|
signal: n.signal
|
|
254
|
-
}),
|
|
254
|
+
}), g.fireDone();
|
|
255
255
|
} catch (o) {
|
|
256
256
|
if (o instanceof DOMException && o.name === "AbortError") return;
|
|
257
257
|
e.onError(o instanceof Error ? o : new Error(String(o)));
|
|
@@ -311,7 +311,9 @@ var Re = {
|
|
|
311
311
|
loadingMessage: "İsteğinizi inceliyorum...",
|
|
312
312
|
loadingSequenceGeneric: [
|
|
313
313
|
"İsteğinizi inceliyorum...",
|
|
314
|
-
"Ürün
|
|
314
|
+
"Ürün detaylarını inceliyorum...",
|
|
315
|
+
"Kontrol ediyorum...",
|
|
316
|
+
"Bulduklarımı değerlendiriyorum...",
|
|
315
317
|
"Detayları inceliyorum..."
|
|
316
318
|
],
|
|
317
319
|
loadingSequencePanel: [
|
|
@@ -459,7 +461,9 @@ var Re = {
|
|
|
459
461
|
loadingMessage: "Reviewing your request...",
|
|
460
462
|
loadingSequenceGeneric: [
|
|
461
463
|
"Reviewing your request...",
|
|
462
|
-
"
|
|
464
|
+
"Reviewing product details...",
|
|
465
|
+
"Checking the strongest signals...",
|
|
466
|
+
"Evaluating what I found...",
|
|
463
467
|
"Reviewing the details..."
|
|
464
468
|
],
|
|
465
469
|
loadingSequencePanel: [
|
|
@@ -649,14 +653,14 @@ function na(t, e, a) {
|
|
|
649
653
|
c.className = "gengage-chat-beauty-photo-step-content";
|
|
650
654
|
const l = document.createElement("div");
|
|
651
655
|
l.className = "gengage-chat-beauty-photo-step-title", l.textContent = (typeof n.title == "string" ? n.title : void 0) ?? i.beautyPhotoStepTitle;
|
|
652
|
-
const
|
|
653
|
-
|
|
654
|
-
const
|
|
655
|
-
|
|
656
|
+
const p = document.createElement("p");
|
|
657
|
+
p.className = "gengage-chat-beauty-photo-step-desc", p.textContent = (typeof n.description == "string" ? n.description : void 0) ?? i.beautyPhotoStepDescription;
|
|
658
|
+
const g = document.createElement("div");
|
|
659
|
+
g.className = "gengage-chat-beauty-photo-step-actions";
|
|
656
660
|
const h = document.createElement("button");
|
|
657
661
|
h.type = "button", h.className = "gengage-chat-beauty-photo-step-upload gds-btn gds-btn-primary", h.textContent = r ? i.beautyPhotoStepProcessing : (typeof n.upload_label == "string" ? n.upload_label : void 0) ?? i.beautyPhotoStepUpload, h.disabled = r, a?.onUpload && h.addEventListener("click", () => a.onUpload());
|
|
658
662
|
const m = document.createElement("button");
|
|
659
|
-
return m.type = "button", m.className = "gengage-chat-beauty-photo-step-skip gds-btn gds-btn-ghost", m.textContent = (typeof n.skip_label == "string" ? n.skip_label : void 0) ?? i.beautyPhotoStepSkip, a?.onSkip && m.addEventListener("click", () => a.onSkip()),
|
|
663
|
+
return m.type = "button", m.className = "gengage-chat-beauty-photo-step-skip gds-btn gds-btn-ghost", m.textContent = (typeof n.skip_label == "string" ? n.skip_label : void 0) ?? i.beautyPhotoStepSkip, a?.onSkip && m.addEventListener("click", () => a.onSkip()), g.appendChild(h), g.appendChild(m), c.appendChild(l), c.appendChild(p), c.appendChild(g), o.appendChild(s), o.appendChild(c), o;
|
|
660
664
|
}
|
|
661
665
|
function Cn(t, e) {
|
|
662
666
|
if (t) return t;
|
|
@@ -727,10 +731,10 @@ function ia(t, e) {
|
|
|
727
731
|
c.className = "gengage-chat-photo-analysis-section gengage-chat-photo-analysis-section--celeb";
|
|
728
732
|
const l = document.createElement("h4");
|
|
729
733
|
l.className = "gengage-chat-photo-analysis-section-title", l.textContent = t.celebStyle;
|
|
730
|
-
const
|
|
731
|
-
if (
|
|
732
|
-
const
|
|
733
|
-
|
|
734
|
+
const p = document.createElement("p");
|
|
735
|
+
if (p.className = "gengage-chat-photo-analysis-celeb-name", p.textContent = e.celebStyle, c.appendChild(l), c.appendChild(p), e.celebStyleReason) {
|
|
736
|
+
const g = document.createElement("p");
|
|
737
|
+
g.className = "gengage-chat-photo-analysis-celeb-reason", g.textContent = e.celebStyleReason, c.appendChild(g);
|
|
734
738
|
}
|
|
735
739
|
r.appendChild(c);
|
|
736
740
|
}
|
|
@@ -764,7 +768,7 @@ var Et = '<svg viewBox="0 0 16 16" class="gengage-chat-icon"><path d="M3 8h10M9
|
|
|
764
768
|
review: '<svg viewBox="0 0 16 16" class="gengage-chat-icon"><polygon points="8,1 10,6 15,6 11,9 12.5,14 8,11 3.5,14 5,9 1,6 6,6" fill="none" stroke="currentColor" stroke-width="1.5"/></svg>',
|
|
765
769
|
info: '<svg viewBox="0 0 16 16" class="gengage-chat-icon"><circle cx="8" cy="8" r="7" fill="none" stroke="currentColor" stroke-width="1.5"/><line x1="8" y1="7" x2="8" y2="12" stroke="currentColor" stroke-width="1.5"/><circle cx="8" cy="4.5" r="0.8" fill="currentColor"/></svg>',
|
|
766
770
|
similar: '<svg viewBox="0 0 16 16" class="gengage-chat-icon"><rect x="1" y="3" width="6" height="6" rx="1" fill="none" stroke="currentColor" stroke-width="1.5"/><rect x="9" y="3" width="6" height="6" rx="1" fill="none" stroke="currentColor" stroke-width="1.5"/></svg>'
|
|
767
|
-
}, Tn = Re, An =
|
|
771
|
+
}, Tn = Re, An = 3e3, Lt = 1500, In = /data:image\/(png|jpeg|jpg|webp);base64,[A-Za-z0-9+/=]+/gi;
|
|
768
772
|
async function Mn(t) {
|
|
769
773
|
for (const e of t) for (const a of e.types)
|
|
770
774
|
if (a.startsWith("image/"))
|
|
@@ -853,14 +857,14 @@ var Bn = class {
|
|
|
853
857
|
}
|
|
854
858
|
const l = document.createElement("div");
|
|
855
859
|
l.className = "gengage-chat-header-info", l.dataset.gengagePart = "chat-header-info";
|
|
856
|
-
const
|
|
857
|
-
|
|
858
|
-
const
|
|
859
|
-
if (
|
|
860
|
+
const p = document.createElement("div");
|
|
861
|
+
p.className = "gengage-chat-header-title-row", p.dataset.gengagePart = "chat-header-title-row";
|
|
862
|
+
const g = document.createElement("span");
|
|
863
|
+
if (g.className = "gengage-chat-header-title", g.dataset.gengagePart = "chat-header-title", g.textContent = e.headerTitle ?? this.i18n.headerTitle ?? "Product Expert", p.appendChild(g), e.headerBadge) {
|
|
860
864
|
const w = document.createElement("span");
|
|
861
|
-
w.className = "gengage-chat-header-badge gds-badge gds-badge-brand", w.dataset.gengagePart = "chat-header-badge", w.textContent = e.headerBadge,
|
|
865
|
+
w.className = "gengage-chat-header-badge gds-badge gds-badge-brand", w.dataset.gengagePart = "chat-header-badge", w.textContent = e.headerBadge, p.appendChild(w);
|
|
862
866
|
}
|
|
863
|
-
if (l.appendChild(
|
|
867
|
+
if (l.appendChild(p), e.footerAttribution === void 0) {
|
|
864
868
|
const w = this._createLegacyHeaderPoweredBy();
|
|
865
869
|
w && l.appendChild(w);
|
|
866
870
|
}
|
|
@@ -942,85 +946,85 @@ var Bn = class {
|
|
|
942
946
|
}
|
|
943
947
|
this.togglePanel(), this._onPanelToggle?.();
|
|
944
948
|
});
|
|
945
|
-
let
|
|
949
|
+
let d = null, _ = null;
|
|
946
950
|
const y = 24, b = (w) => {
|
|
947
951
|
if (!(this._options.getMobileViewport?.() ?? window.innerWidth <= 768)) return;
|
|
948
952
|
const Y = w.changedTouches?.[0];
|
|
949
|
-
Y && (
|
|
953
|
+
Y && (d = Y.clientX, _ = Y.clientY);
|
|
950
954
|
}, A = (w) => {
|
|
951
|
-
if (!(this._options.getMobileViewport?.() ?? window.innerWidth <= 768) ||
|
|
955
|
+
if (!(this._options.getMobileViewport?.() ?? window.innerWidth <= 768) || d === null || _ === null) return;
|
|
952
956
|
const Y = w.changedTouches?.[0];
|
|
953
957
|
if (!Y) return;
|
|
954
|
-
const ce = Y.clientX -
|
|
955
|
-
if (
|
|
958
|
+
const ce = Y.clientX - d, oe = Y.clientY - _;
|
|
959
|
+
if (d = null, _ = null, Math.abs(oe) < y || Math.abs(oe) < Math.abs(ce)) return;
|
|
956
960
|
const M = oe < 0;
|
|
957
961
|
M !== this._panelCollapsed && (this._ignoreNextDividerClick = !0, this.setPanelCollapsed(M), this._onPanelToggle?.());
|
|
958
962
|
};
|
|
959
963
|
this._dividerEl.addEventListener("touchstart", b, { passive: !0 }), this._dividerEl.addEventListener("touchend", A, { passive: !0 }), this._cleanups.push(() => {
|
|
960
964
|
this._dividerEl.removeEventListener("touchstart", b), this._dividerEl.removeEventListener("touchend", A);
|
|
961
965
|
}), this._dividerEl.appendChild(u), x.appendChild(this._dividerEl);
|
|
962
|
-
const
|
|
963
|
-
|
|
964
|
-
const
|
|
965
|
-
|
|
966
|
-
const
|
|
967
|
-
window.addEventListener("offline",
|
|
968
|
-
window.removeEventListener("offline",
|
|
969
|
-
}), this._kvkkSlot = document.createElement("div"), this._kvkkSlot.className = "gengage-chat-kvkk-slot", this._kvkkSlot.dataset.gengagePart = "chat-kvkk-slot",
|
|
970
|
-
const
|
|
971
|
-
|
|
966
|
+
const L = document.createElement("div");
|
|
967
|
+
L.className = "gengage-chat-conversation", L.dataset.gengagePart = "chat-conversation", this._conversationEl = L, L.appendChild(i);
|
|
968
|
+
const E = document.createElement("div");
|
|
969
|
+
E.className = "gengage-chat-offline-bar gds-evidence-card gds-evidence-card-warning", E.dataset.gengagePart = "chat-offline-bar", E.setAttribute("role", "status"), E.setAttribute("aria-live", "polite"), E.textContent = this.i18n.offlineMessage, typeof navigator < "u" && !navigator.onLine && E.classList.add("gengage-chat-offline-bar--visible"), L.appendChild(E);
|
|
970
|
+
const T = () => E.classList.add("gengage-chat-offline-bar--visible"), N = () => E.classList.remove("gengage-chat-offline-bar--visible");
|
|
971
|
+
window.addEventListener("offline", T), window.addEventListener("online", N), this._cleanups.push(() => {
|
|
972
|
+
window.removeEventListener("offline", T), window.removeEventListener("online", N);
|
|
973
|
+
}), this._kvkkSlot = document.createElement("div"), this._kvkkSlot.className = "gengage-chat-kvkk-slot", this._kvkkSlot.dataset.gengagePart = "chat-kvkk-slot", L.appendChild(this._kvkkSlot), this.messagesEl = document.createElement("div"), this.messagesEl.id = dt, this.messagesEl.className = "gengage-chat-messages", this.messagesEl.dataset.gengagePart = "chat-messages", this.messagesEl.setAttribute("role", "log"), this.messagesEl.setAttribute("aria-live", "polite"), this.messagesEl.setAttribute("aria-atomic", "false"), this.messagesEl.setAttribute("aria-label", this.i18n.chatMessagesAriaLabel), Ct(this.messagesEl);
|
|
974
|
+
const F = document.createElement("button");
|
|
975
|
+
F.type = "button", F.className = "gengage-chat-former-messages-btn gds-chip", F.dataset.gengagePart = "chat-former-messages-button", F.textContent = this.i18n.showFormerMessagesButton, F.setAttribute("aria-label", this.i18n.showFormerMessagesButton), F.style.display = "none", F.addEventListener("click", () => {
|
|
972
976
|
this._options.presentation?.onReleasePresentationFocus?.();
|
|
973
|
-
}), this.messagesEl.appendChild(
|
|
977
|
+
}), this.messagesEl.appendChild(F), this._formerMessagesBtn = F;
|
|
974
978
|
const X = () => {
|
|
975
979
|
this._userInteractionUntil = Date.now() + 2e3;
|
|
976
980
|
};
|
|
977
|
-
let
|
|
978
|
-
const R = () => this._options.presentation,
|
|
979
|
-
|
|
980
|
-
|
|
981
|
+
let C = !1;
|
|
982
|
+
const R = () => this._options.presentation, D = () => {
|
|
983
|
+
C || (C = !0, requestAnimationFrame(() => {
|
|
984
|
+
C = !1;
|
|
981
985
|
const { scrollTop: w, scrollHeight: Y, clientHeight: ce } = this.messagesEl, oe = Y - w - ce;
|
|
982
986
|
this._userScrolledUp = oe > 10;
|
|
983
987
|
const M = this._presentationPinned ? oe < 96 : oe < 32, H = Date.now(), ee = H < this._programmaticScrollUntil, pe = !M && H < this._userInteractionUntil, V = ee ? !1 : pe;
|
|
984
988
|
M !== this._presentationPinned && (this._presentationPinned = M, R()?.onPinnedToBottomChange?.(M)), V !== this._presentationUserInteracting && (this._presentationUserInteracting = V, R()?.onUserInteractingChange?.(V));
|
|
985
989
|
}));
|
|
986
990
|
};
|
|
987
|
-
this.messagesEl.addEventListener("scroll",
|
|
988
|
-
this.messagesEl.removeEventListener("scroll",
|
|
991
|
+
this.messagesEl.addEventListener("scroll", D, { passive: !0 }), this._cleanups.push(() => {
|
|
992
|
+
this.messagesEl.removeEventListener("scroll", D);
|
|
989
993
|
});
|
|
990
|
-
const
|
|
994
|
+
const z = (w) => {
|
|
991
995
|
X(), w.deltaY < -6 && this._presentationFocusThreadId && this._options.presentation?.onFormerMessagesHint?.();
|
|
992
996
|
};
|
|
993
|
-
this.messagesEl.addEventListener("wheel",
|
|
994
|
-
const
|
|
997
|
+
this.messagesEl.addEventListener("wheel", z, { passive: !0 }), this._cleanups.push(() => this.messagesEl.removeEventListener("wheel", z));
|
|
998
|
+
const k = (w) => {
|
|
995
999
|
X(), this._touchStartY = w.touches[0]?.clientY ?? null;
|
|
996
|
-
},
|
|
1000
|
+
}, O = (w) => {
|
|
997
1001
|
X();
|
|
998
1002
|
const Y = w.touches[0]?.clientY, ce = this._touchStartY;
|
|
999
1003
|
typeof Y == "number" && typeof ce == "number" && Y - ce > 10 && this._presentationFocusThreadId && this._options.presentation?.onFormerMessagesHint?.();
|
|
1000
1004
|
};
|
|
1001
|
-
this.messagesEl.addEventListener("touchstart",
|
|
1002
|
-
this.messagesEl.removeEventListener("touchstart",
|
|
1003
|
-
}),
|
|
1004
|
-
const
|
|
1005
|
-
|
|
1005
|
+
this.messagesEl.addEventListener("touchstart", k, { passive: !0 }), this.messagesEl.addEventListener("touchmove", O, { passive: !0 }), this._cleanups.push(() => {
|
|
1006
|
+
this.messagesEl.removeEventListener("touchstart", k), this.messagesEl.removeEventListener("touchmove", O);
|
|
1007
|
+
}), L.appendChild(this.messagesEl), this._panelFloatingEl = document.createElement("div"), this._panelFloatingEl.className = "gengage-chat-panel-float", this._panelFloatingEl.dataset.gengagePart = "chat-panel-floating-layer", this._panelEl.appendChild(this._panelFloatingEl), this._resetPanelAiZoneElement(), this._pillsEl = document.createElement("div"), this._pillsEl.className = "gengage-chat-pills", this._pillsEl.dataset.gengagePart = "chat-suggestion-pills", this._pillsEl.setAttribute("role", "toolbar"), this._pillsEl.setAttribute("aria-label", this.i18n.suggestionsAriaLabel), this._pillsEl.style.display = "none";
|
|
1008
|
+
const B = document.createElement("div");
|
|
1009
|
+
B.className = "gengage-chat-pills-scroll", B.dataset.gengagePart = "chat-suggestion-pills-scroll", this._pillsEl.appendChild(B);
|
|
1006
1010
|
const q = document.createElement("button");
|
|
1007
1011
|
q.className = "gengage-chat-pills-arrow gds-btn gds-btn-ghost", q.dataset.gengagePart = "chat-suggestion-pills-more", q.type = "button", q.setAttribute("aria-label", this.i18n.moreSuggestionsAriaLabel), q.textContent = "›", q.addEventListener("click", () => {
|
|
1008
|
-
|
|
1012
|
+
B.scrollBy({
|
|
1009
1013
|
left: 150,
|
|
1010
1014
|
behavior: "smooth"
|
|
1011
1015
|
});
|
|
1012
1016
|
}), this._pillsEl.appendChild(q);
|
|
1013
|
-
let
|
|
1017
|
+
let U = !1;
|
|
1014
1018
|
const ne = () => {
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
const w =
|
|
1019
|
+
U || (U = !0, requestAnimationFrame(() => {
|
|
1020
|
+
U = !1;
|
|
1021
|
+
const w = B.scrollLeft + B.clientWidth >= B.scrollWidth - 4;
|
|
1018
1022
|
q.style.display = w ? "none" : "";
|
|
1019
1023
|
}));
|
|
1020
1024
|
};
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
}),
|
|
1025
|
+
B.addEventListener("scroll", ne, { passive: !0 }), this._cleanups.push(() => {
|
|
1026
|
+
B.removeEventListener("scroll", ne);
|
|
1027
|
+
}), L.appendChild(this._pillsEl), this._inputChipsEl = document.createElement("div"), this._inputChipsEl.className = "gengage-chat-input-chips", this._inputChipsEl.dataset.gengagePart = "chat-input-chips", this._inputChipsEl.style.display = "none", L.appendChild(this._inputChipsEl);
|
|
1024
1028
|
const W = document.createElement("div");
|
|
1025
1029
|
W.className = "gengage-chat-input-area", W.dataset.gengagePart = "chat-input-area", this.inputEl = document.createElement("textarea"), this.inputEl.className = "gengage-chat-input", this.inputEl.dataset.gengagePart = "chat-input", this.inputEl.rows = 1, this.inputEl.placeholder = this.i18n.inputPlaceholder, this.inputEl.setAttribute("aria-label", this.i18n.inputAriaLabel ?? this.i18n.inputPlaceholder), this.inputEl.addEventListener("input", () => {
|
|
1026
1030
|
this._resizeRafId !== null && cancelAnimationFrame(this._resizeRafId), this._resizeRafId = requestAnimationFrame(() => {
|
|
@@ -1105,7 +1109,7 @@ var Bn = class {
|
|
|
1105
1109
|
onError: (w, Y) => {
|
|
1106
1110
|
this._micBtn?.classList.remove("gengage-chat-mic-btn--active");
|
|
1107
1111
|
}
|
|
1108
|
-
}, { lang: this._voiceLang })), te.appendChild(this.sendBtn), W.appendChild(this._previewStrip), W.appendChild(this._fileInput), W.appendChild(te),
|
|
1112
|
+
}, { lang: this._voiceLang })), te.appendChild(this.sendBtn), W.appendChild(this._previewStrip), W.appendChild(this._fileInput), W.appendChild(te), L.appendChild(W), x.appendChild(L), this._comparisonDockSlotEl = document.createElement("div"), this._comparisonDockSlotEl.className = "gengage-chat-comparison-dock-slot", this._comparisonDockSlotEl.dataset.gengagePart = "comparison-dock-slot", x.appendChild(this._comparisonDockSlotEl), this.root.appendChild(x), this._setupHorizontalSwipe(L);
|
|
1109
1113
|
const se = this._createFooterAttribution();
|
|
1110
1114
|
se && this.root.appendChild(se);
|
|
1111
1115
|
const re = (w) => {
|
|
@@ -1150,8 +1154,13 @@ var Bn = class {
|
|
|
1150
1154
|
}
|
|
1151
1155
|
showTypingIndicator(t, e = "auto") {
|
|
1152
1156
|
this.removeTypingIndicator();
|
|
1153
|
-
const a = this._thinkingSteps.length > 0 ? this._thinkingSteps.slice(-3) : t ? [t] : this.i18n.loadingSequenceGeneric, { root:
|
|
1154
|
-
|
|
1157
|
+
const a = this._thinkingSteps.length > 0, n = a ? this._thinkingSteps.slice(-3) : t ? [t] : this.i18n.loadingSequenceGeneric, { root: r, binding: i } = this._createLoadingSequence("chat", n, "chat-typing-indicator", "gengage-chat-typing");
|
|
1158
|
+
r.dataset.typing = "true", this._typingLoadingBinding = i, this.messagesEl.appendChild(r), a && this._applyLoadingSteps(i, this._thinkingSteps, !0), this.setTypingIndicatorMode(e), this._scrollToBottom(!0);
|
|
1159
|
+
}
|
|
1160
|
+
resumeTypingIndicator() {
|
|
1161
|
+
if (this._typingLoadingBinding) return;
|
|
1162
|
+
const t = this._thinkingSteps.length > 0, e = t ? this._thinkingSteps.slice(-3) : this.i18n.loadingSequenceGeneric, { root: a, binding: n } = this._createLoadingSequence("chat", e, "chat-typing-indicator", "gengage-chat-typing");
|
|
1163
|
+
a.dataset.typing = "true", this._typingLoadingBinding = n, this.messagesEl.appendChild(a), t && this._applyLoadingSteps(n, this._thinkingSteps, !0), this.setTypingIndicatorMode("auto"), this._scrollToBottom(!0);
|
|
1155
1164
|
}
|
|
1156
1165
|
addThinkingStep(t) {
|
|
1157
1166
|
const e = t.trim();
|
|
@@ -1324,8 +1333,8 @@ var Bn = class {
|
|
|
1324
1333
|
if (this._panelAiZoneEl.isConnected && (this._clearPanelAiZoneState(), t !== "hidden")) {
|
|
1325
1334
|
if (this._panelAiZoneEl.removeAttribute("hidden"), t === "analyzing") {
|
|
1326
1335
|
this._panelAiZoneEl.innerHTML = "";
|
|
1327
|
-
const a = [e?.analyzingLabel ?? this.i18n.aiAnalysisAnalyzingLabel, ...this.i18n.loadingSequencePanel], { root:
|
|
1328
|
-
this._panelAiZoneLoadingBinding =
|
|
1336
|
+
const a = [e?.analyzingLabel ?? this.i18n.aiAnalysisAnalyzingLabel, ...this.i18n.loadingSequencePanel], n = this._thinkingSteps.length > 0, { root: r, binding: i } = this._createLoadingSequence("panel", n ? this._thinkingSteps.slice(-3) : a, "panel-ai-zone-loading", "gengage-chat-panel-ai-zone-inner");
|
|
1337
|
+
this._panelAiZoneLoadingBinding = i, n && this._applyLoadingSteps(i, this._thinkingSteps, !0), this._panelAiZoneEl.appendChild(r);
|
|
1329
1338
|
} else t === "results" && e?.resultEl && (this._panelAiZoneEl.innerHTML = "", this._panelAiZoneEl.appendChild(e.resultEl));
|
|
1330
1339
|
this.setTypingIndicatorMode("auto");
|
|
1331
1340
|
}
|
|
@@ -1414,112 +1423,112 @@ var Bn = class {
|
|
|
1414
1423
|
this._destroyLoadingBinding(this._panelLoadingBinding), this._panelLoadingBinding = null, this._dividerEl.classList.remove("gengage-chat-panel-divider--hidden"), this._panelEl.innerHTML = "", this._resetPanelAiZoneElement(), this._panelEl.appendChild(this._panelTopBar.getElement()), this._panelEl.appendChild(this._panelAiZoneEl);
|
|
1415
1424
|
const e = document.createElement("div");
|
|
1416
1425
|
e.className = "gengage-chat-panel-skeleton";
|
|
1417
|
-
const a = t === "comparisonTable" ? this.i18n.loadingSequenceComparison : this.i18n.loadingSequencePanel, { root:
|
|
1418
|
-
switch (this._panelLoadingBinding =
|
|
1426
|
+
const a = t === "comparisonTable" ? this.i18n.loadingSequenceComparison : this.i18n.loadingSequencePanel, n = this._thinkingSteps.length > 0, { root: r, binding: i } = this._createLoadingSequence("panel", n ? this._thinkingSteps.slice(-3) : a, "panel-loading-status", "gengage-chat-panel-loading-status");
|
|
1427
|
+
switch (this._panelLoadingBinding = i, n && this._applyLoadingSteps(i, this._thinkingSteps, !0), t) {
|
|
1419
1428
|
case "productDetails": {
|
|
1420
|
-
e.appendChild(
|
|
1421
|
-
const
|
|
1422
|
-
|
|
1423
|
-
for (let
|
|
1424
|
-
const
|
|
1425
|
-
|
|
1429
|
+
e.appendChild(r);
|
|
1430
|
+
const o = document.createElement("div");
|
|
1431
|
+
o.className = "gengage-chat-panel-skeleton-block gengage-chat-panel-skeleton-block--image", e.appendChild(o);
|
|
1432
|
+
for (let s = 0; s < 3; s++) {
|
|
1433
|
+
const c = document.createElement("div");
|
|
1434
|
+
c.className = "gengage-chat-panel-skeleton-block gengage-chat-panel-skeleton-block--text", e.appendChild(c);
|
|
1426
1435
|
}
|
|
1427
1436
|
break;
|
|
1428
1437
|
}
|
|
1429
1438
|
case "productList":
|
|
1430
1439
|
case "groupList": {
|
|
1431
|
-
e.appendChild(
|
|
1432
|
-
const
|
|
1433
|
-
|
|
1434
|
-
for (let
|
|
1435
|
-
const
|
|
1436
|
-
|
|
1440
|
+
e.appendChild(r);
|
|
1441
|
+
const o = document.createElement("div");
|
|
1442
|
+
o.className = "gengage-chat-panel-skeleton-grid";
|
|
1443
|
+
for (let s = 0; s < 6; s++) {
|
|
1444
|
+
const c = document.createElement("div");
|
|
1445
|
+
c.className = "gengage-chat-panel-skeleton-block gengage-chat-panel-skeleton-block--card", o.appendChild(c);
|
|
1437
1446
|
}
|
|
1438
|
-
e.appendChild(
|
|
1447
|
+
e.appendChild(o);
|
|
1439
1448
|
break;
|
|
1440
1449
|
}
|
|
1441
1450
|
case "comparisonTable": {
|
|
1442
|
-
e.classList.add("gengage-chat-panel-skeleton--comparison"), e.appendChild(
|
|
1443
|
-
const i = document.createElement("div");
|
|
1444
|
-
i.className = "gengage-chat-comparison gengage-chat-comparison--skeleton", i.setAttribute("aria-busy", "true");
|
|
1451
|
+
e.classList.add("gengage-chat-panel-skeleton--comparison"), e.appendChild(r);
|
|
1445
1452
|
const o = document.createElement("div");
|
|
1446
|
-
o.className = "gengage-chat-comparison-
|
|
1453
|
+
o.className = "gengage-chat-comparison gengage-chat-comparison--skeleton", o.setAttribute("aria-busy", "true");
|
|
1447
1454
|
const s = document.createElement("div");
|
|
1448
|
-
s.className = "gengage-chat-comparison-
|
|
1455
|
+
s.className = "gengage-chat-comparison-recommended";
|
|
1449
1456
|
const c = document.createElement("div");
|
|
1450
|
-
c.className = "gengage-chat-comparison-
|
|
1457
|
+
c.className = "gengage-chat-comparison-skeleton-shimmer gengage-chat-comparison-skeleton-rec-label", s.appendChild(c);
|
|
1451
1458
|
const l = document.createElement("div");
|
|
1452
|
-
l.className = "gengage-chat-comparison-
|
|
1453
|
-
const d = document.createElement("div");
|
|
1454
|
-
d.className = "gengage-chat-comparison-recommended-info";
|
|
1455
|
-
for (let k = 0; k < 2; k++) {
|
|
1456
|
-
const L = document.createElement("div");
|
|
1457
|
-
L.className = "gengage-chat-comparison-skeleton-shimmer gengage-chat-comparison-skeleton-rec-title", k === 1 && L.classList.add("gengage-chat-comparison-skeleton-rec-title--short"), d.appendChild(L);
|
|
1458
|
-
}
|
|
1459
|
+
l.className = "gengage-chat-comparison-recommended-body";
|
|
1459
1460
|
const p = document.createElement("div");
|
|
1460
|
-
p.className = "gengage-chat-comparison-skeleton-shimmer gengage-chat-comparison-skeleton-rec-
|
|
1461
|
+
p.className = "gengage-chat-comparison-skeleton-shimmer gengage-chat-comparison-skeleton-rec-img", p.setAttribute("aria-hidden", "true");
|
|
1462
|
+
const g = document.createElement("div");
|
|
1463
|
+
g.className = "gengage-chat-comparison-recommended-info";
|
|
1464
|
+
for (let T = 0; T < 2; T++) {
|
|
1465
|
+
const N = document.createElement("div");
|
|
1466
|
+
N.className = "gengage-chat-comparison-skeleton-shimmer gengage-chat-comparison-skeleton-rec-title", T === 1 && N.classList.add("gengage-chat-comparison-skeleton-rec-title--short"), g.appendChild(N);
|
|
1467
|
+
}
|
|
1461
1468
|
const h = document.createElement("div");
|
|
1462
|
-
h.className = "gengage-chat-comparison-
|
|
1469
|
+
h.className = "gengage-chat-comparison-skeleton-shimmer gengage-chat-comparison-skeleton-rec-price", g.appendChild(h), l.appendChild(p), l.appendChild(g), s.appendChild(l);
|
|
1463
1470
|
const m = document.createElement("div");
|
|
1464
|
-
m.className = "gengage-chat-comparison-
|
|
1465
|
-
const x = document.createElement("
|
|
1466
|
-
x.className = "gengage-chat-comparison-skeleton-hl-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1471
|
+
m.className = "gengage-chat-comparison-highlights";
|
|
1472
|
+
const x = document.createElement("div");
|
|
1473
|
+
x.className = "gengage-chat-comparison-skeleton-shimmer gengage-chat-comparison-skeleton-hl-label", m.appendChild(x);
|
|
1474
|
+
const v = document.createElement("ul");
|
|
1475
|
+
v.className = "gengage-chat-comparison-skeleton-hl-list";
|
|
1476
|
+
for (let T = 0; T < 3; T++) {
|
|
1477
|
+
const N = document.createElement("li"), F = document.createElement("div");
|
|
1478
|
+
F.className = "gengage-chat-comparison-skeleton-shimmer gengage-chat-comparison-skeleton-hl-line", T === 1 && F.classList.add("gengage-chat-comparison-skeleton-hl-line--medium"), T === 2 && F.classList.add("gengage-chat-comparison-skeleton-hl-line--short"), N.appendChild(F), v.appendChild(N);
|
|
1470
1479
|
}
|
|
1471
|
-
|
|
1472
|
-
const v = document.createElement("div");
|
|
1473
|
-
v.className = "gengage-chat-comparison-key-differences";
|
|
1480
|
+
m.appendChild(v), s.appendChild(m), o.appendChild(s);
|
|
1474
1481
|
const u = document.createElement("div");
|
|
1475
|
-
u.className = "gengage-chat-comparison-
|
|
1476
|
-
const
|
|
1477
|
-
|
|
1478
|
-
for (let k = 0; k < 4; k++) {
|
|
1479
|
-
const L = document.createElement("div");
|
|
1480
|
-
L.className = "gengage-chat-comparison-skeleton-shimmer gengage-chat-comparison-skeleton-kd-line", g.appendChild(L);
|
|
1481
|
-
}
|
|
1482
|
-
v.appendChild(g), i.appendChild(v);
|
|
1482
|
+
u.className = "gengage-chat-comparison-key-differences";
|
|
1483
|
+
const d = document.createElement("div");
|
|
1484
|
+
d.className = "gengage-chat-comparison-skeleton-shimmer gengage-chat-comparison-skeleton-kd-heading", u.appendChild(d);
|
|
1483
1485
|
const _ = document.createElement("div");
|
|
1484
|
-
_.className = "gengage-chat-comparison-
|
|
1486
|
+
_.className = "gengage-chat-comparison-key-differences-content";
|
|
1487
|
+
for (let T = 0; T < 4; T++) {
|
|
1488
|
+
const N = document.createElement("div");
|
|
1489
|
+
N.className = "gengage-chat-comparison-skeleton-shimmer gengage-chat-comparison-skeleton-kd-line", _.appendChild(N);
|
|
1490
|
+
}
|
|
1491
|
+
u.appendChild(_), o.appendChild(u);
|
|
1485
1492
|
const y = document.createElement("div");
|
|
1486
|
-
y.className = "gengage-chat-comparison-
|
|
1493
|
+
y.className = "gengage-chat-comparison-special gengage-chat-comparison-special--skeleton";
|
|
1487
1494
|
const b = document.createElement("div");
|
|
1488
|
-
b.className = "gengage-chat-comparison-skeleton-
|
|
1495
|
+
b.className = "gengage-chat-comparison-skeleton-shimmer gengage-chat-comparison-skeleton-special-line", y.appendChild(b), o.appendChild(y);
|
|
1489
1496
|
const A = document.createElement("div");
|
|
1490
|
-
A.className = "gengage-chat-comparison-skeleton-table-
|
|
1491
|
-
const
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
const
|
|
1497
|
-
|
|
1498
|
-
const
|
|
1499
|
-
|
|
1497
|
+
A.className = "gengage-chat-comparison-skeleton-table-wrap";
|
|
1498
|
+
const L = document.createElement("div");
|
|
1499
|
+
L.className = "gengage-chat-comparison-skeleton-table-head";
|
|
1500
|
+
const E = document.createElement("div");
|
|
1501
|
+
E.className = "gengage-chat-comparison-skeleton-table-corner", L.appendChild(E);
|
|
1502
|
+
for (let T = 0; T < 3; T++) {
|
|
1503
|
+
const N = document.createElement("div");
|
|
1504
|
+
N.className = "gengage-chat-comparison-skeleton-table-col";
|
|
1505
|
+
const F = document.createElement("div");
|
|
1506
|
+
F.className = "gengage-chat-comparison-skeleton-shimmer gengage-chat-comparison-skeleton-table-th-img";
|
|
1500
1507
|
const X = document.createElement("div");
|
|
1501
|
-
X.className = "gengage-chat-comparison-skeleton-shimmer gengage-chat-comparison-skeleton-table-th-
|
|
1508
|
+
X.className = "gengage-chat-comparison-skeleton-shimmer gengage-chat-comparison-skeleton-table-th-name";
|
|
1509
|
+
const C = document.createElement("div");
|
|
1510
|
+
C.className = "gengage-chat-comparison-skeleton-shimmer gengage-chat-comparison-skeleton-table-th-price", N.appendChild(F), N.appendChild(X), N.appendChild(C), L.appendChild(N);
|
|
1502
1511
|
}
|
|
1503
|
-
|
|
1504
|
-
for (let
|
|
1505
|
-
const
|
|
1506
|
-
|
|
1507
|
-
const
|
|
1508
|
-
|
|
1509
|
-
for (let
|
|
1510
|
-
const
|
|
1511
|
-
|
|
1512
|
+
A.appendChild(L);
|
|
1513
|
+
for (let T = 0; T < 3; T++) {
|
|
1514
|
+
const N = document.createElement("div");
|
|
1515
|
+
N.className = "gengage-chat-comparison-skeleton-table-row";
|
|
1516
|
+
const F = document.createElement("div");
|
|
1517
|
+
F.className = "gengage-chat-comparison-skeleton-shimmer gengage-chat-comparison-skeleton-table-label", N.appendChild(F);
|
|
1518
|
+
for (let X = 0; X < 3; X++) {
|
|
1519
|
+
const C = document.createElement("div");
|
|
1520
|
+
C.className = "gengage-chat-comparison-skeleton-shimmer gengage-chat-comparison-skeleton-table-cell", N.appendChild(C);
|
|
1512
1521
|
}
|
|
1513
|
-
|
|
1522
|
+
A.appendChild(N);
|
|
1514
1523
|
}
|
|
1515
|
-
|
|
1524
|
+
o.appendChild(A), e.appendChild(o);
|
|
1516
1525
|
break;
|
|
1517
1526
|
}
|
|
1518
1527
|
default:
|
|
1519
|
-
e.appendChild(
|
|
1520
|
-
for (let
|
|
1521
|
-
const
|
|
1522
|
-
|
|
1528
|
+
e.appendChild(r);
|
|
1529
|
+
for (let o = 0; o < 3; o++) {
|
|
1530
|
+
const s = document.createElement("div");
|
|
1531
|
+
s.className = "gengage-chat-panel-skeleton-block", e.appendChild(s);
|
|
1523
1532
|
}
|
|
1524
1533
|
break;
|
|
1525
1534
|
}
|
|
@@ -1642,15 +1651,24 @@ var Bn = class {
|
|
|
1642
1651
|
};
|
|
1643
1652
|
}
|
|
1644
1653
|
_applyLoadingSteps(t, e, a = !1) {
|
|
1645
|
-
const n =
|
|
1646
|
-
t.steps = n.length > 0 ? n :
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
}
|
|
1651
|
-
t.index += 1, t.labelEl.textContent = t.steps[t.index], t.index >= t.steps.length - 1 && this._clearLoadingBindingInterval(t);
|
|
1654
|
+
const n = this._normalizeLoadingSteps(e), r = n[n.length - 1], i = this._normalizeLoadingSteps(this.i18n.loadingSequenceGeneric);
|
|
1655
|
+
t.steps = a && r ? [r] : n.length > 0 ? n : i.length > 0 ? i : [this.i18n.loadingMessage], this._clearLoadingBindingInterval(t), t.index = 0;
|
|
1656
|
+
const o = t.steps[t.index];
|
|
1657
|
+
t.labelEl.textContent !== o && (t.labelEl.textContent = o), t.steps.length > 1 && (t.intervalId = setInterval(() => {
|
|
1658
|
+
t.index = (t.index + 1) % t.steps.length, t.labelEl.textContent = t.steps[t.index];
|
|
1652
1659
|
}, An));
|
|
1653
1660
|
}
|
|
1661
|
+
_normalizeLoadingSteps(t) {
|
|
1662
|
+
return t.map((e) => e.trim()).filter(Boolean);
|
|
1663
|
+
}
|
|
1664
|
+
_uniqueLoadingSteps(t) {
|
|
1665
|
+
const e = /* @__PURE__ */ new Set(), a = [];
|
|
1666
|
+
for (const n of t) {
|
|
1667
|
+
const r = n.trim();
|
|
1668
|
+
!r || e.has(r) || (e.add(r), a.push(r));
|
|
1669
|
+
}
|
|
1670
|
+
return a;
|
|
1671
|
+
}
|
|
1654
1672
|
_clearLoadingBindingInterval(t) {
|
|
1655
1673
|
t?.intervalId && (clearInterval(t.intervalId), t.intervalId = null);
|
|
1656
1674
|
}
|
|
@@ -1803,8 +1821,8 @@ var Bn = class {
|
|
|
1803
1821
|
const t = (e) => {
|
|
1804
1822
|
if (e.key !== "Tab") return;
|
|
1805
1823
|
const a = Array.from(this.root.querySelectorAll('a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])')).filter((l) => {
|
|
1806
|
-
const
|
|
1807
|
-
return l.hidden || l.getAttribute("aria-hidden") === "true" ||
|
|
1824
|
+
const p = getComputedStyle(l);
|
|
1825
|
+
return l.hidden || l.getAttribute("aria-hidden") === "true" || p.display === "none" || p.visibility === "hidden" ? !1 : l.getClientRects().length > 0;
|
|
1808
1826
|
});
|
|
1809
1827
|
if (a.length === 0) return;
|
|
1810
1828
|
const n = a[0], r = a[a.length - 1], i = e.composedPath().find((l) => l instanceof HTMLElement && this.root.contains(l)) ?? null, o = this.root.getRootNode(), s = i ?? (o instanceof ShadowRoot && o.activeElement instanceof HTMLElement ? o.activeElement : document.activeElement instanceof HTMLElement ? document.activeElement : null), c = s && this.root.contains(s) ? s : null;
|
|
@@ -2029,117 +2047,117 @@ function Xn(t) {
|
|
|
2029
2047
|
if (c.className = "gengage-chat-comparison", c.dataset.gengagePart = "comparison-dialog", c.setAttribute("role", "dialog"), c.setAttribute("aria-label", s?.comparisonHeading ?? "Comparison Results"), e) {
|
|
2030
2048
|
const l = document.createElement("article");
|
|
2031
2049
|
l.className = "gengage-chat-comparison-recommended gds-card", l.dataset.gengagePart = "comparison-recommended-card";
|
|
2032
|
-
const d = document.createElement("div");
|
|
2033
|
-
d.className = "gengage-chat-comparison-recommended-label", d.textContent = s?.recommendedChoiceLabel ?? "Recommended Choice", l.appendChild(d);
|
|
2034
2050
|
const p = document.createElement("div");
|
|
2035
|
-
p.className = "gengage-chat-comparison-recommended-
|
|
2051
|
+
p.className = "gengage-chat-comparison-recommended-label", p.textContent = s?.recommendedChoiceLabel ?? "Recommended Choice", l.appendChild(p);
|
|
2052
|
+
const g = document.createElement("div");
|
|
2053
|
+
g.className = "gengage-chat-comparison-recommended-body", g.classList.add("gds-clickable"), g.tabIndex = 0, g.setAttribute("role", "button"), g.setAttribute("aria-label", e.name);
|
|
2036
2054
|
const h = document.createElement("div");
|
|
2037
2055
|
if (h.className = "gengage-chat-comparison-recommended-media", e.imageUrl && Ce(e.imageUrl)) {
|
|
2038
|
-
const
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
}, { once: !0 }), h.appendChild(
|
|
2056
|
+
const d = document.createElement("img");
|
|
2057
|
+
d.src = e.imageUrl, d.alt = e.name, d.loading = "lazy", d.addEventListener("error", () => {
|
|
2058
|
+
d.style.display = "none";
|
|
2059
|
+
}, { once: !0 }), h.appendChild(d);
|
|
2042
2060
|
} else {
|
|
2043
|
-
const
|
|
2044
|
-
|
|
2061
|
+
const d = document.createElement("div");
|
|
2062
|
+
d.className = "gengage-chat-comparison-recommended-placeholder", d.setAttribute("aria-hidden", "true"), h.appendChild(d);
|
|
2045
2063
|
}
|
|
2046
|
-
|
|
2064
|
+
g.appendChild(h);
|
|
2047
2065
|
const m = document.createElement("div");
|
|
2048
2066
|
m.className = "gengage-chat-comparison-recommended-info";
|
|
2049
2067
|
const x = document.createElement("div");
|
|
2050
2068
|
x.className = "gengage-chat-comparison-recommended-title", x.textContent = e.name, m.appendChild(x);
|
|
2051
2069
|
const v = document.createElement("div");
|
|
2052
2070
|
if (v.className = "gengage-chat-comparison-recommended-meta", Yn(e.rating) && v.appendChild(Zn(e.rating)), Tt(e.price)) {
|
|
2053
|
-
const
|
|
2054
|
-
|
|
2071
|
+
const d = document.createElement("div");
|
|
2072
|
+
d.className = "gengage-chat-comparison-recommended-price", d.textContent = ae(e.price, t.pricing), v.appendChild(d);
|
|
2055
2073
|
}
|
|
2056
2074
|
if (v.childElementCount > 0 && m.appendChild(v), t.recommendedText) {
|
|
2057
|
-
const
|
|
2058
|
-
|
|
2075
|
+
const d = document.createElement("p");
|
|
2076
|
+
d.className = "gengage-chat-comparison-recommended-text", d.innerHTML = ve(t.recommendedText), m.appendChild(d);
|
|
2059
2077
|
}
|
|
2060
|
-
|
|
2078
|
+
g.appendChild(m);
|
|
2061
2079
|
const u = () => {
|
|
2062
2080
|
o({
|
|
2063
2081
|
sku: e.sku,
|
|
2064
2082
|
name: e.name
|
|
2065
2083
|
});
|
|
2066
2084
|
};
|
|
2067
|
-
if (
|
|
2068
|
-
|
|
2069
|
-
}), l.appendChild(
|
|
2070
|
-
const
|
|
2071
|
-
|
|
2085
|
+
if (g.addEventListener("click", u), g.addEventListener("keydown", (d) => {
|
|
2086
|
+
d.key !== "Enter" && d.key !== " " || (d.preventDefault(), u());
|
|
2087
|
+
}), l.appendChild(g), r.length > 0) {
|
|
2088
|
+
const d = document.createElement("div");
|
|
2089
|
+
d.className = "gengage-chat-comparison-highlights", d.dataset.gengagePart = "comparison-highlights";
|
|
2072
2090
|
const _ = document.createElement("div");
|
|
2073
|
-
_.className = "gengage-chat-comparison-highlights-label", _.textContent = s?.highlightsLabel ?? "Key Highlights",
|
|
2091
|
+
_.className = "gengage-chat-comparison-highlights-label", _.textContent = s?.highlightsLabel ?? "Key Highlights", d.appendChild(_);
|
|
2074
2092
|
const y = document.createElement("ul");
|
|
2075
2093
|
for (const b of r) {
|
|
2076
2094
|
const A = document.createElement("li");
|
|
2077
2095
|
A.textContent = b, y.appendChild(A);
|
|
2078
2096
|
}
|
|
2079
|
-
|
|
2097
|
+
d.appendChild(y), l.appendChild(d);
|
|
2080
2098
|
}
|
|
2081
2099
|
c.appendChild(l);
|
|
2082
2100
|
}
|
|
2083
2101
|
if (t.keyDifferencesHtml) {
|
|
2084
2102
|
const l = document.createElement("details");
|
|
2085
2103
|
l.className = "gengage-chat-comparison-key-differences", l.dataset.gengagePart = "comparison-key-differences";
|
|
2086
|
-
const
|
|
2087
|
-
|
|
2088
|
-
const
|
|
2089
|
-
|
|
2104
|
+
const p = document.createElement("summary");
|
|
2105
|
+
p.className = "gengage-chat-comparison-key-differences-summary";
|
|
2106
|
+
const g = document.createElement("span");
|
|
2107
|
+
g.className = "gengage-chat-comparison-key-differences-summary-label", g.textContent = s?.keyDifferencesLabel ?? "Key Differences";
|
|
2090
2108
|
const h = document.createElement("span");
|
|
2091
|
-
h.className = "gengage-chat-comparison-key-differences-summary-meta", h.textContent = s?.viewMoreLabel ?? "Show More",
|
|
2109
|
+
h.className = "gengage-chat-comparison-key-differences-summary-meta", h.textContent = s?.viewMoreLabel ?? "Show More", p.appendChild(g), p.appendChild(h), l.appendChild(p);
|
|
2092
2110
|
const m = document.createElement("div");
|
|
2093
2111
|
m.className = "gengage-chat-comparison-key-differences-content", m.innerHTML = ve(Qn(t.keyDifferencesHtml)), l.appendChild(m), c.appendChild(l);
|
|
2094
2112
|
}
|
|
2095
2113
|
if (i && i.length > 0) {
|
|
2096
2114
|
const l = document.createElement("details");
|
|
2097
2115
|
l.className = "gengage-chat-comparison-special gds-evidence-card gds-evidence-card-warning", l.dataset.gengagePart = "comparison-special-cases";
|
|
2098
|
-
const
|
|
2099
|
-
|
|
2100
|
-
const
|
|
2101
|
-
for (const h of i) Jn(
|
|
2102
|
-
|
|
2116
|
+
const p = document.createElement("summary");
|
|
2117
|
+
p.textContent = s?.specialCasesLabel ?? "For Special Cases", l.appendChild(p);
|
|
2118
|
+
const g = document.createElement("ul");
|
|
2119
|
+
for (const h of i) Jn(g, h);
|
|
2120
|
+
g.childElementCount > 0 && l.appendChild(g), c.appendChild(l);
|
|
2103
2121
|
}
|
|
2104
2122
|
if (a.length > 0 && n.length > 0) {
|
|
2105
2123
|
const l = document.createElement("table");
|
|
2106
2124
|
l.className = "gengage-chat-comparison-table gds-comparison-table";
|
|
2107
|
-
const
|
|
2108
|
-
|
|
2125
|
+
const p = document.createElement("thead"), g = document.createElement("tr"), h = document.createElement("th");
|
|
2126
|
+
g.appendChild(h);
|
|
2109
2127
|
for (const v of a) {
|
|
2110
2128
|
const u = document.createElement("th");
|
|
2111
2129
|
v.sku === e?.sku && (u.className = "gengage-chat-comparison-selected gds-comparison-table-winner-cell");
|
|
2112
|
-
const
|
|
2113
|
-
|
|
2130
|
+
const d = document.createElement("div");
|
|
2131
|
+
d.className = "gengage-chat-comparison-table-header-cell gengage-chat-comparison-table-header-cell--clickable gds-clickable", d.tabIndex = 0, d.setAttribute("role", "button"), d.setAttribute("aria-label", v.name), d.title = v.name;
|
|
2114
2132
|
const _ = () => {
|
|
2115
2133
|
o({
|
|
2116
2134
|
sku: v.sku,
|
|
2117
2135
|
name: v.name
|
|
2118
2136
|
});
|
|
2119
2137
|
};
|
|
2120
|
-
if (
|
|
2138
|
+
if (d.addEventListener("click", _), d.addEventListener("keydown", (b) => {
|
|
2121
2139
|
b.key !== "Enter" && b.key !== " " || (b.preventDefault(), _());
|
|
2122
2140
|
}), v.imageUrl && Ce(v.imageUrl)) {
|
|
2123
2141
|
const b = document.createElement("img");
|
|
2124
2142
|
b.src = v.imageUrl, b.alt = v.name, b.loading = "lazy", b.addEventListener("error", () => {
|
|
2125
2143
|
b.style.display = "none";
|
|
2126
|
-
}, { once: !0 }),
|
|
2144
|
+
}, { once: !0 }), d.appendChild(b);
|
|
2127
2145
|
} else {
|
|
2128
2146
|
const b = document.createElement("div");
|
|
2129
|
-
b.className = "gengage-chat-comparison-table-header-img-placeholder", b.setAttribute("aria-hidden", "true"),
|
|
2147
|
+
b.className = "gengage-chat-comparison-table-header-img-placeholder", b.setAttribute("aria-hidden", "true"), d.appendChild(b);
|
|
2130
2148
|
}
|
|
2131
2149
|
const y = document.createElement("div");
|
|
2132
|
-
if (y.className = "gengage-chat-comparison-table-product-name", y.textContent = v.name,
|
|
2150
|
+
if (y.className = "gengage-chat-comparison-table-product-name", y.textContent = v.name, d.appendChild(y), Tt(v.price)) {
|
|
2133
2151
|
const b = document.createElement("div");
|
|
2134
|
-
b.className = "gengage-chat-comparison-table-price", b.textContent = ae(v.price, t.pricing),
|
|
2152
|
+
b.className = "gengage-chat-comparison-table-price", b.textContent = ae(v.price, t.pricing), d.appendChild(b);
|
|
2135
2153
|
}
|
|
2136
|
-
u.appendChild(
|
|
2154
|
+
u.appendChild(d), g.appendChild(u);
|
|
2137
2155
|
}
|
|
2138
|
-
|
|
2156
|
+
p.appendChild(g), l.appendChild(p);
|
|
2139
2157
|
const m = document.createElement("tbody");
|
|
2140
2158
|
for (const v of n) {
|
|
2141
|
-
const u = document.createElement("tr"),
|
|
2142
|
-
|
|
2159
|
+
const u = document.createElement("tr"), d = document.createElement("td");
|
|
2160
|
+
d.className = "gengage-chat-comparison-label", d.textContent = Wn(v.label, s?.criteriaLabels, t.locale), u.appendChild(d);
|
|
2143
2161
|
for (let _ = 0; _ < v.values.length; _++) {
|
|
2144
2162
|
const y = document.createElement("td");
|
|
2145
2163
|
a[_]?.sku === e?.sku && (y.className = "gengage-chat-comparison-selected gds-comparison-table-winner-cell");
|
|
@@ -2154,10 +2172,10 @@ function Xn(t) {
|
|
|
2154
2172
|
}
|
|
2155
2173
|
return c.addEventListener("keydown", (l) => {
|
|
2156
2174
|
if (l.key !== "Tab") return;
|
|
2157
|
-
const
|
|
2158
|
-
if (
|
|
2159
|
-
const
|
|
2160
|
-
l.shiftKey && document.activeElement ===
|
|
2175
|
+
const p = c.querySelectorAll('button, [href], input, [tabindex]:not([tabindex="-1"])');
|
|
2176
|
+
if (p.length === 0) return;
|
|
2177
|
+
const g = p[0], h = p[p.length - 1];
|
|
2178
|
+
l.shiftKey && document.activeElement === g ? (l.preventDefault(), h.focus()) : !l.shiftKey && document.activeElement === h && (l.preventDefault(), g.focus());
|
|
2161
2179
|
}), c;
|
|
2162
2180
|
}
|
|
2163
2181
|
function Qn(t) {
|
|
@@ -2227,7 +2245,7 @@ function sr(t, e) {
|
|
|
2227
2245
|
}
|
|
2228
2246
|
const r = n.filter((v) => v !== null && typeof v == "object"), i = /* @__PURE__ */ new Map();
|
|
2229
2247
|
for (const v of r) {
|
|
2230
|
-
const u = ar(v.review_class),
|
|
2248
|
+
const u = ar(v.review_class), d = nr(v.review_text), _ = tr(v.review_tag);
|
|
2231
2249
|
for (const y of _) {
|
|
2232
2250
|
const b = y.toLocaleLowerCase();
|
|
2233
2251
|
let A = i.get(b);
|
|
@@ -2239,12 +2257,12 @@ function sr(t, e) {
|
|
|
2239
2257
|
negative: 0,
|
|
2240
2258
|
neutral: 0,
|
|
2241
2259
|
snippets: []
|
|
2242
|
-
}, i.set(b, A)), A.mentions += 1, u === "positive" ? A.positive += 1 : u === "negative" ? A.negative += 1 : A.neutral += 1,
|
|
2243
|
-
const
|
|
2244
|
-
text:
|
|
2260
|
+
}, i.set(b, A)), A.mentions += 1, u === "positive" ? A.positive += 1 : u === "negative" ? A.negative += 1 : A.neutral += 1, d.length > 0 && A.snippets.length < er && !A.snippets.some((L) => L.text === d)) {
|
|
2261
|
+
const L = {
|
|
2262
|
+
text: d,
|
|
2245
2263
|
tone: u
|
|
2246
2264
|
};
|
|
2247
|
-
v.review_rating !== void 0 && String(v.review_rating).length > 0 && (
|
|
2265
|
+
v.review_rating !== void 0 && String(v.review_rating).length > 0 && (L.rating = v.review_rating), A.snippets.push(L);
|
|
2248
2266
|
}
|
|
2249
2267
|
}
|
|
2250
2268
|
}
|
|
@@ -2255,20 +2273,20 @@ function sr(t, e) {
|
|
|
2255
2273
|
}
|
|
2256
2274
|
const s = (e?.reviewFilterPositive ?? "positive").toLowerCase(), c = (e?.reviewFilterNegative ?? "negative").toLowerCase(), l = document.createElement("div");
|
|
2257
2275
|
l.className = "gengage-chat-review-subjects-heading", l.textContent = e?.reviewSubjectsHeading ?? "Select to learn more", a.appendChild(l);
|
|
2258
|
-
let
|
|
2259
|
-
const
|
|
2260
|
-
|
|
2276
|
+
let p = o[0]?.key ?? null;
|
|
2277
|
+
const g = document.createElement("div");
|
|
2278
|
+
g.className = "gengage-chat-review-subjects gds-toolbar gds-toolbar-compact";
|
|
2261
2279
|
const h = document.createElement("section");
|
|
2262
2280
|
h.className = "gengage-chat-review-detail gds-evidence-card";
|
|
2263
2281
|
const m = () => {
|
|
2264
2282
|
for (; h.firstChild; ) h.removeChild(h.firstChild);
|
|
2265
|
-
if (!
|
|
2266
|
-
const v = o.find((y) => y.key ===
|
|
2283
|
+
if (!p) return;
|
|
2284
|
+
const v = o.find((y) => y.key === p);
|
|
2267
2285
|
if (!v) return;
|
|
2268
2286
|
const u = document.createElement("div");
|
|
2269
2287
|
u.className = "gengage-chat-review-detail-meta";
|
|
2270
|
-
const
|
|
2271
|
-
if (
|
|
2288
|
+
const d = document.createElement("span");
|
|
2289
|
+
if (d.className = "gengage-chat-review-detail-mentions", d.textContent = `${or(v.mentions, e?.reviewCustomersMentionSingular, e?.reviewCustomersMentionPlural)} "${v.label}"`, u.appendChild(d), v.positive > 0) {
|
|
2272
2290
|
const y = document.createElement("span");
|
|
2273
2291
|
y.className = "gengage-chat-review-detail-positive", y.textContent = `${v.positive} ${s}`, u.appendChild(y);
|
|
2274
2292
|
}
|
|
@@ -2284,31 +2302,31 @@ function sr(t, e) {
|
|
|
2284
2302
|
b.className = "gengage-chat-review-snippet", b.dataset.tone = y.tone;
|
|
2285
2303
|
const A = document.createElement("div");
|
|
2286
2304
|
if (A.className = "gengage-chat-review-snippet-text", A.textContent = `"${y.text}"`, b.appendChild(A), y.rating !== void 0 && String(y.rating).length > 0) {
|
|
2287
|
-
const
|
|
2288
|
-
|
|
2305
|
+
const L = document.createElement("div");
|
|
2306
|
+
L.className = "gengage-chat-review-snippet-rating", L.textContent = `★ ${String(y.rating)}`, b.appendChild(L);
|
|
2289
2307
|
}
|
|
2290
2308
|
_.appendChild(b);
|
|
2291
2309
|
}
|
|
2292
2310
|
h.appendChild(_);
|
|
2293
2311
|
}, x = () => {
|
|
2294
|
-
for (const v of
|
|
2295
|
-
const u = v.dataset.subjectKey ===
|
|
2312
|
+
for (const v of g.querySelectorAll(".gengage-chat-review-subject")) {
|
|
2313
|
+
const u = v.dataset.subjectKey === p;
|
|
2296
2314
|
v.classList.toggle("gengage-chat-review-subject--active", u), v.classList.toggle("gds-chip-active", u), v.setAttribute("aria-pressed", String(u));
|
|
2297
2315
|
}
|
|
2298
2316
|
};
|
|
2299
2317
|
for (const v of o) {
|
|
2300
|
-
const u = rr(v),
|
|
2301
|
-
|
|
2318
|
+
const u = rr(v), d = document.createElement("button");
|
|
2319
|
+
d.type = "button", d.className = "gengage-chat-review-subject gds-chip", d.dataset.subjectKey = v.key, d.dataset.tone = u;
|
|
2302
2320
|
const _ = document.createElement("span");
|
|
2303
|
-
_.className = "gengage-chat-review-subject-icon", _.appendChild(ir(u)),
|
|
2321
|
+
_.className = "gengage-chat-review-subject-icon", _.appendChild(ir(u)), d.appendChild(_);
|
|
2304
2322
|
const y = document.createElement("span");
|
|
2305
|
-
y.className = "gengage-chat-review-subject-label", y.textContent = v.label,
|
|
2323
|
+
y.className = "gengage-chat-review-subject-label", y.textContent = v.label, d.appendChild(y);
|
|
2306
2324
|
const b = document.createElement("span");
|
|
2307
|
-
b.className = "gengage-chat-review-subject-count", b.textContent = `(${v.mentions})`,
|
|
2308
|
-
|
|
2309
|
-
}),
|
|
2325
|
+
b.className = "gengage-chat-review-subject-count", b.textContent = `(${v.mentions})`, d.appendChild(b), d.addEventListener("click", () => {
|
|
2326
|
+
p = v.key, x(), m();
|
|
2327
|
+
}), g.appendChild(d);
|
|
2310
2328
|
}
|
|
2311
|
-
return a.appendChild(
|
|
2329
|
+
return a.appendChild(g), x(), m(), a.appendChild(h), a;
|
|
2312
2330
|
}
|
|
2313
2331
|
function cr(t) {
|
|
2314
2332
|
if (!t) return;
|
|
@@ -2417,63 +2435,63 @@ function pr(t, e, a, n, r) {
|
|
|
2417
2435
|
v.stopPropagation(), m.classList.toggle("gengage-chat-favorite-btn--active"), m.querySelector("svg")?.setAttribute("fill", m.classList.contains("gengage-chat-favorite-btn--active") ? "currentColor" : "none"), n.onFavoriteToggle?.(c, o);
|
|
2418
2436
|
}), l.appendChild(m);
|
|
2419
2437
|
}
|
|
2420
|
-
const
|
|
2421
|
-
|
|
2438
|
+
const p = n.i18n?.findSimilarLabel ?? "Find Similar", g = document.createElement("button");
|
|
2439
|
+
g.className = "gengage-chat-find-similar-pill", g.type = "button", g.setAttribute("aria-label", p), g.dataset.tooltip = p, g.innerHTML = '<span class="gengage-chat-find-similar-pill-icon" aria-hidden="true"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.25" stroke-linecap="round" stroke-linejoin="round"><circle cx="10.5" cy="10.5" r="6.5"/><path d="M16 16l5.5 5.5"/></svg></span>';
|
|
2422
2440
|
const h = document.createElement("span");
|
|
2423
|
-
h.className = "gengage-chat-find-similar-pill-text", h.textContent =
|
|
2441
|
+
h.className = "gengage-chat-find-similar-pill-text", h.textContent = p, g.appendChild(h), g.addEventListener("click", (m) => {
|
|
2424
2442
|
m.stopPropagation(), n.onAction({
|
|
2425
|
-
title:
|
|
2443
|
+
title: p,
|
|
2426
2444
|
type: "findSimilar",
|
|
2427
2445
|
payload: { sku: c }
|
|
2428
2446
|
});
|
|
2429
|
-
}), l.appendChild(
|
|
2447
|
+
}), l.appendChild(g), i.appendChild(l);
|
|
2430
2448
|
}
|
|
2431
2449
|
a.appendChild(i);
|
|
2432
2450
|
}
|
|
2433
2451
|
function hr(t, e, a) {
|
|
2434
2452
|
const n = t.price, r = t.originalPrice;
|
|
2435
2453
|
if (!n) return;
|
|
2436
|
-
const i = He(a, t), o = $e(a, t), s = !!(r && r !== n), c = !!(i && s), l = Je(a, t),
|
|
2437
|
-
if (
|
|
2438
|
-
const
|
|
2454
|
+
const i = He(a, t), o = $e(a, t), s = !!(r && r !== n), c = !!(i && s), l = Je(a, t), p = document.createElement("div");
|
|
2455
|
+
if (p.className = "gengage-chat-ai-toppick-price", p.dataset.gengagePart = "ai-top-pick-price", c) {
|
|
2456
|
+
const g = et({
|
|
2439
2457
|
reasonText: i,
|
|
2440
2458
|
salePriceFormatted: ae(n, a.pricing),
|
|
2441
2459
|
...l !== void 0 ? { logoUrl: l } : {}
|
|
2442
2460
|
});
|
|
2443
2461
|
if (s && o === "inline") {
|
|
2444
|
-
|
|
2462
|
+
p.classList.add("gengage-chat-ai-toppick-price--inline"), p.appendChild(g);
|
|
2445
2463
|
const h = document.createElement("span");
|
|
2446
2464
|
h.className = "gengage-chat-ai-toppick-price-sep", h.setAttribute("aria-hidden", "true");
|
|
2447
2465
|
const m = document.createElement("span");
|
|
2448
|
-
m.className = "gengage-chat-ai-toppick-original-price", m.textContent = ae(r, a.pricing),
|
|
2466
|
+
m.className = "gengage-chat-ai-toppick-original-price", m.textContent = ae(r, a.pricing), p.appendChild(h), p.appendChild(m);
|
|
2449
2467
|
} else {
|
|
2450
2468
|
const h = document.createElement("span");
|
|
2451
|
-
h.className = "gengage-chat-ai-toppick-original-price", h.textContent = ae(r, a.pricing),
|
|
2469
|
+
h.className = "gengage-chat-ai-toppick-original-price", h.textContent = ae(r, a.pricing), p.appendChild(h), p.appendChild(document.createTextNode(" ")), p.appendChild(g);
|
|
2452
2470
|
}
|
|
2453
|
-
e.appendChild(
|
|
2471
|
+
e.appendChild(p);
|
|
2454
2472
|
return;
|
|
2455
2473
|
}
|
|
2456
2474
|
if (s && o === "inline") {
|
|
2457
|
-
|
|
2458
|
-
const
|
|
2459
|
-
|
|
2475
|
+
p.classList.add("gengage-chat-ai-toppick-price--inline");
|
|
2476
|
+
const g = document.createElement("span");
|
|
2477
|
+
g.className = "gengage-chat-ai-toppick-price-current", g.textContent = ae(n, a.pricing);
|
|
2460
2478
|
const h = document.createElement("span");
|
|
2461
2479
|
h.className = "gengage-chat-ai-toppick-price-sep", h.setAttribute("aria-hidden", "true");
|
|
2462
2480
|
const m = document.createElement("span");
|
|
2463
|
-
m.className = "gengage-chat-ai-toppick-original-price", m.textContent = ae(r, a.pricing),
|
|
2481
|
+
m.className = "gengage-chat-ai-toppick-original-price", m.textContent = ae(r, a.pricing), p.appendChild(g), p.appendChild(h), p.appendChild(m);
|
|
2464
2482
|
} else if (s) {
|
|
2465
|
-
const
|
|
2466
|
-
|
|
2483
|
+
const g = document.createElement("span");
|
|
2484
|
+
g.className = "gengage-chat-ai-toppick-original-price", g.textContent = ae(r, a.pricing), p.appendChild(g), p.appendChild(document.createTextNode(" "));
|
|
2467
2485
|
const h = document.createElement("span");
|
|
2468
|
-
h.className = "gengage-chat-ai-toppick-price-current", h.textContent = ae(n, a.pricing),
|
|
2486
|
+
h.className = "gengage-chat-ai-toppick-price-current", h.textContent = ae(n, a.pricing), p.appendChild(h);
|
|
2469
2487
|
} else {
|
|
2470
|
-
const
|
|
2471
|
-
|
|
2488
|
+
const g = document.createElement("span");
|
|
2489
|
+
g.className = "gengage-chat-ai-toppick-price-current", g.textContent = ae(n, a.pricing), p.appendChild(g);
|
|
2472
2490
|
}
|
|
2473
2491
|
if (i) {
|
|
2474
|
-
const
|
|
2475
|
-
|
|
2476
|
-
} else e.appendChild(
|
|
2492
|
+
const g = document.createElement("div");
|
|
2493
|
+
g.className = "gengage-chat-ai-toppick-price-stack", g.appendChild(Qe(i)), g.appendChild(p), e.appendChild(g);
|
|
2494
|
+
} else e.appendChild(p);
|
|
2477
2495
|
}
|
|
2478
2496
|
function ur(t, e, a) {
|
|
2479
2497
|
const n = typeof t.reason == "string" ? t.reason.trim() : "", r = a.hideUserReviews !== !0 && typeof t.reviewHighlight == "string" ? t.reviewHighlight.trim() : "";
|
|
@@ -2493,54 +2511,54 @@ function Mt(t, e, a, n) {
|
|
|
2493
2511
|
r.className = a ? "gengage-chat-ai-toppick-card gengage-chat-ai-toppick-card--winner gds-card" : "gengage-chat-ai-toppick-card gengage-chat-ai-toppick-card--compact gds-card";
|
|
2494
2512
|
const i = n?.uniformMobileLayout === !0;
|
|
2495
2513
|
!a && i && r.classList.add("gengage-chat-ai-toppick-card--mobile-uniform"), r.dataset.gengagePart = a ? "ai-top-pick-card-winner" : "ai-top-pick-card";
|
|
2496
|
-
const o = t.product, s = ca(t), c = o.url ?? "", l = o.cartCode,
|
|
2497
|
-
s && e.onProductClick ? (r.classList.add("gds-clickable"), r.addEventListener("click", (
|
|
2498
|
-
if (
|
|
2499
|
-
const
|
|
2514
|
+
const o = t.product, s = ca(t), c = o.url ?? "", l = o.cartCode, p = o.inStock, g = !!(s && l && p !== !1), h = t.action;
|
|
2515
|
+
s && e.onProductClick ? (r.classList.add("gds-clickable"), r.addEventListener("click", (E) => {
|
|
2516
|
+
if (E.target.closest(".gengage-chat-ai-toppick-cta") || E.target.closest(".gengage-chat-favorite-btn") || E.target.closest(".gengage-chat-find-similar-pill")) return;
|
|
2517
|
+
const T = o.name;
|
|
2500
2518
|
e.onProductClick?.({
|
|
2501
2519
|
sku: s,
|
|
2502
2520
|
url: c,
|
|
2503
|
-
...
|
|
2521
|
+
...T ? { name: T } : {}
|
|
2504
2522
|
});
|
|
2505
|
-
})) : h && (r.classList.add("gds-clickable"), r.addEventListener("click", (
|
|
2506
|
-
|
|
2523
|
+
})) : h && (r.classList.add("gds-clickable"), r.addEventListener("click", (E) => {
|
|
2524
|
+
E.target.closest(".gengage-chat-ai-toppick-cta") || E.target.closest(".gengage-chat-favorite-btn") || E.target.closest(".gengage-chat-find-similar-pill") || e.onAction(h);
|
|
2507
2525
|
}));
|
|
2508
2526
|
const m = o.name || "Product image", x = !a && e.isMobile === !0 && !i, v = a ? It(t.role, e.i18n) ?? e.i18n?.roleWinner ?? "TOP MATCH" : It(t.role, e.i18n);
|
|
2509
2527
|
if (v && !x) {
|
|
2510
|
-
const
|
|
2511
|
-
|
|
2528
|
+
const E = document.createElement("span");
|
|
2529
|
+
E.className = "gengage-chat-ai-toppick-badge gds-badge", E.dataset.gengagePart = "ai-top-pick-role-badge", E.textContent = v, r.appendChild(E);
|
|
2512
2530
|
}
|
|
2513
2531
|
const u = document.createElement("div");
|
|
2514
2532
|
u.className = "gengage-chat-ai-toppick-top-row", u.dataset.gengagePart = "ai-top-pick-top-row", pr(t, m, u, e, { skipOverlayActions: x });
|
|
2515
|
-
const
|
|
2516
|
-
if (
|
|
2517
|
-
const
|
|
2518
|
-
|
|
2533
|
+
const d = document.createElement("div");
|
|
2534
|
+
if (d.className = "gengage-chat-ai-toppick-body", d.dataset.gengagePart = "ai-top-pick-body", v && x) {
|
|
2535
|
+
const E = document.createElement("div");
|
|
2536
|
+
E.className = "gengage-chat-ai-toppick-role-line", E.dataset.gengagePart = "ai-top-pick-role-line", E.textContent = v, d.appendChild(E);
|
|
2519
2537
|
}
|
|
2520
2538
|
const _ = o.name;
|
|
2521
2539
|
if (_) {
|
|
2522
|
-
const
|
|
2523
|
-
|
|
2540
|
+
const E = document.createElement("div");
|
|
2541
|
+
E.className = "gengage-chat-ai-toppick-name", E.dataset.gengagePart = "ai-top-pick-name", E.textContent = _, d.appendChild(E);
|
|
2524
2542
|
}
|
|
2525
2543
|
const y = dr(o);
|
|
2526
|
-
y &&
|
|
2544
|
+
y && d.appendChild(y), hr(o, d, e), t.labels && t.labels.length > 0 && d.appendChild(fr(t.labels)), u.appendChild(d), r.appendChild(u);
|
|
2527
2545
|
const b = document.createElement("div");
|
|
2528
2546
|
if (b.className = "gengage-chat-ai-toppick-detail", b.dataset.gengagePart = "ai-top-pick-detail", a) ur(t, b, e);
|
|
2529
2547
|
else {
|
|
2530
|
-
const
|
|
2531
|
-
if (
|
|
2532
|
-
const
|
|
2533
|
-
|
|
2548
|
+
const E = typeof t.reason == "string" ? t.reason.trim() : "";
|
|
2549
|
+
if (E) {
|
|
2550
|
+
const T = document.createElement("p");
|
|
2551
|
+
T.className = "gengage-chat-ai-toppick-snippet", T.dataset.gengagePart = "ai-top-pick-snippet", T.textContent = E, b.appendChild(T);
|
|
2534
2552
|
}
|
|
2535
2553
|
}
|
|
2536
2554
|
b.childNodes.length > 0 && r.appendChild(b);
|
|
2537
|
-
const A = !!(s && e.topPicksLoadingSku === s),
|
|
2538
|
-
if (A ||
|
|
2539
|
-
const
|
|
2540
|
-
if (
|
|
2541
|
-
const
|
|
2542
|
-
|
|
2543
|
-
if (
|
|
2555
|
+
const A = !!(s && e.topPicksLoadingSku === s), L = (g || h) && !x;
|
|
2556
|
+
if (A || g || h) {
|
|
2557
|
+
const E = document.createElement("div");
|
|
2558
|
+
if (E.className = "gengage-chat-ai-toppick-spinner", E.dataset.gengagePart = "ai-top-pick-spinner", E.style.display = A ? "" : "none", r.appendChild(E), L) {
|
|
2559
|
+
const T = document.createElement("button");
|
|
2560
|
+
T.className = "gengage-chat-ai-toppick-cta gds-btn gds-btn-primary", T.dataset.gengagePart = "ai-top-pick-cta", T.type = "button", T.textContent = g ? e.i18n?.addToCartButton ?? "Add to Cart" : e.i18n?.viewDetails ?? "View Details", T.addEventListener("click", (N) => {
|
|
2561
|
+
if (N.stopPropagation(), g) {
|
|
2544
2562
|
e.onAction({
|
|
2545
2563
|
title: e.i18n?.addToCartButton ?? "Add to Cart",
|
|
2546
2564
|
type: "addToCart",
|
|
@@ -2554,17 +2572,17 @@ function Mt(t, e, a, n) {
|
|
|
2554
2572
|
}
|
|
2555
2573
|
if (h) {
|
|
2556
2574
|
if (h.type === "findSimilar" && s && e.onProductClick) {
|
|
2557
|
-
const
|
|
2575
|
+
const F = o.name;
|
|
2558
2576
|
e.onProductClick({
|
|
2559
2577
|
sku: s,
|
|
2560
2578
|
url: c,
|
|
2561
|
-
...
|
|
2579
|
+
...F ? { name: F } : {}
|
|
2562
2580
|
});
|
|
2563
2581
|
return;
|
|
2564
2582
|
}
|
|
2565
2583
|
e.onAction(h);
|
|
2566
2584
|
}
|
|
2567
|
-
}), r.appendChild(
|
|
2585
|
+
}), r.appendChild(T);
|
|
2568
2586
|
}
|
|
2569
2587
|
}
|
|
2570
2588
|
return r;
|
|
@@ -2581,8 +2599,8 @@ function mr(t, e) {
|
|
|
2581
2599
|
const s = document.createElement("div");
|
|
2582
2600
|
s.className = "gengage-chat-ai-top-picks-rest", i && s.classList.add("gengage-chat-ai-top-picks-rest--uniform-mobile"), s.dataset.gengagePart = "ai-top-picks-rest";
|
|
2583
2601
|
for (let c = 1; c < n.length; c++) {
|
|
2584
|
-
const l = n[c],
|
|
2585
|
-
s.appendChild(Mt(l, e,
|
|
2602
|
+
const l = n[c], p = l.role === "winner";
|
|
2603
|
+
s.appendChild(Mt(l, e, p, { uniformMobileLayout: i }));
|
|
2586
2604
|
}
|
|
2587
2605
|
r.appendChild(s);
|
|
2588
2606
|
}
|
|
@@ -2608,18 +2626,18 @@ function br(t, e) {
|
|
|
2608
2626
|
])), a.appendChild(c);
|
|
2609
2627
|
const l = document.createElement("div");
|
|
2610
2628
|
l.className = "gengage-chat-grounding-review-body", l.dataset.gengagePart = "grounding-review-body";
|
|
2611
|
-
const
|
|
2612
|
-
if (
|
|
2629
|
+
const p = document.createElement("div");
|
|
2630
|
+
if (p.className = "gengage-chat-grounding-review-title", p.dataset.gengagePart = "grounding-review-title", p.textContent = r ?? e.i18n?.customerReviewsTitle ?? "Customer Reviews", l.appendChild(p), i) {
|
|
2613
2631
|
const x = document.createElement("div");
|
|
2614
2632
|
x.className = "gengage-chat-grounding-review-subtitle", x.dataset.gengagePart = "grounding-review-subtitle", x.textContent = (e.i18n?.groundingReviewSubtitle ?? "{count} yorum mevcut").replace("{count}", i), l.appendChild(x);
|
|
2615
2633
|
}
|
|
2616
2634
|
a.appendChild(l);
|
|
2617
|
-
const
|
|
2618
|
-
|
|
2635
|
+
const g = document.createElement("span");
|
|
2636
|
+
g.className = "gengage-chat-grounding-review-cta", g.dataset.gengagePart = "grounding-review-cta";
|
|
2619
2637
|
const h = document.createElement("span");
|
|
2620
|
-
h.textContent = s,
|
|
2638
|
+
h.textContent = s, g.appendChild(h);
|
|
2621
2639
|
const m = document.createElement("span");
|
|
2622
|
-
return m.className = "gengage-chat-grounding-review-cta-icon", m.appendChild(qe(["M5 12h14", "M15 8l4 4-4 4"], 14)),
|
|
2640
|
+
return m.className = "gengage-chat-grounding-review-cta-icon", m.appendChild(qe(["M5 12h14", "M15 8l4 4-4 4"], 14)), g.appendChild(m), a.appendChild(g), o && (a.classList.add("gds-clickable"), a.setAttribute("role", "button"), a.setAttribute("tabindex", "0"), a.addEventListener("click", () => e.onAction(o)), a.addEventListener("keydown", (x) => {
|
|
2623
2641
|
(x.key === "Enter" || x.key === " ") && (x.preventDefault(), e.onAction(o));
|
|
2624
2642
|
})), a;
|
|
2625
2643
|
}
|
|
@@ -2659,8 +2677,8 @@ function xr(t, e) {
|
|
|
2659
2677
|
}
|
|
2660
2678
|
const l = document.createElement("div");
|
|
2661
2679
|
l.className = "gengage-chat-grouping-card-body", l.dataset.gengagePart = "ai-grouping-card-body";
|
|
2662
|
-
const
|
|
2663
|
-
if (
|
|
2680
|
+
const p = document.createElement("span");
|
|
2681
|
+
if (p.className = "gengage-chat-grouping-card-name", p.dataset.gengagePart = "ai-grouping-card-name", p.textContent = s.name, l.appendChild(p), s.labels && s.labels.length > 0) {
|
|
2664
2682
|
const h = document.createElement("div");
|
|
2665
2683
|
h.className = "gengage-chat-grouping-card-labels", h.dataset.gengagePart = "ai-grouping-card-labels";
|
|
2666
2684
|
for (const m of s.labels.slice(0, 2)) {
|
|
@@ -2670,8 +2688,8 @@ function xr(t, e) {
|
|
|
2670
2688
|
l.appendChild(h);
|
|
2671
2689
|
}
|
|
2672
2690
|
c.appendChild(l);
|
|
2673
|
-
const
|
|
2674
|
-
|
|
2691
|
+
const g = document.createElement("span");
|
|
2692
|
+
g.className = "gengage-chat-grouping-card-arrow", g.textContent = "↳", c.insertBefore(g, c.firstChild), o.appendChild(c);
|
|
2675
2693
|
}
|
|
2676
2694
|
return a.appendChild(o), a;
|
|
2677
2695
|
}
|
|
@@ -2719,12 +2737,12 @@ function la(t, e) {
|
|
|
2719
2737
|
c.className = "gengage-chat-comparison-floating-copy";
|
|
2720
2738
|
const l = document.createElement("div");
|
|
2721
2739
|
if (l.className = "gengage-chat-comparison-floating-title", l.textContent = a ? `${n} (${t.length})` : e.i18n?.compareMinHint ?? "Select at least 2 products", c.appendChild(l), r) {
|
|
2722
|
-
const
|
|
2723
|
-
|
|
2740
|
+
const g = document.createElement("div");
|
|
2741
|
+
g.className = "gengage-chat-comparison-floating-warning", g.setAttribute("role", "status"), g.setAttribute("aria-live", "polite"), g.textContent = r, c.appendChild(g);
|
|
2724
2742
|
}
|
|
2725
2743
|
o.appendChild(c), i.appendChild(o);
|
|
2726
|
-
const
|
|
2727
|
-
if (
|
|
2744
|
+
const p = document.createElement("button");
|
|
2745
|
+
if (p.className = "gengage-chat-comparison-floating-action gds-btn gds-btn-primary", p.type = "button", p.textContent = n, p.disabled = !a, a || p.classList.add("gengage-chat-comparison-floating-action--disabled"), p.addEventListener("click", () => {
|
|
2728
2746
|
a && e.onAction({
|
|
2729
2747
|
title: n,
|
|
2730
2748
|
type: "getComparisonTable",
|
|
@@ -2733,11 +2751,11 @@ function la(t, e) {
|
|
|
2733
2751
|
gengage_analytics_source: "floating_compare_dock"
|
|
2734
2752
|
}
|
|
2735
2753
|
});
|
|
2736
|
-
}), i.appendChild(
|
|
2737
|
-
const
|
|
2738
|
-
|
|
2754
|
+
}), i.appendChild(p), e.onToggleComparisonSku) {
|
|
2755
|
+
const g = document.createElement("button");
|
|
2756
|
+
g.className = "gengage-chat-comparison-floating-close gds-btn gds-btn-ghost gds-icon-btn", g.dataset.gengagePart = "comparison-dock-close", g.type = "button", g.setAttribute("aria-label", e.i18n?.closeAriaLabel ?? "Close"), g.innerHTML = '<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" aria-hidden="true"><path d="M18 6L6 18"/><path d="M6 6l12 12"/></svg>', g.addEventListener("click", (h) => {
|
|
2739
2757
|
h.preventDefault(), h.stopPropagation(), e.onToggleComparisonSku?.("");
|
|
2740
|
-
}), i.appendChild(
|
|
2758
|
+
}), i.appendChild(g);
|
|
2741
2759
|
}
|
|
2742
2760
|
return i;
|
|
2743
2761
|
}
|
|
@@ -2827,47 +2845,47 @@ function Tr(t, e) {
|
|
|
2827
2845
|
if (i.className = "gengage-chat-categories", i.dataset.gengagePart = "categories-container", a.length === 0) return i;
|
|
2828
2846
|
const o = document.createElement("div");
|
|
2829
2847
|
o.className = "gengage-chat-categories-tabs gds-toolbar", o.dataset.gengagePart = "categories-tab-bar", o.setAttribute("role", "tablist");
|
|
2830
|
-
const s = [], c = [], l = (
|
|
2831
|
-
for (let
|
|
2832
|
-
const h =
|
|
2833
|
-
s[
|
|
2848
|
+
const s = [], c = [], l = (p) => {
|
|
2849
|
+
for (let g = 0; g < s.length; g++) {
|
|
2850
|
+
const h = g === p;
|
|
2851
|
+
s[g].classList.toggle("gengage-chat-categories-tab--active", h), s[g].classList.toggle("is-active", h), s[g].setAttribute("aria-selected", String(h)), s[g].tabIndex = h ? 0 : -1, c[g].style.display = h ? "" : "none";
|
|
2834
2852
|
}
|
|
2835
2853
|
};
|
|
2836
|
-
for (let
|
|
2837
|
-
const
|
|
2838
|
-
if (x.className = "gengage-chat-categories-tab gds-tab", x.type = "button", x.dataset.gengagePart = "categories-tab", x.id = h, x.setAttribute("role", "tab"), x.setAttribute("aria-controls", m), x.setAttribute("aria-selected", String(
|
|
2854
|
+
for (let p = 0; p < a.length; p++) {
|
|
2855
|
+
const g = a[p], h = `${r}-tab-${p}`, m = `${r}-panel-${p}`, x = document.createElement("button");
|
|
2856
|
+
if (x.className = "gengage-chat-categories-tab gds-tab", x.type = "button", x.dataset.gengagePart = "categories-tab", x.id = h, x.setAttribute("role", "tab"), x.setAttribute("aria-controls", m), x.setAttribute("aria-selected", String(p === 0)), x.tabIndex = p === 0 ? 0 : -1, p === 0 && x.classList.add("gengage-chat-categories-tab--active", "is-active"), g.image && Ce(g.image)) {
|
|
2839
2857
|
const y = document.createElement("img");
|
|
2840
|
-
y.className = "gengage-chat-categories-tab-image", y.draggable = !1, y.src =
|
|
2858
|
+
y.className = "gengage-chat-categories-tab-image", y.draggable = !1, y.src = g.image, y.alt = g.groupName, y.loading = "lazy", xe(y), x.appendChild(y);
|
|
2841
2859
|
}
|
|
2842
2860
|
const v = document.createElement("span");
|
|
2843
|
-
v.className = "gengage-chat-categories-tab-text", v.textContent =
|
|
2861
|
+
v.className = "gengage-chat-categories-tab-text", v.textContent = g.groupName, x.appendChild(v), x.addEventListener("click", () => l(p)), x.addEventListener("keydown", (y) => {
|
|
2844
2862
|
let b = -1;
|
|
2845
|
-
y.key === "ArrowRight" || y.key === "ArrowDown" ? b = (
|
|
2863
|
+
y.key === "ArrowRight" || y.key === "ArrowDown" ? b = (p + 1) % a.length : y.key === "ArrowLeft" || y.key === "ArrowUp" ? b = (p - 1 + a.length) % a.length : y.key === "Home" ? b = 0 : y.key === "End" && (b = a.length - 1), b >= 0 && (y.preventDefault(), l(b), s[b].focus());
|
|
2846
2864
|
}), s.push(x), o.appendChild(x);
|
|
2847
2865
|
const u = document.createElement("div");
|
|
2848
|
-
u.className = "gengage-chat-categories-panel", u.dataset.gengagePart = "categories-panel", u.id = m, u.setAttribute("role", "tabpanel"), u.setAttribute("aria-labelledby", h),
|
|
2849
|
-
const
|
|
2850
|
-
|
|
2866
|
+
u.className = "gengage-chat-categories-panel", u.dataset.gengagePart = "categories-panel", u.id = m, u.setAttribute("role", "tabpanel"), u.setAttribute("aria-labelledby", h), p !== 0 && (u.style.display = "none");
|
|
2867
|
+
const d = Er(g);
|
|
2868
|
+
d && u.appendChild(d);
|
|
2851
2869
|
const _ = document.createElement("div");
|
|
2852
2870
|
_.className = "gengage-chat-categories-grid", _.dataset.gengagePart = "categories-grid";
|
|
2853
|
-
for (const y of
|
|
2871
|
+
for (const y of g.products) {
|
|
2854
2872
|
const b = Ar(y, e);
|
|
2855
2873
|
_.appendChild(b);
|
|
2856
2874
|
}
|
|
2857
2875
|
u.appendChild(_), c.push(u);
|
|
2858
2876
|
}
|
|
2859
2877
|
i.appendChild(o);
|
|
2860
|
-
for (const
|
|
2878
|
+
for (const p of c) i.appendChild(p);
|
|
2861
2879
|
if (n.length > 0) {
|
|
2862
|
-
const
|
|
2863
|
-
|
|
2864
|
-
for (const
|
|
2880
|
+
const p = document.createElement("div");
|
|
2881
|
+
p.className = "gengage-chat-categories-filter-tags gds-toolbar", p.dataset.gengagePart = "categories-filter-tags";
|
|
2882
|
+
for (const g of n) {
|
|
2865
2883
|
const h = document.createElement("button");
|
|
2866
|
-
h.className = "gengage-chat-categories-filter-tag gds-chip", h.type = "button", h.dataset.gengagePart = "categories-filter-tag", h.textContent =
|
|
2867
|
-
e.onAction(
|
|
2868
|
-
}),
|
|
2884
|
+
h.className = "gengage-chat-categories-filter-tag gds-chip", h.type = "button", h.dataset.gengagePart = "categories-filter-tag", h.textContent = g.title, g.action && h.addEventListener("click", () => {
|
|
2885
|
+
e.onAction(g.action);
|
|
2886
|
+
}), p.appendChild(h);
|
|
2869
2887
|
}
|
|
2870
|
-
i.appendChild(
|
|
2888
|
+
i.appendChild(p);
|
|
2871
2889
|
}
|
|
2872
2890
|
return i;
|
|
2873
2891
|
}
|
|
@@ -2925,10 +2943,10 @@ function Nr(t) {
|
|
|
2925
2943
|
}).filter((e) => e !== null) : [];
|
|
2926
2944
|
}
|
|
2927
2945
|
function Br(t, e) {
|
|
2928
|
-
const a = t.props ?? {}, n = Te(a.eyebrow), r = Te(a.title), i = a.showTitle !== !1, o = Te(a.ctaLabel) || e.i18n?.showPanelAriaLabel || "Show Results", s = Te(a.panelMessageId), c = Te(a.highlightMessageId), l = Te(a.threadId),
|
|
2929
|
-
|
|
2946
|
+
const a = t.props ?? {}, n = Te(a.eyebrow), r = Te(a.title), i = a.showTitle !== !1, o = Te(a.ctaLabel) || e.i18n?.showPanelAriaLabel || "Show Results", s = Te(a.panelMessageId), c = Te(a.highlightMessageId), l = Te(a.threadId), p = Nr(a.products).slice(0, 3), g = document.createElement("button");
|
|
2947
|
+
g.type = "button", g.className = "gengage-chat-panel-restore-card gds-card", !n && !i && g.classList.add("gengage-chat-panel-restore-card--minimal"), g.dataset.gengagePart = "panel-restore-card";
|
|
2930
2948
|
const h = r || n || o;
|
|
2931
|
-
|
|
2949
|
+
g.setAttribute("aria-label", r ? `${h} - ${o}` : h);
|
|
2932
2950
|
const m = {
|
|
2933
2951
|
title: r,
|
|
2934
2952
|
type: Mr,
|
|
@@ -2938,114 +2956,114 @@ function Br(t, e) {
|
|
|
2938
2956
|
threadId: l
|
|
2939
2957
|
}
|
|
2940
2958
|
};
|
|
2941
|
-
if (
|
|
2959
|
+
if (g.addEventListener("click", () => e.onAction(m)), n) {
|
|
2942
2960
|
const v = document.createElement("div");
|
|
2943
|
-
v.className = "gengage-chat-panel-restore-card__eyebrow", v.textContent = n,
|
|
2961
|
+
v.className = "gengage-chat-panel-restore-card__eyebrow", v.textContent = n, g.appendChild(v);
|
|
2944
2962
|
}
|
|
2945
|
-
if (
|
|
2963
|
+
if (p.length > 0) {
|
|
2946
2964
|
const v = document.createElement("div");
|
|
2947
2965
|
v.className = "gengage-chat-panel-restore-card__previews";
|
|
2948
|
-
for (const u of
|
|
2949
|
-
const
|
|
2950
|
-
|
|
2966
|
+
for (const u of p) {
|
|
2967
|
+
const d = document.createElement("div");
|
|
2968
|
+
d.className = "gengage-chat-panel-restore-card__thumb";
|
|
2951
2969
|
const _ = u.imageUrl;
|
|
2952
2970
|
if (_ && he(_)) {
|
|
2953
2971
|
const y = document.createElement("img");
|
|
2954
|
-
y.loading = "lazy", y.alt = u.name || r, de(y, "src", _), xe(y),
|
|
2972
|
+
y.loading = "lazy", y.alt = u.name || r, de(y, "src", _), xe(y), d.appendChild(y);
|
|
2955
2973
|
}
|
|
2956
|
-
v.appendChild(
|
|
2974
|
+
v.appendChild(d);
|
|
2957
2975
|
}
|
|
2958
|
-
|
|
2976
|
+
g.appendChild(v);
|
|
2959
2977
|
}
|
|
2960
2978
|
if (i && r) {
|
|
2961
2979
|
const v = document.createElement("div");
|
|
2962
|
-
v.className = "gengage-chat-panel-restore-card__title", v.textContent = r, v.title = r,
|
|
2980
|
+
v.className = "gengage-chat-panel-restore-card__title", v.textContent = r, v.title = r, g.appendChild(v);
|
|
2963
2981
|
}
|
|
2964
2982
|
const x = document.createElement("div");
|
|
2965
|
-
return x.className = "gengage-chat-panel-restore-card__cta", x.textContent = o,
|
|
2983
|
+
return x.className = "gengage-chat-panel-restore-card__cta", x.textContent = o, g.appendChild(x), g;
|
|
2966
2984
|
}
|
|
2967
2985
|
function zr(t, e) {
|
|
2968
2986
|
const a = t.props?.product ?? t.props, n = document.createElement("div");
|
|
2969
2987
|
if (n.className = "gengage-chat-product-summary gds-card", n.dataset.gengagePart = "product-summary-card", !a) return n;
|
|
2970
|
-
n.classList.add("gds-clickable"), n.addEventListener("click", (
|
|
2971
|
-
|
|
2988
|
+
n.classList.add("gds-clickable"), n.addEventListener("click", (d) => {
|
|
2989
|
+
d.target.closest("a") || e.onProductSelect?.(a);
|
|
2972
2990
|
});
|
|
2973
2991
|
const r = a.imageUrl;
|
|
2974
2992
|
if (r && he(r)) {
|
|
2975
|
-
const
|
|
2976
|
-
|
|
2993
|
+
const d = document.createElement("div");
|
|
2994
|
+
d.className = "gengage-chat-product-summary__image", d.dataset.gengagePart = "product-summary-image";
|
|
2977
2995
|
const _ = document.createElement("img");
|
|
2978
|
-
_.loading = "lazy", de(_, "src", r), _.alt = a.name || "Product image", xe(_),
|
|
2996
|
+
_.loading = "lazy", de(_, "src", r), _.alt = a.name || "Product image", xe(_), d.appendChild(_), n.appendChild(d);
|
|
2979
2997
|
}
|
|
2980
2998
|
const i = document.createElement("div");
|
|
2981
2999
|
i.className = "gengage-chat-product-summary__content", i.dataset.gengagePart = "product-summary-content";
|
|
2982
3000
|
const o = a.brand, s = a.name;
|
|
2983
3001
|
if (s) {
|
|
2984
|
-
const
|
|
2985
|
-
|
|
3002
|
+
const d = document.createElement("div");
|
|
3003
|
+
d.className = "gengage-chat-product-summary__name", d.dataset.gengagePart = "product-summary-name";
|
|
2986
3004
|
const _ = o && !s.toLowerCase().startsWith(o.toLowerCase()) ? `${o} ${s}` : s;
|
|
2987
|
-
|
|
3005
|
+
d.textContent = _, d.title = _, i.appendChild(d);
|
|
2988
3006
|
}
|
|
2989
3007
|
const c = a.rating, l = a.reviewCount;
|
|
2990
3008
|
if (e.hideUserReviews !== !0 && typeof c == "number" && Number.isFinite(c) && c > 0) {
|
|
2991
|
-
const
|
|
2992
|
-
if (
|
|
3009
|
+
const d = document.createElement("div");
|
|
3010
|
+
if (d.className = "gengage-chat-product-summary__rating", d.dataset.gengagePart = "product-summary-rating", d.appendChild(Jt(c)), typeof l == "number" && Number.isFinite(l)) {
|
|
2993
3011
|
const _ = document.createElement("span");
|
|
2994
|
-
_.className = "gengage-chat-product-summary__review-count", _.textContent = ` (${l})`,
|
|
3012
|
+
_.className = "gengage-chat-product-summary__review-count", _.textContent = ` (${l})`, d.appendChild(_);
|
|
2995
3013
|
}
|
|
2996
|
-
i.appendChild(
|
|
3014
|
+
i.appendChild(d);
|
|
2997
3015
|
}
|
|
2998
|
-
const
|
|
2999
|
-
if (
|
|
3000
|
-
const
|
|
3016
|
+
const p = a.price, g = a.originalPrice;
|
|
3017
|
+
if (p) {
|
|
3018
|
+
const d = He(e, a), _ = $e(e, a), y = !!(g && g !== p), b = document.createElement("div");
|
|
3001
3019
|
b.className = "gengage-chat-product-summary__price", b.dataset.gengagePart = "product-summary-price";
|
|
3002
|
-
const A = !!(
|
|
3020
|
+
const A = !!(d && y), L = Je(e, a);
|
|
3003
3021
|
if (A) {
|
|
3004
|
-
const
|
|
3005
|
-
reasonText:
|
|
3006
|
-
salePriceFormatted: ae(
|
|
3007
|
-
...
|
|
3022
|
+
const E = et({
|
|
3023
|
+
reasonText: d,
|
|
3024
|
+
salePriceFormatted: ae(p, e.pricing),
|
|
3025
|
+
...L !== void 0 ? { logoUrl: L } : {}
|
|
3008
3026
|
});
|
|
3009
3027
|
if (y && _ === "inline") {
|
|
3010
|
-
b.classList.add("gengage-chat-product-summary__price--inline"), b.appendChild(
|
|
3011
|
-
const
|
|
3012
|
-
|
|
3013
|
-
const
|
|
3014
|
-
|
|
3028
|
+
b.classList.add("gengage-chat-product-summary__price--inline"), b.appendChild(E);
|
|
3029
|
+
const T = document.createElement("span");
|
|
3030
|
+
T.className = "gengage-chat-product-summary__price-sep", T.setAttribute("aria-hidden", "true");
|
|
3031
|
+
const N = document.createElement("span");
|
|
3032
|
+
N.className = "gengage-chat-product-summary__price-original", N.textContent = ae(g, e.pricing), b.appendChild(T), b.appendChild(N);
|
|
3015
3033
|
} else {
|
|
3016
|
-
const
|
|
3017
|
-
|
|
3034
|
+
const T = document.createElement("span");
|
|
3035
|
+
T.className = "gengage-chat-product-summary__price-original", T.textContent = ae(g, e.pricing), b.appendChild(T), b.appendChild(document.createTextNode(" ")), b.appendChild(E);
|
|
3018
3036
|
}
|
|
3019
3037
|
i.appendChild(b);
|
|
3020
3038
|
} else {
|
|
3021
3039
|
if (y && _ === "inline") {
|
|
3022
3040
|
b.classList.add("gengage-chat-product-summary__price--inline");
|
|
3023
|
-
const
|
|
3024
|
-
|
|
3025
|
-
const
|
|
3026
|
-
|
|
3027
|
-
const
|
|
3028
|
-
|
|
3041
|
+
const E = document.createElement("span");
|
|
3042
|
+
E.className = "gengage-chat-product-summary__price-current", E.textContent = ae(p, e.pricing);
|
|
3043
|
+
const T = document.createElement("span");
|
|
3044
|
+
T.className = "gengage-chat-product-summary__price-sep", T.setAttribute("aria-hidden", "true");
|
|
3045
|
+
const N = document.createElement("span");
|
|
3046
|
+
N.className = "gengage-chat-product-summary__price-original", N.textContent = ae(g, e.pricing), b.appendChild(E), b.appendChild(T), b.appendChild(N);
|
|
3029
3047
|
} else if (y) {
|
|
3030
|
-
const
|
|
3031
|
-
|
|
3032
|
-
const
|
|
3033
|
-
|
|
3048
|
+
const E = document.createElement("span");
|
|
3049
|
+
E.className = "gengage-chat-product-summary__price-original", E.textContent = ae(g, e.pricing), b.appendChild(E), b.appendChild(document.createTextNode(" "));
|
|
3050
|
+
const T = document.createElement("span");
|
|
3051
|
+
T.className = "gengage-chat-product-summary__price-current", T.textContent = ae(p, e.pricing), b.appendChild(T);
|
|
3034
3052
|
} else {
|
|
3035
|
-
const
|
|
3036
|
-
|
|
3053
|
+
const E = document.createElement("span");
|
|
3054
|
+
E.className = "gengage-chat-product-summary__price-current", E.textContent = ae(p, e.pricing), b.appendChild(E);
|
|
3037
3055
|
}
|
|
3038
|
-
if (
|
|
3039
|
-
const
|
|
3040
|
-
|
|
3056
|
+
if (d) {
|
|
3057
|
+
const E = document.createElement("div");
|
|
3058
|
+
E.className = "gengage-chat-product-summary__price-stack", E.appendChild(Qe(d)), E.appendChild(b), i.appendChild(E);
|
|
3041
3059
|
} else i.appendChild(b);
|
|
3042
3060
|
}
|
|
3043
3061
|
}
|
|
3044
3062
|
n.appendChild(i);
|
|
3045
3063
|
const h = a.url, m = a.sku, x = a.cartCode ?? a.cart_code, v = typeof x == "string" && x.trim() ? x.trim() : void 0, u = a.inStock;
|
|
3046
3064
|
if (m && v && u !== !1) {
|
|
3047
|
-
const
|
|
3048
|
-
|
|
3065
|
+
const d = document.createElement("button");
|
|
3066
|
+
d.type = "button", d.className = "gengage-chat-product-summary__cta gds-chip gds-chip-active", d.dataset.gengagePart = "product-summary-cta", d.textContent = e.i18n?.addToCartButton ?? "Add to Cart", d.addEventListener("click", (_) => {
|
|
3049
3067
|
_.stopPropagation(), e.onAction({
|
|
3050
3068
|
title: e.i18n?.addToCartButton ?? "Add to Cart",
|
|
3051
3069
|
type: "addToCart",
|
|
@@ -3055,10 +3073,10 @@ function zr(t, e) {
|
|
|
3055
3073
|
quantity: 1
|
|
3056
3074
|
}
|
|
3057
3075
|
});
|
|
3058
|
-
}), n.appendChild(
|
|
3076
|
+
}), n.appendChild(d);
|
|
3059
3077
|
} else if (h && he(h)) {
|
|
3060
|
-
const
|
|
3061
|
-
|
|
3078
|
+
const d = document.createElement("a");
|
|
3079
|
+
d.className = "gengage-chat-product-summary__cta gds-chip gds-chip-active", d.dataset.gengagePart = "product-summary-cta", de(d, "href", h), de(d, "target", "_blank"), de(d, "rel", "noopener noreferrer"), d.textContent = e.i18n?.productCtaLabel ?? "View", n.appendChild(d);
|
|
3062
3080
|
}
|
|
3063
3081
|
return n;
|
|
3064
3082
|
}
|
|
@@ -3140,7 +3158,7 @@ function Nt(t, e, a, n, r) {
|
|
|
3140
3158
|
const i = $e(e, a), o = !!(r && n && r !== n), s = He(e, a), c = !!(s && o), l = Je(e, a);
|
|
3141
3159
|
if (!n || parseFloat(n) <= 0) return;
|
|
3142
3160
|
if (c) {
|
|
3143
|
-
const
|
|
3161
|
+
const g = et({
|
|
3144
3162
|
reasonText: s,
|
|
3145
3163
|
salePriceFormatted: ae(n, e.pricing),
|
|
3146
3164
|
...l !== void 0 ? { logoUrl: l } : {}
|
|
@@ -3148,14 +3166,14 @@ function Nt(t, e, a, n, r) {
|
|
|
3148
3166
|
if (o && i === "inline") {
|
|
3149
3167
|
t.classList.add("gengage-chat-product-card-price-block--inline");
|
|
3150
3168
|
const h = document.createElement("div");
|
|
3151
|
-
h.className = "gengage-chat-product-card-price-row", h.appendChild(
|
|
3169
|
+
h.className = "gengage-chat-product-card-price-row", h.appendChild(g);
|
|
3152
3170
|
const m = document.createElement("span");
|
|
3153
3171
|
m.className = "gengage-chat-product-card-price-sep", m.setAttribute("aria-hidden", "true");
|
|
3154
3172
|
const x = document.createElement("span");
|
|
3155
3173
|
x.className = "gengage-chat-product-card-original-price", x.textContent = ae(r, e.pricing), h.appendChild(m), h.appendChild(x), t.appendChild(h);
|
|
3156
3174
|
return;
|
|
3157
3175
|
}
|
|
3158
|
-
if (t.classList.remove("gengage-chat-product-card-price-block--inline"), t.appendChild(
|
|
3176
|
+
if (t.classList.remove("gengage-chat-product-card-price-block--inline"), t.appendChild(g), o) {
|
|
3159
3177
|
t.appendChild(document.createTextNode(" "));
|
|
3160
3178
|
const h = document.createElement("span");
|
|
3161
3179
|
h.className = "gengage-chat-product-card-original-price", h.textContent = ae(r, e.pricing), t.appendChild(h);
|
|
@@ -3164,35 +3182,35 @@ function Nt(t, e, a, n, r) {
|
|
|
3164
3182
|
}
|
|
3165
3183
|
if (o && i === "inline") {
|
|
3166
3184
|
t.classList.add("gengage-chat-product-card-price-block--inline");
|
|
3167
|
-
const
|
|
3168
|
-
|
|
3185
|
+
const g = document.createElement("div");
|
|
3186
|
+
g.className = "gengage-chat-product-card-price-row";
|
|
3169
3187
|
const h = document.createElement("span");
|
|
3170
3188
|
h.className = "gengage-chat-product-card-current-price", h.textContent = ae(n, e.pricing);
|
|
3171
3189
|
const m = document.createElement("span");
|
|
3172
3190
|
m.className = "gengage-chat-product-card-price-sep", m.setAttribute("aria-hidden", "true");
|
|
3173
3191
|
const x = document.createElement("span");
|
|
3174
|
-
x.className = "gengage-chat-product-card-original-price", x.textContent = ae(r, e.pricing),
|
|
3192
|
+
x.className = "gengage-chat-product-card-original-price", x.textContent = ae(r, e.pricing), g.appendChild(h), g.appendChild(m), g.appendChild(x), t.appendChild(g);
|
|
3175
3193
|
return;
|
|
3176
3194
|
}
|
|
3177
3195
|
t.classList.remove("gengage-chat-product-card-price-block--inline");
|
|
3178
|
-
const
|
|
3179
|
-
if (
|
|
3196
|
+
const p = document.createElement("span");
|
|
3197
|
+
if (p.className = "gengage-chat-product-card-current-price", p.textContent = ae(n, e.pricing), t.appendChild(p), o) {
|
|
3180
3198
|
t.appendChild(document.createTextNode(" "));
|
|
3181
|
-
const
|
|
3182
|
-
|
|
3199
|
+
const g = document.createElement("span");
|
|
3200
|
+
g.className = "gengage-chat-product-card-original-price", g.textContent = ae(r, e.pricing), t.appendChild(g);
|
|
3183
3201
|
}
|
|
3184
3202
|
}
|
|
3185
3203
|
function Bt(t, e, a, n, r, i, o) {
|
|
3186
3204
|
t.classList.remove("gengage-chat-product-details-price--inline"), t.replaceChildren(), t.className = "gengage-chat-product-details-price";
|
|
3187
3205
|
const s = He(e, a), c = !!(s && o), l = Je(e, a);
|
|
3188
3206
|
if (c) {
|
|
3189
|
-
const
|
|
3207
|
+
const g = et({
|
|
3190
3208
|
reasonText: s,
|
|
3191
3209
|
salePriceFormatted: ae(n, e.pricing),
|
|
3192
3210
|
...l !== void 0 ? { logoUrl: l } : {}
|
|
3193
3211
|
});
|
|
3194
3212
|
if (o && i === "inline") {
|
|
3195
|
-
t.classList.add("gengage-chat-product-details-price--inline"), t.appendChild(
|
|
3213
|
+
t.classList.add("gengage-chat-product-details-price--inline"), t.appendChild(g);
|
|
3196
3214
|
const h = document.createElement("span");
|
|
3197
3215
|
h.className = "gengage-chat-product-details-price-sep", h.setAttribute("aria-hidden", "true");
|
|
3198
3216
|
const m = document.createElement("span");
|
|
@@ -3202,28 +3220,28 @@ function Bt(t, e, a, n, r, i, o) {
|
|
|
3202
3220
|
const h = document.createElement("span");
|
|
3203
3221
|
h.className = "gengage-chat-product-details-original-price", h.textContent = ae(r, e.pricing), t.appendChild(h), t.appendChild(document.createTextNode(" "));
|
|
3204
3222
|
}
|
|
3205
|
-
t.appendChild(
|
|
3223
|
+
t.appendChild(g);
|
|
3206
3224
|
}
|
|
3207
3225
|
} else if (o && i === "inline") {
|
|
3208
3226
|
t.classList.add("gengage-chat-product-details-price--inline");
|
|
3209
|
-
const
|
|
3210
|
-
|
|
3227
|
+
const g = document.createElement("span");
|
|
3228
|
+
g.className = "gengage-chat-product-details-current-price", g.textContent = ae(n, e.pricing);
|
|
3211
3229
|
const h = document.createElement("span");
|
|
3212
3230
|
h.className = "gengage-chat-product-details-price-sep", h.setAttribute("aria-hidden", "true");
|
|
3213
3231
|
const m = document.createElement("span");
|
|
3214
|
-
m.className = "gengage-chat-product-details-original-price", m.textContent = ae(r, e.pricing), t.appendChild(
|
|
3232
|
+
m.className = "gengage-chat-product-details-original-price", m.textContent = ae(r, e.pricing), t.appendChild(g), t.appendChild(h), t.appendChild(m);
|
|
3215
3233
|
} else {
|
|
3216
3234
|
if (o) {
|
|
3217
3235
|
const h = document.createElement("span");
|
|
3218
3236
|
h.className = "gengage-chat-product-details-original-price", h.textContent = ae(r, e.pricing), t.appendChild(h), t.appendChild(document.createTextNode(" "));
|
|
3219
3237
|
}
|
|
3220
|
-
const
|
|
3221
|
-
|
|
3238
|
+
const g = document.createElement("span");
|
|
3239
|
+
g.className = "gengage-chat-product-details-current-price", g.textContent = ae(n, e.pricing), t.appendChild(g);
|
|
3222
3240
|
}
|
|
3223
|
-
const
|
|
3224
|
-
if (!e.hideProductDiscountBadge && typeof
|
|
3225
|
-
const
|
|
3226
|
-
|
|
3241
|
+
const p = Ke(a, "discountPercent", "price_discount_rate");
|
|
3242
|
+
if (!e.hideProductDiscountBadge && typeof p == "number" && p > 0) {
|
|
3243
|
+
const g = document.createElement("span");
|
|
3244
|
+
g.className = "gengage-chat-product-details-discount-badge", g.textContent = `%${ta(p)}`, t.appendChild(g);
|
|
3227
3245
|
}
|
|
3228
3246
|
}
|
|
3229
3247
|
function pt(t, e) {
|
|
@@ -3233,35 +3251,35 @@ function pt(t, e) {
|
|
|
3233
3251
|
if (!n) return a;
|
|
3234
3252
|
const r = n.sku;
|
|
3235
3253
|
r && (a.dataset.sku = r);
|
|
3236
|
-
const i = t.props?.action, o = n.name, s = n.url, c = n.sku, l = s && he(s) ? s : void 0,
|
|
3254
|
+
const i = t.props?.action, o = n.name, s = n.url, c = n.sku, l = s && he(s) ? s : void 0, p = () => i?.type !== "launchSingleProduct" || l === void 0 || c === void 0 || e.onProductClick === void 0 ? !1 : (e.onProductClick({
|
|
3237
3255
|
sku: c,
|
|
3238
3256
|
url: l,
|
|
3239
3257
|
...typeof o == "string" ? { name: o } : {}
|
|
3240
3258
|
}), !0);
|
|
3241
|
-
(e.onProductSelect || i) && (a.classList.add("gds-clickable"), a.addEventListener("click", (
|
|
3242
|
-
if (!a.parentElement?.classList.contains("gengage-chat-comparison-select-wrapper") && !
|
|
3259
|
+
(e.onProductSelect || i) && (a.classList.add("gds-clickable"), a.addEventListener("click", (k) => {
|
|
3260
|
+
if (!a.parentElement?.classList.contains("gengage-chat-comparison-select-wrapper") && !k.target.closest(".gengage-chat-product-card-atc") && !k.target.closest(".gengage-chat-product-card-cta")) {
|
|
3243
3261
|
if (i) {
|
|
3244
|
-
|
|
3262
|
+
p() || e.onAction(i);
|
|
3245
3263
|
return;
|
|
3246
3264
|
}
|
|
3247
3265
|
e.onProductSelect?.(n);
|
|
3248
3266
|
}
|
|
3249
3267
|
}));
|
|
3250
|
-
const
|
|
3251
|
-
if (
|
|
3252
|
-
const
|
|
3253
|
-
|
|
3254
|
-
const
|
|
3255
|
-
|
|
3256
|
-
const
|
|
3257
|
-
|
|
3268
|
+
const g = n.imageUrl;
|
|
3269
|
+
if (g && he(g)) {
|
|
3270
|
+
const k = document.createElement("div");
|
|
3271
|
+
k.className = "gengage-chat-product-card-img-wrapper";
|
|
3272
|
+
const O = document.createElement("img");
|
|
3273
|
+
O.className = "gengage-chat-product-card-img", O.loading = "lazy", de(O, "src", g);
|
|
3274
|
+
const B = n.name;
|
|
3275
|
+
B && (O.alt = B), xe(O), k.appendChild(O);
|
|
3258
3276
|
const q = n.discountPercent;
|
|
3259
3277
|
if (!e.hideProductDiscountBadge && typeof q == "number" && q > 0) {
|
|
3260
3278
|
const f = document.createElement("span");
|
|
3261
|
-
f.className = "gengage-chat-product-card-discount-badge", f.textContent = `%${ta(q)}`,
|
|
3279
|
+
f.className = "gengage-chat-product-card-discount-badge", f.textContent = `%${ta(q)}`, k.appendChild(f);
|
|
3262
3280
|
}
|
|
3263
|
-
const
|
|
3264
|
-
|
|
3281
|
+
const U = document.createElement("div");
|
|
3282
|
+
U.className = "gengage-chat-product-card-img-actions";
|
|
3265
3283
|
const ne = n.sku;
|
|
3266
3284
|
if (ne && e.onFavoriteToggle) {
|
|
3267
3285
|
const f = document.createElement("button");
|
|
@@ -3271,7 +3289,7 @@ function pt(t, e) {
|
|
|
3271
3289
|
P.stopPropagation(), f.classList.toggle("gengage-chat-favorite-btn--active");
|
|
3272
3290
|
const $ = f.querySelector("svg");
|
|
3273
3291
|
$ && $.setAttribute("fill", f.classList.contains("gengage-chat-favorite-btn--active") ? "currentColor" : "none"), e.onFavoriteToggle(ne, n);
|
|
3274
|
-
}),
|
|
3292
|
+
}), U.appendChild(f);
|
|
3275
3293
|
}
|
|
3276
3294
|
const W = n.sku, K = e.i18n?.findSimilarLabel ?? "Find Similar";
|
|
3277
3295
|
if (W) {
|
|
@@ -3284,59 +3302,59 @@ function pt(t, e) {
|
|
|
3284
3302
|
type: "findSimilar",
|
|
3285
3303
|
payload: { sku: W }
|
|
3286
3304
|
});
|
|
3287
|
-
}),
|
|
3305
|
+
}), U.appendChild(f);
|
|
3288
3306
|
}
|
|
3289
|
-
|
|
3307
|
+
U.childElementCount > 0 && k.appendChild(U), a.appendChild(k);
|
|
3290
3308
|
}
|
|
3291
3309
|
const h = document.createElement("div");
|
|
3292
3310
|
h.className = "gengage-chat-product-card-body";
|
|
3293
3311
|
const m = n.brand;
|
|
3294
3312
|
if (m) {
|
|
3295
|
-
const
|
|
3296
|
-
|
|
3313
|
+
const k = document.createElement("div");
|
|
3314
|
+
k.className = "gengage-chat-product-card-brand", k.textContent = m, h.appendChild(k);
|
|
3297
3315
|
}
|
|
3298
|
-
const x = n.rating, v = n.reviewCount, u = n.price,
|
|
3299
|
-
|
|
3300
|
-
const
|
|
3301
|
-
|
|
3302
|
-
const X =
|
|
3303
|
-
const
|
|
3304
|
-
return
|
|
3305
|
-
})() :
|
|
3316
|
+
const x = n.rating, v = n.reviewCount, u = n.price, d = n.originalPrice, _ = n.price_async, y = He(e, n), b = $e(e, n), A = !!(d && u && d !== u && parseFloat(u) > 0), L = !!(y && A), E = !!(y && !L || A && b === "inline"), T = typeof x == "number" && Number.isFinite(x) && x > 0, N = document.createElement("div");
|
|
3317
|
+
N.className = "gengage-chat-product-card-meta-row";
|
|
3318
|
+
const F = document.createElement("div");
|
|
3319
|
+
F.className = "gengage-chat-product-card-price gengage-chat-product-card-price-block";
|
|
3320
|
+
const X = E ? (() => {
|
|
3321
|
+
const k = document.createElement("div");
|
|
3322
|
+
return k.className = "gengage-chat-product-card-price-stack", y && !L && k.appendChild(Qe(y)), k.appendChild(F), k;
|
|
3323
|
+
})() : F;
|
|
3306
3324
|
if (_ === !0) {
|
|
3307
|
-
const
|
|
3308
|
-
|
|
3309
|
-
|
|
3325
|
+
const k = document.createElement("span");
|
|
3326
|
+
k.className = "gengage-chat-price-skeleton", F.appendChild(k), setTimeout(() => {
|
|
3327
|
+
k.parentElement && (u && parseFloat(u) > 0 ? Nt(F, e, n, u, n.originalPrice) : k.remove());
|
|
3310
3328
|
}, 300);
|
|
3311
|
-
} else u && parseFloat(u) > 0 && Nt(
|
|
3312
|
-
if ((
|
|
3313
|
-
const
|
|
3314
|
-
|
|
3315
|
-
const
|
|
3316
|
-
typeof v == "number" && Number.isFinite(v) &&
|
|
3329
|
+
} else u && parseFloat(u) > 0 && Nt(F, e, n, u, d);
|
|
3330
|
+
if ((F.childElementCount > 0 || _ === !0) && N.appendChild(X), T) {
|
|
3331
|
+
const k = document.createElement("div");
|
|
3332
|
+
k.className = "gengage-chat-product-card-rating gengage-chat-product-card-rating-compact";
|
|
3333
|
+
const O = ea(x), B = [`${O.toFixed(1)}`, "out of 5 stars"];
|
|
3334
|
+
typeof v == "number" && Number.isFinite(v) && B.push(`(${v} reviews)`), k.setAttribute("aria-label", B.join(" "));
|
|
3317
3335
|
const q = document.createElement("span");
|
|
3318
3336
|
q.className = "gengage-chat-product-card-rating-compact-star", q.setAttribute("aria-hidden", "true"), q.innerHTML = '<svg width="12" height="12" viewBox="0 0 24 24" fill="currentColor"><path d="M12 3.6l2.58 5.23 5.77.84-4.17 4.07.98 5.75L12 16.78l-5.16 2.71.99-5.75L3.66 9.67l5.76-.84L12 3.6z"/></svg>';
|
|
3319
|
-
const
|
|
3320
|
-
|
|
3337
|
+
const U = document.createElement("span");
|
|
3338
|
+
U.className = "gengage-chat-product-card-rating-compact-value", U.textContent = O.toFixed(1), k.appendChild(q), k.appendChild(U), N.appendChild(k);
|
|
3321
3339
|
}
|
|
3322
|
-
if (
|
|
3323
|
-
const
|
|
3324
|
-
|
|
3340
|
+
if (N.childElementCount === 0 && (N.classList.add("gengage-chat-product-card-meta-row--empty"), N.setAttribute("aria-hidden", "true")), h.appendChild(N), o) {
|
|
3341
|
+
const k = document.createElement("div");
|
|
3342
|
+
k.className = "gengage-chat-product-card-name", k.textContent = o, k.title = o, h.appendChild(k);
|
|
3325
3343
|
}
|
|
3326
|
-
const
|
|
3327
|
-
if (e.hideStockStatus !== !0 && typeof
|
|
3328
|
-
const
|
|
3329
|
-
|
|
3344
|
+
const C = n.inStock;
|
|
3345
|
+
if (e.hideStockStatus !== !0 && typeof C == "boolean") {
|
|
3346
|
+
const k = document.createElement("div");
|
|
3347
|
+
k.className = `gengage-chat-product-card-stock ${C ? "is-in-stock" : "is-out-of-stock"}`, k.textContent = C ? e.i18n?.inStockLabel ?? "In Stock" : e.i18n?.outOfStockLabel ?? "Out of Stock", h.appendChild(k);
|
|
3330
3348
|
}
|
|
3331
3349
|
a.appendChild(h);
|
|
3332
|
-
const R = n.cartCode,
|
|
3333
|
-
if (
|
|
3334
|
-
const
|
|
3335
|
-
|
|
3336
|
-
const
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
title: e.i18n?.addToCartButton ??
|
|
3350
|
+
const R = n.cartCode, D = !!(R && c && C !== !1), z = e.i18n?.productCtaLabel ?? "View";
|
|
3351
|
+
if (D) {
|
|
3352
|
+
const k = document.createElement("div");
|
|
3353
|
+
k.className = "gengage-chat-product-card-buy-footer";
|
|
3354
|
+
const O = document.createElement("button");
|
|
3355
|
+
O.type = "button", O.className = "gengage-chat-product-card-buy-trigger", O.textContent = z, O.addEventListener("click", (B) => {
|
|
3356
|
+
B.stopPropagation(), e.onAction({
|
|
3357
|
+
title: e.i18n?.addToCartButton ?? z,
|
|
3340
3358
|
type: "addToCart",
|
|
3341
3359
|
payload: {
|
|
3342
3360
|
sku: c,
|
|
@@ -3344,49 +3362,49 @@ function pt(t, e) {
|
|
|
3344
3362
|
quantity: 1
|
|
3345
3363
|
}
|
|
3346
3364
|
});
|
|
3347
|
-
}),
|
|
3365
|
+
}), k.appendChild(O), a.appendChild(k);
|
|
3348
3366
|
} else if (i) {
|
|
3349
|
-
const
|
|
3350
|
-
|
|
3367
|
+
const k = document.createElement("button");
|
|
3368
|
+
k.className = "gengage-chat-product-card-cta", k.type = "button", k.textContent = i.type === "launchSingleProduct" ? z : i.title || z, k.addEventListener("click", (O) => {
|
|
3351
3369
|
if (a.parentElement?.classList.contains("gengage-chat-comparison-select-wrapper")) {
|
|
3352
|
-
|
|
3370
|
+
O.stopPropagation();
|
|
3353
3371
|
return;
|
|
3354
3372
|
}
|
|
3355
|
-
|
|
3356
|
-
}), a.appendChild(
|
|
3373
|
+
p() || e.onAction(i);
|
|
3374
|
+
}), a.appendChild(k);
|
|
3357
3375
|
} else if (l) {
|
|
3358
|
-
const
|
|
3359
|
-
|
|
3376
|
+
const k = document.createElement("a");
|
|
3377
|
+
k.className = "gengage-chat-product-card-cta", de(k, "href", l), de(k, "target", "_blank"), de(k, "rel", "noopener noreferrer"), k.textContent = z, k.addEventListener("click", (O) => {
|
|
3360
3378
|
if (a.parentElement?.classList.contains("gengage-chat-comparison-select-wrapper")) {
|
|
3361
|
-
|
|
3379
|
+
O.preventDefault(), O.stopPropagation();
|
|
3362
3380
|
return;
|
|
3363
3381
|
}
|
|
3364
|
-
e.onProductClick && c && (
|
|
3382
|
+
e.onProductClick && c && (O.preventDefault(), e.onProductClick({
|
|
3365
3383
|
sku: c,
|
|
3366
3384
|
url: l,
|
|
3367
3385
|
...o ? { name: o } : {}
|
|
3368
3386
|
}));
|
|
3369
|
-
}), a.appendChild(
|
|
3387
|
+
}), a.appendChild(k);
|
|
3370
3388
|
}
|
|
3371
3389
|
if (e.comparisonSelectMode && c && e.onToggleComparisonSku) {
|
|
3372
|
-
const
|
|
3373
|
-
|
|
3374
|
-
const
|
|
3375
|
-
|
|
3376
|
-
const
|
|
3377
|
-
|
|
3378
|
-
const
|
|
3379
|
-
|
|
3390
|
+
const k = document.createElement("div");
|
|
3391
|
+
k.className = "gengage-chat-comparison-select-wrapper";
|
|
3392
|
+
const O = e.comparisonSelectedSkus?.includes(c) ?? !1;
|
|
3393
|
+
O && k.classList.add("gengage-chat-comparison-select-wrapper--selected");
|
|
3394
|
+
const B = n.name ?? c, q = e.i18n?.comparisonSelectCardHint ?? "Tap anywhere on the card to add or remove it from comparison.";
|
|
3395
|
+
k.setAttribute("role", "group"), k.setAttribute("aria-label", `${String(B)}. ${q}`);
|
|
3396
|
+
const U = document.createElement("button");
|
|
3397
|
+
U.type = "button", U.className = "gengage-chat-comparison-checkbox", U.dataset.selected = O ? "true" : "false", U.setAttribute("aria-pressed", O ? "true" : "false");
|
|
3380
3398
|
const ne = document.createElement("span");
|
|
3381
|
-
ne.className = "gengage-chat-comparison-checkbox-icon", ne.innerHTML =
|
|
3399
|
+
ne.className = "gengage-chat-comparison-checkbox-icon", ne.innerHTML = O ? '<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M20 6L9 17l-5-5"/></svg>' : '<span class="gengage-chat-comparison-checkbox-dot"></span>';
|
|
3382
3400
|
const W = document.createElement("span");
|
|
3383
|
-
W.className = "gengage-chat-comparison-checkbox-label", W.textContent =
|
|
3401
|
+
W.className = "gengage-chat-comparison-checkbox-label", W.textContent = O ? e.i18n?.comparisonSelectedLabel ?? "Selected" : e.i18n?.comparisonSelectLabel ?? "Select to compare", U.appendChild(ne), U.appendChild(W), U.addEventListener("click", (f) => {
|
|
3384
3402
|
f.stopPropagation(), e.onToggleComparisonSku?.(c);
|
|
3385
3403
|
});
|
|
3386
3404
|
const K = document.createElement("div");
|
|
3387
|
-
return K.className = "gengage-chat-comparison-card-hint", K.setAttribute("aria-hidden", "true"), K.textContent = q,
|
|
3405
|
+
return K.className = "gengage-chat-comparison-card-hint", K.setAttribute("aria-hidden", "true"), K.textContent = q, k.addEventListener("click", (f) => {
|
|
3388
3406
|
f.target.closest(".gengage-chat-comparison-checkbox") || (f.stopPropagation(), e.onToggleComparisonSku?.(c));
|
|
3389
|
-
}),
|
|
3407
|
+
}), k.appendChild(U), k.appendChild(K), k.appendChild(a), k;
|
|
3390
3408
|
}
|
|
3391
3409
|
return a;
|
|
3392
3410
|
}
|
|
@@ -3567,12 +3585,12 @@ function ii(t) {
|
|
|
3567
3585
|
if (e) return e;
|
|
3568
3586
|
const a = be(t, "sku"), n = Ge(t, "inStock", "in_stock"), r = [], i = /* @__PURE__ */ new Set(), o = (c, l) => {
|
|
3569
3587
|
if (!ai(c) || typeof l != "string" && typeof l != "number" && typeof l != "boolean") return;
|
|
3570
|
-
const
|
|
3571
|
-
if (!
|
|
3572
|
-
const
|
|
3588
|
+
const p = String(l).trim();
|
|
3589
|
+
if (!p) return;
|
|
3590
|
+
const g = ni(c), h = `${g.toLowerCase()}:${p.toLowerCase()}`;
|
|
3573
3591
|
i.has(h) || (i.add(h), r.push({
|
|
3574
|
-
name:
|
|
3575
|
-
value:
|
|
3592
|
+
name: g,
|
|
3593
|
+
value: p,
|
|
3576
3594
|
sku: a,
|
|
3577
3595
|
inStock: n
|
|
3578
3596
|
}));
|
|
@@ -3590,46 +3608,46 @@ function si(t, e) {
|
|
|
3590
3608
|
a.className = "gengage-chat-product-details-panel";
|
|
3591
3609
|
const n = t.props?.product ?? t.props;
|
|
3592
3610
|
if (!n) return a;
|
|
3593
|
-
const r = be(n, "name"), i = be(n, "brand"), o = be(n, "sku"), s = be(n, "cartCode", "cart_code"), c = be(n, "price"), l = be(n, "originalPrice", "price_original"),
|
|
3594
|
-
if (
|
|
3595
|
-
const
|
|
3596
|
-
|
|
3611
|
+
const r = be(n, "name"), i = be(n, "brand"), o = be(n, "sku"), s = be(n, "cartCode", "cart_code"), c = be(n, "price"), l = be(n, "originalPrice", "price_original"), p = Ge(n, "price_async"), g = He(e, n), h = $e(e, n), m = !!(l && c && l !== c), x = Ge(n, "inStock", "in_stock"), v = Ke(n, "reviewCount", "review_count"), u = Ke(n, "rating"), d = Kr(n), _ = ha(n).slice(0, 4);
|
|
3612
|
+
if (d.length > 1) {
|
|
3613
|
+
const C = document.createElement("div");
|
|
3614
|
+
C.className = "gengage-chat-product-details-media gengage-chat-product-details-gallery gengage-chat-product-details-img-wrap";
|
|
3597
3615
|
const R = document.createElement("img");
|
|
3598
|
-
R.className = "gengage-chat-product-details-img", de(R, "src",
|
|
3599
|
-
const
|
|
3600
|
-
|
|
3601
|
-
const
|
|
3602
|
-
let
|
|
3603
|
-
const
|
|
3616
|
+
R.className = "gengage-chat-product-details-img", de(R, "src", d[0]), R.alt = r ?? "Product image", xe(R), C.appendChild(R);
|
|
3617
|
+
const D = document.createElement("div");
|
|
3618
|
+
D.className = "gengage-chat-product-gallery-thumbs";
|
|
3619
|
+
const z = 6;
|
|
3620
|
+
let k = null, O = 0;
|
|
3621
|
+
const B = e.i18n, q = B?.galleryPrevAriaLabel ?? "Previous image", U = B?.galleryNextAriaLabel ?? "Next image", ne = (I) => I === "prev" ? '<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="15 18 9 12 15 6"/></svg>' : '<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="9 18 15 12 9 6"/></svg>', W = document.createElement("button");
|
|
3604
3622
|
W.type = "button", W.className = "gengage-chat-product-gallery-nav gengage-chat-product-gallery-nav--prev gds-btn gds-btn-ghost gds-icon-btn", W.setAttribute("aria-label", q), W.innerHTML = ne("prev");
|
|
3605
3623
|
const K = document.createElement("button");
|
|
3606
|
-
K.type = "button", K.className = "gengage-chat-product-gallery-nav gengage-chat-product-gallery-nav--next gds-btn gds-btn-ghost gds-icon-btn", K.setAttribute("aria-label",
|
|
3624
|
+
K.type = "button", K.className = "gengage-chat-product-gallery-nav gengage-chat-product-gallery-nav--next gds-btn gds-btn-ghost gds-icon-btn", K.setAttribute("aria-label", U), K.innerHTML = ne("next");
|
|
3607
3625
|
const f = () => {
|
|
3608
|
-
W.disabled =
|
|
3626
|
+
W.disabled = O <= 0, K.disabled = O >= d.length - 1;
|
|
3609
3627
|
}, S = (I) => {
|
|
3610
|
-
if (I < 0 || I >=
|
|
3611
|
-
const j =
|
|
3628
|
+
if (I < 0 || I >= d.length || I === O) return;
|
|
3629
|
+
const j = d[I];
|
|
3612
3630
|
if (!j) return;
|
|
3613
3631
|
de(R, "src", j);
|
|
3614
|
-
const Q =
|
|
3615
|
-
|
|
3632
|
+
const Q = D.querySelectorAll(".gengage-chat-product-gallery-thumb");
|
|
3633
|
+
k && k.classList.remove("gengage-chat-product-gallery-thumb--active"), I < z && Q[I] ? (Q[I].classList.add("gengage-chat-product-gallery-thumb--active"), k = Q[I]) : k = null, O = I, f();
|
|
3616
3634
|
};
|
|
3617
|
-
for (let I = 0; I <
|
|
3618
|
-
const j =
|
|
3619
|
-
if (I >=
|
|
3635
|
+
for (let I = 0; I < d.length; I++) {
|
|
3636
|
+
const j = d[I];
|
|
3637
|
+
if (I >= z) break;
|
|
3620
3638
|
const Q = document.createElement("img");
|
|
3621
|
-
Q.className = "gengage-chat-product-gallery-thumb", I === 0 && (Q.classList.add("gengage-chat-product-gallery-thumb--active"),
|
|
3639
|
+
Q.className = "gengage-chat-product-gallery-thumb", I === 0 && (Q.classList.add("gengage-chat-product-gallery-thumb--active"), k = Q), de(Q, "src", j), Q.alt = `${r ?? "Product"} ${I + 1}`, Q.width = 48, Q.height = 48, xe(Q), Q.addEventListener("click", () => {
|
|
3622
3640
|
S(I);
|
|
3623
|
-
}),
|
|
3641
|
+
}), D.appendChild(Q);
|
|
3624
3642
|
}
|
|
3625
|
-
if (
|
|
3643
|
+
if (d.length > z) {
|
|
3626
3644
|
const I = document.createElement("span");
|
|
3627
|
-
I.className = "gengage-chat-product-gallery-thumb-more", I.textContent = `+${
|
|
3645
|
+
I.className = "gengage-chat-product-gallery-thumb-more", I.textContent = `+${d.length - z}`, D.appendChild(I);
|
|
3628
3646
|
}
|
|
3629
3647
|
W.addEventListener("click", (I) => {
|
|
3630
|
-
I.stopPropagation(), S(
|
|
3648
|
+
I.stopPropagation(), S(O - 1);
|
|
3631
3649
|
}), K.addEventListener("click", (I) => {
|
|
3632
|
-
I.stopPropagation(), S(
|
|
3650
|
+
I.stopPropagation(), S(O + 1);
|
|
3633
3651
|
}), f();
|
|
3634
3652
|
let P = 0;
|
|
3635
3653
|
const $ = 50;
|
|
@@ -3637,148 +3655,148 @@ function si(t, e) {
|
|
|
3637
3655
|
P = I.changedTouches[0].clientX;
|
|
3638
3656
|
}, { passive: !0 }), R.addEventListener("touchend", (I) => {
|
|
3639
3657
|
const j = I.changedTouches[0].clientX, Q = P - j;
|
|
3640
|
-
Math.abs(Q) < $ || S(Q > 0 ? Math.min(
|
|
3641
|
-
}),
|
|
3642
|
-
} else if (
|
|
3643
|
-
const
|
|
3644
|
-
|
|
3658
|
+
Math.abs(Q) < $ || S(Q > 0 ? Math.min(O + 1, d.length - 1) : Math.max(O - 1, 0));
|
|
3659
|
+
}), C.appendChild(W), C.appendChild(K), C.appendChild(D), a.appendChild(C);
|
|
3660
|
+
} else if (d.length === 1) {
|
|
3661
|
+
const C = document.createElement("div");
|
|
3662
|
+
C.className = "gengage-chat-product-details-media gengage-chat-product-details-img-wrap";
|
|
3645
3663
|
const R = document.createElement("img");
|
|
3646
|
-
R.className = "gengage-chat-product-details-img", R.loading = "lazy", de(R, "src",
|
|
3664
|
+
R.className = "gengage-chat-product-details-img", R.loading = "lazy", de(R, "src", d[0]), xe(R), R.alt = r ?? "Product image", C.appendChild(R), a.appendChild(C);
|
|
3647
3665
|
}
|
|
3648
3666
|
const y = document.createElement("div");
|
|
3649
3667
|
if (y.className = "gengage-chat-product-details-content", i && (!r || !r.toLowerCase().startsWith(i.toLowerCase()))) {
|
|
3650
|
-
const
|
|
3651
|
-
|
|
3668
|
+
const C = document.createElement("div");
|
|
3669
|
+
C.className = "gengage-chat-product-details-brand", C.textContent = i, y.appendChild(C);
|
|
3652
3670
|
}
|
|
3653
3671
|
if (r) {
|
|
3654
|
-
const
|
|
3655
|
-
|
|
3672
|
+
const C = document.createElement("h3");
|
|
3673
|
+
C.className = "gengage-chat-product-details-title", C.textContent = r, C.title = r, y.appendChild(C);
|
|
3656
3674
|
}
|
|
3657
3675
|
if (e.hideUserReviews !== !0 && typeof u == "number" && Number.isFinite(u) && u > 0) {
|
|
3658
|
-
const
|
|
3659
|
-
|
|
3676
|
+
const C = document.createElement(o ? "button" : "div");
|
|
3677
|
+
C.className = "gengage-chat-product-details-rating", o && (C.type = "button", C.classList.add("gengage-chat-product-details-rating--clickable"), C.setAttribute("aria-label", e.i18n?.groundingReviewCta ?? "Read Reviews"), C.addEventListener("click", () => {
|
|
3660
3678
|
e.onAction({
|
|
3661
3679
|
title: e.i18n?.customerReviewsTitle ?? "Customer Reviews",
|
|
3662
3680
|
type: "reviewSummary",
|
|
3663
3681
|
payload: { sku: o }
|
|
3664
3682
|
});
|
|
3665
|
-
})),
|
|
3683
|
+
})), C.appendChild(Jt(u));
|
|
3666
3684
|
const R = document.createElement("span");
|
|
3667
|
-
if (R.className = "gengage-chat-product-details-rating-value", R.textContent = ea(u).toFixed(1),
|
|
3668
|
-
const
|
|
3669
|
-
|
|
3685
|
+
if (R.className = "gengage-chat-product-details-rating-value", R.textContent = ea(u).toFixed(1), C.appendChild(R), typeof v == "number" && Number.isFinite(v)) {
|
|
3686
|
+
const D = document.createElement("span");
|
|
3687
|
+
D.className = "gengage-chat-product-details-review-count", D.textContent = ` (${v})`, C.appendChild(D);
|
|
3670
3688
|
}
|
|
3671
|
-
y.appendChild(
|
|
3689
|
+
y.appendChild(C);
|
|
3672
3690
|
}
|
|
3673
3691
|
{
|
|
3674
|
-
const
|
|
3692
|
+
const C = !!(g && m);
|
|
3675
3693
|
let R = y;
|
|
3676
|
-
if (
|
|
3677
|
-
const
|
|
3678
|
-
|
|
3679
|
-
}
|
|
3680
|
-
const
|
|
3681
|
-
if (
|
|
3682
|
-
const
|
|
3683
|
-
|
|
3684
|
-
if (
|
|
3685
|
-
if (c && parseFloat(c) > 0) Bt(
|
|
3694
|
+
if (g && !C) {
|
|
3695
|
+
const z = document.createElement("div");
|
|
3696
|
+
z.className = "gengage-chat-product-details-price-stack", z.appendChild(Qe(g)), y.appendChild(z), R = z;
|
|
3697
|
+
}
|
|
3698
|
+
const D = document.createElement("div");
|
|
3699
|
+
if (D.className = "gengage-chat-product-details-price", p === !0) {
|
|
3700
|
+
const z = document.createElement("span");
|
|
3701
|
+
z.className = "gengage-chat-price-skeleton", D.appendChild(z), R.appendChild(D), setTimeout(() => {
|
|
3702
|
+
if (z.parentElement)
|
|
3703
|
+
if (c && parseFloat(c) > 0) Bt(D, e, n, c, l, h, m);
|
|
3686
3704
|
else {
|
|
3687
|
-
const
|
|
3688
|
-
|
|
3705
|
+
const k = D.parentElement;
|
|
3706
|
+
D.remove(), k?.classList.contains("gengage-chat-product-details-price-stack") && k.remove();
|
|
3689
3707
|
}
|
|
3690
3708
|
}, 300);
|
|
3691
3709
|
} else if (c && parseFloat(c) > 0)
|
|
3692
|
-
Bt(
|
|
3693
|
-
else if (
|
|
3694
|
-
const
|
|
3695
|
-
|
|
3710
|
+
Bt(D, e, n, c, l, h, m), R.appendChild(D);
|
|
3711
|
+
else if (g) {
|
|
3712
|
+
const z = R;
|
|
3713
|
+
z.classList.contains("gengage-chat-product-details-price-stack") && z.remove();
|
|
3696
3714
|
}
|
|
3697
3715
|
}
|
|
3698
3716
|
if (e.hideStockStatus !== !0 && typeof x == "boolean") {
|
|
3699
|
-
const
|
|
3700
|
-
|
|
3717
|
+
const C = document.createElement("div");
|
|
3718
|
+
C.className = `gengage-chat-product-details-stock ${x ? "is-in-stock" : "is-out-of-stock"}`, C.textContent = x ? e.i18n?.inStockLabel ?? "In Stock" : e.i18n?.outOfStockLabel ?? "Out of Stock", y.appendChild(C);
|
|
3701
3719
|
}
|
|
3702
3720
|
const b = n.promotions;
|
|
3703
3721
|
if (b && b.length > 0) {
|
|
3704
|
-
const
|
|
3705
|
-
|
|
3722
|
+
const C = document.createElement("div");
|
|
3723
|
+
C.className = "gengage-chat-product-details-promos";
|
|
3706
3724
|
for (const R of b.slice(0, 3)) {
|
|
3707
3725
|
if (!R || /%(0(\.0+)?)\s/.test(R)) continue;
|
|
3708
|
-
const
|
|
3709
|
-
|
|
3726
|
+
const D = document.createElement("span");
|
|
3727
|
+
D.className = "gengage-chat-product-details-promo-badge", D.textContent = R, D.title = R, C.appendChild(D);
|
|
3710
3728
|
}
|
|
3711
|
-
|
|
3729
|
+
C.childElementCount > 0 && y.appendChild(C);
|
|
3712
3730
|
}
|
|
3713
3731
|
if (_.length > 0) {
|
|
3714
|
-
const
|
|
3715
|
-
|
|
3732
|
+
const C = document.createElement("dl");
|
|
3733
|
+
C.className = "gengage-chat-product-details-facts";
|
|
3716
3734
|
for (const R of _) {
|
|
3717
|
-
const
|
|
3718
|
-
|
|
3719
|
-
const
|
|
3720
|
-
|
|
3721
|
-
const
|
|
3722
|
-
|
|
3735
|
+
const D = document.createElement("div");
|
|
3736
|
+
D.className = "gengage-chat-product-details-fact";
|
|
3737
|
+
const z = document.createElement("dt");
|
|
3738
|
+
z.textContent = R.key;
|
|
3739
|
+
const k = document.createElement("dd");
|
|
3740
|
+
k.textContent = R.value, D.appendChild(z), D.appendChild(k), C.appendChild(D);
|
|
3723
3741
|
}
|
|
3724
|
-
y.appendChild(
|
|
3742
|
+
y.appendChild(C);
|
|
3725
3743
|
}
|
|
3726
3744
|
const A = ii(n);
|
|
3727
3745
|
if (A.length > 0) {
|
|
3728
|
-
const
|
|
3729
|
-
|
|
3746
|
+
const C = document.createElement("div");
|
|
3747
|
+
C.className = "gengage-chat-product-variants";
|
|
3730
3748
|
const R = document.createElement("div");
|
|
3731
|
-
R.className = "gengage-chat-product-variants-label", R.textContent = oi(A, e),
|
|
3732
|
-
const
|
|
3733
|
-
|
|
3734
|
-
for (const
|
|
3735
|
-
const
|
|
3736
|
-
if (!
|
|
3737
|
-
const
|
|
3738
|
-
|
|
3739
|
-
const q =
|
|
3740
|
-
|
|
3741
|
-
const
|
|
3742
|
-
|
|
3743
|
-
const ne = ei(
|
|
3749
|
+
R.className = "gengage-chat-product-variants-label", R.textContent = oi(A, e), C.appendChild(R);
|
|
3750
|
+
const D = document.createElement("div");
|
|
3751
|
+
D.className = "gengage-chat-product-variants-list";
|
|
3752
|
+
for (const z of A) {
|
|
3753
|
+
const k = ua(z), O = Ee(z, "sku");
|
|
3754
|
+
if (!k && !O) continue;
|
|
3755
|
+
const B = document.createElement("button");
|
|
3756
|
+
B.className = "gengage-chat-product-variant-btn gds-chip", B.type = "button";
|
|
3757
|
+
const q = k ?? O ?? "";
|
|
3758
|
+
B.title = q;
|
|
3759
|
+
const U = Ge(z, "in_stock", "inStock");
|
|
3760
|
+
O && o && O === o ? (B.classList.add("gengage-chat-product-variant-btn--active"), B.setAttribute("aria-pressed", "true")) : B.setAttribute("aria-pressed", "false"), U === !1 && (B.classList.add("gengage-chat-product-variant-btn--out"), B.disabled = !0);
|
|
3761
|
+
const ne = ei(z), W = Jr(z);
|
|
3744
3762
|
if (ne && he(ne)) {
|
|
3745
3763
|
const S = document.createElement("img");
|
|
3746
|
-
S.className = "gengage-chat-product-variant-swatch gengage-chat-product-variant-swatch--image", de(S, "src", ne), S.alt = "", S.setAttribute("aria-hidden", "true"), xe(S),
|
|
3764
|
+
S.className = "gengage-chat-product-variant-swatch gengage-chat-product-variant-swatch--image", de(S, "src", ne), S.alt = "", S.setAttribute("aria-hidden", "true"), xe(S), B.appendChild(S);
|
|
3747
3765
|
} else if (W) {
|
|
3748
3766
|
const S = document.createElement("span");
|
|
3749
|
-
S.className = "gengage-chat-product-variant-swatch", S.setAttribute("aria-hidden", "true"), S.style.backgroundColor = W,
|
|
3767
|
+
S.className = "gengage-chat-product-variant-swatch", S.setAttribute("aria-hidden", "true"), S.style.backgroundColor = W, B.appendChild(S);
|
|
3750
3768
|
}
|
|
3751
3769
|
const K = document.createElement("span");
|
|
3752
|
-
K.className = "gengage-chat-product-variant-label", K.textContent = q,
|
|
3753
|
-
const f = ti(
|
|
3770
|
+
K.className = "gengage-chat-product-variant-label", K.textContent = q, B.appendChild(K);
|
|
3771
|
+
const f = ti(z);
|
|
3754
3772
|
if (f && String(f) !== String(c)) {
|
|
3755
3773
|
const S = document.createElement("span");
|
|
3756
|
-
S.className = "gengage-chat-product-variant-price", S.textContent = ae(String(f), e.pricing),
|
|
3774
|
+
S.className = "gengage-chat-product-variant-price", S.textContent = ae(String(f), e.pricing), B.appendChild(S);
|
|
3757
3775
|
}
|
|
3758
|
-
if (
|
|
3759
|
-
const S = r ?? "", P = (typeof
|
|
3760
|
-
|
|
3776
|
+
if (O && O !== o) {
|
|
3777
|
+
const S = r ?? "", P = (typeof z.value == "string" ? z.value.trim() : "") || (typeof z.name == "string" ? z.name.trim() : "") || (typeof z.variant_name == "string" ? z.variant_name.trim() : "") || "", $ = S.length > 0 ? P.length > 0 && P !== S ? `${S} (${P})` : S : q;
|
|
3778
|
+
B.addEventListener("click", () => {
|
|
3761
3779
|
e.onAction({
|
|
3762
3780
|
title: $,
|
|
3763
3781
|
type: "launchVariant",
|
|
3764
|
-
payload: { sku:
|
|
3782
|
+
payload: { sku: O }
|
|
3765
3783
|
});
|
|
3766
3784
|
});
|
|
3767
3785
|
}
|
|
3768
|
-
|
|
3786
|
+
D.appendChild(B);
|
|
3769
3787
|
}
|
|
3770
|
-
|
|
3788
|
+
D.childElementCount > 0 && (C.appendChild(D), y.appendChild(C));
|
|
3771
3789
|
}
|
|
3772
|
-
const
|
|
3773
|
-
|
|
3774
|
-
const
|
|
3775
|
-
if (
|
|
3776
|
-
const
|
|
3777
|
-
|
|
3790
|
+
const L = document.createElement("div");
|
|
3791
|
+
L.className = "gengage-chat-product-details-actions";
|
|
3792
|
+
const E = t.props?.action;
|
|
3793
|
+
if (E) {
|
|
3794
|
+
const C = document.createElement("button");
|
|
3795
|
+
C.className = "gengage-chat-product-details-cta gds-btn gds-btn-primary", C.type = "button", C.textContent = E.title || e.i18n?.productCtaLabel || "View", C.addEventListener("click", () => e.onAction(E)), L.appendChild(C);
|
|
3778
3796
|
}
|
|
3779
3797
|
if (s && o && x !== !1) {
|
|
3780
|
-
const
|
|
3781
|
-
|
|
3798
|
+
const C = document.createElement("button");
|
|
3799
|
+
C.className = "gengage-chat-product-details-atc gds-btn gds-btn-primary", C.type = "button", C.textContent = e.i18n?.addToCartButton ?? "Add to Cart", C.addEventListener("click", () => {
|
|
3782
3800
|
e.onAction({
|
|
3783
3801
|
title: e.i18n?.addToCartButton ?? "Add to Cart",
|
|
3784
3802
|
type: "addToCart",
|
|
@@ -3788,46 +3806,46 @@ function si(t, e) {
|
|
|
3788
3806
|
quantity: 1
|
|
3789
3807
|
}
|
|
3790
3808
|
});
|
|
3791
|
-
}),
|
|
3809
|
+
}), L.appendChild(C);
|
|
3792
3810
|
}
|
|
3793
|
-
const
|
|
3794
|
-
if (!
|
|
3795
|
-
const
|
|
3796
|
-
|
|
3811
|
+
const T = be(n, "url");
|
|
3812
|
+
if (!E && T && he(T)) {
|
|
3813
|
+
const C = document.createElement("a");
|
|
3814
|
+
C.className = "gengage-chat-product-details-cta gds-btn gds-btn-secondary", de(C, "href", T), de(C, "target", "_blank"), de(C, "rel", "noopener noreferrer"), C.textContent = e.i18n?.viewOnSiteLabel ?? e.i18n?.productCtaLabel ?? "View on Site", C.addEventListener("click", (R) => {
|
|
3797
3815
|
e.onProductClick && o && (R.preventDefault(), e.onProductClick({
|
|
3798
3816
|
sku: o,
|
|
3799
|
-
url:
|
|
3817
|
+
url: T,
|
|
3800
3818
|
...r ? { name: r } : {}
|
|
3801
3819
|
}));
|
|
3802
|
-
}),
|
|
3803
|
-
}
|
|
3804
|
-
const
|
|
3805
|
-
if (
|
|
3806
|
-
let
|
|
3807
|
-
const
|
|
3808
|
-
|
|
3809
|
-
},
|
|
3810
|
-
const W = document.createElementNS(
|
|
3811
|
-
W.setAttribute("x1",
|
|
3820
|
+
}), L.appendChild(C);
|
|
3821
|
+
}
|
|
3822
|
+
const N = T;
|
|
3823
|
+
if (N && he(N)) {
|
|
3824
|
+
let k = function(B, q) {
|
|
3825
|
+
const U = document.createElementNS(D, "circle");
|
|
3826
|
+
U.setAttribute("cx", B), U.setAttribute("cy", q), U.setAttribute("r", "3"), z.appendChild(U);
|
|
3827
|
+
}, O = function(B, q, U, ne) {
|
|
3828
|
+
const W = document.createElementNS(D, "line");
|
|
3829
|
+
W.setAttribute("x1", B), W.setAttribute("y1", q), W.setAttribute("x2", U), W.setAttribute("y2", ne), z.appendChild(W);
|
|
3812
3830
|
};
|
|
3813
|
-
const
|
|
3814
|
-
|
|
3831
|
+
const C = document.createElement("button");
|
|
3832
|
+
C.className = "gengage-chat-product-details-share gds-btn gds-btn-ghost gds-icon-btn", C.type = "button";
|
|
3815
3833
|
const R = e.i18n?.shareButton ?? "Share";
|
|
3816
|
-
|
|
3817
|
-
const
|
|
3818
|
-
|
|
3834
|
+
C.title = R, C.setAttribute("aria-label", R);
|
|
3835
|
+
const D = "http://www.w3.org/2000/svg", z = document.createElementNS(D, "svg");
|
|
3836
|
+
z.setAttribute("width", "18"), z.setAttribute("height", "18"), z.setAttribute("viewBox", "0 0 24 24"), z.setAttribute("fill", "none"), z.setAttribute("stroke", "currentColor"), z.setAttribute("stroke-width", "2"), z.setAttribute("stroke-linecap", "round"), z.setAttribute("stroke-linejoin", "round"), k("18", "5"), k("6", "12"), k("18", "19"), O("8.59", "13.51", "15.42", "17.49"), O("15.41", "6.51", "8.59", "10.49"), C.appendChild(z), C.addEventListener("click", async () => {
|
|
3819
3837
|
try {
|
|
3820
3838
|
navigator.share ? await navigator.share({
|
|
3821
3839
|
title: r ?? "",
|
|
3822
|
-
url:
|
|
3823
|
-
}) : navigator.clipboard && (await navigator.clipboard.writeText(
|
|
3840
|
+
url: N
|
|
3841
|
+
}) : navigator.clipboard && (await navigator.clipboard.writeText(N), C.classList.add("gengage-chat-product-details-share--copied"), setTimeout(() => C.classList.remove("gengage-chat-product-details-share--copied"), 1500));
|
|
3824
3842
|
} catch {
|
|
3825
3843
|
}
|
|
3826
|
-
}),
|
|
3844
|
+
}), L.appendChild(C);
|
|
3827
3845
|
}
|
|
3828
|
-
|
|
3829
|
-
const
|
|
3830
|
-
return (
|
|
3846
|
+
L.childElementCount > 0 && y.appendChild(L), a.appendChild(y);
|
|
3847
|
+
const F = Zr(n), X = Xr(n);
|
|
3848
|
+
return (F || X) && a.appendChild(gi(F, X, e)), a;
|
|
3831
3849
|
}
|
|
3832
3850
|
function ht(t) {
|
|
3833
3851
|
if (t.nodeType === Node.TEXT_NODE) return document.createTextNode(t.textContent ?? "");
|
|
@@ -3886,15 +3904,15 @@ function gi(t, e, a) {
|
|
|
3886
3904
|
c.className = "gengage-chat-product-detail-tab-panel", t && (c.style.display = "none");
|
|
3887
3905
|
const l = document.createElement("table");
|
|
3888
3906
|
l.className = "gengage-chat-product-specs-table";
|
|
3889
|
-
const
|
|
3890
|
-
key:
|
|
3907
|
+
const p = Array.isArray(e) ? e : Object.entries(e).map(([g, h]) => ({
|
|
3908
|
+
key: g,
|
|
3891
3909
|
value: h
|
|
3892
3910
|
}));
|
|
3893
|
-
for (const
|
|
3911
|
+
for (const g of p) {
|
|
3894
3912
|
const h = document.createElement("tr"), m = document.createElement("td");
|
|
3895
|
-
m.className = "gengage-chat-product-specs-key", m.textContent =
|
|
3913
|
+
m.className = "gengage-chat-product-specs-key", m.textContent = g.key;
|
|
3896
3914
|
const x = document.createElement("td");
|
|
3897
|
-
x.className = "gengage-chat-product-specs-value", x.textContent =
|
|
3915
|
+
x.className = "gengage-chat-product-specs-value", x.textContent = g.value, h.appendChild(m), h.appendChild(x), l.appendChild(h);
|
|
3898
3916
|
}
|
|
3899
3917
|
c.appendChild(l), i.push(c);
|
|
3900
3918
|
}
|
|
@@ -3903,8 +3921,8 @@ function gi(t, e, a) {
|
|
|
3903
3921
|
s.addEventListener("click", () => {
|
|
3904
3922
|
o.forEach((l) => {
|
|
3905
3923
|
l.classList.remove("gengage-chat-product-detail-tab--active", "is-active"), l.setAttribute("aria-selected", "false");
|
|
3906
|
-
}), s.classList.add("gengage-chat-product-detail-tab--active", "is-active"), s.setAttribute("aria-selected", "true"), i.forEach((l,
|
|
3907
|
-
l.style.display =
|
|
3924
|
+
}), s.classList.add("gengage-chat-product-detail-tab--active", "is-active"), s.setAttribute("aria-selected", "true"), i.forEach((l, p) => {
|
|
3925
|
+
l.style.display = p === c ? "" : "none";
|
|
3908
3926
|
});
|
|
3909
3927
|
});
|
|
3910
3928
|
}), n.appendChild(r);
|
|
@@ -3963,10 +3981,10 @@ function mi(t, e, a, n) {
|
|
|
3963
3981
|
r.className = "gengage-chat-product-grid-wrapper";
|
|
3964
3982
|
const i = ft(t), o = i.isConsulting, s = t.children ?? [], c = document.createElement("div");
|
|
3965
3983
|
c.className = "gengage-chat-product-grid";
|
|
3966
|
-
const l = Array.isArray(t.props?.productSections) ? t.props.productSections.map((
|
|
3967
|
-
title: typeof
|
|
3968
|
-
children: Array.isArray(
|
|
3969
|
-
})).filter((
|
|
3984
|
+
const l = Array.isArray(t.props?.productSections) ? t.props.productSections.map((d) => ({
|
|
3985
|
+
title: typeof d.title == "string" ? d.title : "",
|
|
3986
|
+
children: Array.isArray(d.children) ? d.children.filter((_) => typeof _ == "string" && !!e.elements[_]) : []
|
|
3987
|
+
})).filter((d) => d.children.length > 0) : [], p = l.length > 1, g = !p && l.length === 1 && l[0]?.title ? l[0].title : "", h = n?.panelProductListHeading ?? (g || void 0), m = !o && !p && s.length > 1 && n?.onSortChange, x = (d) => {
|
|
3970
3988
|
if (!n?.onToggleComparisonSku) return;
|
|
3971
3989
|
const _ = document.createElement("button");
|
|
3972
3990
|
_.className = "gengage-chat-comparison-toggle-btn gds-btn gds-btn-ghost", _.type = "button", n.comparisonSelectMode && _.classList.add("gengage-chat-comparison-toggle-btn--active"), n.isStreaming && _.classList.add("gengage-chat-comparison-toggle-btn--hidden");
|
|
@@ -3977,10 +3995,10 @@ function mi(t, e, a, n) {
|
|
|
3977
3995
|
const A = n.i18n?.compareSelected ?? "Compare";
|
|
3978
3996
|
b.textContent = A, _.setAttribute("aria-label", A), _.title = A, _.appendChild(y), _.appendChild(b), _.addEventListener("click", () => {
|
|
3979
3997
|
n.onToggleComparisonSku?.("");
|
|
3980
|
-
}),
|
|
3981
|
-
}, v = (
|
|
3998
|
+
}), d.appendChild(_);
|
|
3999
|
+
}, v = (d, _ = s.length) => {
|
|
3982
4000
|
const y = t.props?.endOfList;
|
|
3983
|
-
if (o || !(
|
|
4001
|
+
if (o || !(p ? y === !1 : y !== !0) || _ === 0) return;
|
|
3984
4002
|
const b = n?.i18n?.viewMoreLabel ?? "Show More", A = document.createElement("button");
|
|
3985
4003
|
A.className = "gengage-chat-product-grid-view-more", A.type = "button", A.textContent = b, A.addEventListener("click", () => {
|
|
3986
4004
|
n?.onAction({
|
|
@@ -3988,14 +4006,14 @@ function mi(t, e, a, n) {
|
|
|
3988
4006
|
type: "moreProductList",
|
|
3989
4007
|
payload: {}
|
|
3990
4008
|
});
|
|
3991
|
-
}),
|
|
4009
|
+
}), d.appendChild(A);
|
|
3992
4010
|
}, u = () => {
|
|
3993
|
-
const
|
|
3994
|
-
n?.comparisonSelectMode && n.comparisonSelectedSkus && !
|
|
4011
|
+
const d = n?.isMobile ?? Ve();
|
|
4012
|
+
n?.comparisonSelectMode && n.comparisonSelectedSkus && !d && r.appendChild(la(n.comparisonSelectedSkus, n));
|
|
3995
4013
|
};
|
|
3996
4014
|
if (m) {
|
|
3997
|
-
const
|
|
3998
|
-
|
|
4015
|
+
const d = document.createElement("div");
|
|
4016
|
+
d.className = "gengage-chat-product-sort-toolbar", d.setAttribute("role", "toolbar"), d.setAttribute("aria-label", n.i18n?.sortToolbarAriaLabel ?? "Sort products");
|
|
3999
4017
|
let _ = n.productSort ?? { type: "related" };
|
|
4000
4018
|
const y = [
|
|
4001
4019
|
{
|
|
@@ -4023,106 +4041,106 @@ function mi(t, e, a, n) {
|
|
|
4023
4041
|
b.className = "gengage-chat-product-sort-dropdown";
|
|
4024
4042
|
const A = document.createElement("button");
|
|
4025
4043
|
A.type = "button", A.className = "gengage-chat-product-sort-trigger gds-btn gds-btn-ghost", A.setAttribute("aria-haspopup", "listbox"), A.setAttribute("aria-expanded", "false");
|
|
4026
|
-
const
|
|
4027
|
-
|
|
4028
|
-
const
|
|
4029
|
-
|
|
4030
|
-
const
|
|
4031
|
-
const q = y.find((
|
|
4032
|
-
|
|
4044
|
+
const L = n.i18n?.sortToolbarAriaLabel ?? "Sort products", E = document.createElement("span");
|
|
4045
|
+
E.className = "gengage-chat-product-sort-trigger-icon";
|
|
4046
|
+
const T = document.createElement("span");
|
|
4047
|
+
T.className = "gengage-chat-product-sort-trigger-label";
|
|
4048
|
+
const N = (B) => {
|
|
4049
|
+
const q = y.find((U) => Ft(U.sortState, B)) ?? y[0];
|
|
4050
|
+
T.textContent = q.label, E.innerHTML = Ht(q.icon), b.dataset.sortIcon = q.icon, A.setAttribute("aria-label", `${L}: ${q.label}`), A.title = q.label;
|
|
4033
4051
|
};
|
|
4034
|
-
|
|
4035
|
-
const
|
|
4036
|
-
|
|
4052
|
+
N(_);
|
|
4053
|
+
const F = document.createElement("span");
|
|
4054
|
+
F.className = "gengage-chat-product-sort-trigger-chevron", F.innerHTML = di(), A.appendChild(E), A.appendChild(T), A.appendChild(F);
|
|
4037
4055
|
const X = document.createElement("div");
|
|
4038
|
-
X.className = "gengage-chat-product-sort-menu gds-menu", X.hidden = !0, X.setAttribute("role", "listbox"), X.setAttribute("aria-label",
|
|
4039
|
-
const
|
|
4056
|
+
X.className = "gengage-chat-product-sort-menu gds-menu", X.hidden = !0, X.setAttribute("role", "listbox"), X.setAttribute("aria-label", L);
|
|
4057
|
+
const C = d.ownerDocument;
|
|
4040
4058
|
let R = null;
|
|
4041
|
-
const
|
|
4059
|
+
const D = () => {
|
|
4042
4060
|
X.hidden = !0, b.classList.remove("gengage-chat-product-sort-dropdown--open"), A.setAttribute("aria-expanded", "false"), R?.abort(), R = null;
|
|
4043
|
-
},
|
|
4044
|
-
b.classList.contains("gengage-chat-product-sort-dropdown--open") && (b.contains(
|
|
4045
|
-
},
|
|
4046
|
-
|
|
4047
|
-
},
|
|
4061
|
+
}, z = (B) => {
|
|
4062
|
+
b.classList.contains("gengage-chat-product-sort-dropdown--open") && (b.contains(B.target) || D());
|
|
4063
|
+
}, k = (B) => {
|
|
4064
|
+
B.key === "Escape" && (B.preventDefault(), D());
|
|
4065
|
+
}, O = () => {
|
|
4048
4066
|
X.hidden = !1, b.classList.add("gengage-chat-product-sort-dropdown--open"), A.setAttribute("aria-expanded", "true"), R = new AbortController();
|
|
4049
|
-
const { signal:
|
|
4050
|
-
|
|
4067
|
+
const { signal: B } = R;
|
|
4068
|
+
C.addEventListener("click", z, { signal: B }), C.addEventListener("keydown", k, {
|
|
4051
4069
|
capture: !0,
|
|
4052
|
-
signal:
|
|
4070
|
+
signal: B
|
|
4053
4071
|
});
|
|
4054
4072
|
};
|
|
4055
|
-
A.addEventListener("click", (
|
|
4056
|
-
|
|
4073
|
+
A.addEventListener("click", (B) => {
|
|
4074
|
+
B.stopPropagation(), b.classList.contains("gengage-chat-product-sort-dropdown--open") ? D() : O();
|
|
4057
4075
|
});
|
|
4058
|
-
for (const
|
|
4076
|
+
for (const B of y) {
|
|
4059
4077
|
const q = document.createElement("button");
|
|
4060
4078
|
q.type = "button", q.className = "gengage-chat-product-sort-option gds-menu-option", q.setAttribute("role", "option");
|
|
4061
|
-
const
|
|
4062
|
-
q.setAttribute("aria-selected",
|
|
4063
|
-
const ne =
|
|
4079
|
+
const U = Ft(_, B.sortState);
|
|
4080
|
+
q.setAttribute("aria-selected", U ? "true" : "false"), U && q.classList.add("gengage-chat-product-sort-option--active", "gds-menu-option-active");
|
|
4081
|
+
const ne = B.sortState.type === "related" ? "related" : `price-${B.sortState.direction ?? ""}`;
|
|
4064
4082
|
q.dataset.sortKey = ne;
|
|
4065
4083
|
const W = document.createElement("span");
|
|
4066
|
-
W.className = "gengage-chat-product-sort-option-icon", W.innerHTML = Ht(
|
|
4084
|
+
W.className = "gengage-chat-product-sort-option-icon", W.innerHTML = Ht(B.icon);
|
|
4067
4085
|
const K = document.createElement("span");
|
|
4068
|
-
K.className = "gengage-chat-product-sort-option-label", K.textContent =
|
|
4086
|
+
K.className = "gengage-chat-product-sort-option-label", K.textContent = B.label;
|
|
4069
4087
|
const f = document.createElement("span");
|
|
4070
|
-
f.className = "gengage-chat-product-sort-option-check", f.innerHTML = pi(), f.setAttribute("aria-hidden", "true"),
|
|
4071
|
-
_ =
|
|
4088
|
+
f.className = "gengage-chat-product-sort-option-check", f.innerHTML = pi(), f.setAttribute("aria-hidden", "true"), U || f.classList.add("gengage-chat-product-sort-option-check--hidden"), q.appendChild(W), q.appendChild(K), q.appendChild(f), q.addEventListener("click", () => {
|
|
4089
|
+
_ = B.sortState, n.onSortChange?.(B.sortState), ui(c, s, e, B.sortState), X.querySelectorAll(".gengage-chat-product-sort-option").forEach((S) => {
|
|
4072
4090
|
const P = S, $ = P.dataset.sortKey === ne;
|
|
4073
4091
|
P.classList.toggle("gengage-chat-product-sort-option--active", $), P.classList.toggle("gds-menu-option-active", $), P.setAttribute("aria-selected", $ ? "true" : "false"), P.querySelector(".gengage-chat-product-sort-option-check")?.classList.toggle("gengage-chat-product-sort-option-check--hidden", !$);
|
|
4074
|
-
}),
|
|
4092
|
+
}), N(B.sortState), D();
|
|
4075
4093
|
}), X.appendChild(q);
|
|
4076
4094
|
}
|
|
4077
|
-
if (b.appendChild(A), b.appendChild(X),
|
|
4078
|
-
|
|
4079
|
-
const
|
|
4080
|
-
|
|
4095
|
+
if (b.appendChild(A), b.appendChild(X), d.appendChild(b), x(d), h) {
|
|
4096
|
+
d.classList.add("gengage-chat-product-sort-toolbar--inline");
|
|
4097
|
+
const B = document.createElement("div");
|
|
4098
|
+
B.className = "gengage-chat-product-grid-head";
|
|
4081
4099
|
const q = document.createElement("span");
|
|
4082
|
-
q.className = "gengage-chat-product-grid-head-title", q.textContent = h,
|
|
4083
|
-
const
|
|
4084
|
-
|
|
4085
|
-
} else r.appendChild(
|
|
4100
|
+
q.className = "gengage-chat-product-grid-head-title", q.textContent = h, B.appendChild(q);
|
|
4101
|
+
const U = document.createElement("div");
|
|
4102
|
+
U.className = "gengage-chat-product-grid-head-actions", U.appendChild(d), B.appendChild(U), r.appendChild(B);
|
|
4103
|
+
} else r.appendChild(d);
|
|
4086
4104
|
} else if (h) {
|
|
4087
|
-
const
|
|
4088
|
-
|
|
4105
|
+
const d = document.createElement("div");
|
|
4106
|
+
d.className = "gengage-chat-product-grid-head";
|
|
4089
4107
|
const _ = document.createElement("span");
|
|
4090
|
-
_.className = "gengage-chat-product-grid-head-title", _.textContent = h,
|
|
4108
|
+
_.className = "gengage-chat-product-grid-head-title", _.textContent = h, d.appendChild(_), r.appendChild(d);
|
|
4091
4109
|
}
|
|
4092
|
-
if (
|
|
4110
|
+
if (p && !o) {
|
|
4093
4111
|
if (r.classList.add("gengage-chat-product-grid-wrapper--grouped"), n?.onToggleComparisonSku) {
|
|
4094
4112
|
const b = document.createElement("div");
|
|
4095
4113
|
b.className = "gengage-chat-product-sort-toolbar gengage-chat-product-sort-toolbar--compare-only", b.setAttribute("role", "toolbar"), b.setAttribute("aria-label", n.i18n?.compareSelected ?? "Compare"), x(b), r.appendChild(b);
|
|
4096
4114
|
}
|
|
4097
|
-
const
|
|
4098
|
-
|
|
4115
|
+
const d = document.createElement("div");
|
|
4116
|
+
d.className = "gengage-chat-product-grid-sections", d.setAttribute("role", "list");
|
|
4099
4117
|
const _ = t.props?.rankingState;
|
|
4100
4118
|
let y = 0;
|
|
4101
4119
|
for (const b of l) {
|
|
4102
4120
|
y += b.children.length;
|
|
4103
|
-
const A = fi(b.children.length, n),
|
|
4104
|
-
|
|
4105
|
-
const
|
|
4106
|
-
if (
|
|
4107
|
-
const
|
|
4108
|
-
|
|
4121
|
+
const A = fi(b.children.length, n), L = document.createElement("section");
|
|
4122
|
+
L.className = "gengage-chat-product-grid-section", L.setAttribute("role", "listitem");
|
|
4123
|
+
const E = document.createElement("div");
|
|
4124
|
+
if (E.className = "gengage-chat-product-grid-section-head", b.title) {
|
|
4125
|
+
const F = document.createElement("h3");
|
|
4126
|
+
F.className = "gengage-chat-product-grid-section-title", F.textContent = b.title, E.appendChild(F);
|
|
4109
4127
|
}
|
|
4110
|
-
const
|
|
4111
|
-
|
|
4112
|
-
const
|
|
4113
|
-
|
|
4114
|
-
for (const
|
|
4115
|
-
const X = a(
|
|
4116
|
-
X && (X.dataset.elementId =
|
|
4128
|
+
const T = document.createElement("span");
|
|
4129
|
+
T.className = "gengage-chat-product-grid-section-count", T.textContent = A, E.appendChild(T), L.appendChild(E);
|
|
4130
|
+
const N = document.createElement("div");
|
|
4131
|
+
N.className = "gengage-chat-product-grid gengage-chat-product-grid--section";
|
|
4132
|
+
for (const F of b.children) {
|
|
4133
|
+
const X = a(F);
|
|
4134
|
+
X && (X.dataset.elementId = F, N.appendChild(X));
|
|
4117
4135
|
}
|
|
4118
|
-
(n?.isMobile ?? Ve()) &&
|
|
4136
|
+
(n?.isMobile ?? Ve()) && N.classList.add("gengage-chat-product-grid--mobile"), _ === "pending" && (N.classList.add("gengage-chat-product-grid--pending"), N.inert = !0, N.setAttribute("aria-busy", "true")), L.appendChild(N), d.appendChild(L);
|
|
4119
4137
|
}
|
|
4120
|
-
return r.appendChild(
|
|
4138
|
+
return r.appendChild(d), v(r, y), u(), r;
|
|
4121
4139
|
}
|
|
4122
4140
|
if (o) Ci(r, c, i, n);
|
|
4123
4141
|
else {
|
|
4124
|
-
const
|
|
4125
|
-
for (const _ of
|
|
4142
|
+
const d = fa(s, e, n?.productSort);
|
|
4143
|
+
for (const _ of d) {
|
|
4126
4144
|
if (!e.elements[_]) continue;
|
|
4127
4145
|
const y = a(_);
|
|
4128
4146
|
y && (y.dataset.elementId = _, c.appendChild(y));
|
|
@@ -4145,7 +4163,7 @@ function bi(t, e, a) {
|
|
|
4145
4163
|
return n(a.find((r) => r.sku === t));
|
|
4146
4164
|
}
|
|
4147
4165
|
function vi(t, e) {
|
|
4148
|
-
const a = t.props ?? {}, n = a.keyDifferencesHtml, r = a.recommended, i = a.products ?? [], o = a.attributes ?? [], s = a.highlights ?? [], c = a.specialCases, l = a.recommendedText,
|
|
4166
|
+
const a = t.props ?? {}, n = a.keyDifferencesHtml, r = a.recommended, i = a.products ?? [], o = a.attributes ?? [], s = a.highlights ?? [], c = a.specialCases, l = a.recommendedText, p = a.winnerHits, g = a.productActions;
|
|
4149
4167
|
if (!r) return document.createElement("div");
|
|
4150
4168
|
const h = {
|
|
4151
4169
|
recommended: r,
|
|
@@ -4164,7 +4182,7 @@ function vi(t, e) {
|
|
|
4164
4182
|
},
|
|
4165
4183
|
pricing: e.pricing
|
|
4166
4184
|
};
|
|
4167
|
-
l !== void 0 && (h.recommendedText = l),
|
|
4185
|
+
l !== void 0 && (h.recommendedText = l), p !== void 0 && (h.winnerHits = p), g !== void 0 && (h.productActions = g), n !== void 0 && (h.keyDifferencesHtml = n), e.i18n && (h.i18n = {
|
|
4168
4186
|
comparisonHeading: e.i18n.panelTitleComparisonResults,
|
|
4169
4187
|
recommendedChoiceLabel: e.i18n.recommendedChoiceLabel,
|
|
4170
4188
|
highlightsLabel: e.i18n.highlightsLabel,
|
|
@@ -4227,9 +4245,9 @@ function Dt(t, e, a, n) {
|
|
|
4227
4245
|
if (c.className = "gengage-chat-consulting-loading-panel-copy", c.textContent = a === "loading" ? i.consultingStyleLoadingDescription : i.consultingStyleUnavailableDescription, o.appendChild(c), a === "loading") {
|
|
4228
4246
|
const l = document.createElement("div");
|
|
4229
4247
|
l.className = "gengage-chat-consulting-loading-grid";
|
|
4230
|
-
for (let
|
|
4231
|
-
const
|
|
4232
|
-
|
|
4248
|
+
for (let p = 0; p < 3; p += 1) {
|
|
4249
|
+
const g = document.createElement("div");
|
|
4250
|
+
g.className = "gengage-chat-consulting-loading-card", l.appendChild(g);
|
|
4233
4251
|
}
|
|
4234
4252
|
o.appendChild(l);
|
|
4235
4253
|
}
|
|
@@ -4256,64 +4274,64 @@ function vt(t, e) {
|
|
|
4256
4274
|
const c = Array.isArray(a.product_list) ? a.product_list : [], l = Array.isArray(a.recommendation_groups) ? a.recommendation_groups : [];
|
|
4257
4275
|
if (l.length > 0) {
|
|
4258
4276
|
n.classList.add("gengage-chat-product-grid--consulting-groups");
|
|
4259
|
-
const
|
|
4277
|
+
const p = /* @__PURE__ */ new Map();
|
|
4260
4278
|
for (const u of c) {
|
|
4261
|
-
const
|
|
4262
|
-
|
|
4279
|
+
const d = typeof u?.sku == "string" ? u.sku : void 0;
|
|
4280
|
+
d && p.set(d, u);
|
|
4263
4281
|
}
|
|
4264
|
-
const
|
|
4265
|
-
if (
|
|
4282
|
+
const g = (u, d, _, y) => {
|
|
4283
|
+
if (d.length === 0) return;
|
|
4266
4284
|
const b = document.createElement("section");
|
|
4267
4285
|
b.className = "gengage-chat-consulting-group";
|
|
4268
4286
|
const A = document.createElement("div");
|
|
4269
4287
|
A.className = "gengage-chat-consulting-group-header";
|
|
4270
|
-
const
|
|
4271
|
-
if (
|
|
4272
|
-
const
|
|
4273
|
-
|
|
4288
|
+
const L = document.createElement("h4");
|
|
4289
|
+
if (L.className = "gengage-chat-consulting-group-label", L.textContent = `${u} (${d.length})`, A.appendChild(L), typeof y == "string" && y.trim().length > 0) {
|
|
4290
|
+
const T = document.createElement("p");
|
|
4291
|
+
T.className = "gengage-chat-consulting-group-reason", T.textContent = y, A.appendChild(T);
|
|
4274
4292
|
}
|
|
4275
4293
|
b.appendChild(A);
|
|
4276
|
-
const
|
|
4277
|
-
|
|
4278
|
-
for (const
|
|
4279
|
-
const
|
|
4294
|
+
const E = document.createElement("div");
|
|
4295
|
+
E.className = "gengage-chat-product-grid gengage-chat-consulting-group-grid", _ && E.classList.add("gengage-chat-consulting-group-grid--single-group"), E.style.setProperty("--consulting-group-columns", String(Math.max(1, Math.min(4, d.length))));
|
|
4296
|
+
for (const T of d) {
|
|
4297
|
+
const N = pt({
|
|
4280
4298
|
type: "ProductCard",
|
|
4281
|
-
props: { product:
|
|
4299
|
+
props: { product: T }
|
|
4282
4300
|
}, r ?? { onAction: () => {
|
|
4283
4301
|
} });
|
|
4284
|
-
|
|
4302
|
+
E.appendChild(N);
|
|
4285
4303
|
}
|
|
4286
|
-
b.appendChild(
|
|
4304
|
+
b.appendChild(E), n.appendChild(b);
|
|
4287
4305
|
}, h = /* @__PURE__ */ new Set(), m = [];
|
|
4288
4306
|
for (const u of l) {
|
|
4289
|
-
const
|
|
4290
|
-
if (
|
|
4307
|
+
const d = (Array.isArray(u.skus) ? u.skus.filter((b) => typeof b == "string" && b.trim().length > 0) : []).map((b) => (h.add(b), p.get(b))).filter((b) => !!b);
|
|
4308
|
+
if (d.length === 0) continue;
|
|
4291
4309
|
const _ = typeof u.label == "string" && u.label.trim().length > 0 ? u.label : i.consultingFallbackGroupLabel, y = typeof u.reason == "string" ? u.reason : void 0;
|
|
4292
4310
|
m.push({
|
|
4293
4311
|
labelText: _,
|
|
4294
|
-
products:
|
|
4312
|
+
products: d,
|
|
4295
4313
|
...y !== void 0 ? { reasonText: y } : {}
|
|
4296
4314
|
});
|
|
4297
4315
|
}
|
|
4298
4316
|
const x = c.filter((u) => {
|
|
4299
|
-
const
|
|
4300
|
-
return
|
|
4317
|
+
const d = typeof u?.sku == "string" ? u.sku : "";
|
|
4318
|
+
return d.length > 0 && !h.has(d);
|
|
4301
4319
|
});
|
|
4302
4320
|
x.length > 0 && m.push({
|
|
4303
4321
|
labelText: i.consultingOtherCompatibleProductsLabel,
|
|
4304
4322
|
products: x
|
|
4305
4323
|
});
|
|
4306
4324
|
const v = m.length === 1;
|
|
4307
|
-
for (const u of m)
|
|
4325
|
+
for (const u of m) g(u.labelText, u.products, v, u.reasonText);
|
|
4308
4326
|
return;
|
|
4309
4327
|
}
|
|
4310
|
-
for (const
|
|
4311
|
-
const
|
|
4328
|
+
for (const p of c) {
|
|
4329
|
+
const g = pt({
|
|
4312
4330
|
type: "ProductCard",
|
|
4313
|
-
props: { product:
|
|
4331
|
+
props: { product: p }
|
|
4314
4332
|
}, r ?? { onAction: () => {
|
|
4315
4333
|
} });
|
|
4316
|
-
n.appendChild(
|
|
4334
|
+
n.appendChild(g);
|
|
4317
4335
|
}
|
|
4318
4336
|
}
|
|
4319
4337
|
function mt(t, e, a, n) {
|
|
@@ -4323,13 +4341,13 @@ function mt(t, e, a, n) {
|
|
|
4323
4341
|
s ? s.innerHTML = "" : (s = document.createElement("div"), s.className = "gengage-chat-consulting-style-media", t.appendChild(s));
|
|
4324
4342
|
const c = yi(e.image_url);
|
|
4325
4343
|
if (c && he(c)) {
|
|
4326
|
-
const
|
|
4327
|
-
|
|
4344
|
+
const p = document.createElement("img");
|
|
4345
|
+
p.className = "gengage-chat-consulting-style-image", p.draggable = !1, de(p, "src", c), p.alt = We(e, a + 1, n), p.loading = "lazy", xe(p), s.appendChild(p);
|
|
4328
4346
|
}
|
|
4329
4347
|
const l = document.createElement("span");
|
|
4330
4348
|
if (l.className = "gengage-chat-consulting-style-caption", l.textContent = We(e, a + 1, n), s.appendChild(l), r === "loading" || r !== "ready") {
|
|
4331
|
-
const
|
|
4332
|
-
|
|
4349
|
+
const p = document.createElement("span");
|
|
4350
|
+
p.className = "gengage-chat-consulting-style-status", p.textContent = r === "loading" ? i : o, s.appendChild(p);
|
|
4333
4351
|
}
|
|
4334
4352
|
}
|
|
4335
4353
|
function xa(t, e, a, n) {
|
|
@@ -4354,9 +4372,9 @@ function wi(t, e, a, n) {
|
|
|
4354
4372
|
const c = document.createElement("div");
|
|
4355
4373
|
c.className = "gengage-chat-consulting-style-picker-title", c.textContent = va(r).replace("{count}", String(a.length)), o.appendChild(c);
|
|
4356
4374
|
const l = document.createElement("div");
|
|
4357
|
-
l.className = "gengage-chat-consulting-style-grid", o.appendChild(l), a.forEach((
|
|
4375
|
+
l.className = "gengage-chat-consulting-style-grid", o.appendChild(l), a.forEach((p, g) => {
|
|
4358
4376
|
const h = document.createElement("button");
|
|
4359
|
-
h.type = "button", h.className = "gengage-chat-consulting-style-btn gds-card",
|
|
4377
|
+
h.type = "button", h.className = "gengage-chat-consulting-style-btn gds-card", g === i && h.classList.add("gengage-chat-consulting-style-btn--active"), mt(h, p, g, r), xa(h, o, l, g), l.appendChild(h);
|
|
4360
4378
|
}), t.appendChild(o), vt(s, i);
|
|
4361
4379
|
}
|
|
4362
4380
|
function _i(t, e, a) {
|
|
@@ -4381,14 +4399,14 @@ function _i(t, e, a) {
|
|
|
4381
4399
|
const c = n.querySelector(".gengage-chat-consulting-style-picker-title");
|
|
4382
4400
|
c && (c.textContent = va(o).replace("{count}", String(e.length)));
|
|
4383
4401
|
const l = s;
|
|
4384
|
-
let
|
|
4385
|
-
|
|
4386
|
-
const
|
|
4387
|
-
if (
|
|
4402
|
+
let p = l.selectedIndex;
|
|
4403
|
+
p >= e.length && (p = Math.max(0, e.length - 1)), p < 0 && (p = 0), e.length > 0 && tt(e[p] ?? {}) === "loading" && (p = ut(e)), l.selectedIndex = p;
|
|
4404
|
+
const g = [...i.querySelectorAll(".gengage-chat-consulting-style-btn")];
|
|
4405
|
+
if (g.length === 0) return !1;
|
|
4388
4406
|
for (let h = 0; h < e.length; h += 1) {
|
|
4389
4407
|
const m = e[h];
|
|
4390
|
-
let x =
|
|
4391
|
-
x ? mt(x, m, h, o) : (x = document.createElement("button"), x.type = "button", x.className = "gengage-chat-consulting-style-btn gds-card", mt(x, m, h, o), xa(x, n, i, h), i.appendChild(x),
|
|
4408
|
+
let x = g[h];
|
|
4409
|
+
x ? mt(x, m, h, o) : (x = document.createElement("button"), x.type = "button", x.className = "gengage-chat-consulting-style-btn gds-card", mt(x, m, h, o), xa(x, n, i, h), i.appendChild(x), g[h] = x);
|
|
4392
4410
|
}
|
|
4393
4411
|
for (; i.querySelectorAll(".gengage-chat-consulting-style-btn").length > e.length; ) i.lastElementChild?.remove();
|
|
4394
4412
|
return i.querySelectorAll(".gengage-chat-consulting-style-btn").forEach((h, m) => {
|
|
@@ -4751,11 +4769,11 @@ function Ai() {
|
|
|
4751
4769
|
</div>`.trim();
|
|
4752
4770
|
}
|
|
4753
4771
|
function Ii(t, e, a) {
|
|
4754
|
-
const { primaryColor: n = "#6366f1", backgroundColor: r = "#ffffff", textColor: i = "#111827", placeholderColor: o = "#9ca3af", iconColor: s = "#6b7280", borderColor: c = "#e5e7eb", borderRadius: l = "999px", height:
|
|
4772
|
+
const { primaryColor: n = "#6366f1", backgroundColor: r = "#ffffff", textColor: i = "#111827", placeholderColor: o = "#9ca3af", iconColor: s = "#6b7280", borderColor: c = "#e5e7eb", borderRadius: l = "999px", height: p = "56px", maxWidth: g = "680px", fontFamily: h = "inherit", placeholders: m = [
|
|
4755
4773
|
"Ürün ara",
|
|
4756
4774
|
"Karşılaştır",
|
|
4757
4775
|
"Soru sor"
|
|
4758
|
-
], placeholderInterval: x = 2e3, voiceLang: v = "tr-TR", showBorderAnimation: u = !0, sendAriaLabel:
|
|
4776
|
+
], placeholderInterval: x = 2e3, voiceLang: v = "tr-TR", showBorderAnimation: u = !0, sendAriaLabel: d = "Gönder", micAriaLabel: _ = "Sesli giriş", cancelAriaLabel: y = "Ses kaydını durdur", openChatAriaLabel: b = "Chat'i aç" } = t;
|
|
4759
4777
|
if (!a.getElementById(Ut)) {
|
|
4760
4778
|
const V = document.createElement("style");
|
|
4761
4779
|
V.id = Ut, V.textContent = Ti({
|
|
@@ -4766,26 +4784,26 @@ function Ii(t, e, a) {
|
|
|
4766
4784
|
iconColor: s,
|
|
4767
4785
|
borderColor: c,
|
|
4768
4786
|
borderRadius: l,
|
|
4769
|
-
height:
|
|
4770
|
-
maxWidth:
|
|
4787
|
+
height: p,
|
|
4788
|
+
maxWidth: g,
|
|
4771
4789
|
fontFamily: h
|
|
4772
4790
|
}), a.appendChild(V);
|
|
4773
4791
|
}
|
|
4774
4792
|
const A = document.createElement("div");
|
|
4775
4793
|
A.className = "gengage-fl", A.dataset.gengagePart = "floating-launcher", A.innerHTML = Ai();
|
|
4776
|
-
const
|
|
4777
|
-
|
|
4778
|
-
let
|
|
4794
|
+
const L = A.querySelector(".gengage-fl-input"), E = A.querySelector(".gengage-fl-transcript"), T = A.querySelector(".gengage-fl-transcript-final"), N = A.querySelector(".gengage-fl-transcript-interim"), F = A.querySelector(".gengage-fl-btn-send"), X = A.querySelector(".gengage-fl-btn-mic"), C = A.querySelector(".gengage-fl-btn-open-chat"), R = A.querySelector(".gengage-fl-cancel"), D = A.querySelector(".gengage-fl-wave"), z = A.querySelector(".gengage-fl-ring");
|
|
4795
|
+
L.placeholder = m[0] ?? "", F.setAttribute("aria-label", d), X.setAttribute("aria-label", _), R.setAttribute("aria-label", y), C.setAttribute("aria-label", b);
|
|
4796
|
+
let k = !1, O = !1, B = "", q = !1, U = null, ne = 0, W = null, K = null, f = null, S = null, P = null, $ = 0;
|
|
4779
4797
|
function I() {
|
|
4780
|
-
const V =
|
|
4781
|
-
if (X.classList.toggle("is-recording",
|
|
4782
|
-
|
|
4798
|
+
const V = L.value.trim().length > 0;
|
|
4799
|
+
if (X.classList.toggle("is-recording", k), k) {
|
|
4800
|
+
F.style.display = "flex", X.style.display = "flex", R.style.display = "flex", C.style.display = "none";
|
|
4783
4801
|
return;
|
|
4784
4802
|
}
|
|
4785
|
-
|
|
4803
|
+
F.style.display = V ? "flex" : "none", X.style.display = V ? "none" : "flex", R.style.display = "none", C.style.display = !V && q ? "flex" : "none";
|
|
4786
4804
|
}
|
|
4787
4805
|
function j() {
|
|
4788
|
-
ne = (ne + 1) % m.length,
|
|
4806
|
+
ne = (ne + 1) % m.length, L.placeholder = m[ne] ?? "", W = setTimeout(j, x);
|
|
4789
4807
|
}
|
|
4790
4808
|
function Q() {
|
|
4791
4809
|
W !== null || m.length <= 1 || (W = setTimeout(j, x));
|
|
@@ -4794,9 +4812,9 @@ function Ii(t, e, a) {
|
|
|
4794
4812
|
W !== null && (clearTimeout(W), W = null);
|
|
4795
4813
|
}
|
|
4796
4814
|
function se() {
|
|
4797
|
-
|
|
4798
|
-
const V =
|
|
4799
|
-
V && (e.onSend(V), q || (q = !0)),
|
|
4815
|
+
k && (k = !1, w(), O = !1, oe(), u && H(), B = "", L.style.display = "", E.style.display = "none", T.textContent = "", N.textContent = "");
|
|
4816
|
+
const V = L.value.trim();
|
|
4817
|
+
V && (e.onSend(V), q || (q = !0)), L.value = "", B = "", I();
|
|
4800
4818
|
}
|
|
4801
4819
|
function re() {
|
|
4802
4820
|
const V = window, G = V.SpeechRecognition ?? V.webkitSpeechRecognition;
|
|
@@ -4804,8 +4822,8 @@ function Ii(t, e, a) {
|
|
|
4804
4822
|
console.warn("[FloatingLauncher] SpeechRecognition not supported.");
|
|
4805
4823
|
return;
|
|
4806
4824
|
}
|
|
4807
|
-
|
|
4808
|
-
if (!
|
|
4825
|
+
U || (U = new G(), U.continuous = !0, U.interimResults = !0, U.lang = v), k = !0, O = !0, B = "", L.value = "", L.style.display = "none", E.style.display = "flex", T.textContent = "", N.textContent = "", I(), ce(), u && M(), U.onresult = (J) => {
|
|
4826
|
+
if (!k) return;
|
|
4809
4827
|
let ie = "", Z = "";
|
|
4810
4828
|
for (let le = J.resultIndex; le < J.results.length; le++) {
|
|
4811
4829
|
const Ae = J.results[le];
|
|
@@ -4813,28 +4831,28 @@ function Ii(t, e, a) {
|
|
|
4813
4831
|
const Fe = Ae[0]?.transcript ?? "";
|
|
4814
4832
|
Ae.isFinal ? Z += Fe : ie += Fe;
|
|
4815
4833
|
}
|
|
4816
|
-
|
|
4817
|
-
},
|
|
4834
|
+
B += Z, T.textContent = B, N.textContent = ie, L.value = `${B} ${ie}`.trim(), I();
|
|
4835
|
+
}, U.onend = () => Y(), U.onerror = () => Y();
|
|
4818
4836
|
try {
|
|
4819
|
-
|
|
4837
|
+
U.start();
|
|
4820
4838
|
} catch {
|
|
4821
4839
|
Y();
|
|
4822
4840
|
}
|
|
4823
4841
|
}
|
|
4824
4842
|
function w() {
|
|
4825
4843
|
try {
|
|
4826
|
-
|
|
4844
|
+
U?.stop();
|
|
4827
4845
|
} catch {
|
|
4828
4846
|
}
|
|
4829
4847
|
}
|
|
4830
4848
|
function Y() {
|
|
4831
|
-
|
|
4849
|
+
O && (O = !1, k = !1, oe(), u && H(), B.trim() && (L.value = B.trim()), L.style.display = "", E.style.display = "none", T.textContent = "", N.textContent = "", I());
|
|
4832
4850
|
}
|
|
4833
4851
|
async function ce() {
|
|
4834
|
-
const V = ++$, G = Array.from(
|
|
4852
|
+
const V = ++$, G = Array.from(D.querySelectorAll("span"));
|
|
4835
4853
|
try {
|
|
4836
4854
|
const J = await navigator.mediaDevices.getUserMedia({ audio: !0 });
|
|
4837
|
-
if (!
|
|
4855
|
+
if (!k || V !== $) {
|
|
4838
4856
|
J.getTracks().forEach((Ie) => Ie.stop());
|
|
4839
4857
|
return;
|
|
4840
4858
|
}
|
|
@@ -4843,14 +4861,14 @@ function Ii(t, e, a) {
|
|
|
4843
4861
|
if (!Z)
|
|
4844
4862
|
throw K = null, J.getTracks().forEach((Ie) => Ie.stop()), new Error("AudioContext not supported");
|
|
4845
4863
|
const le = new Z();
|
|
4846
|
-
if (!
|
|
4864
|
+
if (!k || V !== $) {
|
|
4847
4865
|
J.getTracks().forEach((Ie) => Ie.stop()), le.close().catch(() => {
|
|
4848
4866
|
});
|
|
4849
4867
|
return;
|
|
4850
4868
|
}
|
|
4851
4869
|
f = le, S = le.createAnalyser(), S.fftSize = 256, le.createMediaStreamSource(J).connect(S);
|
|
4852
4870
|
const Ae = new Uint8Array(S.frequencyBinCount), Fe = () => {
|
|
4853
|
-
if (!
|
|
4871
|
+
if (!k || V !== $ || !S) return;
|
|
4854
4872
|
S.getByteFrequencyData(Ae);
|
|
4855
4873
|
const Ie = Math.max(1, Math.floor(Ae.length / G.length));
|
|
4856
4874
|
G.forEach((ka, Ca) => {
|
|
@@ -4859,37 +4877,37 @@ function Ii(t, e, a) {
|
|
|
4859
4877
|
};
|
|
4860
4878
|
Fe();
|
|
4861
4879
|
} catch {
|
|
4862
|
-
if (!
|
|
4880
|
+
if (!k || V !== $) return;
|
|
4863
4881
|
P !== null && (cancelAnimationFrame(P), P = null), S && (S.disconnect(), S = null), f && (f.close().catch(() => {
|
|
4864
|
-
}), f = null), K && (K.getTracks().forEach((J) => J.stop()), K = null),
|
|
4882
|
+
}), f = null), K && (K.getTracks().forEach((J) => J.stop()), K = null), D.classList.add("is-css-animated");
|
|
4865
4883
|
}
|
|
4866
4884
|
}
|
|
4867
4885
|
function oe() {
|
|
4868
|
-
$ += 1,
|
|
4869
|
-
}), f = null), K && (K.getTracks().forEach((V) => V.stop()), K = null), Array.from(
|
|
4886
|
+
$ += 1, D.classList.remove("is-css-animated"), P !== null && (cancelAnimationFrame(P), P = null), S && (S.disconnect(), S = null), f && (f.close().catch(() => {
|
|
4887
|
+
}), f = null), K && (K.getTracks().forEach((V) => V.stop()), K = null), Array.from(D.querySelectorAll("span")).forEach((V) => {
|
|
4870
4888
|
V.style.height = "4px";
|
|
4871
4889
|
});
|
|
4872
4890
|
}
|
|
4873
4891
|
function M() {
|
|
4874
|
-
|
|
4892
|
+
z.classList.add("is-active");
|
|
4875
4893
|
}
|
|
4876
4894
|
function H() {
|
|
4877
|
-
|
|
4895
|
+
z.classList.remove("is-active");
|
|
4878
4896
|
}
|
|
4879
|
-
|
|
4880
|
-
V.preventDefault(), V.stopPropagation(),
|
|
4897
|
+
F.addEventListener("click", se), X.addEventListener("click", (V) => {
|
|
4898
|
+
V.preventDefault(), V.stopPropagation(), k ? w() : re();
|
|
4881
4899
|
}), R.addEventListener("click", () => {
|
|
4882
|
-
|
|
4883
|
-
}),
|
|
4900
|
+
k && (k = !1, w(), O = !1, oe(), u && H(), B = "", L.style.display = "", E.style.display = "none", T.textContent = "", N.textContent = "", I());
|
|
4901
|
+
}), C.addEventListener("click", (V) => {
|
|
4884
4902
|
V.preventDefault(), V.stopPropagation(), e.onOpenChat();
|
|
4885
|
-
}),
|
|
4903
|
+
}), L.addEventListener("input", I), L.addEventListener("keydown", (V) => {
|
|
4886
4904
|
V.key === "Enter" && se();
|
|
4887
4905
|
}), I(), Q();
|
|
4888
4906
|
function ee() {
|
|
4889
4907
|
q = !0, I();
|
|
4890
4908
|
}
|
|
4891
4909
|
function pe() {
|
|
4892
|
-
te(), oe(), H(),
|
|
4910
|
+
te(), oe(), H(), k && (k = !1, w()), U && (U.onresult = null, U.onend = null, U.onerror = null, U = null);
|
|
4893
4911
|
}
|
|
4894
4912
|
return {
|
|
4895
4913
|
container: A,
|
|
@@ -4949,7 +4967,7 @@ function zi(t) {
|
|
|
4949
4967
|
};
|
|
4950
4968
|
}
|
|
4951
4969
|
function Ri(t) {
|
|
4952
|
-
const e = `.${t.rowClassName}`, a = `#${CSS.escape(t.buttonId)}`, n = `.${fe}-icon`, r = `.${fe}-copy`, i = `.${fe}-title`, o = `.${fe}-spark`, s = `@media (max-width: ${t.compactBelowWidth - 0.02}px)`, { sizes: c } = t, l = c.mobile.hideTitle ? "display:none;" : "display:flex;flex:0 1 auto;min-width:0;",
|
|
4970
|
+
const e = `.${t.rowClassName}`, a = `#${CSS.escape(t.buttonId)}`, n = `.${fe}-icon`, r = `.${fe}-copy`, i = `.${fe}-title`, o = `.${fe}-spark`, s = `@media (max-width: ${t.compactBelowWidth - 0.02}px)`, { sizes: c } = t, l = c.mobile.hideTitle ? "display:none;" : "display:flex;flex:0 1 auto;min-width:0;", p = c.mobile.hideSpark ? "display:none;" : "display:inline-flex;", g = c.mobile.hideLogo ? "display:none !important;width:0 !important;height:0 !important;flex:0 0 0 !important;overflow:hidden !important;" : "display:inline-flex;";
|
|
4953
4971
|
return `
|
|
4954
4972
|
${e}{
|
|
4955
4973
|
display:flex;
|
|
@@ -5062,10 +5080,10 @@ ${s}{
|
|
|
5062
5080
|
line-height:1.05;
|
|
5063
5081
|
}
|
|
5064
5082
|
${a} ${n}{
|
|
5065
|
-
${
|
|
5083
|
+
${g}
|
|
5066
5084
|
}
|
|
5067
5085
|
${a} ${o}{
|
|
5068
|
-
${
|
|
5086
|
+
${p}
|
|
5069
5087
|
width:${c.mobile.sparkSize};
|
|
5070
5088
|
height:${c.mobile.sparkSize};
|
|
5071
5089
|
flex:0 0 ${c.mobile.sparkSize};
|
|
@@ -5081,9 +5099,9 @@ function Hi(t) {
|
|
|
5081
5099
|
return new Promise((e) => window.setTimeout(e, t));
|
|
5082
5100
|
}
|
|
5083
5101
|
function Fi(t, e, a) {
|
|
5084
|
-
const { hostSelector: n, rowClassName: r = "gengage-inline-launcher-row", siblingSelector: i, siblingPlacement: o = "before", rowPlacement: s = "end", title: c = "Ask", iconUrl: l, primaryColor:
|
|
5085
|
-
let X = !1,
|
|
5086
|
-
const
|
|
5102
|
+
const { hostSelector: n, rowClassName: r = "gengage-inline-launcher-row", siblingSelector: i, siblingPlacement: o = "before", rowPlacement: s = "end", title: c = "Ask", iconUrl: l, primaryColor: p = "#6366f1", textColor: g = "#222222", fontFamily: h = "inherit", borderRadius: m = "3px", showSparkIcon: x = !0, desktopMinWidth: v = 0, enableOnMobile: u = !1, disabledPageTypes: d = ["pdp"], hideFloatingLauncher: _ = !0, mountPollFrames: y = 90, debounceMs: b = 90, buttonId: A = Ni } = t, L = t.ariaLabel ?? c, E = t.siblingRestoreParentSelector ?? n, T = u && v > 0 ? v : 576, N = zi(t.size), F = `${Mi}-${A}`;
|
|
5103
|
+
let X = !1, C = !1, R = null, D = null, z = null, k = null;
|
|
5104
|
+
const O = () => {
|
|
5087
5105
|
if (u && v > 0 && window.innerWidth < v && t.mobileHost && t.mobileHost) {
|
|
5088
5106
|
const M = t.mobileHost;
|
|
5089
5107
|
return {
|
|
@@ -5097,28 +5115,28 @@ function Fi(t, e, a) {
|
|
|
5097
5115
|
return {
|
|
5098
5116
|
hostSelector: n,
|
|
5099
5117
|
siblingSelector: i,
|
|
5100
|
-
siblingRestoreParentSelector:
|
|
5118
|
+
siblingRestoreParentSelector: E,
|
|
5101
5119
|
rowPlacement: s,
|
|
5102
5120
|
siblingPlacement: o
|
|
5103
5121
|
};
|
|
5104
|
-
},
|
|
5122
|
+
}, B = (M) => [
|
|
5105
5123
|
M.hostSelector,
|
|
5106
5124
|
M.siblingSelector ?? "",
|
|
5107
5125
|
M.siblingRestoreParentSelector
|
|
5108
5126
|
].join("|"), q = () => {
|
|
5109
|
-
if (document.getElementById(
|
|
5127
|
+
if (document.getElementById(F)) return;
|
|
5110
5128
|
const M = document.createElement("style");
|
|
5111
|
-
M.id =
|
|
5112
|
-
primaryColor:
|
|
5113
|
-
textColor:
|
|
5129
|
+
M.id = F, M.textContent = Ri({
|
|
5130
|
+
primaryColor: p,
|
|
5131
|
+
textColor: g,
|
|
5114
5132
|
fontFamily: h,
|
|
5115
5133
|
borderRadius: m,
|
|
5116
5134
|
rowClassName: r,
|
|
5117
|
-
compactBelowWidth:
|
|
5135
|
+
compactBelowWidth: T,
|
|
5118
5136
|
buttonId: A,
|
|
5119
|
-
sizes:
|
|
5137
|
+
sizes: N
|
|
5120
5138
|
}), document.head.appendChild(M);
|
|
5121
|
-
},
|
|
5139
|
+
}, U = (M) => {
|
|
5122
5140
|
if (!_ || !a.shadowRoot) return;
|
|
5123
5141
|
const H = a.shadowRoot.getElementById(Ot);
|
|
5124
5142
|
if (!M) {
|
|
@@ -5136,9 +5154,9 @@ function Fi(t, e, a) {
|
|
|
5136
5154
|
const H = document.querySelector(M);
|
|
5137
5155
|
return H instanceof HTMLElement ? H : null;
|
|
5138
5156
|
}, K = (M) => {
|
|
5139
|
-
if (
|
|
5157
|
+
if (k?.isConnected) return k;
|
|
5140
5158
|
const H = W(M.siblingSelector);
|
|
5141
|
-
return H && (
|
|
5159
|
+
return H && (k = H), H;
|
|
5142
5160
|
}, f = (M) => {
|
|
5143
5161
|
const H = document.querySelector(M);
|
|
5144
5162
|
return H instanceof HTMLElement ? H : null;
|
|
@@ -5168,17 +5186,17 @@ function Fi(t, e, a) {
|
|
|
5168
5186
|
M.className = `${fe}-icon`;
|
|
5169
5187
|
const H = document.createElement("img");
|
|
5170
5188
|
return H.src = l, H.alt = "", H.draggable = !1, M.appendChild(H), M;
|
|
5171
|
-
}, j = () => window.innerWidth <
|
|
5189
|
+
}, j = () => window.innerWidth < T, Q = (M) => {
|
|
5172
5190
|
if (!l) return;
|
|
5173
5191
|
const H = M.querySelector(`.${fe}-icon`);
|
|
5174
|
-
if (j() &&
|
|
5192
|
+
if (j() && N.mobile.hideLogo) {
|
|
5175
5193
|
H?.remove();
|
|
5176
5194
|
return;
|
|
5177
5195
|
}
|
|
5178
5196
|
H || M.insertBefore(I(), M.firstChild);
|
|
5179
5197
|
}, te = () => {
|
|
5180
5198
|
const M = document.createElement("button");
|
|
5181
|
-
M.type = "button", M.id = A, M.className = fe, M.setAttribute("aria-label",
|
|
5199
|
+
M.type = "button", M.id = A, M.className = fe, M.setAttribute("aria-label", L), l && M.appendChild(I());
|
|
5182
5200
|
const H = document.createElement("span");
|
|
5183
5201
|
H.className = `${fe}-copy`;
|
|
5184
5202
|
const ee = document.createElement("span");
|
|
@@ -5194,29 +5212,29 @@ function Fi(t, e, a) {
|
|
|
5194
5212
|
}
|
|
5195
5213
|
(H.parentElement !== M || ee.nextElementSibling !== H) && M.appendChild(H);
|
|
5196
5214
|
}, re = () => {
|
|
5197
|
-
if (
|
|
5198
|
-
P(
|
|
5199
|
-
const M = ne(
|
|
5200
|
-
M && $(M),
|
|
5215
|
+
if (z) {
|
|
5216
|
+
P(z);
|
|
5217
|
+
const M = ne(z.hostSelector);
|
|
5218
|
+
M && $(M), z = null;
|
|
5201
5219
|
}
|
|
5202
|
-
|
|
5203
|
-
}, w = (M) => !(M &&
|
|
5220
|
+
k = null, U(!1), X = !1;
|
|
5221
|
+
}, w = (M) => !(M && d.includes(M) || v > 0 && window.innerWidth < v && !u), Y = async (M) => {
|
|
5204
5222
|
const H = M ?? a.getPageType();
|
|
5205
5223
|
if (!w(H))
|
|
5206
5224
|
return re(), !1;
|
|
5207
5225
|
q();
|
|
5208
|
-
const ee =
|
|
5209
|
-
|
|
5226
|
+
const ee = O();
|
|
5227
|
+
z && B(z) !== B(ee) && re();
|
|
5210
5228
|
for (let pe = 0; pe < y; pe += 1) {
|
|
5211
5229
|
if (!w(H))
|
|
5212
5230
|
return re(), !1;
|
|
5213
|
-
const V =
|
|
5231
|
+
const V = O(), G = ne(V.hostSelector), J = K(V);
|
|
5214
5232
|
if (G && (!V.siblingSelector || J)) {
|
|
5215
|
-
|
|
5233
|
+
z && B(z) !== B(V) && re(), J && S(J);
|
|
5216
5234
|
let ie = G.querySelector(`.${r}`);
|
|
5217
5235
|
ie instanceof HTMLElement || (ie = document.createElement("div"), ie.className = r, V.rowPlacement === "start" ? G.insertBefore(ie, G.firstChild) : G.appendChild(ie));
|
|
5218
5236
|
let Z = ie.querySelector(`#${CSS.escape(A)}`);
|
|
5219
|
-
return Z instanceof HTMLButtonElement ?
|
|
5237
|
+
return Z instanceof HTMLButtonElement ? D = Z : (Z = te(), D = Z, ie.appendChild(Z)), J && se(ie, J, Z), Q(Z), C ? Z.classList.add(`${fe}--active`) : Z.classList.remove(`${fe}--active`), U(!0), X = !0, z = V, !0;
|
|
5220
5238
|
}
|
|
5221
5239
|
await Hi(16);
|
|
5222
5240
|
}
|
|
@@ -5234,10 +5252,10 @@ function Fi(t, e, a) {
|
|
|
5234
5252
|
return Y(M);
|
|
5235
5253
|
},
|
|
5236
5254
|
setActive(M) {
|
|
5237
|
-
|
|
5255
|
+
C = M, D?.classList.toggle(`${fe}--active`, M);
|
|
5238
5256
|
},
|
|
5239
5257
|
destroy() {
|
|
5240
|
-
R !== null && (window.clearTimeout(R), R = null), window.removeEventListener("resize", oe), window.removeEventListener("orientationchange", oe), re(), document.getElementById(
|
|
5258
|
+
R !== null && (window.clearTimeout(R), R = null), window.removeEventListener("resize", oe), window.removeEventListener("orientationchange", oe), re(), document.getElementById(F)?.remove(), D = null;
|
|
5241
5259
|
}
|
|
5242
5260
|
};
|
|
5243
5261
|
}
|
|
@@ -5314,26 +5332,26 @@ function Vi(t) {
|
|
|
5314
5332
|
isRunning: !1
|
|
5315
5333
|
};
|
|
5316
5334
|
e.innerHTML = "";
|
|
5317
|
-
let c = 0, l = null,
|
|
5318
|
-
function
|
|
5319
|
-
if (!
|
|
5320
|
-
|
|
5335
|
+
let c = 0, l = null, p = !0;
|
|
5336
|
+
function g() {
|
|
5337
|
+
if (!p || c >= s.length) {
|
|
5338
|
+
p = !1, i?.();
|
|
5321
5339
|
return;
|
|
5322
5340
|
}
|
|
5323
5341
|
const h = s[c], m = document.createElement("span");
|
|
5324
5342
|
m.className = "gengage-chat-typewriter-block";
|
|
5325
5343
|
for (const x of h) m.appendChild(x.cloneNode(!0));
|
|
5326
|
-
e.appendChild(m), c++, r?.(), c < s.length ? l = setTimeout(
|
|
5344
|
+
e.appendChild(m), c++, r?.(), c < s.length ? l = setTimeout(g, n) : (p = !1, i?.());
|
|
5327
5345
|
}
|
|
5328
|
-
return
|
|
5346
|
+
return g(), {
|
|
5329
5347
|
complete() {
|
|
5330
|
-
|
|
5348
|
+
p && (l !== null && clearTimeout(l), p = !1, e.innerHTML = a, i?.());
|
|
5331
5349
|
},
|
|
5332
5350
|
cancel() {
|
|
5333
|
-
l !== null && clearTimeout(l),
|
|
5351
|
+
l !== null && clearTimeout(l), p = !1;
|
|
5334
5352
|
},
|
|
5335
5353
|
get isRunning() {
|
|
5336
|
-
return
|
|
5354
|
+
return p;
|
|
5337
5355
|
}
|
|
5338
5356
|
};
|
|
5339
5357
|
}
|
|
@@ -5351,25 +5369,25 @@ function Gi(t) {
|
|
|
5351
5369
|
const s = document.createTreeWalker(e, NodeFilter.SHOW_TEXT);
|
|
5352
5370
|
let c = s.nextNode(), l = !1;
|
|
5353
5371
|
for (; c && !l; ) {
|
|
5354
|
-
const
|
|
5355
|
-
if (
|
|
5372
|
+
const p = c.textContent ?? "", g = p.toLowerCase().indexOf(i);
|
|
5373
|
+
if (g === -1) {
|
|
5356
5374
|
c = s.nextNode();
|
|
5357
5375
|
continue;
|
|
5358
5376
|
}
|
|
5359
|
-
const h =
|
|
5377
|
+
const h = g > 0 ? p[g - 1] : void 0, m = p[g + o.short_name.length];
|
|
5360
5378
|
if (jt(h) || jt(m)) {
|
|
5361
5379
|
c = s.nextNode();
|
|
5362
5380
|
continue;
|
|
5363
5381
|
}
|
|
5364
|
-
const x =
|
|
5365
|
-
if (!
|
|
5382
|
+
const x = p.slice(0, g), v = p.slice(g, g + o.short_name.length), u = p.slice(g + o.short_name.length), d = c.parentNode;
|
|
5383
|
+
if (!d) {
|
|
5366
5384
|
c = s.nextNode();
|
|
5367
5385
|
continue;
|
|
5368
5386
|
}
|
|
5369
5387
|
const _ = typeof o.url == "string" && o.url.trim() && he(o.url.trim()) ? o.url.trim() : void 0, y = document.createElement("a");
|
|
5370
5388
|
y.className = "gengage-product-mention", y.textContent = v, y.href = _ ?? "#", y.addEventListener("click", (b) => {
|
|
5371
5389
|
b.preventDefault(), n(o);
|
|
5372
|
-
}), x &&
|
|
5390
|
+
}), x && d.insertBefore(document.createTextNode(x), c), d.insertBefore(y, c), u && d.insertBefore(document.createTextNode(u), c), d.removeChild(c), l = !0;
|
|
5373
5391
|
}
|
|
5374
5392
|
}
|
|
5375
5393
|
}
|
|
@@ -5668,8 +5686,8 @@ var ao = class {
|
|
|
5668
5686
|
if (this.currentType = s, o.querySelector(".gengage-chat-product-grid-head-title") && s === "ProductGrid") {
|
|
5669
5687
|
const c = this.deps.currentThreadId();
|
|
5670
5688
|
if (c) {
|
|
5671
|
-
const l = this._resolvePanelHistoryIdx(c),
|
|
5672
|
-
this.deps.drawer()?.updatePanelTopBar(
|
|
5689
|
+
const l = this._resolvePanelHistoryIdx(c), p = l > 0, g = l >= 0 && l < this.threads.length - 1;
|
|
5690
|
+
this.deps.drawer()?.updatePanelTopBar(p, g, "");
|
|
5673
5691
|
}
|
|
5674
5692
|
} else this.updateTopBar(s);
|
|
5675
5693
|
return !0;
|
|
@@ -5877,16 +5895,16 @@ var xo = class {
|
|
|
5877
5895
|
saveSession(t) {
|
|
5878
5896
|
if (!this._storage) return null;
|
|
5879
5897
|
const e = ho(t.messages, t.attachmentPlaceholder);
|
|
5880
|
-
if (!e.some((
|
|
5898
|
+
if (!e.some((g) => g.role === "user" && !g.silent && typeof g.content == "string" && ke(g.content).length > 0)) return null;
|
|
5881
5899
|
const a = (/* @__PURE__ */ new Date()).toISOString(), n = uo(e), r = mo(e), i = {};
|
|
5882
|
-
for (const [
|
|
5883
|
-
h.querySelector(".gengage-chat-panel-skeleton") || (i[
|
|
5900
|
+
for (const [g, h] of t.panelSnapshots)
|
|
5901
|
+
h.querySelector(".gengage-chat-panel-skeleton") || (i[g] = h.innerHTML);
|
|
5884
5902
|
const o = {};
|
|
5885
|
-
for (const [
|
|
5903
|
+
for (const [g, h] of t.panelSnapshotTypes) o[g] = h;
|
|
5886
5904
|
const s = {};
|
|
5887
|
-
for (const [
|
|
5905
|
+
for (const [g, h] of t.panelSnapshotSources) s[g] = h;
|
|
5888
5906
|
const c = {};
|
|
5889
|
-
for (const [
|
|
5907
|
+
for (const [g, h] of t.panelAiSpecByThread ?? []) c[g] = h;
|
|
5890
5908
|
const l = {
|
|
5891
5909
|
version: Vt,
|
|
5892
5910
|
id: t.historyId,
|
|
@@ -5909,8 +5927,8 @@ var xo = class {
|
|
|
5909
5927
|
panelSnapshotSources: Object.keys(s).length > 0 ? s : void 0,
|
|
5910
5928
|
panelAiSpecByThread: Object.keys(c).length > 0 ? c : void 0,
|
|
5911
5929
|
lastBackendContext: t.lastBackendContext
|
|
5912
|
-
},
|
|
5913
|
-
for (
|
|
5930
|
+
}, p = this.listSessions().filter((g) => g.id !== t.historyId);
|
|
5931
|
+
for (p.unshift({
|
|
5914
5932
|
id: l.id,
|
|
5915
5933
|
title: l.title,
|
|
5916
5934
|
preview: l.preview,
|
|
@@ -5920,11 +5938,11 @@ var xo = class {
|
|
|
5920
5938
|
pageType: l.pageType,
|
|
5921
5939
|
sku: l.sku,
|
|
5922
5940
|
sourceSessionId: l.sourceSessionId
|
|
5923
|
-
});
|
|
5924
|
-
const
|
|
5925
|
-
|
|
5941
|
+
}); p.length > lo; ) {
|
|
5942
|
+
const g = p.pop();
|
|
5943
|
+
g && this._storage.removeItem(Ue(this._scope, g.id));
|
|
5926
5944
|
}
|
|
5927
|
-
return this._commitRecord(l,
|
|
5945
|
+
return this._commitRecord(l, p) ? l : null;
|
|
5928
5946
|
}
|
|
5929
5947
|
deleteSession(t) {
|
|
5930
5948
|
if (!this._storage) return;
|
|
@@ -6285,19 +6303,19 @@ var Fo = class Me extends Ya {
|
|
|
6285
6303
|
this._shadow = this.root.attachShadow({ mode: "open" });
|
|
6286
6304
|
const a = document.createElement("style");
|
|
6287
6305
|
a.textContent = No, this._shadow.appendChild(a);
|
|
6288
|
-
const n = this.root, r = (u,
|
|
6289
|
-
|
|
6306
|
+
const n = this.root, r = (u, d) => {
|
|
6307
|
+
d && Zt(d) && n.style.setProperty(u, d);
|
|
6290
6308
|
};
|
|
6291
6309
|
if (r("--gengage-chat-header-bg", e.headerBg), r("--gengage-chat-header-foreground", e.headerForeground), e.theme)
|
|
6292
|
-
for (const [u,
|
|
6310
|
+
for (const [u, d] of Object.entries(e.theme)) u.startsWith("--") && typeof d == "string" && r(u, d);
|
|
6293
6311
|
this._applyDiscountedPriceColorVar(e.productPriceUi?.discountedPriceColor);
|
|
6294
6312
|
const i = document.createElement("div");
|
|
6295
6313
|
i.className = "gengage-chat-root", i.lang = Oe(e.locale), this._rootEl = i, this._shadow.appendChild(i);
|
|
6296
6314
|
const o = e.variant ?? "floating";
|
|
6297
6315
|
if (o === "inline" && i.classList.add("gengage-chat--inline"), o !== "inline") {
|
|
6298
6316
|
const u = document.createElement("div");
|
|
6299
|
-
u.className = "gengage-chat-backdrop", u.setAttribute("aria-hidden", "true"), u.setAttribute("role", "button"), u.setAttribute("tabindex", "-1"), u.setAttribute("aria-label", this._i18n.closeAriaLabel), u.addEventListener("click", (
|
|
6300
|
-
|
|
6317
|
+
u.className = "gengage-chat-backdrop", u.setAttribute("aria-hidden", "true"), u.setAttribute("role", "button"), u.setAttribute("tabindex", "-1"), u.setAttribute("aria-label", this._i18n.closeAriaLabel), u.addEventListener("click", (d) => {
|
|
6318
|
+
d.preventDefault(), d.stopPropagation(), this.close();
|
|
6301
6319
|
}), this._backdropEl = u, i.prepend(u);
|
|
6302
6320
|
}
|
|
6303
6321
|
if (o === "floating") {
|
|
@@ -6321,7 +6339,7 @@ var Fo = class Me extends Ya {
|
|
|
6321
6339
|
const s = document.createElement("div");
|
|
6322
6340
|
i.appendChild(s), this._drawer = new Bn(s, {
|
|
6323
6341
|
i18n: this._i18n,
|
|
6324
|
-
onSend: (u,
|
|
6342
|
+
onSend: (u, d) => this._sendMessage(u, d),
|
|
6325
6343
|
onClose: () => this.close(),
|
|
6326
6344
|
onAttachment: (u) => this._handleAttachment(u),
|
|
6327
6345
|
onPanelToggle: () => {
|
|
@@ -6403,13 +6421,13 @@ var Fo = class Me extends Ya {
|
|
|
6403
6421
|
}), o !== "inline" && this._drawer.getElement().classList.add("gengage-chat-drawer--hidden");
|
|
6404
6422
|
const c = this._drawer.restorePanelState(e.accountId), l = e.panelMode ?? "auto";
|
|
6405
6423
|
l === "collapsed" ? this._drawer.setPanelCollapsed(!0) : l === "expanded" && this._drawer.setForceExpanded();
|
|
6406
|
-
const
|
|
6424
|
+
const p = sessionStorage.getItem("gengage_restore_session_id"), g = sessionStorage.getItem("gengage_restore_sku"), h = sessionStorage.getItem("gengage_restore_history_id"), m = !!(p && g);
|
|
6407
6425
|
m && (sessionStorage.removeItem("gengage_restore_session_id"), sessionStorage.removeItem("gengage_restore_sku")), h && sessionStorage.removeItem("gengage_restore_history_id"), this._historyStorage = new xo(this.config.accountId, this.config.session?.userId ?? "");
|
|
6408
6426
|
try {
|
|
6409
6427
|
const u = new ao();
|
|
6410
6428
|
await u.open(), this._session = new Wt(u);
|
|
6411
|
-
const
|
|
6412
|
-
|
|
6429
|
+
const d = h ? this._historyStorage.loadSession(h) : null;
|
|
6430
|
+
d ? (this._activeHistorySessionId = d.id, await this._restoreFromHistoryRecord(d)) : await this._restoreFromIndexedDB(m);
|
|
6413
6431
|
} catch {
|
|
6414
6432
|
this._session = new Wt(null);
|
|
6415
6433
|
const u = h ? this._historyStorage.loadSession(h) : null;
|
|
@@ -6418,12 +6436,12 @@ var Fo = class Me extends Ya {
|
|
|
6418
6436
|
this._registerPublicAPI(), e.mobileInitialState !== void 0 && (this._openState = e.mobileInitialState), this._mobileBreakpoint = e.mobileBreakpoint ?? 768, this._syncViewportState();
|
|
6419
6437
|
const x = () => this._syncViewportState();
|
|
6420
6438
|
if (window.addEventListener("resize", x, { passive: !0 }), this.addCleanup(() => window.removeEventListener("resize", x)), window.visualViewport) {
|
|
6421
|
-
const
|
|
6439
|
+
const d = () => {
|
|
6422
6440
|
if (!this._drawerVisible || !this._isMobileViewport) return;
|
|
6423
6441
|
const _ = this._drawer?.getElement();
|
|
6424
6442
|
if (!_) return;
|
|
6425
|
-
const y = window.visualViewport, b = Math.max(0, Math.round(window.innerHeight - (y.height + y.offsetTop))), A = b > 90,
|
|
6426
|
-
|
|
6443
|
+
const y = window.visualViewport, b = Math.max(0, Math.round(window.innerHeight - (y.height + y.offsetTop))), A = b > 90, L = this._openState === "full" && A ? b : 0;
|
|
6444
|
+
L !== this._lastAppliedKeyboardInset && (this._lastAppliedKeyboardInset = L, _.style.setProperty("--gengage-chat-keyboard-inset", `${L}px`)), this._openState === "full" && (_.style.setProperty("--gengage-chat-visual-vh", `${Math.round(y.height)}px`), _.style.setProperty("--gengage-chat-visual-top", `${Math.round(y.offsetTop)}px`));
|
|
6427
6445
|
};
|
|
6428
6446
|
this._syncVisualVh = () => {
|
|
6429
6447
|
if (!this._isMobileViewport || this._openState !== "full") return;
|
|
@@ -6431,8 +6449,8 @@ var Fo = class Me extends Ya {
|
|
|
6431
6449
|
if (!_ || !window.visualViewport) return;
|
|
6432
6450
|
const y = window.visualViewport;
|
|
6433
6451
|
_.style.setProperty("--gengage-chat-visual-vh", `${Math.round(y.height)}px`), _.style.setProperty("--gengage-chat-visual-top", `${Math.round(y.offsetTop)}px`);
|
|
6434
|
-
}, window.visualViewport.addEventListener("resize",
|
|
6435
|
-
window.visualViewport?.removeEventListener("resize",
|
|
6452
|
+
}, window.visualViewport.addEventListener("resize", d), window.visualViewport.addEventListener("scroll", d), this.addCleanup(() => {
|
|
6453
|
+
window.visualViewport?.removeEventListener("resize", d), window.visualViewport?.removeEventListener("scroll", d);
|
|
6436
6454
|
});
|
|
6437
6455
|
}
|
|
6438
6456
|
o === "inline" && (this._drawerVisible = !0, this.isVisible = !0, this._applyOpenStateClasses(), this._presentation.setShown(!0), setTimeout(() => this._maybeAutoAnchorUnreadAssistant(), 60));
|
|
@@ -6500,79 +6518,79 @@ var Fo = class Me extends Ya {
|
|
|
6500
6518
|
const a = e.launcherAnchor;
|
|
6501
6519
|
if (!a || !a.mobile && !a.desktop) return;
|
|
6502
6520
|
const n = this.root, r = e.mobileBreakpoint ?? 768, i = () => window.innerWidth <= r ? a.mobile : a.desktop, o = () => {
|
|
6503
|
-
const
|
|
6504
|
-
return !!
|
|
6521
|
+
const L = i();
|
|
6522
|
+
return !!L?.dynamicRelocate && !!L.selector;
|
|
6505
6523
|
}, s = "--gengage-chat-launcher-anchor-bottom", c = "--gengage-chat-launcher-anchor-right";
|
|
6506
6524
|
(a.mobile?.dynamicRelocate || a.desktop?.dynamicRelocate) && n.style.setProperty("--gengage-chat-launcher-anchor-transition", "0.35s");
|
|
6507
6525
|
const l = () => {
|
|
6508
|
-
const
|
|
6509
|
-
if (!
|
|
6510
|
-
const
|
|
6511
|
-
if (
|
|
6512
|
-
const { offset:
|
|
6513
|
-
if (!
|
|
6514
|
-
else if (
|
|
6515
|
-
const
|
|
6526
|
+
const L = window.innerWidth <= r ? a.mobile : a.desktop;
|
|
6527
|
+
if (!L) return;
|
|
6528
|
+
const E = L.selector, T = !!E, N = (T ? document.querySelector(E) : null)?.getBoundingClientRect();
|
|
6529
|
+
if (L.bottom !== void 0) {
|
|
6530
|
+
const { offset: F, type: X } = L.bottom;
|
|
6531
|
+
if (!T) n.style.setProperty(s, `${Math.max(0, F)}px`);
|
|
6532
|
+
else if (N) {
|
|
6533
|
+
const C = X === "root" || F === 0 ? N.bottom : N.top, R = Math.max(0, window.innerHeight - C + F);
|
|
6516
6534
|
n.style.setProperty(s, `${R}px`);
|
|
6517
6535
|
}
|
|
6518
6536
|
}
|
|
6519
|
-
if (
|
|
6520
|
-
const { offset:
|
|
6521
|
-
if (!
|
|
6522
|
-
else if (
|
|
6523
|
-
const
|
|
6537
|
+
if (L.right !== void 0) {
|
|
6538
|
+
const { offset: F, type: X } = L.right;
|
|
6539
|
+
if (!T) n.style.setProperty(c, `${Math.max(0, F)}px`);
|
|
6540
|
+
else if (N) {
|
|
6541
|
+
const C = X === "root" || F === 0 ? N.right : N.left, R = Math.max(0, window.innerWidth - C + F);
|
|
6524
6542
|
n.style.setProperty(c, `${R}px`);
|
|
6525
6543
|
}
|
|
6526
6544
|
}
|
|
6527
|
-
},
|
|
6545
|
+
}, p = () => {
|
|
6528
6546
|
n.style.removeProperty(s), n.style.removeProperty(c);
|
|
6529
6547
|
};
|
|
6530
|
-
let
|
|
6548
|
+
let g = !1, h = 0;
|
|
6531
6549
|
const m = () => {
|
|
6532
|
-
!o() || !
|
|
6533
|
-
h = 0, o() &&
|
|
6550
|
+
!o() || !g || h || (h = requestAnimationFrame(() => {
|
|
6551
|
+
h = 0, o() && g && l();
|
|
6534
6552
|
}));
|
|
6535
6553
|
}, x = new ResizeObserver(() => {
|
|
6536
|
-
(!o() ||
|
|
6554
|
+
(!o() || g) && l();
|
|
6537
6555
|
});
|
|
6538
6556
|
let v = null, u = null;
|
|
6539
|
-
const
|
|
6540
|
-
const
|
|
6541
|
-
return !
|
|
6557
|
+
const d = () => {
|
|
6558
|
+
const L = i()?.selector;
|
|
6559
|
+
return !L || !!document.querySelector(L);
|
|
6542
6560
|
}, _ = () => {
|
|
6543
|
-
!o() ||
|
|
6544
|
-
|
|
6561
|
+
!o() || d() || (u?.disconnect(), u = new MutationObserver(() => {
|
|
6562
|
+
d() && (u?.disconnect(), u = null, y());
|
|
6545
6563
|
}), u.observe(document.body, {
|
|
6546
6564
|
childList: !0,
|
|
6547
6565
|
subtree: !0
|
|
6548
6566
|
}));
|
|
6549
6567
|
}, y = () => {
|
|
6550
|
-
x.disconnect(), v?.disconnect(), v = null,
|
|
6551
|
-
const
|
|
6552
|
-
if (!
|
|
6553
|
-
if (!
|
|
6568
|
+
x.disconnect(), v?.disconnect(), v = null, g = !1;
|
|
6569
|
+
const L = i();
|
|
6570
|
+
if (!L) return;
|
|
6571
|
+
if (!L.selector) {
|
|
6554
6572
|
l();
|
|
6555
6573
|
return;
|
|
6556
6574
|
}
|
|
6557
|
-
const
|
|
6558
|
-
|
|
6559
|
-
for (const
|
|
6560
|
-
}, { threshold: 0 }), v.observe(
|
|
6575
|
+
const E = document.querySelector(L.selector);
|
|
6576
|
+
E && (x.observe(E), o() ? (v = new IntersectionObserver((T) => {
|
|
6577
|
+
for (const N of T) N.isIntersecting ? (g = !0, l()) : (g = !1, p(), _());
|
|
6578
|
+
}, { threshold: 0 }), v.observe(E)) : l());
|
|
6561
6579
|
};
|
|
6562
6580
|
y();
|
|
6563
6581
|
let b = 0;
|
|
6564
6582
|
const A = () => {
|
|
6565
6583
|
b || (b = requestAnimationFrame(() => {
|
|
6566
|
-
b = 0,
|
|
6584
|
+
b = 0, g = !1, p(), u?.disconnect(), u = null, y(), _(), o() || l();
|
|
6567
6585
|
}));
|
|
6568
6586
|
};
|
|
6569
6587
|
window.addEventListener("resize", A, { passive: !0 }), window.addEventListener("scroll", m, { passive: !0 }), window.visualViewport?.addEventListener("scroll", m, { passive: !0 }), this._syncLauncherAnchor = () => {
|
|
6570
|
-
|
|
6588
|
+
g = !1, p(), u?.disconnect(), u = null, y(), _();
|
|
6571
6589
|
}, o() ? _() : (l(), [
|
|
6572
6590
|
100,
|
|
6573
6591
|
400,
|
|
6574
6592
|
1e3
|
|
6575
|
-
].forEach((
|
|
6593
|
+
].forEach((L) => window.setTimeout(l, L))), this._launcherAnchorCleanup = () => {
|
|
6576
6594
|
x.disconnect(), v?.disconnect(), u?.disconnect(), window.removeEventListener("resize", A), window.removeEventListener("scroll", m), window.visualViewport?.removeEventListener("scroll", m), b && cancelAnimationFrame(b), h && cancelAnimationFrame(h);
|
|
6577
6595
|
};
|
|
6578
6596
|
}
|
|
@@ -7121,31 +7139,31 @@ var Fo = class Me extends Ya {
|
|
|
7121
7139
|
P.threadId = i, a?.attachment !== void 0 && (P.attachment = a.attachment), this._drawer?.addMessage(P), a?.attachment !== void 0 && this._modeController.isBeautyConsulting && this._drawer?.setBeautyPhotoStepCard({ visible: !1 }), this._messages.push(P), this._persistHistoryToLocalStorage();
|
|
7122
7140
|
}
|
|
7123
7141
|
}
|
|
7124
|
-
const
|
|
7125
|
-
let
|
|
7142
|
+
const p = !a?.silent && this._assistantMode === "shopping" && this._hasUnavailableProductContext() && (e.type === "user_message" || e.type === "inputText");
|
|
7143
|
+
let g = this._currentPanelSource, h = !1;
|
|
7126
7144
|
const m = e.type === "user_message" || e.type === "inputText", x = () => {
|
|
7127
|
-
h || a?.preservePanel || (
|
|
7145
|
+
h || a?.preservePanel || (g = this._currentPanelSource, h = !0);
|
|
7128
7146
|
}, v = () => {
|
|
7129
7147
|
if (this._drawer?.isPanelLoading()) {
|
|
7130
|
-
if (!m &&
|
|
7131
|
-
const f = this._buildRenderContext(), S = this._renderPanelFromSource(
|
|
7132
|
-
this._drawer.setPanelContent(S), this._currentPanelSource =
|
|
7148
|
+
if (!m && g) {
|
|
7149
|
+
const f = this._buildRenderContext(), S = this._renderPanelFromSource(g, f);
|
|
7150
|
+
this._drawer.setPanelContent(S), this._currentPanelSource = g;
|
|
7133
7151
|
} else
|
|
7134
7152
|
this._drawer.clearPanel(), this._currentPanelSource = null;
|
|
7135
|
-
|
|
7153
|
+
g = null;
|
|
7136
7154
|
}
|
|
7137
7155
|
};
|
|
7138
7156
|
e.type === "getComparisonTable" && (this._drawer?.showPanelLoading("comparisonTable"), this._panel?.updateTopBarForLoading("comparisonTable")), !a?.silent && !o && this._pruneEmptyStreamingAssistantPlaceholders(), this._drawer?.showTypingIndicator();
|
|
7139
7157
|
let u = "";
|
|
7140
|
-
const
|
|
7141
|
-
|
|
7158
|
+
const d = this._createMessage("assistant", "");
|
|
7159
|
+
d.threadId = i, d.status = "streaming", a?.silent && (d.silent = !0), this._messages.push(d), this._presentation.registerAssistantActivity(i), this._focusPresentationThread(i, "smooth", a?.silent || o), a?.preservePanel || (this._contextPrimingInFlight && !s && (this._contextPrimingInFlight = !1, this._queuedUserMessages = []), this._abortAllActiveRequests());
|
|
7142
7160
|
const _ = {
|
|
7143
7161
|
middlewareUrl: this.config.middlewareUrl,
|
|
7144
7162
|
...this.config.accountId ? { accountId: this.config.accountId } : {},
|
|
7145
7163
|
...this.config.injectorAdapter ? { injectorAdapter: this.config.injectorAdapter } : {}
|
|
7146
7164
|
};
|
|
7147
7165
|
a?.attachment !== void 0 && (_.attachment = a.attachment);
|
|
7148
|
-
const y = this._getVisibleMessages().filter((f) => !f.frontendOnly && f !==
|
|
7166
|
+
const y = this._getVisibleMessages().filter((f) => !f.frontendOnly && f !== d && (f.content || f.role === "assistant")).slice(-50).map((f) => ({
|
|
7149
7167
|
role: f.role === "user" ? "user" : "model",
|
|
7150
7168
|
content: f.content ?? ""
|
|
7151
7169
|
})), b = {
|
|
@@ -7171,7 +7189,7 @@ var Fo = class Me extends Ya {
|
|
|
7171
7189
|
backendContext: this._lastBackendContext,
|
|
7172
7190
|
isMobile: this._isMobileViewport,
|
|
7173
7191
|
genericNonPdpLaunch: this.config.genericNonPdpLaunch
|
|
7174
|
-
}),
|
|
7192
|
+
}), L = {
|
|
7175
7193
|
account_id: this.config.accountId,
|
|
7176
7194
|
session_id: this.config.session?.sessionId ?? "",
|
|
7177
7195
|
correlation_id: this.config.session?.sessionId ?? "",
|
|
@@ -7184,32 +7202,32 @@ var Fo = class Me extends Ya {
|
|
|
7184
7202
|
session_id: this.config.session?.sessionId ?? ""
|
|
7185
7203
|
}
|
|
7186
7204
|
};
|
|
7187
|
-
this.config.session?.userId !== void 0 && (
|
|
7188
|
-
let
|
|
7205
|
+
this.config.session?.userId !== void 0 && (L.user_id = this.config.session.userId), this.config.session?.viewId !== void 0 && (L.view_id = this.config.session.viewId), A.payload !== void 0 && (L.payload = A.payload), !p && this.config.pageContext?.sku !== void 0 && (L.sku = this.config.pageContext.sku), !p && this.config.pageContext?.pageType !== void 0 && (L.page_type = this.config.pageContext.pageType);
|
|
7206
|
+
let E = !1, T = !1, N = !1, F = !1, X = !1, C = !1;
|
|
7189
7207
|
const R = On();
|
|
7190
|
-
let
|
|
7191
|
-
const
|
|
7192
|
-
if (this._drawer && !
|
|
7193
|
-
if (!
|
|
7208
|
+
let D = null, z = null;
|
|
7209
|
+
const k = () => {
|
|
7210
|
+
if (this._drawer && !F) {
|
|
7211
|
+
if (!N) {
|
|
7194
7212
|
this._drawer.setPanelAiZoneState("hidden");
|
|
7195
7213
|
return;
|
|
7196
7214
|
}
|
|
7197
7215
|
X ? this._drawer.setPanelAiZoneState("hidden") : this._drawer.setPanelAiZoneState("analyzing", { analyzingLabel: this._i18n.aiAnalysisAnalyzingLabel });
|
|
7198
7216
|
}
|
|
7199
|
-
},
|
|
7200
|
-
if (!
|
|
7217
|
+
}, O = (f) => {
|
|
7218
|
+
if (!D || !this._drawer) return;
|
|
7201
7219
|
const S = this._buildRenderContext();
|
|
7202
7220
|
S.isStreaming = f;
|
|
7203
|
-
const P = this._renderUISpec(
|
|
7204
|
-
|
|
7205
|
-
},
|
|
7221
|
+
const P = this._renderUISpec(D, S);
|
|
7222
|
+
F = !0, this._drawer.setPanelAiZoneState("results", { resultEl: P }), D = null;
|
|
7223
|
+
}, B = (f, S, P) => {
|
|
7206
7224
|
if (f === "ProductGrid" || f === "CategoriesContainer") {
|
|
7207
|
-
|
|
7225
|
+
N = !0, O(P), k();
|
|
7208
7226
|
return;
|
|
7209
7227
|
}
|
|
7210
|
-
S !== "appendSimilars" && S !== "append" && (
|
|
7211
|
-
}, q = (f) => (f === "ProductGrid" || f === "CategoriesContainer") && (
|
|
7212
|
-
|
|
7228
|
+
S !== "appendSimilars" && S !== "append" && (N = !1, F = !1, D = null, this._drawer?.setPanelAiZoneState("hidden"));
|
|
7229
|
+
}, q = (f) => (f === "ProductGrid" || f === "CategoriesContainer") && (N || F || D !== null), U = () => {
|
|
7230
|
+
C || (C = !0, this._drawer?.removeTypingIndicator(), r(!1), this._bridge?.send("loadingMessage", { text: null }));
|
|
7213
7231
|
}, ne = (f, S, P) => {
|
|
7214
7232
|
if (!this._drawer || !this._panel) return;
|
|
7215
7233
|
const $ = f.elements[f.root];
|
|
@@ -7232,17 +7250,17 @@ var Fo = class Me extends Ya {
|
|
|
7232
7250
|
}, this._panel.currentType = P;
|
|
7233
7251
|
}, W = (f, S, P, $) => {
|
|
7234
7252
|
if (!this._panel) return;
|
|
7235
|
-
f === "ProductDetailsPanel" && e.type === "launchSingleProduct" && this._clearUnavailableProductContext(),
|
|
7253
|
+
f === "ProductDetailsPanel" && e.type === "launchSingleProduct" && this._clearUnavailableProductContext(), d.threadId && this._panel.threads[this._panel.threads.length - 1] !== d.threadId && this._panel.threads.push(d.threadId), this._isMobileViewport && f === "ProductGrid" && this._ensureMobilePanelOverlayVisible();
|
|
7236
7254
|
const I = this._panel.currentType ?? f, j = S?.props?.panelTitle;
|
|
7237
|
-
this._panel.updateTopBar(I, j), this._panel.updateExtendedMode(f), this._isMobileViewport && c && this._drawer?.hideMobilePanel(),
|
|
7255
|
+
this._panel.updateTopBar(I, j), this._panel.updateExtendedMode(f), this._isMobileViewport && c && this._drawer?.hideMobilePanel(), B(f, P, $);
|
|
7238
7256
|
};
|
|
7239
7257
|
let K = null;
|
|
7240
|
-
if (K = pn(
|
|
7258
|
+
if (K = pn(L, {
|
|
7241
7259
|
onTextChunk: (f, S, P) => {
|
|
7242
7260
|
if (!o && i !== this._activeRequestThreadId || (u += f, P?.skuToProductItem && (this._skuToProductItem = {
|
|
7243
7261
|
...this._skuToProductItem,
|
|
7244
7262
|
...P.skuToProductItem
|
|
7245
|
-
}), P?.conversationMode && (this._conversationMode = P.conversationMode), P?.renderHint && (
|
|
7263
|
+
}), P?.conversationMode && (this._conversationMode = P.conversationMode), P?.renderHint && (d.renderHint = P.renderHint), !this._drawer)) return;
|
|
7246
7264
|
let $ = u;
|
|
7247
7265
|
const I = P?.kvkk === !0, j = I ? { fallbackToFirstBlock: !0 } : void 0;
|
|
7248
7266
|
if (I || xt($)) {
|
|
@@ -7255,13 +7273,13 @@ var Fo = class Me extends Ya {
|
|
|
7255
7273
|
}
|
|
7256
7274
|
$ = To($, j), u = $;
|
|
7257
7275
|
}
|
|
7258
|
-
Ho($) &&
|
|
7259
|
-
const Q = this._shadow?.querySelector(`[data-message-id="${
|
|
7260
|
-
if (Q ? Q.innerHTML = ve($) : (
|
|
7261
|
-
if (
|
|
7262
|
-
this._drawer?.updateBotMessage(
|
|
7276
|
+
Ho($) && U();
|
|
7277
|
+
const Q = this._shadow?.querySelector(`[data-message-id="${d.id}"] .gengage-chat-bubble-text`);
|
|
7278
|
+
if (Q ? Q.innerHTML = ve($) : (d.content = $, d.role === "assistant" && d.threadId && !this._threadsWithFirstBot.has(d.threadId) && (this._threadsWithFirstBot.add(d.threadId), this._drawer.markFirstBotMessage(d.id)), this._drawer.addMessage(d)), S)
|
|
7279
|
+
if (d.content = $, d.status = "done", yt(), qn(d))
|
|
7280
|
+
this._drawer?.updateBotMessage(d.id, $, "photo_analysis", d.photoAnalysis), d.threadId && this._focusPresentationThread(d.threadId, "auto");
|
|
7263
7281
|
else {
|
|
7264
|
-
const te = this._shadow?.querySelector(`[data-message-id="${
|
|
7282
|
+
const te = this._shadow?.querySelector(`[data-message-id="${d.id}"] .gengage-chat-bubble-text`);
|
|
7265
7283
|
if (te) {
|
|
7266
7284
|
this._activeTypewriter?.cancel();
|
|
7267
7285
|
const se = P?.productMentions ? this._enrichProductMentionsWithUrls(P.productMentions) : void 0;
|
|
@@ -7297,22 +7315,22 @@ var Fo = class Me extends Ya {
|
|
|
7297
7315
|
},
|
|
7298
7316
|
onUISpec: (f, S, P, $) => {
|
|
7299
7317
|
if (!o && i !== this._activeRequestThreadId || S !== "chat") return;
|
|
7300
|
-
$ && (this._clearAssistantPanelLikeStreamClearPanel(),
|
|
7318
|
+
$ && (this._clearAssistantPanelLikeStreamClearPanel(), E = !1, z = null);
|
|
7301
7319
|
const I = f.elements[f.root], j = I?.type ?? "unknown";
|
|
7302
7320
|
if (jn(j, I?.props ?? {}, R, {
|
|
7303
7321
|
drawer: this._drawer,
|
|
7304
|
-
ensureRendered: () => this._ensureAssistantMessageRendered(
|
|
7322
|
+
ensureRendered: () => this._ensureAssistantMessageRendered(d),
|
|
7305
7323
|
cancelTypewriter: () => {
|
|
7306
7324
|
this._activeTypewriter?.cancel(), this._activeTypewriter = null;
|
|
7307
7325
|
},
|
|
7308
7326
|
sendSkipMessage: () => this._sendMessage(this._i18n.beautyPhotoStepSkipMessage),
|
|
7309
7327
|
streamDone: X
|
|
7310
|
-
},
|
|
7311
|
-
j === "PhotoAnalysisCard" &&
|
|
7328
|
+
}, d)) {
|
|
7329
|
+
j === "PhotoAnalysisCard" && d.threadId && this._focusPresentationThread(d.threadId, "auto");
|
|
7312
7330
|
return;
|
|
7313
7331
|
}
|
|
7314
7332
|
const Q = gt(I), te = this.config.productDetailsExtended !== !0 && (j === "ProductDetailsPanel" || Q);
|
|
7315
|
-
te && !$ && (this._clearAssistantPanelLikeStreamClearPanel(),
|
|
7333
|
+
te && !$ && (this._clearAssistantPanelLikeStreamClearPanel(), E = !1);
|
|
7316
7334
|
const se = j === "ProductDetailsPanel" && P !== "panel" ? "panel" : P, re = this._buildRenderContext();
|
|
7317
7335
|
if (re.isStreaming = !0, j === "ComparisonTable") {
|
|
7318
7336
|
const G = I?.props?.products;
|
|
@@ -7326,14 +7344,14 @@ var Fo = class Me extends Ya {
|
|
|
7326
7344
|
if (se === "panel" && this._panel && !te && j === "ProductGrid" && I) {
|
|
7327
7345
|
const G = ft(I);
|
|
7328
7346
|
if (G.isConsulting && !Si(G)) {
|
|
7329
|
-
|
|
7347
|
+
z = f;
|
|
7330
7348
|
return;
|
|
7331
7349
|
}
|
|
7332
|
-
G.isConsulting && (
|
|
7350
|
+
G.isConsulting && (z = null);
|
|
7333
7351
|
}
|
|
7334
|
-
if (Ro(I) &&
|
|
7335
|
-
const G = !
|
|
7336
|
-
|
|
7352
|
+
if (Ro(I) && U(), se === "panel" && this._panel && !te) {
|
|
7353
|
+
const G = !T;
|
|
7354
|
+
T = !0;
|
|
7337
7355
|
const J = I?.props?.replacePanel === !0, ie = I?.props?.rankingState, Z = J || ie === "pending" || ie === "final" ? "replace" : oo({
|
|
7338
7356
|
componentType: j,
|
|
7339
7357
|
similarsAppend: I?.props?.similarsAppend === !0,
|
|
@@ -7347,7 +7365,7 @@ var Fo = class Me extends Ya {
|
|
|
7347
7365
|
spec: w
|
|
7348
7366
|
})), Z === "appendSimilars" ? this._appendSimilarsToPanel(w, re) : Z === "append" ? (this._drawer?.appendPanelContent(this._renderUISpec(w, re)), this._comparisonSelectMode && this._refreshComparisonUI()) : ne(w, re, j), W(j, I, Z, !0);
|
|
7349
7367
|
}
|
|
7350
|
-
if (j === "ProductDetailsPanel" && se === "panel" && (!
|
|
7368
|
+
if (j === "ProductDetailsPanel" && se === "panel" && (!d.silent || c)) {
|
|
7351
7369
|
const G = I?.props?.product;
|
|
7352
7370
|
if (G) {
|
|
7353
7371
|
c && (l = G), this._currentInlineProductSummaryRecord = G;
|
|
@@ -7360,30 +7378,30 @@ var Fo = class Me extends Ya {
|
|
|
7360
7378
|
}, ie = this._shadow?.querySelector(".gengage-chat-messages");
|
|
7361
7379
|
if (ie) {
|
|
7362
7380
|
const Z = this._renderUISpec(J, re);
|
|
7363
|
-
|
|
7364
|
-
const le = this._shadow?.querySelector(`[data-message-id="${
|
|
7365
|
-
le && le.parentNode === ie ? le.after(Z) : ie.appendChild(Z), this._scrollInlineIntoView(Z,
|
|
7381
|
+
d.threadId && (Z.dataset.threadId = d.threadId);
|
|
7382
|
+
const le = this._shadow?.querySelector(`[data-message-id="${d.id}"]`);
|
|
7383
|
+
le && le.parentNode === ie ? le.after(Z) : ie.appendChild(Z), this._scrollInlineIntoView(Z, d.threadId), this._drawer?.refreshPresentationCollapsed(), T = !0;
|
|
7366
7384
|
}
|
|
7367
7385
|
}
|
|
7368
7386
|
}
|
|
7369
7387
|
const Y = j === "AITopPicks" || j === "AIGroupingCards", ce = j === "InlineQuestionButtons", oe = j === "ActionButtons" ? I?.props?.buttons : void 0, M = j === "ActionButtons" && this._modeController.mode !== "shopping" && Array.isArray(oe) && oe.length > 0 && oe.every((G) => G.action?.type === "inputText");
|
|
7370
7388
|
let H = !1, ee = !1;
|
|
7371
|
-
if (te && Q && (re.panelProductListHeading = this._i18n.similarProductsLabel ?? "Similar Products"), Y && (!
|
|
7372
|
-
if (
|
|
7389
|
+
if (te && Q && (re.panelProductListHeading = this._i18n.similarProductsLabel ?? "Similar Products"), Y && (!d.silent || s))
|
|
7390
|
+
if (d.threadId && this._rememberPanelAiSpec(d.threadId, f), N) {
|
|
7373
7391
|
const G = this._renderUISpec(f, re);
|
|
7374
|
-
|
|
7392
|
+
F = !0, this._drawer?.setPanelAiZoneState("results", { resultEl: G }), H = !0, D = null;
|
|
7375
7393
|
} else
|
|
7376
|
-
|
|
7394
|
+
D = f, ee = !0;
|
|
7377
7395
|
ce && (this._drawer?.setInputAreaChips([]), this._drawer?.setPills([]));
|
|
7378
7396
|
const pe = s && (j === "GroundingReviewCard" || Y || j === "InlineQuestionButtons");
|
|
7379
|
-
if (!Y && (!
|
|
7397
|
+
if (!Y && (!d.silent || pe) && (se !== "panel" || j === "ProductCard" || te && j === "ProductGrid" && !Q) && (j !== "ActionButtons" || M) && !H && !(ee && Y)) {
|
|
7380
7398
|
const G = this._shadow?.querySelector(".gengage-chat-messages");
|
|
7381
7399
|
if (G) {
|
|
7382
7400
|
const J = this._renderUISpec(f, re);
|
|
7383
|
-
|
|
7401
|
+
d.threadId && (J.dataset.threadId = d.threadId), G.appendChild(J), this._scrollInlineIntoView(J, d.threadId), this._drawer?.refreshPresentationCollapsed(), te && j === "ProductGrid" && (T = !0);
|
|
7384
7402
|
}
|
|
7385
7403
|
}
|
|
7386
|
-
if ((j === "ProductGrid" || j === "ProductCard") &&
|
|
7404
|
+
if ((j === "ProductGrid" || j === "ProductCard") && d.threadId) {
|
|
7387
7405
|
const G = I?.children ?? [], J = j === "ProductGrid" ? G.map((ie) => f.elements[ie]?.props?.product).filter(Boolean) : [I?.props?.product].filter(Boolean);
|
|
7388
7406
|
for (const ie of J) {
|
|
7389
7407
|
const Z = ie.sku;
|
|
@@ -7431,7 +7449,7 @@ var Fo = class Me extends Ya {
|
|
|
7431
7449
|
}));
|
|
7432
7450
|
}
|
|
7433
7451
|
}
|
|
7434
|
-
|
|
7452
|
+
k(), d.uiSpec = f;
|
|
7435
7453
|
},
|
|
7436
7454
|
onAction: (f) => {
|
|
7437
7455
|
if (!(!o && i !== this._activeRequestThreadId) && f.type === "action") {
|
|
@@ -7460,7 +7478,7 @@ var Fo = class Me extends Ya {
|
|
|
7460
7478
|
}
|
|
7461
7479
|
if (f.meta.panelLoading) {
|
|
7462
7480
|
const S = typeof f.meta.panelPendingType == "string" ? f.meta.panelPendingType : void 0;
|
|
7463
|
-
this.config.productDetailsExtended !== !0 && (S === "productDetails" || S === "productDetailsSimilars") || (
|
|
7481
|
+
this.config.productDetailsExtended !== !0 && (S === "productDetails" || S === "productDetailsSimilars") || (E = !0, T = !1, x(), this._panel && (this._panel.currentType = null), this._drawer?.showPanelLoading(S), this._isMobileViewport && S === "productList" && this._ensureMobilePanelOverlayVisible(), S && this._panel?.updateTopBarForLoading(S));
|
|
7464
7482
|
}
|
|
7465
7483
|
if (f.meta.voice) {
|
|
7466
7484
|
const S = new CustomEvent("gengage:chat:voice", {
|
|
@@ -7476,13 +7494,13 @@ var Fo = class Me extends Ya {
|
|
|
7476
7494
|
if ((f.meta.redirectTarget || f.meta.redirect) && (_e("gengage:chat:redirect", {
|
|
7477
7495
|
target: f.meta.redirectTarget ?? null,
|
|
7478
7496
|
payload: f.meta.redirect ?? null
|
|
7479
|
-
}), ze("redirect", "redirect dispatched", { target: f.meta.redirectTarget ?? null }), this._handleRedirectMetadata(f.meta.redirect)), f.meta.analyzeAnimation && this.config.productDetailsExtended === !0 && (
|
|
7497
|
+
}), ze("redirect", "redirect dispatched", { target: f.meta.redirectTarget ?? null }), this._handleRedirectMetadata(f.meta.redirect)), f.meta.analyzeAnimation && this.config.productDetailsExtended === !0 && (E = !0, T = !1, x(), this._panel && (this._panel.currentType = null), this._drawer?.showPanelLoading(), this._panel?.updateTopBarForLoading("productDetails")), f.meta.loading) {
|
|
7480
7498
|
const S = Array.isArray(f.meta.thinkingMessages) ? f.meta.thinkingMessages.filter(($) => typeof $ == "string") : [], P = typeof f.meta.loadingText == "string" ? f.meta.loadingText : void 0;
|
|
7481
7499
|
if (S.length > 0) {
|
|
7482
7500
|
const $ = P && this._modeController.shouldCondenseThinking() ? [...S.slice(0, 2), P] : S;
|
|
7483
7501
|
this._drawer?.setThinkingSteps($);
|
|
7484
7502
|
}
|
|
7485
|
-
typeof P == "string" && P.length > 0 && (this._drawer?.addThinkingStep(P),
|
|
7503
|
+
typeof P == "string" && P.length > 0 && (this._drawer?.addThinkingStep(P), C || this._bridge?.send("loadingMessage", { text: P })), C && !X && this._drawer?.resumeTypingIndicator();
|
|
7486
7504
|
}
|
|
7487
7505
|
f.meta.visitorDataResponse && this._bridge?.send("engagingMessage", f.meta.visitorDataResponse), f.meta.formType && this._bridge?.send("glovForm", {
|
|
7488
7506
|
type: f.meta.formType,
|
|
@@ -7492,7 +7510,7 @@ var Fo = class Me extends Ya {
|
|
|
7492
7510
|
},
|
|
7493
7511
|
onError: (f) => {
|
|
7494
7512
|
if (K && this._abortControllers.delete(K), !o && i !== this._activeRequestThreadId) return;
|
|
7495
|
-
X = !0, this._activeTypewriter?.cancel(), this._activeTypewriter = null,
|
|
7513
|
+
X = !0, this._activeTypewriter?.cancel(), this._activeTypewriter = null, k(), D = null, z = null, r(!1), this._bridge?.send("loadingMessage", { text: null }), this._drawer?.removeTypingIndicator(), this._drawer?.clearInputAreaChips(), Vn(R, {
|
|
7496
7514
|
drawer: this._drawer,
|
|
7497
7515
|
ensureRendered: () => {
|
|
7498
7516
|
},
|
|
@@ -7501,11 +7519,11 @@ var Fo = class Me extends Ya {
|
|
|
7501
7519
|
sendSkipMessage: () => this._sendMessage(this._i18n.beautyPhotoStepSkipMessage),
|
|
7502
7520
|
streamDone: !0
|
|
7503
7521
|
});
|
|
7504
|
-
const S =
|
|
7505
|
-
|
|
7506
|
-
const P =
|
|
7507
|
-
this._shadow?.querySelector(`[data-message-id="${ue(
|
|
7508
|
-
const se = this._messages.indexOf(
|
|
7522
|
+
const S = T;
|
|
7523
|
+
E && !T && v(), E = !1, this._maybeHidePreservedMobilePanel(e.type, S), T = !1;
|
|
7524
|
+
const P = d.content != null && d.content.length > 0 || u.length > 0 || S, $ = d.silent || P, I = typeof navigator < "u" && navigator.onLine === !1 && Qt(f), j = () => {
|
|
7525
|
+
this._shadow?.querySelector(`[data-message-id="${ue(d.id)}"]`)?.remove();
|
|
7526
|
+
const se = this._messages.indexOf(d);
|
|
7509
7527
|
se >= 0 && this._messages.splice(se, 1);
|
|
7510
7528
|
};
|
|
7511
7529
|
let Q = !1;
|
|
@@ -7530,36 +7548,36 @@ var Fo = class Me extends Ya {
|
|
|
7530
7548
|
j(), Q = !0, this._drawer?.showErrorWithRecovery(w, Y);
|
|
7531
7549
|
return;
|
|
7532
7550
|
}
|
|
7533
|
-
|
|
7551
|
+
d.content = w, d.status = "done";
|
|
7534
7552
|
const ce = ve(w.replace(/\r\n/g, `
|
|
7535
7553
|
`).split(`
|
|
7536
7554
|
`).join("<br />"));
|
|
7537
|
-
this._ensureAssistantMessageRendered(
|
|
7555
|
+
this._ensureAssistantMessageRendered(d), this._drawer?.updateBotMessage(d.id, ce), this._drawer?.showRecoveryPillsOnly(Y);
|
|
7538
7556
|
};
|
|
7539
7557
|
if (s && !P) if (c || this._hasUnavailableProductContext()) {
|
|
7540
7558
|
this._drawer?.setPills([]);
|
|
7541
7559
|
const se = this._i18n.productNotFoundMessage;
|
|
7542
|
-
|
|
7543
|
-
} else
|
|
7560
|
+
d.content = se, d.status = "done", this._ensureAssistantMessageRendered(d), this._drawer?.updateBotMessage(d.id, se), this._markUnavailableProductContext();
|
|
7561
|
+
} else d.status = "done";
|
|
7544
7562
|
else if ($)
|
|
7545
|
-
this._drawer?.setPills([]),
|
|
7563
|
+
this._drawer?.setPills([]), d.silent || te();
|
|
7546
7564
|
else if (te(), I) return;
|
|
7547
|
-
s && (this._contextPrimingInFlight = !1, this._flushQueuedUserMessages()), !Q &&
|
|
7565
|
+
s && (this._contextPrimingInFlight = !1, this._flushQueuedUserMessages()), !Q && d.status === "streaming" && (d.status = "error");
|
|
7548
7566
|
},
|
|
7549
7567
|
onDone: () => {
|
|
7550
7568
|
if (K && this._abortControllers.delete(K), !o && i !== this._activeRequestThreadId) return;
|
|
7551
|
-
if (X = !0,
|
|
7569
|
+
if (X = !0, z && this._panel && this._drawer) {
|
|
7552
7570
|
const I = this._buildRenderContext();
|
|
7553
7571
|
I.isStreaming = !1;
|
|
7554
|
-
const j =
|
|
7572
|
+
const j = z.elements[z.root], Q = this._panel.toPanelSpec(z);
|
|
7555
7573
|
this._applyPanelListHeadingToContext(I, {
|
|
7556
7574
|
kind: "spec",
|
|
7557
7575
|
spec: Q
|
|
7558
7576
|
});
|
|
7559
7577
|
const te = j?.type ?? "ProductGrid";
|
|
7560
|
-
ne(Q, I, te), W(te, j, "replace", !1),
|
|
7578
|
+
ne(Q, I, te), W(te, j, "replace", !1), T = !0;
|
|
7561
7579
|
}
|
|
7562
|
-
|
|
7580
|
+
z = null, D && O(!1), k(), !o && i === this._activeRequestThreadId && (this._activeRequestThreadId = null), this._consecutiveErrorCount = 0, this._lastErrorMessage = "", r(!1), this._bridge?.send("loadingMessage", { text: null }), this._drawer?.removeTypingIndicator(), $n(R, {
|
|
7563
7581
|
drawer: this._drawer,
|
|
7564
7582
|
ensureRendered: () => {
|
|
7565
7583
|
},
|
|
@@ -7568,33 +7586,33 @@ var Fo = class Me extends Ya {
|
|
|
7568
7586
|
sendSkipMessage: () => this._sendMessage(this._i18n.beautyPhotoStepSkipMessage),
|
|
7569
7587
|
streamDone: !0
|
|
7570
7588
|
});
|
|
7571
|
-
const f =
|
|
7572
|
-
if (
|
|
7589
|
+
const f = T;
|
|
7590
|
+
if (E && !T && v(), E = !1, this._maybeHidePreservedMobilePanel(e.type, f), c && !u && !f) {
|
|
7573
7591
|
const I = this._i18n.productNotFoundMessage;
|
|
7574
|
-
|
|
7592
|
+
d.content = I, this._ensureAssistantMessageRendered(d), this._drawer?.updateBotMessage(d.id, I), this._markUnavailableProductContext();
|
|
7575
7593
|
}
|
|
7576
|
-
if (
|
|
7594
|
+
if (T = !1, s) {
|
|
7577
7595
|
this._contextPrimingInFlight = !1;
|
|
7578
7596
|
const I = this._queuedUserMessages.length > 0;
|
|
7579
7597
|
this._flushQueuedUserMessages(), !I && c && this._ensurePdpPrimeSuggestedUiIfNeeded(l);
|
|
7580
7598
|
}
|
|
7581
|
-
|
|
7599
|
+
d.status === "streaming" && (d.status = "done", yt()), this._presentation.finalizeAssistantGroup(i);
|
|
7582
7600
|
const S = this._shadow?.querySelector(".gengage-chat-comparison-toggle-btn--hidden");
|
|
7583
|
-
S && (S.classList.remove("gengage-chat-comparison-toggle-btn--hidden"), S.classList.add("gengage-chat-comparison-toggle-btn--reveal")), this.emit("message",
|
|
7601
|
+
S && (S.classList.remove("gengage-chat-comparison-toggle-btn--hidden"), S.classList.add("gengage-chat-comparison-toggle-btn--reveal")), this.emit("message", d);
|
|
7584
7602
|
const P = this._currentPanelSource, $ = P ? this._clonePanelSourceForHistory(P) : null;
|
|
7585
|
-
this._panel?.snapshotForMessage(
|
|
7603
|
+
this._panel?.snapshotForMessage(d.id, $ ? {
|
|
7586
7604
|
source: $,
|
|
7587
|
-
threadId:
|
|
7605
|
+
threadId: d.threadId,
|
|
7588
7606
|
rebuild: () => {
|
|
7589
7607
|
const I = this._buildRenderContext();
|
|
7590
7608
|
return this._renderPanelFromSource($, I);
|
|
7591
7609
|
}
|
|
7592
|
-
} : void 0), this._maybeAddPanelRestoreMessage(
|
|
7610
|
+
} : void 0), this._maybeAddPanelRestoreMessage(d), this._persistConversationState();
|
|
7593
7611
|
}
|
|
7594
7612
|
}, _), this._abortControllers.add(K), !a?.silent && !o) {
|
|
7595
7613
|
const f = K;
|
|
7596
7614
|
this._drawer?.showStopButton(() => {
|
|
7597
|
-
f.abort(), this._abortControllers.delete(f), this._drawer?.removeTypingIndicator(), r(!1), this._bridge?.send("loadingMessage", { text: null }),
|
|
7615
|
+
f.abort(), this._abortControllers.delete(f), this._drawer?.removeTypingIndicator(), r(!1), this._bridge?.send("loadingMessage", { text: null }), d.status === "streaming" && (d.status = "done");
|
|
7598
7616
|
});
|
|
7599
7617
|
}
|
|
7600
7618
|
}
|
|
@@ -7927,10 +7945,10 @@ var Fo = class Me extends Ya {
|
|
|
7927
7945
|
});
|
|
7928
7946
|
const l = document.createElement("div");
|
|
7929
7947
|
l.className = "gengage-chat-history-item-title-row";
|
|
7930
|
-
const d = document.createElement("span");
|
|
7931
|
-
d.className = "gengage-chat-history-item-title", d.textContent = o.title, l.appendChild(d);
|
|
7932
7948
|
const p = document.createElement("span");
|
|
7933
|
-
p.className = "gengage-chat-history-item-
|
|
7949
|
+
p.className = "gengage-chat-history-item-title", p.textContent = o.title, l.appendChild(p);
|
|
7950
|
+
const g = document.createElement("span");
|
|
7951
|
+
g.className = "gengage-chat-history-item-meta", g.textContent = this._formatHistoryTimestamp(o.updatedAt), l.appendChild(g), c.appendChild(l);
|
|
7934
7952
|
const h = document.createElement("p");
|
|
7935
7953
|
h.className = "gengage-chat-history-item-preview", h.textContent = this._resolveHistoryPreviewText(o), c.appendChild(h), s.appendChild(c);
|
|
7936
7954
|
const m = document.createElement("button");
|
|
@@ -8102,50 +8120,50 @@ var Fo = class Me extends Ya {
|
|
|
8102
8120
|
if (o && i.sku && i.sku !== o) return;
|
|
8103
8121
|
this._markCurrentContextLaunchHandled(), this._drawer?.lockScrollForRestore(), this._currentThreadId = i.currentThreadId, this._lastThreadId = i.lastThreadId, this._currentThreadId && this._lastThreadId && this._currentThreadId > this._lastThreadId && (this._currentThreadId = this._lastThreadId), this._chatCreatedAt = i.createdAt, i.panelThreads && (this._panel.threads = i.panelThreads);
|
|
8104
8122
|
const s = this._panelThreadIdByMessageId(i.messages);
|
|
8105
|
-
if (i.panelSnapshotHtml) for (const [l,
|
|
8106
|
-
const
|
|
8107
|
-
|
|
8123
|
+
if (i.panelSnapshotHtml) for (const [l, p] of Object.entries(i.panelSnapshotHtml)) {
|
|
8124
|
+
const g = document.createElement("div");
|
|
8125
|
+
g.innerHTML = ve(p), this._panel.snapshots.set(l, g);
|
|
8108
8126
|
}
|
|
8109
|
-
if (i.panelSnapshotTypes) for (const [l,
|
|
8127
|
+
if (i.panelSnapshotTypes) for (const [l, p] of Object.entries(i.panelSnapshotTypes)) this._panel.snapshotTypes.set(l, p);
|
|
8110
8128
|
this._restorePanelSnapshotSources(i.panelSnapshotSources, s), i.panelAiSpecByThread && this._restorePanelAiSpecMap(i.panelAiSpecByThread);
|
|
8111
8129
|
let c = 0;
|
|
8112
8130
|
for (const l of i.messages) {
|
|
8113
|
-
const
|
|
8131
|
+
const p = {
|
|
8114
8132
|
id: l.id,
|
|
8115
8133
|
role: l.role,
|
|
8116
8134
|
timestamp: l.timestamp,
|
|
8117
8135
|
status: l.status
|
|
8118
8136
|
};
|
|
8119
|
-
if (l.threadId !== void 0 && (
|
|
8120
|
-
if (
|
|
8121
|
-
const m = await this._loadPayload(
|
|
8122
|
-
m && (
|
|
8137
|
+
if (l.threadId !== void 0 && (p.threadId = l.threadId), l.content !== void 0 && (p.content = l.content), l.frontendOnly && (p.frontendOnly = !0), l.silent && (p.silent = !0), this._messages.push(p), p.silent) continue;
|
|
8138
|
+
if (p.role === "assistant" && p.threadId) {
|
|
8139
|
+
const m = await this._loadPayload(p.threadId, p.id);
|
|
8140
|
+
m && (p.uiSpec = m, this._hydrateRestoredUISpecMetadata(p.id, p.threadId, m));
|
|
8123
8141
|
}
|
|
8124
|
-
const
|
|
8125
|
-
|
|
8142
|
+
const g = p.role !== "assistant" || !!p.content || !!p.attachment || this._isMessageHostedUISpec(p.uiSpec);
|
|
8143
|
+
p.role === "assistant" && p.threadId && g && !this._threadsWithFirstBot.has(p.threadId) && (this._threadsWithFirstBot.add(p.threadId), this._drawer?.markFirstBotMessage(p.id)), this._drawer?.addMessage(p);
|
|
8126
8144
|
const h = parseInt(l.id.replace("msg-", ""), 10);
|
|
8127
|
-
!isNaN(h) && h > c && (c = h),
|
|
8145
|
+
!isNaN(h) && h > c && (c = h), p.uiSpec && (this._isMessageHostedUISpec(p.uiSpec) || this._restoreInlineUISpec(p), delete p.uiSpec);
|
|
8128
8146
|
}
|
|
8129
8147
|
if (c > this._currentMessageId && (this._currentMessageId = c), this._currentThreadId) {
|
|
8130
8148
|
let l = await this._session.db?.loadContext(a, this._currentThreadId);
|
|
8131
8149
|
l || (l = await this._session.db?.loadLatestContext(a)), l && (this._lastBackendContext = l.context);
|
|
8132
8150
|
}
|
|
8133
8151
|
if (this._currentThreadId) {
|
|
8134
|
-
const l = [...this._messages].reverse().find((
|
|
8152
|
+
const l = [...this._messages].reverse().find((p) => p.role === "assistant" && p.threadId === this._currentThreadId && !p.silent);
|
|
8135
8153
|
l && (this._panel.snapshots.has(l.id) || this._panel?.sourceForMessage(l.id)) && (this._panel?.restoreForMessage(l.id) ?? !1) && (this._currentPanelSource = this._panel?.sourceForMessage(l.id) ?? this._panelSourceFromMessage(l), this._restorePanelAiZoneForThread(this._currentThreadId));
|
|
8136
8154
|
}
|
|
8137
8155
|
if (this._currentThreadId) {
|
|
8138
8156
|
const l = this._currentThreadId;
|
|
8139
|
-
for (const
|
|
8140
|
-
this._shadow?.querySelectorAll("[data-thread-id]").forEach((
|
|
8141
|
-
|
|
8157
|
+
for (const p of this._messages) p.threadId && p.threadId > l && this._shadow?.querySelector(`[data-message-id="${ue(p.id)}"]`)?.classList.add("gengage-chat-bubble--hidden");
|
|
8158
|
+
this._shadow?.querySelectorAll("[data-thread-id]").forEach((p) => {
|
|
8159
|
+
p instanceof HTMLElement && p.dataset.threadId && p.dataset.threadId > l && p.classList.add("gengage-chat-bubble--hidden");
|
|
8142
8160
|
});
|
|
8143
8161
|
}
|
|
8144
8162
|
if (this._panel.threads.length > 0 && this._currentThreadId) {
|
|
8145
8163
|
const l = this._panel.threads[this._panel.threads.length - 1];
|
|
8146
8164
|
if (l) {
|
|
8147
|
-
const
|
|
8148
|
-
|
|
8165
|
+
const p = [...this._messages].reverse().find((h) => h.role === "assistant" && h.threadId === l && ((this._panel?.snapshots.has(h.id) ?? !1) || this._panel?.sourceForMessage(h.id))), g = p ? this._panel?.snapshotTypes.get(p.id) : void 0;
|
|
8166
|
+
g && this._panel?.updateTopBar(g);
|
|
8149
8167
|
}
|
|
8150
8168
|
}
|
|
8151
8169
|
this._presentation.releaseFocusedThread(), this._drawer?.setPresentationFocus(null), setTimeout(() => {
|
|
@@ -8224,10 +8242,10 @@ var Fo = class Me extends Ya {
|
|
|
8224
8242
|
c && s.classList.add("gengage-chat-comparison-select-wrapper--selected");
|
|
8225
8243
|
const l = document.createElement("button");
|
|
8226
8244
|
l.type = "button", l.className = "gengage-chat-comparison-checkbox", l.dataset.selected = c ? "true" : "false", l.setAttribute("aria-pressed", c ? "true" : "false");
|
|
8227
|
-
const d = document.createElement("span");
|
|
8228
|
-
d.className = "gengage-chat-comparison-checkbox-icon", d.innerHTML = c ? '<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M20 6L9 17l-5-5"/></svg>' : '<span class="gengage-chat-comparison-checkbox-dot"></span>';
|
|
8229
8245
|
const p = document.createElement("span");
|
|
8230
|
-
p.className = "gengage-chat-comparison-checkbox-
|
|
8246
|
+
p.className = "gengage-chat-comparison-checkbox-icon", p.innerHTML = c ? '<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M20 6L9 17l-5-5"/></svg>' : '<span class="gengage-chat-comparison-checkbox-dot"></span>';
|
|
8247
|
+
const g = document.createElement("span");
|
|
8248
|
+
g.className = "gengage-chat-comparison-checkbox-label", g.textContent = c ? this._i18n.comparisonSelectedLabel ?? "Selected" : this._i18n.comparisonSelectLabel ?? "Select to compare", l.appendChild(p), l.appendChild(g), l.addEventListener("click", (h) => {
|
|
8231
8249
|
h.stopPropagation(), this._toggleComparisonSku(o);
|
|
8232
8250
|
}), i.parentNode.insertBefore(s, i), s.appendChild(l), s.appendChild(i), s.classList.add("gds-clickable"), s.addEventListener("click", (h) => {
|
|
8233
8251
|
h.target.closest(".gengage-chat-comparison-checkbox") || (h.stopPropagation(), this._toggleComparisonSku(o));
|
|
@@ -8588,10 +8606,10 @@ var Fo = class Me extends Ya {
|
|
|
8588
8606
|
const n = a.spec.elements[a.spec.root];
|
|
8589
8607
|
if (!n || n.type !== "ProductGrid" || gt(n)) return;
|
|
8590
8608
|
const r = (n.children ?? []).map((l) => {
|
|
8591
|
-
const
|
|
8592
|
-
return
|
|
8593
|
-
imageUrl: typeof
|
|
8594
|
-
name: typeof
|
|
8609
|
+
const p = a.spec.elements[l]?.props?.product;
|
|
8610
|
+
return p ? {
|
|
8611
|
+
imageUrl: typeof p.imageUrl == "string" ? p.imageUrl : void 0,
|
|
8612
|
+
name: typeof p.name == "string" ? p.name : void 0
|
|
8595
8613
|
} : null;
|
|
8596
8614
|
}).filter((l) => l !== null).slice(0, 3);
|
|
8597
8615
|
if (r.length === 0) return;
|
|
@@ -8688,8 +8706,8 @@ var Fo = class Me extends Ya {
|
|
|
8688
8706
|
type: "ProductSummaryCard",
|
|
8689
8707
|
props: { product: c }
|
|
8690
8708
|
} }
|
|
8691
|
-
},
|
|
8692
|
-
e.threadId && (
|
|
8709
|
+
}, p = this._renderUISpec(l, i);
|
|
8710
|
+
e.threadId && (p.dataset.threadId = e.threadId), o.appendChild(p), this._drawer?.refreshPresentationCollapsed();
|
|
8693
8711
|
return;
|
|
8694
8712
|
}
|
|
8695
8713
|
const s = this._renderUISpec(a, i);
|