@gengage/assistant-fe 0.6.44 → 0.6.46
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/productMentionLinker.d.ts +5 -5
- package/dist/chat/runtime.d.ts +3 -0
- package/dist/chat/types.d.ts +6 -0
- package/dist/chat-runtime.js +1 -1
- package/dist/chat.iife.js +26 -26
- package/dist/chat.js +1 -1
- package/dist/common/transport.d.ts +1 -0
- package/dist/common/types.d.ts +1 -0
- package/dist/{common-B_QhTwRK.js → common-BYaIofv0.js} +1 -1
- package/dist/common.js +5 -5
- package/dist/{connection-warning-DjGsAS1h.js → connection-warning-BWCgMHwN.js} +1 -1
- package/dist/{fastIntent-DOgXE46i.js → fastIntent-BfYLNhFF.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 +10 -10
- package/dist/qna.js +1 -1
- package/dist/request-response-cache-DxtNGhlh.js +1491 -0
- package/dist/{runtime-BJiDilHj.js → runtime-B9k46n2p.js} +3 -3
- package/dist/{runtime-D39A30T-.js → runtime-DBmJg9TG.js} +613 -579
- package/dist/{runtime-Cr3f6wjm.js → runtime-IlZ-GH68.js} +3 -3
- package/dist/{simbut-C-2-g2V1.js → simbut-CobYs9jE.js} +1 -1
- package/dist/simbut.iife.js +1 -1
- package/dist/simbut.js +1 -1
- package/dist/{simrel-BaahIAgs.js → simrel-BEyFl3Ec.js} +1 -1
- package/dist/simrel-runtime.js +1 -1
- package/dist/simrel.iife.js +2 -2
- package/dist/simrel.js +2 -2
- package/dist/{widget-base-DRNUkp-i.js → widget-base-BsHKmSMq.js} +1 -1
- package/package.json +1 -1
- package/dist/request-response-cache-Ddw59jGs.js +0 -1475
|
@@ -1,8 +1,8 @@
|
|
|
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-
|
|
2
|
-
import { A as Ce, C as Ma, D as Na, E as Ba, M as de, N as
|
|
3
|
-
import { i as ze, s as Qt, t as Ya } from "./widget-base-
|
|
4
|
-
import { d as
|
|
5
|
-
import { t as
|
|
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-DxtNGhlh.js";
|
|
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-BsHKmSMq.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-BfYLNhFF.js";
|
|
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() {
|
|
8
8
|
const t = Date.now(), e = new Uint8Array(16);
|
|
@@ -300,6 +300,7 @@ function bn() {
|
|
|
300
300
|
var Re = {
|
|
301
301
|
headerTitle: "Ürün Uzmanı",
|
|
302
302
|
inputPlaceholder: "Ürün ara, soru sor",
|
|
303
|
+
inputAriaLabel: "Mesajınızı yazın",
|
|
303
304
|
sendButton: "Gönder",
|
|
304
305
|
closeButton: "Kapat",
|
|
305
306
|
openButton: "Sohbeti aç",
|
|
@@ -447,6 +448,7 @@ var Re = {
|
|
|
447
448
|
}, vn = {
|
|
448
449
|
headerTitle: "Product Expert",
|
|
449
450
|
inputPlaceholder: "Search products, ask questions",
|
|
451
|
+
inputAriaLabel: "Type your message",
|
|
450
452
|
sendButton: "Send",
|
|
451
453
|
closeButton: "Close",
|
|
452
454
|
openButton: "Open chat",
|
|
@@ -602,7 +604,7 @@ function wn(t) {
|
|
|
602
604
|
const e = document.createElement("div");
|
|
603
605
|
e.className = "gengage-chat-kvkk-banner", e.dataset.gengagePart = "kvkk-banner", e.setAttribute("role", "note");
|
|
604
606
|
const a = document.createElement("div");
|
|
605
|
-
return a.className = "gengage-chat-kvkk-content", a.dataset.gengagePart = "kvkk-content", a.innerHTML =
|
|
607
|
+
return a.className = "gengage-chat-kvkk-content", a.dataset.gengagePart = "kvkk-content", a.innerHTML = ve(t.htmlContent), e.appendChild(a), e;
|
|
606
608
|
}
|
|
607
609
|
var _n = class {
|
|
608
610
|
constructor(t) {
|
|
@@ -822,7 +824,7 @@ var Bn = class {
|
|
|
822
824
|
t.className = "gengage-chat-footer", t.dataset.gengagePart = "chat-footer";
|
|
823
825
|
const e = this._options.footerAttribution, a = typeof e?.label == "string" ? e.label.trim() : "", n = typeof e?.href == "string" ? e.href.trim() : "", r = typeof this.i18n.poweredBy == "string" ? this.i18n.poweredBy.trim() : "", i = a || r;
|
|
824
826
|
if (!i) return null;
|
|
825
|
-
if (n &&
|
|
827
|
+
if (n && he(n)) {
|
|
826
828
|
const o = document.createElement("a");
|
|
827
829
|
return o.className = "gengage-chat-footer-link", o.dataset.gengagePart = "chat-footer-link", o.href = n, o.target = e?.target || "_blank", o.rel = e?.rel || "noopener noreferrer", o.textContent = i, typeof e?.ariaLabel == "string" && e.ariaLabel.trim() && o.setAttribute("aria-label", e.ariaLabel.trim()), t.appendChild(o), t;
|
|
828
830
|
}
|
|
@@ -837,8 +839,8 @@ var Bn = class {
|
|
|
837
839
|
n.id = a, n.className = "gengage-sr-only", n.textContent = this.i18n.headerTitle ?? "AI shopping assistant", this.root.appendChild(n), this.root.setAttribute("aria-describedby", a);
|
|
838
840
|
let r = null;
|
|
839
841
|
{
|
|
840
|
-
const
|
|
841
|
-
|
|
842
|
+
const w = document.createElement("div");
|
|
843
|
+
w.className = "gengage-chat-drawer-handle", w.dataset.gengagePart = "chat-drawer-handle", w.setAttribute("aria-hidden", "true"), w.style.pointerEvents = "none", r = w;
|
|
842
844
|
}
|
|
843
845
|
const i = document.createElement("div");
|
|
844
846
|
i.className = "gengage-chat-header gds-shell-header", i.dataset.gengagePart = "chat-header";
|
|
@@ -846,8 +848,8 @@ var Bn = class {
|
|
|
846
848
|
o.className = "gengage-chat-header-left", o.dataset.gengagePart = "chat-header-left";
|
|
847
849
|
const s = e.headerAvatarUrl ?? e.launcherImageUrl, c = typeof e.headerAvatarUrl == "string" && e.headerAvatarUrl.length > 0 && e.headerAvatarUrl !== e.launcherImageUrl;
|
|
848
850
|
if (s) {
|
|
849
|
-
const
|
|
850
|
-
|
|
851
|
+
const w = document.createElement("img");
|
|
852
|
+
w.className = "gengage-chat-header-avatar", c && w.classList.add("gengage-chat-header-avatar--logo"), w.dataset.gengagePart = "chat-header-avatar", w.src = s, w.alt = e.headerTitle ?? "Assistant", o.appendChild(w);
|
|
851
853
|
}
|
|
852
854
|
const l = document.createElement("div");
|
|
853
855
|
l.className = "gengage-chat-header-info", l.dataset.gengagePart = "chat-header-info";
|
|
@@ -855,65 +857,65 @@ var Bn = class {
|
|
|
855
857
|
d.className = "gengage-chat-header-title-row", d.dataset.gengagePart = "chat-header-title-row";
|
|
856
858
|
const p = document.createElement("span");
|
|
857
859
|
if (p.className = "gengage-chat-header-title", p.dataset.gengagePart = "chat-header-title", p.textContent = e.headerTitle ?? this.i18n.headerTitle ?? "Product Expert", d.appendChild(p), e.headerBadge) {
|
|
858
|
-
const
|
|
859
|
-
|
|
860
|
+
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, d.appendChild(w);
|
|
860
862
|
}
|
|
861
863
|
if (l.appendChild(d), e.footerAttribution === void 0) {
|
|
862
|
-
const
|
|
863
|
-
|
|
864
|
+
const w = this._createLegacyHeaderPoweredBy();
|
|
865
|
+
w && l.appendChild(w);
|
|
864
866
|
}
|
|
865
867
|
o.appendChild(l), i.appendChild(o);
|
|
866
868
|
const h = document.createElement("div");
|
|
867
869
|
h.className = "gengage-chat-header-right", h.dataset.gengagePart = "chat-header-actions";
|
|
868
870
|
{
|
|
869
|
-
const
|
|
870
|
-
|
|
871
|
+
const w = document.createElement("button");
|
|
872
|
+
w.type = "button", w.className = "gengage-chat-header-btn gengage-chat-header-btn--reopen-panel gds-btn gds-btn-ghost gds-icon-btn", w.dataset.gengagePart = "chat-header-reopen-panel", w.setAttribute("aria-label", this.i18n.showPanelAriaLabel), w.innerHTML = '<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="2"/><line x1="9" y1="3" x2="9" y2="21"/></svg>', w.addEventListener("click", () => this._showMobilePanelFromBtn()), h.appendChild(w), this._reopenPanelBtn = w;
|
|
871
873
|
}
|
|
872
874
|
if (e.headerCartUrl || e.onCartClick) {
|
|
873
|
-
const
|
|
874
|
-
|
|
875
|
+
const w = document.createElement("button");
|
|
876
|
+
w.type = "button", w.className = "gengage-chat-header-btn gengage-chat-header-btn--cart gds-btn gds-btn-ghost gds-icon-btn", w.dataset.gengagePart = "chat-header-cart", w.setAttribute("aria-label", this.i18n.cartAriaLabel), w.title = this.i18n.cartAriaLabel, w.innerHTML = '<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="9" cy="21" r="1"/><circle cx="20" cy="21" r="1"/><path d="M1 1h4l2.68 13.39a2 2 0 0 0 2 1.61h9.72a2 2 0 0 0 2-1.61L23 6H6"/></svg>', w.addEventListener("click", () => e.onCartClick?.()), h.appendChild(w), this._cartBtn = w;
|
|
875
877
|
}
|
|
876
878
|
if (e.onHistoryClick) {
|
|
877
|
-
const
|
|
878
|
-
|
|
879
|
+
const w = document.createElement("button");
|
|
880
|
+
w.type = "button", w.className = "gengage-chat-header-btn gengage-chat-header-btn--history gds-btn gds-btn-ghost gds-icon-btn", w.dataset.gengagePart = "chat-header-history", w.setAttribute("aria-label", this.i18n.historyAriaLabel), w.title = this.i18n.historyAriaLabel, w.innerHTML = '<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 8v5l3 2"/><path d="M3.05 11A9 9 0 1 1 5 17.5"/><path d="M3 8v4h4"/></svg>', w.addEventListener("click", () => e.onHistoryClick?.()), h.appendChild(w);
|
|
879
881
|
}
|
|
880
882
|
if (e.onNewChat) {
|
|
881
|
-
const
|
|
882
|
-
|
|
883
|
+
const w = document.createElement("button");
|
|
884
|
+
w.className = "gengage-chat-header-btn gengage-chat-new-chat gds-btn gds-btn-ghost gds-icon-btn", w.dataset.gengagePart = "chat-header-new-chat", w.type = "button", w.setAttribute("aria-label", this.i18n.newChatButton), w.title = this.i18n.newChatButton, w.innerHTML = '<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 20h9"/><path d="M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"/></svg>', w.addEventListener("click", () => e.onNewChat?.()), h.appendChild(w);
|
|
883
885
|
}
|
|
884
886
|
const m = document.createElement("button");
|
|
885
887
|
if (m.className = "gengage-chat-close gds-btn gds-btn-ghost gds-icon-btn", m.dataset.gengagePart = "chat-header-close", m.type = "button", m.setAttribute("aria-label", this.i18n.closeButton), m.innerHTML = '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>', m.addEventListener("click", e.onClose), e.showHeaderFavorites) {
|
|
886
|
-
const
|
|
887
|
-
|
|
888
|
+
const w = document.createElement("button");
|
|
889
|
+
w.className = "gengage-chat-header-btn gengage-chat-header-btn--fav gds-btn gds-btn-ghost gds-icon-btn", w.dataset.gengagePart = "chat-header-favorites", w.type = "button", w.setAttribute("aria-label", this.i18n.favoritesAriaLabel), w.innerHTML = '<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"/></svg>';
|
|
888
890
|
const Y = document.createElement("span");
|
|
889
|
-
Y.className = "gengage-chat-header-fav-badge", Y.dataset.gengagePart = "chat-header-favorites-badge", Y.setAttribute("aria-hidden", "true"), Y.style.display = "none",
|
|
891
|
+
Y.className = "gengage-chat-header-fav-badge", Y.dataset.gengagePart = "chat-header-favorites-badge", Y.setAttribute("aria-hidden", "true"), Y.style.display = "none", w.appendChild(Y), this._favBadgeEl = Y, w.addEventListener("click", () => {
|
|
890
892
|
e.onFavoritesClick?.();
|
|
891
|
-
}), h.appendChild(
|
|
893
|
+
}), h.appendChild(w);
|
|
892
894
|
}
|
|
893
895
|
h.appendChild(m), r && i.insertBefore(r, i.firstChild), i.appendChild(h);
|
|
894
896
|
{
|
|
895
|
-
let Y = 0, ce = 0,
|
|
897
|
+
let Y = 0, ce = 0, oe = !1;
|
|
896
898
|
const M = (V) => {
|
|
897
899
|
if (!(this._options.getMobileViewport?.() ?? window.innerWidth <= 768) || V.target.closest('button, a, input, [role="button"]')) return;
|
|
898
900
|
const G = V.changedTouches?.[0];
|
|
899
|
-
G && (Y = G.clientY, ce = 0,
|
|
901
|
+
G && (Y = G.clientY, ce = 0, oe = !0, this.root.style.transition = "none");
|
|
900
902
|
}, H = (V) => {
|
|
901
|
-
if (!
|
|
903
|
+
if (!oe) return;
|
|
902
904
|
const G = V.changedTouches?.[0];
|
|
903
905
|
if (!G) return;
|
|
904
906
|
ce = G.clientY - Y;
|
|
905
907
|
const J = (e.getMobileState?.() ?? "full") === "full" ? Math.max(0, ce) : ce;
|
|
906
908
|
V.preventDefault(), this.root.style.transform = `translateY(${J}px)`;
|
|
907
909
|
}, ee = () => {
|
|
908
|
-
if (!
|
|
909
|
-
|
|
910
|
+
if (!oe) return;
|
|
911
|
+
oe = !1;
|
|
910
912
|
const V = e.getMobileState?.() ?? "full";
|
|
911
913
|
let G;
|
|
912
914
|
ce > 72 ? G = V === "full" ? "half" : "close" : ce < -72 && V === "half" ? G = "full" : G = V, this.root.style.transition = "", G === "close" ? (this.root.style.transform = "translateY(100%)", setTimeout(() => {
|
|
913
915
|
this.root.style.transform = "", e.onMobileSnap?.("close");
|
|
914
916
|
}, 280)) : (this.root.style.transform = "", e.onMobileSnap?.(G)), ce = 0;
|
|
915
917
|
}, pe = () => {
|
|
916
|
-
|
|
918
|
+
oe && (oe = !1, ce = 0, this.root.style.transition = "", this.root.style.transform = "");
|
|
917
919
|
};
|
|
918
920
|
i.addEventListener("touchstart", M, { passive: !0 }), i.addEventListener("touchmove", H, { passive: !1 }), i.addEventListener("touchend", ee, { passive: !0 }), i.addEventListener("touchcancel", pe, { passive: !0 }), this._cleanups.push(() => {
|
|
919
921
|
i.removeEventListener("touchstart", M), i.removeEventListener("touchmove", H), i.removeEventListener("touchend", ee), i.removeEventListener("touchcancel", pe);
|
|
@@ -941,17 +943,17 @@ var Bn = class {
|
|
|
941
943
|
this.togglePanel(), this._onPanelToggle?.();
|
|
942
944
|
});
|
|
943
945
|
let g = null, _ = null;
|
|
944
|
-
const
|
|
946
|
+
const y = 24, b = (w) => {
|
|
945
947
|
if (!(this._options.getMobileViewport?.() ?? window.innerWidth <= 768)) return;
|
|
946
|
-
const Y =
|
|
948
|
+
const Y = w.changedTouches?.[0];
|
|
947
949
|
Y && (g = Y.clientX, _ = Y.clientY);
|
|
948
|
-
}, A = (
|
|
950
|
+
}, A = (w) => {
|
|
949
951
|
if (!(this._options.getMobileViewport?.() ?? window.innerWidth <= 768) || g === null || _ === null) return;
|
|
950
|
-
const Y =
|
|
952
|
+
const Y = w.changedTouches?.[0];
|
|
951
953
|
if (!Y) return;
|
|
952
|
-
const ce = Y.clientX - g,
|
|
953
|
-
if (g = null, _ = null, Math.abs(
|
|
954
|
-
const M =
|
|
954
|
+
const ce = Y.clientX - g, oe = Y.clientY - _;
|
|
955
|
+
if (g = null, _ = null, Math.abs(oe) < y || Math.abs(oe) < Math.abs(ce)) return;
|
|
956
|
+
const M = oe < 0;
|
|
955
957
|
M !== this._panelCollapsed && (this._ignoreNextDividerClick = !0, this.setPanelCollapsed(M), this._onPanelToggle?.());
|
|
956
958
|
};
|
|
957
959
|
this._dividerEl.addEventListener("touchstart", b, { passive: !0 }), this._dividerEl.addEventListener("touchend", A, { passive: !0 }), this._cleanups.push(() => {
|
|
@@ -961,14 +963,14 @@ var Bn = class {
|
|
|
961
963
|
T.className = "gengage-chat-conversation", T.dataset.gengagePart = "chat-conversation", this._conversationEl = T, T.appendChild(i);
|
|
962
964
|
const k = document.createElement("div");
|
|
963
965
|
k.className = "gengage-chat-offline-bar gds-evidence-card gds-evidence-card-warning", k.dataset.gengagePart = "chat-offline-bar", k.setAttribute("role", "status"), k.setAttribute("aria-live", "polite"), k.textContent = this.i18n.offlineMessage, typeof navigator < "u" && !navigator.onLine && k.classList.add("gengage-chat-offline-bar--visible"), T.appendChild(k);
|
|
964
|
-
const
|
|
965
|
-
window.addEventListener("offline",
|
|
966
|
-
window.removeEventListener("offline",
|
|
966
|
+
const L = () => k.classList.add("gengage-chat-offline-bar--visible"), z = () => k.classList.remove("gengage-chat-offline-bar--visible");
|
|
967
|
+
window.addEventListener("offline", L), window.addEventListener("online", z), this._cleanups.push(() => {
|
|
968
|
+
window.removeEventListener("offline", L), window.removeEventListener("online", z);
|
|
967
969
|
}), this._kvkkSlot = document.createElement("div"), this._kvkkSlot.className = "gengage-chat-kvkk-slot", this._kvkkSlot.dataset.gengagePart = "chat-kvkk-slot", T.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);
|
|
968
|
-
const
|
|
969
|
-
|
|
970
|
+
const O = document.createElement("button");
|
|
971
|
+
O.type = "button", O.className = "gengage-chat-former-messages-btn gds-chip", O.dataset.gengagePart = "chat-former-messages-button", O.textContent = this.i18n.showFormerMessagesButton, O.setAttribute("aria-label", this.i18n.showFormerMessagesButton), O.style.display = "none", O.addEventListener("click", () => {
|
|
970
972
|
this._options.presentation?.onReleasePresentationFocus?.();
|
|
971
|
-
}), this.messagesEl.appendChild(
|
|
973
|
+
}), this.messagesEl.appendChild(O), this._formerMessagesBtn = O;
|
|
972
974
|
const X = () => {
|
|
973
975
|
this._userInteractionUntil = Date.now() + 2e3;
|
|
974
976
|
};
|
|
@@ -976,28 +978,28 @@ var Bn = class {
|
|
|
976
978
|
const R = () => this._options.presentation, F = () => {
|
|
977
979
|
E || (E = !0, requestAnimationFrame(() => {
|
|
978
980
|
E = !1;
|
|
979
|
-
const { scrollTop:
|
|
980
|
-
this._userScrolledUp =
|
|
981
|
-
const M = this._presentationPinned ?
|
|
981
|
+
const { scrollTop: w, scrollHeight: Y, clientHeight: ce } = this.messagesEl, oe = Y - w - ce;
|
|
982
|
+
this._userScrolledUp = oe > 10;
|
|
983
|
+
const M = this._presentationPinned ? oe < 96 : oe < 32, H = Date.now(), ee = H < this._programmaticScrollUntil, pe = !M && H < this._userInteractionUntil, V = ee ? !1 : pe;
|
|
982
984
|
M !== this._presentationPinned && (this._presentationPinned = M, R()?.onPinnedToBottomChange?.(M)), V !== this._presentationUserInteracting && (this._presentationUserInteracting = V, R()?.onUserInteractingChange?.(V));
|
|
983
985
|
}));
|
|
984
986
|
};
|
|
985
987
|
this.messagesEl.addEventListener("scroll", F, { passive: !0 }), this._cleanups.push(() => {
|
|
986
988
|
this.messagesEl.removeEventListener("scroll", F);
|
|
987
989
|
});
|
|
988
|
-
const B = (
|
|
989
|
-
X(),
|
|
990
|
+
const B = (w) => {
|
|
991
|
+
X(), w.deltaY < -6 && this._presentationFocusThreadId && this._options.presentation?.onFormerMessagesHint?.();
|
|
990
992
|
};
|
|
991
993
|
this.messagesEl.addEventListener("wheel", B, { passive: !0 }), this._cleanups.push(() => this.messagesEl.removeEventListener("wheel", B));
|
|
992
|
-
const C = (
|
|
993
|
-
X(), this._touchStartY =
|
|
994
|
-
},
|
|
994
|
+
const C = (w) => {
|
|
995
|
+
X(), this._touchStartY = w.touches[0]?.clientY ?? null;
|
|
996
|
+
}, U = (w) => {
|
|
995
997
|
X();
|
|
996
|
-
const Y =
|
|
998
|
+
const Y = w.touches[0]?.clientY, ce = this._touchStartY;
|
|
997
999
|
typeof Y == "number" && typeof ce == "number" && Y - ce > 10 && this._presentationFocusThreadId && this._options.presentation?.onFormerMessagesHint?.();
|
|
998
1000
|
};
|
|
999
|
-
this.messagesEl.addEventListener("touchstart", C, { passive: !0 }), this.messagesEl.addEventListener("touchmove",
|
|
1000
|
-
this.messagesEl.removeEventListener("touchstart", C), this.messagesEl.removeEventListener("touchmove",
|
|
1001
|
+
this.messagesEl.addEventListener("touchstart", C, { passive: !0 }), this.messagesEl.addEventListener("touchmove", U, { passive: !0 }), this._cleanups.push(() => {
|
|
1002
|
+
this.messagesEl.removeEventListener("touchstart", C), this.messagesEl.removeEventListener("touchmove", U);
|
|
1001
1003
|
}), T.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";
|
|
1002
1004
|
const N = document.createElement("div");
|
|
1003
1005
|
N.className = "gengage-chat-pills-scroll", N.dataset.gengagePart = "chat-suggestion-pills-scroll", this._pillsEl.appendChild(N);
|
|
@@ -1012,26 +1014,26 @@ var Bn = class {
|
|
|
1012
1014
|
const ne = () => {
|
|
1013
1015
|
D || (D = !0, requestAnimationFrame(() => {
|
|
1014
1016
|
D = !1;
|
|
1015
|
-
const
|
|
1016
|
-
q.style.display =
|
|
1017
|
+
const w = N.scrollLeft + N.clientWidth >= N.scrollWidth - 4;
|
|
1018
|
+
q.style.display = w ? "none" : "";
|
|
1017
1019
|
}));
|
|
1018
1020
|
};
|
|
1019
1021
|
N.addEventListener("scroll", ne, { passive: !0 }), this._cleanups.push(() => {
|
|
1020
1022
|
N.removeEventListener("scroll", ne);
|
|
1021
1023
|
}), T.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", T.appendChild(this._inputChipsEl);
|
|
1022
1024
|
const W = document.createElement("div");
|
|
1023
|
-
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.addEventListener("input", () => {
|
|
1025
|
+
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", () => {
|
|
1024
1026
|
this._resizeRafId !== null && cancelAnimationFrame(this._resizeRafId), this._resizeRafId = requestAnimationFrame(() => {
|
|
1025
1027
|
this._resizeRafId = null, this.inputEl.style.height = "auto", this.inputEl.style.height = `${Math.min(this.inputEl.scrollHeight, 120)}px`;
|
|
1026
1028
|
}), this._updateSendEnabled();
|
|
1027
|
-
}), this.inputEl.addEventListener("keydown", (
|
|
1028
|
-
|
|
1029
|
-
}), this.inputEl.addEventListener("paste", (
|
|
1030
|
-
const Y =
|
|
1029
|
+
}), this.inputEl.addEventListener("keydown", (w) => {
|
|
1030
|
+
w.key === "Enter" && !w.isComposing && ((this._options.getMobileViewport?.() ?? window.innerWidth <= 768) || !w.shiftKey) && (w.preventDefault(), this._submit());
|
|
1031
|
+
}), this.inputEl.addEventListener("paste", (w) => {
|
|
1032
|
+
const Y = w.clipboardData;
|
|
1031
1033
|
if (!Y) return;
|
|
1032
1034
|
let ce = null;
|
|
1033
|
-
const
|
|
1034
|
-
if (
|
|
1035
|
+
const oe = Y.files?.[0];
|
|
1036
|
+
if (oe && oe.type.startsWith("image/")) ce = oe;
|
|
1035
1037
|
else if (Y.items?.length) for (let M = 0; M < Y.items.length; M++) {
|
|
1036
1038
|
const H = Y.items[M];
|
|
1037
1039
|
if (H?.kind === "file" && H.type.startsWith("image/")) {
|
|
@@ -1042,74 +1044,74 @@ var Bn = class {
|
|
|
1042
1044
|
}
|
|
1043
1045
|
}
|
|
1044
1046
|
}
|
|
1045
|
-
ce && (
|
|
1047
|
+
ce && (w.preventDefault(), this._routeAttachmentFile(ce));
|
|
1046
1048
|
}), this._fileInput = document.createElement("input"), this._fileInput.type = "file", this._fileInput.accept = "image/jpeg,image/png,image/webp", this._fileInput.style.display = "none", this._fileInput.addEventListener("change", () => {
|
|
1047
|
-
const
|
|
1048
|
-
|
|
1049
|
+
const w = this._fileInput.files?.[0];
|
|
1050
|
+
w && this._routeAttachmentFile(w), this._fileInput.value = "";
|
|
1049
1051
|
});
|
|
1050
1052
|
const K = document.createElement("div");
|
|
1051
1053
|
K.className = "gengage-chat-attach-wrap", K.dataset.gengagePart = "chat-attach-wrap", this._attachWrapEl = K;
|
|
1052
1054
|
const f = document.createElement("button");
|
|
1053
|
-
this._attachBtn = f, f.className = "gengage-chat-attach-btn gds-btn gds-btn-ghost", f.dataset.gengagePart = "chat-attach-button", f.type = "button", f.setAttribute("aria-label", this.i18n.attachImageButton), f.setAttribute("aria-haspopup", "menu"), f.setAttribute("aria-expanded", "false"), f.innerHTML = '<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z"/><circle cx="12" cy="13" r="4"/></svg>', f.addEventListener("click", (
|
|
1054
|
-
|
|
1055
|
+
this._attachBtn = f, f.className = "gengage-chat-attach-btn gds-btn gds-btn-ghost", f.dataset.gengagePart = "chat-attach-button", f.type = "button", f.setAttribute("aria-label", this.i18n.attachImageButton), f.setAttribute("aria-haspopup", "menu"), f.setAttribute("aria-expanded", "false"), f.innerHTML = '<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z"/><circle cx="12" cy="13" r="4"/></svg>', f.addEventListener("click", (w) => {
|
|
1056
|
+
w.stopPropagation(), this._toggleAttachMenu();
|
|
1055
1057
|
});
|
|
1056
1058
|
const S = document.createElement("div");
|
|
1057
1059
|
this._attachMenuEl = S, S.className = "gengage-chat-attach-menu gds-menu", S.dataset.gengagePart = "chat-attach-menu", S.setAttribute("role", "menu"), S.setAttribute("hidden", "");
|
|
1058
|
-
const
|
|
1059
|
-
|
|
1060
|
-
|
|
1060
|
+
const P = document.createElement("button");
|
|
1061
|
+
P.type = "button", P.className = "gengage-chat-attach-menu-item gds-btn gds-btn-ghost", P.dataset.gengagePart = "chat-attach-menu-select-photo", P.setAttribute("role", "menuitem"), P.innerHTML = `<span class="gengage-chat-attach-menu-icon" aria-hidden="true"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z"/><circle cx="12" cy="13" r="4"/></svg></span><span class="gengage-chat-attach-menu-label">${this.i18n.attachMenuSelectPhoto}</span>`, P.addEventListener("click", (w) => {
|
|
1062
|
+
w.stopPropagation(), this._closeAttachMenu(), this._fileInput.click();
|
|
1061
1063
|
});
|
|
1062
1064
|
const $ = document.createElement("div");
|
|
1063
1065
|
$.className = "gengage-chat-attach-menu-sep", $.dataset.gengagePart = "chat-attach-menu-separator", $.setAttribute("aria-hidden", "true");
|
|
1064
1066
|
const I = document.createElement("button");
|
|
1065
|
-
I.type = "button", I.className = "gengage-chat-attach-menu-item gds-btn gds-btn-ghost", I.dataset.gengagePart = "chat-attach-menu-paste", I.setAttribute("role", "menuitem"), I.innerHTML = `<span class="gengage-chat-attach-menu-icon" aria-hidden="true"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M15 2H9a1 1 0 0 0-1 1v1a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V3a1 1 0 0 0-1-1Z"/><path d="M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2"/><path d="M16 4h2a2 2 0 0 1 2 2v4"/><path d="M21 14H11"/><path d="m15 10-4 4 4 4"/></svg></span><span class="gengage-chat-attach-menu-label">${this.i18n.attachMenuPaste}</span>`, I.addEventListener("click", (
|
|
1066
|
-
|
|
1067
|
+
I.type = "button", I.className = "gengage-chat-attach-menu-item gds-btn gds-btn-ghost", I.dataset.gengagePart = "chat-attach-menu-paste", I.setAttribute("role", "menuitem"), I.innerHTML = `<span class="gengage-chat-attach-menu-icon" aria-hidden="true"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M15 2H9a1 1 0 0 0-1 1v1a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V3a1 1 0 0 0-1-1Z"/><path d="M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2"/><path d="M16 4h2a2 2 0 0 1 2 2v4"/><path d="M21 14H11"/><path d="m15 10-4 4 4 4"/></svg></span><span class="gengage-chat-attach-menu-label">${this.i18n.attachMenuPaste}</span>`, I.addEventListener("click", (w) => {
|
|
1068
|
+
w.stopPropagation();
|
|
1067
1069
|
const Y = typeof navigator.clipboard?.read == "function" ? navigator.clipboard.read() : void 0;
|
|
1068
1070
|
this._pasteImageFromClipboardMenu(Y);
|
|
1069
|
-
}), S.appendChild(
|
|
1071
|
+
}), S.appendChild(P), S.appendChild($), S.appendChild(I), K.appendChild(f), K.appendChild(S), this._previewStrip = document.createElement("div"), this._previewStrip.className = "gengage-chat-attachment-preview gengage-chat-attachment-preview--hidden gds-card-soft", this._previewStrip.dataset.gengagePart = "chat-attachment-preview";
|
|
1070
1072
|
const j = document.createElement("img");
|
|
1071
1073
|
j.className = "gengage-chat-attachment-preview-thumb", j.dataset.gengagePart = "chat-attachment-preview-thumb", j.alt = "", this._previewName = document.createElement("span"), this._previewName.className = "gengage-chat-attachment-name", this._previewName.dataset.gengagePart = "chat-attachment-preview-name";
|
|
1072
1074
|
const Q = document.createElement("button");
|
|
1073
1075
|
Q.className = "gengage-chat-attachment-remove gds-btn gds-btn-ghost", Q.dataset.gengagePart = "chat-attachment-preview-remove", Q.type = "button", Q.setAttribute("aria-label", this.i18n.removeAttachmentButton), Q.textContent = "×", Q.addEventListener("click", () => this.clearAttachment()), this._previewStrip.appendChild(j), this._previewStrip.appendChild(this._previewName), this._previewStrip.appendChild(Q), this.sendBtn = document.createElement("button"), this.sendBtn.className = "gengage-chat-send gds-btn gds-btn-primary", this.sendBtn.dataset.gengagePart = "chat-send", this.sendBtn.type = "button", this.sendBtn.disabled = !0, this.sendBtn.setAttribute("aria-label", this.i18n.sendButton), this.sendBtn.dataset.tooltip = this.i18n.sendButton, this._renderSendButtonIcon("send"), this.sendBtn.addEventListener("click", () => {
|
|
1074
1076
|
if (this._sendStopHandler) {
|
|
1075
|
-
const
|
|
1076
|
-
this.hideStopButton(),
|
|
1077
|
+
const w = this._sendStopHandler;
|
|
1078
|
+
this.hideStopButton(), w();
|
|
1077
1079
|
return;
|
|
1078
1080
|
}
|
|
1079
1081
|
this._submit();
|
|
1080
|
-
}), W.addEventListener("dragover", (
|
|
1081
|
-
|
|
1082
|
+
}), W.addEventListener("dragover", (w) => {
|
|
1083
|
+
w.preventDefault(), W.classList.add("gengage-chat-input-area--dragover");
|
|
1082
1084
|
}), W.addEventListener("dragleave", () => {
|
|
1083
1085
|
W.classList.remove("gengage-chat-input-area--dragover");
|
|
1084
|
-
}), W.addEventListener("drop", (
|
|
1085
|
-
|
|
1086
|
-
const Y =
|
|
1086
|
+
}), W.addEventListener("drop", (w) => {
|
|
1087
|
+
w.preventDefault(), W.classList.remove("gengage-chat-input-area--dragover");
|
|
1088
|
+
const Y = w.dataTransfer?.files[0];
|
|
1087
1089
|
Y && this._routeAttachmentFile(Y);
|
|
1088
1090
|
});
|
|
1089
1091
|
const te = document.createElement("div");
|
|
1090
1092
|
te.className = "gengage-chat-input-pill gds-input-shell", te.dataset.gengagePart = "chat-input-shell", te.appendChild(K), te.appendChild(this.inputEl), this._voiceEnabled && Xa() && (this._micBtn = document.createElement("button"), this._micBtn.className = "gengage-chat-mic-btn gds-btn gds-btn-ghost", this._micBtn.dataset.gengagePart = "chat-mic-button", this._micBtn.type = "button", this._micBtn.setAttribute("aria-label", this.i18n.voiceButton), this._micBtn.innerHTML = '<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z"/><path d="M19 10v2a7 7 0 0 1-14 0v-2"/><line x1="12" y1="19" x2="12" y2="23"/><line x1="8" y1="23" x2="16" y2="23"/></svg>', this._micBtn.addEventListener("click", () => this._toggleVoice()), te.appendChild(this._micBtn), this._voiceInput = new en({
|
|
1091
|
-
onInterim: (
|
|
1092
|
-
this._resizeRafId !== null && (cancelAnimationFrame(this._resizeRafId), this._resizeRafId = null), this.inputEl.value =
|
|
1093
|
+
onInterim: (w) => {
|
|
1094
|
+
this._resizeRafId !== null && (cancelAnimationFrame(this._resizeRafId), this._resizeRafId = null), this.inputEl.value = w, this.inputEl.style.height = "auto", this.inputEl.style.height = `${Math.min(this.inputEl.scrollHeight, 120)}px`;
|
|
1093
1095
|
},
|
|
1094
|
-
onFinal: (
|
|
1095
|
-
this.inputEl.value =
|
|
1096
|
+
onFinal: (w) => {
|
|
1097
|
+
this.inputEl.value = w;
|
|
1096
1098
|
},
|
|
1097
|
-
onAutoSubmit: (
|
|
1098
|
-
this.inputEl.value =
|
|
1099
|
+
onAutoSubmit: (w) => {
|
|
1100
|
+
this.inputEl.value = w, this._micBtn?.classList.remove("gengage-chat-mic-btn--active"), this._submit();
|
|
1099
1101
|
},
|
|
1100
|
-
onStateChange: (
|
|
1101
|
-
|
|
1102
|
+
onStateChange: (w) => {
|
|
1103
|
+
w === "listening" ? this._micBtn?.classList.add("gengage-chat-mic-btn--active") : this._micBtn?.classList.remove("gengage-chat-mic-btn--active");
|
|
1102
1104
|
},
|
|
1103
|
-
onError: (
|
|
1105
|
+
onError: (w, Y) => {
|
|
1104
1106
|
this._micBtn?.classList.remove("gengage-chat-mic-btn--active");
|
|
1105
1107
|
}
|
|
1106
1108
|
}, { lang: this._voiceLang })), te.appendChild(this.sendBtn), W.appendChild(this._previewStrip), W.appendChild(this._fileInput), W.appendChild(te), T.appendChild(W), x.appendChild(T), 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(T);
|
|
1107
|
-
const
|
|
1108
|
-
|
|
1109
|
-
const
|
|
1110
|
-
|
|
1109
|
+
const se = this._createFooterAttribution();
|
|
1110
|
+
se && this.root.appendChild(se);
|
|
1111
|
+
const re = (w) => {
|
|
1112
|
+
w.key === "Escape" && e.onClose();
|
|
1111
1113
|
};
|
|
1112
|
-
this.root.addEventListener("keydown",
|
|
1114
|
+
this.root.addEventListener("keydown", re), this._cleanups.push(() => this.root.removeEventListener("keydown", re)), t.appendChild(this.root);
|
|
1113
1115
|
}
|
|
1114
1116
|
addMessage(t) {
|
|
1115
1117
|
const e = this._options.renderMessageUISpec?.(t) ?? null;
|
|
@@ -1124,7 +1126,7 @@ var Bn = class {
|
|
|
1124
1126
|
if (t.content) {
|
|
1125
1127
|
const n = document.createElement("div");
|
|
1126
1128
|
if (n.className = "gengage-chat-bubble-text", n.dataset.gengagePart = "chat-message-text", t.role === "assistant") {
|
|
1127
|
-
if (t.renderHint === "photo_analysis" ? (a.classList.add("gengage-chat-bubble--photo-analysis"), this._renderPhotoAnalysisCard(n, t.photoAnalysis)) : n.innerHTML =
|
|
1129
|
+
if (t.renderHint === "photo_analysis" ? (a.classList.add("gengage-chat-bubble--photo-analysis"), this._renderPhotoAnalysisCard(n, t.photoAnalysis)) : n.innerHTML = ve(t.content), this._onLinkClick) {
|
|
1128
1130
|
const r = n.querySelectorAll("a[href]");
|
|
1129
1131
|
for (const i of r) i.addEventListener("click", (o) => {
|
|
1130
1132
|
o.preventDefault();
|
|
@@ -1144,7 +1146,7 @@ var Bn = class {
|
|
|
1144
1146
|
this.messagesEl.appendChild(a), this._presentationFocusThreadId && this._applyPresentationCollapsed(), this._scrollToBottom(t.role === "user");
|
|
1145
1147
|
}
|
|
1146
1148
|
removeMessageBubble(t) {
|
|
1147
|
-
this._firstBotMessageIds.delete(t), this.messagesEl.querySelector(`[data-message-id="${
|
|
1149
|
+
this._firstBotMessageIds.delete(t), this.messagesEl.querySelector(`[data-message-id="${ue(t)}"]`)?.remove(), this._presentationFocusThreadId && this._applyPresentationCollapsed();
|
|
1148
1150
|
}
|
|
1149
1151
|
showTypingIndicator(t, e = "auto") {
|
|
1150
1152
|
this.removeTypingIndicator();
|
|
@@ -1451,8 +1453,8 @@ var Bn = class {
|
|
|
1451
1453
|
const d = document.createElement("div");
|
|
1452
1454
|
d.className = "gengage-chat-comparison-recommended-info";
|
|
1453
1455
|
for (let k = 0; k < 2; k++) {
|
|
1454
|
-
const
|
|
1455
|
-
|
|
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);
|
|
1456
1458
|
}
|
|
1457
1459
|
const p = document.createElement("div");
|
|
1458
1460
|
p.className = "gengage-chat-comparison-skeleton-shimmer gengage-chat-comparison-skeleton-rec-price", d.appendChild(p), c.appendChild(l), c.appendChild(d), o.appendChild(c);
|
|
@@ -1463,8 +1465,8 @@ var Bn = class {
|
|
|
1463
1465
|
const x = document.createElement("ul");
|
|
1464
1466
|
x.className = "gengage-chat-comparison-skeleton-hl-list";
|
|
1465
1467
|
for (let k = 0; k < 3; k++) {
|
|
1466
|
-
const
|
|
1467
|
-
z.className = "gengage-chat-comparison-skeleton-shimmer gengage-chat-comparison-skeleton-hl-line", k === 1 && z.classList.add("gengage-chat-comparison-skeleton-hl-line--medium"), k === 2 && z.classList.add("gengage-chat-comparison-skeleton-hl-line--short"),
|
|
1468
|
+
const L = document.createElement("li"), z = document.createElement("div");
|
|
1469
|
+
z.className = "gengage-chat-comparison-skeleton-shimmer gengage-chat-comparison-skeleton-hl-line", k === 1 && z.classList.add("gengage-chat-comparison-skeleton-hl-line--medium"), k === 2 && z.classList.add("gengage-chat-comparison-skeleton-hl-line--short"), L.appendChild(z), x.appendChild(L);
|
|
1468
1470
|
}
|
|
1469
1471
|
h.appendChild(x), o.appendChild(h), i.appendChild(o);
|
|
1470
1472
|
const v = document.createElement("div");
|
|
@@ -1474,14 +1476,14 @@ var Bn = class {
|
|
|
1474
1476
|
const g = document.createElement("div");
|
|
1475
1477
|
g.className = "gengage-chat-comparison-key-differences-content";
|
|
1476
1478
|
for (let k = 0; k < 4; k++) {
|
|
1477
|
-
const
|
|
1478
|
-
|
|
1479
|
+
const L = document.createElement("div");
|
|
1480
|
+
L.className = "gengage-chat-comparison-skeleton-shimmer gengage-chat-comparison-skeleton-kd-line", g.appendChild(L);
|
|
1479
1481
|
}
|
|
1480
1482
|
v.appendChild(g), i.appendChild(v);
|
|
1481
1483
|
const _ = document.createElement("div");
|
|
1482
1484
|
_.className = "gengage-chat-comparison-special gengage-chat-comparison-special--skeleton";
|
|
1483
|
-
const
|
|
1484
|
-
|
|
1485
|
+
const y = document.createElement("div");
|
|
1486
|
+
y.className = "gengage-chat-comparison-skeleton-shimmer gengage-chat-comparison-skeleton-special-line", _.appendChild(y), i.appendChild(_);
|
|
1485
1487
|
const b = document.createElement("div");
|
|
1486
1488
|
b.className = "gengage-chat-comparison-skeleton-table-wrap";
|
|
1487
1489
|
const A = document.createElement("div");
|
|
@@ -1489,26 +1491,26 @@ var Bn = class {
|
|
|
1489
1491
|
const T = document.createElement("div");
|
|
1490
1492
|
T.className = "gengage-chat-comparison-skeleton-table-corner", A.appendChild(T);
|
|
1491
1493
|
for (let k = 0; k < 3; k++) {
|
|
1492
|
-
const
|
|
1493
|
-
|
|
1494
|
+
const L = document.createElement("div");
|
|
1495
|
+
L.className = "gengage-chat-comparison-skeleton-table-col";
|
|
1494
1496
|
const z = document.createElement("div");
|
|
1495
1497
|
z.className = "gengage-chat-comparison-skeleton-shimmer gengage-chat-comparison-skeleton-table-th-img";
|
|
1496
|
-
const
|
|
1497
|
-
|
|
1498
|
+
const O = document.createElement("div");
|
|
1499
|
+
O.className = "gengage-chat-comparison-skeleton-shimmer gengage-chat-comparison-skeleton-table-th-name";
|
|
1498
1500
|
const X = document.createElement("div");
|
|
1499
|
-
X.className = "gengage-chat-comparison-skeleton-shimmer gengage-chat-comparison-skeleton-table-th-price",
|
|
1501
|
+
X.className = "gengage-chat-comparison-skeleton-shimmer gengage-chat-comparison-skeleton-table-th-price", L.appendChild(z), L.appendChild(O), L.appendChild(X), A.appendChild(L);
|
|
1500
1502
|
}
|
|
1501
1503
|
b.appendChild(A);
|
|
1502
1504
|
for (let k = 0; k < 3; k++) {
|
|
1503
|
-
const
|
|
1504
|
-
|
|
1505
|
+
const L = document.createElement("div");
|
|
1506
|
+
L.className = "gengage-chat-comparison-skeleton-table-row";
|
|
1505
1507
|
const z = document.createElement("div");
|
|
1506
|
-
z.className = "gengage-chat-comparison-skeleton-shimmer gengage-chat-comparison-skeleton-table-label",
|
|
1507
|
-
for (let
|
|
1508
|
+
z.className = "gengage-chat-comparison-skeleton-shimmer gengage-chat-comparison-skeleton-table-label", L.appendChild(z);
|
|
1509
|
+
for (let O = 0; O < 3; O++) {
|
|
1508
1510
|
const X = document.createElement("div");
|
|
1509
|
-
X.className = "gengage-chat-comparison-skeleton-shimmer gengage-chat-comparison-skeleton-table-cell",
|
|
1511
|
+
X.className = "gengage-chat-comparison-skeleton-shimmer gengage-chat-comparison-skeleton-table-cell", L.appendChild(X);
|
|
1510
1512
|
}
|
|
1511
|
-
b.appendChild(
|
|
1513
|
+
b.appendChild(L);
|
|
1512
1514
|
}
|
|
1513
1515
|
i.appendChild(b), e.appendChild(i);
|
|
1514
1516
|
break;
|
|
@@ -1694,14 +1696,14 @@ var Bn = class {
|
|
|
1694
1696
|
this._scrollToBottom(!1);
|
|
1695
1697
|
}
|
|
1696
1698
|
updateBotMessage(t, e, a, n) {
|
|
1697
|
-
const r = this.messagesEl.querySelector(`[data-message-id="${
|
|
1699
|
+
const r = this.messagesEl.querySelector(`[data-message-id="${ue(t)}"]`);
|
|
1698
1700
|
if (!r) return;
|
|
1699
1701
|
let i = r.querySelector(".gengage-chat-bubble-text");
|
|
1700
|
-
i || (i = document.createElement("div"), i.className = "gengage-chat-bubble-text", r.appendChild(i)), a === "photo_analysis" ? (r.classList.add("gengage-chat-bubble--photo-analysis"), this._renderPhotoAnalysisCard(i, n)) : (r.classList.remove("gengage-chat-bubble--photo-analysis"), i.innerHTML =
|
|
1702
|
+
i || (i = document.createElement("div"), i.className = "gengage-chat-bubble-text", r.appendChild(i)), a === "photo_analysis" ? (r.classList.add("gengage-chat-bubble--photo-analysis"), this._renderPhotoAnalysisCard(i, n)) : (r.classList.remove("gengage-chat-bubble--photo-analysis"), i.innerHTML = ve(e)), this._scrollToBottom(!1);
|
|
1701
1703
|
}
|
|
1702
1704
|
markFirstBotMessage(t) {
|
|
1703
1705
|
this._firstBotMessageIds.add(t);
|
|
1704
|
-
const e = this.messagesEl.querySelector(`[data-message-id="${
|
|
1706
|
+
const e = this.messagesEl.querySelector(`[data-message-id="${ue(t)}"]`);
|
|
1705
1707
|
e && e.classList.add("gengage-chat-bubble--first");
|
|
1706
1708
|
}
|
|
1707
1709
|
scrollToLastThread() {
|
|
@@ -1716,7 +1718,7 @@ var Bn = class {
|
|
|
1716
1718
|
return;
|
|
1717
1719
|
}
|
|
1718
1720
|
this._programmaticScrollUntil = Date.now() + 700;
|
|
1719
|
-
const a = this.messagesEl.querySelector(`[data-thread-id="${
|
|
1721
|
+
const a = this.messagesEl.querySelector(`[data-thread-id="${ue(e)}"]`);
|
|
1720
1722
|
a ? requestAnimationFrame(() => {
|
|
1721
1723
|
a.scrollIntoView({
|
|
1722
1724
|
block: "start",
|
|
@@ -1725,7 +1727,7 @@ var Bn = class {
|
|
|
1725
1727
|
}) : this._scrollToBottom(!0);
|
|
1726
1728
|
}
|
|
1727
1729
|
scrollThreadIntoView(t, e = "smooth") {
|
|
1728
|
-
const a = this.messagesEl.querySelectorAll(`[data-thread-id="${
|
|
1730
|
+
const a = this.messagesEl.querySelectorAll(`[data-thread-id="${ue(t)}"]`), n = this.messagesEl.ownerDocument.defaultView?.HTMLElement;
|
|
1729
1731
|
if (!n) return !1;
|
|
1730
1732
|
let r = null, i = null;
|
|
1731
1733
|
for (let c = 0; c < a.length; c++) {
|
|
@@ -1850,7 +1852,7 @@ function oa(t) {
|
|
|
1850
1852
|
function Rn(t) {
|
|
1851
1853
|
return typeof t == "string" ? oa(t) : null;
|
|
1852
1854
|
}
|
|
1853
|
-
function
|
|
1855
|
+
function me(t) {
|
|
1854
1856
|
return t == null || typeof t != "object" || Array.isArray(t) ? null : t;
|
|
1855
1857
|
}
|
|
1856
1858
|
function Hn(...t) {
|
|
@@ -1860,7 +1862,7 @@ function Hn(...t) {
|
|
|
1860
1862
|
}
|
|
1861
1863
|
}
|
|
1862
1864
|
function Fn(t) {
|
|
1863
|
-
const e =
|
|
1865
|
+
const e = me(t);
|
|
1864
1866
|
if (!e) return null;
|
|
1865
1867
|
const a = Hn(e.assistant_mode, e.assistantMode);
|
|
1866
1868
|
if (!a) return null;
|
|
@@ -1870,7 +1872,7 @@ function Fn(t) {
|
|
|
1870
1872
|
function Dn(t) {
|
|
1871
1873
|
return t === "beauty_consulting" ? "user_message" : "findSimilar";
|
|
1872
1874
|
}
|
|
1873
|
-
var
|
|
1875
|
+
var Un = class {
|
|
1874
1876
|
constructor() {
|
|
1875
1877
|
this._mode = "shopping", this._uiHints = null;
|
|
1876
1878
|
}
|
|
@@ -1919,7 +1921,7 @@ var On = class {
|
|
|
1919
1921
|
const a = Rn(e);
|
|
1920
1922
|
a ? this._mode = a : ze("mode", "ignoring unrecognised assistant_mode from context", e);
|
|
1921
1923
|
} else e === null && (this._mode = "shopping");
|
|
1922
|
-
this._uiHints =
|
|
1924
|
+
this._uiHints = me(t.ui_hints) ?? null;
|
|
1923
1925
|
}
|
|
1924
1926
|
reset() {
|
|
1925
1927
|
const t = this._mode !== "shopping";
|
|
@@ -1932,7 +1934,7 @@ var On = class {
|
|
|
1932
1934
|
return this._mode !== "shopping";
|
|
1933
1935
|
}
|
|
1934
1936
|
};
|
|
1935
|
-
function
|
|
1937
|
+
function On() {
|
|
1936
1938
|
return {
|
|
1937
1939
|
streamIncludedBeautyPhotoStep: !1,
|
|
1938
1940
|
pendingPhotoStepSkip: !1
|
|
@@ -2002,7 +2004,7 @@ function Wn(t, e, a) {
|
|
|
2002
2004
|
}
|
|
2003
2005
|
function Kn(t, e) {
|
|
2004
2006
|
try {
|
|
2005
|
-
return t.toLocaleUpperCase(
|
|
2007
|
+
return t.toLocaleUpperCase(Oe(e));
|
|
2006
2008
|
} catch {
|
|
2007
2009
|
return t.toLocaleUpperCase("tr");
|
|
2008
2010
|
}
|
|
@@ -2053,7 +2055,7 @@ function Xn(t) {
|
|
|
2053
2055
|
}
|
|
2054
2056
|
if (v.childElementCount > 0 && m.appendChild(v), t.recommendedText) {
|
|
2055
2057
|
const g = document.createElement("p");
|
|
2056
|
-
g.className = "gengage-chat-comparison-recommended-text", g.innerHTML =
|
|
2058
|
+
g.className = "gengage-chat-comparison-recommended-text", g.innerHTML = ve(t.recommendedText), m.appendChild(g);
|
|
2057
2059
|
}
|
|
2058
2060
|
p.appendChild(m);
|
|
2059
2061
|
const u = () => {
|
|
@@ -2069,12 +2071,12 @@ function Xn(t) {
|
|
|
2069
2071
|
g.className = "gengage-chat-comparison-highlights", g.dataset.gengagePart = "comparison-highlights";
|
|
2070
2072
|
const _ = document.createElement("div");
|
|
2071
2073
|
_.className = "gengage-chat-comparison-highlights-label", _.textContent = s?.highlightsLabel ?? "Key Highlights", g.appendChild(_);
|
|
2072
|
-
const
|
|
2074
|
+
const y = document.createElement("ul");
|
|
2073
2075
|
for (const b of r) {
|
|
2074
2076
|
const A = document.createElement("li");
|
|
2075
|
-
A.textContent = b,
|
|
2077
|
+
A.textContent = b, y.appendChild(A);
|
|
2076
2078
|
}
|
|
2077
|
-
g.appendChild(
|
|
2079
|
+
g.appendChild(y), l.appendChild(g);
|
|
2078
2080
|
}
|
|
2079
2081
|
c.appendChild(l);
|
|
2080
2082
|
}
|
|
@@ -2088,7 +2090,7 @@ function Xn(t) {
|
|
|
2088
2090
|
const h = document.createElement("span");
|
|
2089
2091
|
h.className = "gengage-chat-comparison-key-differences-summary-meta", h.textContent = s?.viewMoreLabel ?? "Show More", d.appendChild(p), d.appendChild(h), l.appendChild(d);
|
|
2090
2092
|
const m = document.createElement("div");
|
|
2091
|
-
m.className = "gengage-chat-comparison-key-differences-content", m.innerHTML =
|
|
2093
|
+
m.className = "gengage-chat-comparison-key-differences-content", m.innerHTML = ve(Qn(t.keyDifferencesHtml)), l.appendChild(m), c.appendChild(l);
|
|
2092
2094
|
}
|
|
2093
2095
|
if (i && i.length > 0) {
|
|
2094
2096
|
const l = document.createElement("details");
|
|
@@ -2126,8 +2128,8 @@ function Xn(t) {
|
|
|
2126
2128
|
const b = document.createElement("div");
|
|
2127
2129
|
b.className = "gengage-chat-comparison-table-header-img-placeholder", b.setAttribute("aria-hidden", "true"), g.appendChild(b);
|
|
2128
2130
|
}
|
|
2129
|
-
const
|
|
2130
|
-
if (
|
|
2131
|
+
const y = document.createElement("div");
|
|
2132
|
+
if (y.className = "gengage-chat-comparison-table-product-name", y.textContent = v.name, g.appendChild(y), Tt(v.price)) {
|
|
2131
2133
|
const b = document.createElement("div");
|
|
2132
2134
|
b.className = "gengage-chat-comparison-table-price", b.textContent = ae(v.price, t.pricing), g.appendChild(b);
|
|
2133
2135
|
}
|
|
@@ -2139,10 +2141,10 @@ function Xn(t) {
|
|
|
2139
2141
|
const u = document.createElement("tr"), g = document.createElement("td");
|
|
2140
2142
|
g.className = "gengage-chat-comparison-label", g.textContent = Wn(v.label, s?.criteriaLabels, t.locale), u.appendChild(g);
|
|
2141
2143
|
for (let _ = 0; _ < v.values.length; _++) {
|
|
2142
|
-
const
|
|
2143
|
-
a[_]?.sku === e?.sku && (
|
|
2144
|
+
const y = document.createElement("td");
|
|
2145
|
+
a[_]?.sku === e?.sku && (y.className = "gengage-chat-comparison-selected gds-comparison-table-winner-cell");
|
|
2144
2146
|
const b = v.values[_] ?? "";
|
|
2145
|
-
sa(b) ?
|
|
2147
|
+
sa(b) ? y.innerHTML = ve(b) : y.textContent = b, u.appendChild(y);
|
|
2146
2148
|
}
|
|
2147
2149
|
m.appendChild(u);
|
|
2148
2150
|
}
|
|
@@ -2165,7 +2167,7 @@ function Qn(t) {
|
|
|
2165
2167
|
return e.length <= 1 ? t : "<ul>" + e.map((a) => `<li>${a.trim()}</li>`).join("") + "</ul>";
|
|
2166
2168
|
}
|
|
2167
2169
|
function Jn(t, e) {
|
|
2168
|
-
const a =
|
|
2170
|
+
const a = ve(e);
|
|
2169
2171
|
if (!a) return;
|
|
2170
2172
|
const n = document.createElement("template");
|
|
2171
2173
|
n.innerHTML = a;
|
|
@@ -2173,7 +2175,7 @@ function Jn(t, e) {
|
|
|
2173
2175
|
if (r.length > 0) {
|
|
2174
2176
|
for (const o of r) {
|
|
2175
2177
|
const s = document.createElement("li");
|
|
2176
|
-
s.innerHTML =
|
|
2178
|
+
s.innerHTML = ve(o.innerHTML), t.appendChild(s);
|
|
2177
2179
|
}
|
|
2178
2180
|
return;
|
|
2179
2181
|
}
|
|
@@ -2226,12 +2228,12 @@ function sr(t, e) {
|
|
|
2226
2228
|
const r = n.filter((v) => v !== null && typeof v == "object"), i = /* @__PURE__ */ new Map();
|
|
2227
2229
|
for (const v of r) {
|
|
2228
2230
|
const u = ar(v.review_class), g = nr(v.review_text), _ = tr(v.review_tag);
|
|
2229
|
-
for (const
|
|
2230
|
-
const b =
|
|
2231
|
+
for (const y of _) {
|
|
2232
|
+
const b = y.toLocaleLowerCase();
|
|
2231
2233
|
let A = i.get(b);
|
|
2232
2234
|
if (A || (A = {
|
|
2233
2235
|
key: b,
|
|
2234
|
-
label:
|
|
2236
|
+
label: y,
|
|
2235
2237
|
mentions: 0,
|
|
2236
2238
|
positive: 0,
|
|
2237
2239
|
negative: 0,
|
|
@@ -2261,29 +2263,29 @@ function sr(t, e) {
|
|
|
2261
2263
|
const m = () => {
|
|
2262
2264
|
for (; h.firstChild; ) h.removeChild(h.firstChild);
|
|
2263
2265
|
if (!d) return;
|
|
2264
|
-
const v = o.find((
|
|
2266
|
+
const v = o.find((y) => y.key === d);
|
|
2265
2267
|
if (!v) return;
|
|
2266
2268
|
const u = document.createElement("div");
|
|
2267
2269
|
u.className = "gengage-chat-review-detail-meta";
|
|
2268
2270
|
const g = document.createElement("span");
|
|
2269
2271
|
if (g.className = "gengage-chat-review-detail-mentions", g.textContent = `${or(v.mentions, e?.reviewCustomersMentionSingular, e?.reviewCustomersMentionPlural)} "${v.label}"`, u.appendChild(g), v.positive > 0) {
|
|
2270
|
-
const
|
|
2271
|
-
|
|
2272
|
+
const y = document.createElement("span");
|
|
2273
|
+
y.className = "gengage-chat-review-detail-positive", y.textContent = `${v.positive} ${s}`, u.appendChild(y);
|
|
2272
2274
|
}
|
|
2273
2275
|
if (v.negative > 0) {
|
|
2274
|
-
const
|
|
2275
|
-
|
|
2276
|
+
const y = document.createElement("span");
|
|
2277
|
+
y.className = "gengage-chat-review-detail-negative", y.textContent = `${v.negative} ${c}`, u.appendChild(y);
|
|
2276
2278
|
}
|
|
2277
2279
|
h.appendChild(u);
|
|
2278
2280
|
const _ = document.createElement("div");
|
|
2279
2281
|
_.className = "gengage-chat-review-snippets";
|
|
2280
|
-
for (const
|
|
2282
|
+
for (const y of v.snippets) {
|
|
2281
2283
|
const b = document.createElement("article");
|
|
2282
|
-
b.className = "gengage-chat-review-snippet", b.dataset.tone =
|
|
2284
|
+
b.className = "gengage-chat-review-snippet", b.dataset.tone = y.tone;
|
|
2283
2285
|
const A = document.createElement("div");
|
|
2284
|
-
if (A.className = "gengage-chat-review-snippet-text", A.textContent = `"${
|
|
2286
|
+
if (A.className = "gengage-chat-review-snippet-text", A.textContent = `"${y.text}"`, b.appendChild(A), y.rating !== void 0 && String(y.rating).length > 0) {
|
|
2285
2287
|
const T = document.createElement("div");
|
|
2286
|
-
T.className = "gengage-chat-review-snippet-rating", T.textContent = `★ ${String(
|
|
2288
|
+
T.className = "gengage-chat-review-snippet-rating", T.textContent = `★ ${String(y.rating)}`, b.appendChild(T);
|
|
2287
2289
|
}
|
|
2288
2290
|
_.appendChild(b);
|
|
2289
2291
|
}
|
|
@@ -2299,8 +2301,8 @@ function sr(t, e) {
|
|
|
2299
2301
|
g.type = "button", g.className = "gengage-chat-review-subject gds-chip", g.dataset.subjectKey = v.key, g.dataset.tone = u;
|
|
2300
2302
|
const _ = document.createElement("span");
|
|
2301
2303
|
_.className = "gengage-chat-review-subject-icon", _.appendChild(ir(u)), g.appendChild(_);
|
|
2302
|
-
const
|
|
2303
|
-
|
|
2304
|
+
const y = document.createElement("span");
|
|
2305
|
+
y.className = "gengage-chat-review-subject-label", y.textContent = v.label, g.appendChild(y);
|
|
2304
2306
|
const b = document.createElement("span");
|
|
2305
2307
|
b.className = "gengage-chat-review-subject-count", b.textContent = `(${v.mentions})`, g.appendChild(b), g.addEventListener("click", () => {
|
|
2306
2308
|
d = v.key, x(), m();
|
|
@@ -2494,11 +2496,11 @@ function Mt(t, e, a, n) {
|
|
|
2494
2496
|
const o = t.product, s = ca(t), c = o.url ?? "", l = o.cartCode, d = o.inStock, p = !!(s && l && d !== !1), h = t.action;
|
|
2495
2497
|
s && e.onProductClick ? (r.classList.add("gds-clickable"), r.addEventListener("click", (k) => {
|
|
2496
2498
|
if (k.target.closest(".gengage-chat-ai-toppick-cta") || k.target.closest(".gengage-chat-favorite-btn") || k.target.closest(".gengage-chat-find-similar-pill")) return;
|
|
2497
|
-
const
|
|
2499
|
+
const L = o.name;
|
|
2498
2500
|
e.onProductClick?.({
|
|
2499
2501
|
sku: s,
|
|
2500
2502
|
url: c,
|
|
2501
|
-
...
|
|
2503
|
+
...L ? { name: L } : {}
|
|
2502
2504
|
});
|
|
2503
2505
|
})) : h && (r.classList.add("gds-clickable"), r.addEventListener("click", (k) => {
|
|
2504
2506
|
k.target.closest(".gengage-chat-ai-toppick-cta") || k.target.closest(".gengage-chat-favorite-btn") || k.target.closest(".gengage-chat-find-similar-pill") || e.onAction(h);
|
|
@@ -2520,15 +2522,15 @@ function Mt(t, e, a, n) {
|
|
|
2520
2522
|
const k = document.createElement("div");
|
|
2521
2523
|
k.className = "gengage-chat-ai-toppick-name", k.dataset.gengagePart = "ai-top-pick-name", k.textContent = _, g.appendChild(k);
|
|
2522
2524
|
}
|
|
2523
|
-
const
|
|
2524
|
-
|
|
2525
|
+
const y = dr(o);
|
|
2526
|
+
y && g.appendChild(y), hr(o, g, e), t.labels && t.labels.length > 0 && g.appendChild(fr(t.labels)), u.appendChild(g), r.appendChild(u);
|
|
2525
2527
|
const b = document.createElement("div");
|
|
2526
2528
|
if (b.className = "gengage-chat-ai-toppick-detail", b.dataset.gengagePart = "ai-top-pick-detail", a) ur(t, b, e);
|
|
2527
2529
|
else {
|
|
2528
2530
|
const k = typeof t.reason == "string" ? t.reason.trim() : "";
|
|
2529
2531
|
if (k) {
|
|
2530
|
-
const
|
|
2531
|
-
|
|
2532
|
+
const L = document.createElement("p");
|
|
2533
|
+
L.className = "gengage-chat-ai-toppick-snippet", L.dataset.gengagePart = "ai-top-pick-snippet", L.textContent = k, b.appendChild(L);
|
|
2532
2534
|
}
|
|
2533
2535
|
}
|
|
2534
2536
|
b.childNodes.length > 0 && r.appendChild(b);
|
|
@@ -2536,8 +2538,8 @@ function Mt(t, e, a, n) {
|
|
|
2536
2538
|
if (A || p || h) {
|
|
2537
2539
|
const k = document.createElement("div");
|
|
2538
2540
|
if (k.className = "gengage-chat-ai-toppick-spinner", k.dataset.gengagePart = "ai-top-pick-spinner", k.style.display = A ? "" : "none", r.appendChild(k), T) {
|
|
2539
|
-
const
|
|
2540
|
-
|
|
2541
|
+
const L = document.createElement("button");
|
|
2542
|
+
L.className = "gengage-chat-ai-toppick-cta gds-btn gds-btn-primary", L.dataset.gengagePart = "ai-top-pick-cta", L.type = "button", L.textContent = p ? e.i18n?.addToCartButton ?? "Add to Cart" : e.i18n?.viewDetails ?? "View Details", L.addEventListener("click", (z) => {
|
|
2541
2543
|
if (z.stopPropagation(), p) {
|
|
2542
2544
|
e.onAction({
|
|
2543
2545
|
title: e.i18n?.addToCartButton ?? "Add to Cart",
|
|
@@ -2552,17 +2554,17 @@ function Mt(t, e, a, n) {
|
|
|
2552
2554
|
}
|
|
2553
2555
|
if (h) {
|
|
2554
2556
|
if (h.type === "findSimilar" && s && e.onProductClick) {
|
|
2555
|
-
const
|
|
2557
|
+
const O = o.name;
|
|
2556
2558
|
e.onProductClick({
|
|
2557
2559
|
sku: s,
|
|
2558
2560
|
url: c,
|
|
2559
|
-
...
|
|
2561
|
+
...O ? { name: O } : {}
|
|
2560
2562
|
});
|
|
2561
2563
|
return;
|
|
2562
2564
|
}
|
|
2563
2565
|
e.onAction(h);
|
|
2564
2566
|
}
|
|
2565
|
-
}), r.appendChild(
|
|
2567
|
+
}), r.appendChild(L);
|
|
2566
2568
|
}
|
|
2567
2569
|
}
|
|
2568
2570
|
return r;
|
|
@@ -2834,13 +2836,13 @@ function Tr(t, e) {
|
|
|
2834
2836
|
for (let d = 0; d < a.length; d++) {
|
|
2835
2837
|
const p = a[d], h = `${r}-tab-${d}`, m = `${r}-panel-${d}`, x = document.createElement("button");
|
|
2836
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(d === 0)), x.tabIndex = d === 0 ? 0 : -1, d === 0 && x.classList.add("gengage-chat-categories-tab--active", "is-active"), p.image && Ce(p.image)) {
|
|
2837
|
-
const
|
|
2838
|
-
|
|
2839
|
+
const y = document.createElement("img");
|
|
2840
|
+
y.className = "gengage-chat-categories-tab-image", y.draggable = !1, y.src = p.image, y.alt = p.groupName, y.loading = "lazy", xe(y), x.appendChild(y);
|
|
2839
2841
|
}
|
|
2840
2842
|
const v = document.createElement("span");
|
|
2841
|
-
v.className = "gengage-chat-categories-tab-text", v.textContent = p.groupName, x.appendChild(v), x.addEventListener("click", () => l(d)), x.addEventListener("keydown", (
|
|
2843
|
+
v.className = "gengage-chat-categories-tab-text", v.textContent = p.groupName, x.appendChild(v), x.addEventListener("click", () => l(d)), x.addEventListener("keydown", (y) => {
|
|
2842
2844
|
let b = -1;
|
|
2843
|
-
|
|
2845
|
+
y.key === "ArrowRight" || y.key === "ArrowDown" ? b = (d + 1) % a.length : y.key === "ArrowLeft" || y.key === "ArrowUp" ? b = (d - 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());
|
|
2844
2846
|
}), s.push(x), o.appendChild(x);
|
|
2845
2847
|
const u = document.createElement("div");
|
|
2846
2848
|
u.className = "gengage-chat-categories-panel", u.dataset.gengagePart = "categories-panel", u.id = m, u.setAttribute("role", "tabpanel"), u.setAttribute("aria-labelledby", h), d !== 0 && (u.style.display = "none");
|
|
@@ -2848,8 +2850,8 @@ function Tr(t, e) {
|
|
|
2848
2850
|
g && u.appendChild(g);
|
|
2849
2851
|
const _ = document.createElement("div");
|
|
2850
2852
|
_.className = "gengage-chat-categories-grid", _.dataset.gengagePart = "categories-grid";
|
|
2851
|
-
for (const
|
|
2852
|
-
const b = Ar(
|
|
2853
|
+
for (const y of p.products) {
|
|
2854
|
+
const b = Ar(y, e);
|
|
2853
2855
|
_.appendChild(b);
|
|
2854
2856
|
}
|
|
2855
2857
|
u.appendChild(_), c.push(u);
|
|
@@ -2947,9 +2949,9 @@ function Br(t, e) {
|
|
|
2947
2949
|
const g = document.createElement("div");
|
|
2948
2950
|
g.className = "gengage-chat-panel-restore-card__thumb";
|
|
2949
2951
|
const _ = u.imageUrl;
|
|
2950
|
-
if (_ &&
|
|
2951
|
-
const
|
|
2952
|
-
|
|
2952
|
+
if (_ && he(_)) {
|
|
2953
|
+
const y = document.createElement("img");
|
|
2954
|
+
y.loading = "lazy", y.alt = u.name || r, de(y, "src", _), xe(y), g.appendChild(y);
|
|
2953
2955
|
}
|
|
2954
2956
|
v.appendChild(g);
|
|
2955
2957
|
}
|
|
@@ -2969,7 +2971,7 @@ function zr(t, e) {
|
|
|
2969
2971
|
g.target.closest("a") || e.onProductSelect?.(a);
|
|
2970
2972
|
});
|
|
2971
2973
|
const r = a.imageUrl;
|
|
2972
|
-
if (r &&
|
|
2974
|
+
if (r && he(r)) {
|
|
2973
2975
|
const g = document.createElement("div");
|
|
2974
2976
|
g.className = "gengage-chat-product-summary__image", g.dataset.gengagePart = "product-summary-image";
|
|
2975
2977
|
const _ = document.createElement("img");
|
|
@@ -2995,40 +2997,40 @@ function zr(t, e) {
|
|
|
2995
2997
|
}
|
|
2996
2998
|
const d = a.price, p = a.originalPrice;
|
|
2997
2999
|
if (d) {
|
|
2998
|
-
const g = He(e, a), _ = $e(e, a),
|
|
3000
|
+
const g = He(e, a), _ = $e(e, a), y = !!(p && p !== d), b = document.createElement("div");
|
|
2999
3001
|
b.className = "gengage-chat-product-summary__price", b.dataset.gengagePart = "product-summary-price";
|
|
3000
|
-
const A = !!(g &&
|
|
3002
|
+
const A = !!(g && y), T = Je(e, a);
|
|
3001
3003
|
if (A) {
|
|
3002
3004
|
const k = et({
|
|
3003
3005
|
reasonText: g,
|
|
3004
3006
|
salePriceFormatted: ae(d, e.pricing),
|
|
3005
3007
|
...T !== void 0 ? { logoUrl: T } : {}
|
|
3006
3008
|
});
|
|
3007
|
-
if (
|
|
3009
|
+
if (y && _ === "inline") {
|
|
3008
3010
|
b.classList.add("gengage-chat-product-summary__price--inline"), b.appendChild(k);
|
|
3009
|
-
const
|
|
3010
|
-
|
|
3011
|
+
const L = document.createElement("span");
|
|
3012
|
+
L.className = "gengage-chat-product-summary__price-sep", L.setAttribute("aria-hidden", "true");
|
|
3011
3013
|
const z = document.createElement("span");
|
|
3012
|
-
z.className = "gengage-chat-product-summary__price-original", z.textContent = ae(p, e.pricing), b.appendChild(
|
|
3014
|
+
z.className = "gengage-chat-product-summary__price-original", z.textContent = ae(p, e.pricing), b.appendChild(L), b.appendChild(z);
|
|
3013
3015
|
} else {
|
|
3014
|
-
const
|
|
3015
|
-
|
|
3016
|
+
const L = document.createElement("span");
|
|
3017
|
+
L.className = "gengage-chat-product-summary__price-original", L.textContent = ae(p, e.pricing), b.appendChild(L), b.appendChild(document.createTextNode(" ")), b.appendChild(k);
|
|
3016
3018
|
}
|
|
3017
3019
|
i.appendChild(b);
|
|
3018
3020
|
} else {
|
|
3019
|
-
if (
|
|
3021
|
+
if (y && _ === "inline") {
|
|
3020
3022
|
b.classList.add("gengage-chat-product-summary__price--inline");
|
|
3021
3023
|
const k = document.createElement("span");
|
|
3022
3024
|
k.className = "gengage-chat-product-summary__price-current", k.textContent = ae(d, e.pricing);
|
|
3023
|
-
const
|
|
3024
|
-
|
|
3025
|
+
const L = document.createElement("span");
|
|
3026
|
+
L.className = "gengage-chat-product-summary__price-sep", L.setAttribute("aria-hidden", "true");
|
|
3025
3027
|
const z = document.createElement("span");
|
|
3026
|
-
z.className = "gengage-chat-product-summary__price-original", z.textContent = ae(p, e.pricing), b.appendChild(k), b.appendChild(
|
|
3027
|
-
} else if (
|
|
3028
|
+
z.className = "gengage-chat-product-summary__price-original", z.textContent = ae(p, e.pricing), b.appendChild(k), b.appendChild(L), b.appendChild(z);
|
|
3029
|
+
} else if (y) {
|
|
3028
3030
|
const k = document.createElement("span");
|
|
3029
3031
|
k.className = "gengage-chat-product-summary__price-original", k.textContent = ae(p, e.pricing), b.appendChild(k), b.appendChild(document.createTextNode(" "));
|
|
3030
|
-
const
|
|
3031
|
-
|
|
3032
|
+
const L = document.createElement("span");
|
|
3033
|
+
L.className = "gengage-chat-product-summary__price-current", L.textContent = ae(d, e.pricing), b.appendChild(L);
|
|
3032
3034
|
} else {
|
|
3033
3035
|
const k = document.createElement("span");
|
|
3034
3036
|
k.className = "gengage-chat-product-summary__price-current", k.textContent = ae(d, e.pricing), b.appendChild(k);
|
|
@@ -3054,7 +3056,7 @@ function zr(t, e) {
|
|
|
3054
3056
|
}
|
|
3055
3057
|
});
|
|
3056
3058
|
}), n.appendChild(g);
|
|
3057
|
-
} else if (h &&
|
|
3059
|
+
} else if (h && he(h)) {
|
|
3058
3060
|
const g = document.createElement("a");
|
|
3059
3061
|
g.className = "gengage-chat-product-summary__cta gds-chip gds-chip-active", g.dataset.gengagePart = "product-summary-cta", de(g, "href", h), de(g, "target", "_blank"), de(g, "rel", "noopener noreferrer"), g.textContent = e.i18n?.productCtaLabel ?? "View", n.appendChild(g);
|
|
3060
3062
|
}
|
|
@@ -3069,7 +3071,7 @@ function Ve() {
|
|
|
3069
3071
|
}
|
|
3070
3072
|
var ga = {
|
|
3071
3073
|
ActionButtons: ({ element: t, context: e }) => Dr(t, e),
|
|
3072
|
-
ActionButton: ({ element: t, context: e }) =>
|
|
3074
|
+
ActionButton: ({ element: t, context: e }) => Ur(t, e),
|
|
3073
3075
|
InlineQuestionButtons: ({ element: t, context: e }) => wr(t, e),
|
|
3074
3076
|
ProductCard: ({ element: t, context: e }) => pt(t, e),
|
|
3075
3077
|
ProductDetailsPanel: ({ element: t, context: e }) => si(t, e),
|
|
@@ -3125,7 +3127,7 @@ function Dr(t, e) {
|
|
|
3125
3127
|
}
|
|
3126
3128
|
return a;
|
|
3127
3129
|
}
|
|
3128
|
-
function
|
|
3130
|
+
function Ur(t, e) {
|
|
3129
3131
|
const a = document.createElement("button");
|
|
3130
3132
|
a.className = "gengage-chat-action-btn";
|
|
3131
3133
|
const n = t.props?.label;
|
|
@@ -3231,7 +3233,7 @@ function pt(t, e) {
|
|
|
3231
3233
|
if (!n) return a;
|
|
3232
3234
|
const r = n.sku;
|
|
3233
3235
|
r && (a.dataset.sku = r);
|
|
3234
|
-
const i = t.props?.action, o = n.name, s = n.url, c = n.sku, l = s &&
|
|
3236
|
+
const i = t.props?.action, o = n.name, s = n.url, c = n.sku, l = s && he(s) ? s : void 0, d = () => i?.type !== "launchSingleProduct" || l === void 0 || c === void 0 || e.onProductClick === void 0 ? !1 : (e.onProductClick({
|
|
3235
3237
|
sku: c,
|
|
3236
3238
|
url: l,
|
|
3237
3239
|
...typeof o == "string" ? { name: o } : {}
|
|
@@ -3246,13 +3248,13 @@ function pt(t, e) {
|
|
|
3246
3248
|
}
|
|
3247
3249
|
}));
|
|
3248
3250
|
const p = n.imageUrl;
|
|
3249
|
-
if (p &&
|
|
3251
|
+
if (p && he(p)) {
|
|
3250
3252
|
const C = document.createElement("div");
|
|
3251
3253
|
C.className = "gengage-chat-product-card-img-wrapper";
|
|
3252
|
-
const
|
|
3253
|
-
|
|
3254
|
+
const U = document.createElement("img");
|
|
3255
|
+
U.className = "gengage-chat-product-card-img", U.loading = "lazy", de(U, "src", p);
|
|
3254
3256
|
const N = n.name;
|
|
3255
|
-
N && (
|
|
3257
|
+
N && (U.alt = N), xe(U), C.appendChild(U);
|
|
3256
3258
|
const q = n.discountPercent;
|
|
3257
3259
|
if (!e.hideProductDiscountBadge && typeof q == "number" && q > 0) {
|
|
3258
3260
|
const f = document.createElement("span");
|
|
@@ -3265,8 +3267,8 @@ function pt(t, e) {
|
|
|
3265
3267
|
const f = document.createElement("button");
|
|
3266
3268
|
f.className = "gengage-chat-favorite-btn", f.type = "button", f.dataset.gengageFavoriteSku = ne, f.setAttribute("aria-label", e.i18n?.addToFavoritesLabel ?? "Add to favorites");
|
|
3267
3269
|
const S = e.favoritedSkus?.has(ne) ?? !1;
|
|
3268
|
-
S && f.classList.add("gengage-chat-favorite-btn--active"), f.innerHTML = `<svg width="14" height="14" viewBox="0 0 24 24" fill="${S ? "currentColor" : "none"}" stroke="currentColor" stroke-width="2"><path d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"/></svg>`, f.addEventListener("click", (
|
|
3269
|
-
|
|
3270
|
+
S && f.classList.add("gengage-chat-favorite-btn--active"), f.innerHTML = `<svg width="14" height="14" viewBox="0 0 24 24" fill="${S ? "currentColor" : "none"}" stroke="currentColor" stroke-width="2"><path d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"/></svg>`, f.addEventListener("click", (P) => {
|
|
3271
|
+
P.stopPropagation(), f.classList.toggle("gengage-chat-favorite-btn--active");
|
|
3270
3272
|
const $ = f.querySelector("svg");
|
|
3271
3273
|
$ && $.setAttribute("fill", f.classList.contains("gengage-chat-favorite-btn--active") ? "currentColor" : "none"), e.onFavoriteToggle(ne, n);
|
|
3272
3274
|
}), D.appendChild(f);
|
|
@@ -3276,8 +3278,8 @@ function pt(t, e) {
|
|
|
3276
3278
|
const f = document.createElement("button");
|
|
3277
3279
|
f.className = "gengage-chat-find-similar-pill", f.type = "button", f.setAttribute("aria-label", K), f.dataset.tooltip = K, f.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>';
|
|
3278
3280
|
const S = document.createElement("span");
|
|
3279
|
-
S.className = "gengage-chat-find-similar-pill-text", S.textContent = K, f.appendChild(S), f.addEventListener("click", (
|
|
3280
|
-
|
|
3281
|
+
S.className = "gengage-chat-find-similar-pill-text", S.textContent = K, f.appendChild(S), f.addEventListener("click", (P) => {
|
|
3282
|
+
P.stopPropagation(), e.onAction({
|
|
3281
3283
|
title: K,
|
|
3282
3284
|
type: "findSimilar",
|
|
3283
3285
|
payload: { sku: W }
|
|
@@ -3293,29 +3295,29 @@ function pt(t, e) {
|
|
|
3293
3295
|
const C = document.createElement("div");
|
|
3294
3296
|
C.className = "gengage-chat-product-card-brand", C.textContent = m, h.appendChild(C);
|
|
3295
3297
|
}
|
|
3296
|
-
const x = n.rating, v = n.reviewCount, u = n.price, g = n.originalPrice, _ = n.price_async,
|
|
3298
|
+
const x = n.rating, v = n.reviewCount, u = n.price, g = n.originalPrice, _ = n.price_async, y = He(e, n), b = $e(e, n), A = !!(g && u && g !== u && parseFloat(u) > 0), T = !!(y && A), k = !!(y && !T || A && b === "inline"), L = typeof x == "number" && Number.isFinite(x) && x > 0, z = document.createElement("div");
|
|
3297
3299
|
z.className = "gengage-chat-product-card-meta-row";
|
|
3298
|
-
const
|
|
3299
|
-
|
|
3300
|
+
const O = document.createElement("div");
|
|
3301
|
+
O.className = "gengage-chat-product-card-price gengage-chat-product-card-price-block";
|
|
3300
3302
|
const X = k ? (() => {
|
|
3301
3303
|
const C = document.createElement("div");
|
|
3302
|
-
return C.className = "gengage-chat-product-card-price-stack",
|
|
3303
|
-
})() :
|
|
3304
|
+
return C.className = "gengage-chat-product-card-price-stack", y && !T && C.appendChild(Qe(y)), C.appendChild(O), C;
|
|
3305
|
+
})() : O;
|
|
3304
3306
|
if (_ === !0) {
|
|
3305
3307
|
const C = document.createElement("span");
|
|
3306
|
-
C.className = "gengage-chat-price-skeleton",
|
|
3307
|
-
C.parentElement && (u && parseFloat(u) > 0 ? Nt(
|
|
3308
|
+
C.className = "gengage-chat-price-skeleton", O.appendChild(C), setTimeout(() => {
|
|
3309
|
+
C.parentElement && (u && parseFloat(u) > 0 ? Nt(O, e, n, u, n.originalPrice) : C.remove());
|
|
3308
3310
|
}, 300);
|
|
3309
|
-
} else u && parseFloat(u) > 0 && Nt(
|
|
3310
|
-
if ((
|
|
3311
|
+
} else u && parseFloat(u) > 0 && Nt(O, e, n, u, g);
|
|
3312
|
+
if ((O.childElementCount > 0 || _ === !0) && z.appendChild(X), L) {
|
|
3311
3313
|
const C = document.createElement("div");
|
|
3312
3314
|
C.className = "gengage-chat-product-card-rating gengage-chat-product-card-rating-compact";
|
|
3313
|
-
const
|
|
3315
|
+
const U = ea(x), N = [`${U.toFixed(1)}`, "out of 5 stars"];
|
|
3314
3316
|
typeof v == "number" && Number.isFinite(v) && N.push(`(${v} reviews)`), C.setAttribute("aria-label", N.join(" "));
|
|
3315
3317
|
const q = document.createElement("span");
|
|
3316
3318
|
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>';
|
|
3317
3319
|
const D = document.createElement("span");
|
|
3318
|
-
D.className = "gengage-chat-product-card-rating-compact-value", D.textContent =
|
|
3320
|
+
D.className = "gengage-chat-product-card-rating-compact-value", D.textContent = U.toFixed(1), C.appendChild(q), C.appendChild(D), z.appendChild(C);
|
|
3319
3321
|
}
|
|
3320
3322
|
if (z.childElementCount === 0 && (z.classList.add("gengage-chat-product-card-meta-row--empty"), z.setAttribute("aria-hidden", "true")), h.appendChild(z), o) {
|
|
3321
3323
|
const C = document.createElement("div");
|
|
@@ -3331,8 +3333,8 @@ function pt(t, e) {
|
|
|
3331
3333
|
if (F) {
|
|
3332
3334
|
const C = document.createElement("div");
|
|
3333
3335
|
C.className = "gengage-chat-product-card-buy-footer";
|
|
3334
|
-
const
|
|
3335
|
-
|
|
3336
|
+
const U = document.createElement("button");
|
|
3337
|
+
U.type = "button", U.className = "gengage-chat-product-card-buy-trigger", U.textContent = B, U.addEventListener("click", (N) => {
|
|
3336
3338
|
N.stopPropagation(), e.onAction({
|
|
3337
3339
|
title: e.i18n?.addToCartButton ?? B,
|
|
3338
3340
|
type: "addToCart",
|
|
@@ -3342,24 +3344,24 @@ function pt(t, e) {
|
|
|
3342
3344
|
quantity: 1
|
|
3343
3345
|
}
|
|
3344
3346
|
});
|
|
3345
|
-
}), C.appendChild(
|
|
3347
|
+
}), C.appendChild(U), a.appendChild(C);
|
|
3346
3348
|
} else if (i) {
|
|
3347
3349
|
const C = document.createElement("button");
|
|
3348
|
-
C.className = "gengage-chat-product-card-cta", C.type = "button", C.textContent = i.type === "launchSingleProduct" ? B : i.title || B, C.addEventListener("click", (
|
|
3350
|
+
C.className = "gengage-chat-product-card-cta", C.type = "button", C.textContent = i.type === "launchSingleProduct" ? B : i.title || B, C.addEventListener("click", (U) => {
|
|
3349
3351
|
if (a.parentElement?.classList.contains("gengage-chat-comparison-select-wrapper")) {
|
|
3350
|
-
|
|
3352
|
+
U.stopPropagation();
|
|
3351
3353
|
return;
|
|
3352
3354
|
}
|
|
3353
3355
|
d() || e.onAction(i);
|
|
3354
3356
|
}), a.appendChild(C);
|
|
3355
3357
|
} else if (l) {
|
|
3356
3358
|
const C = document.createElement("a");
|
|
3357
|
-
C.className = "gengage-chat-product-card-cta", de(C, "href", l), de(C, "target", "_blank"), de(C, "rel", "noopener noreferrer"), C.textContent = B, C.addEventListener("click", (
|
|
3359
|
+
C.className = "gengage-chat-product-card-cta", de(C, "href", l), de(C, "target", "_blank"), de(C, "rel", "noopener noreferrer"), C.textContent = B, C.addEventListener("click", (U) => {
|
|
3358
3360
|
if (a.parentElement?.classList.contains("gengage-chat-comparison-select-wrapper")) {
|
|
3359
|
-
|
|
3361
|
+
U.preventDefault(), U.stopPropagation();
|
|
3360
3362
|
return;
|
|
3361
3363
|
}
|
|
3362
|
-
e.onProductClick && c && (
|
|
3364
|
+
e.onProductClick && c && (U.preventDefault(), e.onProductClick({
|
|
3363
3365
|
sku: c,
|
|
3364
3366
|
url: l,
|
|
3365
3367
|
...o ? { name: o } : {}
|
|
@@ -3369,16 +3371,16 @@ function pt(t, e) {
|
|
|
3369
3371
|
if (e.comparisonSelectMode && c && e.onToggleComparisonSku) {
|
|
3370
3372
|
const C = document.createElement("div");
|
|
3371
3373
|
C.className = "gengage-chat-comparison-select-wrapper";
|
|
3372
|
-
const
|
|
3373
|
-
|
|
3374
|
+
const U = e.comparisonSelectedSkus?.includes(c) ?? !1;
|
|
3375
|
+
U && C.classList.add("gengage-chat-comparison-select-wrapper--selected");
|
|
3374
3376
|
const N = n.name ?? c, q = e.i18n?.comparisonSelectCardHint ?? "Tap anywhere on the card to add or remove it from comparison.";
|
|
3375
3377
|
C.setAttribute("role", "group"), C.setAttribute("aria-label", `${String(N)}. ${q}`);
|
|
3376
3378
|
const D = document.createElement("button");
|
|
3377
|
-
D.type = "button", D.className = "gengage-chat-comparison-checkbox", D.dataset.selected =
|
|
3379
|
+
D.type = "button", D.className = "gengage-chat-comparison-checkbox", D.dataset.selected = U ? "true" : "false", D.setAttribute("aria-pressed", U ? "true" : "false");
|
|
3378
3380
|
const ne = document.createElement("span");
|
|
3379
|
-
ne.className = "gengage-chat-comparison-checkbox-icon", ne.innerHTML =
|
|
3381
|
+
ne.className = "gengage-chat-comparison-checkbox-icon", ne.innerHTML = U ? '<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>';
|
|
3380
3382
|
const W = document.createElement("span");
|
|
3381
|
-
W.className = "gengage-chat-comparison-checkbox-label", W.textContent =
|
|
3383
|
+
W.className = "gengage-chat-comparison-checkbox-label", W.textContent = U ? e.i18n?.comparisonSelectedLabel ?? "Selected" : e.i18n?.comparisonSelectLabel ?? "Select to compare", D.appendChild(ne), D.appendChild(W), D.addEventListener("click", (f) => {
|
|
3382
3384
|
f.stopPropagation(), e.onToggleComparisonSku?.(c);
|
|
3383
3385
|
});
|
|
3384
3386
|
const K = document.createElement("div");
|
|
@@ -3394,7 +3396,7 @@ var pa = /* @__PURE__ */ new Set([
|
|
|
3394
3396
|
"renk",
|
|
3395
3397
|
"renk kodu",
|
|
3396
3398
|
"color code"
|
|
3397
|
-
]),
|
|
3399
|
+
]), Or = /* @__PURE__ */ new Set([
|
|
3398
3400
|
"size",
|
|
3399
3401
|
"beden",
|
|
3400
3402
|
"boyut"
|
|
@@ -3430,7 +3432,7 @@ var pa = /* @__PURE__ */ new Set([
|
|
|
3430
3432
|
"OBJECT",
|
|
3431
3433
|
"EMBED"
|
|
3432
3434
|
]);
|
|
3433
|
-
function
|
|
3435
|
+
function be(t, ...e) {
|
|
3434
3436
|
for (const a of e) {
|
|
3435
3437
|
const n = t[a];
|
|
3436
3438
|
if (typeof n == "string") {
|
|
@@ -3465,14 +3467,14 @@ function Wr(t) {
|
|
|
3465
3467
|
return Array.isArray(t) ? t.filter((e) => typeof e == "string" && e.trim().length > 0) : [];
|
|
3466
3468
|
}
|
|
3467
3469
|
function Kr(t) {
|
|
3468
|
-
const e = [...Wr(t.images),
|
|
3470
|
+
const e = [...Wr(t.images), be(t, "imageUrl", "image_url", "image")].filter((a) => !!a && he(a));
|
|
3469
3471
|
return Array.from(new Set(e));
|
|
3470
3472
|
}
|
|
3471
3473
|
function Yr(t) {
|
|
3472
3474
|
return typeof DOMParser < "u" ? (new DOMParser().parseFromString(t, "text/html").body.textContent ?? "").replace(/\s+/g, " ").trim() : t.replace(/<[^>]*>/g, " ").replace(/\s+/g, " ").trim();
|
|
3473
3475
|
}
|
|
3474
3476
|
function Zr(t) {
|
|
3475
|
-
const e =
|
|
3477
|
+
const e = be(t, "description_html", "descriptionHtml");
|
|
3476
3478
|
if (e) {
|
|
3477
3479
|
const n = Yr(e);
|
|
3478
3480
|
if (n) return {
|
|
@@ -3480,13 +3482,13 @@ function Zr(t) {
|
|
|
3480
3482
|
html: e
|
|
3481
3483
|
};
|
|
3482
3484
|
}
|
|
3483
|
-
const a =
|
|
3485
|
+
const a = be(t, "description");
|
|
3484
3486
|
return a ? { text: a } : void 0;
|
|
3485
3487
|
}
|
|
3486
3488
|
function Ye(t) {
|
|
3487
3489
|
return Array.isArray(t) ? t.map((e) => {
|
|
3488
3490
|
if (!e || typeof e != "object") return null;
|
|
3489
|
-
const a = e, n =
|
|
3491
|
+
const a = e, n = be(a, "key", "name", "label", "title"), r = a.value, i = typeof r == "string" || typeof r == "number" || typeof r == "boolean" ? String(r).trim() : void 0;
|
|
3490
3492
|
return !n || !i ? null : {
|
|
3491
3493
|
key: n,
|
|
3492
3494
|
value: i
|
|
@@ -3510,7 +3512,7 @@ function Xr(t) {
|
|
|
3510
3512
|
return n.length > 0 ? n : void 0;
|
|
3511
3513
|
}
|
|
3512
3514
|
function Ee(t, ...e) {
|
|
3513
|
-
return
|
|
3515
|
+
return be(t, ...e);
|
|
3514
3516
|
}
|
|
3515
3517
|
function zt(t, ...e) {
|
|
3516
3518
|
return Ke(t, ...e);
|
|
@@ -3524,7 +3526,7 @@ function ma(t) {
|
|
|
3524
3526
|
}
|
|
3525
3527
|
function Qr(t) {
|
|
3526
3528
|
const e = ma(t)?.toLowerCase();
|
|
3527
|
-
return !!(
|
|
3529
|
+
return !!(be(t, "color", "colour", "color_hex", "hex", "swatch", "swatchColor") || e && pa.has(e));
|
|
3528
3530
|
}
|
|
3529
3531
|
function Rt(t) {
|
|
3530
3532
|
if (!t) return;
|
|
@@ -3546,7 +3548,7 @@ function ti(t) {
|
|
|
3546
3548
|
}
|
|
3547
3549
|
function ai(t) {
|
|
3548
3550
|
const e = t.trim().toLowerCase();
|
|
3549
|
-
return pa.has(e) ||
|
|
3551
|
+
return pa.has(e) || Or.has(e) || jr.has(e);
|
|
3550
3552
|
}
|
|
3551
3553
|
function ni(t) {
|
|
3552
3554
|
const e = t.trim().toLowerCase();
|
|
@@ -3563,7 +3565,7 @@ function ri(t) {
|
|
|
3563
3565
|
function ii(t) {
|
|
3564
3566
|
const e = ri(t);
|
|
3565
3567
|
if (e) return e;
|
|
3566
|
-
const a =
|
|
3568
|
+
const a = be(t, "sku"), n = Ge(t, "inStock", "in_stock"), r = [], i = /* @__PURE__ */ new Set(), o = (c, l) => {
|
|
3567
3569
|
if (!ai(c) || typeof l != "string" && typeof l != "number" && typeof l != "boolean") return;
|
|
3568
3570
|
const d = String(l).trim();
|
|
3569
3571
|
if (!d) return;
|
|
@@ -3588,7 +3590,7 @@ function si(t, e) {
|
|
|
3588
3590
|
a.className = "gengage-chat-product-details-panel";
|
|
3589
3591
|
const n = t.props?.product ?? t.props;
|
|
3590
3592
|
if (!n) return a;
|
|
3591
|
-
const r =
|
|
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"), d = Ge(n, "price_async"), p = 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"), g = Kr(n), _ = ha(n).slice(0, 4);
|
|
3592
3594
|
if (g.length > 1) {
|
|
3593
3595
|
const E = document.createElement("div");
|
|
3594
3596
|
E.className = "gengage-chat-product-details-media gengage-chat-product-details-gallery gengage-chat-product-details-img-wrap";
|
|
@@ -3597,20 +3599,20 @@ function si(t, e) {
|
|
|
3597
3599
|
const F = document.createElement("div");
|
|
3598
3600
|
F.className = "gengage-chat-product-gallery-thumbs";
|
|
3599
3601
|
const B = 6;
|
|
3600
|
-
let C = null,
|
|
3602
|
+
let C = null, U = 0;
|
|
3601
3603
|
const N = e.i18n, q = N?.galleryPrevAriaLabel ?? "Previous image", D = N?.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");
|
|
3602
3604
|
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");
|
|
3603
3605
|
const K = document.createElement("button");
|
|
3604
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", D), K.innerHTML = ne("next");
|
|
3605
3607
|
const f = () => {
|
|
3606
|
-
W.disabled =
|
|
3608
|
+
W.disabled = U <= 0, K.disabled = U >= g.length - 1;
|
|
3607
3609
|
}, S = (I) => {
|
|
3608
|
-
if (I < 0 || I >= g.length || I ===
|
|
3610
|
+
if (I < 0 || I >= g.length || I === U) return;
|
|
3609
3611
|
const j = g[I];
|
|
3610
3612
|
if (!j) return;
|
|
3611
3613
|
de(R, "src", j);
|
|
3612
3614
|
const Q = F.querySelectorAll(".gengage-chat-product-gallery-thumb");
|
|
3613
|
-
C && C.classList.remove("gengage-chat-product-gallery-thumb--active"), I < B && Q[I] ? (Q[I].classList.add("gengage-chat-product-gallery-thumb--active"), C = Q[I]) : C = null,
|
|
3615
|
+
C && C.classList.remove("gengage-chat-product-gallery-thumb--active"), I < B && Q[I] ? (Q[I].classList.add("gengage-chat-product-gallery-thumb--active"), C = Q[I]) : C = null, U = I, f();
|
|
3614
3616
|
};
|
|
3615
3617
|
for (let I = 0; I < g.length; I++) {
|
|
3616
3618
|
const j = g[I];
|
|
@@ -3625,17 +3627,17 @@ function si(t, e) {
|
|
|
3625
3627
|
I.className = "gengage-chat-product-gallery-thumb-more", I.textContent = `+${g.length - B}`, F.appendChild(I);
|
|
3626
3628
|
}
|
|
3627
3629
|
W.addEventListener("click", (I) => {
|
|
3628
|
-
I.stopPropagation(), S(
|
|
3630
|
+
I.stopPropagation(), S(U - 1);
|
|
3629
3631
|
}), K.addEventListener("click", (I) => {
|
|
3630
|
-
I.stopPropagation(), S(
|
|
3632
|
+
I.stopPropagation(), S(U + 1);
|
|
3631
3633
|
}), f();
|
|
3632
|
-
let
|
|
3634
|
+
let P = 0;
|
|
3633
3635
|
const $ = 50;
|
|
3634
3636
|
R.addEventListener("touchstart", (I) => {
|
|
3635
|
-
|
|
3637
|
+
P = I.changedTouches[0].clientX;
|
|
3636
3638
|
}, { passive: !0 }), R.addEventListener("touchend", (I) => {
|
|
3637
|
-
const j = I.changedTouches[0].clientX, Q =
|
|
3638
|
-
Math.abs(Q) < $ || S(Q > 0 ? Math.min(
|
|
3639
|
+
const j = I.changedTouches[0].clientX, Q = P - j;
|
|
3640
|
+
Math.abs(Q) < $ || S(Q > 0 ? Math.min(U + 1, g.length - 1) : Math.max(U - 1, 0));
|
|
3639
3641
|
}), E.appendChild(W), E.appendChild(K), E.appendChild(F), a.appendChild(E);
|
|
3640
3642
|
} else if (g.length === 1) {
|
|
3641
3643
|
const E = document.createElement("div");
|
|
@@ -3643,14 +3645,14 @@ function si(t, e) {
|
|
|
3643
3645
|
const R = document.createElement("img");
|
|
3644
3646
|
R.className = "gengage-chat-product-details-img", R.loading = "lazy", de(R, "src", g[0]), xe(R), R.alt = r ?? "Product image", E.appendChild(R), a.appendChild(E);
|
|
3645
3647
|
}
|
|
3646
|
-
const
|
|
3647
|
-
if (
|
|
3648
|
+
const y = document.createElement("div");
|
|
3649
|
+
if (y.className = "gengage-chat-product-details-content", i && (!r || !r.toLowerCase().startsWith(i.toLowerCase()))) {
|
|
3648
3650
|
const E = document.createElement("div");
|
|
3649
|
-
E.className = "gengage-chat-product-details-brand", E.textContent = i,
|
|
3651
|
+
E.className = "gengage-chat-product-details-brand", E.textContent = i, y.appendChild(E);
|
|
3650
3652
|
}
|
|
3651
3653
|
if (r) {
|
|
3652
3654
|
const E = document.createElement("h3");
|
|
3653
|
-
E.className = "gengage-chat-product-details-title", E.textContent = r, E.title = r,
|
|
3655
|
+
E.className = "gengage-chat-product-details-title", E.textContent = r, E.title = r, y.appendChild(E);
|
|
3654
3656
|
}
|
|
3655
3657
|
if (e.hideUserReviews !== !0 && typeof u == "number" && Number.isFinite(u) && u > 0) {
|
|
3656
3658
|
const E = document.createElement(o ? "button" : "div");
|
|
@@ -3666,14 +3668,14 @@ function si(t, e) {
|
|
|
3666
3668
|
const F = document.createElement("span");
|
|
3667
3669
|
F.className = "gengage-chat-product-details-review-count", F.textContent = ` (${v})`, E.appendChild(F);
|
|
3668
3670
|
}
|
|
3669
|
-
|
|
3671
|
+
y.appendChild(E);
|
|
3670
3672
|
}
|
|
3671
3673
|
{
|
|
3672
3674
|
const E = !!(p && m);
|
|
3673
|
-
let R =
|
|
3675
|
+
let R = y;
|
|
3674
3676
|
if (p && !E) {
|
|
3675
3677
|
const B = document.createElement("div");
|
|
3676
|
-
B.className = "gengage-chat-product-details-price-stack", B.appendChild(Qe(p)),
|
|
3678
|
+
B.className = "gengage-chat-product-details-price-stack", B.appendChild(Qe(p)), y.appendChild(B), R = B;
|
|
3677
3679
|
}
|
|
3678
3680
|
const F = document.createElement("div");
|
|
3679
3681
|
if (F.className = "gengage-chat-product-details-price", d === !0) {
|
|
@@ -3695,7 +3697,7 @@ function si(t, e) {
|
|
|
3695
3697
|
}
|
|
3696
3698
|
if (e.hideStockStatus !== !0 && typeof x == "boolean") {
|
|
3697
3699
|
const E = document.createElement("div");
|
|
3698
|
-
E.className = `gengage-chat-product-details-stock ${x ? "is-in-stock" : "is-out-of-stock"}`, E.textContent = x ? e.i18n?.inStockLabel ?? "In Stock" : e.i18n?.outOfStockLabel ?? "Out of Stock",
|
|
3700
|
+
E.className = `gengage-chat-product-details-stock ${x ? "is-in-stock" : "is-out-of-stock"}`, E.textContent = x ? e.i18n?.inStockLabel ?? "In Stock" : e.i18n?.outOfStockLabel ?? "Out of Stock", y.appendChild(E);
|
|
3699
3701
|
}
|
|
3700
3702
|
const b = n.promotions;
|
|
3701
3703
|
if (b && b.length > 0) {
|
|
@@ -3706,7 +3708,7 @@ function si(t, e) {
|
|
|
3706
3708
|
const F = document.createElement("span");
|
|
3707
3709
|
F.className = "gengage-chat-product-details-promo-badge", F.textContent = R, F.title = R, E.appendChild(F);
|
|
3708
3710
|
}
|
|
3709
|
-
E.childElementCount > 0 &&
|
|
3711
|
+
E.childElementCount > 0 && y.appendChild(E);
|
|
3710
3712
|
}
|
|
3711
3713
|
if (_.length > 0) {
|
|
3712
3714
|
const E = document.createElement("dl");
|
|
@@ -3719,7 +3721,7 @@ function si(t, e) {
|
|
|
3719
3721
|
const C = document.createElement("dd");
|
|
3720
3722
|
C.textContent = R.value, F.appendChild(B), F.appendChild(C), E.appendChild(F);
|
|
3721
3723
|
}
|
|
3722
|
-
|
|
3724
|
+
y.appendChild(E);
|
|
3723
3725
|
}
|
|
3724
3726
|
const A = ii(n);
|
|
3725
3727
|
if (A.length > 0) {
|
|
@@ -3730,16 +3732,16 @@ function si(t, e) {
|
|
|
3730
3732
|
const F = document.createElement("div");
|
|
3731
3733
|
F.className = "gengage-chat-product-variants-list";
|
|
3732
3734
|
for (const B of A) {
|
|
3733
|
-
const C = ua(B),
|
|
3734
|
-
if (!C && !
|
|
3735
|
+
const C = ua(B), U = Ee(B, "sku");
|
|
3736
|
+
if (!C && !U) continue;
|
|
3735
3737
|
const N = document.createElement("button");
|
|
3736
3738
|
N.className = "gengage-chat-product-variant-btn gds-chip", N.type = "button";
|
|
3737
|
-
const q = C ??
|
|
3739
|
+
const q = C ?? U ?? "";
|
|
3738
3740
|
N.title = q;
|
|
3739
3741
|
const D = Ge(B, "in_stock", "inStock");
|
|
3740
|
-
|
|
3742
|
+
U && o && U === o ? (N.classList.add("gengage-chat-product-variant-btn--active"), N.setAttribute("aria-pressed", "true")) : N.setAttribute("aria-pressed", "false"), D === !1 && (N.classList.add("gengage-chat-product-variant-btn--out"), N.disabled = !0);
|
|
3741
3743
|
const ne = ei(B), W = Jr(B);
|
|
3742
|
-
if (ne &&
|
|
3744
|
+
if (ne && he(ne)) {
|
|
3743
3745
|
const S = document.createElement("img");
|
|
3744
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), N.appendChild(S);
|
|
3745
3747
|
} else if (W) {
|
|
@@ -3753,19 +3755,19 @@ function si(t, e) {
|
|
|
3753
3755
|
const S = document.createElement("span");
|
|
3754
3756
|
S.className = "gengage-chat-product-variant-price", S.textContent = ae(String(f), e.pricing), N.appendChild(S);
|
|
3755
3757
|
}
|
|
3756
|
-
if (
|
|
3757
|
-
const S = r ?? "",
|
|
3758
|
+
if (U && U !== o) {
|
|
3759
|
+
const S = r ?? "", P = (typeof B.value == "string" ? B.value.trim() : "") || (typeof B.name == "string" ? B.name.trim() : "") || (typeof B.variant_name == "string" ? B.variant_name.trim() : "") || "", $ = S.length > 0 ? P.length > 0 && P !== S ? `${S} (${P})` : S : q;
|
|
3758
3760
|
N.addEventListener("click", () => {
|
|
3759
3761
|
e.onAction({
|
|
3760
3762
|
title: $,
|
|
3761
3763
|
type: "launchVariant",
|
|
3762
|
-
payload: { sku:
|
|
3764
|
+
payload: { sku: U }
|
|
3763
3765
|
});
|
|
3764
3766
|
});
|
|
3765
3767
|
}
|
|
3766
3768
|
F.appendChild(N);
|
|
3767
3769
|
}
|
|
3768
|
-
F.childElementCount > 0 && (E.appendChild(F),
|
|
3770
|
+
F.childElementCount > 0 && (E.appendChild(F), y.appendChild(E));
|
|
3769
3771
|
}
|
|
3770
3772
|
const T = document.createElement("div");
|
|
3771
3773
|
T.className = "gengage-chat-product-details-actions";
|
|
@@ -3788,23 +3790,23 @@ function si(t, e) {
|
|
|
3788
3790
|
});
|
|
3789
3791
|
}), T.appendChild(E);
|
|
3790
3792
|
}
|
|
3791
|
-
const
|
|
3792
|
-
if (!k &&
|
|
3793
|
+
const L = be(n, "url");
|
|
3794
|
+
if (!k && L && he(L)) {
|
|
3793
3795
|
const E = document.createElement("a");
|
|
3794
|
-
E.className = "gengage-chat-product-details-cta gds-btn gds-btn-secondary", de(E, "href",
|
|
3796
|
+
E.className = "gengage-chat-product-details-cta gds-btn gds-btn-secondary", de(E, "href", L), de(E, "target", "_blank"), de(E, "rel", "noopener noreferrer"), E.textContent = e.i18n?.viewOnSiteLabel ?? e.i18n?.productCtaLabel ?? "View on Site", E.addEventListener("click", (R) => {
|
|
3795
3797
|
e.onProductClick && o && (R.preventDefault(), e.onProductClick({
|
|
3796
3798
|
sku: o,
|
|
3797
|
-
url:
|
|
3799
|
+
url: L,
|
|
3798
3800
|
...r ? { name: r } : {}
|
|
3799
3801
|
}));
|
|
3800
3802
|
}), T.appendChild(E);
|
|
3801
3803
|
}
|
|
3802
|
-
const z =
|
|
3803
|
-
if (z &&
|
|
3804
|
+
const z = L;
|
|
3805
|
+
if (z && he(z)) {
|
|
3804
3806
|
let C = function(N, q) {
|
|
3805
3807
|
const D = document.createElementNS(F, "circle");
|
|
3806
3808
|
D.setAttribute("cx", N), D.setAttribute("cy", q), D.setAttribute("r", "3"), B.appendChild(D);
|
|
3807
|
-
},
|
|
3809
|
+
}, U = function(N, q, D, ne) {
|
|
3808
3810
|
const W = document.createElementNS(F, "line");
|
|
3809
3811
|
W.setAttribute("x1", N), W.setAttribute("y1", q), W.setAttribute("x2", D), W.setAttribute("y2", ne), B.appendChild(W);
|
|
3810
3812
|
};
|
|
@@ -3813,7 +3815,7 @@ function si(t, e) {
|
|
|
3813
3815
|
const R = e.i18n?.shareButton ?? "Share";
|
|
3814
3816
|
E.title = R, E.setAttribute("aria-label", R);
|
|
3815
3817
|
const F = "http://www.w3.org/2000/svg", B = document.createElementNS(F, "svg");
|
|
3816
|
-
B.setAttribute("width", "18"), B.setAttribute("height", "18"), B.setAttribute("viewBox", "0 0 24 24"), B.setAttribute("fill", "none"), B.setAttribute("stroke", "currentColor"), B.setAttribute("stroke-width", "2"), B.setAttribute("stroke-linecap", "round"), B.setAttribute("stroke-linejoin", "round"), C("18", "5"), C("6", "12"), C("18", "19"),
|
|
3818
|
+
B.setAttribute("width", "18"), B.setAttribute("height", "18"), B.setAttribute("viewBox", "0 0 24 24"), B.setAttribute("fill", "none"), B.setAttribute("stroke", "currentColor"), B.setAttribute("stroke-width", "2"), B.setAttribute("stroke-linecap", "round"), B.setAttribute("stroke-linejoin", "round"), C("18", "5"), C("6", "12"), C("18", "19"), U("8.59", "13.51", "15.42", "17.49"), U("15.41", "6.51", "8.59", "10.49"), E.appendChild(B), E.addEventListener("click", async () => {
|
|
3817
3819
|
try {
|
|
3818
3820
|
navigator.share ? await navigator.share({
|
|
3819
3821
|
title: r ?? "",
|
|
@@ -3823,9 +3825,9 @@ function si(t, e) {
|
|
|
3823
3825
|
}
|
|
3824
3826
|
}), T.appendChild(E);
|
|
3825
3827
|
}
|
|
3826
|
-
T.childElementCount > 0 &&
|
|
3827
|
-
const
|
|
3828
|
-
return (
|
|
3828
|
+
T.childElementCount > 0 && y.appendChild(T), a.appendChild(y);
|
|
3829
|
+
const O = Zr(n), X = Xr(n);
|
|
3830
|
+
return (O || X) && a.appendChild(gi(O, X, e)), a;
|
|
3829
3831
|
}
|
|
3830
3832
|
function ht(t) {
|
|
3831
3833
|
if (t.nodeType === Node.TEXT_NODE) return document.createTextNode(t.textContent ?? "");
|
|
@@ -3968,17 +3970,17 @@ function mi(t, e, a, n) {
|
|
|
3968
3970
|
if (!n?.onToggleComparisonSku) return;
|
|
3969
3971
|
const _ = document.createElement("button");
|
|
3970
3972
|
_.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");
|
|
3971
|
-
const
|
|
3972
|
-
|
|
3973
|
+
const y = document.createElement("span");
|
|
3974
|
+
y.className = "gengage-chat-comparison-toggle-icon", y.innerHTML = hi();
|
|
3973
3975
|
const b = document.createElement("span");
|
|
3974
3976
|
b.className = "gengage-chat-comparison-toggle-label";
|
|
3975
3977
|
const A = n.i18n?.compareSelected ?? "Compare";
|
|
3976
|
-
b.textContent = A, _.setAttribute("aria-label", A), _.title = A, _.appendChild(
|
|
3978
|
+
b.textContent = A, _.setAttribute("aria-label", A), _.title = A, _.appendChild(y), _.appendChild(b), _.addEventListener("click", () => {
|
|
3977
3979
|
n.onToggleComparisonSku?.("");
|
|
3978
3980
|
}), g.appendChild(_);
|
|
3979
3981
|
}, v = (g, _ = s.length) => {
|
|
3980
|
-
const
|
|
3981
|
-
if (o || !(d ?
|
|
3982
|
+
const y = t.props?.endOfList;
|
|
3983
|
+
if (o || !(d ? y === !1 : y !== !0) || _ === 0) return;
|
|
3982
3984
|
const b = n?.i18n?.viewMoreLabel ?? "Show More", A = document.createElement("button");
|
|
3983
3985
|
A.className = "gengage-chat-product-grid-view-more", A.type = "button", A.textContent = b, A.addEventListener("click", () => {
|
|
3984
3986
|
n?.onAction({
|
|
@@ -3995,7 +3997,7 @@ function mi(t, e, a, n) {
|
|
|
3995
3997
|
const g = document.createElement("div");
|
|
3996
3998
|
g.className = "gengage-chat-product-sort-toolbar", g.setAttribute("role", "toolbar"), g.setAttribute("aria-label", n.i18n?.sortToolbarAriaLabel ?? "Sort products");
|
|
3997
3999
|
let _ = n.productSort ?? { type: "related" };
|
|
3998
|
-
const
|
|
4000
|
+
const y = [
|
|
3999
4001
|
{
|
|
4000
4002
|
label: n.i18n?.sortRelated ?? "Related",
|
|
4001
4003
|
sortState: { type: "related" },
|
|
@@ -4023,15 +4025,15 @@ function mi(t, e, a, n) {
|
|
|
4023
4025
|
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");
|
|
4024
4026
|
const T = n.i18n?.sortToolbarAriaLabel ?? "Sort products", k = document.createElement("span");
|
|
4025
4027
|
k.className = "gengage-chat-product-sort-trigger-icon";
|
|
4026
|
-
const
|
|
4027
|
-
|
|
4028
|
+
const L = document.createElement("span");
|
|
4029
|
+
L.className = "gengage-chat-product-sort-trigger-label";
|
|
4028
4030
|
const z = (N) => {
|
|
4029
|
-
const q =
|
|
4030
|
-
|
|
4031
|
+
const q = y.find((D) => Ft(D.sortState, N)) ?? y[0];
|
|
4032
|
+
L.textContent = q.label, k.innerHTML = Ht(q.icon), b.dataset.sortIcon = q.icon, A.setAttribute("aria-label", `${T}: ${q.label}`), A.title = q.label;
|
|
4031
4033
|
};
|
|
4032
4034
|
z(_);
|
|
4033
|
-
const
|
|
4034
|
-
|
|
4035
|
+
const O = document.createElement("span");
|
|
4036
|
+
O.className = "gengage-chat-product-sort-trigger-chevron", O.innerHTML = di(), A.appendChild(k), A.appendChild(L), A.appendChild(O);
|
|
4035
4037
|
const X = document.createElement("div");
|
|
4036
4038
|
X.className = "gengage-chat-product-sort-menu gds-menu", X.hidden = !0, X.setAttribute("role", "listbox"), X.setAttribute("aria-label", T);
|
|
4037
4039
|
const E = g.ownerDocument;
|
|
@@ -4042,7 +4044,7 @@ function mi(t, e, a, n) {
|
|
|
4042
4044
|
b.classList.contains("gengage-chat-product-sort-dropdown--open") && (b.contains(N.target) || F());
|
|
4043
4045
|
}, C = (N) => {
|
|
4044
4046
|
N.key === "Escape" && (N.preventDefault(), F());
|
|
4045
|
-
},
|
|
4047
|
+
}, U = () => {
|
|
4046
4048
|
X.hidden = !1, b.classList.add("gengage-chat-product-sort-dropdown--open"), A.setAttribute("aria-expanded", "true"), R = new AbortController();
|
|
4047
4049
|
const { signal: N } = R;
|
|
4048
4050
|
E.addEventListener("click", B, { signal: N }), E.addEventListener("keydown", C, {
|
|
@@ -4051,9 +4053,9 @@ function mi(t, e, a, n) {
|
|
|
4051
4053
|
});
|
|
4052
4054
|
};
|
|
4053
4055
|
A.addEventListener("click", (N) => {
|
|
4054
|
-
N.stopPropagation(), b.classList.contains("gengage-chat-product-sort-dropdown--open") ? F() :
|
|
4056
|
+
N.stopPropagation(), b.classList.contains("gengage-chat-product-sort-dropdown--open") ? F() : U();
|
|
4055
4057
|
});
|
|
4056
|
-
for (const N of
|
|
4058
|
+
for (const N of y) {
|
|
4057
4059
|
const q = document.createElement("button");
|
|
4058
4060
|
q.type = "button", q.className = "gengage-chat-product-sort-option gds-menu-option", q.setAttribute("role", "option");
|
|
4059
4061
|
const D = Ft(_, N.sortState);
|
|
@@ -4067,8 +4069,8 @@ function mi(t, e, a, n) {
|
|
|
4067
4069
|
const f = document.createElement("span");
|
|
4068
4070
|
f.className = "gengage-chat-product-sort-option-check", f.innerHTML = pi(), f.setAttribute("aria-hidden", "true"), D || f.classList.add("gengage-chat-product-sort-option-check--hidden"), q.appendChild(W), q.appendChild(K), q.appendChild(f), q.addEventListener("click", () => {
|
|
4069
4071
|
_ = N.sortState, n.onSortChange?.(N.sortState), ui(c, s, e, N.sortState), X.querySelectorAll(".gengage-chat-product-sort-option").forEach((S) => {
|
|
4070
|
-
const
|
|
4071
|
-
|
|
4072
|
+
const P = S, $ = P.dataset.sortKey === ne;
|
|
4073
|
+
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", !$);
|
|
4072
4074
|
}), z(N.sortState), F();
|
|
4073
4075
|
}), X.appendChild(q);
|
|
4074
4076
|
}
|
|
@@ -4095,35 +4097,35 @@ function mi(t, e, a, n) {
|
|
|
4095
4097
|
const g = document.createElement("div");
|
|
4096
4098
|
g.className = "gengage-chat-product-grid-sections", g.setAttribute("role", "list");
|
|
4097
4099
|
const _ = t.props?.rankingState;
|
|
4098
|
-
let
|
|
4100
|
+
let y = 0;
|
|
4099
4101
|
for (const b of l) {
|
|
4100
|
-
|
|
4102
|
+
y += b.children.length;
|
|
4101
4103
|
const A = fi(b.children.length, n), T = document.createElement("section");
|
|
4102
4104
|
T.className = "gengage-chat-product-grid-section", T.setAttribute("role", "listitem");
|
|
4103
4105
|
const k = document.createElement("div");
|
|
4104
4106
|
if (k.className = "gengage-chat-product-grid-section-head", b.title) {
|
|
4105
|
-
const
|
|
4106
|
-
|
|
4107
|
+
const O = document.createElement("h3");
|
|
4108
|
+
O.className = "gengage-chat-product-grid-section-title", O.textContent = b.title, k.appendChild(O);
|
|
4107
4109
|
}
|
|
4108
|
-
const
|
|
4109
|
-
|
|
4110
|
+
const L = document.createElement("span");
|
|
4111
|
+
L.className = "gengage-chat-product-grid-section-count", L.textContent = A, k.appendChild(L), T.appendChild(k);
|
|
4110
4112
|
const z = document.createElement("div");
|
|
4111
4113
|
z.className = "gengage-chat-product-grid gengage-chat-product-grid--section";
|
|
4112
|
-
for (const
|
|
4113
|
-
const X = a(
|
|
4114
|
-
X && (X.dataset.elementId =
|
|
4114
|
+
for (const O of b.children) {
|
|
4115
|
+
const X = a(O);
|
|
4116
|
+
X && (X.dataset.elementId = O, z.appendChild(X));
|
|
4115
4117
|
}
|
|
4116
4118
|
(n?.isMobile ?? Ve()) && z.classList.add("gengage-chat-product-grid--mobile"), _ === "pending" && (z.classList.add("gengage-chat-product-grid--pending"), z.inert = !0, z.setAttribute("aria-busy", "true")), T.appendChild(z), g.appendChild(T);
|
|
4117
4119
|
}
|
|
4118
|
-
return r.appendChild(g), v(r,
|
|
4120
|
+
return r.appendChild(g), v(r, y), u(), r;
|
|
4119
4121
|
}
|
|
4120
4122
|
if (o) Ci(r, c, i, n);
|
|
4121
4123
|
else {
|
|
4122
4124
|
const g = fa(s, e, n?.productSort);
|
|
4123
4125
|
for (const _ of g) {
|
|
4124
4126
|
if (!e.elements[_]) continue;
|
|
4125
|
-
const
|
|
4126
|
-
|
|
4127
|
+
const y = a(_);
|
|
4128
|
+
y && (y.dataset.elementId = _, c.appendChild(y));
|
|
4127
4129
|
}
|
|
4128
4130
|
}
|
|
4129
4131
|
return (n?.isMobile ?? Ve()) && c.classList.add("gengage-chat-product-grid--mobile"), t.props?.rankingState === "pending" && (c.classList.add("gengage-chat-product-grid--pending"), c.inert = !0, c.setAttribute("aria-busy", "true")), r.appendChild(c), v(r), u(), r;
|
|
@@ -4259,24 +4261,24 @@ function vt(t, e) {
|
|
|
4259
4261
|
const g = typeof u?.sku == "string" ? u.sku : void 0;
|
|
4260
4262
|
g && d.set(g, u);
|
|
4261
4263
|
}
|
|
4262
|
-
const p = (u, g, _,
|
|
4264
|
+
const p = (u, g, _, y) => {
|
|
4263
4265
|
if (g.length === 0) return;
|
|
4264
4266
|
const b = document.createElement("section");
|
|
4265
4267
|
b.className = "gengage-chat-consulting-group";
|
|
4266
4268
|
const A = document.createElement("div");
|
|
4267
4269
|
A.className = "gengage-chat-consulting-group-header";
|
|
4268
4270
|
const T = document.createElement("h4");
|
|
4269
|
-
if (T.className = "gengage-chat-consulting-group-label", T.textContent = `${u} (${g.length})`, A.appendChild(T), typeof
|
|
4270
|
-
const
|
|
4271
|
-
|
|
4271
|
+
if (T.className = "gengage-chat-consulting-group-label", T.textContent = `${u} (${g.length})`, A.appendChild(T), typeof y == "string" && y.trim().length > 0) {
|
|
4272
|
+
const L = document.createElement("p");
|
|
4273
|
+
L.className = "gengage-chat-consulting-group-reason", L.textContent = y, A.appendChild(L);
|
|
4272
4274
|
}
|
|
4273
4275
|
b.appendChild(A);
|
|
4274
4276
|
const k = document.createElement("div");
|
|
4275
4277
|
k.className = "gengage-chat-product-grid gengage-chat-consulting-group-grid", _ && k.classList.add("gengage-chat-consulting-group-grid--single-group"), k.style.setProperty("--consulting-group-columns", String(Math.max(1, Math.min(4, g.length))));
|
|
4276
|
-
for (const
|
|
4278
|
+
for (const L of g) {
|
|
4277
4279
|
const z = pt({
|
|
4278
4280
|
type: "ProductCard",
|
|
4279
|
-
props: { product:
|
|
4281
|
+
props: { product: L }
|
|
4280
4282
|
}, r ?? { onAction: () => {
|
|
4281
4283
|
} });
|
|
4282
4284
|
k.appendChild(z);
|
|
@@ -4286,11 +4288,11 @@ function vt(t, e) {
|
|
|
4286
4288
|
for (const u of l) {
|
|
4287
4289
|
const g = (Array.isArray(u.skus) ? u.skus.filter((b) => typeof b == "string" && b.trim().length > 0) : []).map((b) => (h.add(b), d.get(b))).filter((b) => !!b);
|
|
4288
4290
|
if (g.length === 0) continue;
|
|
4289
|
-
const _ = typeof u.label == "string" && u.label.trim().length > 0 ? u.label : i.consultingFallbackGroupLabel,
|
|
4291
|
+
const _ = typeof u.label == "string" && u.label.trim().length > 0 ? u.label : i.consultingFallbackGroupLabel, y = typeof u.reason == "string" ? u.reason : void 0;
|
|
4290
4292
|
m.push({
|
|
4291
4293
|
labelText: _,
|
|
4292
4294
|
products: g,
|
|
4293
|
-
...
|
|
4295
|
+
...y !== void 0 ? { reasonText: y } : {}
|
|
4294
4296
|
});
|
|
4295
4297
|
}
|
|
4296
4298
|
const x = c.filter((u) => {
|
|
@@ -4320,7 +4322,7 @@ function mt(t, e, a, n) {
|
|
|
4320
4322
|
let s = t.querySelector(".gengage-chat-consulting-style-media");
|
|
4321
4323
|
s ? s.innerHTML = "" : (s = document.createElement("div"), s.className = "gengage-chat-consulting-style-media", t.appendChild(s));
|
|
4322
4324
|
const c = yi(e.image_url);
|
|
4323
|
-
if (c &&
|
|
4325
|
+
if (c && he(c)) {
|
|
4324
4326
|
const d = document.createElement("img");
|
|
4325
4327
|
d.className = "gengage-chat-consulting-style-image", d.draggable = !1, de(d, "src", c), d.alt = We(e, a + 1, n), d.loading = "lazy", xe(d), s.appendChild(d);
|
|
4326
4328
|
}
|
|
@@ -4458,7 +4460,7 @@ function Li(t) {
|
|
|
4458
4460
|
contentAreaBottom: r
|
|
4459
4461
|
};
|
|
4460
4462
|
}
|
|
4461
|
-
var
|
|
4463
|
+
var Ut = "gengage-floating-launcher-style";
|
|
4462
4464
|
function Ti(t) {
|
|
4463
4465
|
return `
|
|
4464
4466
|
@property --gengage-fl-ring-angle {
|
|
@@ -4753,10 +4755,10 @@ function Ii(t, e, a) {
|
|
|
4753
4755
|
"Ürün ara",
|
|
4754
4756
|
"Karşılaştır",
|
|
4755
4757
|
"Soru sor"
|
|
4756
|
-
], placeholderInterval: x = 2e3, voiceLang: v = "tr-TR", showBorderAnimation: u = !0, sendAriaLabel: g = "Gönder", micAriaLabel: _ = "Sesli giriş", cancelAriaLabel:
|
|
4757
|
-
if (!a.getElementById(
|
|
4758
|
+
], placeholderInterval: x = 2e3, voiceLang: v = "tr-TR", showBorderAnimation: u = !0, sendAriaLabel: g = "Gönder", micAriaLabel: _ = "Sesli giriş", cancelAriaLabel: y = "Ses kaydını durdur", openChatAriaLabel: b = "Chat'i aç" } = t;
|
|
4759
|
+
if (!a.getElementById(Ut)) {
|
|
4758
4760
|
const V = document.createElement("style");
|
|
4759
|
-
V.id =
|
|
4761
|
+
V.id = Ut, V.textContent = Ti({
|
|
4760
4762
|
primaryColor: n,
|
|
4761
4763
|
backgroundColor: r,
|
|
4762
4764
|
textColor: i,
|
|
@@ -4771,16 +4773,16 @@ function Ii(t, e, a) {
|
|
|
4771
4773
|
}
|
|
4772
4774
|
const A = document.createElement("div");
|
|
4773
4775
|
A.className = "gengage-fl", A.dataset.gengagePart = "floating-launcher", A.innerHTML = Ai();
|
|
4774
|
-
const T = A.querySelector(".gengage-fl-input"), k = A.querySelector(".gengage-fl-transcript"),
|
|
4775
|
-
T.placeholder = m[0] ?? "",
|
|
4776
|
-
let C = !1,
|
|
4776
|
+
const T = A.querySelector(".gengage-fl-input"), k = A.querySelector(".gengage-fl-transcript"), L = A.querySelector(".gengage-fl-transcript-final"), z = A.querySelector(".gengage-fl-transcript-interim"), O = A.querySelector(".gengage-fl-btn-send"), X = A.querySelector(".gengage-fl-btn-mic"), E = A.querySelector(".gengage-fl-btn-open-chat"), R = A.querySelector(".gengage-fl-cancel"), F = A.querySelector(".gengage-fl-wave"), B = A.querySelector(".gengage-fl-ring");
|
|
4777
|
+
T.placeholder = m[0] ?? "", O.setAttribute("aria-label", g), X.setAttribute("aria-label", _), R.setAttribute("aria-label", y), E.setAttribute("aria-label", b);
|
|
4778
|
+
let C = !1, U = !1, N = "", q = !1, D = null, ne = 0, W = null, K = null, f = null, S = null, P = null, $ = 0;
|
|
4777
4779
|
function I() {
|
|
4778
4780
|
const V = T.value.trim().length > 0;
|
|
4779
4781
|
if (X.classList.toggle("is-recording", C), C) {
|
|
4780
|
-
|
|
4782
|
+
O.style.display = "flex", X.style.display = "flex", R.style.display = "flex", E.style.display = "none";
|
|
4781
4783
|
return;
|
|
4782
4784
|
}
|
|
4783
|
-
|
|
4785
|
+
O.style.display = V ? "flex" : "none", X.style.display = V ? "none" : "flex", R.style.display = "none", E.style.display = !V && q ? "flex" : "none";
|
|
4784
4786
|
}
|
|
4785
4787
|
function j() {
|
|
4786
4788
|
ne = (ne + 1) % m.length, T.placeholder = m[ne] ?? "", W = setTimeout(j, x);
|
|
@@ -4791,27 +4793,27 @@ function Ii(t, e, a) {
|
|
|
4791
4793
|
function te() {
|
|
4792
4794
|
W !== null && (clearTimeout(W), W = null);
|
|
4793
4795
|
}
|
|
4794
|
-
function
|
|
4795
|
-
C && (C = !1,
|
|
4796
|
+
function se() {
|
|
4797
|
+
C && (C = !1, w(), U = !1, oe(), u && H(), N = "", T.style.display = "", k.style.display = "none", L.textContent = "", z.textContent = "");
|
|
4796
4798
|
const V = T.value.trim();
|
|
4797
4799
|
V && (e.onSend(V), q || (q = !0)), T.value = "", N = "", I();
|
|
4798
4800
|
}
|
|
4799
|
-
function
|
|
4801
|
+
function re() {
|
|
4800
4802
|
const V = window, G = V.SpeechRecognition ?? V.webkitSpeechRecognition;
|
|
4801
4803
|
if (!G) {
|
|
4802
4804
|
console.warn("[FloatingLauncher] SpeechRecognition not supported.");
|
|
4803
4805
|
return;
|
|
4804
4806
|
}
|
|
4805
|
-
D || (D = new G(), D.continuous = !0, D.interimResults = !0, D.lang = v), C = !0,
|
|
4807
|
+
D || (D = new G(), D.continuous = !0, D.interimResults = !0, D.lang = v), C = !0, U = !0, N = "", T.value = "", T.style.display = "none", k.style.display = "flex", L.textContent = "", z.textContent = "", I(), ce(), u && M(), D.onresult = (J) => {
|
|
4806
4808
|
if (!C) return;
|
|
4807
|
-
let
|
|
4809
|
+
let ie = "", Z = "";
|
|
4808
4810
|
for (let le = J.resultIndex; le < J.results.length; le++) {
|
|
4809
4811
|
const Ae = J.results[le];
|
|
4810
4812
|
if (!Ae) continue;
|
|
4811
4813
|
const Fe = Ae[0]?.transcript ?? "";
|
|
4812
|
-
Ae.isFinal ? Z += Fe :
|
|
4814
|
+
Ae.isFinal ? Z += Fe : ie += Fe;
|
|
4813
4815
|
}
|
|
4814
|
-
N += Z,
|
|
4816
|
+
N += Z, L.textContent = N, z.textContent = ie, T.value = `${N} ${ie}`.trim(), I();
|
|
4815
4817
|
}, D.onend = () => Y(), D.onerror = () => Y();
|
|
4816
4818
|
try {
|
|
4817
4819
|
D.start();
|
|
@@ -4819,14 +4821,14 @@ function Ii(t, e, a) {
|
|
|
4819
4821
|
Y();
|
|
4820
4822
|
}
|
|
4821
4823
|
}
|
|
4822
|
-
function
|
|
4824
|
+
function w() {
|
|
4823
4825
|
try {
|
|
4824
4826
|
D?.stop();
|
|
4825
4827
|
} catch {
|
|
4826
4828
|
}
|
|
4827
4829
|
}
|
|
4828
4830
|
function Y() {
|
|
4829
|
-
|
|
4831
|
+
U && (U = !1, C = !1, oe(), u && H(), N.trim() && (T.value = N.trim()), T.style.display = "", k.style.display = "none", L.textContent = "", z.textContent = "", I());
|
|
4830
4832
|
}
|
|
4831
4833
|
async function ce() {
|
|
4832
4834
|
const V = ++$, G = Array.from(F.querySelectorAll("span"));
|
|
@@ -4837,7 +4839,7 @@ function Ii(t, e, a) {
|
|
|
4837
4839
|
return;
|
|
4838
4840
|
}
|
|
4839
4841
|
K = J;
|
|
4840
|
-
const
|
|
4842
|
+
const ie = window, Z = ie.AudioContext ?? ie.webkitAudioContext;
|
|
4841
4843
|
if (!Z)
|
|
4842
4844
|
throw K = null, J.getTracks().forEach((Ie) => Ie.stop()), new Error("AudioContext not supported");
|
|
4843
4845
|
const le = new Z();
|
|
@@ -4853,17 +4855,17 @@ function Ii(t, e, a) {
|
|
|
4853
4855
|
const Ie = Math.max(1, Math.floor(Ae.length / G.length));
|
|
4854
4856
|
G.forEach((ka, Ca) => {
|
|
4855
4857
|
ka.style.height = `${4 + Math.round((Ae[Ca * Ie] ?? 0) / 255 * 8)}px`;
|
|
4856
|
-
}),
|
|
4858
|
+
}), P = requestAnimationFrame(Fe);
|
|
4857
4859
|
};
|
|
4858
4860
|
Fe();
|
|
4859
4861
|
} catch {
|
|
4860
4862
|
if (!C || V !== $) return;
|
|
4861
|
-
|
|
4863
|
+
P !== null && (cancelAnimationFrame(P), P = null), S && (S.disconnect(), S = null), f && (f.close().catch(() => {
|
|
4862
4864
|
}), f = null), K && (K.getTracks().forEach((J) => J.stop()), K = null), F.classList.add("is-css-animated");
|
|
4863
4865
|
}
|
|
4864
4866
|
}
|
|
4865
|
-
function
|
|
4866
|
-
$ += 1, F.classList.remove("is-css-animated"),
|
|
4867
|
+
function oe() {
|
|
4868
|
+
$ += 1, F.classList.remove("is-css-animated"), P !== null && (cancelAnimationFrame(P), P = null), S && (S.disconnect(), S = null), f && (f.close().catch(() => {
|
|
4867
4869
|
}), f = null), K && (K.getTracks().forEach((V) => V.stop()), K = null), Array.from(F.querySelectorAll("span")).forEach((V) => {
|
|
4868
4870
|
V.style.height = "4px";
|
|
4869
4871
|
});
|
|
@@ -4874,20 +4876,20 @@ function Ii(t, e, a) {
|
|
|
4874
4876
|
function H() {
|
|
4875
4877
|
B.classList.remove("is-active");
|
|
4876
4878
|
}
|
|
4877
|
-
|
|
4878
|
-
V.preventDefault(), V.stopPropagation(), C ?
|
|
4879
|
+
O.addEventListener("click", se), X.addEventListener("click", (V) => {
|
|
4880
|
+
V.preventDefault(), V.stopPropagation(), C ? w() : re();
|
|
4879
4881
|
}), R.addEventListener("click", () => {
|
|
4880
|
-
C && (C = !1,
|
|
4882
|
+
C && (C = !1, w(), U = !1, oe(), u && H(), N = "", T.style.display = "", k.style.display = "none", L.textContent = "", z.textContent = "", I());
|
|
4881
4883
|
}), E.addEventListener("click", (V) => {
|
|
4882
4884
|
V.preventDefault(), V.stopPropagation(), e.onOpenChat();
|
|
4883
4885
|
}), T.addEventListener("input", I), T.addEventListener("keydown", (V) => {
|
|
4884
|
-
V.key === "Enter" &&
|
|
4886
|
+
V.key === "Enter" && se();
|
|
4885
4887
|
}), I(), Q();
|
|
4886
4888
|
function ee() {
|
|
4887
4889
|
q = !0, I();
|
|
4888
4890
|
}
|
|
4889
4891
|
function pe() {
|
|
4890
|
-
te(),
|
|
4892
|
+
te(), oe(), H(), C && (C = !1, w()), D && (D.onresult = null, D.onend = null, D.onerror = null, D = null);
|
|
4891
4893
|
}
|
|
4892
4894
|
return {
|
|
4893
4895
|
container: A,
|
|
@@ -4895,7 +4897,7 @@ function Ii(t, e, a) {
|
|
|
4895
4897
|
destroy: pe
|
|
4896
4898
|
};
|
|
4897
4899
|
}
|
|
4898
|
-
var Mi = "gengage-inline-launcher-style",
|
|
4900
|
+
var Mi = "gengage-inline-launcher-style", Ot = "gengage-inline-launcher-hide-floating", fe = "gengage-inline-launcher", Ni = "gengage-inline-launcher", je = "data-gengage-inline-sibling", rt = "data-gengage-inline-sibling-restore-index", Bi = '<svg viewBox="0 0 20 20" fill="none" aria-hidden="true"><path d="M8.85 2.4c.23 0 .43.16.48.39l.9 3.77a3.8 3.8 0 0 0 2.8 2.8l3.77.9a.5.5 0 0 1 0 .98l-3.77.9a3.8 3.8 0 0 0-2.8 2.8l-.9 3.77a.5.5 0 0 1-.98 0l-.9-3.77a3.8 3.8 0 0 0-2.8-2.8l-3.77-.9a.5.5 0 0 1 0-.98l3.77-.9a3.8 3.8 0 0 0 2.8-2.8l.9-3.77c.05-.23.25-.39.48-.39Z" fill="currentColor"/><path d="M15.95 1.1c.12 0 .23.08.26.2l.32 1.34c.16.68.7 1.21 1.37 1.37l1.34.32a.27.27 0 0 1 0 .53l-1.34.32a1.87 1.87 0 0 0-1.37 1.37l-.32 1.34a.27.27 0 0 1-.53 0l-.32-1.34A1.87 1.87 0 0 0 14 5.18l-1.34-.32a.27.27 0 0 1 0-.53L14 4a1.87 1.87 0 0 0 1.37-1.37l.32-1.34c.03-.12.14-.2.26-.2Z" fill="currentColor" opacity=".72"/></svg>', ge = {
|
|
4899
4901
|
rowGap: "14px",
|
|
4900
4902
|
buttonHeight: "46px",
|
|
4901
4903
|
buttonPadding: "0 14px 0 10px",
|
|
@@ -4947,7 +4949,7 @@ function zi(t) {
|
|
|
4947
4949
|
};
|
|
4948
4950
|
}
|
|
4949
4951
|
function Ri(t) {
|
|
4950
|
-
const e = `.${t.rowClassName}`, a = `#${CSS.escape(t.buttonId)}`, n = `.${
|
|
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;", d = c.mobile.hideSpark ? "display:none;" : "display:inline-flex;", p = c.mobile.hideLogo ? "display:none !important;width:0 !important;height:0 !important;flex:0 0 0 !important;overflow:hidden !important;" : "display:inline-flex;";
|
|
4951
4953
|
return `
|
|
4952
4954
|
${e}{
|
|
4953
4955
|
display:flex;
|
|
@@ -4999,7 +5001,7 @@ ${a}:focus-visible{
|
|
|
4999
5001
|
outline:2px solid color-mix(in srgb, ${t.primaryColor} 34%, white);
|
|
5000
5002
|
outline-offset:2px;
|
|
5001
5003
|
}
|
|
5002
|
-
${a}.${
|
|
5004
|
+
${a}.${fe}--active{
|
|
5003
5005
|
border-color:${t.primaryColor};
|
|
5004
5006
|
background:linear-gradient(180deg,#fff7ef 0%,#ffe7d5 100%);
|
|
5005
5007
|
box-shadow:0 16px 28px color-mix(in srgb, ${t.primaryColor} 24%, transparent);
|
|
@@ -5079,9 +5081,9 @@ function Hi(t) {
|
|
|
5079
5081
|
return new Promise((e) => window.setTimeout(e, t));
|
|
5080
5082
|
}
|
|
5081
5083
|
function Fi(t, e, a) {
|
|
5082
|
-
const { hostSelector: n, rowClassName: r = "gengage-inline-launcher-row", siblingSelector: i, siblingPlacement: o = "before", rowPlacement: s = "end", title: c = "Ask", iconUrl: l, primaryColor: d = "#6366f1", textColor: p = "#222222", fontFamily: h = "inherit", borderRadius: m = "3px", showSparkIcon: x = !0, desktopMinWidth: v = 0, enableOnMobile: u = !1, disabledPageTypes: g = ["pdp"], hideFloatingLauncher: _ = !0, mountPollFrames:
|
|
5084
|
+
const { hostSelector: n, rowClassName: r = "gengage-inline-launcher-row", siblingSelector: i, siblingPlacement: o = "before", rowPlacement: s = "end", title: c = "Ask", iconUrl: l, primaryColor: d = "#6366f1", textColor: p = "#222222", fontFamily: h = "inherit", borderRadius: m = "3px", showSparkIcon: x = !0, desktopMinWidth: v = 0, enableOnMobile: u = !1, disabledPageTypes: g = ["pdp"], hideFloatingLauncher: _ = !0, mountPollFrames: y = 90, debounceMs: b = 90, buttonId: A = Ni } = t, T = t.ariaLabel ?? c, k = t.siblingRestoreParentSelector ?? n, L = u && v > 0 ? v : 576, z = zi(t.size), O = `${Mi}-${A}`;
|
|
5083
5085
|
let X = !1, E = !1, R = null, F = null, B = null, C = null;
|
|
5084
|
-
const
|
|
5086
|
+
const U = () => {
|
|
5085
5087
|
if (u && v > 0 && window.innerWidth < v && t.mobileHost && t.mobileHost) {
|
|
5086
5088
|
const M = t.mobileHost;
|
|
5087
5089
|
return {
|
|
@@ -5104,28 +5106,28 @@ function Fi(t, e, a) {
|
|
|
5104
5106
|
M.siblingSelector ?? "",
|
|
5105
5107
|
M.siblingRestoreParentSelector
|
|
5106
5108
|
].join("|"), q = () => {
|
|
5107
|
-
if (document.getElementById(
|
|
5109
|
+
if (document.getElementById(O)) return;
|
|
5108
5110
|
const M = document.createElement("style");
|
|
5109
|
-
M.id =
|
|
5111
|
+
M.id = O, M.textContent = Ri({
|
|
5110
5112
|
primaryColor: d,
|
|
5111
5113
|
textColor: p,
|
|
5112
5114
|
fontFamily: h,
|
|
5113
5115
|
borderRadius: m,
|
|
5114
5116
|
rowClassName: r,
|
|
5115
|
-
compactBelowWidth:
|
|
5117
|
+
compactBelowWidth: L,
|
|
5116
5118
|
buttonId: A,
|
|
5117
5119
|
sizes: z
|
|
5118
5120
|
}), document.head.appendChild(M);
|
|
5119
5121
|
}, D = (M) => {
|
|
5120
5122
|
if (!_ || !a.shadowRoot) return;
|
|
5121
|
-
const H = a.shadowRoot.getElementById(
|
|
5123
|
+
const H = a.shadowRoot.getElementById(Ot);
|
|
5122
5124
|
if (!M) {
|
|
5123
5125
|
H?.remove();
|
|
5124
5126
|
return;
|
|
5125
5127
|
}
|
|
5126
5128
|
if (H) return;
|
|
5127
5129
|
const ee = document.createElement("style");
|
|
5128
|
-
ee.id =
|
|
5130
|
+
ee.id = Ot, ee.textContent = ".gengage-chat-launcher-container,.gengage-fl{display:none!important;}", a.shadowRoot.appendChild(ee);
|
|
5129
5131
|
}, ne = (M) => {
|
|
5130
5132
|
const H = document.querySelector(M);
|
|
5131
5133
|
return H instanceof HTMLElement ? H : null;
|
|
@@ -5146,14 +5148,14 @@ function Fi(t, e, a) {
|
|
|
5146
5148
|
if (!H) return;
|
|
5147
5149
|
const ee = Array.from(H.children).indexOf(M);
|
|
5148
5150
|
ee >= 0 && M.setAttribute(rt, String(ee));
|
|
5149
|
-
},
|
|
5151
|
+
}, P = (M) => {
|
|
5150
5152
|
const H = K(M), ee = f(M.siblingRestoreParentSelector);
|
|
5151
5153
|
if (!H || !ee) return;
|
|
5152
5154
|
if (S(H), H.parentElement === ee) {
|
|
5153
5155
|
H.removeAttribute(je);
|
|
5154
5156
|
return;
|
|
5155
5157
|
}
|
|
5156
|
-
const pe = H.getAttribute(rt), V = pe ? Number.parseInt(pe, 10) : 0, G = Array.from(ee.children).filter((
|
|
5158
|
+
const pe = H.getAttribute(rt), V = pe ? Number.parseInt(pe, 10) : 0, G = Array.from(ee.children).filter((ie) => !(ie instanceof HTMLElement && ie.classList.contains(r))), J = Number.isFinite(V) && V >= 0 ? G[V] ?? null : null;
|
|
5157
5159
|
if (J) {
|
|
5158
5160
|
ee.insertBefore(H, J), H.removeAttribute(je);
|
|
5159
5161
|
return;
|
|
@@ -5163,12 +5165,12 @@ function Fi(t, e, a) {
|
|
|
5163
5165
|
M.querySelector(`.${r}`)?.remove();
|
|
5164
5166
|
}, I = () => {
|
|
5165
5167
|
const M = document.createElement("span");
|
|
5166
|
-
M.className = `${
|
|
5168
|
+
M.className = `${fe}-icon`;
|
|
5167
5169
|
const H = document.createElement("img");
|
|
5168
5170
|
return H.src = l, H.alt = "", H.draggable = !1, M.appendChild(H), M;
|
|
5169
|
-
}, j = () => window.innerWidth <
|
|
5171
|
+
}, j = () => window.innerWidth < L, Q = (M) => {
|
|
5170
5172
|
if (!l) return;
|
|
5171
|
-
const H = M.querySelector(`.${
|
|
5173
|
+
const H = M.querySelector(`.${fe}-icon`);
|
|
5172
5174
|
if (j() && z.mobile.hideLogo) {
|
|
5173
5175
|
H?.remove();
|
|
5174
5176
|
return;
|
|
@@ -5176,55 +5178,55 @@ function Fi(t, e, a) {
|
|
|
5176
5178
|
H || M.insertBefore(I(), M.firstChild);
|
|
5177
5179
|
}, te = () => {
|
|
5178
5180
|
const M = document.createElement("button");
|
|
5179
|
-
M.type = "button", M.id = A, M.className =
|
|
5181
|
+
M.type = "button", M.id = A, M.className = fe, M.setAttribute("aria-label", T), l && M.appendChild(I());
|
|
5180
5182
|
const H = document.createElement("span");
|
|
5181
|
-
H.className = `${
|
|
5183
|
+
H.className = `${fe}-copy`;
|
|
5182
5184
|
const ee = document.createElement("span");
|
|
5183
|
-
if (ee.className = `${
|
|
5185
|
+
if (ee.className = `${fe}-title`, ee.textContent = c, H.appendChild(ee), M.appendChild(H), x) {
|
|
5184
5186
|
const pe = document.createElement("span");
|
|
5185
|
-
pe.className = `${
|
|
5187
|
+
pe.className = `${fe}-spark`, pe.innerHTML = Bi, M.appendChild(pe);
|
|
5186
5188
|
}
|
|
5187
5189
|
return M.addEventListener("click", () => e.onClick()), M;
|
|
5188
|
-
},
|
|
5190
|
+
}, se = (M, H, ee) => {
|
|
5189
5191
|
if (S(H), H.setAttribute(je, "true"), o === "before") {
|
|
5190
5192
|
(H.parentElement !== M || H.nextElementSibling !== ee) && M.insertBefore(H, ee);
|
|
5191
5193
|
return;
|
|
5192
5194
|
}
|
|
5193
5195
|
(H.parentElement !== M || ee.nextElementSibling !== H) && M.appendChild(H);
|
|
5194
|
-
},
|
|
5196
|
+
}, re = () => {
|
|
5195
5197
|
if (B) {
|
|
5196
|
-
|
|
5198
|
+
P(B);
|
|
5197
5199
|
const M = ne(B.hostSelector);
|
|
5198
5200
|
M && $(M), B = null;
|
|
5199
5201
|
}
|
|
5200
5202
|
C = null, D(!1), X = !1;
|
|
5201
|
-
},
|
|
5203
|
+
}, w = (M) => !(M && g.includes(M) || v > 0 && window.innerWidth < v && !u), Y = async (M) => {
|
|
5202
5204
|
const H = M ?? a.getPageType();
|
|
5203
|
-
if (!
|
|
5204
|
-
return
|
|
5205
|
+
if (!w(H))
|
|
5206
|
+
return re(), !1;
|
|
5205
5207
|
q();
|
|
5206
|
-
const ee =
|
|
5207
|
-
B && N(B) !== N(ee) &&
|
|
5208
|
-
for (let pe = 0; pe <
|
|
5209
|
-
if (!
|
|
5210
|
-
return
|
|
5211
|
-
const V =
|
|
5208
|
+
const ee = U();
|
|
5209
|
+
B && N(B) !== N(ee) && re();
|
|
5210
|
+
for (let pe = 0; pe < y; pe += 1) {
|
|
5211
|
+
if (!w(H))
|
|
5212
|
+
return re(), !1;
|
|
5213
|
+
const V = U(), G = ne(V.hostSelector), J = K(V);
|
|
5212
5214
|
if (G && (!V.siblingSelector || J)) {
|
|
5213
|
-
B && N(B) !== N(V) &&
|
|
5214
|
-
let
|
|
5215
|
-
|
|
5216
|
-
let Z =
|
|
5217
|
-
return Z instanceof HTMLButtonElement ? F = Z : (Z = te(), F = Z,
|
|
5215
|
+
B && N(B) !== N(V) && re(), J && S(J);
|
|
5216
|
+
let ie = G.querySelector(`.${r}`);
|
|
5217
|
+
ie instanceof HTMLElement || (ie = document.createElement("div"), ie.className = r, V.rowPlacement === "start" ? G.insertBefore(ie, G.firstChild) : G.appendChild(ie));
|
|
5218
|
+
let Z = ie.querySelector(`#${CSS.escape(A)}`);
|
|
5219
|
+
return Z instanceof HTMLButtonElement ? F = Z : (Z = te(), F = Z, ie.appendChild(Z)), J && se(ie, J, Z), Q(Z), E ? Z.classList.add(`${fe}--active`) : Z.classList.remove(`${fe}--active`), D(!0), X = !0, B = V, !0;
|
|
5218
5220
|
}
|
|
5219
5221
|
await Hi(16);
|
|
5220
5222
|
}
|
|
5221
|
-
return
|
|
5223
|
+
return re(), !1;
|
|
5222
5224
|
}, ce = () => {
|
|
5223
5225
|
R !== null && window.clearTimeout(R), R = window.setTimeout(() => {
|
|
5224
5226
|
R = null, Y();
|
|
5225
5227
|
}, b);
|
|
5226
|
-
},
|
|
5227
|
-
return window.addEventListener("resize",
|
|
5228
|
+
}, oe = () => ce();
|
|
5229
|
+
return window.addEventListener("resize", oe, { passive: !0 }), window.addEventListener("orientationchange", oe), {
|
|
5228
5230
|
get isMounted() {
|
|
5229
5231
|
return X;
|
|
5230
5232
|
},
|
|
@@ -5232,10 +5234,10 @@ function Fi(t, e, a) {
|
|
|
5232
5234
|
return Y(M);
|
|
5233
5235
|
},
|
|
5234
5236
|
setActive(M) {
|
|
5235
|
-
E = M, F?.classList.toggle(`${
|
|
5237
|
+
E = M, F?.classList.toggle(`${fe}--active`, M);
|
|
5236
5238
|
},
|
|
5237
5239
|
destroy() {
|
|
5238
|
-
R !== null && (window.clearTimeout(R), R = null), window.removeEventListener("resize",
|
|
5240
|
+
R !== null && (window.clearTimeout(R), R = null), window.removeEventListener("resize", oe), window.removeEventListener("orientationchange", oe), re(), document.getElementById(O)?.remove(), F = null;
|
|
5239
5241
|
}
|
|
5240
5242
|
};
|
|
5241
5243
|
}
|
|
@@ -5251,7 +5253,7 @@ var Di = /* @__PURE__ */ new Set([
|
|
|
5251
5253
|
function it(t) {
|
|
5252
5254
|
t.pause(), t.removeAttribute("src"), t.load(), ya.delete(t);
|
|
5253
5255
|
}
|
|
5254
|
-
function
|
|
5256
|
+
function Ui(t, e = "audio/ogg") {
|
|
5255
5257
|
const a = e.split(";")[0].trim();
|
|
5256
5258
|
if (!Di.has(a)) return null;
|
|
5257
5259
|
try {
|
|
@@ -5263,7 +5265,7 @@ function Oi(t, e = "audio/ogg") {
|
|
|
5263
5265
|
return null;
|
|
5264
5266
|
}
|
|
5265
5267
|
}
|
|
5266
|
-
var
|
|
5268
|
+
var Oi = /* @__PURE__ */ new Set([
|
|
5267
5269
|
"P",
|
|
5268
5270
|
"DIV",
|
|
5269
5271
|
"H1",
|
|
@@ -5289,7 +5291,7 @@ var Ui = /* @__PURE__ */ new Set([
|
|
|
5289
5291
|
function ji(t) {
|
|
5290
5292
|
const e = [];
|
|
5291
5293
|
let a = [];
|
|
5292
|
-
for (const n of t) n.nodeType === Node.ELEMENT_NODE &&
|
|
5294
|
+
for (const n of t) n.nodeType === Node.ELEMENT_NODE && Oi.has(n.tagName) ? (a.length > 0 && (e.push(a), a = []), e.push([n])) : a.push(n);
|
|
5293
5295
|
return a.length > 0 && e.push(a), e;
|
|
5294
5296
|
}
|
|
5295
5297
|
function qi(t) {
|
|
@@ -5364,10 +5366,10 @@ function Gi(t) {
|
|
|
5364
5366
|
c = s.nextNode();
|
|
5365
5367
|
continue;
|
|
5366
5368
|
}
|
|
5367
|
-
const _ = document.createElement("a");
|
|
5368
|
-
|
|
5369
|
-
|
|
5370
|
-
}), x && g.insertBefore(document.createTextNode(x), c), g.insertBefore(
|
|
5369
|
+
const _ = typeof o.url == "string" && o.url.trim() && he(o.url.trim()) ? o.url.trim() : void 0, y = document.createElement("a");
|
|
5370
|
+
y.className = "gengage-product-mention", y.textContent = v, y.href = _ ?? "#", y.addEventListener("click", (b) => {
|
|
5371
|
+
b.preventDefault(), n(o);
|
|
5372
|
+
}), x && g.insertBefore(document.createTextNode(x), c), g.insertBefore(y, c), u && g.insertBefore(document.createTextNode(u), c), g.removeChild(c), l = !0;
|
|
5371
5373
|
}
|
|
5372
5374
|
}
|
|
5373
5375
|
}
|
|
@@ -5658,7 +5660,7 @@ var ao = class {
|
|
|
5658
5660
|
const a = this._snapshotRebuilders.get(t), n = this.snapshots.get(t);
|
|
5659
5661
|
if (!a && !n) return !1;
|
|
5660
5662
|
const r = this.deps.shadow(), i = this.deps.drawer();
|
|
5661
|
-
this.activePanelMessageId && r?.querySelector(`[data-message-id="${
|
|
5663
|
+
this.activePanelMessageId && r?.querySelector(`[data-message-id="${ue(this.activePanelMessageId)}"]`)?.classList.remove("gengage-chat-bubble--active"), r?.querySelector(`[data-message-id="${ue(e)}"]`)?.classList.add("gengage-chat-bubble--active"), this.activePanelMessageId = e;
|
|
5662
5664
|
const o = a ? a() : n.cloneNode(!0);
|
|
5663
5665
|
i?.setPanelContent(o);
|
|
5664
5666
|
const s = this.snapshotTypes.get(t);
|
|
@@ -5792,7 +5794,7 @@ function po(t, e) {
|
|
|
5792
5794
|
function ot(t) {
|
|
5793
5795
|
return `${so}:${t}`;
|
|
5794
5796
|
}
|
|
5795
|
-
function
|
|
5797
|
+
function Ue(t, e) {
|
|
5796
5798
|
return `${co}:${t}:${e}`;
|
|
5797
5799
|
}
|
|
5798
5800
|
function wa(t) {
|
|
@@ -5869,7 +5871,7 @@ var xo = class {
|
|
|
5869
5871
|
return t ? t.map(bo).sort((e, a) => a.updatedAt.localeCompare(e.updatedAt)) : [];
|
|
5870
5872
|
}
|
|
5871
5873
|
loadSession(t) {
|
|
5872
|
-
const e = Gt(this._storage?.getItem(
|
|
5874
|
+
const e = Gt(this._storage?.getItem(Ue(this._scope, t)) ?? null);
|
|
5873
5875
|
return !e || e.version !== Vt ? null : vo(e);
|
|
5874
5876
|
}
|
|
5875
5877
|
saveSession(t) {
|
|
@@ -5920,14 +5922,14 @@ var xo = class {
|
|
|
5920
5922
|
sourceSessionId: l.sourceSessionId
|
|
5921
5923
|
}); d.length > lo; ) {
|
|
5922
5924
|
const p = d.pop();
|
|
5923
|
-
p && this._storage.removeItem(
|
|
5925
|
+
p && this._storage.removeItem(Ue(this._scope, p.id));
|
|
5924
5926
|
}
|
|
5925
5927
|
return this._commitRecord(l, d) ? l : null;
|
|
5926
5928
|
}
|
|
5927
5929
|
deleteSession(t) {
|
|
5928
5930
|
if (!this._storage) return;
|
|
5929
5931
|
const e = this.listSessions().filter((a) => a.id !== t);
|
|
5930
|
-
this._storage.removeItem(
|
|
5932
|
+
this._storage.removeItem(Ue(this._scope, t));
|
|
5931
5933
|
try {
|
|
5932
5934
|
this._storage.setItem(ot(this._scope), JSON.stringify(e));
|
|
5933
5935
|
} catch {
|
|
@@ -5937,12 +5939,12 @@ var xo = class {
|
|
|
5937
5939
|
if (!this._storage) return !1;
|
|
5938
5940
|
const a = [...e];
|
|
5939
5941
|
for (; a.length > 0; ) try {
|
|
5940
|
-
return this._storage.setItem(
|
|
5942
|
+
return this._storage.setItem(Ue(this._scope, t.id), JSON.stringify(t)), this._storage.setItem(ot(this._scope), JSON.stringify(a)), !0;
|
|
5941
5943
|
} catch {
|
|
5942
5944
|
const n = a.pop();
|
|
5943
5945
|
if (!n) break;
|
|
5944
5946
|
if (n.id !== t.id) {
|
|
5945
|
-
this._storage.removeItem(
|
|
5947
|
+
this._storage.removeItem(Ue(this._scope, n.id));
|
|
5946
5948
|
continue;
|
|
5947
5949
|
}
|
|
5948
5950
|
break;
|
|
@@ -6023,7 +6025,7 @@ var xo = class {
|
|
|
6023
6025
|
await e();
|
|
6024
6026
|
} catch {
|
|
6025
6027
|
}
|
|
6026
|
-
a?.send("openURLInNewTab", { url: t }),
|
|
6028
|
+
a?.send("openURLInNewTab", { url: t }), he(t) && n(t);
|
|
6027
6029
|
}
|
|
6028
6030
|
async loadPayload(t, e) {
|
|
6029
6031
|
if (!this._db) return null;
|
|
@@ -6234,7 +6236,7 @@ function Ro(t) {
|
|
|
6234
6236
|
function Ho(t) {
|
|
6235
6237
|
if (!t.trim()) return !1;
|
|
6236
6238
|
const e = document.createElement("template");
|
|
6237
|
-
return e.innerHTML =
|
|
6239
|
+
return e.innerHTML = ve(t), (e.content.textContent ?? "").trim().length > 0;
|
|
6238
6240
|
}
|
|
6239
6241
|
function Zt(t) {
|
|
6240
6242
|
return t.length > 120 ? !1 : /^[a-zA-Z0-9#(),.\s%/\-]+$/.test(t);
|
|
@@ -6255,7 +6257,7 @@ var Fo = class Me extends Ya {
|
|
|
6255
6257
|
if (!this._hostScrollLockActive || !this._hostScrollLockViewport || this._hostScrollPinning || this._isMobileViewport && window.visualViewport && window.visualViewport.height < window.innerHeight) return;
|
|
6256
6258
|
const a = this._hostScrollLockViewport;
|
|
6257
6259
|
window.scrollX === a.x && window.scrollY === a.y || (this._hostScrollPinning = !0, window.scrollTo(a.x, a.y), this._hostScrollPinning = !1);
|
|
6258
|
-
}, this._messages = [], this._currentMessageId = 0, this._abortControllers = /* @__PURE__ */ new Set(), this._currentThreadId = null, this._lastThreadId = null, this._chatCreatedAt = "", this._lastBackendContext = null, this._productSort = { type: "related" }, this._comparisonSelectMode = !1, this._comparisonSelectedSkus = [], this._comparisonSelectionWarning = null, this._comparisonRefreshRafId = null, this._lastAppliedKeyboardInset = 0, this._syncVisualVh = null, this._viewedProductSkus = /* @__PURE__ */ new Set(), this._panelAiSpecByThread = /* @__PURE__ */ new Map(), this._choicePrompterEl = null, this._openState = "full", this._mobileBreakpoint = 768, this._isMobileViewport = !1, this._gaPrevMainPaneExpanded = !1, this._pdpLaunched = !1, this._plpLaunched = !1, this._homepageLaunched = !1, this._entryContextPrimed = !1, this._contextPrimingInFlight = !1, this._queuedUserMessages = [], this._productContextUnavailableSku = null, this._i18n = Re, this._extendedModeManager = null, this._activeTypewriter = null, this._activeTtsHandle = null, this._activeRequestThreadId = null, this._skuToProductItem = {}, this._conversationMode = null, this._initComplete = !1, this._pendingActions = [], this._bridgeContext = null, this._cartQuantity = null, this._threadsWithFirstBot = /* @__PURE__ */ new Set(), this._panel = null, this._localPanelHistory = [], this._currentPanelSource = null, this._currentInlineProductSummaryRecord = null, this._session = null, this._historyStorage = null, this._activeHistorySessionId = null, this._presentation = new yo(), this._presentationScrollTimerIds = /* @__PURE__ */ new Set(), this._eventCallbacks = /* @__PURE__ */ new Map(), this._pendingAddToCartKeys = /* @__PURE__ */ new Set(), this._lastSentAction = null, this._consecutiveErrorCount = 0, this._lastErrorMessage = "", this._launcherAnchorCleanup = null, this._modeController = new
|
|
6260
|
+
}, this._messages = [], this._currentMessageId = 0, this._abortControllers = /* @__PURE__ */ new Set(), this._currentThreadId = null, this._lastThreadId = null, this._chatCreatedAt = "", this._lastBackendContext = null, this._productSort = { type: "related" }, this._comparisonSelectMode = !1, this._comparisonSelectedSkus = [], this._comparisonSelectionWarning = null, this._comparisonRefreshRafId = null, this._lastAppliedKeyboardInset = 0, this._syncVisualVh = null, this._viewedProductSkus = /* @__PURE__ */ new Set(), this._panelAiSpecByThread = /* @__PURE__ */ new Map(), this._choicePrompterEl = null, this._openState = "full", this._mobileBreakpoint = 768, this._isMobileViewport = !1, this._gaPrevMainPaneExpanded = !1, this._pdpLaunched = !1, this._plpLaunched = !1, this._homepageLaunched = !1, this._entryContextPrimed = !1, this._contextPrimingInFlight = !1, this._queuedUserMessages = [], this._productContextUnavailableSku = null, this._i18n = Re, this._extendedModeManager = null, this._activeTypewriter = null, this._activeTtsHandle = null, this._activeRequestThreadId = null, this._skuToProductItem = {}, this._conversationMode = null, this._initComplete = !1, this._pendingActions = [], this._bridgeContext = null, this._cartQuantity = null, this._threadsWithFirstBot = /* @__PURE__ */ new Set(), this._panel = null, this._localPanelHistory = [], this._currentPanelSource = null, this._currentInlineProductSummaryRecord = null, this._session = null, this._historyStorage = null, this._activeHistorySessionId = null, this._presentation = new yo(), this._presentationScrollTimerIds = /* @__PURE__ */ new Set(), this._eventCallbacks = /* @__PURE__ */ new Map(), this._pendingAddToCartKeys = /* @__PURE__ */ new Set(), this._lastSentAction = null, this._consecutiveErrorCount = 0, this._lastErrorMessage = "", this._launcherAnchorCleanup = null, this._modeController = new Un(), this._syncLauncherAnchor = null;
|
|
6259
6261
|
}
|
|
6260
6262
|
static {
|
|
6261
6263
|
this._MAX_COMPARISON_SELECTION = 5;
|
|
@@ -6290,7 +6292,7 @@ var Fo = class Me extends Ya {
|
|
|
6290
6292
|
for (const [u, g] of Object.entries(e.theme)) u.startsWith("--") && typeof g == "string" && r(u, g);
|
|
6291
6293
|
this._applyDiscountedPriceColorVar(e.productPriceUi?.discountedPriceColor);
|
|
6292
6294
|
const i = document.createElement("div");
|
|
6293
|
-
i.className = "gengage-chat-root", i.lang =
|
|
6295
|
+
i.className = "gengage-chat-root", i.lang = Oe(e.locale), this._rootEl = i, this._shadow.appendChild(i);
|
|
6294
6296
|
const o = e.variant ?? "floating";
|
|
6295
6297
|
if (o === "inline" && i.classList.add("gengage-chat--inline"), o !== "inline") {
|
|
6296
6298
|
const u = document.createElement("div");
|
|
@@ -6420,15 +6422,15 @@ var Fo = class Me extends Ya {
|
|
|
6420
6422
|
if (!this._drawerVisible || !this._isMobileViewport) return;
|
|
6421
6423
|
const _ = this._drawer?.getElement();
|
|
6422
6424
|
if (!_) return;
|
|
6423
|
-
const
|
|
6424
|
-
T !== this._lastAppliedKeyboardInset && (this._lastAppliedKeyboardInset = T, _.style.setProperty("--gengage-chat-keyboard-inset", `${T}px`)), this._openState === "full" && (_.style.setProperty("--gengage-chat-visual-vh", `${Math.round(
|
|
6425
|
+
const y = window.visualViewport, b = Math.max(0, Math.round(window.innerHeight - (y.height + y.offsetTop))), A = b > 90, T = this._openState === "full" && A ? b : 0;
|
|
6426
|
+
T !== this._lastAppliedKeyboardInset && (this._lastAppliedKeyboardInset = T, _.style.setProperty("--gengage-chat-keyboard-inset", `${T}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`));
|
|
6425
6427
|
};
|
|
6426
6428
|
this._syncVisualVh = () => {
|
|
6427
6429
|
if (!this._isMobileViewport || this._openState !== "full") return;
|
|
6428
6430
|
const _ = this._drawer?.getElement();
|
|
6429
6431
|
if (!_ || !window.visualViewport) return;
|
|
6430
|
-
const
|
|
6431
|
-
_.style.setProperty("--gengage-chat-visual-vh", `${Math.round(
|
|
6432
|
+
const y = window.visualViewport;
|
|
6433
|
+
_.style.setProperty("--gengage-chat-visual-vh", `${Math.round(y.height)}px`), _.style.setProperty("--gengage-chat-visual-top", `${Math.round(y.offsetTop)}px`);
|
|
6432
6434
|
}, window.visualViewport.addEventListener("resize", g), window.visualViewport.addEventListener("scroll", g), this.addCleanup(() => {
|
|
6433
6435
|
window.visualViewport?.removeEventListener("resize", g), window.visualViewport?.removeEventListener("scroll", g);
|
|
6434
6436
|
});
|
|
@@ -6505,20 +6507,20 @@ var Fo = class Me extends Ya {
|
|
|
6505
6507
|
const l = () => {
|
|
6506
6508
|
const T = window.innerWidth <= r ? a.mobile : a.desktop;
|
|
6507
6509
|
if (!T) return;
|
|
6508
|
-
const k = T.selector,
|
|
6510
|
+
const k = T.selector, L = !!k, z = (L ? document.querySelector(k) : null)?.getBoundingClientRect();
|
|
6509
6511
|
if (T.bottom !== void 0) {
|
|
6510
|
-
const { offset:
|
|
6511
|
-
if (!
|
|
6512
|
+
const { offset: O, type: X } = T.bottom;
|
|
6513
|
+
if (!L) n.style.setProperty(s, `${Math.max(0, O)}px`);
|
|
6512
6514
|
else if (z) {
|
|
6513
|
-
const E = X === "root" ||
|
|
6515
|
+
const E = X === "root" || O === 0 ? z.bottom : z.top, R = Math.max(0, window.innerHeight - E + O);
|
|
6514
6516
|
n.style.setProperty(s, `${R}px`);
|
|
6515
6517
|
}
|
|
6516
6518
|
}
|
|
6517
6519
|
if (T.right !== void 0) {
|
|
6518
|
-
const { offset:
|
|
6519
|
-
if (!
|
|
6520
|
+
const { offset: O, type: X } = T.right;
|
|
6521
|
+
if (!L) n.style.setProperty(c, `${Math.max(0, O)}px`);
|
|
6520
6522
|
else if (z) {
|
|
6521
|
-
const E = X === "root" ||
|
|
6523
|
+
const E = X === "root" || O === 0 ? z.right : z.left, R = Math.max(0, window.innerWidth - E + O);
|
|
6522
6524
|
n.style.setProperty(c, `${R}px`);
|
|
6523
6525
|
}
|
|
6524
6526
|
}
|
|
@@ -6539,12 +6541,12 @@ var Fo = class Me extends Ya {
|
|
|
6539
6541
|
return !T || !!document.querySelector(T);
|
|
6540
6542
|
}, _ = () => {
|
|
6541
6543
|
!o() || g() || (u?.disconnect(), u = new MutationObserver(() => {
|
|
6542
|
-
g() && (u?.disconnect(), u = null,
|
|
6544
|
+
g() && (u?.disconnect(), u = null, y());
|
|
6543
6545
|
}), u.observe(document.body, {
|
|
6544
6546
|
childList: !0,
|
|
6545
6547
|
subtree: !0
|
|
6546
6548
|
}));
|
|
6547
|
-
},
|
|
6549
|
+
}, y = () => {
|
|
6548
6550
|
x.disconnect(), v?.disconnect(), v = null, p = !1;
|
|
6549
6551
|
const T = i();
|
|
6550
6552
|
if (!T) return;
|
|
@@ -6553,19 +6555,19 @@ var Fo = class Me extends Ya {
|
|
|
6553
6555
|
return;
|
|
6554
6556
|
}
|
|
6555
6557
|
const k = document.querySelector(T.selector);
|
|
6556
|
-
k && (x.observe(k), o() ? (v = new IntersectionObserver((
|
|
6557
|
-
for (const z of
|
|
6558
|
+
k && (x.observe(k), o() ? (v = new IntersectionObserver((L) => {
|
|
6559
|
+
for (const z of L) z.isIntersecting ? (p = !0, l()) : (p = !1, d(), _());
|
|
6558
6560
|
}, { threshold: 0 }), v.observe(k)) : l());
|
|
6559
6561
|
};
|
|
6560
|
-
|
|
6562
|
+
y();
|
|
6561
6563
|
let b = 0;
|
|
6562
6564
|
const A = () => {
|
|
6563
6565
|
b || (b = requestAnimationFrame(() => {
|
|
6564
|
-
b = 0, p = !1, d(), u?.disconnect(), u = null,
|
|
6566
|
+
b = 0, p = !1, d(), u?.disconnect(), u = null, y(), _(), o() || l();
|
|
6565
6567
|
}));
|
|
6566
6568
|
};
|
|
6567
6569
|
window.addEventListener("resize", A, { passive: !0 }), window.addEventListener("scroll", m, { passive: !0 }), window.visualViewport?.addEventListener("scroll", m, { passive: !0 }), this._syncLauncherAnchor = () => {
|
|
6568
|
-
p = !1, d(), u?.disconnect(), u = null,
|
|
6570
|
+
p = !1, d(), u?.disconnect(), u = null, y(), _();
|
|
6569
6571
|
}, o() ? _() : (l(), [
|
|
6570
6572
|
100,
|
|
6571
6573
|
400,
|
|
@@ -6640,7 +6642,7 @@ var Fo = class Me extends Ya {
|
|
|
6640
6642
|
if (a.role === "assistant" && !a.frontendOnly && (a.status === "streaming" || a.status === "done") && (a.content == null || a.content.length === 0)) {
|
|
6641
6643
|
if (a.threadId) {
|
|
6642
6644
|
const n = this._messages.some((r) => r.id !== a.id && r.threadId === a.threadId && r.frontendOnly) || this._panel?.snapshotTypes.has(a.id) === !0;
|
|
6643
|
-
this._threadsWithFirstBot.delete(a.threadId), this._presentation.finalizeAssistantGroup(a.threadId), this._shadow?.querySelectorAll(`[data-thread-id="${
|
|
6645
|
+
this._threadsWithFirstBot.delete(a.threadId), this._presentation.finalizeAssistantGroup(a.threadId), this._shadow?.querySelectorAll(`[data-thread-id="${ue(a.threadId)}"]:not([data-message-id])`).forEach((r) => r.remove()), this._panel && !n && (this._panel.threads = this._panel.threads.filter((r) => r !== a.threadId));
|
|
6644
6646
|
}
|
|
6645
6647
|
this._drawer?.removeMessageBubble(a.id), this._panel?.snapshots.delete(a.id), this._panel?.snapshotTypes.delete(a.id);
|
|
6646
6648
|
continue;
|
|
@@ -7051,7 +7053,7 @@ var Fo = class Me extends Ya {
|
|
|
7051
7053
|
}
|
|
7052
7054
|
if (this._maybeHandleDirectAddToCartCommand(e)) return;
|
|
7053
7055
|
}
|
|
7054
|
-
this._contextPrimingInFlight && (this._abortAllActiveRequests(), this._contextPrimingInFlight = !1, this._queuedUserMessages = []), this._ensureMobileFullSheetForPanel(), Ma(), this._messages.some((r) => r.role === "user") ||
|
|
7056
|
+
this._contextPrimingInFlight && (this._abortAllActiveRequests(), this._contextPrimingInFlight = !1, this._queuedUserMessages = []), this._ensureMobileFullSheetForPanel(), Ma(), this._messages.some((r) => r.role === "user") || Oa(), ze("chat", "sendMessage", {
|
|
7055
7057
|
mode: this._assistantMode,
|
|
7056
7058
|
hasAttachment: a !== void 0,
|
|
7057
7059
|
textLength: e.length
|
|
@@ -7093,12 +7095,12 @@ var Fo = class Me extends Ya {
|
|
|
7093
7095
|
return;
|
|
7094
7096
|
}
|
|
7095
7097
|
if (this._clearChoicePrompter(), a?.preservePanel || qt(), !a?.preservePanel && this._comparisonSelectMode && e.type !== "getComparisonTable" && (this._comparisonSelectMode = !1, this._comparisonSelectedSkus = []), a?.preservePanel || (this._localPanelHistory = []), this._currentThreadId && this._lastThreadId && this._lastThreadId > this._currentThreadId) {
|
|
7096
|
-
const f = this._currentThreadId, S = this._messages.filter((
|
|
7097
|
-
this._messages = this._messages.filter((
|
|
7098
|
-
for (const
|
|
7099
|
-
this._shadow?.querySelector(`[data-message-id="${
|
|
7100
|
-
this._panel?.pruneThreadsAfter(f), this._shadow?.querySelectorAll("[data-thread-id]")?.forEach((
|
|
7101
|
-
|
|
7098
|
+
const f = this._currentThreadId, S = this._messages.filter((P) => P.threadId !== void 0 && P.threadId > f);
|
|
7099
|
+
this._messages = this._messages.filter((P) => !P.threadId || P.threadId <= f);
|
|
7100
|
+
for (const P of S)
|
|
7101
|
+
this._shadow?.querySelector(`[data-message-id="${ue(P.id)}"]`)?.remove(), this._panel?.deleteSnapshotForMessage(P.id);
|
|
7102
|
+
this._panel?.pruneThreadsAfter(f), this._shadow?.querySelectorAll("[data-thread-id]")?.forEach((P) => {
|
|
7103
|
+
P instanceof HTMLElement && P.dataset.threadId && P.dataset.threadId > f && P.remove();
|
|
7102
7104
|
});
|
|
7103
7105
|
}
|
|
7104
7106
|
a?.preservePills || this._drawer?.setPills([]), this._drawer?.clearInputAreaChips();
|
|
@@ -7115,8 +7117,8 @@ var Fo = class Me extends Ya {
|
|
|
7115
7117
|
const f = typeof e.payload == "string" ? e.payload : typeof e.payload?.text == "string" ? e.payload.text : e.title, S = this._messages.length > 0 ? this._messages[this._messages.length - 1] : void 0;
|
|
7116
7118
|
if (!(S !== void 0 && S.role === "user" && S.content === f)) {
|
|
7117
7119
|
(!this._messages.some(($) => $.role === "user") || this._drawer?.isKvkkBannerVisible()) && (ct(this.config.accountId), this._drawer?.hideKvkkBanner());
|
|
7118
|
-
const
|
|
7119
|
-
|
|
7120
|
+
const P = this._createMessage("user", f);
|
|
7121
|
+
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();
|
|
7120
7122
|
}
|
|
7121
7123
|
}
|
|
7122
7124
|
const d = !a?.silent && this._assistantMode === "shopping" && this._hasUnavailableProductContext() && (e.type === "user_message" || e.type === "inputText");
|
|
@@ -7143,7 +7145,7 @@ var Fo = class Me extends Ya {
|
|
|
7143
7145
|
...this.config.injectorAdapter ? { injectorAdapter: this.config.injectorAdapter } : {}
|
|
7144
7146
|
};
|
|
7145
7147
|
a?.attachment !== void 0 && (_.attachment = a.attachment);
|
|
7146
|
-
const
|
|
7148
|
+
const y = this._getVisibleMessages().filter((f) => !f.frontendOnly && f !== g && (f.content || f.role === "assistant")).slice(-50).map((f) => ({
|
|
7147
7149
|
role: f.role === "user" ? "user" : "model",
|
|
7148
7150
|
content: f.content ?? ""
|
|
7149
7151
|
})), b = {
|
|
@@ -7174,44 +7176,44 @@ var Fo = class Me extends Ya {
|
|
|
7174
7176
|
session_id: this.config.session?.sessionId ?? "",
|
|
7175
7177
|
correlation_id: this.config.session?.sessionId ?? "",
|
|
7176
7178
|
type: A.type,
|
|
7177
|
-
locale:
|
|
7179
|
+
locale: Oe(this.config.locale),
|
|
7178
7180
|
meta: b,
|
|
7179
7181
|
context: {
|
|
7180
7182
|
...this._lastBackendContext ?? {},
|
|
7181
|
-
messages:
|
|
7183
|
+
messages: y,
|
|
7182
7184
|
session_id: this.config.session?.sessionId ?? ""
|
|
7183
7185
|
}
|
|
7184
7186
|
};
|
|
7185
7187
|
this.config.session?.userId !== void 0 && (T.user_id = this.config.session.userId), this.config.session?.viewId !== void 0 && (T.view_id = this.config.session.viewId), A.payload !== void 0 && (T.payload = A.payload), !d && this.config.pageContext?.sku !== void 0 && (T.sku = this.config.pageContext.sku), !d && this.config.pageContext?.pageType !== void 0 && (T.page_type = this.config.pageContext.pageType);
|
|
7186
|
-
let k = !1,
|
|
7187
|
-
const R =
|
|
7188
|
+
let k = !1, L = !1, z = !1, O = !1, X = !1, E = !1;
|
|
7189
|
+
const R = On();
|
|
7188
7190
|
let F = null, B = null;
|
|
7189
7191
|
const C = () => {
|
|
7190
|
-
if (this._drawer && !
|
|
7192
|
+
if (this._drawer && !O) {
|
|
7191
7193
|
if (!z) {
|
|
7192
7194
|
this._drawer.setPanelAiZoneState("hidden");
|
|
7193
7195
|
return;
|
|
7194
7196
|
}
|
|
7195
7197
|
X ? this._drawer.setPanelAiZoneState("hidden") : this._drawer.setPanelAiZoneState("analyzing", { analyzingLabel: this._i18n.aiAnalysisAnalyzingLabel });
|
|
7196
7198
|
}
|
|
7197
|
-
},
|
|
7199
|
+
}, U = (f) => {
|
|
7198
7200
|
if (!F || !this._drawer) return;
|
|
7199
7201
|
const S = this._buildRenderContext();
|
|
7200
7202
|
S.isStreaming = f;
|
|
7201
|
-
const
|
|
7202
|
-
|
|
7203
|
-
}, N = (f, S,
|
|
7203
|
+
const P = this._renderUISpec(F, S);
|
|
7204
|
+
O = !0, this._drawer.setPanelAiZoneState("results", { resultEl: P }), F = null;
|
|
7205
|
+
}, N = (f, S, P) => {
|
|
7204
7206
|
if (f === "ProductGrid" || f === "CategoriesContainer") {
|
|
7205
|
-
z = !0,
|
|
7207
|
+
z = !0, U(P), C();
|
|
7206
7208
|
return;
|
|
7207
7209
|
}
|
|
7208
|
-
S !== "appendSimilars" && S !== "append" && (z = !1,
|
|
7209
|
-
}, q = (f) => (f === "ProductGrid" || f === "CategoriesContainer") && (z ||
|
|
7210
|
+
S !== "appendSimilars" && S !== "append" && (z = !1, O = !1, F = null, this._drawer?.setPanelAiZoneState("hidden"));
|
|
7211
|
+
}, q = (f) => (f === "ProductGrid" || f === "CategoriesContainer") && (z || O || F !== null), D = () => {
|
|
7210
7212
|
E || (E = !0, this._drawer?.removeTypingIndicator(), r(!1), this._bridge?.send("loadingMessage", { text: null }));
|
|
7211
|
-
}, ne = (f, S,
|
|
7213
|
+
}, ne = (f, S, P) => {
|
|
7212
7214
|
if (!this._drawer || !this._panel) return;
|
|
7213
7215
|
const $ = f.elements[f.root];
|
|
7214
|
-
if (
|
|
7216
|
+
if (P === "ProductGrid" && $) {
|
|
7215
7217
|
const I = ft($);
|
|
7216
7218
|
if (I.isConsulting) {
|
|
7217
7219
|
const j = this._drawer.getPanelContentElement();
|
|
@@ -7219,63 +7221,72 @@ var Fo = class Me extends Ya {
|
|
|
7219
7221
|
this._comparisonSelectMode = !1, this._comparisonSelectedSkus = [], this._comparisonSelectionWarning = null, this._drawer.setComparisonDockContent(null), this._currentPanelSource = {
|
|
7220
7222
|
kind: "spec",
|
|
7221
7223
|
spec: f
|
|
7222
|
-
}, this._panel.currentType =
|
|
7224
|
+
}, this._panel.currentType = P, this._drawer.resyncPanelTopBarFromCurrentContent();
|
|
7223
7225
|
return;
|
|
7224
7226
|
}
|
|
7225
7227
|
}
|
|
7226
7228
|
}
|
|
7227
|
-
this._comparisonSelectMode = !1, this._comparisonSelectedSkus = [], this._comparisonSelectionWarning = null, this._drawer.setComparisonDockContent(null), this._drawer.setPanelContent(this._renderUISpec(f, S), { preserveAiZone: q(
|
|
7229
|
+
this._comparisonSelectMode = !1, this._comparisonSelectedSkus = [], this._comparisonSelectionWarning = null, this._drawer.setComparisonDockContent(null), this._drawer.setPanelContent(this._renderUISpec(f, S), { preserveAiZone: q(P) }), this._currentPanelSource = {
|
|
7228
7230
|
kind: "spec",
|
|
7229
7231
|
spec: f
|
|
7230
|
-
}, this._panel.currentType =
|
|
7231
|
-
}, W = (f, S,
|
|
7232
|
+
}, this._panel.currentType = P;
|
|
7233
|
+
}, W = (f, S, P, $) => {
|
|
7232
7234
|
if (!this._panel) return;
|
|
7233
7235
|
f === "ProductDetailsPanel" && e.type === "launchSingleProduct" && this._clearUnavailableProductContext(), g.threadId && this._panel.threads[this._panel.threads.length - 1] !== g.threadId && this._panel.threads.push(g.threadId), this._isMobileViewport && f === "ProductGrid" && this._ensureMobilePanelOverlayVisible();
|
|
7234
7236
|
const I = this._panel.currentType ?? f, j = S?.props?.panelTitle;
|
|
7235
|
-
this._panel.updateTopBar(I, j), this._panel.updateExtendedMode(f), this._isMobileViewport && c && this._drawer?.hideMobilePanel(), N(f,
|
|
7237
|
+
this._panel.updateTopBar(I, j), this._panel.updateExtendedMode(f), this._isMobileViewport && c && this._drawer?.hideMobilePanel(), N(f, P, $);
|
|
7236
7238
|
};
|
|
7237
7239
|
let K = null;
|
|
7238
7240
|
if (K = pn(T, {
|
|
7239
|
-
onTextChunk: (f, S,
|
|
7240
|
-
if (!o && i !== this._activeRequestThreadId || (u += f,
|
|
7241
|
+
onTextChunk: (f, S, P) => {
|
|
7242
|
+
if (!o && i !== this._activeRequestThreadId || (u += f, P?.skuToProductItem && (this._skuToProductItem = {
|
|
7241
7243
|
...this._skuToProductItem,
|
|
7242
|
-
...
|
|
7243
|
-
}),
|
|
7244
|
+
...P.skuToProductItem
|
|
7245
|
+
}), P?.conversationMode && (this._conversationMode = P.conversationMode), P?.renderHint && (g.renderHint = P.renderHint), !this._drawer)) return;
|
|
7244
7246
|
let $ = u;
|
|
7245
|
-
const I =
|
|
7247
|
+
const I = P?.kvkk === !0, j = I ? { fallbackToFirstBlock: !0 } : void 0;
|
|
7246
7248
|
if (I || xt($)) {
|
|
7247
7249
|
if (S) {
|
|
7248
7250
|
const te = this.config.accountId;
|
|
7249
7251
|
if (!Kt(te)) {
|
|
7250
|
-
const
|
|
7251
|
-
|
|
7252
|
+
const se = Ao($, j);
|
|
7253
|
+
se && this._drawer?.showKvkkBanner(se), ct(te);
|
|
7252
7254
|
}
|
|
7253
7255
|
}
|
|
7254
7256
|
$ = To($, j), u = $;
|
|
7255
7257
|
}
|
|
7256
7258
|
Ho($) && D();
|
|
7257
7259
|
const Q = this._shadow?.querySelector(`[data-message-id="${g.id}"] .gengage-chat-bubble-text`);
|
|
7258
|
-
if (Q ? Q.innerHTML =
|
|
7260
|
+
if (Q ? Q.innerHTML = ve($) : (g.content = $, g.role === "assistant" && g.threadId && !this._threadsWithFirstBot.has(g.threadId) && (this._threadsWithFirstBot.add(g.threadId), this._drawer.markFirstBotMessage(g.id)), this._drawer.addMessage(g)), S)
|
|
7259
7261
|
if (g.content = $, g.status = "done", yt(), qn(g))
|
|
7260
7262
|
this._drawer?.updateBotMessage(g.id, $, "photo_analysis", g.photoAnalysis), g.threadId && this._focusPresentationThread(g.threadId, "auto");
|
|
7261
7263
|
else {
|
|
7262
7264
|
const te = this._shadow?.querySelector(`[data-message-id="${g.id}"] .gengage-chat-bubble-text`);
|
|
7263
7265
|
if (te) {
|
|
7264
7266
|
this._activeTypewriter?.cancel();
|
|
7265
|
-
const
|
|
7267
|
+
const se = P?.productMentions ? this._enrichProductMentionsWithUrls(P.productMentions) : void 0;
|
|
7266
7268
|
this._activeTypewriter = Vi({
|
|
7267
7269
|
container: te,
|
|
7268
|
-
html:
|
|
7270
|
+
html: ve($),
|
|
7269
7271
|
onTick: () => this._drawer?.scrollToBottomIfNeeded(),
|
|
7270
7272
|
onComplete: () => {
|
|
7271
|
-
this._activeTypewriter = null,
|
|
7273
|
+
this._activeTypewriter = null, se && se.length > 0 && te && Gi({
|
|
7272
7274
|
container: te,
|
|
7273
|
-
mentions:
|
|
7274
|
-
onProductClick: (
|
|
7275
|
+
mentions: se,
|
|
7276
|
+
onProductClick: (re) => {
|
|
7277
|
+
const w = re.url?.trim() ?? "";
|
|
7278
|
+
if (w && he(w)) {
|
|
7279
|
+
this._handleProductNavClick({
|
|
7280
|
+
sku: re.sku,
|
|
7281
|
+
url: w,
|
|
7282
|
+
name: re.short_name
|
|
7283
|
+
});
|
|
7284
|
+
return;
|
|
7285
|
+
}
|
|
7275
7286
|
this._sendAction({
|
|
7276
|
-
title:
|
|
7287
|
+
title: re.short_name || re.sku,
|
|
7277
7288
|
type: "launchSingleProduct",
|
|
7278
|
-
payload: { sku:
|
|
7289
|
+
payload: { sku: re.sku }
|
|
7279
7290
|
});
|
|
7280
7291
|
}
|
|
7281
7292
|
});
|
|
@@ -7284,7 +7295,7 @@ var Fo = class Me extends Ya {
|
|
|
7284
7295
|
}
|
|
7285
7296
|
}
|
|
7286
7297
|
},
|
|
7287
|
-
onUISpec: (f, S,
|
|
7298
|
+
onUISpec: (f, S, P, $) => {
|
|
7288
7299
|
if (!o && i !== this._activeRequestThreadId || S !== "chat") return;
|
|
7289
7300
|
$ && (this._clearAssistantPanelLikeStreamClearPanel(), k = !1, B = null);
|
|
7290
7301
|
const I = f.elements[f.root], j = I?.type ?? "unknown";
|
|
@@ -7302,8 +7313,8 @@ var Fo = class Me extends Ya {
|
|
|
7302
7313
|
}
|
|
7303
7314
|
const Q = gt(I), te = this.config.productDetailsExtended !== !0 && (j === "ProductDetailsPanel" || Q);
|
|
7304
7315
|
te && !$ && (this._clearAssistantPanelLikeStreamClearPanel(), k = !1);
|
|
7305
|
-
const
|
|
7306
|
-
if (
|
|
7316
|
+
const se = j === "ProductDetailsPanel" && P !== "panel" ? "panel" : P, re = this._buildRenderContext();
|
|
7317
|
+
if (re.isStreaming = !0, j === "ComparisonTable") {
|
|
7307
7318
|
const G = I?.props?.products;
|
|
7308
7319
|
$a(Array.isArray(G) ? G.length : 0);
|
|
7309
7320
|
}
|
|
@@ -7311,8 +7322,8 @@ var Fo = class Me extends Ya {
|
|
|
7311
7322
|
const G = I?.children?.length ?? 0;
|
|
7312
7323
|
Ra(void 0, G);
|
|
7313
7324
|
}
|
|
7314
|
-
const
|
|
7315
|
-
if (
|
|
7325
|
+
const w = se === "panel" && this._panel ? this._panel.toPanelSpec(f) : f;
|
|
7326
|
+
if (se === "panel" && this._panel && !te && j === "ProductGrid" && I) {
|
|
7316
7327
|
const G = ft(I);
|
|
7317
7328
|
if (G.isConsulting && !Si(G)) {
|
|
7318
7329
|
B = f;
|
|
@@ -7320,10 +7331,10 @@ var Fo = class Me extends Ya {
|
|
|
7320
7331
|
}
|
|
7321
7332
|
G.isConsulting && (B = null);
|
|
7322
7333
|
}
|
|
7323
|
-
if (Ro(I) && D(),
|
|
7324
|
-
const G = !
|
|
7325
|
-
|
|
7326
|
-
const J = I?.props?.replacePanel === !0,
|
|
7334
|
+
if (Ro(I) && D(), se === "panel" && this._panel && !te) {
|
|
7335
|
+
const G = !L;
|
|
7336
|
+
L = !0;
|
|
7337
|
+
const J = I?.props?.replacePanel === !0, ie = I?.props?.rankingState, Z = J || ie === "pending" || ie === "final" ? "replace" : oo({
|
|
7327
7338
|
componentType: j,
|
|
7328
7339
|
similarsAppend: I?.props?.similarsAppend === !0,
|
|
7329
7340
|
currentPanelType: this._panel.currentType,
|
|
@@ -7331,12 +7342,12 @@ var Fo = class Me extends Ya {
|
|
|
7331
7342
|
isPanelLoading: this._drawer?.isPanelLoading() ?? !1,
|
|
7332
7343
|
isFirstPanelContentInStream: G
|
|
7333
7344
|
});
|
|
7334
|
-
|
|
7345
|
+
re.panelProductListHeading = void 0, j === "ProductGrid" && (Z === "appendSimilars" ? re.panelProductListHeading = this._i18n.similarProductsLabel ?? "Similar Products" : this._applyPanelListHeadingToContext(re, {
|
|
7335
7346
|
kind: "spec",
|
|
7336
|
-
spec:
|
|
7337
|
-
})), Z === "appendSimilars" ? this._appendSimilarsToPanel(
|
|
7347
|
+
spec: w
|
|
7348
|
+
})), 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);
|
|
7338
7349
|
}
|
|
7339
|
-
if (j === "ProductDetailsPanel" &&
|
|
7350
|
+
if (j === "ProductDetailsPanel" && se === "panel" && (!g.silent || c)) {
|
|
7340
7351
|
const G = I?.props?.product;
|
|
7341
7352
|
if (G) {
|
|
7342
7353
|
c && (l = G), this._currentInlineProductSummaryRecord = G;
|
|
@@ -7346,36 +7357,36 @@ var Fo = class Me extends Ya {
|
|
|
7346
7357
|
type: "ProductSummaryCard",
|
|
7347
7358
|
props: { product: G }
|
|
7348
7359
|
} }
|
|
7349
|
-
},
|
|
7350
|
-
if (
|
|
7351
|
-
const Z = this._renderUISpec(J,
|
|
7360
|
+
}, ie = this._shadow?.querySelector(".gengage-chat-messages");
|
|
7361
|
+
if (ie) {
|
|
7362
|
+
const Z = this._renderUISpec(J, re);
|
|
7352
7363
|
g.threadId && (Z.dataset.threadId = g.threadId);
|
|
7353
7364
|
const le = this._shadow?.querySelector(`[data-message-id="${g.id}"]`);
|
|
7354
|
-
le && le.parentNode ===
|
|
7365
|
+
le && le.parentNode === ie ? le.after(Z) : ie.appendChild(Z), this._scrollInlineIntoView(Z, g.threadId), this._drawer?.refreshPresentationCollapsed(), L = !0;
|
|
7355
7366
|
}
|
|
7356
7367
|
}
|
|
7357
7368
|
}
|
|
7358
|
-
const Y = j === "AITopPicks" || j === "AIGroupingCards", ce = j === "InlineQuestionButtons",
|
|
7369
|
+
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");
|
|
7359
7370
|
let H = !1, ee = !1;
|
|
7360
|
-
if (te && Q && (
|
|
7371
|
+
if (te && Q && (re.panelProductListHeading = this._i18n.similarProductsLabel ?? "Similar Products"), Y && (!g.silent || s))
|
|
7361
7372
|
if (g.threadId && this._rememberPanelAiSpec(g.threadId, f), z) {
|
|
7362
|
-
const G = this._renderUISpec(f,
|
|
7363
|
-
|
|
7373
|
+
const G = this._renderUISpec(f, re);
|
|
7374
|
+
O = !0, this._drawer?.setPanelAiZoneState("results", { resultEl: G }), H = !0, F = null;
|
|
7364
7375
|
} else
|
|
7365
7376
|
F = f, ee = !0;
|
|
7366
7377
|
ce && (this._drawer?.setInputAreaChips([]), this._drawer?.setPills([]));
|
|
7367
7378
|
const pe = s && (j === "GroundingReviewCard" || Y || j === "InlineQuestionButtons");
|
|
7368
|
-
if (!Y && (!g.silent || pe) && (
|
|
7379
|
+
if (!Y && (!g.silent || pe) && (se !== "panel" || j === "ProductCard" || te && j === "ProductGrid" && !Q) && (j !== "ActionButtons" || M) && !H && !(ee && Y)) {
|
|
7369
7380
|
const G = this._shadow?.querySelector(".gengage-chat-messages");
|
|
7370
7381
|
if (G) {
|
|
7371
|
-
const J = this._renderUISpec(f,
|
|
7372
|
-
g.threadId && (J.dataset.threadId = g.threadId), G.appendChild(J), this._scrollInlineIntoView(J, g.threadId), this._drawer?.refreshPresentationCollapsed(), te && j === "ProductGrid" && (
|
|
7382
|
+
const J = this._renderUISpec(f, re);
|
|
7383
|
+
g.threadId && (J.dataset.threadId = g.threadId), G.appendChild(J), this._scrollInlineIntoView(J, g.threadId), this._drawer?.refreshPresentationCollapsed(), te && j === "ProductGrid" && (L = !0);
|
|
7373
7384
|
}
|
|
7374
7385
|
}
|
|
7375
7386
|
if ((j === "ProductGrid" || j === "ProductCard") && g.threadId) {
|
|
7376
|
-
const G = I?.children ?? [], J = j === "ProductGrid" ? G.map((
|
|
7377
|
-
for (const
|
|
7378
|
-
const Z =
|
|
7387
|
+
const G = I?.children ?? [], J = j === "ProductGrid" ? G.map((ie) => f.elements[ie]?.props?.product).filter(Boolean) : [I?.props?.product].filter(Boolean);
|
|
7388
|
+
for (const ie of J) {
|
|
7389
|
+
const Z = ie.sku;
|
|
7379
7390
|
Z && this._viewedProductSkus.add(Z);
|
|
7380
7391
|
}
|
|
7381
7392
|
}
|
|
@@ -7384,7 +7395,7 @@ var Fo = class Me extends Ya {
|
|
|
7384
7395
|
G.length > 0 && this._bridge?.send("previewImages", { images: G });
|
|
7385
7396
|
}
|
|
7386
7397
|
const V = I?.children?.length ?? 0;
|
|
7387
|
-
if (j === "ProductGrid" &&
|
|
7398
|
+
if (j === "ProductGrid" && se === "panel" && !te && V > 1 && !this._isMobileViewport && !this._modeController.isChoicePrompterHidden && !this._comparisonSelectMode && !Qi(this._currentThreadId ?? "") && (this._clearChoicePrompter(), this._choicePrompterEl = Xi({
|
|
7388
7399
|
heading: this._i18n.choicePrompterHeading,
|
|
7389
7400
|
suggestion: this._i18n.choicePrompterSuggestion,
|
|
7390
7401
|
ctaLabel: this._i18n.choicePrompterCta,
|
|
@@ -7399,19 +7410,19 @@ var Fo = class Me extends Ya {
|
|
|
7399
7410
|
}), this._mountChoicePrompter()), j === "ActionButtons") {
|
|
7400
7411
|
const G = I?.props?.buttons;
|
|
7401
7412
|
if (G && G.length > 0 && !M) {
|
|
7402
|
-
const J = [],
|
|
7413
|
+
const J = [], ie = [];
|
|
7403
7414
|
for (const Z of G) if (Yi(Z)) {
|
|
7404
7415
|
const le = {
|
|
7405
7416
|
label: Z.label,
|
|
7406
7417
|
action: Z.action
|
|
7407
7418
|
};
|
|
7408
7419
|
Z.icon && (le.icon = Z.icon), J.push(le);
|
|
7409
|
-
} else
|
|
7420
|
+
} else ie.push(Z);
|
|
7410
7421
|
J.length > 0 && this._drawer?.setInputAreaChips(J.map((Z) => ({
|
|
7411
7422
|
label: Z.label,
|
|
7412
7423
|
onAction: () => this._sendAction(Z.action),
|
|
7413
7424
|
...Z.icon ? { icon: Z.icon } : {}
|
|
7414
|
-
}))),
|
|
7425
|
+
}))), ie.length > 0 && this._drawer?.setPills(ie.map((Z) => {
|
|
7415
7426
|
const le = {
|
|
7416
7427
|
label: Z.label,
|
|
7417
7428
|
onAction: () => this._sendAction(Z.action)
|
|
@@ -7427,15 +7438,15 @@ var Fo = class Me extends Ya {
|
|
|
7427
7438
|
const S = {};
|
|
7428
7439
|
this.config.actionHandling?.unknownActionPolicy !== void 0 && (S.unknownActionPolicy = this.config.actionHandling.unknownActionPolicy), this.config.actionHandling?.allowScriptCall !== void 0 && (S.allowScriptCall = this.config.actionHandling.allowScriptCall), Za(f, {
|
|
7429
7440
|
openChat: () => this.open(),
|
|
7430
|
-
navigate: (
|
|
7431
|
-
|
|
7441
|
+
navigate: (P) => {
|
|
7442
|
+
he(P.url) && (this._bridge?.send("navigate", P), P.newTab ? window.open(P.url, "_blank", "noopener,noreferrer") : window.location.href = P.url);
|
|
7432
7443
|
},
|
|
7433
|
-
saveSession: (
|
|
7434
|
-
addToCart: (
|
|
7435
|
-
this._runChatAddToCartFlow(
|
|
7444
|
+
saveSession: (P) => this.saveSession(P.sessionId, P.sku),
|
|
7445
|
+
addToCart: (P) => {
|
|
7446
|
+
this._runChatAddToCartFlow(P);
|
|
7436
7447
|
},
|
|
7437
|
-
scriptCall: (
|
|
7438
|
-
_e("gengage:chat:script-call",
|
|
7448
|
+
scriptCall: (P) => {
|
|
7449
|
+
_e("gengage:chat:script-call", P), this.config.onScriptCall?.(P);
|
|
7439
7450
|
}
|
|
7440
7451
|
}, S);
|
|
7441
7452
|
}
|
|
@@ -7444,34 +7455,34 @@ var Fo = class Me extends Ya {
|
|
|
7444
7455
|
if (!(!o && i !== this._activeRequestThreadId) && f.type === "metadata" && f.meta) {
|
|
7445
7456
|
if (f.meta.panel !== void 0 || f.meta.messages !== void 0 || f.meta.message_id !== void 0) {
|
|
7446
7457
|
this._lastBackendContext = f.meta;
|
|
7447
|
-
const S =
|
|
7458
|
+
const S = me(f.meta.panel);
|
|
7448
7459
|
S && (this._modeController.updateFromContext(S), this._applyUiHints());
|
|
7449
7460
|
}
|
|
7450
7461
|
if (f.meta.panelLoading) {
|
|
7451
7462
|
const S = typeof f.meta.panelPendingType == "string" ? f.meta.panelPendingType : void 0;
|
|
7452
|
-
this.config.productDetailsExtended !== !0 && (S === "productDetails" || S === "productDetailsSimilars") || (k = !0,
|
|
7463
|
+
this.config.productDetailsExtended !== !0 && (S === "productDetails" || S === "productDetailsSimilars") || (k = !0, L = !1, x(), this._panel && (this._panel.currentType = null), this._drawer?.showPanelLoading(S), this._isMobileViewport && S === "productList" && this._ensureMobilePanelOverlayVisible(), S && this._panel?.updateTopBarForLoading(S));
|
|
7453
7464
|
}
|
|
7454
7465
|
if (f.meta.voice) {
|
|
7455
7466
|
const S = new CustomEvent("gengage:chat:voice", {
|
|
7456
7467
|
detail: { payload: f.meta.voice },
|
|
7457
7468
|
bubbles: !1,
|
|
7458
7469
|
cancelable: !0
|
|
7459
|
-
}),
|
|
7460
|
-
if (za(),
|
|
7470
|
+
}), P = window.dispatchEvent(S);
|
|
7471
|
+
if (za(), P) {
|
|
7461
7472
|
const $ = f.meta.voice;
|
|
7462
|
-
$.audio_base64 && (this._activeTtsHandle?.stop(), this._activeTtsHandle =
|
|
7473
|
+
$.audio_base64 && (this._activeTtsHandle?.stop(), this._activeTtsHandle = Ui($.audio_base64, $.content_type ?? "audio/ogg"));
|
|
7463
7474
|
}
|
|
7464
7475
|
}
|
|
7465
7476
|
if ((f.meta.redirectTarget || f.meta.redirect) && (_e("gengage:chat:redirect", {
|
|
7466
7477
|
target: f.meta.redirectTarget ?? null,
|
|
7467
7478
|
payload: f.meta.redirect ?? null
|
|
7468
|
-
}), ze("redirect", "redirect dispatched", { target: f.meta.redirectTarget ?? null }), this._handleRedirectMetadata(f.meta.redirect)), f.meta.analyzeAnimation && this.config.productDetailsExtended === !0 && (k = !0,
|
|
7469
|
-
const S = Array.isArray(f.meta.thinkingMessages) ? f.meta.thinkingMessages.filter(($) => typeof $ == "string") : [],
|
|
7479
|
+
}), ze("redirect", "redirect dispatched", { target: f.meta.redirectTarget ?? null }), this._handleRedirectMetadata(f.meta.redirect)), f.meta.analyzeAnimation && this.config.productDetailsExtended === !0 && (k = !0, L = !1, x(), this._panel && (this._panel.currentType = null), this._drawer?.showPanelLoading(), this._panel?.updateTopBarForLoading("productDetails")), f.meta.loading) {
|
|
7480
|
+
const S = Array.isArray(f.meta.thinkingMessages) ? f.meta.thinkingMessages.filter(($) => typeof $ == "string") : [], P = typeof f.meta.loadingText == "string" ? f.meta.loadingText : void 0;
|
|
7470
7481
|
if (S.length > 0) {
|
|
7471
|
-
const $ =
|
|
7482
|
+
const $ = P && this._modeController.shouldCondenseThinking() ? [...S.slice(0, 2), P] : S;
|
|
7472
7483
|
this._drawer?.setThinkingSteps($);
|
|
7473
7484
|
}
|
|
7474
|
-
typeof
|
|
7485
|
+
typeof P == "string" && P.length > 0 && (this._drawer?.addThinkingStep(P), E || this._bridge?.send("loadingMessage", { text: P }));
|
|
7475
7486
|
}
|
|
7476
7487
|
f.meta.visitorDataResponse && this._bridge?.send("engagingMessage", f.meta.visitorDataResponse), f.meta.formType && this._bridge?.send("glovForm", {
|
|
7477
7488
|
type: f.meta.formType,
|
|
@@ -7490,20 +7501,20 @@ var Fo = class Me extends Ya {
|
|
|
7490
7501
|
sendSkipMessage: () => this._sendMessage(this._i18n.beautyPhotoStepSkipMessage),
|
|
7491
7502
|
streamDone: !0
|
|
7492
7503
|
});
|
|
7493
|
-
const S =
|
|
7494
|
-
k && !
|
|
7495
|
-
const
|
|
7496
|
-
this._shadow?.querySelector(`[data-message-id="${
|
|
7497
|
-
const
|
|
7498
|
-
|
|
7504
|
+
const S = L;
|
|
7505
|
+
k && !L && v(), k = !1, this._maybeHidePreservedMobilePanel(e.type, S), L = !1;
|
|
7506
|
+
const P = g.content != null && g.content.length > 0 || u.length > 0 || S, $ = g.silent || P, I = typeof navigator < "u" && navigator.onLine === !1 && Qt(f), j = () => {
|
|
7507
|
+
this._shadow?.querySelector(`[data-message-id="${ue(g.id)}"]`)?.remove();
|
|
7508
|
+
const se = this._messages.indexOf(g);
|
|
7509
|
+
se >= 0 && this._messages.splice(se, 1);
|
|
7499
7510
|
};
|
|
7500
7511
|
let Q = !1;
|
|
7501
7512
|
const te = () => {
|
|
7502
7513
|
if (I) return;
|
|
7503
7514
|
this.emit("error", f);
|
|
7504
|
-
const
|
|
7505
|
-
|
|
7506
|
-
const
|
|
7515
|
+
const se = f.message;
|
|
7516
|
+
se === this._lastErrorMessage ? this._consecutiveErrorCount++ : (this._consecutiveErrorCount = 1, this._lastErrorMessage = se);
|
|
7517
|
+
const re = f.message.trim(), w = re.length > 0 ? re : this._i18n.errorMessage, Y = {
|
|
7507
7518
|
onRetry: () => {
|
|
7508
7519
|
this._lastSentAction && this._sendAction(this._lastSentAction.action, this._lastSentAction.options);
|
|
7509
7520
|
},
|
|
@@ -7515,20 +7526,20 @@ var Fo = class Me extends Ya {
|
|
|
7515
7526
|
j(), Q = !0, this._drawer?.showErrorWithRecovery(this._i18n.accountInactiveMessage, Y);
|
|
7516
7527
|
return;
|
|
7517
7528
|
}
|
|
7518
|
-
if (Eo(f,
|
|
7519
|
-
j(), Q = !0, this._drawer?.showErrorWithRecovery(
|
|
7529
|
+
if (Eo(f, w)) {
|
|
7530
|
+
j(), Q = !0, this._drawer?.showErrorWithRecovery(w, Y);
|
|
7520
7531
|
return;
|
|
7521
7532
|
}
|
|
7522
|
-
g.content =
|
|
7523
|
-
const ce =
|
|
7533
|
+
g.content = w, g.status = "done";
|
|
7534
|
+
const ce = ve(w.replace(/\r\n/g, `
|
|
7524
7535
|
`).split(`
|
|
7525
7536
|
`).join("<br />"));
|
|
7526
7537
|
this._ensureAssistantMessageRendered(g), this._drawer?.updateBotMessage(g.id, ce), this._drawer?.showRecoveryPillsOnly(Y);
|
|
7527
7538
|
};
|
|
7528
|
-
if (s && !
|
|
7539
|
+
if (s && !P) if (c || this._hasUnavailableProductContext()) {
|
|
7529
7540
|
this._drawer?.setPills([]);
|
|
7530
|
-
const
|
|
7531
|
-
g.content =
|
|
7541
|
+
const se = this._i18n.productNotFoundMessage;
|
|
7542
|
+
g.content = se, g.status = "done", this._ensureAssistantMessageRendered(g), this._drawer?.updateBotMessage(g.id, se), this._markUnavailableProductContext();
|
|
7532
7543
|
} else g.status = "done";
|
|
7533
7544
|
else if ($)
|
|
7534
7545
|
this._drawer?.setPills([]), g.silent || te();
|
|
@@ -7546,9 +7557,9 @@ var Fo = class Me extends Ya {
|
|
|
7546
7557
|
spec: Q
|
|
7547
7558
|
});
|
|
7548
7559
|
const te = j?.type ?? "ProductGrid";
|
|
7549
|
-
ne(Q, I, te), W(te, j, "replace", !1),
|
|
7560
|
+
ne(Q, I, te), W(te, j, "replace", !1), L = !0;
|
|
7550
7561
|
}
|
|
7551
|
-
B = null, F &&
|
|
7562
|
+
B = null, F && U(!1), C(), !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, {
|
|
7552
7563
|
drawer: this._drawer,
|
|
7553
7564
|
ensureRendered: () => {
|
|
7554
7565
|
},
|
|
@@ -7557,12 +7568,12 @@ var Fo = class Me extends Ya {
|
|
|
7557
7568
|
sendSkipMessage: () => this._sendMessage(this._i18n.beautyPhotoStepSkipMessage),
|
|
7558
7569
|
streamDone: !0
|
|
7559
7570
|
});
|
|
7560
|
-
const f =
|
|
7561
|
-
if (k && !
|
|
7571
|
+
const f = L;
|
|
7572
|
+
if (k && !L && v(), k = !1, this._maybeHidePreservedMobilePanel(e.type, f), c && !u && !f) {
|
|
7562
7573
|
const I = this._i18n.productNotFoundMessage;
|
|
7563
7574
|
g.content = I, this._ensureAssistantMessageRendered(g), this._drawer?.updateBotMessage(g.id, I), this._markUnavailableProductContext();
|
|
7564
7575
|
}
|
|
7565
|
-
if (
|
|
7576
|
+
if (L = !1, s) {
|
|
7566
7577
|
this._contextPrimingInFlight = !1;
|
|
7567
7578
|
const I = this._queuedUserMessages.length > 0;
|
|
7568
7579
|
this._flushQueuedUserMessages(), !I && c && this._ensurePdpPrimeSuggestedUiIfNeeded(l);
|
|
@@ -7570,7 +7581,7 @@ var Fo = class Me extends Ya {
|
|
|
7570
7581
|
g.status === "streaming" && (g.status = "done", yt()), this._presentation.finalizeAssistantGroup(i);
|
|
7571
7582
|
const S = this._shadow?.querySelector(".gengage-chat-comparison-toggle-btn--hidden");
|
|
7572
7583
|
S && (S.classList.remove("gengage-chat-comparison-toggle-btn--hidden"), S.classList.add("gengage-chat-comparison-toggle-btn--reveal")), this.emit("message", g);
|
|
7573
|
-
const
|
|
7584
|
+
const P = this._currentPanelSource, $ = P ? this._clonePanelSourceForHistory(P) : null;
|
|
7574
7585
|
this._panel?.snapshotForMessage(g.id, $ ? {
|
|
7575
7586
|
source: $,
|
|
7576
7587
|
threadId: g.threadId,
|
|
@@ -7615,14 +7626,14 @@ var Fo = class Me extends Ya {
|
|
|
7615
7626
|
if (!e) return null;
|
|
7616
7627
|
const a = e.elements[e.root];
|
|
7617
7628
|
if (!a || a.type !== "ProductDetailsPanel") return null;
|
|
7618
|
-
const n =
|
|
7619
|
-
return
|
|
7629
|
+
const n = me(a.props);
|
|
7630
|
+
return me(n?.product) ?? n ?? null;
|
|
7620
7631
|
}
|
|
7621
7632
|
_productGridRecordFromSpec(e, a) {
|
|
7622
7633
|
if (!e) return null;
|
|
7623
7634
|
const n = e.elements[e.root];
|
|
7624
7635
|
if (!n || n.type !== "ProductGrid") return null;
|
|
7625
|
-
const r = Object.values(e.elements).filter((o) => o.type === "ProductCard").map((o) =>
|
|
7636
|
+
const r = Object.values(e.elements).filter((o) => o.type === "ProductCard").map((o) => me(o.props?.product)).filter((o) => o !== null);
|
|
7626
7637
|
if (r.length === 0) return null;
|
|
7627
7638
|
const i = this._coerceSkuKey(a);
|
|
7628
7639
|
if (i) {
|
|
@@ -7633,7 +7644,7 @@ var Fo = class Me extends Ya {
|
|
|
7633
7644
|
}
|
|
7634
7645
|
_productRecordMatchesSku(e, a) {
|
|
7635
7646
|
if (this._coerceSkuKey(e.sku) === a || this._coerceSkuKey(e.group_id ?? e.groupId) === a) return !0;
|
|
7636
|
-
const n =
|
|
7647
|
+
const n = me(e.extras);
|
|
7637
7648
|
return this._coerceSkuKey(n?.group_id ?? n?.groupId) === a;
|
|
7638
7649
|
}
|
|
7639
7650
|
_getCurrentPanelProductRecord() {
|
|
@@ -7789,7 +7800,7 @@ var Fo = class Me extends Ya {
|
|
|
7789
7800
|
return;
|
|
7790
7801
|
this._currentThreadId = e, this._extendedModeManager?.setHiddenByUser(!1), this._lastThreadId != null && e === this._lastThreadId ? (this._presentation.setFocusedThreadId(e), this._drawer?.setPresentationFocus(e)) : (this._presentation.releaseFocusedThread(), this._drawer?.setPresentationFocus(null)), this._drawer?.setFormerMessagesButtonVisible(!1);
|
|
7791
7802
|
for (const s of this._messages) {
|
|
7792
|
-
const c = this._shadow?.querySelector(`[data-message-id="${
|
|
7803
|
+
const c = this._shadow?.querySelector(`[data-message-id="${ue(s.id)}"]`);
|
|
7793
7804
|
c && (s.threadId && s.threadId > e ? c.classList.add("gengage-chat-bubble--hidden") : c.classList.remove("gengage-chat-bubble--hidden"));
|
|
7794
7805
|
}
|
|
7795
7806
|
this._shadow?.querySelectorAll("[data-thread-id]").forEach((s) => {
|
|
@@ -7849,7 +7860,7 @@ var Fo = class Me extends Ya {
|
|
|
7849
7860
|
}
|
|
7850
7861
|
_formatHistoryTimestamp(e) {
|
|
7851
7862
|
try {
|
|
7852
|
-
return new Intl.DateTimeFormat(
|
|
7863
|
+
return new Intl.DateTimeFormat(Oe(this.config.locale), {
|
|
7853
7864
|
month: "short",
|
|
7854
7865
|
day: "numeric",
|
|
7855
7866
|
hour: "2-digit",
|
|
@@ -7947,7 +7958,7 @@ var Fo = class Me extends Ya {
|
|
|
7947
7958
|
const a = this._panelThreadIdByMessageId(e.messages);
|
|
7948
7959
|
if (e.panelSnapshotHtml) for (const [r, i] of Object.entries(e.panelSnapshotHtml)) {
|
|
7949
7960
|
const o = document.createElement("div");
|
|
7950
|
-
o.innerHTML =
|
|
7961
|
+
o.innerHTML = ve(i), this._panel.snapshots.set(r, o);
|
|
7951
7962
|
}
|
|
7952
7963
|
if (e.panelSnapshotTypes) for (const [r, i] of Object.entries(e.panelSnapshotTypes)) this._panel.snapshotTypes.set(r, i);
|
|
7953
7964
|
this._restorePanelSnapshotSources(e.panelSnapshotSources, a), e.panelAiSpecByThread && this._restorePanelAiSpecMap(e.panelAiSpecByThread);
|
|
@@ -7972,7 +7983,7 @@ var Fo = class Me extends Ya {
|
|
|
7972
7983
|
}
|
|
7973
7984
|
if (this._currentThreadId) {
|
|
7974
7985
|
const r = this._currentThreadId;
|
|
7975
|
-
for (const i of this._messages) i.threadId && i.threadId > r && this._shadow?.querySelector(`[data-message-id="${
|
|
7986
|
+
for (const i of this._messages) i.threadId && i.threadId > r && this._shadow?.querySelector(`[data-message-id="${ue(i.id)}"]`)?.classList.add("gengage-chat-bubble--hidden");
|
|
7976
7987
|
this._shadow?.querySelectorAll("[data-thread-id]").forEach((i) => {
|
|
7977
7988
|
i instanceof HTMLElement && i.dataset.threadId && i.dataset.threadId > r && i.classList.add("gengage-chat-bubble--hidden");
|
|
7978
7989
|
});
|
|
@@ -8006,6 +8017,54 @@ var Fo = class Me extends Ya {
|
|
|
8006
8017
|
return !1;
|
|
8007
8018
|
}
|
|
8008
8019
|
}
|
|
8020
|
+
_enrichProductMentionsWithUrls(e) {
|
|
8021
|
+
return e.map((a) => {
|
|
8022
|
+
const n = a.url?.trim();
|
|
8023
|
+
if (n && he(n)) return n === a.url ? a : {
|
|
8024
|
+
...a,
|
|
8025
|
+
url: n
|
|
8026
|
+
};
|
|
8027
|
+
const r = this._productMentionUrlForSku(a.sku);
|
|
8028
|
+
return r ? {
|
|
8029
|
+
...a,
|
|
8030
|
+
url: r
|
|
8031
|
+
} : a;
|
|
8032
|
+
});
|
|
8033
|
+
}
|
|
8034
|
+
_productMentionUrlForSku(e) {
|
|
8035
|
+
const a = e.trim(), n = (this._skuToProductItem[e] ?? (a ? this._skuToProductItem[a] : void 0))?.url;
|
|
8036
|
+
if (typeof n != "string") return;
|
|
8037
|
+
const r = n.trim();
|
|
8038
|
+
return r && he(r) ? r : void 0;
|
|
8039
|
+
}
|
|
8040
|
+
_handleProductNavClick(e) {
|
|
8041
|
+
const a = this.config.isDemoWebsite === !0, n = !a && this._isSameOriginUrl(e.url);
|
|
8042
|
+
if (!n) {
|
|
8043
|
+
const o = this._coerceSkuKey(e.sku), s = this._activeSkuForProductSummaryClick();
|
|
8044
|
+
if (o && s && o === s) return;
|
|
8045
|
+
}
|
|
8046
|
+
if (n) {
|
|
8047
|
+
_e("gengage:similar:product-click", {
|
|
8048
|
+
sku: e.sku,
|
|
8049
|
+
url: e.url,
|
|
8050
|
+
sessionId: this.config.session?.sessionId ?? null,
|
|
8051
|
+
...e.name !== void 0 && e.name !== "" ? { productName: e.name } : {}
|
|
8052
|
+
}), this._saveSessionAndOpenURL(e.url);
|
|
8053
|
+
return;
|
|
8054
|
+
}
|
|
8055
|
+
const r = e.url.trim();
|
|
8056
|
+
if (!a && this.config.onProductNavigate !== void 0 && r.length > 0 && he(r)) {
|
|
8057
|
+
at(e.sku), this.config.onProductNavigate(r, e.sku, this.config.session?.sessionId ?? null);
|
|
8058
|
+
return;
|
|
8059
|
+
}
|
|
8060
|
+
at(e.sku);
|
|
8061
|
+
const i = e.name?.trim() ? e.name.trim() : e.sku;
|
|
8062
|
+
this._sendAction({
|
|
8063
|
+
title: i,
|
|
8064
|
+
type: "launchSingleProduct",
|
|
8065
|
+
payload: { sku: e.sku }
|
|
8066
|
+
});
|
|
8067
|
+
}
|
|
8009
8068
|
_markUnavailableProductContext() {
|
|
8010
8069
|
this._productContextUnavailableSku = this.config.pageContext?.sku ?? null;
|
|
8011
8070
|
}
|
|
@@ -8017,7 +8076,7 @@ var Fo = class Me extends Ya {
|
|
|
8017
8076
|
return e !== void 0 && e.length > 0 && this._productContextUnavailableSku === e;
|
|
8018
8077
|
}
|
|
8019
8078
|
_ensureAssistantMessageRendered(e) {
|
|
8020
|
-
if (!(this._shadow?.querySelector(`[data-message-id="${
|
|
8079
|
+
if (!(this._shadow?.querySelector(`[data-message-id="${ue(e.id)}"]`) || !this._drawer)) {
|
|
8021
8080
|
if (e.role === "assistant" && e.threadId && !this._threadsWithFirstBot.has(e.threadId)) {
|
|
8022
8081
|
this._threadsWithFirstBot.add(e.threadId), this._drawer.addMessage(e), this._drawer.markFirstBotMessage(e.id);
|
|
8023
8082
|
return;
|
|
@@ -8045,7 +8104,7 @@ var Fo = class Me extends Ya {
|
|
|
8045
8104
|
const s = this._panelThreadIdByMessageId(i.messages);
|
|
8046
8105
|
if (i.panelSnapshotHtml) for (const [l, d] of Object.entries(i.panelSnapshotHtml)) {
|
|
8047
8106
|
const p = document.createElement("div");
|
|
8048
|
-
p.innerHTML =
|
|
8107
|
+
p.innerHTML = ve(d), this._panel.snapshots.set(l, p);
|
|
8049
8108
|
}
|
|
8050
8109
|
if (i.panelSnapshotTypes) for (const [l, d] of Object.entries(i.panelSnapshotTypes)) this._panel.snapshotTypes.set(l, d);
|
|
8051
8110
|
this._restorePanelSnapshotSources(i.panelSnapshotSources, s), i.panelAiSpecByThread && this._restorePanelAiSpecMap(i.panelAiSpecByThread);
|
|
@@ -8077,7 +8136,7 @@ var Fo = class Me extends Ya {
|
|
|
8077
8136
|
}
|
|
8078
8137
|
if (this._currentThreadId) {
|
|
8079
8138
|
const l = this._currentThreadId;
|
|
8080
|
-
for (const d of this._messages) d.threadId && d.threadId > l && this._shadow?.querySelector(`[data-message-id="${
|
|
8139
|
+
for (const d of this._messages) d.threadId && d.threadId > l && this._shadow?.querySelector(`[data-message-id="${ue(d.id)}"]`)?.classList.add("gengage-chat-bubble--hidden");
|
|
8081
8140
|
this._shadow?.querySelectorAll("[data-thread-id]").forEach((d) => {
|
|
8082
8141
|
d instanceof HTMLElement && d.dataset.threadId && d.dataset.threadId > l && d.classList.add("gengage-chat-bubble--hidden");
|
|
8083
8142
|
});
|
|
@@ -8124,7 +8183,7 @@ var Fo = class Me extends Ya {
|
|
|
8124
8183
|
});
|
|
8125
8184
|
return;
|
|
8126
8185
|
}
|
|
8127
|
-
this._comparisonSelectedSkus = [...this._comparisonSelectedSkus, e], this._comparisonSelectionWarning = null,
|
|
8186
|
+
this._comparisonSelectedSkus = [...this._comparisonSelectedSkus, e], this._comparisonSelectionWarning = null, Ua(e);
|
|
8128
8187
|
}
|
|
8129
8188
|
this._comparisonRefreshRafId !== null && cancelAnimationFrame(this._comparisonRefreshRafId), this._comparisonRefreshRafId = requestAnimationFrame(() => {
|
|
8130
8189
|
this._comparisonRefreshRafId = null, this._refreshComparisonUI();
|
|
@@ -8215,10 +8274,10 @@ var Fo = class Me extends Ya {
|
|
|
8215
8274
|
return a ? (this._runChatAddToCartFlow(a), !0) : !1;
|
|
8216
8275
|
}
|
|
8217
8276
|
_resolveCurrentProductAddToCartParams() {
|
|
8218
|
-
const e =
|
|
8277
|
+
const e = me(this.config.pageContext?.extra), a = this._activeSkuForProductSummaryClick() ?? this._coerceSkuKey(this._bridgeContext?.sku), n = this.config.pageContext?.pageType === "pdp", r = this._getCurrentPanelProductRecord(), i = n ? this._getCurrentPanelProductGridRecord(a) : null, o = n ? this._getInlinePdpProductRecord() : null;
|
|
8219
8278
|
if (!r && !i && this._currentPanelSource && !o) return null;
|
|
8220
8279
|
const s = [r, i];
|
|
8221
|
-
n && s.push(o), this._currentPanelSource || (s.push(this._getLatestProductDetailsRecord()), n && s.push(this._getLatestProductGridRecord(a))), n && s.push(
|
|
8280
|
+
n && s.push(o), this._currentPanelSource || (s.push(this._getLatestProductDetailsRecord()), n && s.push(this._getLatestProductGridRecord(a))), n && s.push(me(this._bridgeContext?.product), me(this._bridgeContext?.productDetails), this._bridgeContext, me(e?.product), me(e?.productDetails), e);
|
|
8222
8281
|
for (const c of s) {
|
|
8223
8282
|
const l = this._extractAddToCartParamsFromRecord(c, a);
|
|
8224
8283
|
if (l) return l;
|
|
@@ -8287,7 +8346,7 @@ var Fo = class Me extends Ya {
|
|
|
8287
8346
|
}
|
|
8288
8347
|
_buildRenderContext() {
|
|
8289
8348
|
const e = {
|
|
8290
|
-
locale:
|
|
8349
|
+
locale: Oe(this.config.locale),
|
|
8291
8350
|
onAction: (a) => {
|
|
8292
8351
|
if (a.type === "frontend_restore_panel_message") {
|
|
8293
8352
|
this._restorePanelFromFrontendMessage(a.payload);
|
|
@@ -8318,32 +8377,7 @@ var Fo = class Me extends Ya {
|
|
|
8318
8377
|
this._sendAction(a, n ? { preservePanel: !0 } : void 0);
|
|
8319
8378
|
},
|
|
8320
8379
|
onProductClick: (a) => {
|
|
8321
|
-
|
|
8322
|
-
if (!r) {
|
|
8323
|
-
const s = this._coerceSkuKey(a.sku), c = this._activeSkuForProductSummaryClick();
|
|
8324
|
-
if (s && c && s === c) return;
|
|
8325
|
-
}
|
|
8326
|
-
if (r) {
|
|
8327
|
-
_e("gengage:similar:product-click", {
|
|
8328
|
-
sku: a.sku,
|
|
8329
|
-
url: a.url,
|
|
8330
|
-
sessionId: this.config.session?.sessionId ?? null,
|
|
8331
|
-
...a.name !== void 0 && a.name !== "" ? { productName: a.name } : {}
|
|
8332
|
-
}), this._saveSessionAndOpenURL(a.url);
|
|
8333
|
-
return;
|
|
8334
|
-
}
|
|
8335
|
-
const i = a.url.trim();
|
|
8336
|
-
if (!n && this.config.onProductNavigate !== void 0 && i.length > 0 && ve(i)) {
|
|
8337
|
-
at(a.sku), this.config.onProductNavigate(i, a.sku, this.config.session?.sessionId ?? null);
|
|
8338
|
-
return;
|
|
8339
|
-
}
|
|
8340
|
-
at(a.sku);
|
|
8341
|
-
const o = a.name?.trim() ? a.name.trim() : a.sku;
|
|
8342
|
-
this._sendAction({
|
|
8343
|
-
title: o,
|
|
8344
|
-
type: "launchSingleProduct",
|
|
8345
|
-
payload: { sku: a.sku }
|
|
8346
|
-
});
|
|
8380
|
+
this._handleProductNavClick(a);
|
|
8347
8381
|
},
|
|
8348
8382
|
onAddToCart: (a) => {
|
|
8349
8383
|
this._runChatAddToCartFlow(a);
|
|
@@ -8416,7 +8450,7 @@ var Fo = class Me extends Ya {
|
|
|
8416
8450
|
await this._session.toggleFavorite(n, r, e, a), this._drawer?.updateFavoritesBadge(this._session.favoritedSkus.size);
|
|
8417
8451
|
}
|
|
8418
8452
|
_revertFavoriteHeartUi(e) {
|
|
8419
|
-
const a = this._shadow?.querySelectorAll(`[data-gengage-favorite-sku="${
|
|
8453
|
+
const a = this._shadow?.querySelectorAll(`[data-gengage-favorite-sku="${ue(e)}"]`);
|
|
8420
8454
|
if (a?.length)
|
|
8421
8455
|
for (const n of a) {
|
|
8422
8456
|
if (!(n instanceof HTMLButtonElement)) continue;
|
|
@@ -8682,7 +8716,7 @@ var Fo = class Me extends Ya {
|
|
|
8682
8716
|
_renderUISpec(e, a) {
|
|
8683
8717
|
const n = e.elements[e.root];
|
|
8684
8718
|
if (n?.type === "ProductSummaryCard") {
|
|
8685
|
-
const c =
|
|
8719
|
+
const c = me(n.props), l = me(c?.product) ?? c;
|
|
8686
8720
|
l && (this._currentInlineProductSummaryRecord = l);
|
|
8687
8721
|
}
|
|
8688
8722
|
const r = this._resolveUISpecRegistry(), i = this.config.renderer?.unknownRenderer ?? da, o = (c, l) => Fr(c, l, r, i), s = this.config.renderer?.renderUISpec;
|