@gengage/assistant-fe 0.6.16 → 0.6.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{api-paths-C7Y4wTde.js → api-paths-xsHH9jtm.js} +1 -1
- package/dist/chat/components/InlineLauncher.d.ts +15 -0
- package/dist/chat/index.d.ts +1 -1
- package/dist/chat-runtime.js +1 -1
- package/dist/chat.iife.js +15 -12
- package/dist/chat.js +1 -1
- package/dist/{common-BR9JIIjb.js → common-O0BUdXOn.js} +1 -1
- package/dist/common.js +5 -5
- package/dist/{connection-warning-DyeP1AB2.js → connection-warning-DWMfjv0Y.js} +1 -1
- package/dist/{fastIntent-C8jh7D1D.js → fastIntent-RTSVRJhw.js} +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +10 -10
- package/dist/native.iife.js +13 -10
- package/dist/qna-runtime.js +1 -1
- package/dist/qna.iife.js +1 -1
- package/dist/qna.js +1 -1
- package/dist/{runtime-Bt2VV3L3.js → runtime-BKU-NQXf.js} +1068 -1028
- package/dist/{runtime-rjNaPWIi.js → runtime-COh3CwNU.js} +3 -3
- package/dist/{runtime-LY1J9JFl.js → runtime-n7fEJGDt.js} +3 -3
- package/dist/{simbut-DV4oPMpH.js → simbut-DaFCfvp7.js} +1 -1
- package/dist/simbut.iife.js +1 -1
- package/dist/simbut.js +1 -1
- package/dist/{simrel-DaAhtabq.js → simrel-CX1JBDa5.js} +1 -1
- package/dist/simrel-runtime.js +1 -1
- package/dist/simrel.iife.js +1 -1
- package/dist/simrel.js +2 -2
- package/dist/{widget-base-DRaUfd-H.js → widget-base-DoZrhVze.js} +1 -1
- package/package.json +1 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { c as Sa, d as Ea, h as Pa, p as La, r as Ta, s as Zt, t as Aa } from "./api-paths-
|
|
2
|
-
import { A as ke, C as Ia, D as Ma, E as Na, M as
|
|
3
|
-
import { i as ze, s as Xt, t as Ka } from "./widget-base-
|
|
4
|
-
import { d as
|
|
1
|
+
import { c as Sa, d as Ea, h as Pa, p as La, r as Ta, s as Zt, t as Aa } from "./api-paths-xsHH9jtm.js";
|
|
2
|
+
import { A as ke, C as Ia, D as Ma, E as Na, M as ge, N as fe, O as Ba, S as xt, T as za, _ as Ra, a as we, b as Ha, d as Fa, f as Da, g as Oa, h as Ua, j as ve, l as ja, m as $a, p as qa, u as Va, v as Ga, w as et, x as Wa } from "./context-BBuSsXZ9.js";
|
|
3
|
+
import { i as ze, s as Xt, t as Ka } from "./widget-base-DoZrhVze.js";
|
|
4
|
+
import { d as pe, f as Ya, i as Za, n as Xa, p as Qa, r as Ja, t as yt, u as en } from "./fastIntent-RTSVRJhw.js";
|
|
5
5
|
import { t as Ue } from "./locale-CfqNifrU.js";
|
|
6
6
|
import { t as tn } from "./request-response-cache-zsgz3Awp.js";
|
|
7
|
-
import { a as Qt, i as Jt, n as
|
|
7
|
+
import { a as Qt, i as Jt, n as be, r as ea, t as ae } from "./price-formatter-CFsWT0lP.js";
|
|
8
8
|
function wt() {
|
|
9
9
|
const t = Date.now(), e = new Uint8Array(16);
|
|
10
10
|
crypto.getRandomValues(e), e[0] = t / 2 ** 40 & 255, e[1] = t / 2 ** 32 & 255, e[2] = t / 2 ** 24 & 255, e[3] = t / 2 ** 16 & 255, e[4] = t / 2 ** 8 & 255, e[5] = t & 255, e[6] = e[6] & 15 | 112, e[8] = e[8] & 63 | 128;
|
|
@@ -597,7 +597,7 @@ function wn(t) {
|
|
|
597
597
|
const e = document.createElement("div");
|
|
598
598
|
e.className = "gengage-chat-kvkk-banner gds-evidence-card gds-evidence-card-warning", e.dataset.gengagePart = "kvkk-banner", e.setAttribute("role", "alert");
|
|
599
599
|
const a = document.createElement("div");
|
|
600
|
-
a.className = "gengage-chat-kvkk-content", a.dataset.gengagePart = "kvkk-content", a.innerHTML =
|
|
600
|
+
a.className = "gengage-chat-kvkk-content", a.dataset.gengagePart = "kvkk-content", a.innerHTML = fe(t.htmlContent), e.appendChild(a);
|
|
601
601
|
const n = document.createElement("button");
|
|
602
602
|
return n.className = "gengage-chat-kvkk-dismiss", n.dataset.gengagePart = "kvkk-dismiss", n.type = "button", n.setAttribute("aria-label", t.closeAriaLabel ?? "Close privacy notice"), n.textContent = "×", n.addEventListener("click", t.onDismiss), e.appendChild(n), e;
|
|
603
603
|
}
|
|
@@ -863,42 +863,42 @@ var Bn = class {
|
|
|
863
863
|
if (v.className = "gengage-chat-close gds-btn gds-btn-ghost gds-icon-btn", v.dataset.gengagePart = "chat-header-close", v.type = "button", v.setAttribute("aria-label", this.i18n.closeButton), v.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>', v.addEventListener("click", e.onClose), e.showHeaderFavorites) {
|
|
864
864
|
const x = document.createElement("button");
|
|
865
865
|
x.className = "gengage-chat-header-btn gengage-chat-header-btn--fav gds-btn gds-btn-ghost gds-icon-btn", x.dataset.gengagePart = "chat-header-favorites", x.type = "button", x.setAttribute("aria-label", this.i18n.favoritesAriaLabel), x.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>';
|
|
866
|
-
const
|
|
867
|
-
|
|
866
|
+
const C = document.createElement("span");
|
|
867
|
+
C.className = "gengage-chat-header-fav-badge", C.dataset.gengagePart = "chat-header-favorites-badge", C.setAttribute("aria-hidden", "true"), C.style.display = "none", x.appendChild(C), this._favBadgeEl = C, x.addEventListener("click", () => {
|
|
868
868
|
e.onFavoritesClick?.();
|
|
869
869
|
}), m.appendChild(x);
|
|
870
870
|
}
|
|
871
871
|
m.appendChild(v), r && i.insertBefore(r, i.firstChild), i.appendChild(m);
|
|
872
872
|
{
|
|
873
|
-
let
|
|
874
|
-
const
|
|
875
|
-
if (!(this._options.getMobileViewport?.() ?? window.innerWidth <= 768) ||
|
|
876
|
-
const
|
|
877
|
-
|
|
878
|
-
},
|
|
879
|
-
if (!
|
|
880
|
-
const
|
|
881
|
-
if (!
|
|
882
|
-
|
|
883
|
-
const
|
|
884
|
-
|
|
885
|
-
},
|
|
886
|
-
if (!
|
|
887
|
-
|
|
888
|
-
const
|
|
889
|
-
let
|
|
890
|
-
|
|
873
|
+
let C = 0, z = 0, Y = !1;
|
|
874
|
+
const ne = (V) => {
|
|
875
|
+
if (!(this._options.getMobileViewport?.() ?? window.innerWidth <= 768) || V.target.closest('button, a, input, [role="button"]')) return;
|
|
876
|
+
const G = V.changedTouches?.[0];
|
|
877
|
+
G && (C = G.clientY, z = 0, Y = !0, this.root.style.transition = "none");
|
|
878
|
+
}, oe = (V) => {
|
|
879
|
+
if (!Y) return;
|
|
880
|
+
const G = V.changedTouches?.[0];
|
|
881
|
+
if (!G) return;
|
|
882
|
+
z = G.clientY - C;
|
|
883
|
+
const Q = (e.getMobileState?.() ?? "full") === "full" ? Math.max(0, z) : z;
|
|
884
|
+
V.preventDefault(), this.root.style.transform = `translateY(${Q}px)`;
|
|
885
|
+
}, le = () => {
|
|
886
|
+
if (!Y) return;
|
|
887
|
+
Y = !1;
|
|
888
|
+
const V = e.getMobileState?.() ?? "full";
|
|
889
|
+
let G;
|
|
890
|
+
z > 72 ? G = V === "full" ? "half" : "close" : z < -72 && V === "half" ? G = "full" : G = V, this.root.style.transition = "", G === "close" ? (this.root.style.transform = "translateY(100%)", setTimeout(() => {
|
|
891
891
|
this.root.style.transform = "", e.onMobileSnap?.("close");
|
|
892
|
-
}, 280)) : (this.root.style.transform = "", e.onMobileSnap?.(
|
|
893
|
-
},
|
|
894
|
-
|
|
892
|
+
}, 280)) : (this.root.style.transform = "", e.onMobileSnap?.(G)), z = 0;
|
|
893
|
+
}, R = () => {
|
|
894
|
+
Y && (Y = !1, z = 0, this.root.style.transition = "", this.root.style.transform = "");
|
|
895
895
|
};
|
|
896
|
-
i.addEventListener("touchstart",
|
|
897
|
-
i.removeEventListener("touchstart",
|
|
896
|
+
i.addEventListener("touchstart", ne, { passive: !0 }), i.addEventListener("touchmove", oe, { passive: !1 }), i.addEventListener("touchend", le, { passive: !0 }), i.addEventListener("touchcancel", R, { passive: !0 }), this._cleanups.push(() => {
|
|
897
|
+
i.removeEventListener("touchstart", ne), i.removeEventListener("touchmove", oe), i.removeEventListener("touchend", le), i.removeEventListener("touchcancel", R);
|
|
898
898
|
});
|
|
899
899
|
}
|
|
900
|
-
const
|
|
901
|
-
|
|
900
|
+
const f = document.createElement("div");
|
|
901
|
+
f.className = "gengage-chat-body", f.dataset.gengagePart = "chat-body", this._panelEl = document.createElement("div"), this._panelEl.className = "gengage-chat-panel gds-panel", this._panelEl.dataset.gengagePart = "chat-panel", this._panelTopBar = new _n({
|
|
902
902
|
onBack: () => e.onPanelBack?.(),
|
|
903
903
|
onForward: () => e.onPanelForward?.(),
|
|
904
904
|
onClose: () => {
|
|
@@ -909,7 +909,7 @@ var Bn = class {
|
|
|
909
909
|
closePanelAriaLabel: this.i18n.closePanelAriaLabel
|
|
910
910
|
}), this._panelEl.appendChild(this._panelTopBar.getElement());
|
|
911
911
|
const u = () => this._updateScrollAffordance();
|
|
912
|
-
this._panelEl.addEventListener("scroll", u, { passive: !0 }), this._cleanups.push(() => this._panelEl.removeEventListener("scroll", u)),
|
|
912
|
+
this._panelEl.addEventListener("scroll", u, { passive: !0 }), this._cleanups.push(() => this._panelEl.removeEventListener("scroll", u)), f.appendChild(this._panelEl), this._dividerEl = document.createElement("div"), this._dividerEl.className = "gengage-chat-panel-divider gengage-chat-panel-divider--hidden", this._dividerEl.dataset.gengagePart = "chat-panel-divider", this._dividerEl.setAttribute("role", "separator"), this._dividerEl.setAttribute("aria-label", this.i18n.togglePanelAriaLabel), this._dividerEl.setAttribute("title", this.i18n.togglePanelAriaLabel);
|
|
913
913
|
const d = document.createElement("button");
|
|
914
914
|
d.className = "gengage-chat-panel-divider-toggle gds-btn gds-btn-ghost", d.dataset.gengagePart = "chat-panel-divider-toggle", d.type = "button", d.setAttribute("aria-label", this.i18n.togglePanelAriaLabel), d.setAttribute("title", this.i18n.togglePanelAriaLabel), d.textContent = "»", d.addEventListener("click", () => {
|
|
915
915
|
if (this._ignoreNextDividerClick) {
|
|
@@ -919,153 +919,153 @@ var Bn = class {
|
|
|
919
919
|
this.togglePanel(), this._onPanelToggle?.();
|
|
920
920
|
});
|
|
921
921
|
let A = null, y = null;
|
|
922
|
-
const w = 24,
|
|
922
|
+
const w = 24, H = (x) => {
|
|
923
923
|
if (!(this._options.getMobileViewport?.() ?? window.innerWidth <= 768)) return;
|
|
924
|
-
const
|
|
925
|
-
|
|
924
|
+
const C = x.changedTouches?.[0];
|
|
925
|
+
C && (A = C.clientX, y = C.clientY);
|
|
926
926
|
}, I = (x) => {
|
|
927
927
|
if (!(this._options.getMobileViewport?.() ?? window.innerWidth <= 768) || A === null || y === null) return;
|
|
928
|
-
const
|
|
929
|
-
if (
|
|
930
|
-
const
|
|
931
|
-
if (A = null, y = null, Math.abs(
|
|
932
|
-
const
|
|
933
|
-
|
|
928
|
+
const C = x.changedTouches?.[0];
|
|
929
|
+
if (!C) return;
|
|
930
|
+
const z = C.clientX - A, Y = C.clientY - y;
|
|
931
|
+
if (A = null, y = null, Math.abs(Y) < w || Math.abs(Y) < Math.abs(z)) return;
|
|
932
|
+
const ne = Y < 0;
|
|
933
|
+
ne !== this._panelCollapsed && (this._ignoreNextDividerClick = !0, this.setPanelCollapsed(ne), this._onPanelToggle?.());
|
|
934
934
|
};
|
|
935
|
-
this._dividerEl.addEventListener("touchstart",
|
|
936
|
-
this._dividerEl.removeEventListener("touchstart",
|
|
937
|
-
}), this._dividerEl.appendChild(d),
|
|
935
|
+
this._dividerEl.addEventListener("touchstart", H, { passive: !0 }), this._dividerEl.addEventListener("touchend", I, { passive: !0 }), this._cleanups.push(() => {
|
|
936
|
+
this._dividerEl.removeEventListener("touchstart", H), this._dividerEl.removeEventListener("touchend", I);
|
|
937
|
+
}), this._dividerEl.appendChild(d), f.appendChild(this._dividerEl);
|
|
938
938
|
const _ = document.createElement("div");
|
|
939
939
|
_.className = "gengage-chat-conversation", _.dataset.gengagePart = "chat-conversation", this._conversationEl = _, _.appendChild(i);
|
|
940
940
|
const S = document.createElement("div");
|
|
941
941
|
S.className = "gengage-chat-offline-bar gds-evidence-card gds-evidence-card-warning", S.dataset.gengagePart = "chat-offline-bar", S.setAttribute("role", "status"), S.setAttribute("aria-live", "polite"), S.textContent = this.i18n.offlineMessage, typeof navigator < "u" && !navigator.onLine && S.classList.add("gengage-chat-offline-bar--visible"), _.appendChild(S);
|
|
942
|
-
const
|
|
943
|
-
window.addEventListener("offline",
|
|
944
|
-
window.removeEventListener("offline",
|
|
942
|
+
const F = () => S.classList.add("gengage-chat-offline-bar--visible"), W = () => S.classList.remove("gengage-chat-offline-bar--visible");
|
|
943
|
+
window.addEventListener("offline", F), window.addEventListener("online", W), this._cleanups.push(() => {
|
|
944
|
+
window.removeEventListener("offline", F), window.removeEventListener("online", W);
|
|
945
945
|
}), this._kvkkSlot = document.createElement("div"), this._kvkkSlot.className = "gengage-chat-kvkk-slot", this._kvkkSlot.dataset.gengagePart = "chat-kvkk-slot", _.appendChild(this._kvkkSlot), this.messagesEl = document.createElement("div"), this.messagesEl.id = lt, 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), kt(this.messagesEl);
|
|
946
|
-
const
|
|
947
|
-
|
|
946
|
+
const J = document.createElement("button");
|
|
947
|
+
J.type = "button", J.className = "gengage-chat-former-messages-btn gds-chip", J.dataset.gengagePart = "chat-former-messages-button", J.textContent = this.i18n.showFormerMessagesButton, J.setAttribute("aria-label", this.i18n.showFormerMessagesButton), J.style.display = "none", J.addEventListener("click", () => {
|
|
948
948
|
this._options.presentation?.onReleasePresentationFocus?.();
|
|
949
|
-
}), this.messagesEl.appendChild(
|
|
950
|
-
const
|
|
949
|
+
}), this.messagesEl.appendChild(J), this._formerMessagesBtn = J;
|
|
950
|
+
const L = () => {
|
|
951
951
|
this._userInteractionUntil = Date.now() + 2e3;
|
|
952
952
|
};
|
|
953
|
-
let
|
|
954
|
-
const
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
const { scrollTop: x, scrollHeight:
|
|
958
|
-
this._userScrolledUp =
|
|
959
|
-
const
|
|
960
|
-
|
|
953
|
+
let P = !1;
|
|
954
|
+
const B = () => this._options.presentation, N = () => {
|
|
955
|
+
P || (P = !0, requestAnimationFrame(() => {
|
|
956
|
+
P = !1;
|
|
957
|
+
const { scrollTop: x, scrollHeight: C, clientHeight: z } = this.messagesEl, Y = C - x - z;
|
|
958
|
+
this._userScrolledUp = Y > 10;
|
|
959
|
+
const ne = this._presentationPinned ? Y < 96 : Y < 32, oe = Date.now(), le = oe < this._programmaticScrollUntil, R = !ne && oe < this._userInteractionUntil, V = le ? !1 : R;
|
|
960
|
+
ne !== this._presentationPinned && (this._presentationPinned = ne, B()?.onPinnedToBottomChange?.(ne)), V !== this._presentationUserInteracting && (this._presentationUserInteracting = V, B()?.onUserInteractingChange?.(V));
|
|
961
961
|
}));
|
|
962
962
|
};
|
|
963
|
-
this.messagesEl.addEventListener("scroll",
|
|
964
|
-
this.messagesEl.removeEventListener("scroll",
|
|
963
|
+
this.messagesEl.addEventListener("scroll", N, { passive: !0 }), this._cleanups.push(() => {
|
|
964
|
+
this.messagesEl.removeEventListener("scroll", N);
|
|
965
965
|
});
|
|
966
966
|
const k = (x) => {
|
|
967
|
-
|
|
967
|
+
L(), x.deltaY < -6 && this._presentationFocusThreadId && this._options.presentation?.onFormerMessagesHint?.();
|
|
968
968
|
};
|
|
969
969
|
this.messagesEl.addEventListener("wheel", k, { passive: !0 }), this._cleanups.push(() => this.messagesEl.removeEventListener("wheel", k));
|
|
970
|
-
const
|
|
971
|
-
|
|
970
|
+
const O = (x) => {
|
|
971
|
+
L(), this._touchStartY = x.touches[0]?.clientY ?? null;
|
|
972
972
|
}, q = (x) => {
|
|
973
|
-
|
|
974
|
-
const
|
|
975
|
-
typeof
|
|
973
|
+
L();
|
|
974
|
+
const C = x.touches[0]?.clientY, z = this._touchStartY;
|
|
975
|
+
typeof C == "number" && typeof z == "number" && C - z > 10 && this._presentationFocusThreadId && this._options.presentation?.onFormerMessagesHint?.();
|
|
976
976
|
};
|
|
977
|
-
this.messagesEl.addEventListener("touchstart",
|
|
978
|
-
this.messagesEl.removeEventListener("touchstart",
|
|
977
|
+
this.messagesEl.addEventListener("touchstart", O, { passive: !0 }), this.messagesEl.addEventListener("touchmove", q, { passive: !0 }), this._cleanups.push(() => {
|
|
978
|
+
this.messagesEl.removeEventListener("touchstart", O), this.messagesEl.removeEventListener("touchmove", q);
|
|
979
979
|
}), _.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";
|
|
980
980
|
const K = document.createElement("div");
|
|
981
981
|
K.className = "gengage-chat-pills-scroll", K.dataset.gengagePart = "chat-suggestion-pills-scroll", this._pillsEl.appendChild(K);
|
|
982
|
-
const
|
|
983
|
-
|
|
982
|
+
const U = document.createElement("button");
|
|
983
|
+
U.className = "gengage-chat-pills-arrow gds-btn gds-btn-ghost", U.dataset.gengagePart = "chat-suggestion-pills-more", U.type = "button", U.setAttribute("aria-label", this.i18n.moreSuggestionsAriaLabel), U.textContent = "›", U.addEventListener("click", () => {
|
|
984
984
|
K.scrollBy({
|
|
985
985
|
left: 150,
|
|
986
986
|
behavior: "smooth"
|
|
987
987
|
});
|
|
988
|
-
}), this._pillsEl.appendChild(
|
|
989
|
-
let
|
|
990
|
-
const
|
|
991
|
-
|
|
992
|
-
|
|
988
|
+
}), this._pillsEl.appendChild(U);
|
|
989
|
+
let ee = !1;
|
|
990
|
+
const X = () => {
|
|
991
|
+
ee || (ee = !0, requestAnimationFrame(() => {
|
|
992
|
+
ee = !1;
|
|
993
993
|
const x = K.scrollLeft + K.clientWidth >= K.scrollWidth - 4;
|
|
994
|
-
|
|
994
|
+
U.style.display = x ? "none" : "";
|
|
995
995
|
}));
|
|
996
996
|
};
|
|
997
|
-
K.addEventListener("scroll",
|
|
998
|
-
K.removeEventListener("scroll",
|
|
997
|
+
K.addEventListener("scroll", X, { passive: !0 }), this._cleanups.push(() => {
|
|
998
|
+
K.removeEventListener("scroll", X);
|
|
999
999
|
}), _.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", _.appendChild(this._inputChipsEl);
|
|
1000
|
-
const
|
|
1001
|
-
|
|
1000
|
+
const $ = document.createElement("div");
|
|
1001
|
+
$.className = "gengage-chat-input-area", $.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", () => {
|
|
1002
1002
|
this._resizeRafId !== null && cancelAnimationFrame(this._resizeRafId), this._resizeRafId = requestAnimationFrame(() => {
|
|
1003
1003
|
this._resizeRafId = null, this.inputEl.style.height = "auto", this.inputEl.style.height = `${Math.min(this.inputEl.scrollHeight, 120)}px`;
|
|
1004
1004
|
}), this._updateSendEnabled();
|
|
1005
1005
|
}), this.inputEl.addEventListener("keydown", (x) => {
|
|
1006
1006
|
x.key === "Enter" && !x.isComposing && ((this._options.getMobileViewport?.() ?? window.innerWidth <= 768) || !x.shiftKey) && (x.preventDefault(), this._submit());
|
|
1007
1007
|
}), this.inputEl.addEventListener("paste", (x) => {
|
|
1008
|
-
const
|
|
1009
|
-
if (
|
|
1010
|
-
let
|
|
1011
|
-
const
|
|
1012
|
-
if (
|
|
1013
|
-
else if (
|
|
1014
|
-
const
|
|
1015
|
-
if (
|
|
1016
|
-
const
|
|
1017
|
-
if (
|
|
1018
|
-
|
|
1008
|
+
const C = x.clipboardData;
|
|
1009
|
+
if (!C) return;
|
|
1010
|
+
let z = null;
|
|
1011
|
+
const Y = C.files?.[0];
|
|
1012
|
+
if (Y && Y.type.startsWith("image/")) z = Y;
|
|
1013
|
+
else if (C.items?.length) for (let ne = 0; ne < C.items.length; ne++) {
|
|
1014
|
+
const oe = C.items[ne];
|
|
1015
|
+
if (oe?.kind === "file" && oe.type.startsWith("image/")) {
|
|
1016
|
+
const le = oe.getAsFile();
|
|
1017
|
+
if (le) {
|
|
1018
|
+
z = le;
|
|
1019
1019
|
break;
|
|
1020
1020
|
}
|
|
1021
1021
|
}
|
|
1022
1022
|
}
|
|
1023
|
-
|
|
1023
|
+
z && (x.preventDefault(), this._routeAttachmentFile(z));
|
|
1024
1024
|
}), 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", () => {
|
|
1025
1025
|
const x = this._fileInput.files?.[0];
|
|
1026
1026
|
x && this._routeAttachmentFile(x), this._fileInput.value = "";
|
|
1027
1027
|
});
|
|
1028
|
-
const
|
|
1029
|
-
|
|
1030
|
-
const
|
|
1031
|
-
this._attachBtn =
|
|
1028
|
+
const b = document.createElement("div");
|
|
1029
|
+
b.className = "gengage-chat-attach-wrap", b.dataset.gengagePart = "chat-attach-wrap", this._attachWrapEl = b;
|
|
1030
|
+
const E = document.createElement("button");
|
|
1031
|
+
this._attachBtn = E, E.className = "gengage-chat-attach-btn gds-btn gds-btn-ghost", E.dataset.gengagePart = "chat-attach-button", E.type = "button", E.setAttribute("aria-label", this.i18n.attachImageButton), E.setAttribute("aria-haspopup", "menu"), E.setAttribute("aria-expanded", "false"), E.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>', E.addEventListener("click", (x) => {
|
|
1032
1032
|
x.stopPropagation(), this._toggleAttachMenu();
|
|
1033
1033
|
});
|
|
1034
|
-
const
|
|
1035
|
-
this._attachMenuEl =
|
|
1036
|
-
const
|
|
1037
|
-
|
|
1034
|
+
const T = document.createElement("div");
|
|
1035
|
+
this._attachMenuEl = T, T.className = "gengage-chat-attach-menu gds-menu", T.dataset.gengagePart = "chat-attach-menu", T.setAttribute("role", "menu"), T.setAttribute("hidden", "");
|
|
1036
|
+
const j = document.createElement("button");
|
|
1037
|
+
j.type = "button", j.className = "gengage-chat-attach-menu-item gds-btn gds-btn-ghost", j.dataset.gengagePart = "chat-attach-menu-select-photo", j.setAttribute("role", "menuitem"), j.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>`, j.addEventListener("click", (x) => {
|
|
1038
1038
|
x.stopPropagation(), this._closeAttachMenu(), this._fileInput.click();
|
|
1039
1039
|
});
|
|
1040
1040
|
const M = document.createElement("div");
|
|
1041
1041
|
M.className = "gengage-chat-attach-menu-sep", M.dataset.gengagePart = "chat-attach-menu-separator", M.setAttribute("aria-hidden", "true");
|
|
1042
|
-
const
|
|
1043
|
-
|
|
1042
|
+
const D = document.createElement("button");
|
|
1043
|
+
D.type = "button", D.className = "gengage-chat-attach-menu-item gds-btn gds-btn-ghost", D.dataset.gengagePart = "chat-attach-menu-paste", D.setAttribute("role", "menuitem"), D.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>`, D.addEventListener("click", (x) => {
|
|
1044
1044
|
x.stopPropagation();
|
|
1045
|
-
const
|
|
1046
|
-
this._pasteImageFromClipboardMenu(
|
|
1047
|
-
}),
|
|
1048
|
-
const
|
|
1049
|
-
|
|
1050
|
-
const
|
|
1051
|
-
|
|
1045
|
+
const C = typeof navigator.clipboard?.read == "function" ? navigator.clipboard.read() : void 0;
|
|
1046
|
+
this._pasteImageFromClipboardMenu(C);
|
|
1047
|
+
}), T.appendChild(j), T.appendChild(M), T.appendChild(D), b.appendChild(E), b.appendChild(T), 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";
|
|
1048
|
+
const Z = document.createElement("img");
|
|
1049
|
+
Z.className = "gengage-chat-attachment-preview-thumb", Z.dataset.gengagePart = "chat-attachment-preview-thumb", Z.alt = "", this._previewName = document.createElement("span"), this._previewName.className = "gengage-chat-attachment-name", this._previewName.dataset.gengagePart = "chat-attachment-preview-name";
|
|
1050
|
+
const te = document.createElement("button");
|
|
1051
|
+
te.className = "gengage-chat-attachment-remove gds-btn gds-btn-ghost", te.dataset.gengagePart = "chat-attachment-preview-remove", te.type = "button", te.setAttribute("aria-label", this.i18n.removeAttachmentButton), te.textContent = "×", te.addEventListener("click", () => this.clearAttachment()), this._previewStrip.appendChild(Z), this._previewStrip.appendChild(this._previewName), this._previewStrip.appendChild(te), 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", () => {
|
|
1052
1052
|
if (this._sendStopHandler) {
|
|
1053
1053
|
const x = this._sendStopHandler;
|
|
1054
1054
|
this.hideStopButton(), x();
|
|
1055
1055
|
return;
|
|
1056
1056
|
}
|
|
1057
1057
|
this._submit();
|
|
1058
|
-
}),
|
|
1059
|
-
x.preventDefault(),
|
|
1060
|
-
}),
|
|
1061
|
-
|
|
1062
|
-
}),
|
|
1063
|
-
x.preventDefault(),
|
|
1064
|
-
const
|
|
1065
|
-
|
|
1058
|
+
}), $.addEventListener("dragover", (x) => {
|
|
1059
|
+
x.preventDefault(), $.classList.add("gengage-chat-input-area--dragover");
|
|
1060
|
+
}), $.addEventListener("dragleave", () => {
|
|
1061
|
+
$.classList.remove("gengage-chat-input-area--dragover");
|
|
1062
|
+
}), $.addEventListener("drop", (x) => {
|
|
1063
|
+
x.preventDefault(), $.classList.remove("gengage-chat-input-area--dragover");
|
|
1064
|
+
const C = x.dataTransfer?.files[0];
|
|
1065
|
+
C && this._routeAttachmentFile(C);
|
|
1066
1066
|
});
|
|
1067
|
-
const
|
|
1068
|
-
|
|
1067
|
+
const re = document.createElement("div");
|
|
1068
|
+
re.className = "gengage-chat-input-pill gds-input-shell", re.dataset.gengagePart = "chat-input-shell", re.appendChild(b), re.appendChild(this.inputEl), this._voiceEnabled && Za() && (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()), re.appendChild(this._micBtn), this._voiceInput = new Ja({
|
|
1069
1069
|
onInterim: (x) => {
|
|
1070
1070
|
this._resizeRafId !== null && (cancelAnimationFrame(this._resizeRafId), this._resizeRafId = null), this.inputEl.value = x, this.inputEl.style.height = "auto", this.inputEl.style.height = `${Math.min(this.inputEl.scrollHeight, 120)}px`;
|
|
1071
1071
|
},
|
|
@@ -1078,16 +1078,16 @@ var Bn = class {
|
|
|
1078
1078
|
onStateChange: (x) => {
|
|
1079
1079
|
x === "listening" ? this._micBtn?.classList.add("gengage-chat-mic-btn--active") : this._micBtn?.classList.remove("gengage-chat-mic-btn--active");
|
|
1080
1080
|
},
|
|
1081
|
-
onError: (x,
|
|
1081
|
+
onError: (x, C) => {
|
|
1082
1082
|
this._micBtn?.classList.remove("gengage-chat-mic-btn--active");
|
|
1083
1083
|
}
|
|
1084
|
-
}, { lang: this._voiceLang })),
|
|
1085
|
-
const
|
|
1086
|
-
|
|
1087
|
-
const
|
|
1084
|
+
}, { lang: this._voiceLang })), re.appendChild(this.sendBtn), $.appendChild(this._previewStrip), $.appendChild(this._fileInput), $.appendChild(re), _.appendChild($), f.appendChild(_), this._comparisonDockSlotEl = document.createElement("div"), this._comparisonDockSlotEl.className = "gengage-chat-comparison-dock-slot", this._comparisonDockSlotEl.dataset.gengagePart = "comparison-dock-slot", f.appendChild(this._comparisonDockSlotEl), this.root.appendChild(f), this._setupHorizontalSwipe(_);
|
|
1085
|
+
const ie = document.createElement("div");
|
|
1086
|
+
ie.className = "gengage-chat-footer", ie.dataset.gengagePart = "chat-footer", ie.textContent = this.i18n.poweredBy, this.root.appendChild(ie);
|
|
1087
|
+
const ce = (x) => {
|
|
1088
1088
|
x.key === "Escape" && e.onClose();
|
|
1089
1089
|
};
|
|
1090
|
-
this.root.addEventListener("keydown",
|
|
1090
|
+
this.root.addEventListener("keydown", ce), this._cleanups.push(() => this.root.removeEventListener("keydown", ce)), t.appendChild(this.root);
|
|
1091
1091
|
}
|
|
1092
1092
|
addMessage(t) {
|
|
1093
1093
|
const e = this._options.renderMessageUISpec?.(t) ?? null;
|
|
@@ -1102,7 +1102,7 @@ var Bn = class {
|
|
|
1102
1102
|
if (t.content) {
|
|
1103
1103
|
const n = document.createElement("div");
|
|
1104
1104
|
if (n.className = "gengage-chat-bubble-text", n.dataset.gengagePart = "chat-message-text", t.role === "assistant") {
|
|
1105
|
-
if (t.renderHint === "photo_analysis" ? (a.classList.add("gengage-chat-bubble--photo-analysis"), this._renderPhotoAnalysisCard(n, t.photoAnalysis)) : n.innerHTML =
|
|
1105
|
+
if (t.renderHint === "photo_analysis" ? (a.classList.add("gengage-chat-bubble--photo-analysis"), this._renderPhotoAnalysisCard(n, t.photoAnalysis)) : n.innerHTML = fe(t.content), this._onLinkClick) {
|
|
1106
1106
|
const r = n.querySelectorAll("a[href]");
|
|
1107
1107
|
for (const i of r) i.addEventListener("click", (o) => {
|
|
1108
1108
|
o.preventDefault();
|
|
@@ -1122,7 +1122,7 @@ var Bn = class {
|
|
|
1122
1122
|
this.messagesEl.appendChild(a), this._presentationFocusThreadId && this._applyPresentationCollapsed(), this._scrollToBottom(t.role === "user");
|
|
1123
1123
|
}
|
|
1124
1124
|
removeMessageBubble(t) {
|
|
1125
|
-
this._firstBotMessageIds.delete(t), this.messagesEl.querySelector(`[data-message-id="${
|
|
1125
|
+
this._firstBotMessageIds.delete(t), this.messagesEl.querySelector(`[data-message-id="${pe(t)}"]`)?.remove(), this._presentationFocusThreadId && this._applyPresentationCollapsed();
|
|
1126
1126
|
}
|
|
1127
1127
|
showTypingIndicator(t, e = "auto") {
|
|
1128
1128
|
this.removeTypingIndicator();
|
|
@@ -1445,50 +1445,50 @@ var Bn = class {
|
|
|
1445
1445
|
const v = document.createElement("ul");
|
|
1446
1446
|
v.className = "gengage-chat-comparison-skeleton-hl-list";
|
|
1447
1447
|
for (let _ = 0; _ < 3; _++) {
|
|
1448
|
-
const S = document.createElement("li"),
|
|
1449
|
-
|
|
1448
|
+
const S = document.createElement("li"), F = document.createElement("div");
|
|
1449
|
+
F.className = "gengage-chat-comparison-skeleton-shimmer gengage-chat-comparison-skeleton-hl-line", _ === 1 && F.classList.add("gengage-chat-comparison-skeleton-hl-line--medium"), _ === 2 && F.classList.add("gengage-chat-comparison-skeleton-hl-line--short"), S.appendChild(F), v.appendChild(S);
|
|
1450
1450
|
}
|
|
1451
1451
|
h.appendChild(v), o.appendChild(h), i.appendChild(o);
|
|
1452
|
-
const
|
|
1453
|
-
|
|
1452
|
+
const f = document.createElement("div");
|
|
1453
|
+
f.className = "gengage-chat-comparison-key-differences";
|
|
1454
1454
|
const u = document.createElement("div");
|
|
1455
|
-
u.className = "gengage-chat-comparison-skeleton-shimmer gengage-chat-comparison-skeleton-kd-heading",
|
|
1455
|
+
u.className = "gengage-chat-comparison-skeleton-shimmer gengage-chat-comparison-skeleton-kd-heading", f.appendChild(u);
|
|
1456
1456
|
const d = document.createElement("div");
|
|
1457
1457
|
d.className = "gengage-chat-comparison-key-differences-content";
|
|
1458
1458
|
for (let _ = 0; _ < 4; _++) {
|
|
1459
1459
|
const S = document.createElement("div");
|
|
1460
1460
|
S.className = "gengage-chat-comparison-skeleton-shimmer gengage-chat-comparison-skeleton-kd-line", d.appendChild(S);
|
|
1461
1461
|
}
|
|
1462
|
-
|
|
1462
|
+
f.appendChild(d), i.appendChild(f);
|
|
1463
1463
|
const A = document.createElement("div");
|
|
1464
1464
|
A.className = "gengage-chat-comparison-special gengage-chat-comparison-special--skeleton";
|
|
1465
1465
|
const y = document.createElement("div");
|
|
1466
1466
|
y.className = "gengage-chat-comparison-skeleton-shimmer gengage-chat-comparison-skeleton-special-line", A.appendChild(y), i.appendChild(A);
|
|
1467
1467
|
const w = document.createElement("div");
|
|
1468
1468
|
w.className = "gengage-chat-comparison-skeleton-table-wrap";
|
|
1469
|
-
const
|
|
1470
|
-
|
|
1469
|
+
const H = document.createElement("div");
|
|
1470
|
+
H.className = "gengage-chat-comparison-skeleton-table-head";
|
|
1471
1471
|
const I = document.createElement("div");
|
|
1472
|
-
I.className = "gengage-chat-comparison-skeleton-table-corner",
|
|
1472
|
+
I.className = "gengage-chat-comparison-skeleton-table-corner", H.appendChild(I);
|
|
1473
1473
|
for (let _ = 0; _ < 3; _++) {
|
|
1474
1474
|
const S = document.createElement("div");
|
|
1475
1475
|
S.className = "gengage-chat-comparison-skeleton-table-col";
|
|
1476
|
-
const
|
|
1477
|
-
|
|
1476
|
+
const F = document.createElement("div");
|
|
1477
|
+
F.className = "gengage-chat-comparison-skeleton-shimmer gengage-chat-comparison-skeleton-table-th-img";
|
|
1478
1478
|
const W = document.createElement("div");
|
|
1479
1479
|
W.className = "gengage-chat-comparison-skeleton-shimmer gengage-chat-comparison-skeleton-table-th-name";
|
|
1480
|
-
const
|
|
1481
|
-
|
|
1480
|
+
const J = document.createElement("div");
|
|
1481
|
+
J.className = "gengage-chat-comparison-skeleton-shimmer gengage-chat-comparison-skeleton-table-th-price", S.appendChild(F), S.appendChild(W), S.appendChild(J), H.appendChild(S);
|
|
1482
1482
|
}
|
|
1483
|
-
w.appendChild(
|
|
1483
|
+
w.appendChild(H);
|
|
1484
1484
|
for (let _ = 0; _ < 3; _++) {
|
|
1485
1485
|
const S = document.createElement("div");
|
|
1486
1486
|
S.className = "gengage-chat-comparison-skeleton-table-row";
|
|
1487
|
-
const
|
|
1488
|
-
|
|
1487
|
+
const F = document.createElement("div");
|
|
1488
|
+
F.className = "gengage-chat-comparison-skeleton-shimmer gengage-chat-comparison-skeleton-table-label", S.appendChild(F);
|
|
1489
1489
|
for (let W = 0; W < 3; W++) {
|
|
1490
|
-
const
|
|
1491
|
-
|
|
1490
|
+
const J = document.createElement("div");
|
|
1491
|
+
J.className = "gengage-chat-comparison-skeleton-shimmer gengage-chat-comparison-skeleton-table-cell", S.appendChild(J);
|
|
1492
1492
|
}
|
|
1493
1493
|
w.appendChild(S);
|
|
1494
1494
|
}
|
|
@@ -1676,14 +1676,14 @@ var Bn = class {
|
|
|
1676
1676
|
this._scrollToBottom(!1);
|
|
1677
1677
|
}
|
|
1678
1678
|
updateBotMessage(t, e, a, n) {
|
|
1679
|
-
const r = this.messagesEl.querySelector(`[data-message-id="${
|
|
1679
|
+
const r = this.messagesEl.querySelector(`[data-message-id="${pe(t)}"]`);
|
|
1680
1680
|
if (!r) return;
|
|
1681
1681
|
let i = r.querySelector(".gengage-chat-bubble-text");
|
|
1682
|
-
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 =
|
|
1682
|
+
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 = fe(e)), this._scrollToBottom(!1);
|
|
1683
1683
|
}
|
|
1684
1684
|
markFirstBotMessage(t) {
|
|
1685
1685
|
this._firstBotMessageIds.add(t);
|
|
1686
|
-
const e = this.messagesEl.querySelector(`[data-message-id="${
|
|
1686
|
+
const e = this.messagesEl.querySelector(`[data-message-id="${pe(t)}"]`);
|
|
1687
1687
|
e && e.classList.add("gengage-chat-bubble--first");
|
|
1688
1688
|
}
|
|
1689
1689
|
scrollToLastThread() {
|
|
@@ -1698,7 +1698,7 @@ var Bn = class {
|
|
|
1698
1698
|
return;
|
|
1699
1699
|
}
|
|
1700
1700
|
this._programmaticScrollUntil = Date.now() + 700;
|
|
1701
|
-
const a = this.messagesEl.querySelector(`[data-thread-id="${
|
|
1701
|
+
const a = this.messagesEl.querySelector(`[data-thread-id="${pe(e)}"]`);
|
|
1702
1702
|
a ? requestAnimationFrame(() => {
|
|
1703
1703
|
a.scrollIntoView({
|
|
1704
1704
|
block: "start",
|
|
@@ -1707,7 +1707,7 @@ var Bn = class {
|
|
|
1707
1707
|
}) : this._scrollToBottom(!0);
|
|
1708
1708
|
}
|
|
1709
1709
|
scrollThreadIntoView(t, e = "smooth") {
|
|
1710
|
-
const a = this.messagesEl.querySelectorAll(`[data-thread-id="${
|
|
1710
|
+
const a = this.messagesEl.querySelectorAll(`[data-thread-id="${pe(t)}"]`), n = this.messagesEl.ownerDocument.defaultView?.HTMLElement;
|
|
1711
1711
|
if (!n) return !1;
|
|
1712
1712
|
let r = null, i = null;
|
|
1713
1713
|
for (let c = 0; c < a.length; c++) {
|
|
@@ -1825,7 +1825,7 @@ function ia(t) {
|
|
|
1825
1825
|
function Rn(t) {
|
|
1826
1826
|
return typeof t == "string" ? ia(t) : null;
|
|
1827
1827
|
}
|
|
1828
|
-
function
|
|
1828
|
+
function he(t) {
|
|
1829
1829
|
return t == null || typeof t != "object" || Array.isArray(t) ? null : t;
|
|
1830
1830
|
}
|
|
1831
1831
|
function Hn(...t) {
|
|
@@ -1835,7 +1835,7 @@ function Hn(...t) {
|
|
|
1835
1835
|
}
|
|
1836
1836
|
}
|
|
1837
1837
|
function Fn(t) {
|
|
1838
|
-
const e =
|
|
1838
|
+
const e = he(t);
|
|
1839
1839
|
if (!e) return null;
|
|
1840
1840
|
const a = Hn(e.assistant_mode, e.assistantMode);
|
|
1841
1841
|
if (!a) return null;
|
|
@@ -1894,7 +1894,7 @@ var On = class {
|
|
|
1894
1894
|
const a = Rn(e);
|
|
1895
1895
|
a ? this._mode = a : ze("mode", "ignoring unrecognised assistant_mode from context", e);
|
|
1896
1896
|
} else e === null && (this._mode = "shopping");
|
|
1897
|
-
this._uiHints =
|
|
1897
|
+
this._uiHints = he(t.ui_hints) ?? null;
|
|
1898
1898
|
}
|
|
1899
1899
|
reset() {
|
|
1900
1900
|
const t = this._mode !== "shopping";
|
|
@@ -2021,14 +2021,14 @@ function Xn(t) {
|
|
|
2021
2021
|
m.className = "gengage-chat-comparison-recommended-info";
|
|
2022
2022
|
const v = document.createElement("div");
|
|
2023
2023
|
v.className = "gengage-chat-comparison-recommended-title", v.textContent = e.name, m.appendChild(v);
|
|
2024
|
-
const
|
|
2025
|
-
if (
|
|
2024
|
+
const f = document.createElement("div");
|
|
2025
|
+
if (f.className = "gengage-chat-comparison-recommended-meta", Yn(e.rating) && f.appendChild(Zn(e.rating)), Lt(e.price)) {
|
|
2026
2026
|
const d = document.createElement("div");
|
|
2027
|
-
d.className = "gengage-chat-comparison-recommended-price", d.textContent = ae(e.price, t.pricing),
|
|
2027
|
+
d.className = "gengage-chat-comparison-recommended-price", d.textContent = ae(e.price, t.pricing), f.appendChild(d);
|
|
2028
2028
|
}
|
|
2029
|
-
if (
|
|
2029
|
+
if (f.childElementCount > 0 && m.appendChild(f), t.recommendedText) {
|
|
2030
2030
|
const d = document.createElement("p");
|
|
2031
|
-
d.className = "gengage-chat-comparison-recommended-text", d.innerHTML =
|
|
2031
|
+
d.className = "gengage-chat-comparison-recommended-text", d.innerHTML = fe(t.recommendedText), m.appendChild(d);
|
|
2032
2032
|
}
|
|
2033
2033
|
g.appendChild(m);
|
|
2034
2034
|
const u = () => {
|
|
@@ -2046,8 +2046,8 @@ function Xn(t) {
|
|
|
2046
2046
|
A.className = "gengage-chat-comparison-highlights-label", A.textContent = s?.highlightsLabel ?? "Key Highlights", d.appendChild(A);
|
|
2047
2047
|
const y = document.createElement("ul");
|
|
2048
2048
|
for (const w of r) {
|
|
2049
|
-
const
|
|
2050
|
-
|
|
2049
|
+
const H = document.createElement("li");
|
|
2050
|
+
H.textContent = w, y.appendChild(H);
|
|
2051
2051
|
}
|
|
2052
2052
|
d.appendChild(y), l.appendChild(d);
|
|
2053
2053
|
}
|
|
@@ -2063,7 +2063,7 @@ function Xn(t) {
|
|
|
2063
2063
|
const h = document.createElement("span");
|
|
2064
2064
|
h.className = "gengage-chat-comparison-key-differences-summary-meta", h.textContent = s?.viewMoreLabel ?? "Show More", p.appendChild(g), p.appendChild(h), l.appendChild(p);
|
|
2065
2065
|
const m = document.createElement("div");
|
|
2066
|
-
m.className = "gengage-chat-comparison-key-differences-content", m.innerHTML =
|
|
2066
|
+
m.className = "gengage-chat-comparison-key-differences-content", m.innerHTML = fe(Qn(t.keyDifferencesHtml)), l.appendChild(m), c.appendChild(l);
|
|
2067
2067
|
}
|
|
2068
2068
|
if (i && i.length > 0) {
|
|
2069
2069
|
const l = document.createElement("details");
|
|
@@ -2079,22 +2079,22 @@ function Xn(t) {
|
|
|
2079
2079
|
l.className = "gengage-chat-comparison-table gds-comparison-table";
|
|
2080
2080
|
const p = document.createElement("thead"), g = document.createElement("tr"), h = document.createElement("th");
|
|
2081
2081
|
g.appendChild(h);
|
|
2082
|
-
for (const
|
|
2082
|
+
for (const f of a) {
|
|
2083
2083
|
const u = document.createElement("th");
|
|
2084
|
-
|
|
2084
|
+
f.sku === e?.sku && (u.className = "gengage-chat-comparison-selected gds-comparison-table-winner-cell");
|
|
2085
2085
|
const d = document.createElement("div");
|
|
2086
|
-
d.className = "gengage-chat-comparison-table-header-cell gengage-chat-comparison-table-header-cell--clickable gds-clickable", d.tabIndex = 0, d.setAttribute("role", "button"), d.setAttribute("aria-label",
|
|
2086
|
+
d.className = "gengage-chat-comparison-table-header-cell gengage-chat-comparison-table-header-cell--clickable gds-clickable", d.tabIndex = 0, d.setAttribute("role", "button"), d.setAttribute("aria-label", f.name), d.title = f.name;
|
|
2087
2087
|
const A = () => {
|
|
2088
2088
|
o({
|
|
2089
|
-
sku:
|
|
2090
|
-
name:
|
|
2089
|
+
sku: f.sku,
|
|
2090
|
+
name: f.name
|
|
2091
2091
|
});
|
|
2092
2092
|
};
|
|
2093
2093
|
if (d.addEventListener("click", A), d.addEventListener("keydown", (w) => {
|
|
2094
2094
|
w.key !== "Enter" && w.key !== " " || (w.preventDefault(), A());
|
|
2095
|
-
}),
|
|
2095
|
+
}), f.imageUrl && ke(f.imageUrl)) {
|
|
2096
2096
|
const w = document.createElement("img");
|
|
2097
|
-
w.src =
|
|
2097
|
+
w.src = f.imageUrl, w.alt = f.name, w.loading = "lazy", w.addEventListener("error", () => {
|
|
2098
2098
|
w.style.display = "none";
|
|
2099
2099
|
}, { once: !0 }), d.appendChild(w);
|
|
2100
2100
|
} else {
|
|
@@ -2102,22 +2102,22 @@ function Xn(t) {
|
|
|
2102
2102
|
w.className = "gengage-chat-comparison-table-header-img-placeholder", w.setAttribute("aria-hidden", "true"), d.appendChild(w);
|
|
2103
2103
|
}
|
|
2104
2104
|
const y = document.createElement("div");
|
|
2105
|
-
if (y.className = "gengage-chat-comparison-table-product-name", y.textContent =
|
|
2105
|
+
if (y.className = "gengage-chat-comparison-table-product-name", y.textContent = f.name, d.appendChild(y), Lt(f.price)) {
|
|
2106
2106
|
const w = document.createElement("div");
|
|
2107
|
-
w.className = "gengage-chat-comparison-table-price", w.textContent = ae(
|
|
2107
|
+
w.className = "gengage-chat-comparison-table-price", w.textContent = ae(f.price, t.pricing), d.appendChild(w);
|
|
2108
2108
|
}
|
|
2109
2109
|
u.appendChild(d), g.appendChild(u);
|
|
2110
2110
|
}
|
|
2111
2111
|
p.appendChild(g), l.appendChild(p);
|
|
2112
2112
|
const m = document.createElement("tbody");
|
|
2113
|
-
for (const
|
|
2113
|
+
for (const f of n) {
|
|
2114
2114
|
const u = document.createElement("tr"), d = document.createElement("td");
|
|
2115
|
-
d.className = "gengage-chat-comparison-label", d.textContent = Wn(
|
|
2116
|
-
for (let A = 0; A <
|
|
2115
|
+
d.className = "gengage-chat-comparison-label", d.textContent = Wn(f.label, s?.criteriaLabels, t.locale), u.appendChild(d);
|
|
2116
|
+
for (let A = 0; A < f.values.length; A++) {
|
|
2117
2117
|
const y = document.createElement("td");
|
|
2118
2118
|
a[A]?.sku === e?.sku && (y.className = "gengage-chat-comparison-selected gds-comparison-table-winner-cell");
|
|
2119
|
-
const w =
|
|
2120
|
-
oa(w) ? y.innerHTML =
|
|
2119
|
+
const w = f.values[A] ?? "";
|
|
2120
|
+
oa(w) ? y.innerHTML = fe(w) : y.textContent = w, u.appendChild(y);
|
|
2121
2121
|
}
|
|
2122
2122
|
m.appendChild(u);
|
|
2123
2123
|
}
|
|
@@ -2140,7 +2140,7 @@ function Qn(t) {
|
|
|
2140
2140
|
return e.length <= 1 ? t : "<ul>" + e.map((a) => `<li>${a.trim()}</li>`).join("") + "</ul>";
|
|
2141
2141
|
}
|
|
2142
2142
|
function Jn(t, e) {
|
|
2143
|
-
const a =
|
|
2143
|
+
const a = fe(e);
|
|
2144
2144
|
if (!a) return;
|
|
2145
2145
|
const n = document.createElement("template");
|
|
2146
2146
|
n.innerHTML = a;
|
|
@@ -2148,7 +2148,7 @@ function Jn(t, e) {
|
|
|
2148
2148
|
if (r.length > 0) {
|
|
2149
2149
|
for (const o of r) {
|
|
2150
2150
|
const s = document.createElement("li");
|
|
2151
|
-
s.innerHTML =
|
|
2151
|
+
s.innerHTML = fe(o.innerHTML), t.appendChild(s);
|
|
2152
2152
|
}
|
|
2153
2153
|
return;
|
|
2154
2154
|
}
|
|
@@ -2195,16 +2195,16 @@ function sr(t, e) {
|
|
|
2195
2195
|
a.className = "gengage-chat-review-highlights";
|
|
2196
2196
|
const n = t.props?.reviews;
|
|
2197
2197
|
if (!Array.isArray(n) || n.length === 0) {
|
|
2198
|
-
const
|
|
2199
|
-
return
|
|
2198
|
+
const f = document.createElement("div");
|
|
2199
|
+
return f.className = "gengage-chat-review-empty", f.textContent = e?.emptyReviewsMessage ?? "No review summary found.", a.appendChild(f), a;
|
|
2200
2200
|
}
|
|
2201
|
-
const r = n.filter((
|
|
2202
|
-
for (const
|
|
2203
|
-
const u = ar(
|
|
2201
|
+
const r = n.filter((f) => f !== null && typeof f == "object"), i = /* @__PURE__ */ new Map();
|
|
2202
|
+
for (const f of r) {
|
|
2203
|
+
const u = ar(f.review_class), d = nr(f.review_text), A = tr(f.review_tag);
|
|
2204
2204
|
for (const y of A) {
|
|
2205
2205
|
const w = y.toLocaleLowerCase();
|
|
2206
|
-
let
|
|
2207
|
-
if (
|
|
2206
|
+
let H = i.get(w);
|
|
2207
|
+
if (H || (H = {
|
|
2208
2208
|
key: w,
|
|
2209
2209
|
label: y,
|
|
2210
2210
|
mentions: 0,
|
|
@@ -2212,19 +2212,19 @@ function sr(t, e) {
|
|
|
2212
2212
|
negative: 0,
|
|
2213
2213
|
neutral: 0,
|
|
2214
2214
|
snippets: []
|
|
2215
|
-
}, i.set(w,
|
|
2215
|
+
}, i.set(w, H)), H.mentions += 1, u === "positive" ? H.positive += 1 : u === "negative" ? H.negative += 1 : H.neutral += 1, d.length > 0 && H.snippets.length < er && !H.snippets.some((I) => I.text === d)) {
|
|
2216
2216
|
const I = {
|
|
2217
2217
|
text: d,
|
|
2218
2218
|
tone: u
|
|
2219
2219
|
};
|
|
2220
|
-
|
|
2220
|
+
f.review_rating !== void 0 && String(f.review_rating).length > 0 && (I.rating = f.review_rating), H.snippets.push(I);
|
|
2221
2221
|
}
|
|
2222
2222
|
}
|
|
2223
2223
|
}
|
|
2224
|
-
const o = Array.from(i.values()).sort((
|
|
2224
|
+
const o = Array.from(i.values()).sort((f, u) => u.mentions !== f.mentions ? u.mentions - f.mentions : f.label.localeCompare(u.label));
|
|
2225
2225
|
if (o.length === 0) {
|
|
2226
|
-
const
|
|
2227
|
-
return
|
|
2226
|
+
const f = document.createElement("div");
|
|
2227
|
+
return f.className = "gengage-chat-review-empty", f.textContent = e?.emptyReviewsMessage ?? "No review summary found.", a.appendChild(f), a;
|
|
2228
2228
|
}
|
|
2229
2229
|
const s = (e?.reviewFilterPositive ?? "positive").toLowerCase(), c = (e?.reviewFilterNegative ?? "negative").toLowerCase(), l = document.createElement("div");
|
|
2230
2230
|
l.className = "gengage-chat-review-subjects-heading", l.textContent = e?.reviewSubjectsHeading ?? "Select to learn more", a.appendChild(l);
|
|
@@ -2236,27 +2236,27 @@ function sr(t, e) {
|
|
|
2236
2236
|
const m = () => {
|
|
2237
2237
|
for (; h.firstChild; ) h.removeChild(h.firstChild);
|
|
2238
2238
|
if (!p) return;
|
|
2239
|
-
const
|
|
2240
|
-
if (!
|
|
2239
|
+
const f = o.find((y) => y.key === p);
|
|
2240
|
+
if (!f) return;
|
|
2241
2241
|
const u = document.createElement("div");
|
|
2242
2242
|
u.className = "gengage-chat-review-detail-meta";
|
|
2243
2243
|
const d = document.createElement("span");
|
|
2244
|
-
if (d.className = "gengage-chat-review-detail-mentions", d.textContent = `${or(
|
|
2244
|
+
if (d.className = "gengage-chat-review-detail-mentions", d.textContent = `${or(f.mentions, e?.reviewCustomersMentionSingular, e?.reviewCustomersMentionPlural)} "${f.label}"`, u.appendChild(d), f.positive > 0) {
|
|
2245
2245
|
const y = document.createElement("span");
|
|
2246
|
-
y.className = "gengage-chat-review-detail-positive", y.textContent = `${
|
|
2246
|
+
y.className = "gengage-chat-review-detail-positive", y.textContent = `${f.positive} ${s}`, u.appendChild(y);
|
|
2247
2247
|
}
|
|
2248
|
-
if (
|
|
2248
|
+
if (f.negative > 0) {
|
|
2249
2249
|
const y = document.createElement("span");
|
|
2250
|
-
y.className = "gengage-chat-review-detail-negative", y.textContent = `${
|
|
2250
|
+
y.className = "gengage-chat-review-detail-negative", y.textContent = `${f.negative} ${c}`, u.appendChild(y);
|
|
2251
2251
|
}
|
|
2252
2252
|
h.appendChild(u);
|
|
2253
2253
|
const A = document.createElement("div");
|
|
2254
2254
|
A.className = "gengage-chat-review-snippets";
|
|
2255
|
-
for (const y of
|
|
2255
|
+
for (const y of f.snippets) {
|
|
2256
2256
|
const w = document.createElement("article");
|
|
2257
2257
|
w.className = "gengage-chat-review-snippet", w.dataset.tone = y.tone;
|
|
2258
|
-
const
|
|
2259
|
-
if (
|
|
2258
|
+
const H = document.createElement("div");
|
|
2259
|
+
if (H.className = "gengage-chat-review-snippet-text", H.textContent = `"${y.text}"`, w.appendChild(H), y.rating !== void 0 && String(y.rating).length > 0) {
|
|
2260
2260
|
const I = document.createElement("div");
|
|
2261
2261
|
I.className = "gengage-chat-review-snippet-rating", I.textContent = `★ ${String(y.rating)}`, w.appendChild(I);
|
|
2262
2262
|
}
|
|
@@ -2264,21 +2264,21 @@ function sr(t, e) {
|
|
|
2264
2264
|
}
|
|
2265
2265
|
h.appendChild(A);
|
|
2266
2266
|
}, v = () => {
|
|
2267
|
-
for (const
|
|
2268
|
-
const u =
|
|
2269
|
-
|
|
2267
|
+
for (const f of g.querySelectorAll(".gengage-chat-review-subject")) {
|
|
2268
|
+
const u = f.dataset.subjectKey === p;
|
|
2269
|
+
f.classList.toggle("gengage-chat-review-subject--active", u), f.classList.toggle("gds-chip-active", u), f.setAttribute("aria-pressed", String(u));
|
|
2270
2270
|
}
|
|
2271
2271
|
};
|
|
2272
|
-
for (const
|
|
2273
|
-
const u = rr(
|
|
2274
|
-
d.type = "button", d.className = "gengage-chat-review-subject gds-chip", d.dataset.subjectKey =
|
|
2272
|
+
for (const f of o) {
|
|
2273
|
+
const u = rr(f), d = document.createElement("button");
|
|
2274
|
+
d.type = "button", d.className = "gengage-chat-review-subject gds-chip", d.dataset.subjectKey = f.key, d.dataset.tone = u;
|
|
2275
2275
|
const A = document.createElement("span");
|
|
2276
2276
|
A.className = "gengage-chat-review-subject-icon", A.appendChild(ir(u)), d.appendChild(A);
|
|
2277
2277
|
const y = document.createElement("span");
|
|
2278
|
-
y.className = "gengage-chat-review-subject-label", y.textContent =
|
|
2278
|
+
y.className = "gengage-chat-review-subject-label", y.textContent = f.label, d.appendChild(y);
|
|
2279
2279
|
const w = document.createElement("span");
|
|
2280
|
-
w.className = "gengage-chat-review-subject-count", w.textContent = `(${
|
|
2281
|
-
p =
|
|
2280
|
+
w.className = "gengage-chat-review-subject-count", w.textContent = `(${f.mentions})`, d.appendChild(w), d.addEventListener("click", () => {
|
|
2281
|
+
p = f.key, v(), m();
|
|
2282
2282
|
}), g.appendChild(d);
|
|
2283
2283
|
}
|
|
2284
2284
|
return a.appendChild(g), v(), m(), a.appendChild(h), a;
|
|
@@ -2329,7 +2329,7 @@ function Qe(t) {
|
|
|
2329
2329
|
const i = document.createElement("div");
|
|
2330
2330
|
i.className = "gengage-chat-campaign-price-badge__logo";
|
|
2331
2331
|
const o = document.createElement("img");
|
|
2332
|
-
o.alt = "", o.loading = "lazy", o.src = t.logoUrl,
|
|
2332
|
+
o.alt = "", o.loading = "lazy", o.src = t.logoUrl, be(o), i.appendChild(o), e.appendChild(i);
|
|
2333
2333
|
}
|
|
2334
2334
|
const a = document.createElement("div");
|
|
2335
2335
|
a.className = "gengage-chat-campaign-price-badge__body";
|
|
@@ -2377,7 +2377,7 @@ function pr(t, e, a, n, r) {
|
|
|
2377
2377
|
const o = t.product, s = o.imageUrl;
|
|
2378
2378
|
if (s && ke(s)) {
|
|
2379
2379
|
const l = document.createElement("img");
|
|
2380
|
-
l.className = "gengage-chat-ai-toppick-img", l.dataset.gengagePart = "ai-top-pick-image",
|
|
2380
|
+
l.className = "gengage-chat-ai-toppick-img", l.dataset.gengagePart = "ai-top-pick-image", ge(l, "src", s), l.loading = "lazy", l.alt = e, be(l), i.appendChild(l);
|
|
2381
2381
|
}
|
|
2382
2382
|
const c = sa(t);
|
|
2383
2383
|
if (c && !r?.skipOverlayActions) {
|
|
@@ -2386,8 +2386,8 @@ function pr(t, e, a, n, r) {
|
|
|
2386
2386
|
const m = document.createElement("button");
|
|
2387
2387
|
m.className = "gengage-chat-favorite-btn", m.type = "button", m.dataset.gengageFavoriteSku = c, m.setAttribute("aria-label", n.i18n?.addToFavoritesLabel ?? "Add to favorites");
|
|
2388
2388
|
const v = n.favoritedSkus?.has(c) ?? !1;
|
|
2389
|
-
v && m.classList.add("gengage-chat-favorite-btn--active"), m.innerHTML = `<svg width="14" height="14" viewBox="0 0 24 24" fill="${v ? "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>`, m.addEventListener("click", (
|
|
2390
|
-
|
|
2389
|
+
v && m.classList.add("gengage-chat-favorite-btn--active"), m.innerHTML = `<svg width="14" height="14" viewBox="0 0 24 24" fill="${v ? "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>`, m.addEventListener("click", (f) => {
|
|
2390
|
+
f.stopPropagation(), m.classList.toggle("gengage-chat-favorite-btn--active"), m.querySelector("svg")?.setAttribute("fill", m.classList.contains("gengage-chat-favorite-btn--active") ? "currentColor" : "none"), n.onFavoriteToggle?.(c, o);
|
|
2391
2391
|
}), l.appendChild(m);
|
|
2392
2392
|
}
|
|
2393
2393
|
const p = n.i18n?.findSimilarLabel ?? "Find Similar", g = document.createElement("button");
|
|
@@ -2478,17 +2478,17 @@ function It(t, e, a, n) {
|
|
|
2478
2478
|
})) : h && (r.classList.add("gds-clickable"), r.addEventListener("click", (_) => {
|
|
2479
2479
|
_.target.closest(".gengage-chat-ai-toppick-cta") || _.target.closest(".gengage-chat-favorite-btn") || _.target.closest(".gengage-chat-find-similar-pill") || e.onAction(h);
|
|
2480
2480
|
}));
|
|
2481
|
-
const m = o.name || "Product image", v = !a && e.isMobile === !0 && !i,
|
|
2482
|
-
if (
|
|
2481
|
+
const m = o.name || "Product image", v = !a && e.isMobile === !0 && !i, f = a ? At(t.role, e.i18n) ?? e.i18n?.roleWinner ?? "TOP MATCH" : At(t.role, e.i18n);
|
|
2482
|
+
if (f && !v) {
|
|
2483
2483
|
const _ = document.createElement("span");
|
|
2484
|
-
_.className = "gengage-chat-ai-toppick-badge gds-badge", _.dataset.gengagePart = "ai-top-pick-role-badge", _.textContent =
|
|
2484
|
+
_.className = "gengage-chat-ai-toppick-badge gds-badge", _.dataset.gengagePart = "ai-top-pick-role-badge", _.textContent = f, r.appendChild(_);
|
|
2485
2485
|
}
|
|
2486
2486
|
const u = document.createElement("div");
|
|
2487
2487
|
u.className = "gengage-chat-ai-toppick-top-row", u.dataset.gengagePart = "ai-top-pick-top-row", pr(t, m, u, e, { skipOverlayActions: v });
|
|
2488
2488
|
const d = document.createElement("div");
|
|
2489
|
-
if (d.className = "gengage-chat-ai-toppick-body", d.dataset.gengagePart = "ai-top-pick-body",
|
|
2489
|
+
if (d.className = "gengage-chat-ai-toppick-body", d.dataset.gengagePart = "ai-top-pick-body", f && v) {
|
|
2490
2490
|
const _ = document.createElement("div");
|
|
2491
|
-
_.className = "gengage-chat-ai-toppick-role-line", _.dataset.gengagePart = "ai-top-pick-role-line", _.textContent =
|
|
2491
|
+
_.className = "gengage-chat-ai-toppick-role-line", _.dataset.gengagePart = "ai-top-pick-role-line", _.textContent = f, d.appendChild(_);
|
|
2492
2492
|
}
|
|
2493
2493
|
const A = o.name;
|
|
2494
2494
|
if (A) {
|
|
@@ -2507,13 +2507,13 @@ function It(t, e, a, n) {
|
|
|
2507
2507
|
}
|
|
2508
2508
|
}
|
|
2509
2509
|
w.childNodes.length > 0 && r.appendChild(w);
|
|
2510
|
-
const
|
|
2511
|
-
if (
|
|
2510
|
+
const H = !!(s && e.topPicksLoadingSku === s), I = (g || h) && !v;
|
|
2511
|
+
if (H || g || h) {
|
|
2512
2512
|
const _ = document.createElement("div");
|
|
2513
|
-
if (_.className = "gengage-chat-ai-toppick-spinner", _.dataset.gengagePart = "ai-top-pick-spinner", _.style.display =
|
|
2513
|
+
if (_.className = "gengage-chat-ai-toppick-spinner", _.dataset.gengagePart = "ai-top-pick-spinner", _.style.display = H ? "" : "none", r.appendChild(_), I) {
|
|
2514
2514
|
const S = document.createElement("button");
|
|
2515
|
-
S.className = "gengage-chat-ai-toppick-cta gds-btn gds-btn-primary", S.dataset.gengagePart = "ai-top-pick-cta", S.type = "button", S.textContent = g ? e.i18n?.addToCartButton ?? "Add to Cart" : e.i18n?.viewDetails ?? "View Details", S.addEventListener("click", (
|
|
2516
|
-
if (
|
|
2515
|
+
S.className = "gengage-chat-ai-toppick-cta gds-btn gds-btn-primary", S.dataset.gengagePart = "ai-top-pick-cta", S.type = "button", S.textContent = g ? e.i18n?.addToCartButton ?? "Add to Cart" : e.i18n?.viewDetails ?? "View Details", S.addEventListener("click", (F) => {
|
|
2516
|
+
if (F.stopPropagation(), g) {
|
|
2517
2517
|
e.onAction({
|
|
2518
2518
|
title: e.i18n?.addToCartButton ?? "Add to Cart",
|
|
2519
2519
|
type: "addToCart",
|
|
@@ -2766,7 +2766,7 @@ function Er(t) {
|
|
|
2766
2766
|
const e = document.createElement("div");
|
|
2767
2767
|
if (e.className = "gengage-chat-categories-group-selection", e.dataset.gengagePart = "categories-group-selection", t.image && ke(t.image)) {
|
|
2768
2768
|
const n = document.createElement("img");
|
|
2769
|
-
n.className = "gengage-chat-categories-group-selection-image", n.draggable = !1, n.src = t.image, n.alt = t.groupName, n.loading = "lazy",
|
|
2769
|
+
n.className = "gengage-chat-categories-group-selection-image", n.draggable = !1, n.src = t.image, n.alt = t.groupName, n.loading = "lazy", be(n), e.appendChild(n);
|
|
2770
2770
|
}
|
|
2771
2771
|
const a = document.createElement("div");
|
|
2772
2772
|
return a.className = "gengage-chat-categories-group-selection-title", a.textContent = t.groupName, e.appendChild(a), e;
|
|
@@ -2795,10 +2795,10 @@ function Lr(t, e) {
|
|
|
2795
2795
|
const g = a[p], h = `${r}-tab-${p}`, m = `${r}-panel-${p}`, v = document.createElement("button");
|
|
2796
2796
|
if (v.className = "gengage-chat-categories-tab gds-tab", v.type = "button", v.dataset.gengagePart = "categories-tab", v.id = h, v.setAttribute("role", "tab"), v.setAttribute("aria-controls", m), v.setAttribute("aria-selected", String(p === 0)), v.tabIndex = p === 0 ? 0 : -1, p === 0 && v.classList.add("gengage-chat-categories-tab--active", "is-active"), g.image && ke(g.image)) {
|
|
2797
2797
|
const y = document.createElement("img");
|
|
2798
|
-
y.className = "gengage-chat-categories-tab-image", y.draggable = !1, y.src = g.image, y.alt = g.groupName, y.loading = "lazy",
|
|
2798
|
+
y.className = "gengage-chat-categories-tab-image", y.draggable = !1, y.src = g.image, y.alt = g.groupName, y.loading = "lazy", be(y), v.appendChild(y);
|
|
2799
2799
|
}
|
|
2800
|
-
const
|
|
2801
|
-
|
|
2800
|
+
const f = document.createElement("span");
|
|
2801
|
+
f.className = "gengage-chat-categories-tab-text", f.textContent = g.groupName, v.appendChild(f), v.addEventListener("click", () => l(p)), v.addEventListener("keydown", (y) => {
|
|
2802
2802
|
let w = -1;
|
|
2803
2803
|
y.key === "ArrowRight" || y.key === "ArrowDown" ? w = (p + 1) % a.length : y.key === "ArrowLeft" || y.key === "ArrowUp" ? w = (p - 1 + a.length) % a.length : y.key === "Home" ? w = 0 : y.key === "End" && (w = a.length - 1), w >= 0 && (y.preventDefault(), l(w), s[w].focus());
|
|
2804
2804
|
}), s.push(v), o.appendChild(v);
|
|
@@ -2833,7 +2833,7 @@ function Tr(t, e) {
|
|
|
2833
2833
|
const a = document.createElement("div");
|
|
2834
2834
|
if (a.className = "gengage-chat-product-card gds-card gds-product-card gds-card-interactive", a.dataset.gengagePart = "categories-product-card", t.imageUrl && ke(t.imageUrl)) {
|
|
2835
2835
|
const i = document.createElement("img");
|
|
2836
|
-
i.className = "gengage-chat-product-card-img", i.draggable = !1, i.src = t.imageUrl, i.alt = t.name, i.loading = "lazy",
|
|
2836
|
+
i.className = "gengage-chat-product-card-img", i.draggable = !1, i.src = t.imageUrl, i.alt = t.name, i.loading = "lazy", be(i), a.appendChild(i);
|
|
2837
2837
|
}
|
|
2838
2838
|
const n = document.createElement("div");
|
|
2839
2839
|
n.className = "gengage-chat-product-card-body";
|
|
@@ -2897,27 +2897,27 @@ function Nr(t, e) {
|
|
|
2897
2897
|
}
|
|
2898
2898
|
};
|
|
2899
2899
|
if (g.addEventListener("click", () => e.onAction(m)), n) {
|
|
2900
|
-
const
|
|
2901
|
-
|
|
2900
|
+
const f = document.createElement("div");
|
|
2901
|
+
f.className = "gengage-chat-panel-restore-card__eyebrow", f.textContent = n, g.appendChild(f);
|
|
2902
2902
|
}
|
|
2903
2903
|
if (p.length > 0) {
|
|
2904
|
-
const
|
|
2905
|
-
|
|
2904
|
+
const f = document.createElement("div");
|
|
2905
|
+
f.className = "gengage-chat-panel-restore-card__previews";
|
|
2906
2906
|
for (const u of p) {
|
|
2907
2907
|
const d = document.createElement("div");
|
|
2908
2908
|
d.className = "gengage-chat-panel-restore-card__thumb";
|
|
2909
2909
|
const A = u.imageUrl;
|
|
2910
|
-
if (A &&
|
|
2910
|
+
if (A && ve(A)) {
|
|
2911
2911
|
const y = document.createElement("img");
|
|
2912
|
-
y.loading = "lazy", y.alt = u.name || r,
|
|
2912
|
+
y.loading = "lazy", y.alt = u.name || r, ge(y, "src", A), be(y), d.appendChild(y);
|
|
2913
2913
|
}
|
|
2914
|
-
|
|
2914
|
+
f.appendChild(d);
|
|
2915
2915
|
}
|
|
2916
|
-
g.appendChild(
|
|
2916
|
+
g.appendChild(f);
|
|
2917
2917
|
}
|
|
2918
2918
|
if (i && r) {
|
|
2919
|
-
const
|
|
2920
|
-
|
|
2919
|
+
const f = document.createElement("div");
|
|
2920
|
+
f.className = "gengage-chat-panel-restore-card__title", f.textContent = r, f.title = r, g.appendChild(f);
|
|
2921
2921
|
}
|
|
2922
2922
|
const v = document.createElement("div");
|
|
2923
2923
|
return v.className = "gengage-chat-panel-restore-card__cta", v.textContent = o, g.appendChild(v), g;
|
|
@@ -2929,11 +2929,11 @@ function Br(t, e) {
|
|
|
2929
2929
|
d.target.closest("a") || e.onProductSelect?.(a);
|
|
2930
2930
|
});
|
|
2931
2931
|
const r = a.imageUrl;
|
|
2932
|
-
if (r &&
|
|
2932
|
+
if (r && ve(r)) {
|
|
2933
2933
|
const d = document.createElement("div");
|
|
2934
2934
|
d.className = "gengage-chat-product-summary__image", d.dataset.gengagePart = "product-summary-image";
|
|
2935
2935
|
const A = document.createElement("img");
|
|
2936
|
-
A.loading = "lazy",
|
|
2936
|
+
A.loading = "lazy", ge(A, "src", r), A.alt = a.name || "Product image", be(A), d.appendChild(A), n.appendChild(d);
|
|
2937
2937
|
}
|
|
2938
2938
|
const i = document.createElement("div");
|
|
2939
2939
|
i.className = "gengage-chat-product-summary__content", i.dataset.gengagePart = "product-summary-content";
|
|
@@ -2957,8 +2957,8 @@ function Br(t, e) {
|
|
|
2957
2957
|
if (p) {
|
|
2958
2958
|
const d = He(e, a), A = $e(e, a), y = !!(g && g !== p), w = document.createElement("div");
|
|
2959
2959
|
w.className = "gengage-chat-product-summary__price", w.dataset.gengagePart = "product-summary-price";
|
|
2960
|
-
const
|
|
2961
|
-
if (
|
|
2960
|
+
const H = !!(d && y), I = Xe(e, a);
|
|
2961
|
+
if (H) {
|
|
2962
2962
|
const _ = Qe({
|
|
2963
2963
|
reasonText: d,
|
|
2964
2964
|
salePriceFormatted: ae(p, e.pricing),
|
|
@@ -2968,8 +2968,8 @@ function Br(t, e) {
|
|
|
2968
2968
|
w.classList.add("gengage-chat-product-summary__price--inline"), w.appendChild(_);
|
|
2969
2969
|
const S = document.createElement("span");
|
|
2970
2970
|
S.className = "gengage-chat-product-summary__price-sep", S.setAttribute("aria-hidden", "true");
|
|
2971
|
-
const
|
|
2972
|
-
|
|
2971
|
+
const F = document.createElement("span");
|
|
2972
|
+
F.className = "gengage-chat-product-summary__price-original", F.textContent = ae(g, e.pricing), w.appendChild(S), w.appendChild(F);
|
|
2973
2973
|
} else {
|
|
2974
2974
|
const S = document.createElement("span");
|
|
2975
2975
|
S.className = "gengage-chat-product-summary__price-original", S.textContent = ae(g, e.pricing), w.appendChild(S), w.appendChild(document.createTextNode(" ")), w.appendChild(_);
|
|
@@ -2982,8 +2982,8 @@ function Br(t, e) {
|
|
|
2982
2982
|
_.className = "gengage-chat-product-summary__price-current", _.textContent = ae(p, e.pricing);
|
|
2983
2983
|
const S = document.createElement("span");
|
|
2984
2984
|
S.className = "gengage-chat-product-summary__price-sep", S.setAttribute("aria-hidden", "true");
|
|
2985
|
-
const
|
|
2986
|
-
|
|
2985
|
+
const F = document.createElement("span");
|
|
2986
|
+
F.className = "gengage-chat-product-summary__price-original", F.textContent = ae(g, e.pricing), w.appendChild(_), w.appendChild(S), w.appendChild(F);
|
|
2987
2987
|
} else if (y) {
|
|
2988
2988
|
const _ = document.createElement("span");
|
|
2989
2989
|
_.className = "gengage-chat-product-summary__price-original", _.textContent = ae(g, e.pricing), w.appendChild(_), w.appendChild(document.createTextNode(" "));
|
|
@@ -3000,8 +3000,8 @@ function Br(t, e) {
|
|
|
3000
3000
|
}
|
|
3001
3001
|
}
|
|
3002
3002
|
n.appendChild(i);
|
|
3003
|
-
const h = a.url, m = a.sku, v = a.cartCode ?? a.cart_code,
|
|
3004
|
-
if (m &&
|
|
3003
|
+
const h = a.url, m = a.sku, v = a.cartCode ?? a.cart_code, f = typeof v == "string" && v.trim() ? v.trim() : void 0, u = a.inStock;
|
|
3004
|
+
if (m && f && u !== !1) {
|
|
3005
3005
|
const d = document.createElement("button");
|
|
3006
3006
|
d.type = "button", d.className = "gengage-chat-product-summary__cta gds-chip gds-chip-active", d.dataset.gengagePart = "product-summary-cta", d.textContent = e.i18n?.addToCartButton ?? "Add to Cart", d.addEventListener("click", (A) => {
|
|
3007
3007
|
A.stopPropagation(), e.onAction({
|
|
@@ -3009,14 +3009,14 @@ function Br(t, e) {
|
|
|
3009
3009
|
type: "addToCart",
|
|
3010
3010
|
payload: {
|
|
3011
3011
|
sku: m,
|
|
3012
|
-
cartCode:
|
|
3012
|
+
cartCode: f,
|
|
3013
3013
|
quantity: 1
|
|
3014
3014
|
}
|
|
3015
3015
|
});
|
|
3016
3016
|
}), n.appendChild(d);
|
|
3017
|
-
} else if (h &&
|
|
3017
|
+
} else if (h && ve(h)) {
|
|
3018
3018
|
const d = document.createElement("a");
|
|
3019
|
-
d.className = "gengage-chat-product-summary__cta gds-chip gds-chip-active", d.dataset.gengagePart = "product-summary-cta",
|
|
3019
|
+
d.className = "gengage-chat-product-summary__cta gds-chip gds-chip-active", d.dataset.gengagePart = "product-summary-cta", ge(d, "href", h), ge(d, "target", "_blank"), ge(d, "rel", "noopener noreferrer"), d.textContent = e.i18n?.productCtaLabel ?? "View", n.appendChild(d);
|
|
3020
3020
|
}
|
|
3021
3021
|
return n;
|
|
3022
3022
|
}
|
|
@@ -3190,7 +3190,7 @@ function dt(t, e) {
|
|
|
3190
3190
|
if (!n) return a;
|
|
3191
3191
|
const r = n.sku;
|
|
3192
3192
|
r && (a.dataset.sku = r);
|
|
3193
|
-
const i = t.props?.action, o = n.name, s = n.url, c = n.sku, l = s &&
|
|
3193
|
+
const i = t.props?.action, o = n.name, s = n.url, c = n.sku, l = s && ve(s) ? s : void 0, p = () => i?.type !== "launchSingleProduct" || l === void 0 || c === void 0 || e.onProductClick === void 0 ? !1 : (e.onProductClick({
|
|
3194
3194
|
sku: c,
|
|
3195
3195
|
url: l,
|
|
3196
3196
|
...typeof o == "string" ? { name: o } : {}
|
|
@@ -3205,45 +3205,45 @@ function dt(t, e) {
|
|
|
3205
3205
|
}
|
|
3206
3206
|
}));
|
|
3207
3207
|
const g = n.imageUrl;
|
|
3208
|
-
if (g &&
|
|
3208
|
+
if (g && ve(g)) {
|
|
3209
3209
|
const k = document.createElement("div");
|
|
3210
3210
|
k.className = "gengage-chat-product-card-img-wrapper";
|
|
3211
|
-
const
|
|
3212
|
-
|
|
3211
|
+
const O = document.createElement("img");
|
|
3212
|
+
O.className = "gengage-chat-product-card-img", O.loading = "lazy", ge(O, "src", g);
|
|
3213
3213
|
const q = n.name;
|
|
3214
|
-
q && (
|
|
3214
|
+
q && (O.alt = q), be(O), k.appendChild(O);
|
|
3215
3215
|
const K = n.discountPercent;
|
|
3216
3216
|
if (!e.hideProductDiscountBadge && typeof K == "number" && K > 0) {
|
|
3217
|
-
const
|
|
3218
|
-
|
|
3219
|
-
}
|
|
3220
|
-
const
|
|
3221
|
-
|
|
3222
|
-
const
|
|
3223
|
-
if (
|
|
3224
|
-
const
|
|
3225
|
-
|
|
3226
|
-
const
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
const
|
|
3230
|
-
|
|
3231
|
-
}),
|
|
3232
|
-
}
|
|
3233
|
-
const
|
|
3234
|
-
if (
|
|
3235
|
-
const
|
|
3236
|
-
|
|
3237
|
-
const
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
title:
|
|
3217
|
+
const b = document.createElement("span");
|
|
3218
|
+
b.className = "gengage-chat-product-card-discount-badge", b.textContent = `%${ea(K)}`, k.appendChild(b);
|
|
3219
|
+
}
|
|
3220
|
+
const U = document.createElement("div");
|
|
3221
|
+
U.className = "gengage-chat-product-card-img-actions";
|
|
3222
|
+
const ee = n.sku;
|
|
3223
|
+
if (ee && e.onFavoriteToggle) {
|
|
3224
|
+
const b = document.createElement("button");
|
|
3225
|
+
b.className = "gengage-chat-favorite-btn", b.type = "button", b.dataset.gengageFavoriteSku = ee, b.setAttribute("aria-label", e.i18n?.addToFavoritesLabel ?? "Add to favorites");
|
|
3226
|
+
const E = e.favoritedSkus?.has(ee) ?? !1;
|
|
3227
|
+
E && b.classList.add("gengage-chat-favorite-btn--active"), b.innerHTML = `<svg width="14" height="14" viewBox="0 0 24 24" fill="${E ? "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>`, b.addEventListener("click", (T) => {
|
|
3228
|
+
T.stopPropagation(), b.classList.toggle("gengage-chat-favorite-btn--active");
|
|
3229
|
+
const j = b.querySelector("svg");
|
|
3230
|
+
j && j.setAttribute("fill", b.classList.contains("gengage-chat-favorite-btn--active") ? "currentColor" : "none"), e.onFavoriteToggle(ee, n);
|
|
3231
|
+
}), U.appendChild(b);
|
|
3232
|
+
}
|
|
3233
|
+
const X = n.sku, $ = e.i18n?.findSimilarLabel ?? "Find Similar";
|
|
3234
|
+
if (X) {
|
|
3235
|
+
const b = document.createElement("button");
|
|
3236
|
+
b.className = "gengage-chat-find-similar-pill", b.type = "button", b.setAttribute("aria-label", $), b.dataset.tooltip = $, b.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>';
|
|
3237
|
+
const E = document.createElement("span");
|
|
3238
|
+
E.className = "gengage-chat-find-similar-pill-text", E.textContent = $, b.appendChild(E), b.addEventListener("click", (T) => {
|
|
3239
|
+
T.stopPropagation(), e.onAction({
|
|
3240
|
+
title: $,
|
|
3241
3241
|
type: "findSimilar",
|
|
3242
|
-
payload: { sku:
|
|
3242
|
+
payload: { sku: X }
|
|
3243
3243
|
});
|
|
3244
|
-
}),
|
|
3244
|
+
}), U.appendChild(b);
|
|
3245
3245
|
}
|
|
3246
|
-
|
|
3246
|
+
U.childElementCount > 0 && k.appendChild(U), a.appendChild(k);
|
|
3247
3247
|
}
|
|
3248
3248
|
const h = document.createElement("div");
|
|
3249
3249
|
h.className = "gengage-chat-product-card-body";
|
|
@@ -3252,11 +3252,11 @@ function dt(t, e) {
|
|
|
3252
3252
|
const k = document.createElement("div");
|
|
3253
3253
|
k.className = "gengage-chat-product-card-brand", k.textContent = m, h.appendChild(k);
|
|
3254
3254
|
}
|
|
3255
|
-
const v = n.rating,
|
|
3256
|
-
|
|
3255
|
+
const v = n.rating, f = n.reviewCount, u = n.price, d = n.originalPrice, A = n.price_async, y = He(e, n), w = $e(e, n), H = !!(d && u && d !== u && parseFloat(u) > 0), I = !!(y && H), _ = !!(y && !I || H && w === "inline"), S = typeof v == "number" && Number.isFinite(v) && v > 0, F = document.createElement("div");
|
|
3256
|
+
F.className = "gengage-chat-product-card-meta-row";
|
|
3257
3257
|
const W = document.createElement("div");
|
|
3258
3258
|
W.className = "gengage-chat-product-card-price gengage-chat-product-card-price-block";
|
|
3259
|
-
const
|
|
3259
|
+
const J = _ ? (() => {
|
|
3260
3260
|
const k = document.createElement("div");
|
|
3261
3261
|
return k.className = "gengage-chat-product-card-price-stack", y && !I && k.appendChild(Ze(y)), k.appendChild(W), k;
|
|
3262
3262
|
})() : W;
|
|
@@ -3266,59 +3266,59 @@ function dt(t, e) {
|
|
|
3266
3266
|
k.parentElement && (u && parseFloat(u) > 0 ? Mt(W, e, n, u, n.originalPrice) : k.remove());
|
|
3267
3267
|
}, 300);
|
|
3268
3268
|
} else u && parseFloat(u) > 0 && Mt(W, e, n, u, d);
|
|
3269
|
-
if ((W.childElementCount > 0 || A === !0) &&
|
|
3269
|
+
if ((W.childElementCount > 0 || A === !0) && F.appendChild(J), S) {
|
|
3270
3270
|
const k = document.createElement("div");
|
|
3271
3271
|
k.className = "gengage-chat-product-card-rating gengage-chat-product-card-rating-compact";
|
|
3272
|
-
const
|
|
3273
|
-
typeof
|
|
3272
|
+
const O = Jt(v), q = [`${O.toFixed(1)}`, "out of 5 stars"];
|
|
3273
|
+
typeof f == "number" && Number.isFinite(f) && q.push(`(${f} reviews)`), k.setAttribute("aria-label", q.join(" "));
|
|
3274
3274
|
const K = document.createElement("span");
|
|
3275
3275
|
K.className = "gengage-chat-product-card-rating-compact-star", K.setAttribute("aria-hidden", "true"), K.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>';
|
|
3276
|
-
const
|
|
3277
|
-
|
|
3276
|
+
const U = document.createElement("span");
|
|
3277
|
+
U.className = "gengage-chat-product-card-rating-compact-value", U.textContent = O.toFixed(1), k.appendChild(K), k.appendChild(U), F.appendChild(k);
|
|
3278
3278
|
}
|
|
3279
|
-
if (
|
|
3279
|
+
if (F.childElementCount === 0 && (F.classList.add("gengage-chat-product-card-meta-row--empty"), F.setAttribute("aria-hidden", "true")), h.appendChild(F), o) {
|
|
3280
3280
|
const k = document.createElement("div");
|
|
3281
3281
|
k.className = "gengage-chat-product-card-name", k.textContent = o, k.title = o, h.appendChild(k);
|
|
3282
3282
|
}
|
|
3283
|
-
const
|
|
3284
|
-
if (e.hideStockStatus !== !0 && typeof
|
|
3283
|
+
const L = n.inStock;
|
|
3284
|
+
if (e.hideStockStatus !== !0 && typeof L == "boolean") {
|
|
3285
3285
|
const k = document.createElement("div");
|
|
3286
|
-
k.className = `gengage-chat-product-card-stock ${
|
|
3286
|
+
k.className = `gengage-chat-product-card-stock ${L ? "is-in-stock" : "is-out-of-stock"}`, k.textContent = L ? e.i18n?.inStockLabel ?? "In Stock" : e.i18n?.outOfStockLabel ?? "Out of Stock", h.appendChild(k);
|
|
3287
3287
|
}
|
|
3288
3288
|
a.appendChild(h);
|
|
3289
|
-
const
|
|
3290
|
-
if (
|
|
3289
|
+
const P = n.cartCode, B = !!(P && c && L !== !1), N = e.i18n?.productCtaLabel ?? "View";
|
|
3290
|
+
if (B) {
|
|
3291
3291
|
const k = document.createElement("div");
|
|
3292
3292
|
k.className = "gengage-chat-product-card-buy-footer";
|
|
3293
|
-
const
|
|
3294
|
-
|
|
3293
|
+
const O = document.createElement("button");
|
|
3294
|
+
O.type = "button", O.className = "gengage-chat-product-card-buy-trigger", O.textContent = N, O.addEventListener("click", (q) => {
|
|
3295
3295
|
q.stopPropagation(), e.onAction({
|
|
3296
|
-
title: e.i18n?.addToCartButton ??
|
|
3296
|
+
title: e.i18n?.addToCartButton ?? N,
|
|
3297
3297
|
type: "addToCart",
|
|
3298
3298
|
payload: {
|
|
3299
3299
|
sku: c,
|
|
3300
|
-
cartCode:
|
|
3300
|
+
cartCode: P,
|
|
3301
3301
|
quantity: 1
|
|
3302
3302
|
}
|
|
3303
3303
|
});
|
|
3304
|
-
}), k.appendChild(
|
|
3304
|
+
}), k.appendChild(O), a.appendChild(k);
|
|
3305
3305
|
} else if (i) {
|
|
3306
3306
|
const k = document.createElement("button");
|
|
3307
|
-
k.className = "gengage-chat-product-card-cta", k.type = "button", k.textContent = i.type === "launchSingleProduct" ?
|
|
3307
|
+
k.className = "gengage-chat-product-card-cta", k.type = "button", k.textContent = i.type === "launchSingleProduct" ? N : i.title || N, k.addEventListener("click", (O) => {
|
|
3308
3308
|
if (a.parentElement?.classList.contains("gengage-chat-comparison-select-wrapper")) {
|
|
3309
|
-
|
|
3309
|
+
O.stopPropagation();
|
|
3310
3310
|
return;
|
|
3311
3311
|
}
|
|
3312
3312
|
p() || e.onAction(i);
|
|
3313
3313
|
}), a.appendChild(k);
|
|
3314
3314
|
} else if (l) {
|
|
3315
3315
|
const k = document.createElement("a");
|
|
3316
|
-
k.className = "gengage-chat-product-card-cta",
|
|
3316
|
+
k.className = "gengage-chat-product-card-cta", ge(k, "href", l), ge(k, "target", "_blank"), ge(k, "rel", "noopener noreferrer"), k.textContent = N, k.addEventListener("click", (O) => {
|
|
3317
3317
|
if (a.parentElement?.classList.contains("gengage-chat-comparison-select-wrapper")) {
|
|
3318
|
-
|
|
3318
|
+
O.preventDefault(), O.stopPropagation();
|
|
3319
3319
|
return;
|
|
3320
3320
|
}
|
|
3321
|
-
e.onProductClick && c && (
|
|
3321
|
+
e.onProductClick && c && (O.preventDefault(), e.onProductClick({
|
|
3322
3322
|
sku: c,
|
|
3323
3323
|
url: l,
|
|
3324
3324
|
...o ? { name: o } : {}
|
|
@@ -3328,22 +3328,22 @@ function dt(t, e) {
|
|
|
3328
3328
|
if (e.comparisonSelectMode && c && e.onToggleComparisonSku) {
|
|
3329
3329
|
const k = document.createElement("div");
|
|
3330
3330
|
k.className = "gengage-chat-comparison-select-wrapper";
|
|
3331
|
-
const
|
|
3332
|
-
|
|
3331
|
+
const O = e.comparisonSelectedSkus?.includes(c) ?? !1;
|
|
3332
|
+
O && k.classList.add("gengage-chat-comparison-select-wrapper--selected");
|
|
3333
3333
|
const q = n.name ?? c, K = e.i18n?.comparisonSelectCardHint ?? "Tap anywhere on the card to add or remove it from comparison.";
|
|
3334
3334
|
k.setAttribute("role", "group"), k.setAttribute("aria-label", `${String(q)}. ${K}`);
|
|
3335
|
-
const
|
|
3336
|
-
|
|
3337
|
-
const
|
|
3338
|
-
|
|
3339
|
-
const
|
|
3340
|
-
|
|
3341
|
-
|
|
3335
|
+
const U = document.createElement("button");
|
|
3336
|
+
U.type = "button", U.className = "gengage-chat-comparison-checkbox", U.dataset.selected = O ? "true" : "false", U.setAttribute("aria-pressed", O ? "true" : "false");
|
|
3337
|
+
const ee = document.createElement("span");
|
|
3338
|
+
ee.className = "gengage-chat-comparison-checkbox-icon", ee.innerHTML = O ? '<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M20 6L9 17l-5-5"/></svg>' : '<span class="gengage-chat-comparison-checkbox-dot"></span>';
|
|
3339
|
+
const X = document.createElement("span");
|
|
3340
|
+
X.className = "gengage-chat-comparison-checkbox-label", X.textContent = O ? e.i18n?.comparisonSelectedLabel ?? "Selected" : e.i18n?.comparisonSelectLabel ?? "Select to compare", U.appendChild(ee), U.appendChild(X), U.addEventListener("click", (b) => {
|
|
3341
|
+
b.stopPropagation(), e.onToggleComparisonSku?.(c);
|
|
3342
3342
|
});
|
|
3343
|
-
const
|
|
3344
|
-
return
|
|
3345
|
-
|
|
3346
|
-
}), k.appendChild(
|
|
3343
|
+
const $ = document.createElement("div");
|
|
3344
|
+
return $.className = "gengage-chat-comparison-card-hint", $.setAttribute("aria-hidden", "true"), $.textContent = K, k.addEventListener("click", (b) => {
|
|
3345
|
+
b.target.closest(".gengage-chat-comparison-checkbox") || (b.stopPropagation(), e.onToggleComparisonSku?.(c));
|
|
3346
|
+
}), k.appendChild(U), k.appendChild($), k.appendChild(a), k;
|
|
3347
3347
|
}
|
|
3348
3348
|
return a;
|
|
3349
3349
|
}
|
|
@@ -3389,7 +3389,7 @@ var da = /* @__PURE__ */ new Set([
|
|
|
3389
3389
|
"OBJECT",
|
|
3390
3390
|
"EMBED"
|
|
3391
3391
|
]);
|
|
3392
|
-
function
|
|
3392
|
+
function me(t, ...e) {
|
|
3393
3393
|
for (const a of e) {
|
|
3394
3394
|
const n = t[a];
|
|
3395
3395
|
if (typeof n == "string") {
|
|
@@ -3424,14 +3424,14 @@ function Gr(t) {
|
|
|
3424
3424
|
return Array.isArray(t) ? t.filter((e) => typeof e == "string" && e.trim().length > 0) : [];
|
|
3425
3425
|
}
|
|
3426
3426
|
function Wr(t) {
|
|
3427
|
-
const e = [...Gr(t.images),
|
|
3427
|
+
const e = [...Gr(t.images), me(t, "imageUrl", "image_url", "image")].filter((a) => !!a && ve(a));
|
|
3428
3428
|
return Array.from(new Set(e));
|
|
3429
3429
|
}
|
|
3430
3430
|
function Kr(t) {
|
|
3431
3431
|
return typeof DOMParser < "u" ? (new DOMParser().parseFromString(t, "text/html").body.textContent ?? "").replace(/\s+/g, " ").trim() : t.replace(/<[^>]*>/g, " ").replace(/\s+/g, " ").trim();
|
|
3432
3432
|
}
|
|
3433
3433
|
function Yr(t) {
|
|
3434
|
-
const e =
|
|
3434
|
+
const e = me(t, "description_html", "descriptionHtml");
|
|
3435
3435
|
if (e) {
|
|
3436
3436
|
const n = Kr(e);
|
|
3437
3437
|
if (n) return {
|
|
@@ -3439,13 +3439,13 @@ function Yr(t) {
|
|
|
3439
3439
|
html: e
|
|
3440
3440
|
};
|
|
3441
3441
|
}
|
|
3442
|
-
const a =
|
|
3442
|
+
const a = me(t, "description");
|
|
3443
3443
|
return a ? { text: a } : void 0;
|
|
3444
3444
|
}
|
|
3445
3445
|
function We(t) {
|
|
3446
3446
|
return Array.isArray(t) ? t.map((e) => {
|
|
3447
3447
|
if (!e || typeof e != "object") return null;
|
|
3448
|
-
const a = e, n =
|
|
3448
|
+
const a = e, n = me(a, "key", "name", "label", "title"), r = a.value, i = typeof r == "string" || typeof r == "number" || typeof r == "boolean" ? String(r).trim() : void 0;
|
|
3449
3449
|
return !n || !i ? null : {
|
|
3450
3450
|
key: n,
|
|
3451
3451
|
value: i
|
|
@@ -3469,7 +3469,7 @@ function Zr(t) {
|
|
|
3469
3469
|
return n.length > 0 ? n : void 0;
|
|
3470
3470
|
}
|
|
3471
3471
|
function Se(t, ...e) {
|
|
3472
|
-
return
|
|
3472
|
+
return me(t, ...e);
|
|
3473
3473
|
}
|
|
3474
3474
|
function Bt(t, ...e) {
|
|
3475
3475
|
return Ge(t, ...e);
|
|
@@ -3483,7 +3483,7 @@ function ua(t) {
|
|
|
3483
3483
|
}
|
|
3484
3484
|
function Xr(t) {
|
|
3485
3485
|
const e = ua(t)?.toLowerCase();
|
|
3486
|
-
return !!(
|
|
3486
|
+
return !!(me(t, "color", "colour", "color_hex", "hex", "swatch", "swatchColor") || e && da.has(e));
|
|
3487
3487
|
}
|
|
3488
3488
|
function zt(t) {
|
|
3489
3489
|
if (!t) return;
|
|
@@ -3522,7 +3522,7 @@ function ni(t) {
|
|
|
3522
3522
|
function ri(t) {
|
|
3523
3523
|
const e = ni(t);
|
|
3524
3524
|
if (e) return e;
|
|
3525
|
-
const a =
|
|
3525
|
+
const a = me(t, "sku"), n = qe(t, "inStock", "in_stock"), r = [], i = /* @__PURE__ */ new Set(), o = (c, l) => {
|
|
3526
3526
|
if (!ti(c) || typeof l != "string" && typeof l != "number" && typeof l != "boolean") return;
|
|
3527
3527
|
const p = String(l).trim();
|
|
3528
3528
|
if (!p) return;
|
|
@@ -3547,195 +3547,195 @@ function oi(t, e) {
|
|
|
3547
3547
|
a.className = "gengage-chat-product-details-panel";
|
|
3548
3548
|
const n = t.props?.product ?? t.props;
|
|
3549
3549
|
if (!n) return a;
|
|
3550
|
-
const r =
|
|
3550
|
+
const r = me(n, "name"), i = me(n, "brand"), o = me(n, "sku"), s = me(n, "cartCode", "cart_code"), c = me(n, "price"), l = me(n, "originalPrice", "price_original"), p = qe(n, "price_async"), g = He(e, n), h = $e(e, n), m = !!(l && c && l !== c), v = qe(n, "inStock", "in_stock"), f = Ge(n, "reviewCount", "review_count"), u = Ge(n, "rating"), d = Wr(n), A = pa(n).slice(0, 4);
|
|
3551
3551
|
if (d.length > 1) {
|
|
3552
|
-
const
|
|
3553
|
-
|
|
3554
|
-
const
|
|
3555
|
-
|
|
3556
|
-
const
|
|
3557
|
-
|
|
3558
|
-
const
|
|
3559
|
-
let k = null,
|
|
3560
|
-
const q = e.i18n, K = q?.galleryPrevAriaLabel ?? "Previous image",
|
|
3561
|
-
|
|
3562
|
-
const
|
|
3563
|
-
|
|
3564
|
-
const
|
|
3565
|
-
|
|
3566
|
-
},
|
|
3567
|
-
if (M < 0 || M >= d.length || M ===
|
|
3568
|
-
const
|
|
3569
|
-
if (!
|
|
3570
|
-
|
|
3571
|
-
const
|
|
3572
|
-
k && k.classList.remove("gengage-chat-product-gallery-thumb--active"), M <
|
|
3552
|
+
const L = document.createElement("div");
|
|
3553
|
+
L.className = "gengage-chat-product-details-media gengage-chat-product-details-gallery gengage-chat-product-details-img-wrap";
|
|
3554
|
+
const P = document.createElement("img");
|
|
3555
|
+
P.className = "gengage-chat-product-details-img", ge(P, "src", d[0]), P.alt = r ?? "Product image", be(P), L.appendChild(P);
|
|
3556
|
+
const B = document.createElement("div");
|
|
3557
|
+
B.className = "gengage-chat-product-gallery-thumbs";
|
|
3558
|
+
const N = 6;
|
|
3559
|
+
let k = null, O = 0;
|
|
3560
|
+
const q = e.i18n, K = q?.galleryPrevAriaLabel ?? "Previous image", U = q?.galleryNextAriaLabel ?? "Next image", ee = (M) => M === "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>', X = document.createElement("button");
|
|
3561
|
+
X.type = "button", X.className = "gengage-chat-product-gallery-nav gengage-chat-product-gallery-nav--prev gds-btn gds-btn-ghost gds-icon-btn", X.setAttribute("aria-label", K), X.innerHTML = ee("prev");
|
|
3562
|
+
const $ = document.createElement("button");
|
|
3563
|
+
$.type = "button", $.className = "gengage-chat-product-gallery-nav gengage-chat-product-gallery-nav--next gds-btn gds-btn-ghost gds-icon-btn", $.setAttribute("aria-label", U), $.innerHTML = ee("next");
|
|
3564
|
+
const b = () => {
|
|
3565
|
+
X.disabled = O <= 0, $.disabled = O >= d.length - 1;
|
|
3566
|
+
}, E = (M) => {
|
|
3567
|
+
if (M < 0 || M >= d.length || M === O) return;
|
|
3568
|
+
const D = d[M];
|
|
3569
|
+
if (!D) return;
|
|
3570
|
+
ge(P, "src", D);
|
|
3571
|
+
const Z = B.querySelectorAll(".gengage-chat-product-gallery-thumb");
|
|
3572
|
+
k && k.classList.remove("gengage-chat-product-gallery-thumb--active"), M < N && Z[M] ? (Z[M].classList.add("gengage-chat-product-gallery-thumb--active"), k = Z[M]) : k = null, O = M, b();
|
|
3573
3573
|
};
|
|
3574
3574
|
for (let M = 0; M < d.length; M++) {
|
|
3575
|
-
const
|
|
3576
|
-
if (M >=
|
|
3577
|
-
const
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
}),
|
|
3581
|
-
}
|
|
3582
|
-
if (d.length >
|
|
3575
|
+
const D = d[M];
|
|
3576
|
+
if (M >= N) break;
|
|
3577
|
+
const Z = document.createElement("img");
|
|
3578
|
+
Z.className = "gengage-chat-product-gallery-thumb", M === 0 && (Z.classList.add("gengage-chat-product-gallery-thumb--active"), k = Z), ge(Z, "src", D), Z.alt = `${r ?? "Product"} ${M + 1}`, Z.width = 48, Z.height = 48, be(Z), Z.addEventListener("click", () => {
|
|
3579
|
+
E(M);
|
|
3580
|
+
}), B.appendChild(Z);
|
|
3581
|
+
}
|
|
3582
|
+
if (d.length > N) {
|
|
3583
3583
|
const M = document.createElement("span");
|
|
3584
|
-
M.className = "gengage-chat-product-gallery-thumb-more", M.textContent = `+${d.length -
|
|
3585
|
-
}
|
|
3586
|
-
|
|
3587
|
-
M.stopPropagation(),
|
|
3588
|
-
}),
|
|
3589
|
-
M.stopPropagation(),
|
|
3590
|
-
}),
|
|
3591
|
-
let
|
|
3592
|
-
const
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
}, { passive: !0 }),
|
|
3596
|
-
const
|
|
3597
|
-
Math.abs(
|
|
3598
|
-
}),
|
|
3584
|
+
M.className = "gengage-chat-product-gallery-thumb-more", M.textContent = `+${d.length - N}`, B.appendChild(M);
|
|
3585
|
+
}
|
|
3586
|
+
X.addEventListener("click", (M) => {
|
|
3587
|
+
M.stopPropagation(), E(O - 1);
|
|
3588
|
+
}), $.addEventListener("click", (M) => {
|
|
3589
|
+
M.stopPropagation(), E(O + 1);
|
|
3590
|
+
}), b();
|
|
3591
|
+
let T = 0;
|
|
3592
|
+
const j = 50;
|
|
3593
|
+
P.addEventListener("touchstart", (M) => {
|
|
3594
|
+
T = M.changedTouches[0].clientX;
|
|
3595
|
+
}, { passive: !0 }), P.addEventListener("touchend", (M) => {
|
|
3596
|
+
const D = M.changedTouches[0].clientX, Z = T - D;
|
|
3597
|
+
Math.abs(Z) < j || E(Z > 0 ? Math.min(O + 1, d.length - 1) : Math.max(O - 1, 0));
|
|
3598
|
+
}), L.appendChild(X), L.appendChild($), L.appendChild(B), a.appendChild(L);
|
|
3599
3599
|
} else if (d.length === 1) {
|
|
3600
|
-
const
|
|
3601
|
-
|
|
3602
|
-
const
|
|
3603
|
-
|
|
3600
|
+
const L = document.createElement("div");
|
|
3601
|
+
L.className = "gengage-chat-product-details-media gengage-chat-product-details-img-wrap";
|
|
3602
|
+
const P = document.createElement("img");
|
|
3603
|
+
P.className = "gengage-chat-product-details-img", P.loading = "lazy", ge(P, "src", d[0]), be(P), P.alt = r ?? "Product image", L.appendChild(P), a.appendChild(L);
|
|
3604
3604
|
}
|
|
3605
3605
|
const y = document.createElement("div");
|
|
3606
3606
|
if (y.className = "gengage-chat-product-details-content", i && (!r || !r.toLowerCase().startsWith(i.toLowerCase()))) {
|
|
3607
|
-
const
|
|
3608
|
-
|
|
3607
|
+
const L = document.createElement("div");
|
|
3608
|
+
L.className = "gengage-chat-product-details-brand", L.textContent = i, y.appendChild(L);
|
|
3609
3609
|
}
|
|
3610
3610
|
if (r) {
|
|
3611
|
-
const
|
|
3612
|
-
|
|
3611
|
+
const L = document.createElement("h3");
|
|
3612
|
+
L.className = "gengage-chat-product-details-title", L.textContent = r, L.title = r, y.appendChild(L);
|
|
3613
3613
|
}
|
|
3614
3614
|
if (e.hideUserReviews !== !0 && typeof u == "number" && Number.isFinite(u) && u > 0) {
|
|
3615
|
-
const
|
|
3616
|
-
|
|
3615
|
+
const L = document.createElement(o ? "button" : "div");
|
|
3616
|
+
L.className = "gengage-chat-product-details-rating", o && (L.type = "button", L.classList.add("gengage-chat-product-details-rating--clickable"), L.setAttribute("aria-label", e.i18n?.groundingReviewCta ?? "Read Reviews"), L.addEventListener("click", () => {
|
|
3617
3617
|
e.onAction({
|
|
3618
3618
|
title: e.i18n?.customerReviewsTitle ?? "Customer Reviews",
|
|
3619
3619
|
type: "reviewSummary",
|
|
3620
3620
|
payload: { sku: o }
|
|
3621
3621
|
});
|
|
3622
|
-
})),
|
|
3623
|
-
const
|
|
3624
|
-
if (
|
|
3625
|
-
const
|
|
3626
|
-
|
|
3622
|
+
})), L.appendChild(Qt(u));
|
|
3623
|
+
const P = document.createElement("span");
|
|
3624
|
+
if (P.className = "gengage-chat-product-details-rating-value", P.textContent = Jt(u).toFixed(1), L.appendChild(P), typeof f == "number" && Number.isFinite(f)) {
|
|
3625
|
+
const B = document.createElement("span");
|
|
3626
|
+
B.className = "gengage-chat-product-details-review-count", B.textContent = ` (${f})`, L.appendChild(B);
|
|
3627
3627
|
}
|
|
3628
|
-
y.appendChild(
|
|
3628
|
+
y.appendChild(L);
|
|
3629
3629
|
}
|
|
3630
3630
|
{
|
|
3631
|
-
const
|
|
3632
|
-
let
|
|
3633
|
-
if (g && !
|
|
3634
|
-
const
|
|
3635
|
-
|
|
3631
|
+
const L = !!(g && m);
|
|
3632
|
+
let P = y;
|
|
3633
|
+
if (g && !L) {
|
|
3634
|
+
const N = document.createElement("div");
|
|
3635
|
+
N.className = "gengage-chat-product-details-price-stack", N.appendChild(Ze(g)), y.appendChild(N), P = N;
|
|
3636
3636
|
}
|
|
3637
|
-
const
|
|
3638
|
-
if (
|
|
3639
|
-
const
|
|
3640
|
-
|
|
3641
|
-
if (
|
|
3642
|
-
if (c && parseFloat(c) > 0) Nt(
|
|
3637
|
+
const B = document.createElement("div");
|
|
3638
|
+
if (B.className = "gengage-chat-product-details-price", p === !0) {
|
|
3639
|
+
const N = document.createElement("span");
|
|
3640
|
+
N.className = "gengage-chat-price-skeleton", B.appendChild(N), P.appendChild(B), setTimeout(() => {
|
|
3641
|
+
if (N.parentElement)
|
|
3642
|
+
if (c && parseFloat(c) > 0) Nt(B, e, n, c, l, h, m);
|
|
3643
3643
|
else {
|
|
3644
|
-
const k =
|
|
3645
|
-
|
|
3644
|
+
const k = B.parentElement;
|
|
3645
|
+
B.remove(), k?.classList.contains("gengage-chat-product-details-price-stack") && k.remove();
|
|
3646
3646
|
}
|
|
3647
3647
|
}, 300);
|
|
3648
3648
|
} else if (c && parseFloat(c) > 0)
|
|
3649
|
-
Nt(
|
|
3649
|
+
Nt(B, e, n, c, l, h, m), P.appendChild(B);
|
|
3650
3650
|
else if (g) {
|
|
3651
|
-
const
|
|
3652
|
-
|
|
3651
|
+
const N = P;
|
|
3652
|
+
N.classList.contains("gengage-chat-product-details-price-stack") && N.remove();
|
|
3653
3653
|
}
|
|
3654
3654
|
}
|
|
3655
3655
|
if (e.hideStockStatus !== !0 && typeof v == "boolean") {
|
|
3656
|
-
const
|
|
3657
|
-
|
|
3656
|
+
const L = document.createElement("div");
|
|
3657
|
+
L.className = `gengage-chat-product-details-stock ${v ? "is-in-stock" : "is-out-of-stock"}`, L.textContent = v ? e.i18n?.inStockLabel ?? "In Stock" : e.i18n?.outOfStockLabel ?? "Out of Stock", y.appendChild(L);
|
|
3658
3658
|
}
|
|
3659
3659
|
const w = n.promotions;
|
|
3660
3660
|
if (w && w.length > 0) {
|
|
3661
|
-
const
|
|
3662
|
-
|
|
3663
|
-
for (const
|
|
3664
|
-
if (!
|
|
3665
|
-
const
|
|
3666
|
-
|
|
3661
|
+
const L = document.createElement("div");
|
|
3662
|
+
L.className = "gengage-chat-product-details-promos";
|
|
3663
|
+
for (const P of w.slice(0, 3)) {
|
|
3664
|
+
if (!P || /%(0(\.0+)?)\s/.test(P)) continue;
|
|
3665
|
+
const B = document.createElement("span");
|
|
3666
|
+
B.className = "gengage-chat-product-details-promo-badge", B.textContent = P, B.title = P, L.appendChild(B);
|
|
3667
3667
|
}
|
|
3668
|
-
|
|
3668
|
+
L.childElementCount > 0 && y.appendChild(L);
|
|
3669
3669
|
}
|
|
3670
3670
|
if (A.length > 0) {
|
|
3671
|
-
const
|
|
3672
|
-
|
|
3673
|
-
for (const
|
|
3674
|
-
const
|
|
3675
|
-
|
|
3676
|
-
const
|
|
3677
|
-
|
|
3671
|
+
const L = document.createElement("dl");
|
|
3672
|
+
L.className = "gengage-chat-product-details-facts";
|
|
3673
|
+
for (const P of A) {
|
|
3674
|
+
const B = document.createElement("div");
|
|
3675
|
+
B.className = "gengage-chat-product-details-fact";
|
|
3676
|
+
const N = document.createElement("dt");
|
|
3677
|
+
N.textContent = P.key;
|
|
3678
3678
|
const k = document.createElement("dd");
|
|
3679
|
-
k.textContent =
|
|
3679
|
+
k.textContent = P.value, B.appendChild(N), B.appendChild(k), L.appendChild(B);
|
|
3680
3680
|
}
|
|
3681
|
-
y.appendChild(
|
|
3681
|
+
y.appendChild(L);
|
|
3682
3682
|
}
|
|
3683
|
-
const
|
|
3684
|
-
if (
|
|
3683
|
+
const H = ri(n);
|
|
3684
|
+
if (H.length > 0) {
|
|
3685
|
+
const L = document.createElement("div");
|
|
3686
|
+
L.className = "gengage-chat-product-variants";
|
|
3685
3687
|
const P = document.createElement("div");
|
|
3686
|
-
P.className = "gengage-chat-product-variants";
|
|
3687
|
-
const
|
|
3688
|
-
|
|
3689
|
-
const N
|
|
3690
|
-
|
|
3691
|
-
|
|
3692
|
-
const k = ha(B), D = Se(B, "sku");
|
|
3693
|
-
if (!k && !D) continue;
|
|
3688
|
+
P.className = "gengage-chat-product-variants-label", P.textContent = ii(H, e), L.appendChild(P);
|
|
3689
|
+
const B = document.createElement("div");
|
|
3690
|
+
B.className = "gengage-chat-product-variants-list";
|
|
3691
|
+
for (const N of H) {
|
|
3692
|
+
const k = ha(N), O = Se(N, "sku");
|
|
3693
|
+
if (!k && !O) continue;
|
|
3694
3694
|
const q = document.createElement("button");
|
|
3695
3695
|
q.className = "gengage-chat-product-variant-btn gds-chip", q.type = "button";
|
|
3696
|
-
const K = k ??
|
|
3696
|
+
const K = k ?? O ?? "";
|
|
3697
3697
|
q.title = K;
|
|
3698
|
-
const
|
|
3699
|
-
|
|
3700
|
-
const
|
|
3701
|
-
if (
|
|
3702
|
-
const
|
|
3703
|
-
|
|
3704
|
-
} else if (
|
|
3705
|
-
const
|
|
3706
|
-
|
|
3698
|
+
const U = qe(N, "in_stock", "inStock");
|
|
3699
|
+
O && o && O === o ? (q.classList.add("gengage-chat-product-variant-btn--active"), q.setAttribute("aria-pressed", "true")) : q.setAttribute("aria-pressed", "false"), U === !1 && (q.classList.add("gengage-chat-product-variant-btn--out"), q.disabled = !0);
|
|
3700
|
+
const ee = Jr(N), X = Qr(N);
|
|
3701
|
+
if (ee && ve(ee)) {
|
|
3702
|
+
const E = document.createElement("img");
|
|
3703
|
+
E.className = "gengage-chat-product-variant-swatch gengage-chat-product-variant-swatch--image", ge(E, "src", ee), E.alt = "", E.setAttribute("aria-hidden", "true"), be(E), q.appendChild(E);
|
|
3704
|
+
} else if (X) {
|
|
3705
|
+
const E = document.createElement("span");
|
|
3706
|
+
E.className = "gengage-chat-product-variant-swatch", E.setAttribute("aria-hidden", "true"), E.style.backgroundColor = X, q.appendChild(E);
|
|
3707
3707
|
}
|
|
3708
|
-
const
|
|
3709
|
-
|
|
3710
|
-
const
|
|
3711
|
-
if (
|
|
3712
|
-
const
|
|
3713
|
-
|
|
3708
|
+
const $ = document.createElement("span");
|
|
3709
|
+
$.className = "gengage-chat-product-variant-label", $.textContent = K, q.appendChild($);
|
|
3710
|
+
const b = ei(N);
|
|
3711
|
+
if (b && String(b) !== String(c)) {
|
|
3712
|
+
const E = document.createElement("span");
|
|
3713
|
+
E.className = "gengage-chat-product-variant-price", E.textContent = ae(String(b), e.pricing), q.appendChild(E);
|
|
3714
3714
|
}
|
|
3715
|
-
if (
|
|
3716
|
-
const
|
|
3715
|
+
if (O && O !== o) {
|
|
3716
|
+
const E = r ?? "", T = (typeof N.value == "string" ? N.value.trim() : "") || (typeof N.name == "string" ? N.name.trim() : "") || (typeof N.variant_name == "string" ? N.variant_name.trim() : "") || "", j = E.length > 0 ? T.length > 0 && T !== E ? `${E} (${T})` : E : K;
|
|
3717
3717
|
q.addEventListener("click", () => {
|
|
3718
3718
|
e.onAction({
|
|
3719
|
-
title:
|
|
3719
|
+
title: j,
|
|
3720
3720
|
type: "launchVariant",
|
|
3721
|
-
payload: { sku:
|
|
3721
|
+
payload: { sku: O }
|
|
3722
3722
|
});
|
|
3723
3723
|
});
|
|
3724
3724
|
}
|
|
3725
|
-
|
|
3725
|
+
B.appendChild(q);
|
|
3726
3726
|
}
|
|
3727
|
-
|
|
3727
|
+
B.childElementCount > 0 && (L.appendChild(B), y.appendChild(L));
|
|
3728
3728
|
}
|
|
3729
3729
|
const I = document.createElement("div");
|
|
3730
3730
|
I.className = "gengage-chat-product-details-actions";
|
|
3731
3731
|
const _ = t.props?.action;
|
|
3732
3732
|
if (_) {
|
|
3733
|
-
const
|
|
3734
|
-
|
|
3733
|
+
const L = document.createElement("button");
|
|
3734
|
+
L.className = "gengage-chat-product-details-cta gds-btn gds-btn-primary", L.type = "button", L.textContent = _.title || e.i18n?.productCtaLabel || "View", L.addEventListener("click", () => e.onAction(_)), I.appendChild(L);
|
|
3735
3735
|
}
|
|
3736
3736
|
if (s && o && v !== !1) {
|
|
3737
|
-
const
|
|
3738
|
-
|
|
3737
|
+
const L = document.createElement("button");
|
|
3738
|
+
L.className = "gengage-chat-product-details-atc gds-btn gds-btn-primary", L.type = "button", L.textContent = e.i18n?.addToCartButton ?? "Add to Cart", L.addEventListener("click", () => {
|
|
3739
3739
|
e.onAction({
|
|
3740
3740
|
title: e.i18n?.addToCartButton ?? "Add to Cart",
|
|
3741
3741
|
type: "addToCart",
|
|
@@ -3745,46 +3745,46 @@ function oi(t, e) {
|
|
|
3745
3745
|
quantity: 1
|
|
3746
3746
|
}
|
|
3747
3747
|
});
|
|
3748
|
-
}), I.appendChild(
|
|
3748
|
+
}), I.appendChild(L);
|
|
3749
3749
|
}
|
|
3750
|
-
const S =
|
|
3751
|
-
if (!_ && S &&
|
|
3752
|
-
const
|
|
3753
|
-
|
|
3754
|
-
e.onProductClick && o && (
|
|
3750
|
+
const S = me(n, "url");
|
|
3751
|
+
if (!_ && S && ve(S)) {
|
|
3752
|
+
const L = document.createElement("a");
|
|
3753
|
+
L.className = "gengage-chat-product-details-cta gds-btn gds-btn-secondary", ge(L, "href", S), ge(L, "target", "_blank"), ge(L, "rel", "noopener noreferrer"), L.textContent = e.i18n?.viewOnSiteLabel ?? e.i18n?.productCtaLabel ?? "View on Site", L.addEventListener("click", (P) => {
|
|
3754
|
+
e.onProductClick && o && (P.preventDefault(), e.onProductClick({
|
|
3755
3755
|
sku: o,
|
|
3756
3756
|
url: S,
|
|
3757
3757
|
...r ? { name: r } : {}
|
|
3758
3758
|
}));
|
|
3759
|
-
}), I.appendChild(
|
|
3759
|
+
}), I.appendChild(L);
|
|
3760
3760
|
}
|
|
3761
|
-
const
|
|
3762
|
-
if (
|
|
3761
|
+
const F = S;
|
|
3762
|
+
if (F && ve(F)) {
|
|
3763
3763
|
let k = function(q, K) {
|
|
3764
|
-
const
|
|
3765
|
-
|
|
3766
|
-
},
|
|
3767
|
-
const
|
|
3768
|
-
|
|
3764
|
+
const U = document.createElementNS(B, "circle");
|
|
3765
|
+
U.setAttribute("cx", q), U.setAttribute("cy", K), U.setAttribute("r", "3"), N.appendChild(U);
|
|
3766
|
+
}, O = function(q, K, U, ee) {
|
|
3767
|
+
const X = document.createElementNS(B, "line");
|
|
3768
|
+
X.setAttribute("x1", q), X.setAttribute("y1", K), X.setAttribute("x2", U), X.setAttribute("y2", ee), N.appendChild(X);
|
|
3769
3769
|
};
|
|
3770
|
-
const
|
|
3771
|
-
|
|
3772
|
-
const
|
|
3773
|
-
|
|
3774
|
-
const
|
|
3775
|
-
|
|
3770
|
+
const L = document.createElement("button");
|
|
3771
|
+
L.className = "gengage-chat-product-details-share gds-btn gds-btn-ghost gds-icon-btn", L.type = "button";
|
|
3772
|
+
const P = e.i18n?.shareButton ?? "Share";
|
|
3773
|
+
L.title = P, L.setAttribute("aria-label", P);
|
|
3774
|
+
const B = "http://www.w3.org/2000/svg", N = document.createElementNS(B, "svg");
|
|
3775
|
+
N.setAttribute("width", "18"), N.setAttribute("height", "18"), N.setAttribute("viewBox", "0 0 24 24"), N.setAttribute("fill", "none"), N.setAttribute("stroke", "currentColor"), N.setAttribute("stroke-width", "2"), N.setAttribute("stroke-linecap", "round"), N.setAttribute("stroke-linejoin", "round"), k("18", "5"), k("6", "12"), k("18", "19"), O("8.59", "13.51", "15.42", "17.49"), O("15.41", "6.51", "8.59", "10.49"), L.appendChild(N), L.addEventListener("click", async () => {
|
|
3776
3776
|
try {
|
|
3777
3777
|
navigator.share ? await navigator.share({
|
|
3778
3778
|
title: r ?? "",
|
|
3779
|
-
url:
|
|
3780
|
-
}) : navigator.clipboard && (await navigator.clipboard.writeText(
|
|
3779
|
+
url: F
|
|
3780
|
+
}) : navigator.clipboard && (await navigator.clipboard.writeText(F), L.classList.add("gengage-chat-product-details-share--copied"), setTimeout(() => L.classList.remove("gengage-chat-product-details-share--copied"), 1500));
|
|
3781
3781
|
} catch {
|
|
3782
3782
|
}
|
|
3783
|
-
}), I.appendChild(
|
|
3783
|
+
}), I.appendChild(L);
|
|
3784
3784
|
}
|
|
3785
3785
|
I.childElementCount > 0 && y.appendChild(I), a.appendChild(y);
|
|
3786
|
-
const W = Yr(n),
|
|
3787
|
-
return (W ||
|
|
3786
|
+
const W = Yr(n), J = Zr(n);
|
|
3787
|
+
return (W || J) && a.appendChild(li(W, J, e)), a;
|
|
3788
3788
|
}
|
|
3789
3789
|
function pt(t) {
|
|
3790
3790
|
if (t.nodeType === Node.TEXT_NODE) return document.createTextNode(t.textContent ?? "");
|
|
@@ -3947,81 +3947,81 @@ function ui(t, e, a, n) {
|
|
|
3947
3947
|
},
|
|
3948
3948
|
icon: "priceDesc"
|
|
3949
3949
|
}
|
|
3950
|
-
],
|
|
3951
|
-
|
|
3950
|
+
], f = document.createElement("div");
|
|
3951
|
+
f.className = "gengage-chat-product-sort-dropdown";
|
|
3952
3952
|
const u = document.createElement("button");
|
|
3953
3953
|
u.type = "button", u.className = "gengage-chat-product-sort-trigger gds-btn gds-btn-ghost", u.setAttribute("aria-haspopup", "listbox"), u.setAttribute("aria-expanded", "false");
|
|
3954
3954
|
const d = n.i18n?.sortToolbarAriaLabel ?? "Sort products", A = document.createElement("span");
|
|
3955
3955
|
A.className = "gengage-chat-product-sort-trigger-icon";
|
|
3956
3956
|
const y = document.createElement("span");
|
|
3957
3957
|
y.className = "gengage-chat-product-sort-trigger-label";
|
|
3958
|
-
const w = (
|
|
3959
|
-
const
|
|
3960
|
-
y.textContent =
|
|
3958
|
+
const w = (P) => {
|
|
3959
|
+
const B = v.find((N) => Ht(N.sortState, P)) ?? v[0];
|
|
3960
|
+
y.textContent = B.label, A.innerHTML = Rt(B.icon), f.dataset.sortIcon = B.icon, u.setAttribute("aria-label", `${d}: ${B.label}`), u.title = B.label;
|
|
3961
3961
|
};
|
|
3962
3962
|
w(m);
|
|
3963
|
-
const
|
|
3964
|
-
|
|
3963
|
+
const H = document.createElement("span");
|
|
3964
|
+
H.className = "gengage-chat-product-sort-trigger-chevron", H.innerHTML = gi(), u.appendChild(A), u.appendChild(y), u.appendChild(H);
|
|
3965
3965
|
const I = document.createElement("div");
|
|
3966
3966
|
I.className = "gengage-chat-product-sort-menu gds-menu", I.hidden = !0, I.setAttribute("role", "listbox"), I.setAttribute("aria-label", d);
|
|
3967
3967
|
const _ = h.ownerDocument;
|
|
3968
3968
|
let S = null;
|
|
3969
|
-
const
|
|
3970
|
-
I.hidden = !0,
|
|
3971
|
-
}, W = (
|
|
3972
|
-
|
|
3973
|
-
},
|
|
3974
|
-
|
|
3975
|
-
},
|
|
3976
|
-
I.hidden = !1,
|
|
3977
|
-
const { signal:
|
|
3978
|
-
_.addEventListener("click", W, { signal:
|
|
3969
|
+
const F = () => {
|
|
3970
|
+
I.hidden = !0, f.classList.remove("gengage-chat-product-sort-dropdown--open"), u.setAttribute("aria-expanded", "false"), S?.abort(), S = null;
|
|
3971
|
+
}, W = (P) => {
|
|
3972
|
+
f.classList.contains("gengage-chat-product-sort-dropdown--open") && (f.contains(P.target) || F());
|
|
3973
|
+
}, J = (P) => {
|
|
3974
|
+
P.key === "Escape" && (P.preventDefault(), F());
|
|
3975
|
+
}, L = () => {
|
|
3976
|
+
I.hidden = !1, f.classList.add("gengage-chat-product-sort-dropdown--open"), u.setAttribute("aria-expanded", "true"), S = new AbortController();
|
|
3977
|
+
const { signal: P } = S;
|
|
3978
|
+
_.addEventListener("click", W, { signal: P }), _.addEventListener("keydown", J, {
|
|
3979
3979
|
capture: !0,
|
|
3980
|
-
signal:
|
|
3980
|
+
signal: P
|
|
3981
3981
|
});
|
|
3982
3982
|
};
|
|
3983
|
-
u.addEventListener("click", (
|
|
3984
|
-
|
|
3983
|
+
u.addEventListener("click", (P) => {
|
|
3984
|
+
P.stopPropagation(), f.classList.contains("gengage-chat-product-sort-dropdown--open") ? F() : L();
|
|
3985
3985
|
});
|
|
3986
|
-
for (const
|
|
3987
|
-
const
|
|
3988
|
-
|
|
3989
|
-
const
|
|
3990
|
-
|
|
3991
|
-
const k =
|
|
3992
|
-
|
|
3993
|
-
const
|
|
3994
|
-
|
|
3986
|
+
for (const P of v) {
|
|
3987
|
+
const B = document.createElement("button");
|
|
3988
|
+
B.type = "button", B.className = "gengage-chat-product-sort-option gds-menu-option", B.setAttribute("role", "option");
|
|
3989
|
+
const N = Ht(m, P.sortState);
|
|
3990
|
+
B.setAttribute("aria-selected", N ? "true" : "false"), N && B.classList.add("gengage-chat-product-sort-option--active", "gds-menu-option-active");
|
|
3991
|
+
const k = P.sortState.type === "related" ? "related" : `price-${P.sortState.direction ?? ""}`;
|
|
3992
|
+
B.dataset.sortKey = k;
|
|
3993
|
+
const O = document.createElement("span");
|
|
3994
|
+
O.className = "gengage-chat-product-sort-option-icon", O.innerHTML = Rt(P.icon);
|
|
3995
3995
|
const q = document.createElement("span");
|
|
3996
|
-
q.className = "gengage-chat-product-sort-option-label", q.textContent =
|
|
3996
|
+
q.className = "gengage-chat-product-sort-option-label", q.textContent = P.label;
|
|
3997
3997
|
const K = document.createElement("span");
|
|
3998
|
-
K.className = "gengage-chat-product-sort-option-check", K.innerHTML = di(), K.setAttribute("aria-hidden", "true"),
|
|
3999
|
-
m =
|
|
4000
|
-
const
|
|
4001
|
-
|
|
4002
|
-
}), w(
|
|
4003
|
-
}), I.appendChild(
|
|
4004
|
-
}
|
|
4005
|
-
if (
|
|
4006
|
-
const
|
|
4007
|
-
|
|
4008
|
-
const N = document.createElement("span");
|
|
4009
|
-
N.className = "gengage-chat-comparison-toggle-icon", N.innerHTML = pi();
|
|
3998
|
+
K.className = "gengage-chat-product-sort-option-check", K.innerHTML = di(), K.setAttribute("aria-hidden", "true"), N || K.classList.add("gengage-chat-product-sort-option-check--hidden"), B.appendChild(O), B.appendChild(q), B.appendChild(K), B.addEventListener("click", () => {
|
|
3999
|
+
m = P.sortState, n.onSortChange?.(P.sortState), hi(c, s, e, P.sortState), I.querySelectorAll(".gengage-chat-product-sort-option").forEach((U) => {
|
|
4000
|
+
const ee = U, X = ee.dataset.sortKey === k;
|
|
4001
|
+
ee.classList.toggle("gengage-chat-product-sort-option--active", X), ee.classList.toggle("gds-menu-option-active", X), ee.setAttribute("aria-selected", X ? "true" : "false"), ee.querySelector(".gengage-chat-product-sort-option-check")?.classList.toggle("gengage-chat-product-sort-option-check--hidden", !X);
|
|
4002
|
+
}), w(P.sortState), F();
|
|
4003
|
+
}), I.appendChild(B);
|
|
4004
|
+
}
|
|
4005
|
+
if (f.appendChild(u), f.appendChild(I), h.appendChild(f), n.onToggleComparisonSku) {
|
|
4006
|
+
const P = document.createElement("button");
|
|
4007
|
+
P.className = "gengage-chat-comparison-toggle-btn gds-btn gds-btn-ghost", P.type = "button", n.comparisonSelectMode && P.classList.add("gengage-chat-comparison-toggle-btn--active"), n.isStreaming && P.classList.add("gengage-chat-comparison-toggle-btn--hidden");
|
|
4010
4008
|
const B = document.createElement("span");
|
|
4011
|
-
B.className = "gengage-chat-comparison-toggle-
|
|
4009
|
+
B.className = "gengage-chat-comparison-toggle-icon", B.innerHTML = pi();
|
|
4010
|
+
const N = document.createElement("span");
|
|
4011
|
+
N.className = "gengage-chat-comparison-toggle-label";
|
|
4012
4012
|
const k = n.i18n?.compareSelected ?? "Compare";
|
|
4013
|
-
|
|
4013
|
+
N.textContent = k, P.setAttribute("aria-label", k), P.title = k, P.appendChild(B), P.appendChild(N), P.addEventListener("click", () => {
|
|
4014
4014
|
n.onToggleComparisonSku?.("");
|
|
4015
|
-
}), h.appendChild(
|
|
4015
|
+
}), h.appendChild(P);
|
|
4016
4016
|
}
|
|
4017
4017
|
if (l) {
|
|
4018
4018
|
h.classList.add("gengage-chat-product-sort-toolbar--inline");
|
|
4019
|
-
const
|
|
4020
|
-
|
|
4021
|
-
const
|
|
4022
|
-
|
|
4023
|
-
const
|
|
4024
|
-
|
|
4019
|
+
const P = document.createElement("div");
|
|
4020
|
+
P.className = "gengage-chat-product-grid-head";
|
|
4021
|
+
const B = document.createElement("span");
|
|
4022
|
+
B.className = "gengage-chat-product-grid-head-title", B.textContent = l, P.appendChild(B);
|
|
4023
|
+
const N = document.createElement("div");
|
|
4024
|
+
N.className = "gengage-chat-product-grid-head-actions", N.appendChild(h), P.appendChild(N), r.appendChild(P);
|
|
4025
4025
|
} else r.appendChild(h);
|
|
4026
4026
|
} else if (l) {
|
|
4027
4027
|
const h = document.createElement("div");
|
|
@@ -4078,12 +4078,12 @@ function fi(t, e) {
|
|
|
4078
4078
|
highlights: s,
|
|
4079
4079
|
specialCases: c,
|
|
4080
4080
|
locale: e.locale,
|
|
4081
|
-
onProductClick: ({ sku: v, name:
|
|
4081
|
+
onProductClick: ({ sku: v, name: f }) => {
|
|
4082
4082
|
const u = mi(v, r, i);
|
|
4083
4083
|
e.onProductClick?.({
|
|
4084
4084
|
sku: v,
|
|
4085
4085
|
url: u,
|
|
4086
|
-
...
|
|
4086
|
+
...f !== void 0 && f !== "" ? { name: f } : {}
|
|
4087
4087
|
});
|
|
4088
4088
|
},
|
|
4089
4089
|
pricing: e.pricing
|
|
@@ -4189,23 +4189,23 @@ function bt(t, e) {
|
|
|
4189
4189
|
if (d.length === 0) return;
|
|
4190
4190
|
const w = document.createElement("section");
|
|
4191
4191
|
w.className = "gengage-chat-consulting-group";
|
|
4192
|
-
const
|
|
4193
|
-
|
|
4192
|
+
const H = document.createElement("div");
|
|
4193
|
+
H.className = "gengage-chat-consulting-group-header";
|
|
4194
4194
|
const I = document.createElement("h4");
|
|
4195
|
-
if (I.className = "gengage-chat-consulting-group-label", I.textContent = `${u} (${d.length})`,
|
|
4195
|
+
if (I.className = "gengage-chat-consulting-group-label", I.textContent = `${u} (${d.length})`, H.appendChild(I), typeof y == "string" && y.trim().length > 0) {
|
|
4196
4196
|
const S = document.createElement("p");
|
|
4197
|
-
S.className = "gengage-chat-consulting-group-reason", S.textContent = y,
|
|
4197
|
+
S.className = "gengage-chat-consulting-group-reason", S.textContent = y, H.appendChild(S);
|
|
4198
4198
|
}
|
|
4199
|
-
w.appendChild(
|
|
4199
|
+
w.appendChild(H);
|
|
4200
4200
|
const _ = document.createElement("div");
|
|
4201
4201
|
_.className = "gengage-chat-product-grid gengage-chat-consulting-group-grid", A && _.classList.add("gengage-chat-consulting-group-grid--single-group"), _.style.setProperty("--consulting-group-columns", String(Math.max(1, Math.min(4, d.length))));
|
|
4202
4202
|
for (const S of d) {
|
|
4203
|
-
const
|
|
4203
|
+
const F = dt({
|
|
4204
4204
|
type: "ProductCard",
|
|
4205
4205
|
props: { product: S }
|
|
4206
4206
|
}, r ?? { onAction: () => {
|
|
4207
4207
|
} });
|
|
4208
|
-
_.appendChild(
|
|
4208
|
+
_.appendChild(F);
|
|
4209
4209
|
}
|
|
4210
4210
|
w.appendChild(_), n.appendChild(w);
|
|
4211
4211
|
}, h = /* @__PURE__ */ new Set(), m = [];
|
|
@@ -4227,8 +4227,8 @@ function bt(t, e) {
|
|
|
4227
4227
|
labelText: i.consultingOtherCompatibleProductsLabel,
|
|
4228
4228
|
products: v
|
|
4229
4229
|
});
|
|
4230
|
-
const
|
|
4231
|
-
for (const u of m) g(u.labelText, u.products,
|
|
4230
|
+
const f = m.length === 1;
|
|
4231
|
+
for (const u of m) g(u.labelText, u.products, f, u.reasonText);
|
|
4232
4232
|
return;
|
|
4233
4233
|
}
|
|
4234
4234
|
for (const p of c) {
|
|
@@ -4246,9 +4246,9 @@ function ut(t, e, a, n) {
|
|
|
4246
4246
|
let s = t.querySelector(".gengage-chat-consulting-style-media");
|
|
4247
4247
|
s ? s.innerHTML = "" : (s = document.createElement("div"), s.className = "gengage-chat-consulting-style-media", t.appendChild(s));
|
|
4248
4248
|
const c = vi(e.image_url);
|
|
4249
|
-
if (c &&
|
|
4249
|
+
if (c && ve(c)) {
|
|
4250
4250
|
const p = document.createElement("img");
|
|
4251
|
-
p.className = "gengage-chat-consulting-style-image", p.draggable = !1,
|
|
4251
|
+
p.className = "gengage-chat-consulting-style-image", p.draggable = !1, ge(p, "src", c), p.alt = Ve(e, a + 1, n), p.loading = "lazy", be(p), s.appendChild(p);
|
|
4252
4252
|
}
|
|
4253
4253
|
const l = document.createElement("span");
|
|
4254
4254
|
if (l.className = "gengage-chat-consulting-style-caption", l.textContent = Ve(e, a + 1, n), s.appendChild(l), r === "loading" || r !== "ready") {
|
|
@@ -4679,10 +4679,10 @@ function Ti(t, e, a) {
|
|
|
4679
4679
|
"Ürün ara",
|
|
4680
4680
|
"Karşılaştır",
|
|
4681
4681
|
"Soru sor"
|
|
4682
|
-
], placeholderInterval: v = 2e3, voiceLang:
|
|
4682
|
+
], placeholderInterval: v = 2e3, voiceLang: f = "tr-TR", showBorderAnimation: u = !0, sendAriaLabel: d = "Gönder", micAriaLabel: A = "Sesli giriş", cancelAriaLabel: y = "Ses kaydını durdur", openChatAriaLabel: w = "Chat'i aç" } = t;
|
|
4683
4683
|
if (!a.getElementById(Dt)) {
|
|
4684
|
-
const
|
|
4685
|
-
|
|
4684
|
+
const R = document.createElement("style");
|
|
4685
|
+
R.id = Dt, R.textContent = Pi({
|
|
4686
4686
|
primaryColor: n,
|
|
4687
4687
|
backgroundColor: r,
|
|
4688
4688
|
textColor: i,
|
|
@@ -4693,135 +4693,135 @@ function Ti(t, e, a) {
|
|
|
4693
4693
|
height: p,
|
|
4694
4694
|
maxWidth: g,
|
|
4695
4695
|
fontFamily: h
|
|
4696
|
-
}), a.appendChild(
|
|
4696
|
+
}), a.appendChild(R);
|
|
4697
4697
|
}
|
|
4698
|
-
const
|
|
4699
|
-
|
|
4700
|
-
const I =
|
|
4701
|
-
I.placeholder = m[0] ?? "", W.setAttribute("aria-label", d),
|
|
4702
|
-
let k = !1,
|
|
4698
|
+
const H = document.createElement("div");
|
|
4699
|
+
H.className = "gengage-fl", H.dataset.gengagePart = "floating-launcher", H.innerHTML = Li();
|
|
4700
|
+
const I = H.querySelector(".gengage-fl-input"), _ = H.querySelector(".gengage-fl-transcript"), S = H.querySelector(".gengage-fl-transcript-final"), F = H.querySelector(".gengage-fl-transcript-interim"), W = H.querySelector(".gengage-fl-btn-send"), J = H.querySelector(".gengage-fl-btn-mic"), L = H.querySelector(".gengage-fl-btn-open-chat"), P = H.querySelector(".gengage-fl-cancel"), B = H.querySelector(".gengage-fl-wave"), N = H.querySelector(".gengage-fl-ring");
|
|
4701
|
+
I.placeholder = m[0] ?? "", W.setAttribute("aria-label", d), J.setAttribute("aria-label", A), P.setAttribute("aria-label", y), L.setAttribute("aria-label", w);
|
|
4702
|
+
let k = !1, O = !1, q = "", K = !1, U = null, ee = 0, X = null, $ = null, b = null, E = null, T = null, j = 0;
|
|
4703
4703
|
function M() {
|
|
4704
|
-
const
|
|
4705
|
-
if (
|
|
4706
|
-
W.style.display = "flex",
|
|
4704
|
+
const R = I.value.trim().length > 0;
|
|
4705
|
+
if (J.classList.toggle("is-recording", k), k) {
|
|
4706
|
+
W.style.display = "flex", J.style.display = "flex", P.style.display = "flex", L.style.display = "none";
|
|
4707
4707
|
return;
|
|
4708
4708
|
}
|
|
4709
|
-
W.style.display =
|
|
4709
|
+
W.style.display = R ? "flex" : "none", J.style.display = R ? "none" : "flex", P.style.display = "none", L.style.display = !R && K ? "flex" : "none";
|
|
4710
4710
|
}
|
|
4711
|
-
function
|
|
4712
|
-
|
|
4711
|
+
function D() {
|
|
4712
|
+
ee = (ee + 1) % m.length, I.placeholder = m[ee] ?? "", X = setTimeout(D, v);
|
|
4713
4713
|
}
|
|
4714
|
-
function
|
|
4715
|
-
|
|
4714
|
+
function Z() {
|
|
4715
|
+
X !== null || m.length <= 1 || (X = setTimeout(D, v));
|
|
4716
4716
|
}
|
|
4717
|
-
function
|
|
4718
|
-
|
|
4717
|
+
function te() {
|
|
4718
|
+
X !== null && (clearTimeout(X), X = null);
|
|
4719
4719
|
}
|
|
4720
|
-
function
|
|
4721
|
-
k && (k = !1,
|
|
4722
|
-
const
|
|
4723
|
-
|
|
4720
|
+
function re() {
|
|
4721
|
+
k && (k = !1, ce(), O = !1, z(), u && ne(), q = "", I.style.display = "", _.style.display = "none", S.textContent = "", F.textContent = "");
|
|
4722
|
+
const R = I.value.trim();
|
|
4723
|
+
R && (e.onSend(R), K || (K = !0)), I.value = "", q = "", M();
|
|
4724
4724
|
}
|
|
4725
|
-
function
|
|
4726
|
-
const
|
|
4727
|
-
if (!
|
|
4725
|
+
function ie() {
|
|
4726
|
+
const R = window, V = R.SpeechRecognition ?? R.webkitSpeechRecognition;
|
|
4727
|
+
if (!V) {
|
|
4728
4728
|
console.warn("[FloatingLauncher] SpeechRecognition not supported.");
|
|
4729
4729
|
return;
|
|
4730
4730
|
}
|
|
4731
|
-
|
|
4731
|
+
U || (U = new V(), U.continuous = !0, U.interimResults = !0, U.lang = f), k = !0, O = !0, q = "", I.value = "", I.style.display = "none", _.style.display = "flex", S.textContent = "", F.textContent = "", M(), C(), u && Y(), U.onresult = (G) => {
|
|
4732
4732
|
if (!k) return;
|
|
4733
|
-
let
|
|
4734
|
-
for (let Pe =
|
|
4735
|
-
const Ae =
|
|
4733
|
+
let Q = "", de = "";
|
|
4734
|
+
for (let Pe = G.resultIndex; Pe < G.results.length; Pe++) {
|
|
4735
|
+
const Ae = G.results[Pe];
|
|
4736
4736
|
if (!Ae) continue;
|
|
4737
4737
|
const Fe = Ae[0]?.transcript ?? "";
|
|
4738
|
-
Ae.isFinal ?
|
|
4738
|
+
Ae.isFinal ? de += Fe : Q += Fe;
|
|
4739
4739
|
}
|
|
4740
|
-
q +=
|
|
4741
|
-
},
|
|
4740
|
+
q += de, S.textContent = q, F.textContent = Q, I.value = `${q} ${Q}`.trim(), M();
|
|
4741
|
+
}, U.onend = () => x(), U.onerror = () => x();
|
|
4742
4742
|
try {
|
|
4743
|
-
|
|
4743
|
+
U.start();
|
|
4744
4744
|
} catch {
|
|
4745
4745
|
x();
|
|
4746
4746
|
}
|
|
4747
4747
|
}
|
|
4748
|
-
function
|
|
4748
|
+
function ce() {
|
|
4749
4749
|
try {
|
|
4750
|
-
|
|
4750
|
+
U?.stop();
|
|
4751
4751
|
} catch {
|
|
4752
4752
|
}
|
|
4753
4753
|
}
|
|
4754
4754
|
function x() {
|
|
4755
|
-
|
|
4755
|
+
O && (O = !1, k = !1, z(), u && ne(), q.trim() && (I.value = q.trim()), I.style.display = "", _.style.display = "none", S.textContent = "", F.textContent = "", M());
|
|
4756
4756
|
}
|
|
4757
|
-
async function
|
|
4758
|
-
const
|
|
4757
|
+
async function C() {
|
|
4758
|
+
const R = ++j, V = Array.from(B.querySelectorAll("span"));
|
|
4759
4759
|
try {
|
|
4760
|
-
const
|
|
4761
|
-
if (!k ||
|
|
4762
|
-
|
|
4760
|
+
const G = await navigator.mediaDevices.getUserMedia({ audio: !0 });
|
|
4761
|
+
if (!k || R !== j) {
|
|
4762
|
+
G.getTracks().forEach((Ie) => Ie.stop());
|
|
4763
4763
|
return;
|
|
4764
4764
|
}
|
|
4765
|
-
|
|
4766
|
-
const
|
|
4767
|
-
if (!
|
|
4768
|
-
throw
|
|
4769
|
-
const Pe = new
|
|
4770
|
-
if (!k ||
|
|
4771
|
-
|
|
4765
|
+
$ = G;
|
|
4766
|
+
const Q = window, de = Q.AudioContext ?? Q.webkitAudioContext;
|
|
4767
|
+
if (!de)
|
|
4768
|
+
throw $ = null, G.getTracks().forEach((Ie) => Ie.stop()), new Error("AudioContext not supported");
|
|
4769
|
+
const Pe = new de();
|
|
4770
|
+
if (!k || R !== j) {
|
|
4771
|
+
G.getTracks().forEach((Ie) => Ie.stop()), Pe.close().catch(() => {
|
|
4772
4772
|
});
|
|
4773
4773
|
return;
|
|
4774
4774
|
}
|
|
4775
|
-
|
|
4776
|
-
const Ae = new Uint8Array(
|
|
4777
|
-
if (!k ||
|
|
4778
|
-
|
|
4779
|
-
const Ie = Math.max(1, Math.floor(Ae.length /
|
|
4780
|
-
|
|
4775
|
+
b = Pe, E = Pe.createAnalyser(), E.fftSize = 256, Pe.createMediaStreamSource(G).connect(E);
|
|
4776
|
+
const Ae = new Uint8Array(E.frequencyBinCount), Fe = () => {
|
|
4777
|
+
if (!k || R !== j || !E) return;
|
|
4778
|
+
E.getByteFrequencyData(Ae);
|
|
4779
|
+
const Ie = Math.max(1, Math.floor(Ae.length / V.length));
|
|
4780
|
+
V.forEach((ka, Ca) => {
|
|
4781
4781
|
ka.style.height = `${4 + Math.round((Ae[Ca * Ie] ?? 0) / 255 * 8)}px`;
|
|
4782
|
-
}),
|
|
4782
|
+
}), T = requestAnimationFrame(Fe);
|
|
4783
4783
|
};
|
|
4784
4784
|
Fe();
|
|
4785
4785
|
} catch {
|
|
4786
|
-
if (!k ||
|
|
4787
|
-
|
|
4788
|
-
}),
|
|
4786
|
+
if (!k || R !== j) return;
|
|
4787
|
+
T !== null && (cancelAnimationFrame(T), T = null), E && (E.disconnect(), E = null), b && (b.close().catch(() => {
|
|
4788
|
+
}), b = null), $ && ($.getTracks().forEach((G) => G.stop()), $ = null), B.classList.add("is-css-animated");
|
|
4789
4789
|
}
|
|
4790
4790
|
}
|
|
4791
|
-
function
|
|
4792
|
-
|
|
4793
|
-
}),
|
|
4794
|
-
|
|
4791
|
+
function z() {
|
|
4792
|
+
j += 1, B.classList.remove("is-css-animated"), T !== null && (cancelAnimationFrame(T), T = null), E && (E.disconnect(), E = null), b && (b.close().catch(() => {
|
|
4793
|
+
}), b = null), $ && ($.getTracks().forEach((R) => R.stop()), $ = null), Array.from(B.querySelectorAll("span")).forEach((R) => {
|
|
4794
|
+
R.style.height = "4px";
|
|
4795
4795
|
});
|
|
4796
4796
|
}
|
|
4797
|
-
function
|
|
4798
|
-
|
|
4797
|
+
function Y() {
|
|
4798
|
+
N.classList.add("is-active");
|
|
4799
4799
|
}
|
|
4800
|
+
function ne() {
|
|
4801
|
+
N.classList.remove("is-active");
|
|
4802
|
+
}
|
|
4803
|
+
W.addEventListener("click", re), J.addEventListener("click", (R) => {
|
|
4804
|
+
R.preventDefault(), R.stopPropagation(), k ? ce() : ie();
|
|
4805
|
+
}), P.addEventListener("click", () => {
|
|
4806
|
+
k && (k = !1, ce(), O = !1, z(), u && ne(), q = "", I.style.display = "", _.style.display = "none", S.textContent = "", F.textContent = "", M());
|
|
4807
|
+
}), L.addEventListener("click", (R) => {
|
|
4808
|
+
R.preventDefault(), R.stopPropagation(), e.onOpenChat();
|
|
4809
|
+
}), I.addEventListener("input", M), I.addEventListener("keydown", (R) => {
|
|
4810
|
+
R.key === "Enter" && re();
|
|
4811
|
+
}), M(), Z();
|
|
4800
4812
|
function oe() {
|
|
4801
|
-
B.classList.remove("is-active");
|
|
4802
|
-
}
|
|
4803
|
-
W.addEventListener("click", G), X.addEventListener("click", (F) => {
|
|
4804
|
-
F.preventDefault(), F.stopPropagation(), k ? ne() : Q();
|
|
4805
|
-
}), E.addEventListener("click", () => {
|
|
4806
|
-
k && (k = !1, ne(), D = !1, re(), u && oe(), q = "", I.style.display = "", _.style.display = "none", S.textContent = "", H.textContent = "", M());
|
|
4807
|
-
}), P.addEventListener("click", (F) => {
|
|
4808
|
-
F.preventDefault(), F.stopPropagation(), e.onOpenChat();
|
|
4809
|
-
}), I.addEventListener("input", M), I.addEventListener("keydown", (F) => {
|
|
4810
|
-
F.key === "Enter" && G();
|
|
4811
|
-
}), M(), T();
|
|
4812
|
-
function ue() {
|
|
4813
4813
|
K = !0, M();
|
|
4814
4814
|
}
|
|
4815
|
-
function
|
|
4816
|
-
|
|
4815
|
+
function le() {
|
|
4816
|
+
te(), z(), ne(), k && (k = !1, ce()), U && (U.onresult = null, U.onend = null, U.onerror = null, U = null);
|
|
4817
4817
|
}
|
|
4818
4818
|
return {
|
|
4819
|
-
container:
|
|
4820
|
-
showOpenChatButton:
|
|
4821
|
-
destroy:
|
|
4819
|
+
container: H,
|
|
4820
|
+
showOpenChatButton: oe,
|
|
4821
|
+
destroy: le
|
|
4822
4822
|
};
|
|
4823
4823
|
}
|
|
4824
|
-
var Ai = "gengage-inline-launcher-style", Ot = "gengage-inline-launcher-hide-floating",
|
|
4824
|
+
var Ai = "gengage-inline-launcher-style", Ot = "gengage-inline-launcher-hide-floating", ue = "gengage-inline-launcher", Ii = "gengage-inline-launcher", xa = "data-gengage-inline-sibling", at = "data-gengage-inline-sibling-restore-index", Mi = '<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>', se = {
|
|
4825
4825
|
rowGap: "14px",
|
|
4826
4826
|
buttonHeight: "46px",
|
|
4827
4827
|
buttonPadding: "0 14px 0 10px",
|
|
@@ -4841,7 +4841,8 @@ var Ai = "gengage-inline-launcher-style", Ot = "gengage-inline-launcher-hide-flo
|
|
|
4841
4841
|
sparkSize: "14px",
|
|
4842
4842
|
sparkIconSize: "12px",
|
|
4843
4843
|
hideTitle: !1,
|
|
4844
|
-
hideSpark: !0
|
|
4844
|
+
hideSpark: !0,
|
|
4845
|
+
hideLogo: !1
|
|
4845
4846
|
}
|
|
4846
4847
|
};
|
|
4847
4848
|
function Ni(t) {
|
|
@@ -4866,12 +4867,13 @@ function Ni(t) {
|
|
|
4866
4867
|
sparkSize: e?.sparkSize ?? se.mobile.sparkSize,
|
|
4867
4868
|
sparkIconSize: e?.sparkIconSize ?? se.mobile.sparkIconSize,
|
|
4868
4869
|
hideTitle: e?.hideTitle ?? se.mobile.hideTitle,
|
|
4869
|
-
hideSpark: e?.hideSpark ?? se.mobile.hideSpark
|
|
4870
|
+
hideSpark: e?.hideSpark ?? se.mobile.hideSpark,
|
|
4871
|
+
hideLogo: e?.hideLogo ?? se.mobile.hideLogo
|
|
4870
4872
|
}
|
|
4871
4873
|
};
|
|
4872
4874
|
}
|
|
4873
4875
|
function Bi(t) {
|
|
4874
|
-
const e = `.${t.rowClassName}`, a = `#${CSS.escape(t.buttonId)}`, n = `.${
|
|
4876
|
+
const e = `.${t.rowClassName}`, a = `#${CSS.escape(t.buttonId)}`, n = `.${ue}-icon`, r = `.${ue}-copy`, i = `.${ue}-title`, o = `.${ue}-spark`, s = `@media (max-width: ${t.compactBelowWidth - 0.02}px)`, { sizes: c } = t, l = c.mobile.hideTitle ? "display:none;" : "display:flex;flex:0 1 auto;min-width:0;", p = c.mobile.hideSpark ? "display:none;" : "display:inline-flex;", g = c.mobile.hideLogo ? "display:none !important;width:0 !important;height:0 !important;flex:0 0 0 !important;overflow:hidden !important;" : "display:inline-flex;";
|
|
4875
4877
|
return `
|
|
4876
4878
|
${e}{
|
|
4877
4879
|
display:flex;
|
|
@@ -4923,7 +4925,7 @@ ${a}:focus-visible{
|
|
|
4923
4925
|
outline:2px solid color-mix(in srgb, ${t.primaryColor} 34%, white);
|
|
4924
4926
|
outline-offset:2px;
|
|
4925
4927
|
}
|
|
4926
|
-
${a}.${
|
|
4928
|
+
${a}.${ue}--active{
|
|
4927
4929
|
border-color:${t.primaryColor};
|
|
4928
4930
|
background:linear-gradient(180deg,#fff7ef 0%,#ffe7d5 100%);
|
|
4929
4931
|
box-shadow:0 16px 28px color-mix(in srgb, ${t.primaryColor} 24%, transparent);
|
|
@@ -4983,6 +4985,9 @@ ${s}{
|
|
|
4983
4985
|
font-size:${c.mobile.fontSize};
|
|
4984
4986
|
line-height:1.05;
|
|
4985
4987
|
}
|
|
4988
|
+
${a} ${n}{
|
|
4989
|
+
${g}
|
|
4990
|
+
}
|
|
4986
4991
|
${a} ${o}{
|
|
4987
4992
|
${p}
|
|
4988
4993
|
width:${c.mobile.sparkSize};
|
|
@@ -5000,120 +5005,155 @@ function zi(t) {
|
|
|
5000
5005
|
return new Promise((e) => window.setTimeout(e, t));
|
|
5001
5006
|
}
|
|
5002
5007
|
function Ri(t, e, a) {
|
|
5003
|
-
const { hostSelector: n, rowClassName: r = "gengage-inline-launcher-row", siblingSelector: i, siblingPlacement: o = "before", rowPlacement: s = "end", title: c = "Ask", iconUrl: l, primaryColor: p = "#6366f1", textColor: g = "#222222", fontFamily: h = "inherit", borderRadius: m = "3px", showSparkIcon: v = !0, desktopMinWidth:
|
|
5004
|
-
let
|
|
5005
|
-
const
|
|
5008
|
+
const { hostSelector: n, rowClassName: r = "gengage-inline-launcher-row", siblingSelector: i, siblingPlacement: o = "before", rowPlacement: s = "end", title: c = "Ask", iconUrl: l, primaryColor: p = "#6366f1", textColor: g = "#222222", fontFamily: h = "inherit", borderRadius: m = "3px", showSparkIcon: v = !0, desktopMinWidth: f = 0, enableOnMobile: u = !1, disabledPageTypes: d = ["pdp"], hideFloatingLauncher: A = !0, mountPollFrames: y = 90, debounceMs: w = 90, buttonId: H = Ii } = t, I = t.ariaLabel ?? c, _ = t.siblingRestoreParentSelector ?? n, S = u && f > 0 ? f : 576, F = Ni(t.size), W = `${Ai}-${H}`;
|
|
5009
|
+
let J = !1, L = !1, P = null, B = null, N = null;
|
|
5010
|
+
const k = () => {
|
|
5011
|
+
if (u && f > 0 && window.innerWidth < f && t.mobileHost && t.mobileHost) {
|
|
5012
|
+
const C = t.mobileHost;
|
|
5013
|
+
return {
|
|
5014
|
+
hostSelector: C.hostSelector,
|
|
5015
|
+
siblingSelector: C.siblingSelector ?? i,
|
|
5016
|
+
siblingRestoreParentSelector: C.siblingRestoreParentSelector ?? C.hostSelector,
|
|
5017
|
+
rowPlacement: C.rowPlacement ?? s,
|
|
5018
|
+
siblingPlacement: C.siblingPlacement ?? o
|
|
5019
|
+
};
|
|
5020
|
+
}
|
|
5021
|
+
return {
|
|
5022
|
+
hostSelector: n,
|
|
5023
|
+
siblingSelector: i,
|
|
5024
|
+
siblingRestoreParentSelector: _,
|
|
5025
|
+
rowPlacement: s,
|
|
5026
|
+
siblingPlacement: o
|
|
5027
|
+
};
|
|
5028
|
+
}, O = (C) => [
|
|
5029
|
+
C.hostSelector,
|
|
5030
|
+
C.siblingSelector ?? "",
|
|
5031
|
+
C.siblingRestoreParentSelector
|
|
5032
|
+
].join("|"), q = () => {
|
|
5006
5033
|
if (document.getElementById(W)) return;
|
|
5007
|
-
const
|
|
5008
|
-
|
|
5034
|
+
const C = document.createElement("style");
|
|
5035
|
+
C.id = W, C.textContent = Bi({
|
|
5009
5036
|
primaryColor: p,
|
|
5010
5037
|
textColor: g,
|
|
5011
5038
|
fontFamily: h,
|
|
5012
5039
|
borderRadius: m,
|
|
5013
5040
|
rowClassName: r,
|
|
5014
5041
|
compactBelowWidth: S,
|
|
5015
|
-
buttonId:
|
|
5016
|
-
sizes:
|
|
5017
|
-
}), document.head.appendChild(
|
|
5018
|
-
},
|
|
5042
|
+
buttonId: H,
|
|
5043
|
+
sizes: F
|
|
5044
|
+
}), document.head.appendChild(C);
|
|
5045
|
+
}, K = (C) => {
|
|
5019
5046
|
if (!A || !a.shadowRoot) return;
|
|
5020
|
-
const
|
|
5021
|
-
if (!
|
|
5022
|
-
|
|
5047
|
+
const z = a.shadowRoot.getElementById(Ot);
|
|
5048
|
+
if (!C) {
|
|
5049
|
+
z?.remove();
|
|
5023
5050
|
return;
|
|
5024
5051
|
}
|
|
5025
|
-
if (
|
|
5026
|
-
const
|
|
5027
|
-
|
|
5028
|
-
},
|
|
5029
|
-
const
|
|
5030
|
-
return
|
|
5031
|
-
},
|
|
5032
|
-
if (!
|
|
5033
|
-
const
|
|
5034
|
-
return
|
|
5035
|
-
},
|
|
5036
|
-
const
|
|
5037
|
-
return
|
|
5038
|
-
},
|
|
5039
|
-
if (
|
|
5040
|
-
const
|
|
5041
|
-
if (!
|
|
5042
|
-
const
|
|
5043
|
-
|
|
5044
|
-
},
|
|
5045
|
-
const
|
|
5046
|
-
if (!
|
|
5047
|
-
const
|
|
5048
|
-
if (
|
|
5049
|
-
|
|
5052
|
+
if (z) return;
|
|
5053
|
+
const Y = document.createElement("style");
|
|
5054
|
+
Y.id = Ot, Y.textContent = ".gengage-chat-launcher-container,.gengage-fl{display:none!important;}", a.shadowRoot.appendChild(Y);
|
|
5055
|
+
}, U = (C) => {
|
|
5056
|
+
const z = document.querySelector(C);
|
|
5057
|
+
return z instanceof HTMLElement ? z : null;
|
|
5058
|
+
}, ee = (C) => {
|
|
5059
|
+
if (!C) return null;
|
|
5060
|
+
const z = document.querySelector(C);
|
|
5061
|
+
return z instanceof HTMLElement ? z : null;
|
|
5062
|
+
}, X = (C) => {
|
|
5063
|
+
const z = document.querySelector(C);
|
|
5064
|
+
return z instanceof HTMLElement ? z : null;
|
|
5065
|
+
}, $ = (C) => {
|
|
5066
|
+
if (C.hasAttribute(at)) return;
|
|
5067
|
+
const z = C.parentElement;
|
|
5068
|
+
if (!z) return;
|
|
5069
|
+
const Y = Array.from(z.children).indexOf(C);
|
|
5070
|
+
Y >= 0 && C.setAttribute(at, String(Y));
|
|
5071
|
+
}, b = (C) => {
|
|
5072
|
+
const z = ee(C.siblingSelector), Y = X(C.siblingRestoreParentSelector);
|
|
5073
|
+
if (!z || !Y || ($(z), z.parentElement === Y)) return;
|
|
5074
|
+
const ne = z.getAttribute(at), oe = ne ? Number.parseInt(ne, 10) : 0, le = Array.from(Y.children).filter((V) => !(V instanceof HTMLElement && V.classList.contains(r))), R = Number.isFinite(oe) && oe >= 0 ? le[oe] ?? null : null;
|
|
5075
|
+
if (R) {
|
|
5076
|
+
Y.insertBefore(z, R);
|
|
5050
5077
|
return;
|
|
5051
5078
|
}
|
|
5052
|
-
|
|
5053
|
-
},
|
|
5054
|
-
|
|
5055
|
-
},
|
|
5056
|
-
const
|
|
5057
|
-
|
|
5058
|
-
|
|
5059
|
-
|
|
5060
|
-
|
|
5061
|
-
|
|
5062
|
-
}
|
|
5063
|
-
|
|
5064
|
-
|
|
5065
|
-
|
|
5066
|
-
|
|
5067
|
-
|
|
5068
|
-
|
|
5069
|
-
|
|
5070
|
-
|
|
5071
|
-
|
|
5072
|
-
|
|
5073
|
-
|
|
5079
|
+
Y.appendChild(z);
|
|
5080
|
+
}, E = (C) => {
|
|
5081
|
+
C.querySelector(`.${r}`)?.remove();
|
|
5082
|
+
}, T = () => {
|
|
5083
|
+
const C = document.createElement("span");
|
|
5084
|
+
C.className = `${ue}-icon`;
|
|
5085
|
+
const z = document.createElement("img");
|
|
5086
|
+
return z.src = l, z.alt = "", z.draggable = !1, C.appendChild(z), C;
|
|
5087
|
+
}, j = () => window.innerWidth < S, M = (C) => {
|
|
5088
|
+
if (!l) return;
|
|
5089
|
+
const z = C.querySelector(`.${ue}-icon`);
|
|
5090
|
+
if (j() && F.mobile.hideLogo) {
|
|
5091
|
+
z?.remove();
|
|
5092
|
+
return;
|
|
5093
|
+
}
|
|
5094
|
+
z || C.insertBefore(T(), C.firstChild);
|
|
5095
|
+
}, D = () => {
|
|
5096
|
+
const C = document.createElement("button");
|
|
5097
|
+
C.type = "button", C.id = H, C.className = ue, C.setAttribute("aria-label", I), l && C.appendChild(T());
|
|
5098
|
+
const z = document.createElement("span");
|
|
5099
|
+
z.className = `${ue}-copy`;
|
|
5100
|
+
const Y = document.createElement("span");
|
|
5101
|
+
if (Y.className = `${ue}-title`, Y.textContent = c, z.appendChild(Y), C.appendChild(z), v) {
|
|
5102
|
+
const ne = document.createElement("span");
|
|
5103
|
+
ne.className = `${ue}-spark`, ne.innerHTML = Mi, C.appendChild(ne);
|
|
5104
|
+
}
|
|
5105
|
+
return C.addEventListener("click", () => e.onClick()), C;
|
|
5106
|
+
}, Z = (C, z, Y) => {
|
|
5107
|
+
if ($(z), z.setAttribute(xa, "true"), o === "before") {
|
|
5108
|
+
(z.parentElement !== C || z.nextElementSibling !== Y) && C.insertBefore(z, Y);
|
|
5074
5109
|
return;
|
|
5075
5110
|
}
|
|
5076
|
-
(
|
|
5077
|
-
},
|
|
5078
|
-
|
|
5079
|
-
|
|
5080
|
-
|
|
5081
|
-
|
|
5082
|
-
|
|
5083
|
-
|
|
5084
|
-
|
|
5085
|
-
|
|
5086
|
-
|
|
5087
|
-
|
|
5088
|
-
|
|
5089
|
-
|
|
5090
|
-
|
|
5091
|
-
|
|
5092
|
-
|
|
5093
|
-
|
|
5094
|
-
|
|
5095
|
-
|
|
5111
|
+
(z.parentElement !== C || Y.nextElementSibling !== z) && C.appendChild(z);
|
|
5112
|
+
}, te = () => {
|
|
5113
|
+
if (N) {
|
|
5114
|
+
b(N);
|
|
5115
|
+
const C = U(N.hostSelector);
|
|
5116
|
+
C && E(C), N = null;
|
|
5117
|
+
}
|
|
5118
|
+
K(!1), J = !1;
|
|
5119
|
+
}, re = (C) => !(C && d.includes(C) || f > 0 && window.innerWidth < f && !u), ie = async (C) => {
|
|
5120
|
+
const z = C ?? a.getPageType();
|
|
5121
|
+
if (!re(z))
|
|
5122
|
+
return te(), !1;
|
|
5123
|
+
q();
|
|
5124
|
+
const Y = k();
|
|
5125
|
+
N && O(N) !== O(Y) && te();
|
|
5126
|
+
for (let ne = 0; ne < y; ne += 1) {
|
|
5127
|
+
if (!re(z))
|
|
5128
|
+
return te(), !1;
|
|
5129
|
+
const oe = k(), le = U(oe.hostSelector), R = ee(oe.siblingSelector);
|
|
5130
|
+
if (le && (!oe.siblingSelector || R)) {
|
|
5131
|
+
N && O(N) !== O(oe) && te(), R && $(R);
|
|
5132
|
+
let V = le.querySelector(`.${r}`);
|
|
5133
|
+
V instanceof HTMLElement || (V = document.createElement("div"), V.className = r, oe.rowPlacement === "start" ? le.insertBefore(V, le.firstChild) : le.appendChild(V));
|
|
5134
|
+
let G = V.querySelector(`#${CSS.escape(H)}`);
|
|
5135
|
+
return G instanceof HTMLButtonElement ? B = G : (G = D(), B = G, V.appendChild(G)), R && Z(V, R, G), M(G), L ? G.classList.add(`${ue}--active`) : G.classList.remove(`${ue}--active`), K(!0), J = !0, N = oe, !0;
|
|
5096
5136
|
}
|
|
5097
5137
|
await zi(16);
|
|
5098
5138
|
}
|
|
5099
|
-
return
|
|
5100
|
-
},
|
|
5101
|
-
|
|
5102
|
-
|
|
5139
|
+
return te(), !1;
|
|
5140
|
+
}, ce = () => {
|
|
5141
|
+
P !== null && window.clearTimeout(P), P = window.setTimeout(() => {
|
|
5142
|
+
P = null, ie();
|
|
5103
5143
|
}, w);
|
|
5104
|
-
},
|
|
5105
|
-
return window.addEventListener("resize",
|
|
5144
|
+
}, x = () => ce();
|
|
5145
|
+
return window.addEventListener("resize", x, { passive: !0 }), window.addEventListener("orientationchange", x), {
|
|
5106
5146
|
get isMounted() {
|
|
5107
|
-
return
|
|
5147
|
+
return J;
|
|
5108
5148
|
},
|
|
5109
|
-
sync(
|
|
5110
|
-
return
|
|
5149
|
+
sync(C) {
|
|
5150
|
+
return ie(C);
|
|
5111
5151
|
},
|
|
5112
|
-
setActive(
|
|
5113
|
-
|
|
5152
|
+
setActive(C) {
|
|
5153
|
+
L = C, B?.classList.toggle(`${ue}--active`, C);
|
|
5114
5154
|
},
|
|
5115
5155
|
destroy() {
|
|
5116
|
-
|
|
5156
|
+
P !== null && (window.clearTimeout(P), P = null), window.removeEventListener("resize", x), window.removeEventListener("orientationchange", x), te(), document.getElementById(W)?.remove(), B = null;
|
|
5117
5157
|
}
|
|
5118
5158
|
};
|
|
5119
5159
|
}
|
|
@@ -5237,13 +5277,13 @@ function qi(t) {
|
|
|
5237
5277
|
c = s.nextNode();
|
|
5238
5278
|
continue;
|
|
5239
5279
|
}
|
|
5240
|
-
const v = p.slice(0, g),
|
|
5280
|
+
const v = p.slice(0, g), f = p.slice(g, g + o.short_name.length), u = p.slice(g + o.short_name.length), d = c.parentNode;
|
|
5241
5281
|
if (!d) {
|
|
5242
5282
|
c = s.nextNode();
|
|
5243
5283
|
continue;
|
|
5244
5284
|
}
|
|
5245
5285
|
const A = document.createElement("a");
|
|
5246
|
-
A.className = "gengage-product-mention", A.textContent =
|
|
5286
|
+
A.className = "gengage-product-mention", A.textContent = f, A.href = "#", A.addEventListener("click", (y) => {
|
|
5247
5287
|
y.preventDefault(), n(o.sku);
|
|
5248
5288
|
}), v && d.insertBefore(document.createTextNode(v), c), d.insertBefore(A, c), u && d.insertBefore(document.createTextNode(u), c), d.removeChild(c), l = !0;
|
|
5249
5289
|
}
|
|
@@ -5526,7 +5566,7 @@ var eo = class {
|
|
|
5526
5566
|
const a = this._snapshotRebuilders.get(t), n = this.snapshots.get(t);
|
|
5527
5567
|
if (!a && !n) return !1;
|
|
5528
5568
|
const r = this.deps.shadow(), i = this.deps.drawer();
|
|
5529
|
-
this.activePanelMessageId && r?.querySelector(`[data-message-id="${
|
|
5569
|
+
this.activePanelMessageId && r?.querySelector(`[data-message-id="${pe(this.activePanelMessageId)}"]`)?.classList.remove("gengage-chat-bubble--active"), r?.querySelector(`[data-message-id="${pe(e)}"]`)?.classList.add("gengage-chat-bubble--active"), this.activePanelMessageId = e;
|
|
5530
5570
|
const o = a ? a() : n.cloneNode(!0);
|
|
5531
5571
|
i?.setPanelContent(o);
|
|
5532
5572
|
const s = this.snapshotTypes.get(t);
|
|
@@ -5885,7 +5925,7 @@ var bo = class {
|
|
|
5885
5925
|
await e();
|
|
5886
5926
|
} catch {
|
|
5887
5927
|
}
|
|
5888
|
-
a?.send("openURLInNewTab", { url: t }),
|
|
5928
|
+
a?.send("openURLInNewTab", { url: t }), ve(t) && n(t);
|
|
5889
5929
|
}
|
|
5890
5930
|
async loadPayload(t, e) {
|
|
5891
5931
|
if (!this._db) return null;
|
|
@@ -6095,7 +6135,7 @@ function Bo(t) {
|
|
|
6095
6135
|
function zo(t) {
|
|
6096
6136
|
if (!t.trim()) return !1;
|
|
6097
6137
|
const e = document.createElement("template");
|
|
6098
|
-
return e.innerHTML =
|
|
6138
|
+
return e.innerHTML = fe(t), (e.content.textContent ?? "").trim().length > 0;
|
|
6099
6139
|
}
|
|
6100
6140
|
function Yt(t) {
|
|
6101
6141
|
return t.length > 120 ? !1 : /^[a-zA-Z0-9#(),.\s%/\-]+$/.test(t);
|
|
@@ -6280,7 +6320,7 @@ var Ro = class Me extends Ka {
|
|
|
6280
6320
|
if (!this._drawerVisible || !this._isMobileViewport) return;
|
|
6281
6321
|
const A = this._drawer?.getElement();
|
|
6282
6322
|
if (!A) return;
|
|
6283
|
-
const y = window.visualViewport, w = Math.max(0, Math.round(window.innerHeight - (y.height + y.offsetTop))),
|
|
6323
|
+
const y = window.visualViewport, w = Math.max(0, Math.round(window.innerHeight - (y.height + y.offsetTop))), H = w > 90, I = this._openState === "full" && H ? w : 0;
|
|
6284
6324
|
I !== this._lastAppliedKeyboardInset && (this._lastAppliedKeyboardInset = I, A.style.setProperty("--gengage-chat-keyboard-inset", `${I}px`)), this._openState === "full" && (A.style.setProperty("--gengage-chat-visual-vh", `${Math.round(y.height)}px`), A.style.setProperty("--gengage-chat-visual-top", `${Math.round(y.offsetTop)}px`));
|
|
6285
6325
|
};
|
|
6286
6326
|
this._syncVisualVh = () => {
|
|
@@ -6294,11 +6334,11 @@ var Ro = class Me extends Ka {
|
|
|
6294
6334
|
});
|
|
6295
6335
|
}
|
|
6296
6336
|
o === "inline" && (this._drawerVisible = !0, this.isVisible = !0, this._applyOpenStateClasses(), this._presentation.setShown(!0), setTimeout(() => this._maybeAutoAnchorUnreadAssistant(), 60));
|
|
6297
|
-
const
|
|
6337
|
+
const f = {
|
|
6298
6338
|
namespace: "chat",
|
|
6299
6339
|
onMessage: (u) => this._handleBridgeMessage(u)
|
|
6300
6340
|
};
|
|
6301
|
-
e.allowedOrigins !== void 0 && (
|
|
6341
|
+
e.allowedOrigins !== void 0 && (f.allowedOrigins = e.allowedOrigins), this._bridge = new an(f), this._lastSku = this.config.pageContext?.sku, this._lastPageType = this.config.pageContext?.pageType, this._lastSkuListKey = this.config.pageContext?.skuList?.slice(0, 48).join(","), this._initComplete = !0;
|
|
6302
6342
|
for (const u of this._pendingActions) this._sendAction(u.action, u.options);
|
|
6303
6343
|
this._pendingActions = [], this._pillLauncherApply && o === "floating" && (await this._pillLauncherApply(), this._pillLauncherApply = null), we("gengage:chat:ready", {}), Ga("chat"), e.onReady?.();
|
|
6304
6344
|
}
|
|
@@ -6365,21 +6405,21 @@ var Ro = class Me extends Ka {
|
|
|
6365
6405
|
const l = () => {
|
|
6366
6406
|
const I = window.innerWidth <= r ? a.mobile : a.desktop;
|
|
6367
6407
|
if (!I) return;
|
|
6368
|
-
const _ = I.selector, S = !!_,
|
|
6408
|
+
const _ = I.selector, S = !!_, F = (S ? document.querySelector(_) : null)?.getBoundingClientRect();
|
|
6369
6409
|
if (I.bottom !== void 0) {
|
|
6370
|
-
const { offset: W, type:
|
|
6410
|
+
const { offset: W, type: J } = I.bottom;
|
|
6371
6411
|
if (!S) n.style.setProperty(s, `${Math.max(0, W)}px`);
|
|
6372
|
-
else if (
|
|
6373
|
-
const
|
|
6374
|
-
n.style.setProperty(s, `${
|
|
6412
|
+
else if (F) {
|
|
6413
|
+
const L = J === "root" || W === 0 ? F.bottom : F.top, P = Math.max(0, window.innerHeight - L + W);
|
|
6414
|
+
n.style.setProperty(s, `${P}px`);
|
|
6375
6415
|
}
|
|
6376
6416
|
}
|
|
6377
6417
|
if (I.right !== void 0) {
|
|
6378
|
-
const { offset: W, type:
|
|
6418
|
+
const { offset: W, type: J } = I.right;
|
|
6379
6419
|
if (!S) n.style.setProperty(c, `${Math.max(0, W)}px`);
|
|
6380
|
-
else if (
|
|
6381
|
-
const
|
|
6382
|
-
n.style.setProperty(c, `${
|
|
6420
|
+
else if (F) {
|
|
6421
|
+
const L = J === "root" || W === 0 ? F.right : F.left, P = Math.max(0, window.innerWidth - L + W);
|
|
6422
|
+
n.style.setProperty(c, `${P}px`);
|
|
6383
6423
|
}
|
|
6384
6424
|
}
|
|
6385
6425
|
}, p = () => {
|
|
@@ -6393,7 +6433,7 @@ var Ro = class Me extends Ka {
|
|
|
6393
6433
|
}, v = new ResizeObserver(() => {
|
|
6394
6434
|
(!o() || g) && l();
|
|
6395
6435
|
});
|
|
6396
|
-
let
|
|
6436
|
+
let f = null, u = null;
|
|
6397
6437
|
const d = () => {
|
|
6398
6438
|
const I = i()?.selector;
|
|
6399
6439
|
return !I || !!document.querySelector(I);
|
|
@@ -6405,7 +6445,7 @@ var Ro = class Me extends Ka {
|
|
|
6405
6445
|
subtree: !0
|
|
6406
6446
|
}));
|
|
6407
6447
|
}, y = () => {
|
|
6408
|
-
v.disconnect(),
|
|
6448
|
+
v.disconnect(), f?.disconnect(), f = null, g = !1;
|
|
6409
6449
|
const I = i();
|
|
6410
6450
|
if (!I) return;
|
|
6411
6451
|
if (!I.selector) {
|
|
@@ -6413,25 +6453,25 @@ var Ro = class Me extends Ka {
|
|
|
6413
6453
|
return;
|
|
6414
6454
|
}
|
|
6415
6455
|
const _ = document.querySelector(I.selector);
|
|
6416
|
-
_ && (v.observe(_), o() ? (
|
|
6417
|
-
for (const
|
|
6418
|
-
}, { threshold: 0 }),
|
|
6456
|
+
_ && (v.observe(_), o() ? (f = new IntersectionObserver((S) => {
|
|
6457
|
+
for (const F of S) F.isIntersecting ? (g = !0, l()) : (g = !1, p(), A());
|
|
6458
|
+
}, { threshold: 0 }), f.observe(_)) : l());
|
|
6419
6459
|
};
|
|
6420
6460
|
y();
|
|
6421
6461
|
let w = 0;
|
|
6422
|
-
const
|
|
6462
|
+
const H = () => {
|
|
6423
6463
|
w || (w = requestAnimationFrame(() => {
|
|
6424
6464
|
w = 0, g = !1, p(), u?.disconnect(), u = null, y(), A(), o() || l();
|
|
6425
6465
|
}));
|
|
6426
6466
|
};
|
|
6427
|
-
window.addEventListener("resize",
|
|
6467
|
+
window.addEventListener("resize", H, { passive: !0 }), window.addEventListener("scroll", m, { passive: !0 }), window.visualViewport?.addEventListener("scroll", m, { passive: !0 }), this._syncLauncherAnchor = () => {
|
|
6428
6468
|
g = !1, p(), u?.disconnect(), u = null, y(), A();
|
|
6429
6469
|
}, o() ? A() : (l(), [
|
|
6430
6470
|
100,
|
|
6431
6471
|
400,
|
|
6432
6472
|
1e3
|
|
6433
6473
|
].forEach((I) => window.setTimeout(l, I))), this._launcherAnchorCleanup = () => {
|
|
6434
|
-
v.disconnect(),
|
|
6474
|
+
v.disconnect(), f?.disconnect(), u?.disconnect(), window.removeEventListener("resize", H), window.removeEventListener("scroll", m), window.visualViewport?.removeEventListener("scroll", m), w && cancelAnimationFrame(w), h && cancelAnimationFrame(h);
|
|
6435
6475
|
};
|
|
6436
6476
|
}
|
|
6437
6477
|
syncLauncherAnchor() {
|
|
@@ -6500,7 +6540,7 @@ var Ro = class Me extends Ka {
|
|
|
6500
6540
|
if (a.role === "assistant" && !a.frontendOnly && (a.status === "streaming" || a.status === "done") && (a.content == null || a.content.length === 0)) {
|
|
6501
6541
|
if (a.threadId) {
|
|
6502
6542
|
const n = this._messages.some((r) => r.id !== a.id && r.threadId === a.threadId && r.frontendOnly) || this._panel?.snapshotTypes.has(a.id) === !0;
|
|
6503
|
-
this._threadsWithFirstBot.delete(a.threadId), this._presentation.finalizeAssistantGroup(a.threadId), this._shadow?.querySelectorAll(`[data-thread-id="${
|
|
6543
|
+
this._threadsWithFirstBot.delete(a.threadId), this._presentation.finalizeAssistantGroup(a.threadId), this._shadow?.querySelectorAll(`[data-thread-id="${pe(a.threadId)}"]:not([data-message-id])`).forEach((r) => r.remove()), this._panel && !n && (this._panel.threads = this._panel.threads.filter((r) => r !== a.threadId));
|
|
6504
6544
|
}
|
|
6505
6545
|
this._drawer?.removeMessageBubble(a.id), this._panel?.snapshots.delete(a.id), this._panel?.snapshotTypes.delete(a.id);
|
|
6506
6546
|
continue;
|
|
@@ -6931,18 +6971,18 @@ var Ro = class Me extends Ka {
|
|
|
6931
6971
|
return;
|
|
6932
6972
|
}
|
|
6933
6973
|
if (this._clearChoicePrompter(), a?.preservePanel || jt(), !a?.preservePanel && this._comparisonSelectMode && e.type !== "getComparisonTable" && (this._comparisonSelectMode = !1, this._comparisonSelectedSkus = []), a?.preservePanel || (this._localPanelHistory = []), this._currentThreadId && this._lastThreadId && this._lastThreadId > this._currentThreadId) {
|
|
6934
|
-
const
|
|
6935
|
-
this._messages = this._messages.filter((
|
|
6936
|
-
for (const
|
|
6937
|
-
this._shadow?.querySelector(`[data-message-id="${
|
|
6938
|
-
this._panel?.pruneThreadsAfter(
|
|
6939
|
-
|
|
6974
|
+
const b = this._currentThreadId, E = this._messages.filter((T) => T.threadId !== void 0 && T.threadId > b);
|
|
6975
|
+
this._messages = this._messages.filter((T) => !T.threadId || T.threadId <= b);
|
|
6976
|
+
for (const T of E)
|
|
6977
|
+
this._shadow?.querySelector(`[data-message-id="${pe(T.id)}"]`)?.remove(), this._panel?.deleteSnapshotForMessage(T.id);
|
|
6978
|
+
this._panel?.pruneThreadsAfter(b), this._shadow?.querySelectorAll("[data-thread-id]")?.forEach((T) => {
|
|
6979
|
+
T instanceof HTMLElement && T.dataset.threadId && T.dataset.threadId > b && T.remove();
|
|
6940
6980
|
});
|
|
6941
6981
|
}
|
|
6942
6982
|
a?.preservePills || this._drawer?.setPills([]), this._drawer?.clearInputAreaChips();
|
|
6943
6983
|
let n = !1;
|
|
6944
|
-
const r = (
|
|
6945
|
-
n !==
|
|
6984
|
+
const r = (b) => {
|
|
6985
|
+
n !== b && (n = b, this._bridge?.send("isResponding", b));
|
|
6946
6986
|
};
|
|
6947
6987
|
r(!0);
|
|
6948
6988
|
const i = wt();
|
|
@@ -6950,22 +6990,22 @@ var Ro = class Me extends Ka {
|
|
|
6950
6990
|
const o = a?.preservePanel === !0, s = a?.silent === !0 && a?.isContextPrime === !0, c = s && e.type === "launchSingleProduct";
|
|
6951
6991
|
let l;
|
|
6952
6992
|
if (o || (this._activeRequestThreadId = i), !a?.silent && !o && this._drawer?.setPresentationFocus(i), !a?.silent) {
|
|
6953
|
-
const
|
|
6954
|
-
if (!(
|
|
6955
|
-
(!this._messages.some((
|
|
6956
|
-
const
|
|
6957
|
-
|
|
6993
|
+
const b = typeof e.payload == "string" ? e.payload : typeof e.payload?.text == "string" ? e.payload.text : e.title, E = this._messages.length > 0 ? this._messages[this._messages.length - 1] : void 0;
|
|
6994
|
+
if (!(E !== void 0 && E.role === "user" && E.content === b)) {
|
|
6995
|
+
(!this._messages.some((j) => j.role === "user") || this._drawer?.isKvkkBannerVisible()) && (ot(this.config.accountId), this._drawer?.hideKvkkBanner());
|
|
6996
|
+
const T = this._createMessage("user", b);
|
|
6997
|
+
T.threadId = i, a?.attachment !== void 0 && (T.attachment = a.attachment), this._drawer?.addMessage(T), a?.attachment !== void 0 && this._modeController.isBeautyConsulting && this._drawer?.setBeautyPhotoStepCard({ visible: !1 }), this._messages.push(T), this._persistHistoryToLocalStorage();
|
|
6958
6998
|
}
|
|
6959
6999
|
}
|
|
6960
7000
|
const p = !a?.silent && this._assistantMode === "shopping" && this._hasUnavailableProductContext() && (e.type === "user_message" || e.type === "inputText");
|
|
6961
7001
|
let g = this._currentPanelSource, h = !1;
|
|
6962
7002
|
const m = e.type === "user_message" || e.type === "inputText", v = () => {
|
|
6963
7003
|
h || a?.preservePanel || (g = this._currentPanelSource, h = !0);
|
|
6964
|
-
},
|
|
7004
|
+
}, f = () => {
|
|
6965
7005
|
if (this._drawer?.isPanelLoading()) {
|
|
6966
7006
|
if (!m && g) {
|
|
6967
|
-
const
|
|
6968
|
-
this._drawer.setPanelContent(
|
|
7007
|
+
const b = this._buildRenderContext(), E = this._renderPanelFromSource(g, b);
|
|
7008
|
+
this._drawer.setPanelContent(E), this._currentPanelSource = g;
|
|
6969
7009
|
} else
|
|
6970
7010
|
this._drawer.clearPanel(), this._currentPanelSource = null;
|
|
6971
7011
|
g = null;
|
|
@@ -6981,9 +7021,9 @@ var Ro = class Me extends Ka {
|
|
|
6981
7021
|
...this.config.injectorAdapter ? { injectorAdapter: this.config.injectorAdapter } : {}
|
|
6982
7022
|
};
|
|
6983
7023
|
a?.attachment !== void 0 && (A.attachment = a.attachment);
|
|
6984
|
-
const y = this._getVisibleMessages().filter((
|
|
6985
|
-
role:
|
|
6986
|
-
content:
|
|
7024
|
+
const y = this._getVisibleMessages().filter((b) => !b.frontendOnly && b !== d && (b.content || b.role === "assistant")).slice(-50).map((b) => ({
|
|
7025
|
+
role: b.role === "user" ? "user" : "model",
|
|
7026
|
+
content: b.content ?? ""
|
|
6987
7027
|
})), w = {
|
|
6988
7028
|
outputLanguage: Ao(this.config.locale),
|
|
6989
7029
|
parentUrl: window.location.href,
|
|
@@ -7002,7 +7042,7 @@ var Ro = class Me extends Ka {
|
|
|
7002
7042
|
isMobile: this._isMobileViewport
|
|
7003
7043
|
};
|
|
7004
7044
|
this.config.isDemoWebsite === !0 && (w.openPdpSimilars = !0), this._modeController.isShopping || (w.assistantMode = this._modeController.mode), this.config.session?.viewId !== void 0 && (w.viewId = this.config.session.viewId);
|
|
7005
|
-
const
|
|
7045
|
+
const H = cn(e, {
|
|
7006
7046
|
pageContext: this.config.pageContext,
|
|
7007
7047
|
backendContext: this._lastBackendContext,
|
|
7008
7048
|
isMobile: this._isMobileViewport
|
|
@@ -7010,7 +7050,7 @@ var Ro = class Me extends Ka {
|
|
|
7010
7050
|
account_id: this.config.accountId,
|
|
7011
7051
|
session_id: this.config.session?.sessionId ?? "",
|
|
7012
7052
|
correlation_id: this.config.session?.sessionId ?? "",
|
|
7013
|
-
type:
|
|
7053
|
+
type: H.type,
|
|
7014
7054
|
locale: Ue(this.config.locale),
|
|
7015
7055
|
meta: w,
|
|
7016
7056
|
context: {
|
|
@@ -7019,100 +7059,100 @@ var Ro = class Me extends Ka {
|
|
|
7019
7059
|
session_id: this.config.session?.sessionId ?? ""
|
|
7020
7060
|
}
|
|
7021
7061
|
};
|
|
7022
|
-
this.config.session?.userId !== void 0 && (I.user_id = this.config.session.userId), this.config.session?.viewId !== void 0 && (I.view_id = this.config.session.viewId),
|
|
7023
|
-
let _ = !1, S = !1,
|
|
7024
|
-
const
|
|
7025
|
-
let
|
|
7062
|
+
this.config.session?.userId !== void 0 && (I.user_id = this.config.session.userId), this.config.session?.viewId !== void 0 && (I.view_id = this.config.session.viewId), H.payload !== void 0 && (I.payload = H.payload), !p && this.config.pageContext?.sku !== void 0 && (I.sku = this.config.pageContext.sku), !p && this.config.pageContext?.pageType !== void 0 && (I.page_type = this.config.pageContext.pageType);
|
|
7063
|
+
let _ = !1, S = !1, F = !1, W = !1, J = !1, L = !1;
|
|
7064
|
+
const P = Un();
|
|
7065
|
+
let B = null, N = null;
|
|
7026
7066
|
const k = () => {
|
|
7027
7067
|
if (this._drawer && !W) {
|
|
7028
|
-
if (!
|
|
7068
|
+
if (!F) {
|
|
7029
7069
|
this._drawer.setPanelAiZoneState("hidden");
|
|
7030
7070
|
return;
|
|
7031
7071
|
}
|
|
7032
|
-
|
|
7072
|
+
J ? this._drawer.setPanelAiZoneState("hidden") : this._drawer.setPanelAiZoneState("analyzing", { analyzingLabel: this._i18n.aiAnalysisAnalyzingLabel });
|
|
7033
7073
|
}
|
|
7034
|
-
},
|
|
7035
|
-
if (!
|
|
7036
|
-
const
|
|
7037
|
-
|
|
7038
|
-
const
|
|
7039
|
-
W = !0, this._drawer.setPanelAiZoneState("results", { resultEl:
|
|
7040
|
-
}, q = (
|
|
7041
|
-
if (
|
|
7042
|
-
|
|
7074
|
+
}, O = (b) => {
|
|
7075
|
+
if (!B || !this._drawer) return;
|
|
7076
|
+
const E = this._buildRenderContext();
|
|
7077
|
+
E.isStreaming = b;
|
|
7078
|
+
const T = this._renderUISpec(B, E);
|
|
7079
|
+
W = !0, this._drawer.setPanelAiZoneState("results", { resultEl: T }), B = null;
|
|
7080
|
+
}, q = (b, E, T) => {
|
|
7081
|
+
if (b === "ProductGrid" || b === "CategoriesContainer") {
|
|
7082
|
+
F = !0, O(T), k();
|
|
7043
7083
|
return;
|
|
7044
7084
|
}
|
|
7045
|
-
|
|
7046
|
-
}, K = (
|
|
7047
|
-
|
|
7048
|
-
},
|
|
7085
|
+
E !== "appendSimilars" && E !== "append" && (F = !1, W = !1, B = null, this._drawer?.setPanelAiZoneState("hidden"));
|
|
7086
|
+
}, K = (b) => (b === "ProductGrid" || b === "CategoriesContainer") && (F || W || B !== null), U = () => {
|
|
7087
|
+
L || (L = !0, this._drawer?.removeTypingIndicator(), r(!1), this._bridge?.send("loadingMessage", { text: null }));
|
|
7088
|
+
}, ee = (b, E, T) => {
|
|
7049
7089
|
if (!this._drawer || !this._panel) return;
|
|
7050
|
-
const
|
|
7051
|
-
if (
|
|
7052
|
-
const M = mt(
|
|
7090
|
+
const j = b.elements[b.root];
|
|
7091
|
+
if (T === "ProductGrid" && j) {
|
|
7092
|
+
const M = mt(j);
|
|
7053
7093
|
if (M.isConsulting) {
|
|
7054
|
-
const
|
|
7055
|
-
if (
|
|
7094
|
+
const D = this._drawer.getPanelContentElement();
|
|
7095
|
+
if (D && Ci(D, M, E)) {
|
|
7056
7096
|
this._comparisonSelectMode = !1, this._comparisonSelectedSkus = [], this._comparisonSelectionWarning = null, this._drawer.setComparisonDockContent(null), this._currentPanelSource = {
|
|
7057
7097
|
kind: "spec",
|
|
7058
|
-
spec:
|
|
7059
|
-
}, this._panel.currentType =
|
|
7098
|
+
spec: b
|
|
7099
|
+
}, this._panel.currentType = T, this._drawer.resyncPanelTopBarFromCurrentContent();
|
|
7060
7100
|
return;
|
|
7061
7101
|
}
|
|
7062
7102
|
}
|
|
7063
7103
|
}
|
|
7064
|
-
this._comparisonSelectMode = !1, this._comparisonSelectedSkus = [], this._comparisonSelectionWarning = null, this._drawer.setComparisonDockContent(null), this._drawer.setPanelContent(this._renderUISpec(
|
|
7104
|
+
this._comparisonSelectMode = !1, this._comparisonSelectedSkus = [], this._comparisonSelectionWarning = null, this._drawer.setComparisonDockContent(null), this._drawer.setPanelContent(this._renderUISpec(b, E), { preserveAiZone: K(T) }), this._currentPanelSource = {
|
|
7065
7105
|
kind: "spec",
|
|
7066
|
-
spec:
|
|
7067
|
-
}, this._panel.currentType =
|
|
7068
|
-
},
|
|
7106
|
+
spec: b
|
|
7107
|
+
}, this._panel.currentType = T;
|
|
7108
|
+
}, X = (b, E, T, j) => {
|
|
7069
7109
|
if (!this._panel) return;
|
|
7070
|
-
|
|
7071
|
-
const M = this._panel.currentType ??
|
|
7072
|
-
this._panel.updateTopBar(M,
|
|
7110
|
+
b === "ProductDetailsPanel" && e.type === "launchSingleProduct" && this._clearUnavailableProductContext(), d.threadId && this._panel.threads[this._panel.threads.length - 1] !== d.threadId && this._panel.threads.push(d.threadId), this._isMobileViewport && b === "ProductGrid" && this._ensureMobilePanelOverlayVisible();
|
|
7111
|
+
const M = this._panel.currentType ?? b, D = E?.props?.panelTitle;
|
|
7112
|
+
this._panel.updateTopBar(M, D), this._panel.updateExtendedMode(b), this._isMobileViewport && c && this._drawer?.hideMobilePanel(), q(b, T, j);
|
|
7073
7113
|
};
|
|
7074
|
-
let
|
|
7075
|
-
if (
|
|
7076
|
-
onTextChunk: (
|
|
7077
|
-
if (!o && i !== this._activeRequestThreadId || (u +=
|
|
7114
|
+
let $ = null;
|
|
7115
|
+
if ($ = pn(I, {
|
|
7116
|
+
onTextChunk: (b, E, T) => {
|
|
7117
|
+
if (!o && i !== this._activeRequestThreadId || (u += b, zo(u) && U(), T?.skuToProductItem && (this._skuToProductItem = {
|
|
7078
7118
|
...this._skuToProductItem,
|
|
7079
|
-
...
|
|
7080
|
-
}),
|
|
7081
|
-
let
|
|
7082
|
-
if (
|
|
7083
|
-
if (
|
|
7084
|
-
const
|
|
7085
|
-
if (!Wt(
|
|
7086
|
-
const
|
|
7087
|
-
|
|
7088
|
-
this._drawer?.hideKvkkBanner(), ot(
|
|
7089
|
-
}) : ot(
|
|
7119
|
+
...T.skuToProductItem
|
|
7120
|
+
}), T?.conversationMode && (this._conversationMode = T.conversationMode), T?.renderHint && (d.renderHint = T.renderHint), !this._drawer)) return;
|
|
7121
|
+
let j = u;
|
|
7122
|
+
if (T?.kvkk === !0 || vt(j)) {
|
|
7123
|
+
if (E) {
|
|
7124
|
+
const D = this.config.accountId;
|
|
7125
|
+
if (!Wt(D)) {
|
|
7126
|
+
const Z = Lo(j);
|
|
7127
|
+
Z ? this._drawer?.showKvkkBanner(Z, () => {
|
|
7128
|
+
this._drawer?.hideKvkkBanner(), ot(D);
|
|
7129
|
+
}) : ot(D);
|
|
7090
7130
|
}
|
|
7091
7131
|
}
|
|
7092
|
-
|
|
7132
|
+
j = Po(j);
|
|
7093
7133
|
}
|
|
7094
7134
|
const M = this._shadow?.querySelector(`[data-message-id="${d.id}"] .gengage-chat-bubble-text`);
|
|
7095
|
-
if (M ? M.innerHTML =
|
|
7096
|
-
if (d.content =
|
|
7097
|
-
this._drawer?.updateBotMessage(d.id,
|
|
7135
|
+
if (M ? M.innerHTML = fe(j) : (d.content = j, d.role === "assistant" && d.threadId && !this._threadsWithFirstBot.has(d.threadId) && (this._threadsWithFirstBot.add(d.threadId), this._drawer.markFirstBotMessage(d.id)), this._drawer.addMessage(d)), E)
|
|
7136
|
+
if (d.content = j, d.status = "done", xt(), $n(d))
|
|
7137
|
+
this._drawer?.updateBotMessage(d.id, j, "photo_analysis", d.photoAnalysis), d.threadId && this._focusPresentationThread(d.threadId, "auto");
|
|
7098
7138
|
else {
|
|
7099
|
-
const
|
|
7100
|
-
if (
|
|
7139
|
+
const D = this._shadow?.querySelector(`[data-message-id="${d.id}"] .gengage-chat-bubble-text`);
|
|
7140
|
+
if (D) {
|
|
7101
7141
|
this._activeTypewriter?.cancel();
|
|
7102
|
-
const
|
|
7142
|
+
const Z = T?.productMentions;
|
|
7103
7143
|
this._activeTypewriter = $i({
|
|
7104
|
-
container:
|
|
7105
|
-
html:
|
|
7144
|
+
container: D,
|
|
7145
|
+
html: fe(j),
|
|
7106
7146
|
onTick: () => this._drawer?.scrollToBottomIfNeeded(),
|
|
7107
7147
|
onComplete: () => {
|
|
7108
|
-
this._activeTypewriter = null,
|
|
7109
|
-
container:
|
|
7110
|
-
mentions:
|
|
7111
|
-
onProductClick: (
|
|
7148
|
+
this._activeTypewriter = null, Z && Z.length > 0 && D && qi({
|
|
7149
|
+
container: D,
|
|
7150
|
+
mentions: Z,
|
|
7151
|
+
onProductClick: (te) => {
|
|
7112
7152
|
this._sendAction({
|
|
7113
|
-
title:
|
|
7153
|
+
title: Z.find((re) => re.sku === te)?.short_name ?? te,
|
|
7114
7154
|
type: "launchSingleProduct",
|
|
7115
|
-
payload: { sku:
|
|
7155
|
+
payload: { sku: te }
|
|
7116
7156
|
});
|
|
7117
7157
|
}
|
|
7118
7158
|
});
|
|
@@ -7121,106 +7161,106 @@ var Ro = class Me extends Ka {
|
|
|
7121
7161
|
}
|
|
7122
7162
|
}
|
|
7123
7163
|
},
|
|
7124
|
-
onUISpec: (
|
|
7125
|
-
if (!o && i !== this._activeRequestThreadId ||
|
|
7126
|
-
|
|
7127
|
-
const M =
|
|
7128
|
-
if (jn(
|
|
7164
|
+
onUISpec: (b, E, T, j) => {
|
|
7165
|
+
if (!o && i !== this._activeRequestThreadId || E !== "chat") return;
|
|
7166
|
+
j && (this._clearAssistantPanelLikeStreamClearPanel(), _ = !1, N = null);
|
|
7167
|
+
const M = b.elements[b.root], D = M?.type ?? "unknown";
|
|
7168
|
+
if (jn(D, M?.props ?? {}, P, {
|
|
7129
7169
|
drawer: this._drawer,
|
|
7130
7170
|
ensureRendered: () => this._ensureAssistantMessageRendered(d),
|
|
7131
7171
|
cancelTypewriter: () => {
|
|
7132
7172
|
this._activeTypewriter?.cancel(), this._activeTypewriter = null;
|
|
7133
7173
|
},
|
|
7134
7174
|
sendSkipMessage: () => this._sendMessage(this._i18n.beautyPhotoStepSkipMessage),
|
|
7135
|
-
streamDone:
|
|
7175
|
+
streamDone: J
|
|
7136
7176
|
}, d)) {
|
|
7137
|
-
|
|
7177
|
+
D === "PhotoAnalysisCard" && d.threadId && this._focusPresentationThread(d.threadId, "auto");
|
|
7138
7178
|
return;
|
|
7139
7179
|
}
|
|
7140
|
-
const
|
|
7141
|
-
|
|
7142
|
-
const
|
|
7143
|
-
if (
|
|
7144
|
-
const
|
|
7145
|
-
$a(Array.isArray(
|
|
7180
|
+
const Z = ct(M), te = this.config.productDetailsExtended !== !0 && (D === "ProductDetailsPanel" || Z);
|
|
7181
|
+
te && !j && (this._clearAssistantPanelLikeStreamClearPanel(), _ = !1);
|
|
7182
|
+
const re = D === "ProductDetailsPanel" && T !== "panel" ? "panel" : T, ie = this._buildRenderContext();
|
|
7183
|
+
if (ie.isStreaming = !0, D === "ComparisonTable") {
|
|
7184
|
+
const R = M?.props?.products;
|
|
7185
|
+
$a(Array.isArray(R) ? R.length : 0);
|
|
7146
7186
|
}
|
|
7147
|
-
if (
|
|
7148
|
-
const
|
|
7149
|
-
za(void 0,
|
|
7187
|
+
if (D === "ProductGrid") {
|
|
7188
|
+
const R = M?.children?.length ?? 0;
|
|
7189
|
+
za(void 0, R);
|
|
7150
7190
|
}
|
|
7151
|
-
const
|
|
7152
|
-
if (
|
|
7153
|
-
const
|
|
7154
|
-
if (
|
|
7155
|
-
|
|
7191
|
+
const ce = re === "panel" && this._panel ? this._panel.toPanelSpec(b) : b;
|
|
7192
|
+
if (re === "panel" && this._panel && !te && D === "ProductGrid" && M) {
|
|
7193
|
+
const R = mt(M);
|
|
7194
|
+
if (R.isConsulting && !ki(R)) {
|
|
7195
|
+
N = b;
|
|
7156
7196
|
return;
|
|
7157
7197
|
}
|
|
7158
|
-
|
|
7198
|
+
R.isConsulting && (N = null);
|
|
7159
7199
|
}
|
|
7160
|
-
if (Bo(M) &&
|
|
7161
|
-
const
|
|
7200
|
+
if (Bo(M) && U(), re === "panel" && this._panel && !te) {
|
|
7201
|
+
const R = !S;
|
|
7162
7202
|
S = !0;
|
|
7163
|
-
const
|
|
7164
|
-
componentType:
|
|
7203
|
+
const V = M?.props?.replacePanel === !0, G = M?.props?.rankingState, Q = V || G === "pending" || G === "final" ? "replace" : ro({
|
|
7204
|
+
componentType: D,
|
|
7165
7205
|
similarsAppend: M?.props?.similarsAppend === !0,
|
|
7166
7206
|
currentPanelType: this._panel.currentType,
|
|
7167
7207
|
hasPanelContent: this._drawer?.hasPanelContent() ?? !1,
|
|
7168
7208
|
isPanelLoading: this._drawer?.isPanelLoading() ?? !1,
|
|
7169
|
-
isFirstPanelContentInStream:
|
|
7209
|
+
isFirstPanelContentInStream: R
|
|
7170
7210
|
});
|
|
7171
|
-
|
|
7211
|
+
ie.panelProductListHeading = void 0, D === "ProductGrid" && (Q === "appendSimilars" ? ie.panelProductListHeading = this._i18n.similarProductsLabel ?? "Similar Products" : this._applyPanelListHeadingToContext(ie, {
|
|
7172
7212
|
kind: "spec",
|
|
7173
|
-
spec:
|
|
7174
|
-
})),
|
|
7213
|
+
spec: ce
|
|
7214
|
+
})), Q === "appendSimilars" ? this._appendSimilarsToPanel(ce, ie) : Q === "append" ? (this._drawer?.appendPanelContent(this._renderUISpec(ce, ie)), this._comparisonSelectMode && this._refreshComparisonUI()) : ee(ce, ie, D), X(D, M, Q, !0);
|
|
7175
7215
|
}
|
|
7176
|
-
if (
|
|
7177
|
-
const
|
|
7178
|
-
if (
|
|
7179
|
-
c && (l =
|
|
7180
|
-
const
|
|
7216
|
+
if (D === "ProductDetailsPanel" && re === "panel" && (!d.silent || c)) {
|
|
7217
|
+
const R = M?.props?.product;
|
|
7218
|
+
if (R) {
|
|
7219
|
+
c && (l = R), this._currentInlineProductSummaryRecord = R;
|
|
7220
|
+
const V = {
|
|
7181
7221
|
root: "root",
|
|
7182
7222
|
elements: { root: {
|
|
7183
7223
|
type: "ProductSummaryCard",
|
|
7184
|
-
props: { product:
|
|
7224
|
+
props: { product: R }
|
|
7185
7225
|
} }
|
|
7186
|
-
},
|
|
7187
|
-
if (
|
|
7188
|
-
const
|
|
7189
|
-
d.threadId && (
|
|
7190
|
-
const
|
|
7191
|
-
|
|
7226
|
+
}, G = this._shadow?.querySelector(".gengage-chat-messages");
|
|
7227
|
+
if (G) {
|
|
7228
|
+
const Q = this._renderUISpec(V, ie);
|
|
7229
|
+
d.threadId && (Q.dataset.threadId = d.threadId);
|
|
7230
|
+
const de = this._shadow?.querySelector(`[data-message-id="${d.id}"]`);
|
|
7231
|
+
de && de.parentNode === G ? de.after(Q) : G.appendChild(Q), this._scrollInlineIntoView(Q, d.threadId), this._drawer?.refreshPresentationCollapsed(), S = !0;
|
|
7192
7232
|
}
|
|
7193
7233
|
}
|
|
7194
7234
|
}
|
|
7195
|
-
const x =
|
|
7196
|
-
let
|
|
7197
|
-
if (
|
|
7198
|
-
if (d.threadId && this._rememberPanelAiSpec(d.threadId,
|
|
7199
|
-
const
|
|
7200
|
-
W = !0, this._drawer?.setPanelAiZoneState("results", { resultEl:
|
|
7235
|
+
const x = D === "AITopPicks" || D === "AIGroupingCards", C = D === "ActionButtons" ? M?.props?.buttons : void 0, z = D === "ActionButtons" && this._modeController.mode !== "shopping" && Array.isArray(C) && C.length > 0 && C.every((R) => R.action?.type === "inputText");
|
|
7236
|
+
let Y = !1, ne = !1;
|
|
7237
|
+
if (te && Z && (ie.panelProductListHeading = this._i18n.similarProductsLabel ?? "Similar Products"), x && (!d.silent || s))
|
|
7238
|
+
if (d.threadId && this._rememberPanelAiSpec(d.threadId, b), F) {
|
|
7239
|
+
const R = this._renderUISpec(b, ie);
|
|
7240
|
+
W = !0, this._drawer?.setPanelAiZoneState("results", { resultEl: R }), Y = !0, B = null;
|
|
7201
7241
|
} else
|
|
7202
|
-
|
|
7203
|
-
const
|
|
7204
|
-
if (!x && (!d.silent ||
|
|
7205
|
-
const
|
|
7206
|
-
if (
|
|
7207
|
-
const
|
|
7208
|
-
d.threadId && (
|
|
7242
|
+
B = b, ne = !0;
|
|
7243
|
+
const oe = s && (D === "GroundingReviewCard" || x);
|
|
7244
|
+
if (!x && (!d.silent || oe) && (re !== "panel" || D === "ProductCard" || te && D === "ProductGrid" && !Z) && (D !== "ActionButtons" || z) && !Y && !(ne && x)) {
|
|
7245
|
+
const R = this._shadow?.querySelector(".gengage-chat-messages");
|
|
7246
|
+
if (R) {
|
|
7247
|
+
const V = this._renderUISpec(b, ie);
|
|
7248
|
+
d.threadId && (V.dataset.threadId = d.threadId), R.appendChild(V), this._scrollInlineIntoView(V, d.threadId), this._drawer?.refreshPresentationCollapsed(), te && D === "ProductGrid" && (S = !0);
|
|
7209
7249
|
}
|
|
7210
7250
|
}
|
|
7211
|
-
if ((
|
|
7212
|
-
const
|
|
7213
|
-
for (const
|
|
7214
|
-
const
|
|
7215
|
-
|
|
7251
|
+
if ((D === "ProductGrid" || D === "ProductCard") && d.threadId) {
|
|
7252
|
+
const R = M?.children ?? [], V = D === "ProductGrid" ? R.map((G) => b.elements[G]?.props?.product).filter(Boolean) : [M?.props?.product].filter(Boolean);
|
|
7253
|
+
for (const G of V) {
|
|
7254
|
+
const Q = G.sku;
|
|
7255
|
+
Q && this._viewedProductSkus.add(Q);
|
|
7216
7256
|
}
|
|
7217
7257
|
}
|
|
7218
|
-
if (
|
|
7219
|
-
const
|
|
7220
|
-
|
|
7258
|
+
if (D === "ProductGrid" || D === "ProductDetailsPanel") {
|
|
7259
|
+
const R = (D === "ProductGrid" ? (M?.children ?? []).map((V) => b.elements[V]?.props?.product).filter(Boolean) : [M?.props?.product ?? M?.props].filter(Boolean)).map((V) => V.imageUrl).filter((V) => typeof V == "string").slice(0, 5);
|
|
7260
|
+
R.length > 0 && this._bridge?.send("previewImages", { images: R });
|
|
7221
7261
|
}
|
|
7222
|
-
const
|
|
7223
|
-
if (
|
|
7262
|
+
const le = M?.children?.length ?? 0;
|
|
7263
|
+
if (D === "ProductGrid" && re === "panel" && !te && le > 1 && !this._isMobileViewport && !this._modeController.isChoicePrompterHidden && !this._comparisonSelectMode && !Zi(this._currentThreadId ?? "") && (this._clearChoicePrompter(), this._choicePrompterEl = Yi({
|
|
7224
7264
|
heading: this._i18n.choicePrompterHeading,
|
|
7225
7265
|
suggestion: this._i18n.choicePrompterSuggestion,
|
|
7226
7266
|
ctaLabel: this._i18n.choicePrompterCta,
|
|
@@ -7232,92 +7272,92 @@ var Ro = class Me extends Ka {
|
|
|
7232
7272
|
onDismiss: () => {
|
|
7233
7273
|
this._choicePrompterEl = null;
|
|
7234
7274
|
}
|
|
7235
|
-
}), this._mountChoicePrompter()),
|
|
7236
|
-
const
|
|
7237
|
-
if (
|
|
7238
|
-
const
|
|
7239
|
-
for (const
|
|
7240
|
-
const
|
|
7241
|
-
label:
|
|
7242
|
-
action:
|
|
7275
|
+
}), this._mountChoicePrompter()), D === "ActionButtons") {
|
|
7276
|
+
const R = M?.props?.buttons;
|
|
7277
|
+
if (R && R.length > 0 && !z) {
|
|
7278
|
+
const V = [], G = [];
|
|
7279
|
+
for (const Q of R) if (Wi(Q)) {
|
|
7280
|
+
const de = {
|
|
7281
|
+
label: Q.label,
|
|
7282
|
+
action: Q.action
|
|
7243
7283
|
};
|
|
7244
|
-
|
|
7245
|
-
} else
|
|
7246
|
-
|
|
7247
|
-
label:
|
|
7248
|
-
onAction: () => this._sendAction(
|
|
7249
|
-
...
|
|
7250
|
-
}))),
|
|
7251
|
-
const
|
|
7252
|
-
label:
|
|
7253
|
-
onAction: () => this._sendAction(
|
|
7284
|
+
Q.icon && (de.icon = Q.icon), V.push(de);
|
|
7285
|
+
} else G.push(Q);
|
|
7286
|
+
V.length > 0 && this._drawer?.setInputAreaChips(V.map((Q) => ({
|
|
7287
|
+
label: Q.label,
|
|
7288
|
+
onAction: () => this._sendAction(Q.action),
|
|
7289
|
+
...Q.icon ? { icon: Q.icon } : {}
|
|
7290
|
+
}))), G.length > 0 && this._drawer?.setPills(G.map((Q) => {
|
|
7291
|
+
const de = {
|
|
7292
|
+
label: Q.label,
|
|
7293
|
+
onAction: () => this._sendAction(Q.action)
|
|
7254
7294
|
};
|
|
7255
|
-
return
|
|
7295
|
+
return Q.icon && (de.icon = Q.icon), Q.image && (de.image = Q.image), Q.description && (de.description = Q.description), de;
|
|
7256
7296
|
}));
|
|
7257
7297
|
}
|
|
7258
7298
|
}
|
|
7259
|
-
k(), d.uiSpec =
|
|
7299
|
+
k(), d.uiSpec = b;
|
|
7260
7300
|
},
|
|
7261
|
-
onAction: (
|
|
7262
|
-
if (!(!o && i !== this._activeRequestThreadId) &&
|
|
7263
|
-
const
|
|
7264
|
-
this.config.actionHandling?.unknownActionPolicy !== void 0 && (
|
|
7301
|
+
onAction: (b) => {
|
|
7302
|
+
if (!(!o && i !== this._activeRequestThreadId) && b.type === "action") {
|
|
7303
|
+
const E = {};
|
|
7304
|
+
this.config.actionHandling?.unknownActionPolicy !== void 0 && (E.unknownActionPolicy = this.config.actionHandling.unknownActionPolicy), this.config.actionHandling?.allowScriptCall !== void 0 && (E.allowScriptCall = this.config.actionHandling.allowScriptCall), Ya(b, {
|
|
7265
7305
|
openChat: () => this.open(),
|
|
7266
|
-
navigate: (
|
|
7267
|
-
|
|
7306
|
+
navigate: (T) => {
|
|
7307
|
+
ve(T.url) && (this._bridge?.send("navigate", T), T.newTab ? window.open(T.url, "_blank", "noopener,noreferrer") : window.location.href = T.url);
|
|
7268
7308
|
},
|
|
7269
|
-
saveSession: (
|
|
7270
|
-
addToCart: (
|
|
7271
|
-
this._runChatAddToCartFlow(
|
|
7309
|
+
saveSession: (T) => this.saveSession(T.sessionId, T.sku),
|
|
7310
|
+
addToCart: (T) => {
|
|
7311
|
+
this._runChatAddToCartFlow(T);
|
|
7272
7312
|
},
|
|
7273
|
-
scriptCall: (
|
|
7274
|
-
we("gengage:chat:script-call",
|
|
7313
|
+
scriptCall: (T) => {
|
|
7314
|
+
we("gengage:chat:script-call", T), this.config.onScriptCall?.(T);
|
|
7275
7315
|
}
|
|
7276
|
-
},
|
|
7316
|
+
}, E);
|
|
7277
7317
|
}
|
|
7278
7318
|
},
|
|
7279
|
-
onMetadata: (
|
|
7280
|
-
if (!(!o && i !== this._activeRequestThreadId) &&
|
|
7281
|
-
if (
|
|
7282
|
-
this._lastBackendContext =
|
|
7283
|
-
const
|
|
7284
|
-
|
|
7319
|
+
onMetadata: (b) => {
|
|
7320
|
+
if (!(!o && i !== this._activeRequestThreadId) && b.type === "metadata" && b.meta) {
|
|
7321
|
+
if (b.meta.panel !== void 0 || b.meta.messages !== void 0 || b.meta.message_id !== void 0) {
|
|
7322
|
+
this._lastBackendContext = b.meta;
|
|
7323
|
+
const E = he(b.meta.panel);
|
|
7324
|
+
E && (this._modeController.updateFromContext(E), this._applyUiHints());
|
|
7285
7325
|
}
|
|
7286
|
-
if (
|
|
7287
|
-
const
|
|
7288
|
-
this.config.productDetailsExtended !== !0 && (
|
|
7326
|
+
if (b.meta.panelLoading) {
|
|
7327
|
+
const E = typeof b.meta.panelPendingType == "string" ? b.meta.panelPendingType : void 0;
|
|
7328
|
+
this.config.productDetailsExtended !== !0 && (E === "productDetails" || E === "productDetailsSimilars") || (_ = !0, S = !1, v(), this._panel && (this._panel.currentType = null), this._drawer?.showPanelLoading(E), this._isMobileViewport && E === "productList" && this._ensureMobilePanelOverlayVisible(), E && this._panel?.updateTopBarForLoading(E));
|
|
7289
7329
|
}
|
|
7290
|
-
if (
|
|
7291
|
-
const
|
|
7292
|
-
detail: { payload:
|
|
7330
|
+
if (b.meta.voice) {
|
|
7331
|
+
const E = new CustomEvent("gengage:chat:voice", {
|
|
7332
|
+
detail: { payload: b.meta.voice },
|
|
7293
7333
|
bubbles: !1,
|
|
7294
7334
|
cancelable: !0
|
|
7295
|
-
}),
|
|
7296
|
-
if (Ba(),
|
|
7297
|
-
const
|
|
7298
|
-
|
|
7335
|
+
}), T = window.dispatchEvent(E);
|
|
7336
|
+
if (Ba(), T) {
|
|
7337
|
+
const j = b.meta.voice;
|
|
7338
|
+
j.audio_base64 && (this._activeTtsHandle?.stop(), this._activeTtsHandle = Fi(j.audio_base64, j.content_type ?? "audio/ogg"));
|
|
7299
7339
|
}
|
|
7300
7340
|
}
|
|
7301
|
-
if ((
|
|
7302
|
-
target:
|
|
7303
|
-
payload:
|
|
7304
|
-
}), ze("redirect", "redirect dispatched", { target:
|
|
7305
|
-
const
|
|
7306
|
-
if (
|
|
7307
|
-
const
|
|
7308
|
-
this._drawer?.setThinkingSteps(
|
|
7341
|
+
if ((b.meta.redirectTarget || b.meta.redirect) && (we("gengage:chat:redirect", {
|
|
7342
|
+
target: b.meta.redirectTarget ?? null,
|
|
7343
|
+
payload: b.meta.redirect ?? null
|
|
7344
|
+
}), ze("redirect", "redirect dispatched", { target: b.meta.redirectTarget ?? null }), this._handleRedirectMetadata(b.meta.redirect)), b.meta.analyzeAnimation && this.config.productDetailsExtended === !0 && (_ = !0, S = !1, v(), this._panel && (this._panel.currentType = null), this._drawer?.showPanelLoading(), this._panel?.updateTopBarForLoading("productDetails")), b.meta.loading) {
|
|
7345
|
+
const E = Array.isArray(b.meta.thinkingMessages) ? b.meta.thinkingMessages.filter((j) => typeof j == "string") : [], T = typeof b.meta.loadingText == "string" ? b.meta.loadingText : void 0;
|
|
7346
|
+
if (E.length > 0) {
|
|
7347
|
+
const j = T && this._modeController.shouldCondenseThinking() ? [...E.slice(0, 2), T] : E;
|
|
7348
|
+
this._drawer?.setThinkingSteps(j);
|
|
7309
7349
|
}
|
|
7310
|
-
typeof
|
|
7350
|
+
typeof T == "string" && T.length > 0 && (this._drawer?.addThinkingStep(T), L || this._bridge?.send("loadingMessage", { text: T }));
|
|
7311
7351
|
}
|
|
7312
|
-
|
|
7313
|
-
type:
|
|
7314
|
-
data:
|
|
7315
|
-
}),
|
|
7352
|
+
b.meta.visitorDataResponse && this._bridge?.send("engagingMessage", b.meta.visitorDataResponse), b.meta.formType && this._bridge?.send("glovForm", {
|
|
7353
|
+
type: b.meta.formType,
|
|
7354
|
+
data: b.meta.formPayload
|
|
7355
|
+
}), b.meta.launcherContent && this._bridge?.send("launcherContent", b.meta.launcherContent), we("gengage:chat:metadata", { payload: b.meta });
|
|
7316
7356
|
}
|
|
7317
7357
|
},
|
|
7318
|
-
onError: (
|
|
7319
|
-
if (
|
|
7320
|
-
|
|
7358
|
+
onError: (b) => {
|
|
7359
|
+
if ($ && this._abortControllers.delete($), !o && i !== this._activeRequestThreadId) return;
|
|
7360
|
+
J = !0, this._activeTypewriter?.cancel(), this._activeTypewriter = null, k(), B = null, N = null, r(!1), this._bridge?.send("loadingMessage", { text: null }), this._drawer?.removeTypingIndicator(), this._drawer?.clearInputAreaChips(), Vn(P, {
|
|
7321
7361
|
drawer: this._drawer,
|
|
7322
7362
|
ensureRendered: () => {
|
|
7323
7363
|
},
|
|
@@ -7326,20 +7366,20 @@ var Ro = class Me extends Ka {
|
|
|
7326
7366
|
sendSkipMessage: () => this._sendMessage(this._i18n.beautyPhotoStepSkipMessage),
|
|
7327
7367
|
streamDone: !0
|
|
7328
7368
|
});
|
|
7329
|
-
const
|
|
7330
|
-
_ && !S &&
|
|
7331
|
-
const
|
|
7332
|
-
this._shadow?.querySelector(`[data-message-id="${
|
|
7333
|
-
const
|
|
7334
|
-
|
|
7369
|
+
const E = S;
|
|
7370
|
+
_ && !S && f(), _ = !1, S = !1;
|
|
7371
|
+
const T = d.content != null && d.content.length > 0 || u.length > 0 || E, j = d.silent || T, M = typeof navigator < "u" && navigator.onLine === !1 && Xt(b), D = () => {
|
|
7372
|
+
this._shadow?.querySelector(`[data-message-id="${pe(d.id)}"]`)?.remove();
|
|
7373
|
+
const re = this._messages.indexOf(d);
|
|
7374
|
+
re >= 0 && this._messages.splice(re, 1);
|
|
7335
7375
|
};
|
|
7336
|
-
let
|
|
7337
|
-
const
|
|
7376
|
+
let Z = !1;
|
|
7377
|
+
const te = () => {
|
|
7338
7378
|
if (M) return;
|
|
7339
|
-
this.emit("error",
|
|
7340
|
-
const
|
|
7341
|
-
|
|
7342
|
-
const
|
|
7379
|
+
this.emit("error", b);
|
|
7380
|
+
const re = b.message;
|
|
7381
|
+
re === this._lastErrorMessage ? this._consecutiveErrorCount++ : (this._consecutiveErrorCount = 1, this._lastErrorMessage = re);
|
|
7382
|
+
const ie = b.message.trim(), ce = ie.length > 0 ? ie : this._i18n.errorMessage, x = {
|
|
7343
7383
|
onRetry: () => {
|
|
7344
7384
|
this._lastSentAction && this._sendAction(this._lastSentAction.action, this._lastSentAction.options);
|
|
7345
7385
|
},
|
|
@@ -7348,43 +7388,43 @@ var Ro = class Me extends Ka {
|
|
|
7348
7388
|
}
|
|
7349
7389
|
};
|
|
7350
7390
|
if (this._consecutiveErrorCount >= 2) {
|
|
7351
|
-
|
|
7391
|
+
D(), Z = !0, this._drawer?.showErrorWithRecovery(this._i18n.accountInactiveMessage, x);
|
|
7352
7392
|
return;
|
|
7353
7393
|
}
|
|
7354
|
-
if (Co(
|
|
7355
|
-
|
|
7394
|
+
if (Co(b, ce)) {
|
|
7395
|
+
D(), Z = !0, this._drawer?.showErrorWithRecovery(ce, x);
|
|
7356
7396
|
return;
|
|
7357
7397
|
}
|
|
7358
|
-
d.content =
|
|
7359
|
-
const
|
|
7398
|
+
d.content = ce, d.status = "done";
|
|
7399
|
+
const C = fe(ce.replace(/\r\n/g, `
|
|
7360
7400
|
`).split(`
|
|
7361
7401
|
`).join("<br />"));
|
|
7362
|
-
this._ensureAssistantMessageRendered(d), this._drawer?.updateBotMessage(d.id,
|
|
7402
|
+
this._ensureAssistantMessageRendered(d), this._drawer?.updateBotMessage(d.id, C), this._drawer?.showRecoveryPillsOnly(x);
|
|
7363
7403
|
};
|
|
7364
|
-
if (s && !
|
|
7404
|
+
if (s && !T) if (c || this._hasUnavailableProductContext()) {
|
|
7365
7405
|
this._drawer?.setPills([]);
|
|
7366
|
-
const
|
|
7367
|
-
d.content =
|
|
7406
|
+
const re = this._i18n.productNotFoundMessage;
|
|
7407
|
+
d.content = re, d.status = "done", this._ensureAssistantMessageRendered(d), this._drawer?.updateBotMessage(d.id, re), this._markUnavailableProductContext();
|
|
7368
7408
|
} else d.status = "done";
|
|
7369
|
-
else if (
|
|
7370
|
-
this._drawer?.setPills([]), d.silent ||
|
|
7371
|
-
else if (
|
|
7372
|
-
s && (this._contextPrimingInFlight = !1, this._flushQueuedUserMessages()), !
|
|
7409
|
+
else if (j)
|
|
7410
|
+
this._drawer?.setPills([]), d.silent || te();
|
|
7411
|
+
else if (te(), M) return;
|
|
7412
|
+
s && (this._contextPrimingInFlight = !1, this._flushQueuedUserMessages()), !Z && d.status === "streaming" && (d.status = "error");
|
|
7373
7413
|
},
|
|
7374
7414
|
onDone: () => {
|
|
7375
|
-
if (
|
|
7376
|
-
if (
|
|
7415
|
+
if ($ && this._abortControllers.delete($), !o && i !== this._activeRequestThreadId) return;
|
|
7416
|
+
if (J = !0, N && this._panel && this._drawer) {
|
|
7377
7417
|
const M = this._buildRenderContext();
|
|
7378
7418
|
M.isStreaming = !1;
|
|
7379
|
-
const
|
|
7419
|
+
const D = N.elements[N.root], Z = this._panel.toPanelSpec(N);
|
|
7380
7420
|
this._applyPanelListHeadingToContext(M, {
|
|
7381
7421
|
kind: "spec",
|
|
7382
|
-
spec:
|
|
7422
|
+
spec: Z
|
|
7383
7423
|
});
|
|
7384
|
-
const
|
|
7385
|
-
|
|
7424
|
+
const te = D?.type ?? "ProductGrid";
|
|
7425
|
+
ee(Z, M, te), X(te, D, "replace", !1), S = !0;
|
|
7386
7426
|
}
|
|
7387
|
-
|
|
7427
|
+
N = null, B && O(!1), k(), this._activeRequestThreadId = null, this._consecutiveErrorCount = 0, this._lastErrorMessage = "", r(!1), this._bridge?.send("loadingMessage", { text: null }), this._drawer?.removeTypingIndicator(), qn(P, {
|
|
7388
7428
|
drawer: this._drawer,
|
|
7389
7429
|
ensureRendered: () => {
|
|
7390
7430
|
},
|
|
@@ -7393,8 +7433,8 @@ var Ro = class Me extends Ka {
|
|
|
7393
7433
|
sendSkipMessage: () => this._sendMessage(this._i18n.beautyPhotoStepSkipMessage),
|
|
7394
7434
|
streamDone: !0
|
|
7395
7435
|
});
|
|
7396
|
-
const
|
|
7397
|
-
if (_ && !S &&
|
|
7436
|
+
const b = S;
|
|
7437
|
+
if (_ && !S && f(), _ = !1, c && !u && !b) {
|
|
7398
7438
|
const M = this._i18n.productNotFoundMessage;
|
|
7399
7439
|
d.content = M, this._ensureAssistantMessageRendered(d), this._drawer?.updateBotMessage(d.id, M), this._markUnavailableProductContext();
|
|
7400
7440
|
}
|
|
@@ -7404,22 +7444,22 @@ var Ro = class Me extends Ka {
|
|
|
7404
7444
|
this._flushQueuedUserMessages(), !M && c && this._ensurePdpPrimeSuggestedUiIfNeeded(l);
|
|
7405
7445
|
}
|
|
7406
7446
|
d.status === "streaming" && (d.status = "done", xt()), this._presentation.finalizeAssistantGroup(i);
|
|
7407
|
-
const
|
|
7408
|
-
|
|
7409
|
-
const
|
|
7410
|
-
this._panel?.snapshotForMessage(d.id,
|
|
7411
|
-
source:
|
|
7447
|
+
const E = this._shadow?.querySelector(".gengage-chat-comparison-toggle-btn--hidden");
|
|
7448
|
+
E && (E.classList.remove("gengage-chat-comparison-toggle-btn--hidden"), E.classList.add("gengage-chat-comparison-toggle-btn--reveal")), this.emit("message", d);
|
|
7449
|
+
const T = this._currentPanelSource, j = T ? this._clonePanelSourceForHistory(T) : null;
|
|
7450
|
+
this._panel?.snapshotForMessage(d.id, j ? {
|
|
7451
|
+
source: j,
|
|
7412
7452
|
threadId: d.threadId,
|
|
7413
7453
|
rebuild: () => {
|
|
7414
7454
|
const M = this._buildRenderContext();
|
|
7415
|
-
return this._renderPanelFromSource(
|
|
7455
|
+
return this._renderPanelFromSource(j, M);
|
|
7416
7456
|
}
|
|
7417
7457
|
} : void 0), this._maybeAddPanelRestoreMessage(d), this._persistConversationState();
|
|
7418
7458
|
}
|
|
7419
|
-
}, A), this._abortControllers.add(
|
|
7420
|
-
const
|
|
7459
|
+
}, A), this._abortControllers.add($), !a?.silent && !o) {
|
|
7460
|
+
const b = $;
|
|
7421
7461
|
this._drawer?.showStopButton(() => {
|
|
7422
|
-
|
|
7462
|
+
b.abort(), this._abortControllers.delete(b), this._drawer?.removeTypingIndicator(), r(!1), this._bridge?.send("loadingMessage", { text: null }), d.status === "streaming" && (d.status = "done");
|
|
7423
7463
|
});
|
|
7424
7464
|
}
|
|
7425
7465
|
}
|
|
@@ -7451,14 +7491,14 @@ var Ro = class Me extends Ka {
|
|
|
7451
7491
|
if (!e) return null;
|
|
7452
7492
|
const a = e.elements[e.root];
|
|
7453
7493
|
if (!a || a.type !== "ProductDetailsPanel") return null;
|
|
7454
|
-
const n =
|
|
7455
|
-
return
|
|
7494
|
+
const n = he(a.props);
|
|
7495
|
+
return he(n?.product) ?? n ?? null;
|
|
7456
7496
|
}
|
|
7457
7497
|
_productGridRecordFromSpec(e, a) {
|
|
7458
7498
|
if (!e) return null;
|
|
7459
7499
|
const n = e.elements[e.root];
|
|
7460
7500
|
if (!n || n.type !== "ProductGrid") return null;
|
|
7461
|
-
const r = Object.values(e.elements).filter((o) => o.type === "ProductCard").map((o) =>
|
|
7501
|
+
const r = Object.values(e.elements).filter((o) => o.type === "ProductCard").map((o) => he(o.props?.product)).filter((o) => o !== null);
|
|
7462
7502
|
if (r.length === 0) return null;
|
|
7463
7503
|
const i = this._coerceSkuKey(a);
|
|
7464
7504
|
if (i) {
|
|
@@ -7469,7 +7509,7 @@ var Ro = class Me extends Ka {
|
|
|
7469
7509
|
}
|
|
7470
7510
|
_productRecordMatchesSku(e, a) {
|
|
7471
7511
|
if (this._coerceSkuKey(e.sku) === a || this._coerceSkuKey(e.group_id ?? e.groupId) === a) return !0;
|
|
7472
|
-
const n =
|
|
7512
|
+
const n = he(e.extras);
|
|
7473
7513
|
return this._coerceSkuKey(n?.group_id ?? n?.groupId) === a;
|
|
7474
7514
|
}
|
|
7475
7515
|
_getCurrentPanelProductRecord() {
|
|
@@ -7625,7 +7665,7 @@ var Ro = class Me extends Ka {
|
|
|
7625
7665
|
return;
|
|
7626
7666
|
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);
|
|
7627
7667
|
for (const s of this._messages) {
|
|
7628
|
-
const c = this._shadow?.querySelector(`[data-message-id="${
|
|
7668
|
+
const c = this._shadow?.querySelector(`[data-message-id="${pe(s.id)}"]`);
|
|
7629
7669
|
c && (s.threadId && s.threadId > e ? c.classList.add("gengage-chat-bubble--hidden") : c.classList.remove("gengage-chat-bubble--hidden"));
|
|
7630
7670
|
}
|
|
7631
7671
|
this._shadow?.querySelectorAll("[data-thread-id]").forEach((s) => {
|
|
@@ -7779,7 +7819,7 @@ var Ro = class Me extends Ka {
|
|
|
7779
7819
|
async _restoreFromHistoryRecord(e) {
|
|
7780
7820
|
if (this._drawer?.lockScrollForRestore(), e.messages.length > 0 && (this.config.pageContext?.pageType === "pdp" && this.config.pageContext?.sku && (this._pdpLaunched = !0), this.config.pageContext?.pageType === "plp" && this.config.pageContext?.skuList?.length && (this._plpLaunched = !0), this.config.pageContext?.pageType === "home" && (this._homepageLaunched = !0)), this._currentThreadId = e.currentThreadId, this._lastThreadId = e.lastThreadId, this._currentThreadId && this._lastThreadId && this._currentThreadId > this._lastThreadId && (this._currentThreadId = this._lastThreadId), this._chatCreatedAt = e.createdAt, this._lastBackendContext = e.lastBackendContext, e.panelThreads && (this._panel.threads = [...e.panelThreads]), e.panelSnapshotHtml) for (const [n, r] of Object.entries(e.panelSnapshotHtml)) {
|
|
7781
7821
|
const i = document.createElement("div");
|
|
7782
|
-
i.innerHTML =
|
|
7822
|
+
i.innerHTML = fe(r), this._panel.snapshots.set(n, i);
|
|
7783
7823
|
}
|
|
7784
7824
|
if (e.panelSnapshotTypes) for (const [n, r] of Object.entries(e.panelSnapshotTypes)) this._panel.snapshotTypes.set(n, r);
|
|
7785
7825
|
e.panelAiSpecByThread && this._restorePanelAiSpecMap(e.panelAiSpecByThread);
|
|
@@ -7804,7 +7844,7 @@ var Ro = class Me extends Ka {
|
|
|
7804
7844
|
}
|
|
7805
7845
|
if (this._currentThreadId) {
|
|
7806
7846
|
const n = this._currentThreadId;
|
|
7807
|
-
for (const r of this._messages) r.threadId && r.threadId > n && this._shadow?.querySelector(`[data-message-id="${
|
|
7847
|
+
for (const r of this._messages) r.threadId && r.threadId > n && this._shadow?.querySelector(`[data-message-id="${pe(r.id)}"]`)?.classList.add("gengage-chat-bubble--hidden");
|
|
7808
7848
|
this._shadow?.querySelectorAll("[data-thread-id]").forEach((r) => {
|
|
7809
7849
|
r instanceof HTMLElement && r.dataset.threadId && r.dataset.threadId > n && r.classList.add("gengage-chat-bubble--hidden");
|
|
7810
7850
|
});
|
|
@@ -7848,7 +7888,7 @@ var Ro = class Me extends Ka {
|
|
|
7848
7888
|
return e !== void 0 && e.length > 0 && this._productContextUnavailableSku === e;
|
|
7849
7889
|
}
|
|
7850
7890
|
_ensureAssistantMessageRendered(e) {
|
|
7851
|
-
if (!(this._shadow?.querySelector(`[data-message-id="${
|
|
7891
|
+
if (!(this._shadow?.querySelector(`[data-message-id="${pe(e.id)}"]`) || !this._drawer)) {
|
|
7852
7892
|
if (e.role === "assistant" && e.threadId && !this._threadsWithFirstBot.has(e.threadId)) {
|
|
7853
7893
|
this._threadsWithFirstBot.add(e.threadId), this._drawer.addMessage(e), this._drawer.markFirstBotMessage(e.id);
|
|
7854
7894
|
return;
|
|
@@ -7874,7 +7914,7 @@ var Ro = class Me extends Ka {
|
|
|
7874
7914
|
if (o && i.sku && i.sku !== o) return;
|
|
7875
7915
|
if (this._pdpLaunched = !0, this._drawer?.lockScrollForRestore(), this._currentThreadId = i.currentThreadId, this._lastThreadId = i.lastThreadId, this._currentThreadId && this._lastThreadId && this._currentThreadId > this._lastThreadId && (this._currentThreadId = this._lastThreadId), this._chatCreatedAt = i.createdAt, i.panelThreads && (this._panel.threads = i.panelThreads), i.panelSnapshotHtml) for (const [c, l] of Object.entries(i.panelSnapshotHtml)) {
|
|
7876
7916
|
const p = document.createElement("div");
|
|
7877
|
-
p.innerHTML =
|
|
7917
|
+
p.innerHTML = fe(l), this._panel.snapshots.set(c, p);
|
|
7878
7918
|
}
|
|
7879
7919
|
if (i.panelSnapshotTypes) for (const [c, l] of Object.entries(i.panelSnapshotTypes)) this._panel.snapshotTypes.set(c, l);
|
|
7880
7920
|
i.panelAiSpecByThread && this._restorePanelAiSpecMap(i.panelAiSpecByThread);
|
|
@@ -7906,7 +7946,7 @@ var Ro = class Me extends Ka {
|
|
|
7906
7946
|
}
|
|
7907
7947
|
if (this._currentThreadId) {
|
|
7908
7948
|
const c = this._currentThreadId;
|
|
7909
|
-
for (const l of this._messages) l.threadId && l.threadId > c && this._shadow?.querySelector(`[data-message-id="${
|
|
7949
|
+
for (const l of this._messages) l.threadId && l.threadId > c && this._shadow?.querySelector(`[data-message-id="${pe(l.id)}"]`)?.classList.add("gengage-chat-bubble--hidden");
|
|
7910
7950
|
this._shadow?.querySelectorAll("[data-thread-id]").forEach((l) => {
|
|
7911
7951
|
l instanceof HTMLElement && l.dataset.threadId && l.dataset.threadId > c && l.classList.add("gengage-chat-bubble--hidden");
|
|
7912
7952
|
});
|
|
@@ -7977,10 +8017,10 @@ var Ro = class Me extends Ka {
|
|
|
7977
8017
|
if (o.parentElement?.classList.contains("gengage-chat-comparison-select-wrapper")) {
|
|
7978
8018
|
const m = o.parentElement, v = this._comparisonSelectedSkus.includes(o.dataset.sku);
|
|
7979
8019
|
m.classList.toggle("gengage-chat-comparison-select-wrapper--selected", v);
|
|
7980
|
-
const
|
|
7981
|
-
if (
|
|
7982
|
-
|
|
7983
|
-
const u =
|
|
8020
|
+
const f = m.querySelector(".gengage-chat-comparison-checkbox");
|
|
8021
|
+
if (f) {
|
|
8022
|
+
f.dataset.selected = v ? "true" : "false", f.setAttribute("aria-pressed", v ? "true" : "false");
|
|
8023
|
+
const u = f.querySelector(".gengage-chat-comparison-checkbox-icon"), d = f.querySelector(".gengage-chat-comparison-checkbox-label");
|
|
7984
8024
|
u && (u.innerHTML = v ? '<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>'), d && (d.textContent = v ? this._i18n.comparisonSelectedLabel ?? "Selected" : this._i18n.comparisonSelectLabel ?? "Select to compare");
|
|
7985
8025
|
}
|
|
7986
8026
|
continue;
|
|
@@ -8041,10 +8081,10 @@ var Ro = class Me extends Ka {
|
|
|
8041
8081
|
return a ? (this._runChatAddToCartFlow(a), !0) : !1;
|
|
8042
8082
|
}
|
|
8043
8083
|
_resolveCurrentProductAddToCartParams() {
|
|
8044
|
-
const e =
|
|
8084
|
+
const e = he(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;
|
|
8045
8085
|
if (!r && !i && this._currentPanelSource && !o) return null;
|
|
8046
8086
|
const s = [r, i];
|
|
8047
|
-
n && s.push(o), this._currentPanelSource || (s.push(this._getLatestProductDetailsRecord()), n && s.push(this._getLatestProductGridRecord(a))), n && s.push(
|
|
8087
|
+
n && s.push(o), this._currentPanelSource || (s.push(this._getLatestProductDetailsRecord()), n && s.push(this._getLatestProductGridRecord(a))), n && s.push(he(this._bridgeContext?.product), he(this._bridgeContext?.productDetails), this._bridgeContext, he(e?.product), he(e?.productDetails), e);
|
|
8048
8088
|
for (const c of s) {
|
|
8049
8089
|
const l = this._extractAddToCartParamsFromRecord(c, a);
|
|
8050
8090
|
if (l) return l;
|
|
@@ -8149,7 +8189,7 @@ var Ro = class Me extends Ka {
|
|
|
8149
8189
|
return;
|
|
8150
8190
|
}
|
|
8151
8191
|
const i = a.url.trim();
|
|
8152
|
-
if (!n && this.config.onProductNavigate !== void 0 && i.length > 0 &&
|
|
8192
|
+
if (!n && this.config.onProductNavigate !== void 0 && i.length > 0 && ve(i)) {
|
|
8153
8193
|
et(a.sku), this.config.onProductNavigate(i, a.sku, this.config.session?.sessionId ?? null);
|
|
8154
8194
|
return;
|
|
8155
8195
|
}
|
|
@@ -8232,7 +8272,7 @@ var Ro = class Me extends Ka {
|
|
|
8232
8272
|
await this._session.toggleFavorite(n, r, e, a), this._drawer?.updateFavoritesBadge(this._session.favoritedSkus.size);
|
|
8233
8273
|
}
|
|
8234
8274
|
_revertFavoriteHeartUi(e) {
|
|
8235
|
-
const a = this._shadow?.querySelectorAll(`[data-gengage-favorite-sku="${
|
|
8275
|
+
const a = this._shadow?.querySelectorAll(`[data-gengage-favorite-sku="${pe(e)}"]`);
|
|
8236
8276
|
if (a?.length)
|
|
8237
8277
|
for (const n of a) {
|
|
8238
8278
|
if (!(n instanceof HTMLButtonElement)) continue;
|
|
@@ -8479,7 +8519,7 @@ var Ro = class Me extends Ka {
|
|
|
8479
8519
|
_renderUISpec(e, a) {
|
|
8480
8520
|
const n = e.elements[e.root];
|
|
8481
8521
|
if (n?.type === "ProductSummaryCard") {
|
|
8482
|
-
const c =
|
|
8522
|
+
const c = he(n.props), l = he(c?.product) ?? c;
|
|
8483
8523
|
l && (this._currentInlineProductSummaryRecord = l);
|
|
8484
8524
|
}
|
|
8485
8525
|
const r = this._resolveUISpecRegistry(), i = this.config.renderer?.unknownRenderer ?? ga, o = (c, l) => Hr(c, l, r, i), s = this.config.renderer?.renderUISpec;
|