@gengage/assistant-fe 0.6.41 → 0.6.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chat-runtime.js +1 -1
- package/dist/chat.iife.js +14 -14
- package/dist/chat.js +1 -1
- package/dist/{common-RLXFcoOo.js → common-B9n_o9ki.js} +1 -1
- package/dist/common.js +5 -5
- package/dist/{connection-warning-C1LnYGUH.js → connection-warning-ByY3TKaG.js} +1 -1
- package/dist/{fastIntent-BivJoy3l.js → fastIntent-BaNC2CJz.js} +1 -1
- package/dist/index.js +10 -10
- package/dist/native.iife.js +10 -10
- package/dist/qna-runtime.js +1 -1
- package/dist/qna.iife.js +1 -1
- package/dist/qna.js +1 -1
- package/dist/{request-response-cache-CVgP72eC.js → request-response-cache-DkilqELR.js} +1 -1
- package/dist/{runtime-xuhF4izk.js → runtime-BkqUiRUi.js} +3 -3
- package/dist/{runtime-BemZwmk_.js → runtime-CmpEARET.js} +3 -3
- package/dist/{runtime-B0aSQBLM.js → runtime-_ly8XVXC.js} +1000 -992
- package/dist/{simbut-CJmAHE6w.js → simbut-CltMk2OF.js} +1 -1
- package/dist/simbut.iife.js +1 -1
- package/dist/simbut.js +1 -1
- package/dist/{simrel-CwuklQwH.js → simrel-BuCc53Pw.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-C3v87X91.js → widget-base-vDXD27_n.js} +1 -1
- package/package.json +1 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { c as
|
|
2
|
-
import { A as Ce, C as Ma, D as Na, E as Ba, M as pe, N as be, O as za, S as
|
|
3
|
-
import { i as ze, s as
|
|
4
|
-
import { d as he, f as Za, i as Xa, n as Qa, p as Ja, r as en, t as
|
|
1
|
+
import { c as Xt, f as Sa, g as Ea, i as Pa, l as Ta, m as La, n as Aa, t as Ia } from "./request-response-cache-DkilqELR.js";
|
|
2
|
+
import { A as Ce, C as Ma, D as Na, E as Ba, M as pe, N as be, O as za, S as yt, T as Ra, _ as Ha, a as _e, b as Fa, d as Da, f as Oa, g as Ua, h as ja, j as xe, l as qa, m as $a, p as Va, u as Ga, v as Wa, w as at, x as Ka } from "./context-UTzCGyR9.js";
|
|
3
|
+
import { i as ze, s as Qt, t as Ya } from "./widget-base-vDXD27_n.js";
|
|
4
|
+
import { d as he, f as Za, i as Xa, n as Qa, p as Ja, r as en, t as wt, u as tn } from "./fastIntent-BaNC2CJz.js";
|
|
5
5
|
import { t as Ue } from "./locale-uQ5XZ2yS.js";
|
|
6
|
-
import { a as
|
|
7
|
-
function
|
|
6
|
+
import { a as Jt, i as ea, n as ve, r as ta, t as oe } from "./price-formatter-CHUmYq8I.js";
|
|
7
|
+
function _t() {
|
|
8
8
|
const t = Date.now(), e = new Uint8Array(16);
|
|
9
9
|
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;
|
|
10
10
|
const a = Array.from(e, (n) => n.toString(16).padStart(2, "0")).join("");
|
|
@@ -100,7 +100,7 @@ function cn(t, e) {
|
|
|
100
100
|
const i = { is_launcher: 0 };
|
|
101
101
|
return t.title && (i.text = t.title, i.input = t.title), {
|
|
102
102
|
...t,
|
|
103
|
-
payload:
|
|
103
|
+
payload: Xt(r(i))
|
|
104
104
|
};
|
|
105
105
|
}
|
|
106
106
|
case "getComparisonTable": {
|
|
@@ -137,7 +137,7 @@ function cn(t, e) {
|
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
139
|
var ln = { user_message: "inputText" };
|
|
140
|
-
function
|
|
140
|
+
function aa(t) {
|
|
141
141
|
const { action: e, type: a, payload: n, ...r } = t, i = a ?? e?.type ?? "inputText", o = n ?? e?.payload, s = ln[i] ?? i, c = {
|
|
142
142
|
...r,
|
|
143
143
|
type: s
|
|
@@ -145,12 +145,12 @@ function ta(t) {
|
|
|
145
145
|
return o !== void 0 && (c.payload = typeof o == "string" ? { text: o } : o), JSON.stringify(c);
|
|
146
146
|
}
|
|
147
147
|
function gn(t) {
|
|
148
|
-
return JSON.parse(
|
|
148
|
+
return JSON.parse(aa(t));
|
|
149
149
|
}
|
|
150
150
|
function dn(t) {
|
|
151
151
|
return t !== null && (typeof t == "object" || typeof t == "function") && typeof t.then == "function";
|
|
152
152
|
}
|
|
153
|
-
function
|
|
153
|
+
function kt(t, e) {
|
|
154
154
|
let a = !1;
|
|
155
155
|
const n = () => e?.aborted === !0, r = () => a || n(), i = () => {
|
|
156
156
|
r() || (a = !0, t.onDone());
|
|
@@ -180,7 +180,7 @@ function _t(t, e) {
|
|
|
180
180
|
function pn(t, e, a) {
|
|
181
181
|
const n = new AbortController(), r = a.injectorAdapter ?? tn(a.accountId);
|
|
182
182
|
return r ? ((async () => {
|
|
183
|
-
const o =
|
|
183
|
+
const o = kt(e, n.signal);
|
|
184
184
|
try {
|
|
185
185
|
if (await Promise.resolve(), n.signal.aborted) return;
|
|
186
186
|
const s = r(gn(t), o.callbacks, n.signal, a.attachment);
|
|
@@ -191,7 +191,7 @@ function pn(t, e, a) {
|
|
|
191
191
|
}
|
|
192
192
|
})(), n) : ((async () => {
|
|
193
193
|
try {
|
|
194
|
-
const o = Aa("process_action", a), s =
|
|
194
|
+
const o = Aa("process_action", a), s = aa(t), c = a.attachment !== void 0;
|
|
195
195
|
let l;
|
|
196
196
|
if (c) {
|
|
197
197
|
const h = new FormData();
|
|
@@ -217,7 +217,7 @@ function pn(t, e, a) {
|
|
|
217
217
|
e.onError(/* @__PURE__ */ new Error(`HTTP ${d.status}: ${h}`));
|
|
218
218
|
return;
|
|
219
219
|
}
|
|
220
|
-
const p =
|
|
220
|
+
const p = kt(e);
|
|
221
221
|
await Sa(d, {
|
|
222
222
|
onEvent: (h) => {
|
|
223
223
|
const m = Pa(h);
|
|
@@ -284,15 +284,15 @@ function fn(t, e, a) {
|
|
|
284
284
|
const i = `[gengage-chat-debug #${n}][${t}] ${e}`;
|
|
285
285
|
a === void 0 ? console.debug(i) : console.debug(i, a);
|
|
286
286
|
}
|
|
287
|
-
var
|
|
288
|
-
function
|
|
287
|
+
var dt = "gengage-chat-scroll", Be = null;
|
|
288
|
+
function Ct(t) {
|
|
289
289
|
Be = t;
|
|
290
290
|
}
|
|
291
291
|
function Go() {
|
|
292
292
|
if (Be && Be.isConnected) return Be;
|
|
293
293
|
Be = null;
|
|
294
|
-
const t = document.getElementById(
|
|
295
|
-
return t || (fn("chat-scroll", "failed to resolve scroll container (not registered)", { id:
|
|
294
|
+
const t = document.getElementById(dt);
|
|
295
|
+
return t || (fn("chat-scroll", "failed to resolve scroll container (not registered)", { id: dt }), null);
|
|
296
296
|
}
|
|
297
297
|
function bn() {
|
|
298
298
|
Be = null;
|
|
@@ -635,7 +635,7 @@ function kn(t) {
|
|
|
635
635
|
skipLabel: typeof t.skip_label == "string" ? t.skip_label : void 0
|
|
636
636
|
};
|
|
637
637
|
}
|
|
638
|
-
function
|
|
638
|
+
function na(t, e, a) {
|
|
639
639
|
const n = t.props ?? {}, r = n.processing === !0, i = {
|
|
640
640
|
...Re,
|
|
641
641
|
...e.i18n ?? {}
|
|
@@ -668,7 +668,7 @@ function Sn(t, e, a, n, r) {
|
|
|
668
668
|
return t && (t.hidden = !0, t.innerHTML = ""), t;
|
|
669
669
|
const i = Cn(t, e);
|
|
670
670
|
i.hidden = !1, i.innerHTML = "";
|
|
671
|
-
const o =
|
|
671
|
+
const o = na({
|
|
672
672
|
type: "BeautyPhotoStep",
|
|
673
673
|
props: {
|
|
674
674
|
processing: a.processing ?? !1,
|
|
@@ -687,13 +687,13 @@ function Sn(t, e, a, n, r) {
|
|
|
687
687
|
});
|
|
688
688
|
return i.appendChild(o), i;
|
|
689
689
|
}
|
|
690
|
-
function
|
|
690
|
+
function ra(t) {
|
|
691
691
|
const e = typeof t.summary == "string" ? t.summary : "", a = Array.isArray(t.strengths) ? t.strengths.filter((c) => typeof c == "string") : [], n = Array.isArray(t.focus_points) ? t.focus_points.filter((c) => typeof c == "string") : [];
|
|
692
692
|
if (!e && a.length === 0 && n.length === 0) return null;
|
|
693
693
|
const r = { summary: e }, i = typeof t.celeb_style == "string" ? t.celeb_style : void 0, o = typeof t.celeb_style_reason == "string" ? t.celeb_style_reason : void 0, s = typeof t.next_question == "string" ? t.next_question : void 0;
|
|
694
694
|
return a.length > 0 && (r.strengths = a), n.length > 0 && (r.focusPoints = n), i && (r.celebStyle = i), o && (r.celebStyleReason = o), s && (r.nextQuestion = s), r;
|
|
695
695
|
}
|
|
696
|
-
function
|
|
696
|
+
function St(t, e, a) {
|
|
697
697
|
if (e.length === 0) return null;
|
|
698
698
|
const n = document.createElement("section");
|
|
699
699
|
n.className = `gengage-chat-photo-analysis-section ${a}`;
|
|
@@ -707,7 +707,7 @@ function Ct(t, e, a) {
|
|
|
707
707
|
}
|
|
708
708
|
return n.appendChild(r), n.appendChild(i), n;
|
|
709
709
|
}
|
|
710
|
-
function
|
|
710
|
+
function ia(t, e) {
|
|
711
711
|
const a = document.createElement("div");
|
|
712
712
|
a.className = "gengage-chat-photo-analysis-card";
|
|
713
713
|
const n = document.createElement("div");
|
|
@@ -719,7 +719,7 @@ function ra(t, e) {
|
|
|
719
719
|
}
|
|
720
720
|
const i = document.createElement("div");
|
|
721
721
|
i.className = "gengage-chat-photo-analysis-highlights";
|
|
722
|
-
const o =
|
|
722
|
+
const o = St(t.strengths, e.strengths ?? [], "gengage-chat-photo-analysis-section--strengths"), s = St(t.focus, e.focusPoints ?? [], "gengage-chat-photo-analysis-section--focus");
|
|
723
723
|
if (o && i.appendChild(o), s && i.appendChild(s), i.childElementCount > 0 && r.appendChild(i), e.celebStyle) {
|
|
724
724
|
const c = document.createElement("section");
|
|
725
725
|
c.className = "gengage-chat-photo-analysis-section gengage-chat-photo-analysis-section--celeb";
|
|
@@ -751,18 +751,18 @@ function En(t) {
|
|
|
751
751
|
};
|
|
752
752
|
}
|
|
753
753
|
function Pn(t, e) {
|
|
754
|
-
const a =
|
|
755
|
-
return
|
|
754
|
+
const a = ra(t.props ?? {}) ?? { summary: "" };
|
|
755
|
+
return ia(En(e), a);
|
|
756
756
|
}
|
|
757
757
|
function Tn(t, e, a) {
|
|
758
|
-
t.innerHTML = "", a && t.appendChild(
|
|
758
|
+
t.innerHTML = "", a && t.appendChild(ia(e, a));
|
|
759
759
|
}
|
|
760
|
-
var
|
|
760
|
+
var Et = '<svg viewBox="0 0 16 16" class="gengage-chat-icon"><path d="M3 8h10M9 4l4 4-4 4" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>', Pt = {
|
|
761
761
|
search: '<svg viewBox="0 0 16 16" class="gengage-chat-icon"><circle cx="6.5" cy="6.5" r="5" fill="none" stroke="currentColor" stroke-width="1.5"/><line x1="10" y1="10" x2="15" y2="15" stroke="currentColor" stroke-width="1.5"/></svg>',
|
|
762
762
|
review: '<svg viewBox="0 0 16 16" class="gengage-chat-icon"><polygon points="8,1 10,6 15,6 11,9 12.5,14 8,11 3.5,14 5,9 1,6 6,6" fill="none" stroke="currentColor" stroke-width="1.5"/></svg>',
|
|
763
763
|
info: '<svg viewBox="0 0 16 16" class="gengage-chat-icon"><circle cx="8" cy="8" r="7" fill="none" stroke="currentColor" stroke-width="1.5"/><line x1="8" y1="7" x2="8" y2="12" stroke="currentColor" stroke-width="1.5"/><circle cx="8" cy="4.5" r="0.8" fill="currentColor"/></svg>',
|
|
764
764
|
similar: '<svg viewBox="0 0 16 16" class="gengage-chat-icon"><rect x="1" y="3" width="6" height="6" rx="1" fill="none" stroke="currentColor" stroke-width="1.5"/><rect x="9" y="3" width="6" height="6" rx="1" fill="none" stroke="currentColor" stroke-width="1.5"/></svg>'
|
|
765
|
-
}, Ln = Re, An = 1400,
|
|
765
|
+
}, Ln = Re, An = 1400, Tt = 1500, In = /data:image\/(png|jpeg|jpg|webp);base64,[A-Za-z0-9+/=]+/gi;
|
|
766
766
|
async function Mn(t) {
|
|
767
767
|
for (const e of t) for (const a of e.types)
|
|
768
768
|
if (a.startsWith("image/"))
|
|
@@ -866,38 +866,38 @@ var Bn = class {
|
|
|
866
866
|
if (x.className = "gengage-chat-close gds-btn gds-btn-ghost gds-icon-btn", x.dataset.gengagePart = "chat-header-close", x.type = "button", x.setAttribute("aria-label", this.i18n.closeButton), x.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>', x.addEventListener("click", e.onClose), e.showHeaderFavorites) {
|
|
867
867
|
const w = document.createElement("button");
|
|
868
868
|
w.className = "gengage-chat-header-btn gengage-chat-header-btn--fav gds-btn gds-btn-ghost gds-icon-btn", w.dataset.gengagePart = "chat-header-favorites", w.type = "button", w.setAttribute("aria-label", this.i18n.favoritesAriaLabel), w.innerHTML = '<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"/></svg>';
|
|
869
|
-
const
|
|
870
|
-
|
|
869
|
+
const Q = document.createElement("span");
|
|
870
|
+
Q.className = "gengage-chat-header-fav-badge", Q.dataset.gengagePart = "chat-header-favorites-badge", Q.setAttribute("aria-hidden", "true"), Q.style.display = "none", w.appendChild(Q), this._favBadgeEl = Q, w.addEventListener("click", () => {
|
|
871
871
|
e.onFavoritesClick?.();
|
|
872
872
|
}), m.appendChild(w);
|
|
873
873
|
}
|
|
874
874
|
m.appendChild(x), r && i.insertBefore(r, i.firstChild), i.appendChild(m);
|
|
875
875
|
{
|
|
876
|
-
let
|
|
877
|
-
const
|
|
878
|
-
if (!(this._options.getMobileViewport?.() ?? window.innerWidth <= 768) ||
|
|
879
|
-
const K =
|
|
880
|
-
K && (
|
|
881
|
-
},
|
|
882
|
-
if (!
|
|
883
|
-
const K =
|
|
876
|
+
let Q = 0, ie = 0, A = !1;
|
|
877
|
+
const z = ($) => {
|
|
878
|
+
if (!(this._options.getMobileViewport?.() ?? window.innerWidth <= 768) || $.target.closest('button, a, input, [role="button"]')) return;
|
|
879
|
+
const K = $.changedTouches?.[0];
|
|
880
|
+
K && (Q = K.clientY, ie = 0, A = !0, this.root.style.transition = "none");
|
|
881
|
+
}, ee = ($) => {
|
|
882
|
+
if (!A) return;
|
|
883
|
+
const K = $.changedTouches?.[0];
|
|
884
884
|
if (!K) return;
|
|
885
|
-
|
|
886
|
-
const
|
|
887
|
-
|
|
888
|
-
},
|
|
889
|
-
if (!
|
|
890
|
-
|
|
891
|
-
const
|
|
885
|
+
ie = K.clientY - Q;
|
|
886
|
+
const ae = (e.getMobileState?.() ?? "full") === "full" ? Math.max(0, ie) : ie;
|
|
887
|
+
$.preventDefault(), this.root.style.transform = `translateY(${ae}px)`;
|
|
888
|
+
}, le = () => {
|
|
889
|
+
if (!A) return;
|
|
890
|
+
A = !1;
|
|
891
|
+
const $ = e.getMobileState?.() ?? "full";
|
|
892
892
|
let K;
|
|
893
|
-
|
|
893
|
+
ie > 72 ? K = $ === "full" ? "half" : "close" : ie < -72 && $ === "half" ? K = "full" : K = $, this.root.style.transition = "", K === "close" ? (this.root.style.transform = "translateY(100%)", setTimeout(() => {
|
|
894
894
|
this.root.style.transform = "", e.onMobileSnap?.("close");
|
|
895
|
-
}, 280)) : (this.root.style.transform = "", e.onMobileSnap?.(K)),
|
|
895
|
+
}, 280)) : (this.root.style.transform = "", e.onMobileSnap?.(K)), ie = 0;
|
|
896
896
|
}, Z = () => {
|
|
897
|
-
|
|
897
|
+
A && (A = !1, ie = 0, this.root.style.transition = "", this.root.style.transform = "");
|
|
898
898
|
};
|
|
899
|
-
i.addEventListener("touchstart",
|
|
900
|
-
i.removeEventListener("touchstart",
|
|
899
|
+
i.addEventListener("touchstart", z, { passive: !0 }), i.addEventListener("touchmove", ee, { passive: !1 }), i.addEventListener("touchend", le, { passive: !0 }), i.addEventListener("touchcancel", Z, { passive: !0 }), this._cleanups.push(() => {
|
|
900
|
+
i.removeEventListener("touchstart", z), i.removeEventListener("touchmove", ee), i.removeEventListener("touchend", le), i.removeEventListener("touchcancel", Z);
|
|
901
901
|
});
|
|
902
902
|
}
|
|
903
903
|
const v = document.createElement("div");
|
|
@@ -922,63 +922,63 @@ var Bn = class {
|
|
|
922
922
|
this.togglePanel(), this._onPanelToggle?.();
|
|
923
923
|
});
|
|
924
924
|
let _ = null, y = null;
|
|
925
|
-
const b = 24,
|
|
925
|
+
const b = 24, L = (w) => {
|
|
926
926
|
if (!(this._options.getMobileViewport?.() ?? window.innerWidth <= 768)) return;
|
|
927
|
-
const
|
|
928
|
-
|
|
927
|
+
const Q = w.changedTouches?.[0];
|
|
928
|
+
Q && (_ = Q.clientX, y = Q.clientY);
|
|
929
929
|
}, M = (w) => {
|
|
930
930
|
if (!(this._options.getMobileViewport?.() ?? window.innerWidth <= 768) || _ === null || y === null) return;
|
|
931
|
-
const
|
|
932
|
-
if (!
|
|
933
|
-
const
|
|
934
|
-
if (_ = null, y = null, Math.abs(
|
|
935
|
-
const
|
|
936
|
-
|
|
931
|
+
const Q = w.changedTouches?.[0];
|
|
932
|
+
if (!Q) return;
|
|
933
|
+
const ie = Q.clientX - _, A = Q.clientY - y;
|
|
934
|
+
if (_ = null, y = null, Math.abs(A) < b || Math.abs(A) < Math.abs(ie)) return;
|
|
935
|
+
const z = A < 0;
|
|
936
|
+
z !== this._panelCollapsed && (this._ignoreNextDividerClick = !0, this.setPanelCollapsed(z), this._onPanelToggle?.());
|
|
937
937
|
};
|
|
938
|
-
this._dividerEl.addEventListener("touchstart",
|
|
939
|
-
this._dividerEl.removeEventListener("touchstart",
|
|
938
|
+
this._dividerEl.addEventListener("touchstart", L, { passive: !0 }), this._dividerEl.addEventListener("touchend", M, { passive: !0 }), this._cleanups.push(() => {
|
|
939
|
+
this._dividerEl.removeEventListener("touchstart", L), this._dividerEl.removeEventListener("touchend", M);
|
|
940
940
|
}), this._dividerEl.appendChild(g), v.appendChild(this._dividerEl);
|
|
941
941
|
const k = document.createElement("div");
|
|
942
942
|
k.className = "gengage-chat-conversation", k.dataset.gengagePart = "chat-conversation", this._conversationEl = k, k.appendChild(i);
|
|
943
|
-
const
|
|
944
|
-
|
|
945
|
-
const
|
|
946
|
-
window.addEventListener("offline",
|
|
947
|
-
window.removeEventListener("offline",
|
|
948
|
-
}), this._kvkkSlot = document.createElement("div"), this._kvkkSlot.className = "gengage-chat-kvkk-slot", this._kvkkSlot.dataset.gengagePart = "chat-kvkk-slot", k.appendChild(this._kvkkSlot), this.messagesEl = document.createElement("div"), this.messagesEl.id =
|
|
943
|
+
const E = document.createElement("div");
|
|
944
|
+
E.className = "gengage-chat-offline-bar gds-evidence-card gds-evidence-card-warning", E.dataset.gengagePart = "chat-offline-bar", E.setAttribute("role", "status"), E.setAttribute("aria-live", "polite"), E.textContent = this.i18n.offlineMessage, typeof navigator < "u" && !navigator.onLine && E.classList.add("gengage-chat-offline-bar--visible"), k.appendChild(E);
|
|
945
|
+
const R = () => E.classList.add("gengage-chat-offline-bar--visible"), G = () => E.classList.remove("gengage-chat-offline-bar--visible");
|
|
946
|
+
window.addEventListener("offline", R), window.addEventListener("online", G), this._cleanups.push(() => {
|
|
947
|
+
window.removeEventListener("offline", R), window.removeEventListener("online", G);
|
|
948
|
+
}), this._kvkkSlot = document.createElement("div"), this._kvkkSlot.className = "gengage-chat-kvkk-slot", this._kvkkSlot.dataset.gengagePart = "chat-kvkk-slot", k.appendChild(this._kvkkSlot), this.messagesEl = document.createElement("div"), this.messagesEl.id = dt, this.messagesEl.className = "gengage-chat-messages", this.messagesEl.dataset.gengagePart = "chat-messages", this.messagesEl.setAttribute("role", "log"), this.messagesEl.setAttribute("aria-live", "polite"), this.messagesEl.setAttribute("aria-atomic", "false"), this.messagesEl.setAttribute("aria-label", this.i18n.chatMessagesAriaLabel), Ct(this.messagesEl);
|
|
949
949
|
const W = document.createElement("button");
|
|
950
950
|
W.type = "button", W.className = "gengage-chat-former-messages-btn gds-chip", W.dataset.gengagePart = "chat-former-messages-button", W.textContent = this.i18n.showFormerMessagesButton, W.setAttribute("aria-label", this.i18n.showFormerMessagesButton), W.style.display = "none", W.addEventListener("click", () => {
|
|
951
951
|
this._options.presentation?.onReleasePresentationFocus?.();
|
|
952
952
|
}), this.messagesEl.appendChild(W), this._formerMessagesBtn = W;
|
|
953
|
-
const
|
|
953
|
+
const P = () => {
|
|
954
954
|
this._userInteractionUntil = Date.now() + 2e3;
|
|
955
955
|
};
|
|
956
956
|
let H = !1;
|
|
957
957
|
const D = () => this._options.presentation, N = () => {
|
|
958
958
|
H || (H = !0, requestAnimationFrame(() => {
|
|
959
959
|
H = !1;
|
|
960
|
-
const { scrollTop: w, scrollHeight:
|
|
961
|
-
this._userScrolledUp =
|
|
962
|
-
const
|
|
963
|
-
|
|
960
|
+
const { scrollTop: w, scrollHeight: Q, clientHeight: ie } = this.messagesEl, A = Q - w - ie;
|
|
961
|
+
this._userScrolledUp = A > 10;
|
|
962
|
+
const z = this._presentationPinned ? A < 96 : A < 32, ee = Date.now(), le = ee < this._programmaticScrollUntil, Z = !z && ee < this._userInteractionUntil, $ = le ? !1 : Z;
|
|
963
|
+
z !== this._presentationPinned && (this._presentationPinned = z, D()?.onPinnedToBottomChange?.(z)), $ !== this._presentationUserInteracting && (this._presentationUserInteracting = $, D()?.onUserInteractingChange?.($));
|
|
964
964
|
}));
|
|
965
965
|
};
|
|
966
966
|
this.messagesEl.addEventListener("scroll", N, { passive: !0 }), this._cleanups.push(() => {
|
|
967
967
|
this.messagesEl.removeEventListener("scroll", N);
|
|
968
968
|
});
|
|
969
969
|
const C = (w) => {
|
|
970
|
-
|
|
970
|
+
P(), w.deltaY < -6 && this._presentationFocusThreadId && this._options.presentation?.onFormerMessagesHint?.();
|
|
971
971
|
};
|
|
972
972
|
this.messagesEl.addEventListener("wheel", C, { passive: !0 }), this._cleanups.push(() => this.messagesEl.removeEventListener("wheel", C));
|
|
973
|
-
const
|
|
974
|
-
|
|
975
|
-
},
|
|
976
|
-
|
|
977
|
-
const
|
|
978
|
-
typeof
|
|
973
|
+
const U = (w) => {
|
|
974
|
+
P(), this._touchStartY = w.touches[0]?.clientY ?? null;
|
|
975
|
+
}, B = (w) => {
|
|
976
|
+
P();
|
|
977
|
+
const Q = w.touches[0]?.clientY, ie = this._touchStartY;
|
|
978
|
+
typeof Q == "number" && typeof ie == "number" && Q - ie > 10 && this._presentationFocusThreadId && this._options.presentation?.onFormerMessagesHint?.();
|
|
979
979
|
};
|
|
980
|
-
this.messagesEl.addEventListener("touchstart",
|
|
981
|
-
this.messagesEl.removeEventListener("touchstart",
|
|
980
|
+
this.messagesEl.addEventListener("touchstart", U, { passive: !0 }), this.messagesEl.addEventListener("touchmove", B, { passive: !0 }), this._cleanups.push(() => {
|
|
981
|
+
this.messagesEl.removeEventListener("touchstart", U), this.messagesEl.removeEventListener("touchmove", B);
|
|
982
982
|
}), k.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";
|
|
983
983
|
const j = document.createElement("div");
|
|
984
984
|
j.className = "gengage-chat-pills-scroll", j.dataset.gengagePart = "chat-suggestion-pills-scroll", this._pillsEl.appendChild(j);
|
|
@@ -989,10 +989,10 @@ var Bn = class {
|
|
|
989
989
|
behavior: "smooth"
|
|
990
990
|
});
|
|
991
991
|
}), this._pillsEl.appendChild(F);
|
|
992
|
-
let
|
|
992
|
+
let ne = !1;
|
|
993
993
|
const X = () => {
|
|
994
|
-
|
|
995
|
-
|
|
994
|
+
ne || (ne = !0, requestAnimationFrame(() => {
|
|
995
|
+
ne = !1;
|
|
996
996
|
const w = j.scrollLeft + j.clientWidth >= j.scrollWidth - 4;
|
|
997
997
|
F.style.display = w ? "none" : "";
|
|
998
998
|
}));
|
|
@@ -1008,50 +1008,50 @@ var Bn = class {
|
|
|
1008
1008
|
}), this.inputEl.addEventListener("keydown", (w) => {
|
|
1009
1009
|
w.key === "Enter" && !w.isComposing && ((this._options.getMobileViewport?.() ?? window.innerWidth <= 768) || !w.shiftKey) && (w.preventDefault(), this._submit());
|
|
1010
1010
|
}), this.inputEl.addEventListener("paste", (w) => {
|
|
1011
|
-
const
|
|
1012
|
-
if (!
|
|
1013
|
-
let
|
|
1014
|
-
const
|
|
1015
|
-
if (
|
|
1016
|
-
else if (
|
|
1017
|
-
const
|
|
1018
|
-
if (
|
|
1019
|
-
const
|
|
1020
|
-
if (
|
|
1021
|
-
|
|
1011
|
+
const Q = w.clipboardData;
|
|
1012
|
+
if (!Q) return;
|
|
1013
|
+
let ie = null;
|
|
1014
|
+
const A = Q.files?.[0];
|
|
1015
|
+
if (A && A.type.startsWith("image/")) ie = A;
|
|
1016
|
+
else if (Q.items?.length) for (let z = 0; z < Q.items.length; z++) {
|
|
1017
|
+
const ee = Q.items[z];
|
|
1018
|
+
if (ee?.kind === "file" && ee.type.startsWith("image/")) {
|
|
1019
|
+
const le = ee.getAsFile();
|
|
1020
|
+
if (le) {
|
|
1021
|
+
ie = le;
|
|
1022
1022
|
break;
|
|
1023
1023
|
}
|
|
1024
1024
|
}
|
|
1025
1025
|
}
|
|
1026
|
-
|
|
1026
|
+
ie && (w.preventDefault(), this._routeAttachmentFile(ie));
|
|
1027
1027
|
}), 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", () => {
|
|
1028
1028
|
const w = this._fileInput.files?.[0];
|
|
1029
1029
|
w && this._routeAttachmentFile(w), this._fileInput.value = "";
|
|
1030
1030
|
});
|
|
1031
1031
|
const f = document.createElement("div");
|
|
1032
1032
|
f.className = "gengage-chat-attach-wrap", f.dataset.gengagePart = "chat-attach-wrap", this._attachWrapEl = f;
|
|
1033
|
-
const
|
|
1034
|
-
this._attachBtn =
|
|
1033
|
+
const S = document.createElement("button");
|
|
1034
|
+
this._attachBtn = S, S.className = "gengage-chat-attach-btn gds-btn gds-btn-ghost", S.dataset.gengagePart = "chat-attach-button", S.type = "button", S.setAttribute("aria-label", this.i18n.attachImageButton), S.setAttribute("aria-haspopup", "menu"), S.setAttribute("aria-expanded", "false"), S.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>', S.addEventListener("click", (w) => {
|
|
1035
1035
|
w.stopPropagation(), this._toggleAttachMenu();
|
|
1036
1036
|
});
|
|
1037
1037
|
const T = document.createElement("div");
|
|
1038
1038
|
this._attachMenuEl = T, T.className = "gengage-chat-attach-menu gds-menu", T.dataset.gengagePart = "chat-attach-menu", T.setAttribute("role", "menu"), T.setAttribute("hidden", "");
|
|
1039
|
-
const
|
|
1040
|
-
|
|
1039
|
+
const q = document.createElement("button");
|
|
1040
|
+
q.type = "button", q.className = "gengage-chat-attach-menu-item gds-btn gds-btn-ghost", q.dataset.gengagePart = "chat-attach-menu-select-photo", q.setAttribute("role", "menuitem"), q.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>`, q.addEventListener("click", (w) => {
|
|
1041
1041
|
w.stopPropagation(), this._closeAttachMenu(), this._fileInput.click();
|
|
1042
1042
|
});
|
|
1043
1043
|
const I = document.createElement("div");
|
|
1044
1044
|
I.className = "gengage-chat-attach-menu-sep", I.dataset.gengagePart = "chat-attach-menu-separator", I.setAttribute("aria-hidden", "true");
|
|
1045
|
-
const
|
|
1046
|
-
|
|
1045
|
+
const O = document.createElement("button");
|
|
1046
|
+
O.type = "button", O.className = "gengage-chat-attach-menu-item gds-btn gds-btn-ghost", O.dataset.gengagePart = "chat-attach-menu-paste", O.setAttribute("role", "menuitem"), O.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>`, O.addEventListener("click", (w) => {
|
|
1047
1047
|
w.stopPropagation();
|
|
1048
|
-
const
|
|
1049
|
-
this._pasteImageFromClipboardMenu(
|
|
1050
|
-
}), T.appendChild(
|
|
1051
|
-
const
|
|
1052
|
-
|
|
1053
|
-
const
|
|
1054
|
-
|
|
1048
|
+
const Q = typeof navigator.clipboard?.read == "function" ? navigator.clipboard.read() : void 0;
|
|
1049
|
+
this._pasteImageFromClipboardMenu(Q);
|
|
1050
|
+
}), T.appendChild(q), T.appendChild(I), T.appendChild(O), f.appendChild(S), f.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";
|
|
1051
|
+
const J = document.createElement("img");
|
|
1052
|
+
J.className = "gengage-chat-attachment-preview-thumb", J.dataset.gengagePart = "chat-attachment-preview-thumb", J.alt = "", this._previewName = document.createElement("span"), this._previewName.className = "gengage-chat-attachment-name", this._previewName.dataset.gengagePart = "chat-attachment-preview-name";
|
|
1053
|
+
const re = document.createElement("button");
|
|
1054
|
+
re.className = "gengage-chat-attachment-remove gds-btn gds-btn-ghost", re.dataset.gengagePart = "chat-attachment-preview-remove", re.type = "button", re.setAttribute("aria-label", this.i18n.removeAttachmentButton), re.textContent = "×", re.addEventListener("click", () => this.clearAttachment()), this._previewStrip.appendChild(J), this._previewStrip.appendChild(this._previewName), this._previewStrip.appendChild(re), 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", () => {
|
|
1055
1055
|
if (this._sendStopHandler) {
|
|
1056
1056
|
const w = this._sendStopHandler;
|
|
1057
1057
|
this.hideStopButton(), w();
|
|
@@ -1064,8 +1064,8 @@ var Bn = class {
|
|
|
1064
1064
|
V.classList.remove("gengage-chat-input-area--dragover");
|
|
1065
1065
|
}), V.addEventListener("drop", (w) => {
|
|
1066
1066
|
w.preventDefault(), V.classList.remove("gengage-chat-input-area--dragover");
|
|
1067
|
-
const
|
|
1068
|
-
|
|
1067
|
+
const Q = w.dataTransfer?.files[0];
|
|
1068
|
+
Q && this._routeAttachmentFile(Q);
|
|
1069
1069
|
});
|
|
1070
1070
|
const te = document.createElement("div");
|
|
1071
1071
|
te.className = "gengage-chat-input-pill gds-input-shell", te.dataset.gengagePart = "chat-input-shell", te.appendChild(f), te.appendChild(this.inputEl), this._voiceEnabled && Xa() && (this._micBtn = document.createElement("button"), this._micBtn.className = "gengage-chat-mic-btn gds-btn gds-btn-ghost", this._micBtn.dataset.gengagePart = "chat-mic-button", this._micBtn.type = "button", this._micBtn.setAttribute("aria-label", this.i18n.voiceButton), this._micBtn.innerHTML = '<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z"/><path d="M19 10v2a7 7 0 0 1-14 0v-2"/><line x1="12" y1="19" x2="12" y2="23"/><line x1="8" y1="23" x2="16" y2="23"/></svg>', this._micBtn.addEventListener("click", () => this._toggleVoice()), te.appendChild(this._micBtn), this._voiceInput = new en({
|
|
@@ -1081,12 +1081,12 @@ var Bn = class {
|
|
|
1081
1081
|
onStateChange: (w) => {
|
|
1082
1082
|
w === "listening" ? this._micBtn?.classList.add("gengage-chat-mic-btn--active") : this._micBtn?.classList.remove("gengage-chat-mic-btn--active");
|
|
1083
1083
|
},
|
|
1084
|
-
onError: (w,
|
|
1084
|
+
onError: (w, Q) => {
|
|
1085
1085
|
this._micBtn?.classList.remove("gengage-chat-mic-btn--active");
|
|
1086
1086
|
}
|
|
1087
1087
|
}, { lang: this._voiceLang })), te.appendChild(this.sendBtn), V.appendChild(this._previewStrip), V.appendChild(this._fileInput), V.appendChild(te), k.appendChild(V), v.appendChild(k), this._comparisonDockSlotEl = document.createElement("div"), this._comparisonDockSlotEl.className = "gengage-chat-comparison-dock-slot", this._comparisonDockSlotEl.dataset.gengagePart = "comparison-dock-slot", v.appendChild(this._comparisonDockSlotEl), this.root.appendChild(v), this._setupHorizontalSwipe(k);
|
|
1088
|
-
const
|
|
1089
|
-
|
|
1088
|
+
const se = document.createElement("div");
|
|
1089
|
+
se.className = "gengage-chat-footer", se.dataset.gengagePart = "chat-footer", se.textContent = this.i18n.poweredBy, this.root.appendChild(se);
|
|
1090
1090
|
const ce = (w) => {
|
|
1091
1091
|
w.key === "Escape" && e.onClose();
|
|
1092
1092
|
};
|
|
@@ -1201,7 +1201,7 @@ var Bn = class {
|
|
|
1201
1201
|
for (const n of t) {
|
|
1202
1202
|
const r = document.createElement("button");
|
|
1203
1203
|
if (r.className = n.image ? "gengage-chat-pill gds-chip gds-chip-active gengage-chat-pill--rich" : "gengage-chat-pill gds-chip gds-chip-active", r.type = "button", n.icon) {
|
|
1204
|
-
const o =
|
|
1204
|
+
const o = Pt[n.icon] ?? Et, s = document.createElement("span");
|
|
1205
1205
|
s.className = "gengage-chat-pill-icon", s.innerHTML = o, r.appendChild(s);
|
|
1206
1206
|
}
|
|
1207
1207
|
if (n.image && Ce(n.image)) {
|
|
@@ -1432,8 +1432,8 @@ var Bn = class {
|
|
|
1432
1432
|
const d = document.createElement("div");
|
|
1433
1433
|
d.className = "gengage-chat-comparison-recommended-info";
|
|
1434
1434
|
for (let k = 0; k < 2; k++) {
|
|
1435
|
-
const
|
|
1436
|
-
|
|
1435
|
+
const E = document.createElement("div");
|
|
1436
|
+
E.className = "gengage-chat-comparison-skeleton-shimmer gengage-chat-comparison-skeleton-rec-title", k === 1 && E.classList.add("gengage-chat-comparison-skeleton-rec-title--short"), d.appendChild(E);
|
|
1437
1437
|
}
|
|
1438
1438
|
const p = document.createElement("div");
|
|
1439
1439
|
p.className = "gengage-chat-comparison-skeleton-shimmer gengage-chat-comparison-skeleton-rec-price", d.appendChild(p), c.appendChild(l), c.appendChild(d), o.appendChild(c);
|
|
@@ -1444,8 +1444,8 @@ var Bn = class {
|
|
|
1444
1444
|
const x = document.createElement("ul");
|
|
1445
1445
|
x.className = "gengage-chat-comparison-skeleton-hl-list";
|
|
1446
1446
|
for (let k = 0; k < 3; k++) {
|
|
1447
|
-
const
|
|
1448
|
-
|
|
1447
|
+
const E = document.createElement("li"), R = document.createElement("div");
|
|
1448
|
+
R.className = "gengage-chat-comparison-skeleton-shimmer gengage-chat-comparison-skeleton-hl-line", k === 1 && R.classList.add("gengage-chat-comparison-skeleton-hl-line--medium"), k === 2 && R.classList.add("gengage-chat-comparison-skeleton-hl-line--short"), E.appendChild(R), x.appendChild(E);
|
|
1449
1449
|
}
|
|
1450
1450
|
h.appendChild(x), o.appendChild(h), i.appendChild(o);
|
|
1451
1451
|
const v = document.createElement("div");
|
|
@@ -1455,8 +1455,8 @@ var Bn = class {
|
|
|
1455
1455
|
const g = document.createElement("div");
|
|
1456
1456
|
g.className = "gengage-chat-comparison-key-differences-content";
|
|
1457
1457
|
for (let k = 0; k < 4; k++) {
|
|
1458
|
-
const
|
|
1459
|
-
|
|
1458
|
+
const E = document.createElement("div");
|
|
1459
|
+
E.className = "gengage-chat-comparison-skeleton-shimmer gengage-chat-comparison-skeleton-kd-line", g.appendChild(E);
|
|
1460
1460
|
}
|
|
1461
1461
|
v.appendChild(g), i.appendChild(v);
|
|
1462
1462
|
const _ = document.createElement("div");
|
|
@@ -1465,31 +1465,31 @@ var Bn = class {
|
|
|
1465
1465
|
y.className = "gengage-chat-comparison-skeleton-shimmer gengage-chat-comparison-skeleton-special-line", _.appendChild(y), i.appendChild(_);
|
|
1466
1466
|
const b = document.createElement("div");
|
|
1467
1467
|
b.className = "gengage-chat-comparison-skeleton-table-wrap";
|
|
1468
|
-
const
|
|
1469
|
-
|
|
1468
|
+
const L = document.createElement("div");
|
|
1469
|
+
L.className = "gengage-chat-comparison-skeleton-table-head";
|
|
1470
1470
|
const M = document.createElement("div");
|
|
1471
|
-
M.className = "gengage-chat-comparison-skeleton-table-corner",
|
|
1471
|
+
M.className = "gengage-chat-comparison-skeleton-table-corner", L.appendChild(M);
|
|
1472
1472
|
for (let k = 0; k < 3; k++) {
|
|
1473
|
-
const
|
|
1474
|
-
|
|
1475
|
-
const
|
|
1476
|
-
|
|
1473
|
+
const E = document.createElement("div");
|
|
1474
|
+
E.className = "gengage-chat-comparison-skeleton-table-col";
|
|
1475
|
+
const R = document.createElement("div");
|
|
1476
|
+
R.className = "gengage-chat-comparison-skeleton-shimmer gengage-chat-comparison-skeleton-table-th-img";
|
|
1477
1477
|
const G = document.createElement("div");
|
|
1478
1478
|
G.className = "gengage-chat-comparison-skeleton-shimmer gengage-chat-comparison-skeleton-table-th-name";
|
|
1479
1479
|
const W = document.createElement("div");
|
|
1480
|
-
W.className = "gengage-chat-comparison-skeleton-shimmer gengage-chat-comparison-skeleton-table-th-price",
|
|
1480
|
+
W.className = "gengage-chat-comparison-skeleton-shimmer gengage-chat-comparison-skeleton-table-th-price", E.appendChild(R), E.appendChild(G), E.appendChild(W), L.appendChild(E);
|
|
1481
1481
|
}
|
|
1482
|
-
b.appendChild(
|
|
1482
|
+
b.appendChild(L);
|
|
1483
1483
|
for (let k = 0; k < 3; k++) {
|
|
1484
|
-
const
|
|
1485
|
-
|
|
1486
|
-
const
|
|
1487
|
-
|
|
1484
|
+
const E = document.createElement("div");
|
|
1485
|
+
E.className = "gengage-chat-comparison-skeleton-table-row";
|
|
1486
|
+
const R = document.createElement("div");
|
|
1487
|
+
R.className = "gengage-chat-comparison-skeleton-shimmer gengage-chat-comparison-skeleton-table-label", E.appendChild(R);
|
|
1488
1488
|
for (let G = 0; G < 3; G++) {
|
|
1489
1489
|
const W = document.createElement("div");
|
|
1490
|
-
W.className = "gengage-chat-comparison-skeleton-shimmer gengage-chat-comparison-skeleton-table-cell",
|
|
1490
|
+
W.className = "gengage-chat-comparison-skeleton-shimmer gengage-chat-comparison-skeleton-table-cell", E.appendChild(W);
|
|
1491
1491
|
}
|
|
1492
|
-
b.appendChild(
|
|
1492
|
+
b.appendChild(E);
|
|
1493
1493
|
}
|
|
1494
1494
|
i.appendChild(b), e.appendChild(i);
|
|
1495
1495
|
break;
|
|
@@ -1718,7 +1718,7 @@ var Bn = class {
|
|
|
1718
1718
|
}
|
|
1719
1719
|
if (r || (r = i), !r) return !1;
|
|
1720
1720
|
const o = Date.now();
|
|
1721
|
-
this._programmaticScrollUntil = o +
|
|
1721
|
+
this._programmaticScrollUntil = o + Tt, this._scrollLockedUntil = Math.max(this._scrollLockedUntil, o + Tt), this._userScrolledUp = !0;
|
|
1722
1722
|
const s = () => {
|
|
1723
1723
|
this._scrollMessagesTo(Math.max(r.offsetTop - 20, 0), e);
|
|
1724
1724
|
};
|
|
@@ -1767,7 +1767,7 @@ var Bn = class {
|
|
|
1767
1767
|
for (const e of t) {
|
|
1768
1768
|
const a = document.createElement("button");
|
|
1769
1769
|
if (a.className = "gengage-chat-input-chip gds-chip", a.type = "button", e.icon) {
|
|
1770
|
-
const r =
|
|
1770
|
+
const r = Pt[e.icon] ?? Et, i = document.createElement("span");
|
|
1771
1771
|
i.className = "gengage-chat-input-chip-icon", i.innerHTML = r, a.appendChild(i);
|
|
1772
1772
|
}
|
|
1773
1773
|
const n = document.createElement("span");
|
|
@@ -1820,16 +1820,16 @@ var Bn = class {
|
|
|
1820
1820
|
}, n));
|
|
1821
1821
|
}
|
|
1822
1822
|
destroy() {
|
|
1823
|
-
|
|
1823
|
+
Ct(null), this.releaseFocus(), this._resizeRafId !== null && (cancelAnimationFrame(this._resizeRafId), this._resizeRafId = null), this._destroyLoadingBinding(this._typingLoadingBinding), this._typingLoadingBinding = null, this._destroyLoadingBinding(this._panelLoadingBinding), this._panelLoadingBinding = null, this._destroyLoadingBinding(this._panelAiZoneLoadingBinding), this._panelAiZoneLoadingBinding = null, this.hideCartToast(), this._closeAttachMenu();
|
|
1824
1824
|
for (const t of this._cleanups) t();
|
|
1825
1825
|
this._cleanups.length = 0, this._voiceInput?.destroy(), this._voiceInput = null;
|
|
1826
1826
|
}
|
|
1827
1827
|
}, zn = ["shopping", "beauty_consulting", "account_expert"];
|
|
1828
|
-
function
|
|
1828
|
+
function oa(t) {
|
|
1829
1829
|
return t === "watch_expert" ? "account_expert" : zn.includes(t) ? t : null;
|
|
1830
1830
|
}
|
|
1831
1831
|
function Rn(t) {
|
|
1832
|
-
return typeof t == "string" ?
|
|
1832
|
+
return typeof t == "string" ? oa(t) : null;
|
|
1833
1833
|
}
|
|
1834
1834
|
function ue(t) {
|
|
1835
1835
|
return t == null || typeof t != "object" || Array.isArray(t) ? null : t;
|
|
@@ -1845,7 +1845,7 @@ function Fn(t) {
|
|
|
1845
1845
|
if (!e) return null;
|
|
1846
1846
|
const a = Hn(e.assistant_mode, e.assistantMode);
|
|
1847
1847
|
if (!a) return null;
|
|
1848
|
-
const n =
|
|
1848
|
+
const n = oa(a);
|
|
1849
1849
|
return !n || n === "shopping" ? null : n;
|
|
1850
1850
|
}
|
|
1851
1851
|
function Dn(t) {
|
|
@@ -1921,7 +1921,7 @@ function Un() {
|
|
|
1921
1921
|
}
|
|
1922
1922
|
function jn(t, e, a, n, r) {
|
|
1923
1923
|
if (t === "PhotoAnalysisCard") {
|
|
1924
|
-
const i =
|
|
1924
|
+
const i = ra(e);
|
|
1925
1925
|
return i ? (r.photoAnalysis = i, r.renderHint = "photo_analysis", n.ensureRendered(), n.cancelTypewriter(), n.drawer?.updateBotMessage(r.id, r.content ?? "", "photo_analysis", r.photoAnalysis), !0) : (ze("beauty", "PhotoAnalysisCard parse failed, falling through to generic renderer", e), !1);
|
|
1926
1926
|
}
|
|
1927
1927
|
if (t === "BeautyPhotoStep") {
|
|
@@ -1988,7 +1988,7 @@ function Kn(t, e) {
|
|
|
1988
1988
|
return t.toLocaleUpperCase("tr");
|
|
1989
1989
|
}
|
|
1990
1990
|
}
|
|
1991
|
-
function
|
|
1991
|
+
function Lt(t) {
|
|
1992
1992
|
if (typeof t != "string") return !1;
|
|
1993
1993
|
const e = Number(t);
|
|
1994
1994
|
return Number.isFinite(e) && e > 0;
|
|
@@ -2028,9 +2028,9 @@ function Xn(t) {
|
|
|
2028
2028
|
const x = document.createElement("div");
|
|
2029
2029
|
x.className = "gengage-chat-comparison-recommended-title", x.textContent = e.name, m.appendChild(x);
|
|
2030
2030
|
const v = document.createElement("div");
|
|
2031
|
-
if (v.className = "gengage-chat-comparison-recommended-meta", Yn(e.rating) && v.appendChild(Zn(e.rating)),
|
|
2031
|
+
if (v.className = "gengage-chat-comparison-recommended-meta", Yn(e.rating) && v.appendChild(Zn(e.rating)), Lt(e.price)) {
|
|
2032
2032
|
const g = document.createElement("div");
|
|
2033
|
-
g.className = "gengage-chat-comparison-recommended-price", g.textContent =
|
|
2033
|
+
g.className = "gengage-chat-comparison-recommended-price", g.textContent = oe(e.price, t.pricing), v.appendChild(g);
|
|
2034
2034
|
}
|
|
2035
2035
|
if (v.childElementCount > 0 && m.appendChild(v), t.recommendedText) {
|
|
2036
2036
|
const g = document.createElement("p");
|
|
@@ -2052,8 +2052,8 @@ function Xn(t) {
|
|
|
2052
2052
|
_.className = "gengage-chat-comparison-highlights-label", _.textContent = s?.highlightsLabel ?? "Key Highlights", g.appendChild(_);
|
|
2053
2053
|
const y = document.createElement("ul");
|
|
2054
2054
|
for (const b of r) {
|
|
2055
|
-
const
|
|
2056
|
-
|
|
2055
|
+
const L = document.createElement("li");
|
|
2056
|
+
L.textContent = b, y.appendChild(L);
|
|
2057
2057
|
}
|
|
2058
2058
|
g.appendChild(y), l.appendChild(g);
|
|
2059
2059
|
}
|
|
@@ -2108,9 +2108,9 @@ function Xn(t) {
|
|
|
2108
2108
|
b.className = "gengage-chat-comparison-table-header-img-placeholder", b.setAttribute("aria-hidden", "true"), g.appendChild(b);
|
|
2109
2109
|
}
|
|
2110
2110
|
const y = document.createElement("div");
|
|
2111
|
-
if (y.className = "gengage-chat-comparison-table-product-name", y.textContent = v.name, g.appendChild(y),
|
|
2111
|
+
if (y.className = "gengage-chat-comparison-table-product-name", y.textContent = v.name, g.appendChild(y), Lt(v.price)) {
|
|
2112
2112
|
const b = document.createElement("div");
|
|
2113
|
-
b.className = "gengage-chat-comparison-table-price", b.textContent =
|
|
2113
|
+
b.className = "gengage-chat-comparison-table-price", b.textContent = oe(v.price, t.pricing), g.appendChild(b);
|
|
2114
2114
|
}
|
|
2115
2115
|
u.appendChild(g), p.appendChild(u);
|
|
2116
2116
|
}
|
|
@@ -2123,7 +2123,7 @@ function Xn(t) {
|
|
|
2123
2123
|
const y = document.createElement("td");
|
|
2124
2124
|
a[_]?.sku === e?.sku && (y.className = "gengage-chat-comparison-selected gds-comparison-table-winner-cell");
|
|
2125
2125
|
const b = v.values[_] ?? "";
|
|
2126
|
-
|
|
2126
|
+
sa(b) ? y.innerHTML = be(b) : y.textContent = b, u.appendChild(y);
|
|
2127
2127
|
}
|
|
2128
2128
|
m.appendChild(u);
|
|
2129
2129
|
}
|
|
@@ -2159,12 +2159,12 @@ function Jn(t, e) {
|
|
|
2159
2159
|
return;
|
|
2160
2160
|
}
|
|
2161
2161
|
const i = document.createElement("li");
|
|
2162
|
-
|
|
2162
|
+
sa(e) ? i.innerHTML = a : i.textContent = e, t.appendChild(i);
|
|
2163
2163
|
}
|
|
2164
|
-
function
|
|
2164
|
+
function sa(t) {
|
|
2165
2165
|
return /<\/?[a-z][\s\S]*>/i.test(t);
|
|
2166
2166
|
}
|
|
2167
|
-
function
|
|
2167
|
+
function qe(t, e = 18) {
|
|
2168
2168
|
const a = "http://www.w3.org/2000/svg", n = document.createElementNS(a, "svg");
|
|
2169
2169
|
n.setAttribute("width", String(e)), n.setAttribute("height", String(e)), 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"), n.setAttribute("aria-hidden", "true");
|
|
2170
2170
|
for (const r of t) {
|
|
@@ -2173,11 +2173,11 @@ function je(t, e = 18) {
|
|
|
2173
2173
|
}
|
|
2174
2174
|
return n;
|
|
2175
2175
|
}
|
|
2176
|
-
var
|
|
2176
|
+
var nt = "General", At = 220, er = 6;
|
|
2177
2177
|
function tr(t) {
|
|
2178
|
-
if (typeof t != "string") return [
|
|
2178
|
+
if (typeof t != "string") return [nt];
|
|
2179
2179
|
const e = t.split(/[,;|/]+/).map((a) => a.trim().replace(/\s+/g, " ")).filter((a) => a.length > 0);
|
|
2180
|
-
return e.length === 0 ? [
|
|
2180
|
+
return e.length === 0 ? [nt] : Array.from(new Set(e.map((a) => a.toLocaleLowerCase()))).map((a) => e.find((n) => n.toLocaleLowerCase() === a) ?? nt);
|
|
2181
2181
|
}
|
|
2182
2182
|
function ar(t) {
|
|
2183
2183
|
return t === "positive" || t === "negative" || t === "neutral" ? t : "neutral";
|
|
@@ -2185,13 +2185,13 @@ function ar(t) {
|
|
|
2185
2185
|
function nr(t) {
|
|
2186
2186
|
if (typeof t != "string") return "";
|
|
2187
2187
|
const e = t.trim().replace(/\s+/g, " ");
|
|
2188
|
-
return e.length <=
|
|
2188
|
+
return e.length <= At ? e : `${e.slice(0, At - 3).trimEnd()}...`;
|
|
2189
2189
|
}
|
|
2190
2190
|
function rr(t) {
|
|
2191
2191
|
return t.positive > t.negative ? "positive" : t.negative > t.positive ? "negative" : "neutral";
|
|
2192
2192
|
}
|
|
2193
2193
|
function ir(t) {
|
|
2194
|
-
return
|
|
2194
|
+
return qe(t === "positive" ? ["M7 17 17 7", "M7 7h10v10"] : t === "negative" ? ["M7 7 17 17", "M17 7v10H7"] : ["M5 12h14"], 14);
|
|
2195
2195
|
}
|
|
2196
2196
|
function or(t, e = "1 customer mentions", a = "customers mention") {
|
|
2197
2197
|
return t === 1 ? e : `${t} ${a}`;
|
|
@@ -2209,8 +2209,8 @@ function sr(t, e) {
|
|
|
2209
2209
|
const u = ar(v.review_class), g = nr(v.review_text), _ = tr(v.review_tag);
|
|
2210
2210
|
for (const y of _) {
|
|
2211
2211
|
const b = y.toLocaleLowerCase();
|
|
2212
|
-
let
|
|
2213
|
-
if (
|
|
2212
|
+
let L = i.get(b);
|
|
2213
|
+
if (L || (L = {
|
|
2214
2214
|
key: b,
|
|
2215
2215
|
label: y,
|
|
2216
2216
|
mentions: 0,
|
|
@@ -2218,12 +2218,12 @@ function sr(t, e) {
|
|
|
2218
2218
|
negative: 0,
|
|
2219
2219
|
neutral: 0,
|
|
2220
2220
|
snippets: []
|
|
2221
|
-
}, i.set(b,
|
|
2221
|
+
}, i.set(b, L)), L.mentions += 1, u === "positive" ? L.positive += 1 : u === "negative" ? L.negative += 1 : L.neutral += 1, g.length > 0 && L.snippets.length < er && !L.snippets.some((M) => M.text === g)) {
|
|
2222
2222
|
const M = {
|
|
2223
2223
|
text: g,
|
|
2224
2224
|
tone: u
|
|
2225
2225
|
};
|
|
2226
|
-
v.review_rating !== void 0 && String(v.review_rating).length > 0 && (M.rating = v.review_rating),
|
|
2226
|
+
v.review_rating !== void 0 && String(v.review_rating).length > 0 && (M.rating = v.review_rating), L.snippets.push(M);
|
|
2227
2227
|
}
|
|
2228
2228
|
}
|
|
2229
2229
|
}
|
|
@@ -2261,8 +2261,8 @@ function sr(t, e) {
|
|
|
2261
2261
|
for (const y of v.snippets) {
|
|
2262
2262
|
const b = document.createElement("article");
|
|
2263
2263
|
b.className = "gengage-chat-review-snippet", b.dataset.tone = y.tone;
|
|
2264
|
-
const
|
|
2265
|
-
if (
|
|
2264
|
+
const L = document.createElement("div");
|
|
2265
|
+
if (L.className = "gengage-chat-review-snippet-text", L.textContent = `"${y.text}"`, b.appendChild(L), y.rating !== void 0 && String(y.rating).length > 0) {
|
|
2266
2266
|
const M = document.createElement("div");
|
|
2267
2267
|
M.className = "gengage-chat-review-snippet-rating", M.textContent = `★ ${String(y.rating)}`, b.appendChild(M);
|
|
2268
2268
|
}
|
|
@@ -2300,17 +2300,17 @@ function He(t, e) {
|
|
|
2300
2300
|
if (t.productPriceUi?.showCampaignReason === !0)
|
|
2301
2301
|
return cr(e);
|
|
2302
2302
|
}
|
|
2303
|
-
function
|
|
2303
|
+
function $e(t, e) {
|
|
2304
2304
|
const a = e?.originalPriceStyle ?? e?.price_original_style;
|
|
2305
2305
|
if (a === "inline" || a === "strikethrough") return a;
|
|
2306
2306
|
const n = t.productPriceUi?.originalPriceStyle;
|
|
2307
2307
|
return n === "inline" || n === "strikethrough" ? n : "strikethrough";
|
|
2308
2308
|
}
|
|
2309
|
-
function
|
|
2309
|
+
function Qe(t) {
|
|
2310
2310
|
const e = document.createElement("div");
|
|
2311
2311
|
return e.className = "gengage-chat-campaign-reason", e.textContent = t, e;
|
|
2312
2312
|
}
|
|
2313
|
-
function
|
|
2313
|
+
function Je(t, e) {
|
|
2314
2314
|
for (const n of [
|
|
2315
2315
|
"campaignReasonLogoUrl",
|
|
2316
2316
|
"campaign_reason_logo_url",
|
|
@@ -2329,7 +2329,7 @@ function Qe(t, e) {
|
|
|
2329
2329
|
if (Ce(n)) return n;
|
|
2330
2330
|
}
|
|
2331
2331
|
}
|
|
2332
|
-
function
|
|
2332
|
+
function et(t) {
|
|
2333
2333
|
const e = document.createElement("div");
|
|
2334
2334
|
if (e.className = "gengage-chat-campaign-price-badge", e.dataset.gengagePart = "campaign-price-badge", t.logoUrl) {
|
|
2335
2335
|
const i = document.createElement("div");
|
|
@@ -2351,7 +2351,7 @@ function lr() {
|
|
|
2351
2351
|
return !1;
|
|
2352
2352
|
}
|
|
2353
2353
|
}
|
|
2354
|
-
function
|
|
2354
|
+
function ca(t) {
|
|
2355
2355
|
const e = t.product.sku;
|
|
2356
2356
|
if (typeof e == "string" && e.length > 0) return e;
|
|
2357
2357
|
const a = t.action?.payload;
|
|
@@ -2362,7 +2362,7 @@ var gr = {
|
|
|
2362
2362
|
best_value: "roleBestValue",
|
|
2363
2363
|
best_alternative: "roleBestAlternative"
|
|
2364
2364
|
};
|
|
2365
|
-
function
|
|
2365
|
+
function It(t, e) {
|
|
2366
2366
|
if (!t || !e) return null;
|
|
2367
2367
|
const a = gr[t];
|
|
2368
2368
|
return a ? e[a] ?? t : t;
|
|
@@ -2385,7 +2385,7 @@ function pr(t, e, a, n, r) {
|
|
|
2385
2385
|
const l = document.createElement("img");
|
|
2386
2386
|
l.className = "gengage-chat-ai-toppick-img", l.dataset.gengagePart = "ai-top-pick-image", pe(l, "src", s), l.loading = "lazy", l.alt = e, ve(l), i.appendChild(l);
|
|
2387
2387
|
}
|
|
2388
|
-
const c =
|
|
2388
|
+
const c = ca(t);
|
|
2389
2389
|
if (c && !r?.skipOverlayActions) {
|
|
2390
2390
|
const l = document.createElement("div");
|
|
2391
2391
|
if (l.className = "gengage-chat-product-card-img-actions", n.onFavoriteToggle) {
|
|
@@ -2412,11 +2412,11 @@ function pr(t, e, a, n, r) {
|
|
|
2412
2412
|
function hr(t, e, a) {
|
|
2413
2413
|
const n = t.price, r = t.originalPrice;
|
|
2414
2414
|
if (!n) return;
|
|
2415
|
-
const i = He(a, t), o =
|
|
2415
|
+
const i = He(a, t), o = $e(a, t), s = !!(r && r !== n), c = !!(i && s), l = Je(a, t), d = document.createElement("div");
|
|
2416
2416
|
if (d.className = "gengage-chat-ai-toppick-price", d.dataset.gengagePart = "ai-top-pick-price", c) {
|
|
2417
|
-
const p =
|
|
2417
|
+
const p = et({
|
|
2418
2418
|
reasonText: i,
|
|
2419
|
-
salePriceFormatted:
|
|
2419
|
+
salePriceFormatted: oe(n, a.pricing),
|
|
2420
2420
|
...l !== void 0 ? { logoUrl: l } : {}
|
|
2421
2421
|
});
|
|
2422
2422
|
if (s && o === "inline") {
|
|
@@ -2424,10 +2424,10 @@ function hr(t, e, a) {
|
|
|
2424
2424
|
const h = document.createElement("span");
|
|
2425
2425
|
h.className = "gengage-chat-ai-toppick-price-sep", h.setAttribute("aria-hidden", "true");
|
|
2426
2426
|
const m = document.createElement("span");
|
|
2427
|
-
m.className = "gengage-chat-ai-toppick-original-price", m.textContent =
|
|
2427
|
+
m.className = "gengage-chat-ai-toppick-original-price", m.textContent = oe(r, a.pricing), d.appendChild(h), d.appendChild(m);
|
|
2428
2428
|
} else {
|
|
2429
2429
|
const h = document.createElement("span");
|
|
2430
|
-
h.className = "gengage-chat-ai-toppick-original-price", h.textContent =
|
|
2430
|
+
h.className = "gengage-chat-ai-toppick-original-price", h.textContent = oe(r, a.pricing), d.appendChild(h), d.appendChild(document.createTextNode(" ")), d.appendChild(p);
|
|
2431
2431
|
}
|
|
2432
2432
|
e.appendChild(d);
|
|
2433
2433
|
return;
|
|
@@ -2435,23 +2435,23 @@ function hr(t, e, a) {
|
|
|
2435
2435
|
if (s && o === "inline") {
|
|
2436
2436
|
d.classList.add("gengage-chat-ai-toppick-price--inline");
|
|
2437
2437
|
const p = document.createElement("span");
|
|
2438
|
-
p.className = "gengage-chat-ai-toppick-price-current", p.textContent =
|
|
2438
|
+
p.className = "gengage-chat-ai-toppick-price-current", p.textContent = oe(n, a.pricing);
|
|
2439
2439
|
const h = document.createElement("span");
|
|
2440
2440
|
h.className = "gengage-chat-ai-toppick-price-sep", h.setAttribute("aria-hidden", "true");
|
|
2441
2441
|
const m = document.createElement("span");
|
|
2442
|
-
m.className = "gengage-chat-ai-toppick-original-price", m.textContent =
|
|
2442
|
+
m.className = "gengage-chat-ai-toppick-original-price", m.textContent = oe(r, a.pricing), d.appendChild(p), d.appendChild(h), d.appendChild(m);
|
|
2443
2443
|
} else if (s) {
|
|
2444
2444
|
const p = document.createElement("span");
|
|
2445
|
-
p.className = "gengage-chat-ai-toppick-original-price", p.textContent =
|
|
2445
|
+
p.className = "gengage-chat-ai-toppick-original-price", p.textContent = oe(r, a.pricing), d.appendChild(p), d.appendChild(document.createTextNode(" "));
|
|
2446
2446
|
const h = document.createElement("span");
|
|
2447
|
-
h.className = "gengage-chat-ai-toppick-price-current", h.textContent =
|
|
2447
|
+
h.className = "gengage-chat-ai-toppick-price-current", h.textContent = oe(n, a.pricing), d.appendChild(h);
|
|
2448
2448
|
} else {
|
|
2449
2449
|
const p = document.createElement("span");
|
|
2450
|
-
p.className = "gengage-chat-ai-toppick-price-current", p.textContent =
|
|
2450
|
+
p.className = "gengage-chat-ai-toppick-price-current", p.textContent = oe(n, a.pricing), d.appendChild(p);
|
|
2451
2451
|
}
|
|
2452
2452
|
if (i) {
|
|
2453
2453
|
const p = document.createElement("div");
|
|
2454
|
-
p.className = "gengage-chat-ai-toppick-price-stack", p.appendChild(
|
|
2454
|
+
p.className = "gengage-chat-ai-toppick-price-stack", p.appendChild(Qe(i)), p.appendChild(d), e.appendChild(p);
|
|
2455
2455
|
} else e.appendChild(d);
|
|
2456
2456
|
}
|
|
2457
2457
|
function ur(t, e, a) {
|
|
@@ -2467,24 +2467,24 @@ function ur(t, e, a) {
|
|
|
2467
2467
|
}
|
|
2468
2468
|
}
|
|
2469
2469
|
}
|
|
2470
|
-
function
|
|
2470
|
+
function Mt(t, e, a, n) {
|
|
2471
2471
|
const r = document.createElement("div");
|
|
2472
2472
|
r.className = a ? "gengage-chat-ai-toppick-card gengage-chat-ai-toppick-card--winner gds-card" : "gengage-chat-ai-toppick-card gengage-chat-ai-toppick-card--compact gds-card";
|
|
2473
2473
|
const i = n?.uniformMobileLayout === !0;
|
|
2474
2474
|
!a && i && r.classList.add("gengage-chat-ai-toppick-card--mobile-uniform"), r.dataset.gengagePart = a ? "ai-top-pick-card-winner" : "ai-top-pick-card";
|
|
2475
|
-
const o = t.product, s =
|
|
2475
|
+
const o = t.product, s = ca(t), c = o.url ?? "", l = o.cartCode, d = o.inStock, p = !!(s && l && d !== !1), h = t.action;
|
|
2476
2476
|
s && e.onProductClick ? (r.classList.add("gds-clickable"), r.addEventListener("click", (k) => {
|
|
2477
2477
|
if (k.target.closest(".gengage-chat-ai-toppick-cta") || k.target.closest(".gengage-chat-favorite-btn") || k.target.closest(".gengage-chat-find-similar-pill")) return;
|
|
2478
|
-
const
|
|
2478
|
+
const E = o.name;
|
|
2479
2479
|
e.onProductClick?.({
|
|
2480
2480
|
sku: s,
|
|
2481
2481
|
url: c,
|
|
2482
|
-
...
|
|
2482
|
+
...E ? { name: E } : {}
|
|
2483
2483
|
});
|
|
2484
2484
|
})) : h && (r.classList.add("gds-clickable"), r.addEventListener("click", (k) => {
|
|
2485
2485
|
k.target.closest(".gengage-chat-ai-toppick-cta") || k.target.closest(".gengage-chat-favorite-btn") || k.target.closest(".gengage-chat-find-similar-pill") || e.onAction(h);
|
|
2486
2486
|
}));
|
|
2487
|
-
const m = o.name || "Product image", x = !a && e.isMobile === !0 && !i, v = a ?
|
|
2487
|
+
const m = o.name || "Product image", x = !a && e.isMobile === !0 && !i, v = a ? It(t.role, e.i18n) ?? e.i18n?.roleWinner ?? "TOP MATCH" : It(t.role, e.i18n);
|
|
2488
2488
|
if (v && !x) {
|
|
2489
2489
|
const k = document.createElement("span");
|
|
2490
2490
|
k.className = "gengage-chat-ai-toppick-badge gds-badge", k.dataset.gengagePart = "ai-top-pick-role-badge", k.textContent = v, r.appendChild(k);
|
|
@@ -2508,18 +2508,18 @@ function It(t, e, a, n) {
|
|
|
2508
2508
|
else {
|
|
2509
2509
|
const k = typeof t.reason == "string" ? t.reason.trim() : "";
|
|
2510
2510
|
if (k) {
|
|
2511
|
-
const
|
|
2512
|
-
|
|
2511
|
+
const E = document.createElement("p");
|
|
2512
|
+
E.className = "gengage-chat-ai-toppick-snippet", E.dataset.gengagePart = "ai-top-pick-snippet", E.textContent = k, b.appendChild(E);
|
|
2513
2513
|
}
|
|
2514
2514
|
}
|
|
2515
2515
|
b.childNodes.length > 0 && r.appendChild(b);
|
|
2516
|
-
const
|
|
2517
|
-
if (
|
|
2516
|
+
const L = !!(s && e.topPicksLoadingSku === s), M = (p || h) && !x;
|
|
2517
|
+
if (L || p || h) {
|
|
2518
2518
|
const k = document.createElement("div");
|
|
2519
|
-
if (k.className = "gengage-chat-ai-toppick-spinner", k.dataset.gengagePart = "ai-top-pick-spinner", k.style.display =
|
|
2520
|
-
const
|
|
2521
|
-
|
|
2522
|
-
if (
|
|
2519
|
+
if (k.className = "gengage-chat-ai-toppick-spinner", k.dataset.gengagePart = "ai-top-pick-spinner", k.style.display = L ? "" : "none", r.appendChild(k), M) {
|
|
2520
|
+
const E = document.createElement("button");
|
|
2521
|
+
E.className = "gengage-chat-ai-toppick-cta gds-btn gds-btn-primary", E.dataset.gengagePart = "ai-top-pick-cta", E.type = "button", E.textContent = p ? e.i18n?.addToCartButton ?? "Add to Cart" : e.i18n?.viewDetails ?? "View Details", E.addEventListener("click", (R) => {
|
|
2522
|
+
if (R.stopPropagation(), p) {
|
|
2523
2523
|
e.onAction({
|
|
2524
2524
|
title: e.i18n?.addToCartButton ?? "Add to Cart",
|
|
2525
2525
|
type: "addToCart",
|
|
@@ -2543,7 +2543,7 @@ function It(t, e, a, n) {
|
|
|
2543
2543
|
}
|
|
2544
2544
|
e.onAction(h);
|
|
2545
2545
|
}
|
|
2546
|
-
}), r.appendChild(
|
|
2546
|
+
}), r.appendChild(E);
|
|
2547
2547
|
}
|
|
2548
2548
|
}
|
|
2549
2549
|
return r;
|
|
@@ -2556,12 +2556,12 @@ function mr(t, e) {
|
|
|
2556
2556
|
const r = document.createElement("div");
|
|
2557
2557
|
r.className = "gengage-chat-ai-top-picks-scroll", r.dataset.gengagePart = "ai-top-picks-scroll";
|
|
2558
2558
|
const i = e.isMobile === !0 && lr(), o = n[0];
|
|
2559
|
-
if (r.appendChild(
|
|
2559
|
+
if (r.appendChild(Mt(o, e, !0, { uniformMobileLayout: i })), n.length > 1) {
|
|
2560
2560
|
const s = document.createElement("div");
|
|
2561
2561
|
s.className = "gengage-chat-ai-top-picks-rest", i && s.classList.add("gengage-chat-ai-top-picks-rest--uniform-mobile"), s.dataset.gengagePart = "ai-top-picks-rest";
|
|
2562
2562
|
for (let c = 1; c < n.length; c++) {
|
|
2563
2563
|
const l = n[c], d = l.role === "winner";
|
|
2564
|
-
s.appendChild(
|
|
2564
|
+
s.appendChild(Mt(l, e, d, { uniformMobileLayout: i }));
|
|
2565
2565
|
}
|
|
2566
2566
|
r.appendChild(s);
|
|
2567
2567
|
}
|
|
@@ -2580,7 +2580,7 @@ function br(t, e) {
|
|
|
2580
2580
|
const a = document.createElement("div");
|
|
2581
2581
|
a.className = "gengage-chat-grounding-review gds-evidence-card", a.dataset.gengagePart = "grounding-review-card";
|
|
2582
2582
|
const n = t.props ?? {}, r = n.title, i = n.reviewCount, o = n.action, s = e.i18n?.groundingReviewCta ?? "Read Reviews", c = document.createElement("span");
|
|
2583
|
-
c.className = "gengage-chat-grounding-review-icon", c.appendChild(
|
|
2583
|
+
c.className = "gengage-chat-grounding-review-icon", c.appendChild(qe([
|
|
2584
2584
|
"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",
|
|
2585
2585
|
"M8 9h8",
|
|
2586
2586
|
"M8 13h6"
|
|
@@ -2598,7 +2598,7 @@ function br(t, e) {
|
|
|
2598
2598
|
const h = document.createElement("span");
|
|
2599
2599
|
h.textContent = s, p.appendChild(h);
|
|
2600
2600
|
const m = document.createElement("span");
|
|
2601
|
-
return m.className = "gengage-chat-grounding-review-cta-icon", m.appendChild(
|
|
2601
|
+
return m.className = "gengage-chat-grounding-review-cta-icon", m.appendChild(qe(["M5 12h14", "M15 8l4 4-4 4"], 14)), p.appendChild(m), a.appendChild(p), o && (a.classList.add("gds-clickable"), a.setAttribute("role", "button"), a.setAttribute("tabindex", "0"), a.addEventListener("click", () => e.onAction(o)), a.addEventListener("keydown", (x) => {
|
|
2602
2602
|
(x.key === "Enter" || x.key === " ") && (x.preventDefault(), e.onAction(o));
|
|
2603
2603
|
})), a;
|
|
2604
2604
|
}
|
|
@@ -2615,7 +2615,7 @@ function vr(t) {
|
|
|
2615
2615
|
return typeof a?.input == "string" && a.input.trim() ? r.input = a.input : delete r.input, {
|
|
2616
2616
|
title: t.action.title,
|
|
2617
2617
|
type: e,
|
|
2618
|
-
payload:
|
|
2618
|
+
payload: Xt(r)
|
|
2619
2619
|
};
|
|
2620
2620
|
}
|
|
2621
2621
|
function xr(t, e) {
|
|
@@ -2687,7 +2687,7 @@ function wr(t, e) {
|
|
|
2687
2687
|
}
|
|
2688
2688
|
return a;
|
|
2689
2689
|
}
|
|
2690
|
-
function
|
|
2690
|
+
function la(t, e) {
|
|
2691
2691
|
const a = t.length >= 2, n = e.i18n?.compareSelected ?? "Compare", r = e.comparisonSelectionWarning, i = document.createElement("div");
|
|
2692
2692
|
i.className = "gengage-chat-comparison-floating-btn", i.dataset.gengagePart = "comparison-dock";
|
|
2693
2693
|
const o = document.createElement("div");
|
|
@@ -2861,7 +2861,7 @@ function Ar(t, e) {
|
|
|
2861
2861
|
const r = document.createElement("div");
|
|
2862
2862
|
if (r.className = "gengage-chat-product-card-name", r.textContent = t.name, n.appendChild(r), t.price) {
|
|
2863
2863
|
const i = document.createElement("div");
|
|
2864
|
-
i.className = "gengage-chat-product-card-price", i.textContent =
|
|
2864
|
+
i.className = "gengage-chat-product-card-price", i.textContent = oe(t.price, e.pricing), n.appendChild(i);
|
|
2865
2865
|
}
|
|
2866
2866
|
return a.appendChild(n), (e.onProductSelect || e.onAction) && (a.classList.add("gds-clickable"), a.addEventListener("click", () => {
|
|
2867
2867
|
if (t.sku) {
|
|
@@ -2968,7 +2968,7 @@ function zr(t, e) {
|
|
|
2968
2968
|
const c = a.rating, l = a.reviewCount;
|
|
2969
2969
|
if (e.hideUserReviews !== !0 && typeof c == "number" && Number.isFinite(c) && c > 0) {
|
|
2970
2970
|
const g = document.createElement("div");
|
|
2971
|
-
if (g.className = "gengage-chat-product-summary__rating", g.dataset.gengagePart = "product-summary-rating", g.appendChild(
|
|
2971
|
+
if (g.className = "gengage-chat-product-summary__rating", g.dataset.gengagePart = "product-summary-rating", g.appendChild(Jt(c)), typeof l == "number" && Number.isFinite(l)) {
|
|
2972
2972
|
const _ = document.createElement("span");
|
|
2973
2973
|
_.className = "gengage-chat-product-summary__review-count", _.textContent = ` (${l})`, g.appendChild(_);
|
|
2974
2974
|
}
|
|
@@ -2976,47 +2976,47 @@ function zr(t, e) {
|
|
|
2976
2976
|
}
|
|
2977
2977
|
const d = a.price, p = a.originalPrice;
|
|
2978
2978
|
if (d) {
|
|
2979
|
-
const g = He(e, a), _ =
|
|
2979
|
+
const g = He(e, a), _ = $e(e, a), y = !!(p && p !== d), b = document.createElement("div");
|
|
2980
2980
|
b.className = "gengage-chat-product-summary__price", b.dataset.gengagePart = "product-summary-price";
|
|
2981
|
-
const
|
|
2982
|
-
if (
|
|
2983
|
-
const k =
|
|
2981
|
+
const L = !!(g && y), M = Je(e, a);
|
|
2982
|
+
if (L) {
|
|
2983
|
+
const k = et({
|
|
2984
2984
|
reasonText: g,
|
|
2985
|
-
salePriceFormatted:
|
|
2985
|
+
salePriceFormatted: oe(d, e.pricing),
|
|
2986
2986
|
...M !== void 0 ? { logoUrl: M } : {}
|
|
2987
2987
|
});
|
|
2988
2988
|
if (y && _ === "inline") {
|
|
2989
2989
|
b.classList.add("gengage-chat-product-summary__price--inline"), b.appendChild(k);
|
|
2990
|
-
const
|
|
2991
|
-
|
|
2992
|
-
const
|
|
2993
|
-
|
|
2990
|
+
const E = document.createElement("span");
|
|
2991
|
+
E.className = "gengage-chat-product-summary__price-sep", E.setAttribute("aria-hidden", "true");
|
|
2992
|
+
const R = document.createElement("span");
|
|
2993
|
+
R.className = "gengage-chat-product-summary__price-original", R.textContent = oe(p, e.pricing), b.appendChild(E), b.appendChild(R);
|
|
2994
2994
|
} else {
|
|
2995
|
-
const
|
|
2996
|
-
|
|
2995
|
+
const E = document.createElement("span");
|
|
2996
|
+
E.className = "gengage-chat-product-summary__price-original", E.textContent = oe(p, e.pricing), b.appendChild(E), b.appendChild(document.createTextNode(" ")), b.appendChild(k);
|
|
2997
2997
|
}
|
|
2998
2998
|
i.appendChild(b);
|
|
2999
2999
|
} else {
|
|
3000
3000
|
if (y && _ === "inline") {
|
|
3001
3001
|
b.classList.add("gengage-chat-product-summary__price--inline");
|
|
3002
3002
|
const k = document.createElement("span");
|
|
3003
|
-
k.className = "gengage-chat-product-summary__price-current", k.textContent =
|
|
3004
|
-
const
|
|
3005
|
-
|
|
3006
|
-
const
|
|
3007
|
-
|
|
3003
|
+
k.className = "gengage-chat-product-summary__price-current", k.textContent = oe(d, e.pricing);
|
|
3004
|
+
const E = document.createElement("span");
|
|
3005
|
+
E.className = "gengage-chat-product-summary__price-sep", E.setAttribute("aria-hidden", "true");
|
|
3006
|
+
const R = document.createElement("span");
|
|
3007
|
+
R.className = "gengage-chat-product-summary__price-original", R.textContent = oe(p, e.pricing), b.appendChild(k), b.appendChild(E), b.appendChild(R);
|
|
3008
3008
|
} else if (y) {
|
|
3009
3009
|
const k = document.createElement("span");
|
|
3010
|
-
k.className = "gengage-chat-product-summary__price-original", k.textContent =
|
|
3011
|
-
const
|
|
3012
|
-
|
|
3010
|
+
k.className = "gengage-chat-product-summary__price-original", k.textContent = oe(p, e.pricing), b.appendChild(k), b.appendChild(document.createTextNode(" "));
|
|
3011
|
+
const E = document.createElement("span");
|
|
3012
|
+
E.className = "gengage-chat-product-summary__price-current", E.textContent = oe(d, e.pricing), b.appendChild(E);
|
|
3013
3013
|
} else {
|
|
3014
3014
|
const k = document.createElement("span");
|
|
3015
|
-
k.className = "gengage-chat-product-summary__price-current", k.textContent =
|
|
3015
|
+
k.className = "gengage-chat-product-summary__price-current", k.textContent = oe(d, e.pricing), b.appendChild(k);
|
|
3016
3016
|
}
|
|
3017
3017
|
if (g) {
|
|
3018
3018
|
const k = document.createElement("div");
|
|
3019
|
-
k.className = "gengage-chat-product-summary__price-stack", k.appendChild(
|
|
3019
|
+
k.className = "gengage-chat-product-summary__price-stack", k.appendChild(Qe(g)), k.appendChild(b), i.appendChild(k);
|
|
3020
3020
|
} else i.appendChild(b);
|
|
3021
3021
|
}
|
|
3022
3022
|
}
|
|
@@ -3043,16 +3043,16 @@ function zr(t, e) {
|
|
|
3043
3043
|
}
|
|
3044
3044
|
var Rr = {
|
|
3045
3045
|
PhotoAnalysisCard: ({ element: t, context: e }) => Pn(t, e),
|
|
3046
|
-
BeautyPhotoStep: ({ element: t, context: e }) =>
|
|
3046
|
+
BeautyPhotoStep: ({ element: t, context: e }) => na(t, e)
|
|
3047
3047
|
};
|
|
3048
|
-
function
|
|
3048
|
+
function Ve() {
|
|
3049
3049
|
return window.innerWidth < 768;
|
|
3050
3050
|
}
|
|
3051
|
-
var
|
|
3051
|
+
var ga = {
|
|
3052
3052
|
ActionButtons: ({ element: t, context: e }) => Dr(t, e),
|
|
3053
3053
|
ActionButton: ({ element: t, context: e }) => Or(t, e),
|
|
3054
3054
|
InlineQuestionButtons: ({ element: t, context: e }) => wr(t, e),
|
|
3055
|
-
ProductCard: ({ element: t, context: e }) =>
|
|
3055
|
+
ProductCard: ({ element: t, context: e }) => pt(t, e),
|
|
3056
3056
|
ProductDetailsPanel: ({ element: t, context: e }) => si(t, e),
|
|
3057
3057
|
ProductGrid: ({ element: t, spec: e, renderElement: a, context: n }) => mi(t, e, a, n),
|
|
3058
3058
|
ReviewHighlights: ({ element: t, context: e }) => e.hideUserReviews === !0 ? null : sr(t, {
|
|
@@ -3075,7 +3075,7 @@ var la = {
|
|
|
3075
3075
|
ProductSummaryCard: ({ element: t, context: e }) => zr(t, e),
|
|
3076
3076
|
Divider: ({ element: t }) => xi(t),
|
|
3077
3077
|
...Rr
|
|
3078
|
-
},
|
|
3078
|
+
}, da = ({ element: t, renderElement: e }) => {
|
|
3079
3079
|
if (!t.children || t.children.length === 0) return null;
|
|
3080
3080
|
const a = document.createElement("div");
|
|
3081
3081
|
for (const n of t.children) {
|
|
@@ -3085,9 +3085,9 @@ var la = {
|
|
|
3085
3085
|
return a;
|
|
3086
3086
|
};
|
|
3087
3087
|
function Hr() {
|
|
3088
|
-
return { ...
|
|
3088
|
+
return { ...ga };
|
|
3089
3089
|
}
|
|
3090
|
-
function Fr(t, e, a =
|
|
3090
|
+
function Fr(t, e, a = ga, n = da) {
|
|
3091
3091
|
return Ea({
|
|
3092
3092
|
spec: t,
|
|
3093
3093
|
context: e,
|
|
@@ -3114,14 +3114,14 @@ function Or(t, e) {
|
|
|
3114
3114
|
const r = t.props?.action;
|
|
3115
3115
|
return r && a.addEventListener("click", () => e.onAction(r)), a;
|
|
3116
3116
|
}
|
|
3117
|
-
function
|
|
3117
|
+
function Nt(t, e, a, n, r) {
|
|
3118
3118
|
t.replaceChildren();
|
|
3119
|
-
const i =
|
|
3119
|
+
const i = $e(e, a), o = !!(r && n && r !== n), s = He(e, a), c = !!(s && o), l = Je(e, a);
|
|
3120
3120
|
if (!n || parseFloat(n) <= 0) return;
|
|
3121
3121
|
if (c) {
|
|
3122
|
-
const p =
|
|
3122
|
+
const p = et({
|
|
3123
3123
|
reasonText: s,
|
|
3124
|
-
salePriceFormatted:
|
|
3124
|
+
salePriceFormatted: oe(n, e.pricing),
|
|
3125
3125
|
...l !== void 0 ? { logoUrl: l } : {}
|
|
3126
3126
|
});
|
|
3127
3127
|
if (o && i === "inline") {
|
|
@@ -3131,13 +3131,13 @@ function Mt(t, e, a, n, r) {
|
|
|
3131
3131
|
const m = document.createElement("span");
|
|
3132
3132
|
m.className = "gengage-chat-product-card-price-sep", m.setAttribute("aria-hidden", "true");
|
|
3133
3133
|
const x = document.createElement("span");
|
|
3134
|
-
x.className = "gengage-chat-product-card-original-price", x.textContent =
|
|
3134
|
+
x.className = "gengage-chat-product-card-original-price", x.textContent = oe(r, e.pricing), h.appendChild(m), h.appendChild(x), t.appendChild(h);
|
|
3135
3135
|
return;
|
|
3136
3136
|
}
|
|
3137
3137
|
if (t.classList.remove("gengage-chat-product-card-price-block--inline"), t.appendChild(p), o) {
|
|
3138
3138
|
t.appendChild(document.createTextNode(" "));
|
|
3139
3139
|
const h = document.createElement("span");
|
|
3140
|
-
h.className = "gengage-chat-product-card-original-price", h.textContent =
|
|
3140
|
+
h.className = "gengage-chat-product-card-original-price", h.textContent = oe(r, e.pricing), t.appendChild(h);
|
|
3141
3141
|
}
|
|
3142
3142
|
return;
|
|
3143
3143
|
}
|
|
@@ -3146,28 +3146,28 @@ function Mt(t, e, a, n, r) {
|
|
|
3146
3146
|
const p = document.createElement("div");
|
|
3147
3147
|
p.className = "gengage-chat-product-card-price-row";
|
|
3148
3148
|
const h = document.createElement("span");
|
|
3149
|
-
h.className = "gengage-chat-product-card-current-price", h.textContent =
|
|
3149
|
+
h.className = "gengage-chat-product-card-current-price", h.textContent = oe(n, e.pricing);
|
|
3150
3150
|
const m = document.createElement("span");
|
|
3151
3151
|
m.className = "gengage-chat-product-card-price-sep", m.setAttribute("aria-hidden", "true");
|
|
3152
3152
|
const x = document.createElement("span");
|
|
3153
|
-
x.className = "gengage-chat-product-card-original-price", x.textContent =
|
|
3153
|
+
x.className = "gengage-chat-product-card-original-price", x.textContent = oe(r, e.pricing), p.appendChild(h), p.appendChild(m), p.appendChild(x), t.appendChild(p);
|
|
3154
3154
|
return;
|
|
3155
3155
|
}
|
|
3156
3156
|
t.classList.remove("gengage-chat-product-card-price-block--inline");
|
|
3157
3157
|
const d = document.createElement("span");
|
|
3158
|
-
if (d.className = "gengage-chat-product-card-current-price", d.textContent =
|
|
3158
|
+
if (d.className = "gengage-chat-product-card-current-price", d.textContent = oe(n, e.pricing), t.appendChild(d), o) {
|
|
3159
3159
|
t.appendChild(document.createTextNode(" "));
|
|
3160
3160
|
const p = document.createElement("span");
|
|
3161
|
-
p.className = "gengage-chat-product-card-original-price", p.textContent =
|
|
3161
|
+
p.className = "gengage-chat-product-card-original-price", p.textContent = oe(r, e.pricing), t.appendChild(p);
|
|
3162
3162
|
}
|
|
3163
3163
|
}
|
|
3164
|
-
function
|
|
3164
|
+
function Bt(t, e, a, n, r, i, o) {
|
|
3165
3165
|
t.classList.remove("gengage-chat-product-details-price--inline"), t.replaceChildren(), t.className = "gengage-chat-product-details-price";
|
|
3166
|
-
const s = He(e, a), c = !!(s && o), l =
|
|
3166
|
+
const s = He(e, a), c = !!(s && o), l = Je(e, a);
|
|
3167
3167
|
if (c) {
|
|
3168
|
-
const p =
|
|
3168
|
+
const p = et({
|
|
3169
3169
|
reasonText: s,
|
|
3170
|
-
salePriceFormatted:
|
|
3170
|
+
salePriceFormatted: oe(n, e.pricing),
|
|
3171
3171
|
...l !== void 0 ? { logoUrl: l } : {}
|
|
3172
3172
|
});
|
|
3173
3173
|
if (o && i === "inline") {
|
|
@@ -3175,37 +3175,37 @@ function Nt(t, e, a, n, r, i, o) {
|
|
|
3175
3175
|
const h = document.createElement("span");
|
|
3176
3176
|
h.className = "gengage-chat-product-details-price-sep", h.setAttribute("aria-hidden", "true");
|
|
3177
3177
|
const m = document.createElement("span");
|
|
3178
|
-
m.className = "gengage-chat-product-details-original-price", m.textContent =
|
|
3178
|
+
m.className = "gengage-chat-product-details-original-price", m.textContent = oe(r, e.pricing), t.appendChild(h), t.appendChild(m);
|
|
3179
3179
|
} else {
|
|
3180
3180
|
if (o) {
|
|
3181
3181
|
const h = document.createElement("span");
|
|
3182
|
-
h.className = "gengage-chat-product-details-original-price", h.textContent =
|
|
3182
|
+
h.className = "gengage-chat-product-details-original-price", h.textContent = oe(r, e.pricing), t.appendChild(h), t.appendChild(document.createTextNode(" "));
|
|
3183
3183
|
}
|
|
3184
3184
|
t.appendChild(p);
|
|
3185
3185
|
}
|
|
3186
3186
|
} else if (o && i === "inline") {
|
|
3187
3187
|
t.classList.add("gengage-chat-product-details-price--inline");
|
|
3188
3188
|
const p = document.createElement("span");
|
|
3189
|
-
p.className = "gengage-chat-product-details-current-price", p.textContent =
|
|
3189
|
+
p.className = "gengage-chat-product-details-current-price", p.textContent = oe(n, e.pricing);
|
|
3190
3190
|
const h = document.createElement("span");
|
|
3191
3191
|
h.className = "gengage-chat-product-details-price-sep", h.setAttribute("aria-hidden", "true");
|
|
3192
3192
|
const m = document.createElement("span");
|
|
3193
|
-
m.className = "gengage-chat-product-details-original-price", m.textContent =
|
|
3193
|
+
m.className = "gengage-chat-product-details-original-price", m.textContent = oe(r, e.pricing), t.appendChild(p), t.appendChild(h), t.appendChild(m);
|
|
3194
3194
|
} else {
|
|
3195
3195
|
if (o) {
|
|
3196
3196
|
const h = document.createElement("span");
|
|
3197
|
-
h.className = "gengage-chat-product-details-original-price", h.textContent =
|
|
3197
|
+
h.className = "gengage-chat-product-details-original-price", h.textContent = oe(r, e.pricing), t.appendChild(h), t.appendChild(document.createTextNode(" "));
|
|
3198
3198
|
}
|
|
3199
3199
|
const p = document.createElement("span");
|
|
3200
|
-
p.className = "gengage-chat-product-details-current-price", p.textContent =
|
|
3200
|
+
p.className = "gengage-chat-product-details-current-price", p.textContent = oe(n, e.pricing), t.appendChild(p);
|
|
3201
3201
|
}
|
|
3202
|
-
const d =
|
|
3202
|
+
const d = Ke(a, "discountPercent", "price_discount_rate");
|
|
3203
3203
|
if (!e.hideProductDiscountBadge && typeof d == "number" && d > 0) {
|
|
3204
3204
|
const p = document.createElement("span");
|
|
3205
|
-
p.className = "gengage-chat-product-details-discount-badge", p.textContent = `%${
|
|
3205
|
+
p.className = "gengage-chat-product-details-discount-badge", p.textContent = `%${ta(d)}`, t.appendChild(p);
|
|
3206
3206
|
}
|
|
3207
3207
|
}
|
|
3208
|
-
function
|
|
3208
|
+
function pt(t, e) {
|
|
3209
3209
|
const a = document.createElement("div");
|
|
3210
3210
|
a.className = "gengage-chat-product-card gds-card gds-product-card gds-card-interactive";
|
|
3211
3211
|
const n = t.props?.product ?? t.props;
|
|
@@ -3230,34 +3230,34 @@ function dt(t, e) {
|
|
|
3230
3230
|
if (p && xe(p)) {
|
|
3231
3231
|
const C = document.createElement("div");
|
|
3232
3232
|
C.className = "gengage-chat-product-card-img-wrapper";
|
|
3233
|
-
const
|
|
3234
|
-
|
|
3235
|
-
const
|
|
3236
|
-
|
|
3233
|
+
const U = document.createElement("img");
|
|
3234
|
+
U.className = "gengage-chat-product-card-img", U.loading = "lazy", pe(U, "src", p);
|
|
3235
|
+
const B = n.name;
|
|
3236
|
+
B && (U.alt = B), ve(U), C.appendChild(U);
|
|
3237
3237
|
const j = n.discountPercent;
|
|
3238
3238
|
if (!e.hideProductDiscountBadge && typeof j == "number" && j > 0) {
|
|
3239
3239
|
const f = document.createElement("span");
|
|
3240
|
-
f.className = "gengage-chat-product-card-discount-badge", f.textContent = `%${
|
|
3240
|
+
f.className = "gengage-chat-product-card-discount-badge", f.textContent = `%${ta(j)}`, C.appendChild(f);
|
|
3241
3241
|
}
|
|
3242
3242
|
const F = document.createElement("div");
|
|
3243
3243
|
F.className = "gengage-chat-product-card-img-actions";
|
|
3244
|
-
const
|
|
3245
|
-
if (
|
|
3244
|
+
const ne = n.sku;
|
|
3245
|
+
if (ne && e.onFavoriteToggle) {
|
|
3246
3246
|
const f = document.createElement("button");
|
|
3247
|
-
f.className = "gengage-chat-favorite-btn", f.type = "button", f.dataset.gengageFavoriteSku =
|
|
3248
|
-
const
|
|
3249
|
-
|
|
3247
|
+
f.className = "gengage-chat-favorite-btn", f.type = "button", f.dataset.gengageFavoriteSku = ne, f.setAttribute("aria-label", e.i18n?.addToFavoritesLabel ?? "Add to favorites");
|
|
3248
|
+
const S = e.favoritedSkus?.has(ne) ?? !1;
|
|
3249
|
+
S && f.classList.add("gengage-chat-favorite-btn--active"), f.innerHTML = `<svg width="14" height="14" viewBox="0 0 24 24" fill="${S ? "currentColor" : "none"}" stroke="currentColor" stroke-width="2"><path d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"/></svg>`, f.addEventListener("click", (T) => {
|
|
3250
3250
|
T.stopPropagation(), f.classList.toggle("gengage-chat-favorite-btn--active");
|
|
3251
|
-
const
|
|
3252
|
-
|
|
3251
|
+
const q = f.querySelector("svg");
|
|
3252
|
+
q && q.setAttribute("fill", f.classList.contains("gengage-chat-favorite-btn--active") ? "currentColor" : "none"), e.onFavoriteToggle(ne, n);
|
|
3253
3253
|
}), F.appendChild(f);
|
|
3254
3254
|
}
|
|
3255
3255
|
const X = n.sku, V = e.i18n?.findSimilarLabel ?? "Find Similar";
|
|
3256
3256
|
if (X) {
|
|
3257
3257
|
const f = document.createElement("button");
|
|
3258
3258
|
f.className = "gengage-chat-find-similar-pill", f.type = "button", f.setAttribute("aria-label", V), f.dataset.tooltip = V, f.innerHTML = '<span class="gengage-chat-find-similar-pill-icon" aria-hidden="true"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.25" stroke-linecap="round" stroke-linejoin="round"><circle cx="10.5" cy="10.5" r="6.5"/><path d="M16 16l5.5 5.5"/></svg></span>';
|
|
3259
|
-
const
|
|
3260
|
-
|
|
3259
|
+
const S = document.createElement("span");
|
|
3260
|
+
S.className = "gengage-chat-find-similar-pill-text", S.textContent = V, f.appendChild(S), f.addEventListener("click", (T) => {
|
|
3261
3261
|
T.stopPropagation(), e.onAction({
|
|
3262
3262
|
title: V,
|
|
3263
3263
|
type: "findSimilar",
|
|
@@ -3274,47 +3274,47 @@ function dt(t, e) {
|
|
|
3274
3274
|
const C = document.createElement("div");
|
|
3275
3275
|
C.className = "gengage-chat-product-card-brand", C.textContent = m, h.appendChild(C);
|
|
3276
3276
|
}
|
|
3277
|
-
const x = n.rating, v = n.reviewCount, u = n.price, g = n.originalPrice, _ = n.price_async, y = He(e, n), b =
|
|
3278
|
-
|
|
3277
|
+
const x = n.rating, v = n.reviewCount, u = n.price, g = n.originalPrice, _ = n.price_async, y = He(e, n), b = $e(e, n), L = !!(g && u && g !== u && parseFloat(u) > 0), M = !!(y && L), k = !!(y && !M || L && b === "inline"), E = typeof x == "number" && Number.isFinite(x) && x > 0, R = document.createElement("div");
|
|
3278
|
+
R.className = "gengage-chat-product-card-meta-row";
|
|
3279
3279
|
const G = document.createElement("div");
|
|
3280
3280
|
G.className = "gengage-chat-product-card-price gengage-chat-product-card-price-block";
|
|
3281
3281
|
const W = k ? (() => {
|
|
3282
3282
|
const C = document.createElement("div");
|
|
3283
|
-
return C.className = "gengage-chat-product-card-price-stack", y && !M && C.appendChild(
|
|
3283
|
+
return C.className = "gengage-chat-product-card-price-stack", y && !M && C.appendChild(Qe(y)), C.appendChild(G), C;
|
|
3284
3284
|
})() : G;
|
|
3285
3285
|
if (_ === !0) {
|
|
3286
3286
|
const C = document.createElement("span");
|
|
3287
3287
|
C.className = "gengage-chat-price-skeleton", G.appendChild(C), setTimeout(() => {
|
|
3288
|
-
C.parentElement && (u && parseFloat(u) > 0 ?
|
|
3288
|
+
C.parentElement && (u && parseFloat(u) > 0 ? Nt(G, e, n, u, n.originalPrice) : C.remove());
|
|
3289
3289
|
}, 300);
|
|
3290
|
-
} else u && parseFloat(u) > 0 &&
|
|
3291
|
-
if ((G.childElementCount > 0 || _ === !0) &&
|
|
3290
|
+
} else u && parseFloat(u) > 0 && Nt(G, e, n, u, g);
|
|
3291
|
+
if ((G.childElementCount > 0 || _ === !0) && R.appendChild(W), E) {
|
|
3292
3292
|
const C = document.createElement("div");
|
|
3293
3293
|
C.className = "gengage-chat-product-card-rating gengage-chat-product-card-rating-compact";
|
|
3294
|
-
const
|
|
3295
|
-
typeof v == "number" && Number.isFinite(v) &&
|
|
3294
|
+
const U = ea(x), B = [`${U.toFixed(1)}`, "out of 5 stars"];
|
|
3295
|
+
typeof v == "number" && Number.isFinite(v) && B.push(`(${v} reviews)`), C.setAttribute("aria-label", B.join(" "));
|
|
3296
3296
|
const j = document.createElement("span");
|
|
3297
3297
|
j.className = "gengage-chat-product-card-rating-compact-star", j.setAttribute("aria-hidden", "true"), j.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>';
|
|
3298
3298
|
const F = document.createElement("span");
|
|
3299
|
-
F.className = "gengage-chat-product-card-rating-compact-value", F.textContent =
|
|
3299
|
+
F.className = "gengage-chat-product-card-rating-compact-value", F.textContent = U.toFixed(1), C.appendChild(j), C.appendChild(F), R.appendChild(C);
|
|
3300
3300
|
}
|
|
3301
|
-
if (
|
|
3301
|
+
if (R.childElementCount === 0 && (R.classList.add("gengage-chat-product-card-meta-row--empty"), R.setAttribute("aria-hidden", "true")), h.appendChild(R), o) {
|
|
3302
3302
|
const C = document.createElement("div");
|
|
3303
3303
|
C.className = "gengage-chat-product-card-name", C.textContent = o, C.title = o, h.appendChild(C);
|
|
3304
3304
|
}
|
|
3305
|
-
const
|
|
3306
|
-
if (e.hideStockStatus !== !0 && typeof
|
|
3305
|
+
const P = n.inStock;
|
|
3306
|
+
if (e.hideStockStatus !== !0 && typeof P == "boolean") {
|
|
3307
3307
|
const C = document.createElement("div");
|
|
3308
|
-
C.className = `gengage-chat-product-card-stock ${
|
|
3308
|
+
C.className = `gengage-chat-product-card-stock ${P ? "is-in-stock" : "is-out-of-stock"}`, C.textContent = P ? e.i18n?.inStockLabel ?? "In Stock" : e.i18n?.outOfStockLabel ?? "Out of Stock", h.appendChild(C);
|
|
3309
3309
|
}
|
|
3310
3310
|
a.appendChild(h);
|
|
3311
|
-
const H = n.cartCode, D = !!(H && c &&
|
|
3311
|
+
const H = n.cartCode, D = !!(H && c && P !== !1), N = e.i18n?.productCtaLabel ?? "View";
|
|
3312
3312
|
if (D) {
|
|
3313
3313
|
const C = document.createElement("div");
|
|
3314
3314
|
C.className = "gengage-chat-product-card-buy-footer";
|
|
3315
|
-
const
|
|
3316
|
-
|
|
3317
|
-
|
|
3315
|
+
const U = document.createElement("button");
|
|
3316
|
+
U.type = "button", U.className = "gengage-chat-product-card-buy-trigger", U.textContent = N, U.addEventListener("click", (B) => {
|
|
3317
|
+
B.stopPropagation(), e.onAction({
|
|
3318
3318
|
title: e.i18n?.addToCartButton ?? N,
|
|
3319
3319
|
type: "addToCart",
|
|
3320
3320
|
payload: {
|
|
@@ -3323,24 +3323,24 @@ function dt(t, e) {
|
|
|
3323
3323
|
quantity: 1
|
|
3324
3324
|
}
|
|
3325
3325
|
});
|
|
3326
|
-
}), C.appendChild(
|
|
3326
|
+
}), C.appendChild(U), a.appendChild(C);
|
|
3327
3327
|
} else if (i) {
|
|
3328
3328
|
const C = document.createElement("button");
|
|
3329
|
-
C.className = "gengage-chat-product-card-cta", C.type = "button", C.textContent = i.type === "launchSingleProduct" ? N : i.title || N, C.addEventListener("click", (
|
|
3329
|
+
C.className = "gengage-chat-product-card-cta", C.type = "button", C.textContent = i.type === "launchSingleProduct" ? N : i.title || N, C.addEventListener("click", (U) => {
|
|
3330
3330
|
if (a.parentElement?.classList.contains("gengage-chat-comparison-select-wrapper")) {
|
|
3331
|
-
|
|
3331
|
+
U.stopPropagation();
|
|
3332
3332
|
return;
|
|
3333
3333
|
}
|
|
3334
3334
|
d() || e.onAction(i);
|
|
3335
3335
|
}), a.appendChild(C);
|
|
3336
3336
|
} else if (l) {
|
|
3337
3337
|
const C = document.createElement("a");
|
|
3338
|
-
C.className = "gengage-chat-product-card-cta", pe(C, "href", l), pe(C, "target", "_blank"), pe(C, "rel", "noopener noreferrer"), C.textContent = N, C.addEventListener("click", (
|
|
3338
|
+
C.className = "gengage-chat-product-card-cta", pe(C, "href", l), pe(C, "target", "_blank"), pe(C, "rel", "noopener noreferrer"), C.textContent = N, C.addEventListener("click", (U) => {
|
|
3339
3339
|
if (a.parentElement?.classList.contains("gengage-chat-comparison-select-wrapper")) {
|
|
3340
|
-
|
|
3340
|
+
U.preventDefault(), U.stopPropagation();
|
|
3341
3341
|
return;
|
|
3342
3342
|
}
|
|
3343
|
-
e.onProductClick && c && (
|
|
3343
|
+
e.onProductClick && c && (U.preventDefault(), e.onProductClick({
|
|
3344
3344
|
sku: c,
|
|
3345
3345
|
url: l,
|
|
3346
3346
|
...o ? { name: o } : {}
|
|
@@ -3350,16 +3350,16 @@ function dt(t, e) {
|
|
|
3350
3350
|
if (e.comparisonSelectMode && c && e.onToggleComparisonSku) {
|
|
3351
3351
|
const C = document.createElement("div");
|
|
3352
3352
|
C.className = "gengage-chat-comparison-select-wrapper";
|
|
3353
|
-
const
|
|
3354
|
-
|
|
3355
|
-
const
|
|
3356
|
-
C.setAttribute("role", "group"), C.setAttribute("aria-label", `${String(
|
|
3353
|
+
const U = e.comparisonSelectedSkus?.includes(c) ?? !1;
|
|
3354
|
+
U && C.classList.add("gengage-chat-comparison-select-wrapper--selected");
|
|
3355
|
+
const B = n.name ?? c, j = e.i18n?.comparisonSelectCardHint ?? "Tap anywhere on the card to add or remove it from comparison.";
|
|
3356
|
+
C.setAttribute("role", "group"), C.setAttribute("aria-label", `${String(B)}. ${j}`);
|
|
3357
3357
|
const F = document.createElement("button");
|
|
3358
|
-
F.type = "button", F.className = "gengage-chat-comparison-checkbox", F.dataset.selected =
|
|
3359
|
-
const
|
|
3360
|
-
|
|
3358
|
+
F.type = "button", F.className = "gengage-chat-comparison-checkbox", F.dataset.selected = U ? "true" : "false", F.setAttribute("aria-pressed", U ? "true" : "false");
|
|
3359
|
+
const ne = document.createElement("span");
|
|
3360
|
+
ne.className = "gengage-chat-comparison-checkbox-icon", ne.innerHTML = U ? '<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M20 6L9 17l-5-5"/></svg>' : '<span class="gengage-chat-comparison-checkbox-dot"></span>';
|
|
3361
3361
|
const X = document.createElement("span");
|
|
3362
|
-
X.className = "gengage-chat-comparison-checkbox-label", X.textContent =
|
|
3362
|
+
X.className = "gengage-chat-comparison-checkbox-label", X.textContent = U ? e.i18n?.comparisonSelectedLabel ?? "Selected" : e.i18n?.comparisonSelectLabel ?? "Select to compare", F.appendChild(ne), F.appendChild(X), F.addEventListener("click", (f) => {
|
|
3363
3363
|
f.stopPropagation(), e.onToggleComparisonSku?.(c);
|
|
3364
3364
|
});
|
|
3365
3365
|
const V = document.createElement("div");
|
|
@@ -3369,7 +3369,7 @@ function dt(t, e) {
|
|
|
3369
3369
|
}
|
|
3370
3370
|
return a;
|
|
3371
3371
|
}
|
|
3372
|
-
var
|
|
3372
|
+
var pa = /* @__PURE__ */ new Set([
|
|
3373
3373
|
"color",
|
|
3374
3374
|
"colour",
|
|
3375
3375
|
"renk",
|
|
@@ -3420,7 +3420,7 @@ function fe(t, ...e) {
|
|
|
3420
3420
|
}
|
|
3421
3421
|
}
|
|
3422
3422
|
}
|
|
3423
|
-
function
|
|
3423
|
+
function Ke(t, ...e) {
|
|
3424
3424
|
for (const a of e) {
|
|
3425
3425
|
const n = t[a];
|
|
3426
3426
|
if (typeof n == "number" && Number.isFinite(n)) return n;
|
|
@@ -3430,7 +3430,7 @@ function We(t, ...e) {
|
|
|
3430
3430
|
}
|
|
3431
3431
|
}
|
|
3432
3432
|
}
|
|
3433
|
-
function
|
|
3433
|
+
function Ge(t, ...e) {
|
|
3434
3434
|
for (const a of e) {
|
|
3435
3435
|
const n = t[a];
|
|
3436
3436
|
if (typeof n == "boolean") return n;
|
|
@@ -3464,7 +3464,7 @@ function Zr(t) {
|
|
|
3464
3464
|
const a = fe(t, "description");
|
|
3465
3465
|
return a ? { text: a } : void 0;
|
|
3466
3466
|
}
|
|
3467
|
-
function
|
|
3467
|
+
function Ye(t) {
|
|
3468
3468
|
return Array.isArray(t) ? t.map((e) => {
|
|
3469
3469
|
if (!e || typeof e != "object") return null;
|
|
3470
3470
|
const a = e, n = fe(a, "key", "name", "label", "title"), r = a.value, i = typeof r == "string" || typeof r == "number" || typeof r == "boolean" ? String(r).trim() : void 0;
|
|
@@ -3480,54 +3480,54 @@ function Ke(t) {
|
|
|
3480
3480
|
};
|
|
3481
3481
|
}).filter((e) => e !== null) : [];
|
|
3482
3482
|
}
|
|
3483
|
-
function
|
|
3484
|
-
const e =
|
|
3485
|
-
return e.length > 0 ? e :
|
|
3483
|
+
function ha(t) {
|
|
3484
|
+
const e = Ye(t.features);
|
|
3485
|
+
return e.length > 0 ? e : Ye(t.specifications);
|
|
3486
3486
|
}
|
|
3487
3487
|
function Xr(t) {
|
|
3488
|
-
const e = t.specifications, a =
|
|
3488
|
+
const e = t.specifications, a = Ye(e);
|
|
3489
3489
|
if (a.length > 0) return Array.isArray(e) ? a : Object.fromEntries(a.map((r) => [r.key, r.value]));
|
|
3490
|
-
const n =
|
|
3490
|
+
const n = Ye(t.features);
|
|
3491
3491
|
return n.length > 0 ? n : void 0;
|
|
3492
3492
|
}
|
|
3493
3493
|
function Ee(t, ...e) {
|
|
3494
3494
|
return fe(t, ...e);
|
|
3495
3495
|
}
|
|
3496
|
-
function
|
|
3497
|
-
return
|
|
3496
|
+
function zt(t, ...e) {
|
|
3497
|
+
return Ke(t, ...e);
|
|
3498
3498
|
}
|
|
3499
|
-
function
|
|
3499
|
+
function ua(t) {
|
|
3500
3500
|
return Ee(t, "value", "option_value", "attribute_value", "label", "title", "name", "variant_name", "sku");
|
|
3501
3501
|
}
|
|
3502
|
-
function
|
|
3502
|
+
function ma(t) {
|
|
3503
3503
|
const e = Ee(t, "type", "attribute", "option_name", "attribute_name");
|
|
3504
3504
|
return e || (Ee(t, "value") ? Ee(t, "name", "variant_name") : void 0);
|
|
3505
3505
|
}
|
|
3506
3506
|
function Qr(t) {
|
|
3507
|
-
const e =
|
|
3508
|
-
return !!(fe(t, "color", "colour", "color_hex", "hex", "swatch", "swatchColor") || e &&
|
|
3507
|
+
const e = ma(t)?.toLowerCase();
|
|
3508
|
+
return !!(fe(t, "color", "colour", "color_hex", "hex", "swatch", "swatchColor") || e && pa.has(e));
|
|
3509
3509
|
}
|
|
3510
|
-
function
|
|
3510
|
+
function Rt(t) {
|
|
3511
3511
|
if (!t) return;
|
|
3512
3512
|
const e = t.trim();
|
|
3513
3513
|
if (!(!e || e.includes(";")) && (typeof CSS < "u" && CSS.supports?.("color", e) || /^#(?:[0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(e)))
|
|
3514
3514
|
return e;
|
|
3515
3515
|
}
|
|
3516
3516
|
function Jr(t) {
|
|
3517
|
-
const e =
|
|
3517
|
+
const e = Rt(Ee(t, "swatchColor", "swatch", "color_hex", "hex", "color", "colour"));
|
|
3518
3518
|
if (e) return e;
|
|
3519
3519
|
if (Qr(t))
|
|
3520
|
-
return
|
|
3520
|
+
return Rt(ua(t));
|
|
3521
3521
|
}
|
|
3522
3522
|
function ei(t) {
|
|
3523
3523
|
return Ee(t, "image", "imageUrl", "image_url", "swatchImage", "swatch_image");
|
|
3524
3524
|
}
|
|
3525
3525
|
function ti(t) {
|
|
3526
|
-
return
|
|
3526
|
+
return zt(t, "price_discounted", "priceDiscounted") ?? Ee(t, "price_discounted", "priceDiscounted") ?? zt(t, "price") ?? Ee(t, "price");
|
|
3527
3527
|
}
|
|
3528
3528
|
function ai(t) {
|
|
3529
3529
|
const e = t.trim().toLowerCase();
|
|
3530
|
-
return
|
|
3530
|
+
return pa.has(e) || Ur.has(e) || jr.has(e);
|
|
3531
3531
|
}
|
|
3532
3532
|
function ni(t) {
|
|
3533
3533
|
const e = t.trim().toLowerCase();
|
|
@@ -3544,7 +3544,7 @@ function ri(t) {
|
|
|
3544
3544
|
function ii(t) {
|
|
3545
3545
|
const e = ri(t);
|
|
3546
3546
|
if (e) return e;
|
|
3547
|
-
const a = fe(t, "sku"), n =
|
|
3547
|
+
const a = fe(t, "sku"), n = Ge(t, "inStock", "in_stock"), r = [], i = /* @__PURE__ */ new Set(), o = (c, l) => {
|
|
3548
3548
|
if (!ai(c) || typeof l != "string" && typeof l != "number" && typeof l != "boolean") return;
|
|
3549
3549
|
const d = String(l).trim();
|
|
3550
3550
|
if (!d) return;
|
|
@@ -3557,11 +3557,11 @@ function ii(t) {
|
|
|
3557
3557
|
}));
|
|
3558
3558
|
}, s = Gr(t, "facetHits", "facet_hits");
|
|
3559
3559
|
if (s) for (const [c, l] of Object.entries(s)) o(c, l);
|
|
3560
|
-
for (const c of
|
|
3560
|
+
for (const c of ha(t)) o(c.key, c.value);
|
|
3561
3561
|
return r;
|
|
3562
3562
|
}
|
|
3563
3563
|
function oi(t, e) {
|
|
3564
|
-
const a = Array.from(new Set(t.map(
|
|
3564
|
+
const a = Array.from(new Set(t.map(ma).filter((n) => !!n)));
|
|
3565
3565
|
return a.length === 1 ? `${t.length} ${a[0]}` : e.i18n?.variantsLabel ?? "Variants";
|
|
3566
3566
|
}
|
|
3567
3567
|
function si(t, e) {
|
|
@@ -3569,195 +3569,195 @@ function si(t, e) {
|
|
|
3569
3569
|
a.className = "gengage-chat-product-details-panel";
|
|
3570
3570
|
const n = t.props?.product ?? t.props;
|
|
3571
3571
|
if (!n) return a;
|
|
3572
|
-
const r = fe(n, "name"), i = fe(n, "brand"), o = fe(n, "sku"), s = fe(n, "cartCode", "cart_code"), c = fe(n, "price"), l = fe(n, "originalPrice", "price_original"), d =
|
|
3572
|
+
const r = fe(n, "name"), i = fe(n, "brand"), o = fe(n, "sku"), s = fe(n, "cartCode", "cart_code"), c = fe(n, "price"), l = fe(n, "originalPrice", "price_original"), d = Ge(n, "price_async"), p = He(e, n), h = $e(e, n), m = !!(l && c && l !== c), x = Ge(n, "inStock", "in_stock"), v = Ke(n, "reviewCount", "review_count"), u = Ke(n, "rating"), g = Kr(n), _ = ha(n).slice(0, 4);
|
|
3573
3573
|
if (g.length > 1) {
|
|
3574
|
-
const
|
|
3575
|
-
|
|
3574
|
+
const P = document.createElement("div");
|
|
3575
|
+
P.className = "gengage-chat-product-details-media gengage-chat-product-details-gallery gengage-chat-product-details-img-wrap";
|
|
3576
3576
|
const H = document.createElement("img");
|
|
3577
|
-
H.className = "gengage-chat-product-details-img", pe(H, "src", g[0]), H.alt = r ?? "Product image", ve(H),
|
|
3577
|
+
H.className = "gengage-chat-product-details-img", pe(H, "src", g[0]), H.alt = r ?? "Product image", ve(H), P.appendChild(H);
|
|
3578
3578
|
const D = document.createElement("div");
|
|
3579
3579
|
D.className = "gengage-chat-product-gallery-thumbs";
|
|
3580
3580
|
const N = 6;
|
|
3581
|
-
let C = null,
|
|
3582
|
-
const
|
|
3583
|
-
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", j), X.innerHTML =
|
|
3581
|
+
let C = null, U = 0;
|
|
3582
|
+
const B = e.i18n, j = B?.galleryPrevAriaLabel ?? "Previous image", F = B?.galleryNextAriaLabel ?? "Next image", ne = (I) => I === "prev" ? '<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="15 18 9 12 15 6"/></svg>' : '<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="9 18 15 12 9 6"/></svg>', X = document.createElement("button");
|
|
3583
|
+
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", j), X.innerHTML = ne("prev");
|
|
3584
3584
|
const V = document.createElement("button");
|
|
3585
|
-
V.type = "button", V.className = "gengage-chat-product-gallery-nav gengage-chat-product-gallery-nav--next gds-btn gds-btn-ghost gds-icon-btn", V.setAttribute("aria-label", F), V.innerHTML =
|
|
3585
|
+
V.type = "button", V.className = "gengage-chat-product-gallery-nav gengage-chat-product-gallery-nav--next gds-btn gds-btn-ghost gds-icon-btn", V.setAttribute("aria-label", F), V.innerHTML = ne("next");
|
|
3586
3586
|
const f = () => {
|
|
3587
|
-
X.disabled =
|
|
3588
|
-
},
|
|
3589
|
-
if (I < 0 || I >= g.length || I ===
|
|
3590
|
-
const
|
|
3591
|
-
if (!
|
|
3592
|
-
pe(H, "src",
|
|
3593
|
-
const
|
|
3594
|
-
C && C.classList.remove("gengage-chat-product-gallery-thumb--active"), I < N &&
|
|
3587
|
+
X.disabled = U <= 0, V.disabled = U >= g.length - 1;
|
|
3588
|
+
}, S = (I) => {
|
|
3589
|
+
if (I < 0 || I >= g.length || I === U) return;
|
|
3590
|
+
const O = g[I];
|
|
3591
|
+
if (!O) return;
|
|
3592
|
+
pe(H, "src", O);
|
|
3593
|
+
const J = D.querySelectorAll(".gengage-chat-product-gallery-thumb");
|
|
3594
|
+
C && C.classList.remove("gengage-chat-product-gallery-thumb--active"), I < N && J[I] ? (J[I].classList.add("gengage-chat-product-gallery-thumb--active"), C = J[I]) : C = null, U = I, f();
|
|
3595
3595
|
};
|
|
3596
3596
|
for (let I = 0; I < g.length; I++) {
|
|
3597
|
-
const
|
|
3597
|
+
const O = g[I];
|
|
3598
3598
|
if (I >= N) break;
|
|
3599
|
-
const
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
}), D.appendChild(
|
|
3599
|
+
const J = document.createElement("img");
|
|
3600
|
+
J.className = "gengage-chat-product-gallery-thumb", I === 0 && (J.classList.add("gengage-chat-product-gallery-thumb--active"), C = J), pe(J, "src", O), J.alt = `${r ?? "Product"} ${I + 1}`, J.width = 48, J.height = 48, ve(J), J.addEventListener("click", () => {
|
|
3601
|
+
S(I);
|
|
3602
|
+
}), D.appendChild(J);
|
|
3603
3603
|
}
|
|
3604
3604
|
if (g.length > N) {
|
|
3605
3605
|
const I = document.createElement("span");
|
|
3606
3606
|
I.className = "gengage-chat-product-gallery-thumb-more", I.textContent = `+${g.length - N}`, D.appendChild(I);
|
|
3607
3607
|
}
|
|
3608
3608
|
X.addEventListener("click", (I) => {
|
|
3609
|
-
I.stopPropagation(),
|
|
3609
|
+
I.stopPropagation(), S(U - 1);
|
|
3610
3610
|
}), V.addEventListener("click", (I) => {
|
|
3611
|
-
I.stopPropagation(),
|
|
3611
|
+
I.stopPropagation(), S(U + 1);
|
|
3612
3612
|
}), f();
|
|
3613
3613
|
let T = 0;
|
|
3614
|
-
const
|
|
3614
|
+
const q = 50;
|
|
3615
3615
|
H.addEventListener("touchstart", (I) => {
|
|
3616
3616
|
T = I.changedTouches[0].clientX;
|
|
3617
3617
|
}, { passive: !0 }), H.addEventListener("touchend", (I) => {
|
|
3618
|
-
const
|
|
3619
|
-
Math.abs(
|
|
3620
|
-
}),
|
|
3618
|
+
const O = I.changedTouches[0].clientX, J = T - O;
|
|
3619
|
+
Math.abs(J) < q || S(J > 0 ? Math.min(U + 1, g.length - 1) : Math.max(U - 1, 0));
|
|
3620
|
+
}), P.appendChild(X), P.appendChild(V), P.appendChild(D), a.appendChild(P);
|
|
3621
3621
|
} else if (g.length === 1) {
|
|
3622
|
-
const
|
|
3623
|
-
|
|
3622
|
+
const P = document.createElement("div");
|
|
3623
|
+
P.className = "gengage-chat-product-details-media gengage-chat-product-details-img-wrap";
|
|
3624
3624
|
const H = document.createElement("img");
|
|
3625
|
-
H.className = "gengage-chat-product-details-img", H.loading = "lazy", pe(H, "src", g[0]), ve(H), H.alt = r ?? "Product image",
|
|
3625
|
+
H.className = "gengage-chat-product-details-img", H.loading = "lazy", pe(H, "src", g[0]), ve(H), H.alt = r ?? "Product image", P.appendChild(H), a.appendChild(P);
|
|
3626
3626
|
}
|
|
3627
3627
|
const y = document.createElement("div");
|
|
3628
3628
|
if (y.className = "gengage-chat-product-details-content", i && (!r || !r.toLowerCase().startsWith(i.toLowerCase()))) {
|
|
3629
|
-
const
|
|
3630
|
-
|
|
3629
|
+
const P = document.createElement("div");
|
|
3630
|
+
P.className = "gengage-chat-product-details-brand", P.textContent = i, y.appendChild(P);
|
|
3631
3631
|
}
|
|
3632
3632
|
if (r) {
|
|
3633
|
-
const
|
|
3634
|
-
|
|
3633
|
+
const P = document.createElement("h3");
|
|
3634
|
+
P.className = "gengage-chat-product-details-title", P.textContent = r, P.title = r, y.appendChild(P);
|
|
3635
3635
|
}
|
|
3636
3636
|
if (e.hideUserReviews !== !0 && typeof u == "number" && Number.isFinite(u) && u > 0) {
|
|
3637
|
-
const
|
|
3638
|
-
|
|
3637
|
+
const P = document.createElement(o ? "button" : "div");
|
|
3638
|
+
P.className = "gengage-chat-product-details-rating", o && (P.type = "button", P.classList.add("gengage-chat-product-details-rating--clickable"), P.setAttribute("aria-label", e.i18n?.groundingReviewCta ?? "Read Reviews"), P.addEventListener("click", () => {
|
|
3639
3639
|
e.onAction({
|
|
3640
3640
|
title: e.i18n?.customerReviewsTitle ?? "Customer Reviews",
|
|
3641
3641
|
type: "reviewSummary",
|
|
3642
3642
|
payload: { sku: o }
|
|
3643
3643
|
});
|
|
3644
|
-
})),
|
|
3644
|
+
})), P.appendChild(Jt(u));
|
|
3645
3645
|
const H = document.createElement("span");
|
|
3646
|
-
if (H.className = "gengage-chat-product-details-rating-value", H.textContent =
|
|
3646
|
+
if (H.className = "gengage-chat-product-details-rating-value", H.textContent = ea(u).toFixed(1), P.appendChild(H), typeof v == "number" && Number.isFinite(v)) {
|
|
3647
3647
|
const D = document.createElement("span");
|
|
3648
|
-
D.className = "gengage-chat-product-details-review-count", D.textContent = ` (${v})`,
|
|
3648
|
+
D.className = "gengage-chat-product-details-review-count", D.textContent = ` (${v})`, P.appendChild(D);
|
|
3649
3649
|
}
|
|
3650
|
-
y.appendChild(
|
|
3650
|
+
y.appendChild(P);
|
|
3651
3651
|
}
|
|
3652
3652
|
{
|
|
3653
|
-
const
|
|
3653
|
+
const P = !!(p && m);
|
|
3654
3654
|
let H = y;
|
|
3655
|
-
if (p && !
|
|
3655
|
+
if (p && !P) {
|
|
3656
3656
|
const N = document.createElement("div");
|
|
3657
|
-
N.className = "gengage-chat-product-details-price-stack", N.appendChild(
|
|
3657
|
+
N.className = "gengage-chat-product-details-price-stack", N.appendChild(Qe(p)), y.appendChild(N), H = N;
|
|
3658
3658
|
}
|
|
3659
3659
|
const D = document.createElement("div");
|
|
3660
3660
|
if (D.className = "gengage-chat-product-details-price", d === !0) {
|
|
3661
3661
|
const N = document.createElement("span");
|
|
3662
3662
|
N.className = "gengage-chat-price-skeleton", D.appendChild(N), H.appendChild(D), setTimeout(() => {
|
|
3663
3663
|
if (N.parentElement)
|
|
3664
|
-
if (c && parseFloat(c) > 0)
|
|
3664
|
+
if (c && parseFloat(c) > 0) Bt(D, e, n, c, l, h, m);
|
|
3665
3665
|
else {
|
|
3666
3666
|
const C = D.parentElement;
|
|
3667
3667
|
D.remove(), C?.classList.contains("gengage-chat-product-details-price-stack") && C.remove();
|
|
3668
3668
|
}
|
|
3669
3669
|
}, 300);
|
|
3670
3670
|
} else if (c && parseFloat(c) > 0)
|
|
3671
|
-
|
|
3671
|
+
Bt(D, e, n, c, l, h, m), H.appendChild(D);
|
|
3672
3672
|
else if (p) {
|
|
3673
3673
|
const N = H;
|
|
3674
3674
|
N.classList.contains("gengage-chat-product-details-price-stack") && N.remove();
|
|
3675
3675
|
}
|
|
3676
3676
|
}
|
|
3677
3677
|
if (e.hideStockStatus !== !0 && typeof x == "boolean") {
|
|
3678
|
-
const
|
|
3679
|
-
|
|
3678
|
+
const P = document.createElement("div");
|
|
3679
|
+
P.className = `gengage-chat-product-details-stock ${x ? "is-in-stock" : "is-out-of-stock"}`, P.textContent = x ? e.i18n?.inStockLabel ?? "In Stock" : e.i18n?.outOfStockLabel ?? "Out of Stock", y.appendChild(P);
|
|
3680
3680
|
}
|
|
3681
3681
|
const b = n.promotions;
|
|
3682
3682
|
if (b && b.length > 0) {
|
|
3683
|
-
const
|
|
3684
|
-
|
|
3683
|
+
const P = document.createElement("div");
|
|
3684
|
+
P.className = "gengage-chat-product-details-promos";
|
|
3685
3685
|
for (const H of b.slice(0, 3)) {
|
|
3686
3686
|
if (!H || /%(0(\.0+)?)\s/.test(H)) continue;
|
|
3687
3687
|
const D = document.createElement("span");
|
|
3688
|
-
D.className = "gengage-chat-product-details-promo-badge", D.textContent = H, D.title = H,
|
|
3688
|
+
D.className = "gengage-chat-product-details-promo-badge", D.textContent = H, D.title = H, P.appendChild(D);
|
|
3689
3689
|
}
|
|
3690
|
-
|
|
3690
|
+
P.childElementCount > 0 && y.appendChild(P);
|
|
3691
3691
|
}
|
|
3692
3692
|
if (_.length > 0) {
|
|
3693
|
-
const
|
|
3694
|
-
|
|
3693
|
+
const P = document.createElement("dl");
|
|
3694
|
+
P.className = "gengage-chat-product-details-facts";
|
|
3695
3695
|
for (const H of _) {
|
|
3696
3696
|
const D = document.createElement("div");
|
|
3697
3697
|
D.className = "gengage-chat-product-details-fact";
|
|
3698
3698
|
const N = document.createElement("dt");
|
|
3699
3699
|
N.textContent = H.key;
|
|
3700
3700
|
const C = document.createElement("dd");
|
|
3701
|
-
C.textContent = H.value, D.appendChild(N), D.appendChild(C),
|
|
3701
|
+
C.textContent = H.value, D.appendChild(N), D.appendChild(C), P.appendChild(D);
|
|
3702
3702
|
}
|
|
3703
|
-
y.appendChild(
|
|
3703
|
+
y.appendChild(P);
|
|
3704
3704
|
}
|
|
3705
|
-
const
|
|
3706
|
-
if (
|
|
3707
|
-
const
|
|
3708
|
-
|
|
3705
|
+
const L = ii(n);
|
|
3706
|
+
if (L.length > 0) {
|
|
3707
|
+
const P = document.createElement("div");
|
|
3708
|
+
P.className = "gengage-chat-product-variants";
|
|
3709
3709
|
const H = document.createElement("div");
|
|
3710
|
-
H.className = "gengage-chat-product-variants-label", H.textContent = oi(
|
|
3710
|
+
H.className = "gengage-chat-product-variants-label", H.textContent = oi(L, e), P.appendChild(H);
|
|
3711
3711
|
const D = document.createElement("div");
|
|
3712
3712
|
D.className = "gengage-chat-product-variants-list";
|
|
3713
|
-
for (const N of
|
|
3714
|
-
const C =
|
|
3715
|
-
if (!C && !
|
|
3716
|
-
const
|
|
3717
|
-
|
|
3718
|
-
const j = C ??
|
|
3719
|
-
|
|
3720
|
-
const F =
|
|
3721
|
-
|
|
3722
|
-
const
|
|
3723
|
-
if (
|
|
3724
|
-
const
|
|
3725
|
-
|
|
3713
|
+
for (const N of L) {
|
|
3714
|
+
const C = ua(N), U = Ee(N, "sku");
|
|
3715
|
+
if (!C && !U) continue;
|
|
3716
|
+
const B = document.createElement("button");
|
|
3717
|
+
B.className = "gengage-chat-product-variant-btn gds-chip", B.type = "button";
|
|
3718
|
+
const j = C ?? U ?? "";
|
|
3719
|
+
B.title = j;
|
|
3720
|
+
const F = Ge(N, "in_stock", "inStock");
|
|
3721
|
+
U && o && U === o ? (B.classList.add("gengage-chat-product-variant-btn--active"), B.setAttribute("aria-pressed", "true")) : B.setAttribute("aria-pressed", "false"), F === !1 && (B.classList.add("gengage-chat-product-variant-btn--out"), B.disabled = !0);
|
|
3722
|
+
const ne = ei(N), X = Jr(N);
|
|
3723
|
+
if (ne && xe(ne)) {
|
|
3724
|
+
const S = document.createElement("img");
|
|
3725
|
+
S.className = "gengage-chat-product-variant-swatch gengage-chat-product-variant-swatch--image", pe(S, "src", ne), S.alt = "", S.setAttribute("aria-hidden", "true"), ve(S), B.appendChild(S);
|
|
3726
3726
|
} else if (X) {
|
|
3727
|
-
const
|
|
3728
|
-
|
|
3727
|
+
const S = document.createElement("span");
|
|
3728
|
+
S.className = "gengage-chat-product-variant-swatch", S.setAttribute("aria-hidden", "true"), S.style.backgroundColor = X, B.appendChild(S);
|
|
3729
3729
|
}
|
|
3730
3730
|
const V = document.createElement("span");
|
|
3731
|
-
V.className = "gengage-chat-product-variant-label", V.textContent = j,
|
|
3731
|
+
V.className = "gengage-chat-product-variant-label", V.textContent = j, B.appendChild(V);
|
|
3732
3732
|
const f = ti(N);
|
|
3733
3733
|
if (f && String(f) !== String(c)) {
|
|
3734
|
-
const
|
|
3735
|
-
|
|
3734
|
+
const S = document.createElement("span");
|
|
3735
|
+
S.className = "gengage-chat-product-variant-price", S.textContent = oe(String(f), e.pricing), B.appendChild(S);
|
|
3736
3736
|
}
|
|
3737
|
-
if (
|
|
3738
|
-
const
|
|
3739
|
-
|
|
3737
|
+
if (U && U !== o) {
|
|
3738
|
+
const S = 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() : "") || "", q = S.length > 0 ? T.length > 0 && T !== S ? `${S} (${T})` : S : j;
|
|
3739
|
+
B.addEventListener("click", () => {
|
|
3740
3740
|
e.onAction({
|
|
3741
|
-
title:
|
|
3741
|
+
title: q,
|
|
3742
3742
|
type: "launchVariant",
|
|
3743
|
-
payload: { sku:
|
|
3743
|
+
payload: { sku: U }
|
|
3744
3744
|
});
|
|
3745
3745
|
});
|
|
3746
3746
|
}
|
|
3747
|
-
D.appendChild(
|
|
3747
|
+
D.appendChild(B);
|
|
3748
3748
|
}
|
|
3749
|
-
D.childElementCount > 0 && (
|
|
3749
|
+
D.childElementCount > 0 && (P.appendChild(D), y.appendChild(P));
|
|
3750
3750
|
}
|
|
3751
3751
|
const M = document.createElement("div");
|
|
3752
3752
|
M.className = "gengage-chat-product-details-actions";
|
|
3753
3753
|
const k = t.props?.action;
|
|
3754
3754
|
if (k) {
|
|
3755
|
-
const
|
|
3756
|
-
|
|
3755
|
+
const P = document.createElement("button");
|
|
3756
|
+
P.className = "gengage-chat-product-details-cta gds-btn gds-btn-primary", P.type = "button", P.textContent = k.title || e.i18n?.productCtaLabel || "View", P.addEventListener("click", () => e.onAction(k)), M.appendChild(P);
|
|
3757
3757
|
}
|
|
3758
3758
|
if (s && o && x !== !1) {
|
|
3759
|
-
const
|
|
3760
|
-
|
|
3759
|
+
const P = document.createElement("button");
|
|
3760
|
+
P.className = "gengage-chat-product-details-atc gds-btn gds-btn-primary", P.type = "button", P.textContent = e.i18n?.addToCartButton ?? "Add to Cart", P.addEventListener("click", () => {
|
|
3761
3761
|
e.onAction({
|
|
3762
3762
|
title: e.i18n?.addToCartButton ?? "Add to Cart",
|
|
3763
3763
|
type: "addToCart",
|
|
@@ -3767,48 +3767,48 @@ function si(t, e) {
|
|
|
3767
3767
|
quantity: 1
|
|
3768
3768
|
}
|
|
3769
3769
|
});
|
|
3770
|
-
}), M.appendChild(
|
|
3770
|
+
}), M.appendChild(P);
|
|
3771
3771
|
}
|
|
3772
|
-
const
|
|
3773
|
-
if (!k &&
|
|
3774
|
-
const
|
|
3775
|
-
|
|
3772
|
+
const E = fe(n, "url");
|
|
3773
|
+
if (!k && E && xe(E)) {
|
|
3774
|
+
const P = document.createElement("a");
|
|
3775
|
+
P.className = "gengage-chat-product-details-cta gds-btn gds-btn-secondary", pe(P, "href", E), pe(P, "target", "_blank"), pe(P, "rel", "noopener noreferrer"), P.textContent = e.i18n?.viewOnSiteLabel ?? e.i18n?.productCtaLabel ?? "View on Site", P.addEventListener("click", (H) => {
|
|
3776
3776
|
e.onProductClick && o && (H.preventDefault(), e.onProductClick({
|
|
3777
3777
|
sku: o,
|
|
3778
|
-
url:
|
|
3778
|
+
url: E,
|
|
3779
3779
|
...r ? { name: r } : {}
|
|
3780
3780
|
}));
|
|
3781
|
-
}), M.appendChild(
|
|
3781
|
+
}), M.appendChild(P);
|
|
3782
3782
|
}
|
|
3783
|
-
const
|
|
3784
|
-
if (
|
|
3785
|
-
let C = function(
|
|
3783
|
+
const R = E;
|
|
3784
|
+
if (R && xe(R)) {
|
|
3785
|
+
let C = function(B, j) {
|
|
3786
3786
|
const F = document.createElementNS(D, "circle");
|
|
3787
|
-
F.setAttribute("cx",
|
|
3788
|
-
},
|
|
3787
|
+
F.setAttribute("cx", B), F.setAttribute("cy", j), F.setAttribute("r", "3"), N.appendChild(F);
|
|
3788
|
+
}, U = function(B, j, F, ne) {
|
|
3789
3789
|
const X = document.createElementNS(D, "line");
|
|
3790
|
-
X.setAttribute("x1",
|
|
3790
|
+
X.setAttribute("x1", B), X.setAttribute("y1", j), X.setAttribute("x2", F), X.setAttribute("y2", ne), N.appendChild(X);
|
|
3791
3791
|
};
|
|
3792
|
-
const
|
|
3793
|
-
|
|
3792
|
+
const P = document.createElement("button");
|
|
3793
|
+
P.className = "gengage-chat-product-details-share gds-btn gds-btn-ghost gds-icon-btn", P.type = "button";
|
|
3794
3794
|
const H = e.i18n?.shareButton ?? "Share";
|
|
3795
|
-
|
|
3795
|
+
P.title = H, P.setAttribute("aria-label", H);
|
|
3796
3796
|
const D = "http://www.w3.org/2000/svg", N = document.createElementNS(D, "svg");
|
|
3797
|
-
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"), C("18", "5"), C("6", "12"), C("18", "19"),
|
|
3797
|
+
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"), C("18", "5"), C("6", "12"), C("18", "19"), U("8.59", "13.51", "15.42", "17.49"), U("15.41", "6.51", "8.59", "10.49"), P.appendChild(N), P.addEventListener("click", async () => {
|
|
3798
3798
|
try {
|
|
3799
3799
|
navigator.share ? await navigator.share({
|
|
3800
3800
|
title: r ?? "",
|
|
3801
|
-
url:
|
|
3802
|
-
}) : navigator.clipboard && (await navigator.clipboard.writeText(
|
|
3801
|
+
url: R
|
|
3802
|
+
}) : navigator.clipboard && (await navigator.clipboard.writeText(R), P.classList.add("gengage-chat-product-details-share--copied"), setTimeout(() => P.classList.remove("gengage-chat-product-details-share--copied"), 1500));
|
|
3803
3803
|
} catch {
|
|
3804
3804
|
}
|
|
3805
|
-
}), M.appendChild(
|
|
3805
|
+
}), M.appendChild(P);
|
|
3806
3806
|
}
|
|
3807
3807
|
M.childElementCount > 0 && y.appendChild(M), a.appendChild(y);
|
|
3808
3808
|
const G = Zr(n), W = Xr(n);
|
|
3809
3809
|
return (G || W) && a.appendChild(gi(G, W, e)), a;
|
|
3810
3810
|
}
|
|
3811
|
-
function
|
|
3811
|
+
function ht(t) {
|
|
3812
3812
|
if (t.nodeType === Node.TEXT_NODE) return document.createTextNode(t.textContent ?? "");
|
|
3813
3813
|
if (t.nodeType !== Node.ELEMENT_NODE) return null;
|
|
3814
3814
|
const e = t, a = e.tagName.toUpperCase();
|
|
@@ -3816,14 +3816,14 @@ function pt(t) {
|
|
|
3816
3816
|
if (!$r.has(a)) {
|
|
3817
3817
|
const r = document.createDocumentFragment();
|
|
3818
3818
|
for (const i of Array.from(e.childNodes)) {
|
|
3819
|
-
const o =
|
|
3819
|
+
const o = ht(i);
|
|
3820
3820
|
o && r.appendChild(o);
|
|
3821
3821
|
}
|
|
3822
3822
|
return r;
|
|
3823
3823
|
}
|
|
3824
3824
|
const n = document.createElement(a.toLowerCase());
|
|
3825
3825
|
for (const r of Array.from(e.childNodes)) {
|
|
3826
|
-
const i =
|
|
3826
|
+
const i = ht(r);
|
|
3827
3827
|
i && n.appendChild(i);
|
|
3828
3828
|
}
|
|
3829
3829
|
return n;
|
|
@@ -3838,7 +3838,7 @@ function ci(t, e) {
|
|
|
3838
3838
|
}
|
|
3839
3839
|
function li(t, e) {
|
|
3840
3840
|
if (t.classList.add("gengage-chat-product-description"), e.html && typeof DOMParser < "u") {
|
|
3841
|
-
const a = new DOMParser().parseFromString(e.html, "text/html"), n = Array.from(a.body.childNodes).map((r) =>
|
|
3841
|
+
const a = new DOMParser().parseFromString(e.html, "text/html"), n = Array.from(a.body.childNodes).map((r) => ht(r)).filter((r) => !!r && (r.nodeType === Node.ELEMENT_NODE || !!r.textContent?.trim()));
|
|
3842
3842
|
if (n.length > 0) {
|
|
3843
3843
|
for (const r of n) t.appendChild(r);
|
|
3844
3844
|
return;
|
|
@@ -3890,7 +3890,7 @@ function gi(t, e, a) {
|
|
|
3890
3890
|
for (const s of i) n.appendChild(s);
|
|
3891
3891
|
return n;
|
|
3892
3892
|
}
|
|
3893
|
-
function
|
|
3893
|
+
function Ht(t) {
|
|
3894
3894
|
const e = 'width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"';
|
|
3895
3895
|
switch (t) {
|
|
3896
3896
|
case "related":
|
|
@@ -3912,10 +3912,10 @@ function pi() {
|
|
|
3912
3912
|
function hi() {
|
|
3913
3913
|
return '<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8 3 4 7l4 4"/><path d="M16 21l4-4-4-4"/><path d="M4 7h16"/><path d="M20 17H4"/></svg>';
|
|
3914
3914
|
}
|
|
3915
|
-
function
|
|
3915
|
+
function Ft(t, e) {
|
|
3916
3916
|
return t.type === e.type && t.direction === e.direction;
|
|
3917
3917
|
}
|
|
3918
|
-
function
|
|
3918
|
+
function fa(t, e, a) {
|
|
3919
3919
|
if (!a || a.type === "related") return t;
|
|
3920
3920
|
const n = t.map((r) => {
|
|
3921
3921
|
const i = e.elements[r]?.props?.product, o = i ? Number(i.price) : NaN;
|
|
@@ -3927,7 +3927,7 @@ function ma(t, e, a) {
|
|
|
3927
3927
|
return n.sort((r, i) => r.price === 1 / 0 && i.price === 1 / 0 ? 0 : r.price === 1 / 0 ? 1 : i.price === 1 / 0 ? -1 : a.direction === "desc" ? i.price - r.price : r.price - i.price), n.map((r) => r.id);
|
|
3928
3928
|
}
|
|
3929
3929
|
function ui(t, e, a, n) {
|
|
3930
|
-
const r =
|
|
3930
|
+
const r = fa(e, a, n), i = /* @__PURE__ */ new Map();
|
|
3931
3931
|
for (const o of Array.from(t.children)) {
|
|
3932
3932
|
const s = o.dataset.elementId;
|
|
3933
3933
|
s && i.set(s, o);
|
|
@@ -3940,7 +3940,7 @@ function ui(t, e, a, n) {
|
|
|
3940
3940
|
function mi(t, e, a, n) {
|
|
3941
3941
|
const r = document.createElement("div");
|
|
3942
3942
|
r.className = "gengage-chat-product-grid-wrapper";
|
|
3943
|
-
const i =
|
|
3943
|
+
const i = ft(t), o = i.isConsulting, s = t.children ?? [], c = document.createElement("div");
|
|
3944
3944
|
c.className = "gengage-chat-product-grid";
|
|
3945
3945
|
const l = Array.isArray(t.props?.productSections) ? t.props.productSections.map((g) => ({
|
|
3946
3946
|
title: typeof g.title == "string" ? g.title : "",
|
|
@@ -3953,24 +3953,24 @@ function mi(t, e, a, n) {
|
|
|
3953
3953
|
y.className = "gengage-chat-comparison-toggle-icon", y.innerHTML = hi();
|
|
3954
3954
|
const b = document.createElement("span");
|
|
3955
3955
|
b.className = "gengage-chat-comparison-toggle-label";
|
|
3956
|
-
const
|
|
3957
|
-
b.textContent =
|
|
3956
|
+
const L = n.i18n?.compareSelected ?? "Compare";
|
|
3957
|
+
b.textContent = L, _.setAttribute("aria-label", L), _.title = L, _.appendChild(y), _.appendChild(b), _.addEventListener("click", () => {
|
|
3958
3958
|
n.onToggleComparisonSku?.("");
|
|
3959
3959
|
}), g.appendChild(_);
|
|
3960
3960
|
}, v = (g, _ = s.length) => {
|
|
3961
3961
|
const y = t.props?.endOfList;
|
|
3962
3962
|
if (o || !(d ? y === !1 : y !== !0) || _ === 0) return;
|
|
3963
|
-
const b = n?.i18n?.viewMoreLabel ?? "Show More",
|
|
3964
|
-
|
|
3963
|
+
const b = n?.i18n?.viewMoreLabel ?? "Show More", L = document.createElement("button");
|
|
3964
|
+
L.className = "gengage-chat-product-grid-view-more", L.type = "button", L.textContent = b, L.addEventListener("click", () => {
|
|
3965
3965
|
n?.onAction({
|
|
3966
3966
|
title: b,
|
|
3967
3967
|
type: "moreProductList",
|
|
3968
3968
|
payload: {}
|
|
3969
3969
|
});
|
|
3970
|
-
}), g.appendChild(
|
|
3970
|
+
}), g.appendChild(L);
|
|
3971
3971
|
}, u = () => {
|
|
3972
|
-
const g = n?.isMobile ??
|
|
3973
|
-
n?.comparisonSelectMode && n.comparisonSelectedSkus && !g && r.appendChild(
|
|
3972
|
+
const g = n?.isMobile ?? Ve();
|
|
3973
|
+
n?.comparisonSelectMode && n.comparisonSelectedSkus && !g && r.appendChild(la(n.comparisonSelectedSkus, n));
|
|
3974
3974
|
};
|
|
3975
3975
|
if (m) {
|
|
3976
3976
|
const g = document.createElement("div");
|
|
@@ -4000,67 +4000,67 @@ function mi(t, e, a, n) {
|
|
|
4000
4000
|
}
|
|
4001
4001
|
], b = document.createElement("div");
|
|
4002
4002
|
b.className = "gengage-chat-product-sort-dropdown";
|
|
4003
|
-
const
|
|
4004
|
-
|
|
4003
|
+
const L = document.createElement("button");
|
|
4004
|
+
L.type = "button", L.className = "gengage-chat-product-sort-trigger gds-btn gds-btn-ghost", L.setAttribute("aria-haspopup", "listbox"), L.setAttribute("aria-expanded", "false");
|
|
4005
4005
|
const M = n.i18n?.sortToolbarAriaLabel ?? "Sort products", k = document.createElement("span");
|
|
4006
4006
|
k.className = "gengage-chat-product-sort-trigger-icon";
|
|
4007
|
-
const
|
|
4008
|
-
|
|
4009
|
-
const
|
|
4010
|
-
const j = y.find((F) =>
|
|
4011
|
-
|
|
4007
|
+
const E = document.createElement("span");
|
|
4008
|
+
E.className = "gengage-chat-product-sort-trigger-label";
|
|
4009
|
+
const R = (B) => {
|
|
4010
|
+
const j = y.find((F) => Ft(F.sortState, B)) ?? y[0];
|
|
4011
|
+
E.textContent = j.label, k.innerHTML = Ht(j.icon), b.dataset.sortIcon = j.icon, L.setAttribute("aria-label", `${M}: ${j.label}`), L.title = j.label;
|
|
4012
4012
|
};
|
|
4013
|
-
|
|
4013
|
+
R(_);
|
|
4014
4014
|
const G = document.createElement("span");
|
|
4015
|
-
G.className = "gengage-chat-product-sort-trigger-chevron", G.innerHTML = di(),
|
|
4015
|
+
G.className = "gengage-chat-product-sort-trigger-chevron", G.innerHTML = di(), L.appendChild(k), L.appendChild(E), L.appendChild(G);
|
|
4016
4016
|
const W = document.createElement("div");
|
|
4017
4017
|
W.className = "gengage-chat-product-sort-menu gds-menu", W.hidden = !0, W.setAttribute("role", "listbox"), W.setAttribute("aria-label", M);
|
|
4018
|
-
const
|
|
4018
|
+
const P = g.ownerDocument;
|
|
4019
4019
|
let H = null;
|
|
4020
4020
|
const D = () => {
|
|
4021
|
-
W.hidden = !0, b.classList.remove("gengage-chat-product-sort-dropdown--open"),
|
|
4022
|
-
}, N = (
|
|
4023
|
-
b.classList.contains("gengage-chat-product-sort-dropdown--open") && (b.contains(
|
|
4024
|
-
}, C = (
|
|
4025
|
-
|
|
4026
|
-
},
|
|
4027
|
-
W.hidden = !1, b.classList.add("gengage-chat-product-sort-dropdown--open"),
|
|
4028
|
-
const { signal:
|
|
4029
|
-
|
|
4021
|
+
W.hidden = !0, b.classList.remove("gengage-chat-product-sort-dropdown--open"), L.setAttribute("aria-expanded", "false"), H?.abort(), H = null;
|
|
4022
|
+
}, N = (B) => {
|
|
4023
|
+
b.classList.contains("gengage-chat-product-sort-dropdown--open") && (b.contains(B.target) || D());
|
|
4024
|
+
}, C = (B) => {
|
|
4025
|
+
B.key === "Escape" && (B.preventDefault(), D());
|
|
4026
|
+
}, U = () => {
|
|
4027
|
+
W.hidden = !1, b.classList.add("gengage-chat-product-sort-dropdown--open"), L.setAttribute("aria-expanded", "true"), H = new AbortController();
|
|
4028
|
+
const { signal: B } = H;
|
|
4029
|
+
P.addEventListener("click", N, { signal: B }), P.addEventListener("keydown", C, {
|
|
4030
4030
|
capture: !0,
|
|
4031
|
-
signal:
|
|
4031
|
+
signal: B
|
|
4032
4032
|
});
|
|
4033
4033
|
};
|
|
4034
|
-
|
|
4035
|
-
|
|
4034
|
+
L.addEventListener("click", (B) => {
|
|
4035
|
+
B.stopPropagation(), b.classList.contains("gengage-chat-product-sort-dropdown--open") ? D() : U();
|
|
4036
4036
|
});
|
|
4037
|
-
for (const
|
|
4037
|
+
for (const B of y) {
|
|
4038
4038
|
const j = document.createElement("button");
|
|
4039
4039
|
j.type = "button", j.className = "gengage-chat-product-sort-option gds-menu-option", j.setAttribute("role", "option");
|
|
4040
|
-
const F =
|
|
4040
|
+
const F = Ft(_, B.sortState);
|
|
4041
4041
|
j.setAttribute("aria-selected", F ? "true" : "false"), F && j.classList.add("gengage-chat-product-sort-option--active", "gds-menu-option-active");
|
|
4042
|
-
const
|
|
4043
|
-
j.dataset.sortKey =
|
|
4042
|
+
const ne = B.sortState.type === "related" ? "related" : `price-${B.sortState.direction ?? ""}`;
|
|
4043
|
+
j.dataset.sortKey = ne;
|
|
4044
4044
|
const X = document.createElement("span");
|
|
4045
|
-
X.className = "gengage-chat-product-sort-option-icon", X.innerHTML =
|
|
4045
|
+
X.className = "gengage-chat-product-sort-option-icon", X.innerHTML = Ht(B.icon);
|
|
4046
4046
|
const V = document.createElement("span");
|
|
4047
|
-
V.className = "gengage-chat-product-sort-option-label", V.textContent =
|
|
4047
|
+
V.className = "gengage-chat-product-sort-option-label", V.textContent = B.label;
|
|
4048
4048
|
const f = document.createElement("span");
|
|
4049
4049
|
f.className = "gengage-chat-product-sort-option-check", f.innerHTML = pi(), f.setAttribute("aria-hidden", "true"), F || f.classList.add("gengage-chat-product-sort-option-check--hidden"), j.appendChild(X), j.appendChild(V), j.appendChild(f), j.addEventListener("click", () => {
|
|
4050
|
-
_ =
|
|
4051
|
-
const T =
|
|
4052
|
-
T.classList.toggle("gengage-chat-product-sort-option--active",
|
|
4053
|
-
}),
|
|
4050
|
+
_ = B.sortState, n.onSortChange?.(B.sortState), ui(c, s, e, B.sortState), W.querySelectorAll(".gengage-chat-product-sort-option").forEach((S) => {
|
|
4051
|
+
const T = S, q = T.dataset.sortKey === ne;
|
|
4052
|
+
T.classList.toggle("gengage-chat-product-sort-option--active", q), T.classList.toggle("gds-menu-option-active", q), T.setAttribute("aria-selected", q ? "true" : "false"), T.querySelector(".gengage-chat-product-sort-option-check")?.classList.toggle("gengage-chat-product-sort-option-check--hidden", !q);
|
|
4053
|
+
}), R(B.sortState), D();
|
|
4054
4054
|
}), W.appendChild(j);
|
|
4055
4055
|
}
|
|
4056
|
-
if (b.appendChild(
|
|
4056
|
+
if (b.appendChild(L), b.appendChild(W), g.appendChild(b), x(g), h) {
|
|
4057
4057
|
g.classList.add("gengage-chat-product-sort-toolbar--inline");
|
|
4058
|
-
const
|
|
4059
|
-
|
|
4058
|
+
const B = document.createElement("div");
|
|
4059
|
+
B.className = "gengage-chat-product-grid-head";
|
|
4060
4060
|
const j = document.createElement("span");
|
|
4061
|
-
j.className = "gengage-chat-product-grid-head-title", j.textContent = h,
|
|
4061
|
+
j.className = "gengage-chat-product-grid-head-title", j.textContent = h, B.appendChild(j);
|
|
4062
4062
|
const F = document.createElement("div");
|
|
4063
|
-
F.className = "gengage-chat-product-grid-head-actions", F.appendChild(g),
|
|
4063
|
+
F.className = "gengage-chat-product-grid-head-actions", F.appendChild(g), B.appendChild(F), r.appendChild(B);
|
|
4064
4064
|
} else r.appendChild(g);
|
|
4065
4065
|
} else if (h) {
|
|
4066
4066
|
const g = document.createElement("div");
|
|
@@ -4079,35 +4079,35 @@ function mi(t, e, a, n) {
|
|
|
4079
4079
|
let y = 0;
|
|
4080
4080
|
for (const b of l) {
|
|
4081
4081
|
y += b.children.length;
|
|
4082
|
-
const
|
|
4082
|
+
const L = fi(b.children.length, n), M = document.createElement("section");
|
|
4083
4083
|
M.className = "gengage-chat-product-grid-section", M.setAttribute("role", "listitem");
|
|
4084
4084
|
const k = document.createElement("div");
|
|
4085
4085
|
if (k.className = "gengage-chat-product-grid-section-head", b.title) {
|
|
4086
4086
|
const G = document.createElement("h3");
|
|
4087
4087
|
G.className = "gengage-chat-product-grid-section-title", G.textContent = b.title, k.appendChild(G);
|
|
4088
4088
|
}
|
|
4089
|
-
const
|
|
4090
|
-
|
|
4091
|
-
const
|
|
4092
|
-
|
|
4089
|
+
const E = document.createElement("span");
|
|
4090
|
+
E.className = "gengage-chat-product-grid-section-count", E.textContent = L, k.appendChild(E), M.appendChild(k);
|
|
4091
|
+
const R = document.createElement("div");
|
|
4092
|
+
R.className = "gengage-chat-product-grid gengage-chat-product-grid--section";
|
|
4093
4093
|
for (const G of b.children) {
|
|
4094
4094
|
const W = a(G);
|
|
4095
|
-
W && (W.dataset.elementId = G,
|
|
4095
|
+
W && (W.dataset.elementId = G, R.appendChild(W));
|
|
4096
4096
|
}
|
|
4097
|
-
(n?.isMobile ??
|
|
4097
|
+
(n?.isMobile ?? Ve()) && R.classList.add("gengage-chat-product-grid--mobile"), _ === "pending" && (R.classList.add("gengage-chat-product-grid--pending"), R.inert = !0, R.setAttribute("aria-busy", "true")), M.appendChild(R), g.appendChild(M);
|
|
4098
4098
|
}
|
|
4099
4099
|
return r.appendChild(g), v(r, y), u(), r;
|
|
4100
4100
|
}
|
|
4101
4101
|
if (o) Ci(r, c, i, n);
|
|
4102
4102
|
else {
|
|
4103
|
-
const g =
|
|
4103
|
+
const g = fa(s, e, n?.productSort);
|
|
4104
4104
|
for (const _ of g) {
|
|
4105
4105
|
if (!e.elements[_]) continue;
|
|
4106
4106
|
const y = a(_);
|
|
4107
4107
|
y && (y.dataset.elementId = _, c.appendChild(y));
|
|
4108
4108
|
}
|
|
4109
4109
|
}
|
|
4110
|
-
return (n?.isMobile ??
|
|
4110
|
+
return (n?.isMobile ?? Ve()) && c.classList.add("gengage-chat-product-grid--mobile"), t.props?.rankingState === "pending" && (c.classList.add("gengage-chat-product-grid--pending"), c.inert = !0, c.setAttribute("aria-busy", "true")), r.appendChild(c), v(r), u(), r;
|
|
4111
4111
|
}
|
|
4112
4112
|
function fi(t, e) {
|
|
4113
4113
|
return (e?.i18n?.productGridSectionCountLabel ?? "{count} product(s)").replace(/\{count\}/g, String(t));
|
|
@@ -4153,7 +4153,7 @@ function vi(t, e) {
|
|
|
4153
4153
|
addToCartButton: e.i18n.addToCartButton
|
|
4154
4154
|
});
|
|
4155
4155
|
const m = Xn(h);
|
|
4156
|
-
return (e.isMobile ??
|
|
4156
|
+
return (e.isMobile ?? Ve()) && m.classList.add("gengage-chat-comparison--mobile"), m;
|
|
4157
4157
|
}
|
|
4158
4158
|
function xi(t) {
|
|
4159
4159
|
const e = document.createElement("hr");
|
|
@@ -4169,21 +4169,21 @@ function xi(t) {
|
|
|
4169
4169
|
}
|
|
4170
4170
|
return e;
|
|
4171
4171
|
}
|
|
4172
|
-
var
|
|
4173
|
-
function
|
|
4172
|
+
var Ze = /* @__PURE__ */ new WeakMap();
|
|
4173
|
+
function ba(t) {
|
|
4174
4174
|
return {
|
|
4175
4175
|
...Re,
|
|
4176
4176
|
...t?.i18n ?? {}
|
|
4177
4177
|
};
|
|
4178
4178
|
}
|
|
4179
|
-
function
|
|
4179
|
+
function va(t) {
|
|
4180
4180
|
return t.watchStylesPreparedTitle ?? t.beautyStylesPreparedTitle;
|
|
4181
4181
|
}
|
|
4182
|
-
function
|
|
4182
|
+
function tt(t) {
|
|
4183
4183
|
return typeof t.status == "string" ? t.status : "ready";
|
|
4184
4184
|
}
|
|
4185
|
-
function
|
|
4186
|
-
const e = t.findIndex((a) =>
|
|
4185
|
+
function ut(t) {
|
|
4186
|
+
const e = t.findIndex((a) => tt(a) !== "loading");
|
|
4187
4187
|
return e < 0 ? 0 : e;
|
|
4188
4188
|
}
|
|
4189
4189
|
function yi(t) {
|
|
@@ -4195,13 +4195,13 @@ function yi(t) {
|
|
|
4195
4195
|
if (a && (a = a.replace(/^\/+/, ""), a.startsWith("remoteConfig/") && (a = a.slice(13)), !!a))
|
|
4196
4196
|
return `https://configs.gengage.ai/assets/${a}`;
|
|
4197
4197
|
}
|
|
4198
|
-
function
|
|
4198
|
+
function Dt(t, e, a, n) {
|
|
4199
4199
|
const { grid: r, i18n: i } = t;
|
|
4200
4200
|
r.innerHTML = "", r.classList.remove("gengage-chat-product-grid--consulting-groups");
|
|
4201
4201
|
const o = document.createElement("section");
|
|
4202
4202
|
o.className = "gengage-chat-consulting-loading-panel";
|
|
4203
4203
|
const s = document.createElement("h4");
|
|
4204
|
-
s.className = "gengage-chat-consulting-loading-panel-title", s.textContent =
|
|
4204
|
+
s.className = "gengage-chat-consulting-loading-panel-title", s.textContent = We(e, n, i), o.appendChild(s);
|
|
4205
4205
|
const c = document.createElement("p");
|
|
4206
4206
|
if (c.className = "gengage-chat-consulting-loading-panel-copy", c.textContent = a === "loading" ? i.consultingStyleLoadingDescription : i.consultingStyleUnavailableDescription, o.appendChild(c), a === "loading") {
|
|
4207
4207
|
const l = document.createElement("div");
|
|
@@ -4214,22 +4214,22 @@ function Ft(t, e, a, n) {
|
|
|
4214
4214
|
}
|
|
4215
4215
|
r.appendChild(o);
|
|
4216
4216
|
}
|
|
4217
|
-
function
|
|
4217
|
+
function We(t, e, a) {
|
|
4218
4218
|
const n = (r) => a.consultingFallbackStyleLabel.replace("{index}", String(r));
|
|
4219
4219
|
return t.style_label ?? n(e);
|
|
4220
4220
|
}
|
|
4221
|
-
function
|
|
4221
|
+
function vt(t, e) {
|
|
4222
4222
|
const a = t.variations[e];
|
|
4223
4223
|
if (!a) return;
|
|
4224
4224
|
const { grid: n, ctx: r, i18n: i } = t;
|
|
4225
4225
|
n.innerHTML = "", n.classList.remove("gengage-chat-product-grid--consulting-groups");
|
|
4226
|
-
const o =
|
|
4226
|
+
const o = tt(a), s = e + 1;
|
|
4227
4227
|
if (o === "loading") {
|
|
4228
|
-
|
|
4228
|
+
Dt(t, a, "loading", s);
|
|
4229
4229
|
return;
|
|
4230
4230
|
}
|
|
4231
4231
|
if (o !== "ready" && (!Array.isArray(a.product_list) || a.product_list.length === 0)) {
|
|
4232
|
-
|
|
4232
|
+
Dt(t, a, "unavailable", s);
|
|
4233
4233
|
return;
|
|
4234
4234
|
}
|
|
4235
4235
|
const c = Array.isArray(a.product_list) ? a.product_list : [], l = Array.isArray(a.recommendation_groups) ? a.recommendation_groups : [];
|
|
@@ -4244,23 +4244,23 @@ function bt(t, e) {
|
|
|
4244
4244
|
if (g.length === 0) return;
|
|
4245
4245
|
const b = document.createElement("section");
|
|
4246
4246
|
b.className = "gengage-chat-consulting-group";
|
|
4247
|
-
const
|
|
4248
|
-
|
|
4247
|
+
const L = document.createElement("div");
|
|
4248
|
+
L.className = "gengage-chat-consulting-group-header";
|
|
4249
4249
|
const M = document.createElement("h4");
|
|
4250
|
-
if (M.className = "gengage-chat-consulting-group-label", M.textContent = `${u} (${g.length})`,
|
|
4251
|
-
const
|
|
4252
|
-
|
|
4250
|
+
if (M.className = "gengage-chat-consulting-group-label", M.textContent = `${u} (${g.length})`, L.appendChild(M), typeof y == "string" && y.trim().length > 0) {
|
|
4251
|
+
const E = document.createElement("p");
|
|
4252
|
+
E.className = "gengage-chat-consulting-group-reason", E.textContent = y, L.appendChild(E);
|
|
4253
4253
|
}
|
|
4254
|
-
b.appendChild(
|
|
4254
|
+
b.appendChild(L);
|
|
4255
4255
|
const k = document.createElement("div");
|
|
4256
4256
|
k.className = "gengage-chat-product-grid gengage-chat-consulting-group-grid", _ && k.classList.add("gengage-chat-consulting-group-grid--single-group"), k.style.setProperty("--consulting-group-columns", String(Math.max(1, Math.min(4, g.length))));
|
|
4257
|
-
for (const
|
|
4258
|
-
const
|
|
4257
|
+
for (const E of g) {
|
|
4258
|
+
const R = pt({
|
|
4259
4259
|
type: "ProductCard",
|
|
4260
|
-
props: { product:
|
|
4260
|
+
props: { product: E }
|
|
4261
4261
|
}, r ?? { onAction: () => {
|
|
4262
4262
|
} });
|
|
4263
|
-
k.appendChild(
|
|
4263
|
+
k.appendChild(R);
|
|
4264
4264
|
}
|
|
4265
4265
|
b.appendChild(k), n.appendChild(b);
|
|
4266
4266
|
}, h = /* @__PURE__ */ new Set(), m = [];
|
|
@@ -4287,7 +4287,7 @@ function bt(t, e) {
|
|
|
4287
4287
|
return;
|
|
4288
4288
|
}
|
|
4289
4289
|
for (const d of c) {
|
|
4290
|
-
const p =
|
|
4290
|
+
const p = pt({
|
|
4291
4291
|
type: "ProductCard",
|
|
4292
4292
|
props: { product: d }
|
|
4293
4293
|
}, r ?? { onAction: () => {
|
|
@@ -4295,32 +4295,32 @@ function bt(t, e) {
|
|
|
4295
4295
|
n.appendChild(p);
|
|
4296
4296
|
}
|
|
4297
4297
|
}
|
|
4298
|
-
function
|
|
4299
|
-
const r =
|
|
4300
|
-
t.classList.remove("gengage-chat-consulting-style-btn--loading", "gengage-chat-consulting-style-btn--muted"), r === "loading" ? t.classList.add("gengage-chat-consulting-style-btn--loading") : r !== "ready" && t.classList.add("gengage-chat-consulting-style-btn--muted"), t.setAttribute("aria-label",
|
|
4298
|
+
function mt(t, e, a, n) {
|
|
4299
|
+
const r = tt(e), i = n.consultingStyleLoadingBadge, o = n.consultingStyleUnavailableBadge;
|
|
4300
|
+
t.classList.remove("gengage-chat-consulting-style-btn--loading", "gengage-chat-consulting-style-btn--muted"), r === "loading" ? t.classList.add("gengage-chat-consulting-style-btn--loading") : r !== "ready" && t.classList.add("gengage-chat-consulting-style-btn--muted"), t.setAttribute("aria-label", We(e, a + 1, n));
|
|
4301
4301
|
let s = t.querySelector(".gengage-chat-consulting-style-media");
|
|
4302
4302
|
s ? s.innerHTML = "" : (s = document.createElement("div"), s.className = "gengage-chat-consulting-style-media", t.appendChild(s));
|
|
4303
4303
|
const c = yi(e.image_url);
|
|
4304
4304
|
if (c && xe(c)) {
|
|
4305
4305
|
const d = document.createElement("img");
|
|
4306
|
-
d.className = "gengage-chat-consulting-style-image", d.draggable = !1, pe(d, "src", c), d.alt =
|
|
4306
|
+
d.className = "gengage-chat-consulting-style-image", d.draggable = !1, pe(d, "src", c), d.alt = We(e, a + 1, n), d.loading = "lazy", ve(d), s.appendChild(d);
|
|
4307
4307
|
}
|
|
4308
4308
|
const l = document.createElement("span");
|
|
4309
|
-
if (l.className = "gengage-chat-consulting-style-caption", l.textContent =
|
|
4309
|
+
if (l.className = "gengage-chat-consulting-style-caption", l.textContent = We(e, a + 1, n), s.appendChild(l), r === "loading" || r !== "ready") {
|
|
4310
4310
|
const d = document.createElement("span");
|
|
4311
4311
|
d.className = "gengage-chat-consulting-style-status", d.textContent = r === "loading" ? i : o, s.appendChild(d);
|
|
4312
4312
|
}
|
|
4313
4313
|
}
|
|
4314
|
-
function
|
|
4314
|
+
function xa(t, e, a, n) {
|
|
4315
4315
|
t.addEventListener("click", () => {
|
|
4316
|
-
const r =
|
|
4316
|
+
const r = Ze.get(e);
|
|
4317
4317
|
r && r.selectedIndex !== n && (r.selectedIndex = n, a.querySelectorAll(".gengage-chat-consulting-style-btn").forEach((i, o) => {
|
|
4318
4318
|
i.classList.toggle("gengage-chat-consulting-style-btn--active", o === n);
|
|
4319
|
-
}),
|
|
4319
|
+
}), vt(r, n));
|
|
4320
4320
|
});
|
|
4321
4321
|
}
|
|
4322
4322
|
function wi(t, e, a, n) {
|
|
4323
|
-
const r =
|
|
4323
|
+
const r = ba(n), i = ut(a), o = document.createElement("div");
|
|
4324
4324
|
o.className = "gengage-chat-consulting-style-picker";
|
|
4325
4325
|
const s = {
|
|
4326
4326
|
grid: e,
|
|
@@ -4329,22 +4329,22 @@ function wi(t, e, a, n) {
|
|
|
4329
4329
|
i18n: r,
|
|
4330
4330
|
selectedIndex: i
|
|
4331
4331
|
};
|
|
4332
|
-
|
|
4332
|
+
Ze.set(o, s);
|
|
4333
4333
|
const c = document.createElement("div");
|
|
4334
|
-
c.className = "gengage-chat-consulting-style-picker-title", c.textContent =
|
|
4334
|
+
c.className = "gengage-chat-consulting-style-picker-title", c.textContent = va(r).replace("{count}", String(a.length)), o.appendChild(c);
|
|
4335
4335
|
const l = document.createElement("div");
|
|
4336
4336
|
l.className = "gengage-chat-consulting-style-grid", o.appendChild(l), a.forEach((d, p) => {
|
|
4337
4337
|
const h = document.createElement("button");
|
|
4338
|
-
h.type = "button", h.className = "gengage-chat-consulting-style-btn gds-card", p === i && h.classList.add("gengage-chat-consulting-style-btn--active"),
|
|
4339
|
-
}), t.appendChild(o),
|
|
4338
|
+
h.type = "button", h.className = "gengage-chat-consulting-style-btn gds-card", p === i && h.classList.add("gengage-chat-consulting-style-btn--active"), mt(h, d, p, r), xa(h, o, l, p), l.appendChild(h);
|
|
4339
|
+
}), t.appendChild(o), vt(s, i);
|
|
4340
4340
|
}
|
|
4341
4341
|
function _i(t, e, a) {
|
|
4342
4342
|
const n = t.querySelector(".gengage-chat-consulting-style-picker"), r = ki(t);
|
|
4343
4343
|
if (!n || !r) return !1;
|
|
4344
4344
|
const i = n.querySelector(".gengage-chat-consulting-style-grid");
|
|
4345
4345
|
if (!i) return !1;
|
|
4346
|
-
const o =
|
|
4347
|
-
let s =
|
|
4346
|
+
const o = ba(a);
|
|
4347
|
+
let s = Ze.get(n);
|
|
4348
4348
|
if (s)
|
|
4349
4349
|
s.grid = r, s.ctx = a, s.variations = e, s.i18n = o;
|
|
4350
4350
|
else {
|
|
@@ -4353,26 +4353,26 @@ function _i(t, e, a) {
|
|
|
4353
4353
|
ctx: a,
|
|
4354
4354
|
variations: e,
|
|
4355
4355
|
i18n: o,
|
|
4356
|
-
selectedIndex:
|
|
4356
|
+
selectedIndex: ut(e)
|
|
4357
4357
|
};
|
|
4358
|
-
|
|
4358
|
+
Ze.set(n, h), s = h;
|
|
4359
4359
|
}
|
|
4360
4360
|
const c = n.querySelector(".gengage-chat-consulting-style-picker-title");
|
|
4361
|
-
c && (c.textContent =
|
|
4361
|
+
c && (c.textContent = va(o).replace("{count}", String(e.length)));
|
|
4362
4362
|
const l = s;
|
|
4363
4363
|
let d = l.selectedIndex;
|
|
4364
|
-
d >= e.length && (d = Math.max(0, e.length - 1)), d < 0 && (d = 0), e.length > 0 &&
|
|
4364
|
+
d >= e.length && (d = Math.max(0, e.length - 1)), d < 0 && (d = 0), e.length > 0 && tt(e[d] ?? {}) === "loading" && (d = ut(e)), l.selectedIndex = d;
|
|
4365
4365
|
const p = [...i.querySelectorAll(".gengage-chat-consulting-style-btn")];
|
|
4366
4366
|
if (p.length === 0) return !1;
|
|
4367
4367
|
for (let h = 0; h < e.length; h += 1) {
|
|
4368
4368
|
const m = e[h];
|
|
4369
4369
|
let x = p[h];
|
|
4370
|
-
x ?
|
|
4370
|
+
x ? mt(x, m, h, o) : (x = document.createElement("button"), x.type = "button", x.className = "gengage-chat-consulting-style-btn gds-card", mt(x, m, h, o), xa(x, n, i, h), i.appendChild(x), p[h] = x);
|
|
4371
4371
|
}
|
|
4372
4372
|
for (; i.querySelectorAll(".gengage-chat-consulting-style-btn").length > e.length; ) i.lastElementChild?.remove();
|
|
4373
4373
|
return i.querySelectorAll(".gengage-chat-consulting-style-btn").forEach((h, m) => {
|
|
4374
4374
|
h.classList.toggle("gengage-chat-consulting-style-btn--active", m === l.selectedIndex);
|
|
4375
|
-
}),
|
|
4375
|
+
}), vt(l, l.selectedIndex), !0;
|
|
4376
4376
|
}
|
|
4377
4377
|
function ki(t) {
|
|
4378
4378
|
const e = [...t.children];
|
|
@@ -4382,7 +4382,7 @@ function ki(t) {
|
|
|
4382
4382
|
}
|
|
4383
4383
|
return t.querySelector(":scope > .gengage-chat-product-grid");
|
|
4384
4384
|
}
|
|
4385
|
-
function
|
|
4385
|
+
function ft(t) {
|
|
4386
4386
|
const e = typeof t.props?.source == "string" ? t.props.source : void 0, a = (Array.isArray(t.props?.styleVariations) ? t.props.styleVariations : []).filter((n) => typeof n.style_label == "string" && n.style_label.trim().length > 0);
|
|
4387
4387
|
return {
|
|
4388
4388
|
isConsulting: Ta(e) && a.length > 0,
|
|
@@ -4439,7 +4439,7 @@ function Ti(t) {
|
|
|
4439
4439
|
contentAreaBottom: r
|
|
4440
4440
|
};
|
|
4441
4441
|
}
|
|
4442
|
-
var
|
|
4442
|
+
var Ot = "gengage-floating-launcher-style";
|
|
4443
4443
|
function Li(t) {
|
|
4444
4444
|
return `
|
|
4445
4445
|
@property --gengage-fl-ring-angle {
|
|
@@ -4735,9 +4735,9 @@ function Ii(t, e, a) {
|
|
|
4735
4735
|
"Karşılaştır",
|
|
4736
4736
|
"Soru sor"
|
|
4737
4737
|
], placeholderInterval: x = 2e3, voiceLang: v = "tr-TR", showBorderAnimation: u = !0, sendAriaLabel: g = "Gönder", micAriaLabel: _ = "Sesli giriş", cancelAriaLabel: y = "Ses kaydını durdur", openChatAriaLabel: b = "Chat'i aç" } = t;
|
|
4738
|
-
if (!a.getElementById(
|
|
4738
|
+
if (!a.getElementById(Ot)) {
|
|
4739
4739
|
const Z = document.createElement("style");
|
|
4740
|
-
Z.id =
|
|
4740
|
+
Z.id = Ot, Z.textContent = Li({
|
|
4741
4741
|
primaryColor: n,
|
|
4742
4742
|
backgroundColor: r,
|
|
4743
4743
|
textColor: i,
|
|
@@ -4750,49 +4750,49 @@ function Ii(t, e, a) {
|
|
|
4750
4750
|
fontFamily: h
|
|
4751
4751
|
}), a.appendChild(Z);
|
|
4752
4752
|
}
|
|
4753
|
-
const
|
|
4754
|
-
|
|
4755
|
-
const M =
|
|
4756
|
-
M.placeholder = m[0] ?? "", G.setAttribute("aria-label", g), W.setAttribute("aria-label", _), H.setAttribute("aria-label", y),
|
|
4757
|
-
let C = !1,
|
|
4753
|
+
const L = document.createElement("div");
|
|
4754
|
+
L.className = "gengage-fl", L.dataset.gengagePart = "floating-launcher", L.innerHTML = Ai();
|
|
4755
|
+
const M = L.querySelector(".gengage-fl-input"), k = L.querySelector(".gengage-fl-transcript"), E = L.querySelector(".gengage-fl-transcript-final"), R = L.querySelector(".gengage-fl-transcript-interim"), G = L.querySelector(".gengage-fl-btn-send"), W = L.querySelector(".gengage-fl-btn-mic"), P = L.querySelector(".gengage-fl-btn-open-chat"), H = L.querySelector(".gengage-fl-cancel"), D = L.querySelector(".gengage-fl-wave"), N = L.querySelector(".gengage-fl-ring");
|
|
4756
|
+
M.placeholder = m[0] ?? "", G.setAttribute("aria-label", g), W.setAttribute("aria-label", _), H.setAttribute("aria-label", y), P.setAttribute("aria-label", b);
|
|
4757
|
+
let C = !1, U = !1, B = "", j = !1, F = null, ne = 0, X = null, V = null, f = null, S = null, T = null, q = 0;
|
|
4758
4758
|
function I() {
|
|
4759
4759
|
const Z = M.value.trim().length > 0;
|
|
4760
4760
|
if (W.classList.toggle("is-recording", C), C) {
|
|
4761
|
-
G.style.display = "flex", W.style.display = "flex", H.style.display = "flex",
|
|
4761
|
+
G.style.display = "flex", W.style.display = "flex", H.style.display = "flex", P.style.display = "none";
|
|
4762
4762
|
return;
|
|
4763
4763
|
}
|
|
4764
|
-
G.style.display = Z ? "flex" : "none", W.style.display = Z ? "none" : "flex", H.style.display = "none",
|
|
4765
|
-
}
|
|
4766
|
-
function U() {
|
|
4767
|
-
ae = (ae + 1) % m.length, M.placeholder = m[ae] ?? "", X = setTimeout(U, x);
|
|
4764
|
+
G.style.display = Z ? "flex" : "none", W.style.display = Z ? "none" : "flex", H.style.display = "none", P.style.display = !Z && j ? "flex" : "none";
|
|
4768
4765
|
}
|
|
4769
|
-
function
|
|
4770
|
-
|
|
4766
|
+
function O() {
|
|
4767
|
+
ne = (ne + 1) % m.length, M.placeholder = m[ne] ?? "", X = setTimeout(O, x);
|
|
4771
4768
|
}
|
|
4772
4769
|
function J() {
|
|
4770
|
+
X !== null || m.length <= 1 || (X = setTimeout(O, x));
|
|
4771
|
+
}
|
|
4772
|
+
function re() {
|
|
4773
4773
|
X !== null && (clearTimeout(X), X = null);
|
|
4774
4774
|
}
|
|
4775
4775
|
function te() {
|
|
4776
|
-
C && (C = !1, ce(),
|
|
4776
|
+
C && (C = !1, ce(), U = !1, ie(), u && z(), B = "", M.style.display = "", k.style.display = "none", E.textContent = "", R.textContent = "");
|
|
4777
4777
|
const Z = M.value.trim();
|
|
4778
|
-
Z && (e.onSend(Z), j || (j = !0)), M.value = "",
|
|
4778
|
+
Z && (e.onSend(Z), j || (j = !0)), M.value = "", B = "", I();
|
|
4779
4779
|
}
|
|
4780
|
-
function
|
|
4781
|
-
const Z = window,
|
|
4782
|
-
if (
|
|
4780
|
+
function se() {
|
|
4781
|
+
const Z = window, $ = Z.SpeechRecognition ?? Z.webkitSpeechRecognition;
|
|
4782
|
+
if (!$) {
|
|
4783
4783
|
console.warn("[FloatingLauncher] SpeechRecognition not supported.");
|
|
4784
4784
|
return;
|
|
4785
4785
|
}
|
|
4786
|
-
F || (F = new
|
|
4786
|
+
F || (F = new $(), F.continuous = !0, F.interimResults = !0, F.lang = v), C = !0, U = !0, B = "", M.value = "", M.style.display = "none", k.style.display = "flex", E.textContent = "", R.textContent = "", I(), Q(), u && A(), F.onresult = (K) => {
|
|
4787
4787
|
if (!C) return;
|
|
4788
|
-
let
|
|
4789
|
-
for (let
|
|
4790
|
-
const Ae = K.results[
|
|
4788
|
+
let ae = "", Y = "";
|
|
4789
|
+
for (let ge = K.resultIndex; ge < K.results.length; ge++) {
|
|
4790
|
+
const Ae = K.results[ge];
|
|
4791
4791
|
if (!Ae) continue;
|
|
4792
4792
|
const Fe = Ae[0]?.transcript ?? "";
|
|
4793
|
-
Ae.isFinal ?
|
|
4793
|
+
Ae.isFinal ? Y += Fe : ae += Fe;
|
|
4794
4794
|
}
|
|
4795
|
-
|
|
4795
|
+
B += Y, E.textContent = B, R.textContent = ae, M.value = `${B} ${ae}`.trim(), I();
|
|
4796
4796
|
}, F.onend = () => w(), F.onerror = () => w();
|
|
4797
4797
|
try {
|
|
4798
4798
|
F.start();
|
|
@@ -4807,76 +4807,76 @@ function Ii(t, e, a) {
|
|
|
4807
4807
|
}
|
|
4808
4808
|
}
|
|
4809
4809
|
function w() {
|
|
4810
|
-
|
|
4810
|
+
U && (U = !1, C = !1, ie(), u && z(), B.trim() && (M.value = B.trim()), M.style.display = "", k.style.display = "none", E.textContent = "", R.textContent = "", I());
|
|
4811
4811
|
}
|
|
4812
|
-
async function
|
|
4813
|
-
const Z =
|
|
4812
|
+
async function Q() {
|
|
4813
|
+
const Z = ++q, $ = Array.from(D.querySelectorAll("span"));
|
|
4814
4814
|
try {
|
|
4815
4815
|
const K = await navigator.mediaDevices.getUserMedia({ audio: !0 });
|
|
4816
|
-
if (!C || Z !==
|
|
4816
|
+
if (!C || Z !== q) {
|
|
4817
4817
|
K.getTracks().forEach((Ie) => Ie.stop());
|
|
4818
4818
|
return;
|
|
4819
4819
|
}
|
|
4820
4820
|
V = K;
|
|
4821
|
-
const
|
|
4822
|
-
if (!
|
|
4821
|
+
const ae = window, Y = ae.AudioContext ?? ae.webkitAudioContext;
|
|
4822
|
+
if (!Y)
|
|
4823
4823
|
throw V = null, K.getTracks().forEach((Ie) => Ie.stop()), new Error("AudioContext not supported");
|
|
4824
|
-
const
|
|
4825
|
-
if (!C || Z !==
|
|
4826
|
-
K.getTracks().forEach((Ie) => Ie.stop()),
|
|
4824
|
+
const ge = new Y();
|
|
4825
|
+
if (!C || Z !== q) {
|
|
4826
|
+
K.getTracks().forEach((Ie) => Ie.stop()), ge.close().catch(() => {
|
|
4827
4827
|
});
|
|
4828
4828
|
return;
|
|
4829
4829
|
}
|
|
4830
|
-
f =
|
|
4831
|
-
const Ae = new Uint8Array(
|
|
4832
|
-
if (!C || Z !==
|
|
4833
|
-
|
|
4834
|
-
const Ie = Math.max(1, Math.floor(Ae.length /
|
|
4835
|
-
|
|
4830
|
+
f = ge, S = ge.createAnalyser(), S.fftSize = 256, ge.createMediaStreamSource(K).connect(S);
|
|
4831
|
+
const Ae = new Uint8Array(S.frequencyBinCount), Fe = () => {
|
|
4832
|
+
if (!C || Z !== q || !S) return;
|
|
4833
|
+
S.getByteFrequencyData(Ae);
|
|
4834
|
+
const Ie = Math.max(1, Math.floor(Ae.length / $.length));
|
|
4835
|
+
$.forEach((ka, Ca) => {
|
|
4836
4836
|
ka.style.height = `${4 + Math.round((Ae[Ca * Ie] ?? 0) / 255 * 8)}px`;
|
|
4837
4837
|
}), T = requestAnimationFrame(Fe);
|
|
4838
4838
|
};
|
|
4839
4839
|
Fe();
|
|
4840
4840
|
} catch {
|
|
4841
|
-
if (!C || Z !==
|
|
4842
|
-
T !== null && (cancelAnimationFrame(T), T = null),
|
|
4841
|
+
if (!C || Z !== q) return;
|
|
4842
|
+
T !== null && (cancelAnimationFrame(T), T = null), S && (S.disconnect(), S = null), f && (f.close().catch(() => {
|
|
4843
4843
|
}), f = null), V && (V.getTracks().forEach((K) => K.stop()), V = null), D.classList.add("is-css-animated");
|
|
4844
4844
|
}
|
|
4845
4845
|
}
|
|
4846
|
-
function
|
|
4847
|
-
|
|
4846
|
+
function ie() {
|
|
4847
|
+
q += 1, D.classList.remove("is-css-animated"), T !== null && (cancelAnimationFrame(T), T = null), S && (S.disconnect(), S = null), f && (f.close().catch(() => {
|
|
4848
4848
|
}), f = null), V && (V.getTracks().forEach((Z) => Z.stop()), V = null), Array.from(D.querySelectorAll("span")).forEach((Z) => {
|
|
4849
4849
|
Z.style.height = "4px";
|
|
4850
4850
|
});
|
|
4851
4851
|
}
|
|
4852
|
-
function
|
|
4852
|
+
function A() {
|
|
4853
4853
|
N.classList.add("is-active");
|
|
4854
4854
|
}
|
|
4855
|
-
function
|
|
4855
|
+
function z() {
|
|
4856
4856
|
N.classList.remove("is-active");
|
|
4857
4857
|
}
|
|
4858
4858
|
G.addEventListener("click", te), W.addEventListener("click", (Z) => {
|
|
4859
|
-
Z.preventDefault(), Z.stopPropagation(), C ? ce() :
|
|
4859
|
+
Z.preventDefault(), Z.stopPropagation(), C ? ce() : se();
|
|
4860
4860
|
}), H.addEventListener("click", () => {
|
|
4861
|
-
C && (C = !1, ce(),
|
|
4862
|
-
}),
|
|
4861
|
+
C && (C = !1, ce(), U = !1, ie(), u && z(), B = "", M.style.display = "", k.style.display = "none", E.textContent = "", R.textContent = "", I());
|
|
4862
|
+
}), P.addEventListener("click", (Z) => {
|
|
4863
4863
|
Z.preventDefault(), Z.stopPropagation(), e.onOpenChat();
|
|
4864
4864
|
}), M.addEventListener("input", I), M.addEventListener("keydown", (Z) => {
|
|
4865
4865
|
Z.key === "Enter" && te();
|
|
4866
|
-
}), I(),
|
|
4867
|
-
function
|
|
4866
|
+
}), I(), J();
|
|
4867
|
+
function ee() {
|
|
4868
4868
|
j = !0, I();
|
|
4869
4869
|
}
|
|
4870
|
-
function
|
|
4871
|
-
|
|
4870
|
+
function le() {
|
|
4871
|
+
re(), ie(), z(), C && (C = !1, ce()), F && (F.onresult = null, F.onend = null, F.onerror = null, F = null);
|
|
4872
4872
|
}
|
|
4873
4873
|
return {
|
|
4874
|
-
container:
|
|
4875
|
-
showOpenChatButton:
|
|
4876
|
-
destroy:
|
|
4874
|
+
container: L,
|
|
4875
|
+
showOpenChatButton: ee,
|
|
4876
|
+
destroy: le
|
|
4877
4877
|
};
|
|
4878
4878
|
}
|
|
4879
|
-
var Mi = "gengage-inline-launcher-style",
|
|
4879
|
+
var Mi = "gengage-inline-launcher-style", Ut = "gengage-inline-launcher-hide-floating", me = "gengage-inline-launcher", Ni = "gengage-inline-launcher", je = "data-gengage-inline-sibling", rt = "data-gengage-inline-sibling-restore-index", Bi = '<svg viewBox="0 0 20 20" fill="none" aria-hidden="true"><path d="M8.85 2.4c.23 0 .43.16.48.39l.9 3.77a3.8 3.8 0 0 0 2.8 2.8l3.77.9a.5.5 0 0 1 0 .98l-3.77.9a3.8 3.8 0 0 0-2.8 2.8l-.9 3.77a.5.5 0 0 1-.98 0l-.9-3.77a3.8 3.8 0 0 0-2.8-2.8l-3.77-.9a.5.5 0 0 1 0-.98l3.77-.9a3.8 3.8 0 0 0 2.8-2.8l.9-3.77c.05-.23.25-.39.48-.39Z" fill="currentColor"/><path d="M15.95 1.1c.12 0 .23.08.26.2l.32 1.34c.16.68.7 1.21 1.37 1.37l1.34.32a.27.27 0 0 1 0 .53l-1.34.32a1.87 1.87 0 0 0-1.37 1.37l-.32 1.34a.27.27 0 0 1-.53 0l-.32-1.34A1.87 1.87 0 0 0 14 5.18l-1.34-.32a.27.27 0 0 1 0-.53L14 4a1.87 1.87 0 0 0 1.37-1.37l.32-1.34c.03-.12.14-.2.26-.2Z" fill="currentColor" opacity=".72"/></svg>', de = {
|
|
4880
4880
|
rowGap: "14px",
|
|
4881
4881
|
buttonHeight: "46px",
|
|
4882
4882
|
buttonPadding: "0 14px 0 10px",
|
|
@@ -4903,27 +4903,27 @@ var Mi = "gengage-inline-launcher-style", Ot = "gengage-inline-launcher-hide-flo
|
|
|
4903
4903
|
function zi(t) {
|
|
4904
4904
|
const e = t?.mobile;
|
|
4905
4905
|
return {
|
|
4906
|
-
rowGap: t?.rowGap ??
|
|
4907
|
-
buttonHeight: t?.buttonHeight ??
|
|
4908
|
-
buttonPadding: t?.buttonPadding ??
|
|
4909
|
-
buttonGap: t?.buttonGap ??
|
|
4910
|
-
fontSize: t?.fontSize ??
|
|
4911
|
-
iconSize: t?.iconSize ??
|
|
4912
|
-
iconImageSize: t?.iconImageSize ??
|
|
4913
|
-
sparkSize: t?.sparkSize ??
|
|
4914
|
-
sparkIconSize: t?.sparkIconSize ??
|
|
4906
|
+
rowGap: t?.rowGap ?? de.rowGap,
|
|
4907
|
+
buttonHeight: t?.buttonHeight ?? de.buttonHeight,
|
|
4908
|
+
buttonPadding: t?.buttonPadding ?? de.buttonPadding,
|
|
4909
|
+
buttonGap: t?.buttonGap ?? de.buttonGap,
|
|
4910
|
+
fontSize: t?.fontSize ?? de.fontSize,
|
|
4911
|
+
iconSize: t?.iconSize ?? de.iconSize,
|
|
4912
|
+
iconImageSize: t?.iconImageSize ?? de.iconImageSize,
|
|
4913
|
+
sparkSize: t?.sparkSize ?? de.sparkSize,
|
|
4914
|
+
sparkIconSize: t?.sparkIconSize ?? de.sparkIconSize,
|
|
4915
4915
|
mobile: {
|
|
4916
|
-
rowGap: e?.rowGap ??
|
|
4917
|
-
buttonPadding: e?.buttonPadding ??
|
|
4918
|
-
buttonGap: e?.buttonGap ??
|
|
4919
|
-
fontSize: e?.fontSize ??
|
|
4920
|
-
iconSize: e?.iconSize ??
|
|
4921
|
-
iconImageSize: e?.iconImageSize ??
|
|
4922
|
-
sparkSize: e?.sparkSize ??
|
|
4923
|
-
sparkIconSize: e?.sparkIconSize ??
|
|
4924
|
-
hideTitle: e?.hideTitle ??
|
|
4925
|
-
hideSpark: e?.hideSpark ??
|
|
4926
|
-
hideLogo: e?.hideLogo ??
|
|
4916
|
+
rowGap: e?.rowGap ?? de.mobile.rowGap,
|
|
4917
|
+
buttonPadding: e?.buttonPadding ?? de.mobile.buttonPadding,
|
|
4918
|
+
buttonGap: e?.buttonGap ?? de.mobile.buttonGap,
|
|
4919
|
+
fontSize: e?.fontSize ?? de.mobile.fontSize,
|
|
4920
|
+
iconSize: e?.iconSize ?? de.mobile.iconSize,
|
|
4921
|
+
iconImageSize: e?.iconImageSize ?? de.mobile.iconImageSize,
|
|
4922
|
+
sparkSize: e?.sparkSize ?? de.mobile.sparkSize,
|
|
4923
|
+
sparkIconSize: e?.sparkIconSize ?? de.mobile.sparkIconSize,
|
|
4924
|
+
hideTitle: e?.hideTitle ?? de.mobile.hideTitle,
|
|
4925
|
+
hideSpark: e?.hideSpark ?? de.mobile.hideSpark,
|
|
4926
|
+
hideLogo: e?.hideLogo ?? de.mobile.hideLogo
|
|
4927
4927
|
}
|
|
4928
4928
|
};
|
|
4929
4929
|
}
|
|
@@ -4936,7 +4936,7 @@ ${e}{
|
|
|
4936
4936
|
gap:${c.rowGap};
|
|
4937
4937
|
min-width:0;
|
|
4938
4938
|
}
|
|
4939
|
-
${e} > [${
|
|
4939
|
+
${e} > [${je}]{
|
|
4940
4940
|
flex:1 1 auto;
|
|
4941
4941
|
min-width:0;
|
|
4942
4942
|
}
|
|
@@ -5060,17 +5060,17 @@ function Hi(t) {
|
|
|
5060
5060
|
return new Promise((e) => window.setTimeout(e, t));
|
|
5061
5061
|
}
|
|
5062
5062
|
function Fi(t, e, a) {
|
|
5063
|
-
const { hostSelector: n, rowClassName: r = "gengage-inline-launcher-row", siblingSelector: i, siblingPlacement: o = "before", rowPlacement: s = "end", title: c = "Ask", iconUrl: l, primaryColor: d = "#6366f1", textColor: p = "#222222", fontFamily: h = "inherit", borderRadius: m = "3px", showSparkIcon: x = !0, desktopMinWidth: v = 0, enableOnMobile: u = !1, disabledPageTypes: g = ["pdp"], hideFloatingLauncher: _ = !0, mountPollFrames: y = 90, debounceMs: b = 90, buttonId:
|
|
5064
|
-
let W = !1,
|
|
5065
|
-
const
|
|
5063
|
+
const { hostSelector: n, rowClassName: r = "gengage-inline-launcher-row", siblingSelector: i, siblingPlacement: o = "before", rowPlacement: s = "end", title: c = "Ask", iconUrl: l, primaryColor: d = "#6366f1", textColor: p = "#222222", fontFamily: h = "inherit", borderRadius: m = "3px", showSparkIcon: x = !0, desktopMinWidth: v = 0, enableOnMobile: u = !1, disabledPageTypes: g = ["pdp"], hideFloatingLauncher: _ = !0, mountPollFrames: y = 90, debounceMs: b = 90, buttonId: L = Ni } = t, M = t.ariaLabel ?? c, k = t.siblingRestoreParentSelector ?? n, E = u && v > 0 ? v : 576, R = zi(t.size), G = `${Mi}-${L}`;
|
|
5064
|
+
let W = !1, P = !1, H = null, D = null, N = null, C = null;
|
|
5065
|
+
const U = () => {
|
|
5066
5066
|
if (u && v > 0 && window.innerWidth < v && t.mobileHost && t.mobileHost) {
|
|
5067
|
-
const
|
|
5067
|
+
const A = t.mobileHost;
|
|
5068
5068
|
return {
|
|
5069
|
-
hostSelector:
|
|
5070
|
-
siblingSelector:
|
|
5071
|
-
siblingRestoreParentSelector:
|
|
5072
|
-
rowPlacement:
|
|
5073
|
-
siblingPlacement:
|
|
5069
|
+
hostSelector: A.hostSelector,
|
|
5070
|
+
siblingSelector: A.siblingSelector ?? i,
|
|
5071
|
+
siblingRestoreParentSelector: A.siblingRestoreParentSelector ?? A.hostSelector,
|
|
5072
|
+
rowPlacement: A.rowPlacement ?? s,
|
|
5073
|
+
siblingPlacement: A.siblingPlacement ?? o
|
|
5074
5074
|
};
|
|
5075
5075
|
}
|
|
5076
5076
|
return {
|
|
@@ -5080,135 +5080,143 @@ function Fi(t, e, a) {
|
|
|
5080
5080
|
rowPlacement: s,
|
|
5081
5081
|
siblingPlacement: o
|
|
5082
5082
|
};
|
|
5083
|
-
},
|
|
5084
|
-
|
|
5085
|
-
|
|
5086
|
-
|
|
5087
|
-
].join("|"),
|
|
5083
|
+
}, B = (A) => [
|
|
5084
|
+
A.hostSelector,
|
|
5085
|
+
A.siblingSelector ?? "",
|
|
5086
|
+
A.siblingRestoreParentSelector
|
|
5087
|
+
].join("|"), j = () => {
|
|
5088
5088
|
if (document.getElementById(G)) return;
|
|
5089
|
-
const
|
|
5090
|
-
|
|
5089
|
+
const A = document.createElement("style");
|
|
5090
|
+
A.id = G, A.textContent = Ri({
|
|
5091
5091
|
primaryColor: d,
|
|
5092
5092
|
textColor: p,
|
|
5093
5093
|
fontFamily: h,
|
|
5094
5094
|
borderRadius: m,
|
|
5095
5095
|
rowClassName: r,
|
|
5096
|
-
compactBelowWidth:
|
|
5097
|
-
buttonId:
|
|
5098
|
-
sizes:
|
|
5099
|
-
}), document.head.appendChild(
|
|
5100
|
-
},
|
|
5096
|
+
compactBelowWidth: E,
|
|
5097
|
+
buttonId: L,
|
|
5098
|
+
sizes: R
|
|
5099
|
+
}), document.head.appendChild(A);
|
|
5100
|
+
}, F = (A) => {
|
|
5101
5101
|
if (!_ || !a.shadowRoot) return;
|
|
5102
|
-
const
|
|
5103
|
-
if (!
|
|
5104
|
-
|
|
5102
|
+
const z = a.shadowRoot.getElementById(Ut);
|
|
5103
|
+
if (!A) {
|
|
5104
|
+
z?.remove();
|
|
5105
5105
|
return;
|
|
5106
5106
|
}
|
|
5107
|
-
if (
|
|
5108
|
-
const
|
|
5109
|
-
|
|
5110
|
-
},
|
|
5111
|
-
const
|
|
5112
|
-
return
|
|
5113
|
-
},
|
|
5114
|
-
if (!
|
|
5115
|
-
const
|
|
5116
|
-
return
|
|
5117
|
-
},
|
|
5118
|
-
|
|
5119
|
-
|
|
5120
|
-
|
|
5121
|
-
|
|
5122
|
-
const
|
|
5123
|
-
|
|
5124
|
-
|
|
5125
|
-
|
|
5126
|
-
|
|
5127
|
-
|
|
5128
|
-
|
|
5129
|
-
|
|
5130
|
-
|
|
5131
|
-
|
|
5107
|
+
if (z) return;
|
|
5108
|
+
const ee = document.createElement("style");
|
|
5109
|
+
ee.id = Ut, ee.textContent = ".gengage-chat-launcher-container,.gengage-fl{display:none!important;}", a.shadowRoot.appendChild(ee);
|
|
5110
|
+
}, ne = (A) => {
|
|
5111
|
+
const z = document.querySelector(A);
|
|
5112
|
+
return z instanceof HTMLElement ? z : null;
|
|
5113
|
+
}, X = (A) => {
|
|
5114
|
+
if (!A) return null;
|
|
5115
|
+
const z = document.querySelector(A);
|
|
5116
|
+
return z instanceof HTMLElement ? z : null;
|
|
5117
|
+
}, V = (A) => {
|
|
5118
|
+
if (C?.isConnected) return C;
|
|
5119
|
+
const z = X(A.siblingSelector);
|
|
5120
|
+
return z && (C = z), z;
|
|
5121
|
+
}, f = (A) => {
|
|
5122
|
+
const z = document.querySelector(A);
|
|
5123
|
+
return z instanceof HTMLElement ? z : null;
|
|
5124
|
+
}, S = (A) => {
|
|
5125
|
+
if (A.hasAttribute(rt)) return;
|
|
5126
|
+
const z = A.parentElement;
|
|
5127
|
+
if (!z) return;
|
|
5128
|
+
const ee = Array.from(z.children).indexOf(A);
|
|
5129
|
+
ee >= 0 && A.setAttribute(rt, String(ee));
|
|
5130
|
+
}, T = (A) => {
|
|
5131
|
+
const z = V(A), ee = f(A.siblingRestoreParentSelector);
|
|
5132
|
+
if (!z || !ee) return;
|
|
5133
|
+
if (S(z), z.parentElement === ee) {
|
|
5134
|
+
z.removeAttribute(je);
|
|
5132
5135
|
return;
|
|
5133
5136
|
}
|
|
5134
|
-
|
|
5135
|
-
|
|
5136
|
-
|
|
5137
|
-
|
|
5138
|
-
|
|
5139
|
-
|
|
5140
|
-
|
|
5141
|
-
|
|
5142
|
-
},
|
|
5137
|
+
const le = z.getAttribute(rt), Z = le ? Number.parseInt(le, 10) : 0, $ = Array.from(ee.children).filter((ae) => !(ae instanceof HTMLElement && ae.classList.contains(r))), K = Number.isFinite(Z) && Z >= 0 ? $[Z] ?? null : null;
|
|
5138
|
+
if (K) {
|
|
5139
|
+
ee.insertBefore(z, K), z.removeAttribute(je);
|
|
5140
|
+
return;
|
|
5141
|
+
}
|
|
5142
|
+
ee.appendChild(z), z.removeAttribute(je);
|
|
5143
|
+
}, q = (A) => {
|
|
5144
|
+
A.querySelector(`.${r}`)?.remove();
|
|
5145
|
+
}, I = () => {
|
|
5146
|
+
const A = document.createElement("span");
|
|
5147
|
+
A.className = `${me}-icon`;
|
|
5148
|
+
const z = document.createElement("img");
|
|
5149
|
+
return z.src = l, z.alt = "", z.draggable = !1, A.appendChild(z), A;
|
|
5150
|
+
}, O = () => window.innerWidth < E, J = (A) => {
|
|
5143
5151
|
if (!l) return;
|
|
5144
|
-
const
|
|
5145
|
-
if (
|
|
5146
|
-
|
|
5152
|
+
const z = A.querySelector(`.${me}-icon`);
|
|
5153
|
+
if (O() && R.mobile.hideLogo) {
|
|
5154
|
+
z?.remove();
|
|
5147
5155
|
return;
|
|
5148
5156
|
}
|
|
5149
|
-
|
|
5150
|
-
},
|
|
5151
|
-
const
|
|
5152
|
-
|
|
5153
|
-
const
|
|
5154
|
-
|
|
5155
|
-
const
|
|
5156
|
-
if (
|
|
5157
|
-
const
|
|
5158
|
-
|
|
5159
|
-
}
|
|
5160
|
-
return
|
|
5161
|
-
},
|
|
5162
|
-
if (
|
|
5163
|
-
(
|
|
5157
|
+
z || A.insertBefore(I(), A.firstChild);
|
|
5158
|
+
}, re = () => {
|
|
5159
|
+
const A = document.createElement("button");
|
|
5160
|
+
A.type = "button", A.id = L, A.className = me, A.setAttribute("aria-label", M), l && A.appendChild(I());
|
|
5161
|
+
const z = document.createElement("span");
|
|
5162
|
+
z.className = `${me}-copy`;
|
|
5163
|
+
const ee = document.createElement("span");
|
|
5164
|
+
if (ee.className = `${me}-title`, ee.textContent = c, z.appendChild(ee), A.appendChild(z), x) {
|
|
5165
|
+
const le = document.createElement("span");
|
|
5166
|
+
le.className = `${me}-spark`, le.innerHTML = Bi, A.appendChild(le);
|
|
5167
|
+
}
|
|
5168
|
+
return A.addEventListener("click", () => e.onClick()), A;
|
|
5169
|
+
}, te = (A, z, ee) => {
|
|
5170
|
+
if (S(z), z.setAttribute(je, "true"), o === "before") {
|
|
5171
|
+
(z.parentElement !== A || z.nextElementSibling !== ee) && A.insertBefore(z, ee);
|
|
5164
5172
|
return;
|
|
5165
5173
|
}
|
|
5166
|
-
(
|
|
5167
|
-
},
|
|
5174
|
+
(z.parentElement !== A || ee.nextElementSibling !== z) && A.appendChild(z);
|
|
5175
|
+
}, se = () => {
|
|
5168
5176
|
if (N) {
|
|
5169
|
-
|
|
5170
|
-
const
|
|
5171
|
-
|
|
5172
|
-
}
|
|
5173
|
-
|
|
5174
|
-
},
|
|
5175
|
-
const
|
|
5176
|
-
if (!
|
|
5177
|
-
return
|
|
5178
|
-
|
|
5179
|
-
const
|
|
5180
|
-
N &&
|
|
5181
|
-
for (let
|
|
5182
|
-
if (!
|
|
5183
|
-
return
|
|
5184
|
-
const
|
|
5185
|
-
if (
|
|
5186
|
-
N &&
|
|
5187
|
-
let
|
|
5188
|
-
|
|
5189
|
-
let
|
|
5190
|
-
return
|
|
5177
|
+
T(N);
|
|
5178
|
+
const A = ne(N.hostSelector);
|
|
5179
|
+
A && q(A), N = null;
|
|
5180
|
+
}
|
|
5181
|
+
C = null, F(!1), W = !1;
|
|
5182
|
+
}, ce = (A) => !(A && g.includes(A) || v > 0 && window.innerWidth < v && !u), w = async (A) => {
|
|
5183
|
+
const z = A ?? a.getPageType();
|
|
5184
|
+
if (!ce(z))
|
|
5185
|
+
return se(), !1;
|
|
5186
|
+
j();
|
|
5187
|
+
const ee = U();
|
|
5188
|
+
N && B(N) !== B(ee) && se();
|
|
5189
|
+
for (let le = 0; le < y; le += 1) {
|
|
5190
|
+
if (!ce(z))
|
|
5191
|
+
return se(), !1;
|
|
5192
|
+
const Z = U(), $ = ne(Z.hostSelector), K = V(Z);
|
|
5193
|
+
if ($ && (!Z.siblingSelector || K)) {
|
|
5194
|
+
N && B(N) !== B(Z) && se(), K && S(K);
|
|
5195
|
+
let ae = $.querySelector(`.${r}`);
|
|
5196
|
+
ae instanceof HTMLElement || (ae = document.createElement("div"), ae.className = r, Z.rowPlacement === "start" ? $.insertBefore(ae, $.firstChild) : $.appendChild(ae));
|
|
5197
|
+
let Y = ae.querySelector(`#${CSS.escape(L)}`);
|
|
5198
|
+
return Y instanceof HTMLButtonElement ? D = Y : (Y = re(), D = Y, ae.appendChild(Y)), K && te(ae, K, Y), J(Y), P ? Y.classList.add(`${me}--active`) : Y.classList.remove(`${me}--active`), F(!0), W = !0, N = Z, !0;
|
|
5191
5199
|
}
|
|
5192
5200
|
await Hi(16);
|
|
5193
5201
|
}
|
|
5194
|
-
return
|
|
5195
|
-
},
|
|
5202
|
+
return se(), !1;
|
|
5203
|
+
}, Q = () => {
|
|
5196
5204
|
H !== null && window.clearTimeout(H), H = window.setTimeout(() => {
|
|
5197
|
-
H = null,
|
|
5205
|
+
H = null, w();
|
|
5198
5206
|
}, b);
|
|
5199
|
-
},
|
|
5200
|
-
return window.addEventListener("resize",
|
|
5207
|
+
}, ie = () => Q();
|
|
5208
|
+
return window.addEventListener("resize", ie, { passive: !0 }), window.addEventListener("orientationchange", ie), {
|
|
5201
5209
|
get isMounted() {
|
|
5202
5210
|
return W;
|
|
5203
5211
|
},
|
|
5204
|
-
sync(
|
|
5205
|
-
return
|
|
5212
|
+
sync(A) {
|
|
5213
|
+
return w(A);
|
|
5206
5214
|
},
|
|
5207
|
-
setActive(
|
|
5208
|
-
|
|
5215
|
+
setActive(A) {
|
|
5216
|
+
P = A, D?.classList.toggle(`${me}--active`, A);
|
|
5209
5217
|
},
|
|
5210
5218
|
destroy() {
|
|
5211
|
-
H !== null && (window.clearTimeout(H), H = null), window.removeEventListener("resize",
|
|
5219
|
+
H !== null && (window.clearTimeout(H), H = null), window.removeEventListener("resize", ie), window.removeEventListener("orientationchange", ie), se(), document.getElementById(G)?.remove(), D = null;
|
|
5212
5220
|
}
|
|
5213
5221
|
};
|
|
5214
5222
|
}
|
|
@@ -5221,7 +5229,7 @@ var Di = /* @__PURE__ */ new Set([
|
|
|
5221
5229
|
"audio/aac",
|
|
5222
5230
|
"audio/mp4"
|
|
5223
5231
|
]), ya = /* @__PURE__ */ new Set();
|
|
5224
|
-
function
|
|
5232
|
+
function it(t) {
|
|
5225
5233
|
t.pause(), t.removeAttribute("src"), t.load(), ya.delete(t);
|
|
5226
5234
|
}
|
|
5227
5235
|
function Oi(t, e = "audio/ogg") {
|
|
@@ -5229,9 +5237,9 @@ function Oi(t, e = "audio/ogg") {
|
|
|
5229
5237
|
if (!Di.has(a)) return null;
|
|
5230
5238
|
try {
|
|
5231
5239
|
const n = new Audio(`data:${e};base64,${t}`);
|
|
5232
|
-
return ya.add(n), n.addEventListener("ended", () =>
|
|
5233
|
-
|
|
5234
|
-
}), { stop: () =>
|
|
5240
|
+
return ya.add(n), n.addEventListener("ended", () => it(n), { once: !0 }), n.play().catch(() => {
|
|
5241
|
+
it(n);
|
|
5242
|
+
}), { stop: () => it(n) };
|
|
5235
5243
|
} catch {
|
|
5236
5244
|
return null;
|
|
5237
5245
|
}
|
|
@@ -5308,7 +5316,7 @@ function Vi(t) {
|
|
|
5308
5316
|
}
|
|
5309
5317
|
};
|
|
5310
5318
|
}
|
|
5311
|
-
function
|
|
5319
|
+
function jt(t) {
|
|
5312
5320
|
return t !== void 0 && /[\p{L}\p{N}_]/u.test(t);
|
|
5313
5321
|
}
|
|
5314
5322
|
function Gi(t) {
|
|
@@ -5328,7 +5336,7 @@ function Gi(t) {
|
|
|
5328
5336
|
continue;
|
|
5329
5337
|
}
|
|
5330
5338
|
const h = p > 0 ? d[p - 1] : void 0, m = d[p + o.short_name.length];
|
|
5331
|
-
if (
|
|
5339
|
+
if (jt(h) || jt(m)) {
|
|
5332
5340
|
c = s.nextNode();
|
|
5333
5341
|
continue;
|
|
5334
5342
|
}
|
|
@@ -5359,7 +5367,7 @@ var Wi = /* @__PURE__ */ new Set([
|
|
|
5359
5367
|
function Yi(t) {
|
|
5360
5368
|
return !!(t.icon && Wi.has(t.icon) || t.action?.type && Ki.has(t.action.type));
|
|
5361
5369
|
}
|
|
5362
|
-
var
|
|
5370
|
+
var Xe = "gengage_choice_prompter_dismissed", Zi = "gengage_choice_prompter_dismissed_global";
|
|
5363
5371
|
function Xi(t) {
|
|
5364
5372
|
const e = document.createElement("div");
|
|
5365
5373
|
e.className = "gengage-chat-choice-prompter gds-card", e.dataset.gengagePart = "choice-prompter";
|
|
@@ -5373,36 +5381,36 @@ function Xi(t) {
|
|
|
5373
5381
|
i.className = "gengage-chat-choice-prompter-actions";
|
|
5374
5382
|
const o = document.createElement("button");
|
|
5375
5383
|
o.type = "button", o.className = "gengage-chat-choice-prompter-cta gds-btn gds-btn-primary", o.dataset.gengagePart = "choice-prompter-cta", o.textContent = t.ctaLabel, o.addEventListener("click", () => {
|
|
5376
|
-
|
|
5384
|
+
bt(t.threadId), e.remove(), t.onCtaClick();
|
|
5377
5385
|
}), i.appendChild(o);
|
|
5378
5386
|
const s = document.createElement("button");
|
|
5379
5387
|
return s.type = "button", s.className = "gengage-chat-choice-prompter-dismiss", s.dataset.gengagePart = "choice-prompter-dismiss", s.textContent = "×", s.setAttribute("aria-label", t.dismissAriaLabel ?? "Dismiss"), s.addEventListener("click", () => {
|
|
5380
|
-
|
|
5388
|
+
bt(t.threadId), e.remove(), t.onDismiss?.();
|
|
5381
5389
|
}), i.appendChild(s), e.appendChild(i), e;
|
|
5382
5390
|
}
|
|
5383
|
-
function
|
|
5391
|
+
function qt() {
|
|
5384
5392
|
try {
|
|
5385
|
-
sessionStorage.removeItem(
|
|
5393
|
+
sessionStorage.removeItem(Xe), sessionStorage.removeItem(Zi);
|
|
5386
5394
|
} catch {
|
|
5387
5395
|
}
|
|
5388
5396
|
}
|
|
5389
5397
|
function Qi(t) {
|
|
5390
5398
|
try {
|
|
5391
|
-
const e = sessionStorage.getItem(
|
|
5399
|
+
const e = sessionStorage.getItem(Xe);
|
|
5392
5400
|
return e ? JSON.parse(e).includes(t) : !1;
|
|
5393
5401
|
} catch {
|
|
5394
5402
|
return !1;
|
|
5395
5403
|
}
|
|
5396
5404
|
}
|
|
5397
|
-
function
|
|
5405
|
+
function bt(t) {
|
|
5398
5406
|
try {
|
|
5399
|
-
const e = sessionStorage.getItem(
|
|
5400
|
-
a.includes(t) || a.push(t), sessionStorage.setItem(
|
|
5407
|
+
const e = sessionStorage.getItem(Xe), a = e ? JSON.parse(e) : [];
|
|
5408
|
+
a.includes(t) || a.push(t), sessionStorage.setItem(Xe, JSON.stringify(a));
|
|
5401
5409
|
} catch {
|
|
5402
5410
|
}
|
|
5403
5411
|
}
|
|
5404
5412
|
function Ji(t) {
|
|
5405
|
-
t &&
|
|
5413
|
+
t && bt(t);
|
|
5406
5414
|
}
|
|
5407
5415
|
var eo = "gengage_assistant", to = 3, Te = "sessions", ye = "context", Se = "payload", we = "favorites";
|
|
5408
5416
|
function De(t) {
|
|
@@ -5656,7 +5664,7 @@ var ao = class {
|
|
|
5656
5664
|
case "ProductDetailsPanel":
|
|
5657
5665
|
return a.panelTitleProductDetails;
|
|
5658
5666
|
case "ProductGrid":
|
|
5659
|
-
return
|
|
5667
|
+
return $t(this.lastActionType) ? a.panelTitleSearchResults : a.panelTitleSimilarProducts;
|
|
5660
5668
|
case "ComparisonTable":
|
|
5661
5669
|
return a.panelTitleComparisonResults;
|
|
5662
5670
|
case "AIGroupingCards":
|
|
@@ -5675,7 +5683,7 @@ var ao = class {
|
|
|
5675
5683
|
updateTopBarForLoading(t) {
|
|
5676
5684
|
const e = this.deps.i18n(), a = {
|
|
5677
5685
|
productDetails: e.panelTitleProductDetails,
|
|
5678
|
-
productList:
|
|
5686
|
+
productList: $t(this.lastActionType) ? e.panelTitleSearchResults : e.panelTitleSimilarProducts,
|
|
5679
5687
|
comparisonTable: e.panelTitleComparisonResults,
|
|
5680
5688
|
groupList: e.panelTitleCategories
|
|
5681
5689
|
}[t] ?? "";
|
|
@@ -5731,13 +5739,13 @@ var ao = class {
|
|
|
5731
5739
|
this.snapshots.clear(), this._snapshotRebuilders.clear(), this.snapshotTypes.clear(), this.activePanelMessageId = null, this.currentType = null, this.threads = [];
|
|
5732
5740
|
}
|
|
5733
5741
|
};
|
|
5734
|
-
function
|
|
5742
|
+
function $t(t) {
|
|
5735
5743
|
return t === "user_message" || t === "inputText";
|
|
5736
5744
|
}
|
|
5737
5745
|
function oo(t) {
|
|
5738
5746
|
return t.similarsAppend && t.currentPanelType === "ProductDetailsPanel" && t.hasPanelContent && !t.isPanelLoading ? "appendSimilars" : t.componentType === "ProductGrid" && !t.isFirstPanelContentInStream && t.hasPanelContent && !t.isPanelLoading ? "append" : "replace";
|
|
5739
5747
|
}
|
|
5740
|
-
var
|
|
5748
|
+
var Vt = 1, so = "gengage:chat-history:index", co = "gengage:chat-history:session", lo = 12, go = "Image attachment";
|
|
5741
5749
|
function Pe(t, e) {
|
|
5742
5750
|
const a = t.replace(/\s+/g, " ").trim();
|
|
5743
5751
|
return a.length <= e ? a : `${a.slice(0, Math.max(0, e - 1)).trimEnd()}…`;
|
|
@@ -5751,7 +5759,7 @@ function ke(t) {
|
|
|
5751
5759
|
}
|
|
5752
5760
|
return e.replace(/<[^>]+>/g, " ").replace(/ /gi, " ").replace(/&/gi, "&").replace(/</gi, "<").replace(/>/gi, ">").replace(/'/gi, "'").replace(/"/gi, '"').replace(/\s+/g, " ").trim();
|
|
5753
5761
|
}
|
|
5754
|
-
function
|
|
5762
|
+
function Gt(t) {
|
|
5755
5763
|
if (!t) return null;
|
|
5756
5764
|
try {
|
|
5757
5765
|
return JSON.parse(t);
|
|
@@ -5762,7 +5770,7 @@ function Vt(t) {
|
|
|
5762
5770
|
function po(t, e) {
|
|
5763
5771
|
return `${encodeURIComponent(t)}::${encodeURIComponent(e || "__guest__")}`;
|
|
5764
5772
|
}
|
|
5765
|
-
function
|
|
5773
|
+
function ot(t) {
|
|
5766
5774
|
return `${so}:${t}`;
|
|
5767
5775
|
}
|
|
5768
5776
|
function Oe(t, e) {
|
|
@@ -5838,12 +5846,12 @@ var xo = class {
|
|
|
5838
5846
|
return !t || !e ? null : this.listSessions().find((a) => a.sourceSessionId === t && a.createdAt === e)?.id ?? null;
|
|
5839
5847
|
}
|
|
5840
5848
|
listSessions() {
|
|
5841
|
-
const t =
|
|
5849
|
+
const t = Gt(this._storage?.getItem(ot(this._scope)) ?? null);
|
|
5842
5850
|
return t ? t.map(bo).sort((e, a) => a.updatedAt.localeCompare(e.updatedAt)) : [];
|
|
5843
5851
|
}
|
|
5844
5852
|
loadSession(t) {
|
|
5845
|
-
const e =
|
|
5846
|
-
return !e || e.version !==
|
|
5853
|
+
const e = Gt(this._storage?.getItem(Oe(this._scope, t)) ?? null);
|
|
5854
|
+
return !e || e.version !== Vt ? null : vo(e);
|
|
5847
5855
|
}
|
|
5848
5856
|
saveSession(t) {
|
|
5849
5857
|
if (!this._storage) return null;
|
|
@@ -5859,7 +5867,7 @@ var xo = class {
|
|
|
5859
5867
|
const c = {};
|
|
5860
5868
|
for (const [p, h] of t.panelAiSpecByThread ?? []) c[p] = h;
|
|
5861
5869
|
const l = {
|
|
5862
|
-
version:
|
|
5870
|
+
version: Vt,
|
|
5863
5871
|
id: t.historyId,
|
|
5864
5872
|
userId: t.userId,
|
|
5865
5873
|
appId: t.appId,
|
|
@@ -5902,7 +5910,7 @@ var xo = class {
|
|
|
5902
5910
|
const e = this.listSessions().filter((a) => a.id !== t);
|
|
5903
5911
|
this._storage.removeItem(Oe(this._scope, t));
|
|
5904
5912
|
try {
|
|
5905
|
-
this._storage.setItem(
|
|
5913
|
+
this._storage.setItem(ot(this._scope), JSON.stringify(e));
|
|
5906
5914
|
} catch {
|
|
5907
5915
|
}
|
|
5908
5916
|
}
|
|
@@ -5910,7 +5918,7 @@ var xo = class {
|
|
|
5910
5918
|
if (!this._storage) return !1;
|
|
5911
5919
|
const a = [...e];
|
|
5912
5920
|
for (; a.length > 0; ) try {
|
|
5913
|
-
return this._storage.setItem(Oe(this._scope, t.id), JSON.stringify(t)), this._storage.setItem(
|
|
5921
|
+
return this._storage.setItem(Oe(this._scope, t.id), JSON.stringify(t)), this._storage.setItem(ot(this._scope), JSON.stringify(a)), !0;
|
|
5914
5922
|
} catch {
|
|
5915
5923
|
const n = a.pop();
|
|
5916
5924
|
if (!n) break;
|
|
@@ -5922,7 +5930,7 @@ var xo = class {
|
|
|
5922
5930
|
}
|
|
5923
5931
|
return !1;
|
|
5924
5932
|
}
|
|
5925
|
-
},
|
|
5933
|
+
}, Wt = class {
|
|
5926
5934
|
constructor(t) {
|
|
5927
5935
|
this.favoritedSkus = /* @__PURE__ */ new Set(), this._favoritesCache = /* @__PURE__ */ new Map(), this._persistLock = Promise.resolve(), this._db = t;
|
|
5928
5936
|
}
|
|
@@ -6041,7 +6049,7 @@ var xo = class {
|
|
|
6041
6049
|
close() {
|
|
6042
6050
|
this._db?.close(), this._db = null;
|
|
6043
6051
|
}
|
|
6044
|
-
},
|
|
6052
|
+
}, st = (t) => `${t}:assistant`, yo = class {
|
|
6045
6053
|
constructor() {
|
|
6046
6054
|
this.groups = {}, this.pinnedToBottom = !0, this.userInteracting = !1, this.focusedThreadId = null, this.shown = !1, this.lastAutoAnchoredGroupId = null, this.scrollRequest = null, this._nextScrollId = 1;
|
|
6047
6055
|
}
|
|
@@ -6052,7 +6060,7 @@ var xo = class {
|
|
|
6052
6060
|
this.groups = {}, this.pinnedToBottom = !0, this.userInteracting = !1, this.focusedThreadId = null, this.lastAutoAnchoredGroupId = null, this.scrollRequest = null;
|
|
6053
6061
|
}
|
|
6054
6062
|
registerAssistantActivity(t) {
|
|
6055
|
-
const e =
|
|
6063
|
+
const e = st(t), a = this.groups[e], n = this.shown && this.pinnedToBottom && !this.userInteracting ? "active_unread" : "unseen";
|
|
6056
6064
|
this.groups[e] = {
|
|
6057
6065
|
id: e,
|
|
6058
6066
|
threadId: t,
|
|
@@ -6062,7 +6070,7 @@ var xo = class {
|
|
|
6062
6070
|
}, a?.readState === "seen" && this.lastAutoAnchoredGroupId === e && (this.lastAutoAnchoredGroupId = null);
|
|
6063
6071
|
}
|
|
6064
6072
|
finalizeAssistantGroup(t) {
|
|
6065
|
-
const e =
|
|
6073
|
+
const e = st(t), a = this.groups[e];
|
|
6066
6074
|
a && (a.status = "complete", a.updatedAt = Date.now());
|
|
6067
6075
|
}
|
|
6068
6076
|
setGroupReadStates(t) {
|
|
@@ -6103,7 +6111,7 @@ var xo = class {
|
|
|
6103
6111
|
return this.shown && this.userInteracting && !this.pinnedToBottom;
|
|
6104
6112
|
}
|
|
6105
6113
|
getAssistantReadState(t) {
|
|
6106
|
-
return this.groups[
|
|
6114
|
+
return this.groups[st(t)]?.readState;
|
|
6107
6115
|
}
|
|
6108
6116
|
};
|
|
6109
6117
|
function wo(t, e) {
|
|
@@ -6138,7 +6146,7 @@ var _o = /^HTTP\s+\d{3}\b/i, ko = [
|
|
|
6138
6146
|
/UnhandledPromiseRejection/i
|
|
6139
6147
|
], So = 720;
|
|
6140
6148
|
function Eo(t, e) {
|
|
6141
|
-
if (
|
|
6149
|
+
if (Qt(t)) return !0;
|
|
6142
6150
|
const a = t.message.trim();
|
|
6143
6151
|
if (_o.test(a) || ko.some((i) => i.test(a))) return !0;
|
|
6144
6152
|
const n = e.trim();
|
|
@@ -6151,18 +6159,18 @@ var _a = "gengage_kvkk_shown", Po = [
|
|
|
6151
6159
|
"kişisel veri",
|
|
6152
6160
|
"kisisel veri"
|
|
6153
6161
|
], To = /\b6698\b/;
|
|
6154
|
-
function
|
|
6162
|
+
function xt(t) {
|
|
6155
6163
|
const e = t.toLowerCase();
|
|
6156
6164
|
return Po.some((a) => e.includes(a)) || To.test(e);
|
|
6157
6165
|
}
|
|
6158
|
-
function
|
|
6166
|
+
function Kt(t) {
|
|
6159
6167
|
try {
|
|
6160
6168
|
return localStorage.getItem(`${_a}_${t}`) === "1";
|
|
6161
6169
|
} catch {
|
|
6162
6170
|
return !1;
|
|
6163
6171
|
}
|
|
6164
6172
|
}
|
|
6165
|
-
function
|
|
6173
|
+
function ct(t) {
|
|
6166
6174
|
try {
|
|
6167
6175
|
localStorage.setItem(`${_a}_${t}`, "1");
|
|
6168
6176
|
} catch {
|
|
@@ -6171,7 +6179,7 @@ function st(t) {
|
|
|
6171
6179
|
function Lo(t, e = {}) {
|
|
6172
6180
|
const a = new DOMParser().parseFromString(t, "text/html").body, n = Array.from(a.children);
|
|
6173
6181
|
let r = !1;
|
|
6174
|
-
for (const i of n) if (
|
|
6182
|
+
for (const i of n) if (xt(i.textContent ?? "")) {
|
|
6175
6183
|
i.remove(), r = !0;
|
|
6176
6184
|
break;
|
|
6177
6185
|
}
|
|
@@ -6179,7 +6187,7 @@ function Lo(t, e = {}) {
|
|
|
6179
6187
|
}
|
|
6180
6188
|
function Ao(t, e = {}) {
|
|
6181
6189
|
const a = new DOMParser().parseFromString(t, "text/html"), n = Array.from(a.body.children);
|
|
6182
|
-
for (const r of n) if (
|
|
6190
|
+
for (const r of n) if (xt(r.textContent ?? "")) return r.outerHTML;
|
|
6183
6191
|
return e.fallbackToFirstBlock === !0 ? n[0]?.outerHTML ?? null : null;
|
|
6184
6192
|
}
|
|
6185
6193
|
var Io = {
|
|
@@ -6195,7 +6203,7 @@ var No = ':where(:root,.gengage-chat-root,.gengage-qna-container,.gengage-simrel
|
|
|
6195
6203
|
"launchSingleProduct",
|
|
6196
6204
|
"launchProductList",
|
|
6197
6205
|
"launchHomepage"
|
|
6198
|
-
]),
|
|
6206
|
+
]), Yt = /* @__PURE__ */ new Set(["PanelRestoreCard"]), zo = /* @__PURE__ */ new Set(["ComparisonTable", "ProductDetailsPanel"]);
|
|
6199
6207
|
function Ro(t) {
|
|
6200
6208
|
const e = t?.type;
|
|
6201
6209
|
if (e) {
|
|
@@ -6209,13 +6217,13 @@ function Ho(t) {
|
|
|
6209
6217
|
const e = document.createElement("template");
|
|
6210
6218
|
return e.innerHTML = be(t), (e.content.textContent ?? "").trim().length > 0;
|
|
6211
6219
|
}
|
|
6212
|
-
function
|
|
6220
|
+
function Zt(t) {
|
|
6213
6221
|
return t.length > 120 ? !1 : /^[a-zA-Z0-9#(),.\s%/\-]+$/.test(t);
|
|
6214
6222
|
}
|
|
6215
|
-
function
|
|
6223
|
+
function lt(t) {
|
|
6216
6224
|
return typeof t == "object" && t !== null && typeof t.type == "string";
|
|
6217
6225
|
}
|
|
6218
|
-
function
|
|
6226
|
+
function gt(t) {
|
|
6219
6227
|
return t?.type === "ProductGrid" && t.props?.similarsAppend === !0;
|
|
6220
6228
|
}
|
|
6221
6229
|
var Fo = class Me extends Ya {
|
|
@@ -6257,7 +6265,7 @@ var Fo = class Me extends Ya {
|
|
|
6257
6265
|
const a = document.createElement("style");
|
|
6258
6266
|
a.textContent = No, this._shadow.appendChild(a);
|
|
6259
6267
|
const n = this.root, r = (u, g) => {
|
|
6260
|
-
g &&
|
|
6268
|
+
g && Zt(g) && n.style.setProperty(u, g);
|
|
6261
6269
|
};
|
|
6262
6270
|
if (r("--gengage-chat-header-bg", e.headerBg), r("--gengage-chat-header-foreground", e.headerForeground), e.theme)
|
|
6263
6271
|
for (const [u, g] of Object.entries(e.theme)) u.startsWith("--") && typeof g == "string" && r(u, g);
|
|
@@ -6377,11 +6385,11 @@ var Fo = class Me extends Ya {
|
|
|
6377
6385
|
m && (sessionStorage.removeItem("gengage_restore_session_id"), sessionStorage.removeItem("gengage_restore_sku")), h && sessionStorage.removeItem("gengage_restore_history_id"), this._historyStorage = new xo(this.config.accountId, this.config.session?.userId ?? "");
|
|
6378
6386
|
try {
|
|
6379
6387
|
const u = new ao();
|
|
6380
|
-
await u.open(), this._session = new
|
|
6388
|
+
await u.open(), this._session = new Wt(u);
|
|
6381
6389
|
const g = h ? this._historyStorage.loadSession(h) : null;
|
|
6382
6390
|
g ? (this._activeHistorySessionId = g.id, await this._restoreFromHistoryRecord(g)) : await this._restoreFromIndexedDB(m);
|
|
6383
6391
|
} catch {
|
|
6384
|
-
this._session = new
|
|
6392
|
+
this._session = new Wt(null);
|
|
6385
6393
|
const u = h ? this._historyStorage.loadSession(h) : null;
|
|
6386
6394
|
u && (this._activeHistorySessionId = u.id, await this._restoreFromHistoryRecord(u));
|
|
6387
6395
|
}
|
|
@@ -6392,7 +6400,7 @@ var Fo = class Me extends Ya {
|
|
|
6392
6400
|
if (!this._drawerVisible || !this._isMobileViewport) return;
|
|
6393
6401
|
const _ = this._drawer?.getElement();
|
|
6394
6402
|
if (!_) return;
|
|
6395
|
-
const y = window.visualViewport, b = Math.max(0, Math.round(window.innerHeight - (y.height + y.offsetTop))),
|
|
6403
|
+
const y = window.visualViewport, b = Math.max(0, Math.round(window.innerHeight - (y.height + y.offsetTop))), L = b > 90, M = this._openState === "full" && L ? b : 0;
|
|
6396
6404
|
M !== this._lastAppliedKeyboardInset && (this._lastAppliedKeyboardInset = M, _.style.setProperty("--gengage-chat-keyboard-inset", `${M}px`)), this._openState === "full" && (_.style.setProperty("--gengage-chat-visual-vh", `${Math.round(y.height)}px`), _.style.setProperty("--gengage-chat-visual-top", `${Math.round(y.offsetTop)}px`));
|
|
6397
6405
|
};
|
|
6398
6406
|
this._syncVisualVh = () => {
|
|
@@ -6477,20 +6485,20 @@ var Fo = class Me extends Ya {
|
|
|
6477
6485
|
const l = () => {
|
|
6478
6486
|
const M = window.innerWidth <= r ? a.mobile : a.desktop;
|
|
6479
6487
|
if (!M) return;
|
|
6480
|
-
const k = M.selector,
|
|
6488
|
+
const k = M.selector, E = !!k, R = (E ? document.querySelector(k) : null)?.getBoundingClientRect();
|
|
6481
6489
|
if (M.bottom !== void 0) {
|
|
6482
6490
|
const { offset: G, type: W } = M.bottom;
|
|
6483
|
-
if (!
|
|
6484
|
-
else if (
|
|
6485
|
-
const
|
|
6491
|
+
if (!E) n.style.setProperty(s, `${Math.max(0, G)}px`);
|
|
6492
|
+
else if (R) {
|
|
6493
|
+
const P = W === "root" || G === 0 ? R.bottom : R.top, H = Math.max(0, window.innerHeight - P + G);
|
|
6486
6494
|
n.style.setProperty(s, `${H}px`);
|
|
6487
6495
|
}
|
|
6488
6496
|
}
|
|
6489
6497
|
if (M.right !== void 0) {
|
|
6490
6498
|
const { offset: G, type: W } = M.right;
|
|
6491
|
-
if (!
|
|
6492
|
-
else if (
|
|
6493
|
-
const
|
|
6499
|
+
if (!E) n.style.setProperty(c, `${Math.max(0, G)}px`);
|
|
6500
|
+
else if (R) {
|
|
6501
|
+
const P = W === "root" || G === 0 ? R.right : R.left, H = Math.max(0, window.innerWidth - P + G);
|
|
6494
6502
|
n.style.setProperty(c, `${H}px`);
|
|
6495
6503
|
}
|
|
6496
6504
|
}
|
|
@@ -6525,25 +6533,25 @@ var Fo = class Me extends Ya {
|
|
|
6525
6533
|
return;
|
|
6526
6534
|
}
|
|
6527
6535
|
const k = document.querySelector(M.selector);
|
|
6528
|
-
k && (x.observe(k), o() ? (v = new IntersectionObserver((
|
|
6529
|
-
for (const
|
|
6536
|
+
k && (x.observe(k), o() ? (v = new IntersectionObserver((E) => {
|
|
6537
|
+
for (const R of E) R.isIntersecting ? (p = !0, l()) : (p = !1, d(), _());
|
|
6530
6538
|
}, { threshold: 0 }), v.observe(k)) : l());
|
|
6531
6539
|
};
|
|
6532
6540
|
y();
|
|
6533
6541
|
let b = 0;
|
|
6534
|
-
const
|
|
6542
|
+
const L = () => {
|
|
6535
6543
|
b || (b = requestAnimationFrame(() => {
|
|
6536
6544
|
b = 0, p = !1, d(), u?.disconnect(), u = null, y(), _(), o() || l();
|
|
6537
6545
|
}));
|
|
6538
6546
|
};
|
|
6539
|
-
window.addEventListener("resize",
|
|
6547
|
+
window.addEventListener("resize", L, { passive: !0 }), window.addEventListener("scroll", m, { passive: !0 }), window.visualViewport?.addEventListener("scroll", m, { passive: !0 }), this._syncLauncherAnchor = () => {
|
|
6540
6548
|
p = !1, d(), u?.disconnect(), u = null, y(), _();
|
|
6541
6549
|
}, o() ? _() : (l(), [
|
|
6542
6550
|
100,
|
|
6543
6551
|
400,
|
|
6544
6552
|
1e3
|
|
6545
6553
|
].forEach((M) => window.setTimeout(l, M))), this._launcherAnchorCleanup = () => {
|
|
6546
|
-
x.disconnect(), v?.disconnect(), u?.disconnect(), window.removeEventListener("resize",
|
|
6554
|
+
x.disconnect(), v?.disconnect(), u?.disconnect(), window.removeEventListener("resize", L), window.removeEventListener("scroll", m), window.visualViewport?.removeEventListener("scroll", m), b && cancelAnimationFrame(b), h && cancelAnimationFrame(h);
|
|
6547
6555
|
};
|
|
6548
6556
|
}
|
|
6549
6557
|
syncLauncherAnchor() {
|
|
@@ -6622,7 +6630,7 @@ var Fo = class Me extends Ya {
|
|
|
6622
6630
|
this._messages.length = 0, this._messages.push(...e);
|
|
6623
6631
|
}
|
|
6624
6632
|
_clearConversationState(e) {
|
|
6625
|
-
this._activeRequestThreadId = null, this._abortAllActiveRequests(), this._activeTypewriter?.cancel(), this._activeTypewriter = null, this._activeTtsHandle?.stop(), this._activeTtsHandle = null, this._messages.length = 0, this._drawer?.clearMessages(), this._drawer?.clearPanel(), this._currentPanelSource = null, this._currentInlineProductSummaryRecord = null, this._localPanelHistory = [], this._panel && (this._panel.clearSnapshots(), this._panel.threads = [], this._panel.activePanelMessageId = null, this._panel.currentType = null), this._panelAiSpecByThread.clear(), this._comparisonSelectMode = !1, this._comparisonSelectedSkus = [], this._comparisonSelectionWarning = null, this._viewedProductSkus.clear(), this._threadsWithFirstBot.clear(), this._currentThreadId = null, this._lastThreadId = null, this._lastBackendContext = null, this._chatCreatedAt = (/* @__PURE__ */ new Date()).toISOString(), e && (this._pdpLaunched = !1, this._plpLaunched = !1, this._homepageLaunched = !1, this._entryContextPrimed = !1), this._contextPrimingInFlight = !1, this._queuedUserMessages = [], this._productContextUnavailableSku = null, this._presentation.reset(), this._presentation.setShown(this._drawerVisible), this._drawer?.setPresentationFocus(null), this._drawer?.setFormerMessagesButtonVisible(!1), this._drawer?.setPills([]),
|
|
6633
|
+
this._activeRequestThreadId = null, this._abortAllActiveRequests(), this._activeTypewriter?.cancel(), this._activeTypewriter = null, this._activeTtsHandle?.stop(), this._activeTtsHandle = null, this._messages.length = 0, this._drawer?.clearMessages(), this._drawer?.clearPanel(), this._currentPanelSource = null, this._currentInlineProductSummaryRecord = null, this._localPanelHistory = [], this._panel && (this._panel.clearSnapshots(), this._panel.threads = [], this._panel.activePanelMessageId = null, this._panel.currentType = null), this._panelAiSpecByThread.clear(), this._comparisonSelectMode = !1, this._comparisonSelectedSkus = [], this._comparisonSelectionWarning = null, this._viewedProductSkus.clear(), this._threadsWithFirstBot.clear(), this._currentThreadId = null, this._lastThreadId = null, this._lastBackendContext = null, this._chatCreatedAt = (/* @__PURE__ */ new Date()).toISOString(), e && (this._pdpLaunched = !1, this._plpLaunched = !1, this._homepageLaunched = !1, this._entryContextPrimed = !1), this._contextPrimingInFlight = !1, this._queuedUserMessages = [], this._productContextUnavailableSku = null, this._presentation.reset(), this._presentation.setShown(this._drawerVisible), this._drawer?.setPresentationFocus(null), this._drawer?.setFormerMessagesButtonVisible(!1), this._drawer?.setPills([]), qt(), this._modeController.reset() && (this._drawer?.setInputPlaceholder(this._i18n.inputPlaceholder), this._drawer?.setAttachmentControlsVisible(!0), this._drawer?.setBeautyPhotoStepCard({ visible: !1 }));
|
|
6626
6634
|
}
|
|
6627
6635
|
_resetForNewPage() {
|
|
6628
6636
|
this._activeHistorySessionId = null, this._bridgeContext = null, this._clearConversationState(!0);
|
|
@@ -6689,7 +6697,7 @@ var Fo = class Me extends Ya {
|
|
|
6689
6697
|
this.close();
|
|
6690
6698
|
break;
|
|
6691
6699
|
case "startNewChatWithLauncherAction": {
|
|
6692
|
-
const a = e.payload, n = a?.action, r =
|
|
6700
|
+
const a = e.payload, n = a?.action, r = lt(n) ? n : lt(a) ? a : null;
|
|
6693
6701
|
r && this._sendAction(r, { silent: !0 }), this.open();
|
|
6694
6702
|
break;
|
|
6695
6703
|
}
|
|
@@ -6698,7 +6706,7 @@ var Fo = class Me extends Ya {
|
|
|
6698
6706
|
if (a && typeof a == "object") {
|
|
6699
6707
|
this._bridgeContext = a;
|
|
6700
6708
|
const n = a.sku;
|
|
6701
|
-
if (n && this.update({ sku: n }),
|
|
6709
|
+
if (n && this.update({ sku: n }), lt(a.action)) {
|
|
6702
6710
|
this._markCurrentContextLaunchHandled(), this.open(), this._sendAction(a.action);
|
|
6703
6711
|
break;
|
|
6704
6712
|
}
|
|
@@ -6732,7 +6740,7 @@ var Fo = class Me extends Ya {
|
|
|
6732
6740
|
break;
|
|
6733
6741
|
case "bgColorChange": {
|
|
6734
6742
|
const a = e.payload?.color;
|
|
6735
|
-
typeof a == "string" &&
|
|
6743
|
+
typeof a == "string" && Zt(a) && this._shadow && this._shadow.host.style.setProperty("--gengage-chat-bg", a);
|
|
6736
6744
|
break;
|
|
6737
6745
|
}
|
|
6738
6746
|
default:
|
|
@@ -6770,7 +6778,7 @@ var Fo = class Me extends Ya {
|
|
|
6770
6778
|
const n = this._resolveContextualOpeningMessage(e);
|
|
6771
6779
|
if (!n) return;
|
|
6772
6780
|
const r = {
|
|
6773
|
-
id:
|
|
6781
|
+
id: _t(),
|
|
6774
6782
|
role: "assistant",
|
|
6775
6783
|
content: n,
|
|
6776
6784
|
timestamp: Date.now(),
|
|
@@ -7017,7 +7025,7 @@ var Fo = class Me extends Ya {
|
|
|
7017
7025
|
}
|
|
7018
7026
|
_sendMessage(e, a) {
|
|
7019
7027
|
if (a === void 0) {
|
|
7020
|
-
if (this._contextPrimingInFlight &&
|
|
7028
|
+
if (this._contextPrimingInFlight && wt(e) === "directAddToCart") {
|
|
7021
7029
|
this._queuedUserMessages.push({ text: e });
|
|
7022
7030
|
return;
|
|
7023
7031
|
}
|
|
@@ -7064,10 +7072,10 @@ var Fo = class Me extends Ya {
|
|
|
7064
7072
|
});
|
|
7065
7073
|
return;
|
|
7066
7074
|
}
|
|
7067
|
-
if (this._clearChoicePrompter(), a?.preservePanel ||
|
|
7068
|
-
const f = this._currentThreadId,
|
|
7075
|
+
if (this._clearChoicePrompter(), a?.preservePanel || qt(), !a?.preservePanel && this._comparisonSelectMode && e.type !== "getComparisonTable" && (this._comparisonSelectMode = !1, this._comparisonSelectedSkus = []), a?.preservePanel || (this._localPanelHistory = []), this._currentThreadId && this._lastThreadId && this._lastThreadId > this._currentThreadId) {
|
|
7076
|
+
const f = this._currentThreadId, S = this._messages.filter((T) => T.threadId !== void 0 && T.threadId > f);
|
|
7069
7077
|
this._messages = this._messages.filter((T) => !T.threadId || T.threadId <= f);
|
|
7070
|
-
for (const T of
|
|
7078
|
+
for (const T of S)
|
|
7071
7079
|
this._shadow?.querySelector(`[data-message-id="${he(T.id)}"]`)?.remove(), this._panel?.deleteSnapshotForMessage(T.id);
|
|
7072
7080
|
this._panel?.pruneThreadsAfter(f), this._shadow?.querySelectorAll("[data-thread-id]")?.forEach((T) => {
|
|
7073
7081
|
T instanceof HTMLElement && T.dataset.threadId && T.dataset.threadId > f && T.remove();
|
|
@@ -7079,14 +7087,14 @@ var Fo = class Me extends Ya {
|
|
|
7079
7087
|
n !== f && (n = f, this._bridge?.send("isResponding", f));
|
|
7080
7088
|
};
|
|
7081
7089
|
r(!0);
|
|
7082
|
-
const i =
|
|
7090
|
+
const i = _t();
|
|
7083
7091
|
this._currentThreadId = i, this._lastThreadId = i, this._panel && !Bo.has(e.type) && (this._panel.lastActionType = e.type);
|
|
7084
7092
|
const o = a?.preservePanel === !0, s = a?.silent === !0 && a?.isContextPrime === !0, c = s && e.type === "launchSingleProduct";
|
|
7085
7093
|
let l;
|
|
7086
7094
|
if (o || (this._activeRequestThreadId = i), !a?.silent && !o && this._drawer?.setPresentationFocus(i), !a?.silent) {
|
|
7087
|
-
const f = typeof e.payload == "string" ? e.payload : typeof e.payload?.text == "string" ? e.payload.text : e.title,
|
|
7088
|
-
if (!(
|
|
7089
|
-
(!this._messages.some((
|
|
7095
|
+
const f = typeof e.payload == "string" ? e.payload : typeof e.payload?.text == "string" ? e.payload.text : e.title, S = this._messages.length > 0 ? this._messages[this._messages.length - 1] : void 0;
|
|
7096
|
+
if (!(S !== void 0 && S.role === "user" && S.content === f)) {
|
|
7097
|
+
(!this._messages.some((q) => q.role === "user") || this._drawer?.isKvkkBannerVisible()) && (ct(this.config.accountId), this._drawer?.hideKvkkBanner());
|
|
7090
7098
|
const T = this._createMessage("user", f);
|
|
7091
7099
|
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();
|
|
7092
7100
|
}
|
|
@@ -7098,8 +7106,8 @@ var Fo = class Me extends Ya {
|
|
|
7098
7106
|
}, v = () => {
|
|
7099
7107
|
if (this._drawer?.isPanelLoading()) {
|
|
7100
7108
|
if (!m && p) {
|
|
7101
|
-
const f = this._buildRenderContext(),
|
|
7102
|
-
this._drawer.setPanelContent(
|
|
7109
|
+
const f = this._buildRenderContext(), S = this._renderPanelFromSource(p, f);
|
|
7110
|
+
this._drawer.setPanelContent(S), this._currentPanelSource = p;
|
|
7103
7111
|
} else
|
|
7104
7112
|
this._drawer.clearPanel(), this._currentPanelSource = null;
|
|
7105
7113
|
p = null;
|
|
@@ -7129,14 +7137,14 @@ var Fo = class Me extends Ya {
|
|
|
7129
7137
|
appId: this.config.accountId,
|
|
7130
7138
|
threads: [],
|
|
7131
7139
|
createdAt: this._chatCreatedAt,
|
|
7132
|
-
kvkkApproved:
|
|
7140
|
+
kvkkApproved: Kt(this.config.accountId),
|
|
7133
7141
|
voiceEnabled: this.config.voiceEnabled ?? !1,
|
|
7134
7142
|
threadId: i,
|
|
7135
7143
|
isControlGroup: this.config.session?.abTestVariant === "control",
|
|
7136
7144
|
isMobile: this._isMobileViewport
|
|
7137
7145
|
};
|
|
7138
7146
|
this.config.isDemoWebsite === !0 && (b.openPdpSimilars = !0), this._modeController.isShopping || (b.assistantMode = this._modeController.mode), this.config.session?.viewId !== void 0 && (b.viewId = this.config.session.viewId);
|
|
7139
|
-
const
|
|
7147
|
+
const L = cn(e, {
|
|
7140
7148
|
pageContext: this.config.pageContext,
|
|
7141
7149
|
backendContext: this._lastBackendContext,
|
|
7142
7150
|
isMobile: this._isMobileViewport,
|
|
@@ -7145,7 +7153,7 @@ var Fo = class Me extends Ya {
|
|
|
7145
7153
|
account_id: this.config.accountId,
|
|
7146
7154
|
session_id: this.config.session?.sessionId ?? "",
|
|
7147
7155
|
correlation_id: this.config.session?.sessionId ?? "",
|
|
7148
|
-
type:
|
|
7156
|
+
type: L.type,
|
|
7149
7157
|
locale: Ue(this.config.locale),
|
|
7150
7158
|
meta: b,
|
|
7151
7159
|
context: {
|
|
@@ -7154,40 +7162,40 @@ var Fo = class Me extends Ya {
|
|
|
7154
7162
|
session_id: this.config.session?.sessionId ?? ""
|
|
7155
7163
|
}
|
|
7156
7164
|
};
|
|
7157
|
-
this.config.session?.userId !== void 0 && (M.user_id = this.config.session.userId), this.config.session?.viewId !== void 0 && (M.view_id = this.config.session.viewId),
|
|
7158
|
-
let k = !1,
|
|
7165
|
+
this.config.session?.userId !== void 0 && (M.user_id = this.config.session.userId), this.config.session?.viewId !== void 0 && (M.view_id = this.config.session.viewId), L.payload !== void 0 && (M.payload = L.payload), !d && this.config.pageContext?.sku !== void 0 && (M.sku = this.config.pageContext.sku), !d && this.config.pageContext?.pageType !== void 0 && (M.page_type = this.config.pageContext.pageType);
|
|
7166
|
+
let k = !1, E = !1, R = !1, G = !1, W = !1, P = !1;
|
|
7159
7167
|
const H = Un();
|
|
7160
7168
|
let D = null, N = null;
|
|
7161
7169
|
const C = () => {
|
|
7162
7170
|
if (this._drawer && !G) {
|
|
7163
|
-
if (!
|
|
7171
|
+
if (!R) {
|
|
7164
7172
|
this._drawer.setPanelAiZoneState("hidden");
|
|
7165
7173
|
return;
|
|
7166
7174
|
}
|
|
7167
7175
|
W ? this._drawer.setPanelAiZoneState("hidden") : this._drawer.setPanelAiZoneState("analyzing", { analyzingLabel: this._i18n.aiAnalysisAnalyzingLabel });
|
|
7168
7176
|
}
|
|
7169
|
-
},
|
|
7177
|
+
}, U = (f) => {
|
|
7170
7178
|
if (!D || !this._drawer) return;
|
|
7171
|
-
const
|
|
7172
|
-
|
|
7173
|
-
const T = this._renderUISpec(D,
|
|
7179
|
+
const S = this._buildRenderContext();
|
|
7180
|
+
S.isStreaming = f;
|
|
7181
|
+
const T = this._renderUISpec(D, S);
|
|
7174
7182
|
G = !0, this._drawer.setPanelAiZoneState("results", { resultEl: T }), D = null;
|
|
7175
|
-
},
|
|
7183
|
+
}, B = (f, S, T) => {
|
|
7176
7184
|
if (f === "ProductGrid" || f === "CategoriesContainer") {
|
|
7177
|
-
|
|
7185
|
+
R = !0, U(T), C();
|
|
7178
7186
|
return;
|
|
7179
7187
|
}
|
|
7180
|
-
|
|
7181
|
-
}, j = (f) => (f === "ProductGrid" || f === "CategoriesContainer") && (
|
|
7182
|
-
|
|
7183
|
-
},
|
|
7188
|
+
S !== "appendSimilars" && S !== "append" && (R = !1, G = !1, D = null, this._drawer?.setPanelAiZoneState("hidden"));
|
|
7189
|
+
}, j = (f) => (f === "ProductGrid" || f === "CategoriesContainer") && (R || G || D !== null), F = () => {
|
|
7190
|
+
P || (P = !0, this._drawer?.removeTypingIndicator(), r(!1), this._bridge?.send("loadingMessage", { text: null }));
|
|
7191
|
+
}, ne = (f, S, T) => {
|
|
7184
7192
|
if (!this._drawer || !this._panel) return;
|
|
7185
|
-
const
|
|
7186
|
-
if (T === "ProductGrid" &&
|
|
7187
|
-
const I =
|
|
7193
|
+
const q = f.elements[f.root];
|
|
7194
|
+
if (T === "ProductGrid" && q) {
|
|
7195
|
+
const I = ft(q);
|
|
7188
7196
|
if (I.isConsulting) {
|
|
7189
|
-
const
|
|
7190
|
-
if (
|
|
7197
|
+
const O = this._drawer.getPanelContentElement();
|
|
7198
|
+
if (O && Ei(O, I, S)) {
|
|
7191
7199
|
this._comparisonSelectMode = !1, this._comparisonSelectedSkus = [], this._comparisonSelectionWarning = null, this._drawer.setComparisonDockContent(null), this._currentPanelSource = {
|
|
7192
7200
|
kind: "spec",
|
|
7193
7201
|
spec: f
|
|
@@ -7196,57 +7204,57 @@ var Fo = class Me extends Ya {
|
|
|
7196
7204
|
}
|
|
7197
7205
|
}
|
|
7198
7206
|
}
|
|
7199
|
-
this._comparisonSelectMode = !1, this._comparisonSelectedSkus = [], this._comparisonSelectionWarning = null, this._drawer.setComparisonDockContent(null), this._drawer.setPanelContent(this._renderUISpec(f,
|
|
7207
|
+
this._comparisonSelectMode = !1, this._comparisonSelectedSkus = [], this._comparisonSelectionWarning = null, this._drawer.setComparisonDockContent(null), this._drawer.setPanelContent(this._renderUISpec(f, S), { preserveAiZone: j(T) }), this._currentPanelSource = {
|
|
7200
7208
|
kind: "spec",
|
|
7201
7209
|
spec: f
|
|
7202
7210
|
}, this._panel.currentType = T;
|
|
7203
|
-
}, X = (f,
|
|
7211
|
+
}, X = (f, S, T, q) => {
|
|
7204
7212
|
if (!this._panel) return;
|
|
7205
7213
|
f === "ProductDetailsPanel" && e.type === "launchSingleProduct" && this._clearUnavailableProductContext(), g.threadId && this._panel.threads[this._panel.threads.length - 1] !== g.threadId && this._panel.threads.push(g.threadId), this._isMobileViewport && f === "ProductGrid" && this._ensureMobilePanelOverlayVisible();
|
|
7206
|
-
const I = this._panel.currentType ?? f,
|
|
7207
|
-
this._panel.updateTopBar(I,
|
|
7214
|
+
const I = this._panel.currentType ?? f, O = S?.props?.panelTitle;
|
|
7215
|
+
this._panel.updateTopBar(I, O), this._panel.updateExtendedMode(f), this._isMobileViewport && c && this._drawer?.hideMobilePanel(), B(f, T, q);
|
|
7208
7216
|
};
|
|
7209
7217
|
let V = null;
|
|
7210
7218
|
if (V = pn(M, {
|
|
7211
|
-
onTextChunk: (f,
|
|
7219
|
+
onTextChunk: (f, S, T) => {
|
|
7212
7220
|
if (!o && i !== this._activeRequestThreadId || (u += f, Ho(u) && F(), T?.skuToProductItem && (this._skuToProductItem = {
|
|
7213
7221
|
...this._skuToProductItem,
|
|
7214
7222
|
...T.skuToProductItem
|
|
7215
7223
|
}), T?.conversationMode && (this._conversationMode = T.conversationMode), T?.renderHint && (g.renderHint = T.renderHint), !this._drawer)) return;
|
|
7216
|
-
let
|
|
7217
|
-
const I = T?.kvkk === !0,
|
|
7218
|
-
if (I ||
|
|
7219
|
-
if (
|
|
7220
|
-
const
|
|
7221
|
-
if (!
|
|
7222
|
-
const te = Ao(
|
|
7223
|
-
te && this._drawer?.showKvkkBanner(te),
|
|
7224
|
+
let q = u;
|
|
7225
|
+
const I = T?.kvkk === !0, O = I ? { fallbackToFirstBlock: !0 } : void 0;
|
|
7226
|
+
if (I || xt(q)) {
|
|
7227
|
+
if (S) {
|
|
7228
|
+
const re = this.config.accountId;
|
|
7229
|
+
if (!Kt(re)) {
|
|
7230
|
+
const te = Ao(q, O);
|
|
7231
|
+
te && this._drawer?.showKvkkBanner(te), ct(re);
|
|
7224
7232
|
}
|
|
7225
7233
|
}
|
|
7226
|
-
|
|
7234
|
+
q = Lo(q, O);
|
|
7227
7235
|
}
|
|
7228
|
-
const
|
|
7229
|
-
if (
|
|
7230
|
-
if (g.content =
|
|
7231
|
-
this._drawer?.updateBotMessage(g.id,
|
|
7236
|
+
const J = this._shadow?.querySelector(`[data-message-id="${g.id}"] .gengage-chat-bubble-text`);
|
|
7237
|
+
if (J ? J.innerHTML = be(q) : (g.content = q, g.role === "assistant" && g.threadId && !this._threadsWithFirstBot.has(g.threadId) && (this._threadsWithFirstBot.add(g.threadId), this._drawer.markFirstBotMessage(g.id)), this._drawer.addMessage(g)), S)
|
|
7238
|
+
if (g.content = q, g.status = "done", yt(), qn(g))
|
|
7239
|
+
this._drawer?.updateBotMessage(g.id, q, "photo_analysis", g.photoAnalysis), g.threadId && this._focusPresentationThread(g.threadId, "auto");
|
|
7232
7240
|
else {
|
|
7233
|
-
const
|
|
7234
|
-
if (
|
|
7241
|
+
const re = this._shadow?.querySelector(`[data-message-id="${g.id}"] .gengage-chat-bubble-text`);
|
|
7242
|
+
if (re) {
|
|
7235
7243
|
this._activeTypewriter?.cancel();
|
|
7236
7244
|
const te = T?.productMentions;
|
|
7237
7245
|
this._activeTypewriter = Vi({
|
|
7238
|
-
container:
|
|
7239
|
-
html: be(
|
|
7246
|
+
container: re,
|
|
7247
|
+
html: be(q),
|
|
7240
7248
|
onTick: () => this._drawer?.scrollToBottomIfNeeded(),
|
|
7241
7249
|
onComplete: () => {
|
|
7242
|
-
this._activeTypewriter = null, te && te.length > 0 &&
|
|
7243
|
-
container:
|
|
7250
|
+
this._activeTypewriter = null, te && te.length > 0 && re && Gi({
|
|
7251
|
+
container: re,
|
|
7244
7252
|
mentions: te,
|
|
7245
|
-
onProductClick: (
|
|
7253
|
+
onProductClick: (se) => {
|
|
7246
7254
|
this._sendAction({
|
|
7247
|
-
title: te.find((ce) => ce.sku ===
|
|
7255
|
+
title: te.find((ce) => ce.sku === se)?.short_name ?? se,
|
|
7248
7256
|
type: "launchSingleProduct",
|
|
7249
|
-
payload: { sku:
|
|
7257
|
+
payload: { sku: se }
|
|
7250
7258
|
});
|
|
7251
7259
|
}
|
|
7252
7260
|
});
|
|
@@ -7255,11 +7263,11 @@ var Fo = class Me extends Ya {
|
|
|
7255
7263
|
}
|
|
7256
7264
|
}
|
|
7257
7265
|
},
|
|
7258
|
-
onUISpec: (f,
|
|
7259
|
-
if (!o && i !== this._activeRequestThreadId ||
|
|
7260
|
-
|
|
7261
|
-
const I = f.elements[f.root],
|
|
7262
|
-
if (jn(
|
|
7266
|
+
onUISpec: (f, S, T, q) => {
|
|
7267
|
+
if (!o && i !== this._activeRequestThreadId || S !== "chat") return;
|
|
7268
|
+
q && (this._clearAssistantPanelLikeStreamClearPanel(), k = !1, N = null);
|
|
7269
|
+
const I = f.elements[f.root], O = I?.type ?? "unknown";
|
|
7270
|
+
if (jn(O, I?.props ?? {}, H, {
|
|
7263
7271
|
drawer: this._drawer,
|
|
7264
7272
|
ensureRendered: () => this._ensureAssistantMessageRendered(g),
|
|
7265
7273
|
cancelTypewriter: () => {
|
|
@@ -7268,94 +7276,94 @@ var Fo = class Me extends Ya {
|
|
|
7268
7276
|
sendSkipMessage: () => this._sendMessage(this._i18n.beautyPhotoStepSkipMessage),
|
|
7269
7277
|
streamDone: W
|
|
7270
7278
|
}, g)) {
|
|
7271
|
-
|
|
7279
|
+
O === "PhotoAnalysisCard" && g.threadId && this._focusPresentationThread(g.threadId, "auto");
|
|
7272
7280
|
return;
|
|
7273
7281
|
}
|
|
7274
|
-
const
|
|
7275
|
-
|
|
7276
|
-
const te =
|
|
7277
|
-
if (
|
|
7278
|
-
const
|
|
7279
|
-
$a(Array.isArray(
|
|
7282
|
+
const J = gt(I), re = this.config.productDetailsExtended !== !0 && (O === "ProductDetailsPanel" || J);
|
|
7283
|
+
re && !q && (this._clearAssistantPanelLikeStreamClearPanel(), k = !1);
|
|
7284
|
+
const te = O === "ProductDetailsPanel" && T !== "panel" ? "panel" : T, se = this._buildRenderContext();
|
|
7285
|
+
if (se.isStreaming = !0, O === "ComparisonTable") {
|
|
7286
|
+
const $ = I?.props?.products;
|
|
7287
|
+
$a(Array.isArray($) ? $.length : 0);
|
|
7280
7288
|
}
|
|
7281
|
-
if (
|
|
7282
|
-
const
|
|
7283
|
-
Ra(void 0,
|
|
7289
|
+
if (O === "ProductGrid") {
|
|
7290
|
+
const $ = I?.children?.length ?? 0;
|
|
7291
|
+
Ra(void 0, $);
|
|
7284
7292
|
}
|
|
7285
7293
|
const ce = te === "panel" && this._panel ? this._panel.toPanelSpec(f) : f;
|
|
7286
|
-
if (te === "panel" && this._panel && !
|
|
7287
|
-
const
|
|
7288
|
-
if (
|
|
7294
|
+
if (te === "panel" && this._panel && !re && O === "ProductGrid" && I) {
|
|
7295
|
+
const $ = ft(I);
|
|
7296
|
+
if ($.isConsulting && !Si($)) {
|
|
7289
7297
|
N = f;
|
|
7290
7298
|
return;
|
|
7291
7299
|
}
|
|
7292
|
-
|
|
7300
|
+
$.isConsulting && (N = null);
|
|
7293
7301
|
}
|
|
7294
|
-
if (Ro(I) && F(), te === "panel" && this._panel && !
|
|
7295
|
-
const
|
|
7296
|
-
|
|
7297
|
-
const K = I?.props?.replacePanel === !0,
|
|
7298
|
-
componentType:
|
|
7302
|
+
if (Ro(I) && F(), te === "panel" && this._panel && !re) {
|
|
7303
|
+
const $ = !E;
|
|
7304
|
+
E = !0;
|
|
7305
|
+
const K = I?.props?.replacePanel === !0, ae = I?.props?.rankingState, Y = K || ae === "pending" || ae === "final" ? "replace" : oo({
|
|
7306
|
+
componentType: O,
|
|
7299
7307
|
similarsAppend: I?.props?.similarsAppend === !0,
|
|
7300
7308
|
currentPanelType: this._panel.currentType,
|
|
7301
7309
|
hasPanelContent: this._drawer?.hasPanelContent() ?? !1,
|
|
7302
7310
|
isPanelLoading: this._drawer?.isPanelLoading() ?? !1,
|
|
7303
|
-
isFirstPanelContentInStream:
|
|
7311
|
+
isFirstPanelContentInStream: $
|
|
7304
7312
|
});
|
|
7305
|
-
|
|
7313
|
+
se.panelProductListHeading = void 0, O === "ProductGrid" && (Y === "appendSimilars" ? se.panelProductListHeading = this._i18n.similarProductsLabel ?? "Similar Products" : this._applyPanelListHeadingToContext(se, {
|
|
7306
7314
|
kind: "spec",
|
|
7307
7315
|
spec: ce
|
|
7308
|
-
})),
|
|
7316
|
+
})), Y === "appendSimilars" ? this._appendSimilarsToPanel(ce, se) : Y === "append" ? (this._drawer?.appendPanelContent(this._renderUISpec(ce, se)), this._comparisonSelectMode && this._refreshComparisonUI()) : ne(ce, se, O), X(O, I, Y, !0);
|
|
7309
7317
|
}
|
|
7310
|
-
if (
|
|
7311
|
-
const
|
|
7312
|
-
if (
|
|
7313
|
-
c && (l =
|
|
7318
|
+
if (O === "ProductDetailsPanel" && te === "panel" && (!g.silent || c)) {
|
|
7319
|
+
const $ = I?.props?.product;
|
|
7320
|
+
if ($) {
|
|
7321
|
+
c && (l = $), this._currentInlineProductSummaryRecord = $;
|
|
7314
7322
|
const K = {
|
|
7315
7323
|
root: "root",
|
|
7316
7324
|
elements: { root: {
|
|
7317
7325
|
type: "ProductSummaryCard",
|
|
7318
|
-
props: { product:
|
|
7326
|
+
props: { product: $ }
|
|
7319
7327
|
} }
|
|
7320
|
-
},
|
|
7321
|
-
if (
|
|
7322
|
-
const
|
|
7323
|
-
g.threadId && (
|
|
7324
|
-
const
|
|
7325
|
-
|
|
7328
|
+
}, ae = this._shadow?.querySelector(".gengage-chat-messages");
|
|
7329
|
+
if (ae) {
|
|
7330
|
+
const Y = this._renderUISpec(K, se);
|
|
7331
|
+
g.threadId && (Y.dataset.threadId = g.threadId);
|
|
7332
|
+
const ge = this._shadow?.querySelector(`[data-message-id="${g.id}"]`);
|
|
7333
|
+
ge && ge.parentNode === ae ? ge.after(Y) : ae.appendChild(Y), this._scrollInlineIntoView(Y, g.threadId), this._drawer?.refreshPresentationCollapsed(), E = !0;
|
|
7326
7334
|
}
|
|
7327
7335
|
}
|
|
7328
7336
|
}
|
|
7329
|
-
const w =
|
|
7330
|
-
let
|
|
7331
|
-
if (
|
|
7332
|
-
if (g.threadId && this._rememberPanelAiSpec(g.threadId, f),
|
|
7333
|
-
const
|
|
7334
|
-
G = !0, this._drawer?.setPanelAiZoneState("results", { resultEl:
|
|
7337
|
+
const w = O === "AITopPicks" || O === "AIGroupingCards", Q = O === "InlineQuestionButtons", ie = O === "ActionButtons" ? I?.props?.buttons : void 0, A = O === "ActionButtons" && this._modeController.mode !== "shopping" && Array.isArray(ie) && ie.length > 0 && ie.every(($) => $.action?.type === "inputText");
|
|
7338
|
+
let z = !1, ee = !1;
|
|
7339
|
+
if (re && J && (se.panelProductListHeading = this._i18n.similarProductsLabel ?? "Similar Products"), w && (!g.silent || s))
|
|
7340
|
+
if (g.threadId && this._rememberPanelAiSpec(g.threadId, f), R) {
|
|
7341
|
+
const $ = this._renderUISpec(f, se);
|
|
7342
|
+
G = !0, this._drawer?.setPanelAiZoneState("results", { resultEl: $ }), z = !0, D = null;
|
|
7335
7343
|
} else
|
|
7336
|
-
D = f,
|
|
7337
|
-
|
|
7338
|
-
const
|
|
7339
|
-
if (!w && (!g.silent ||
|
|
7340
|
-
const
|
|
7341
|
-
if (
|
|
7342
|
-
const K = this._renderUISpec(f,
|
|
7343
|
-
g.threadId && (K.dataset.threadId = g.threadId),
|
|
7344
|
+
D = f, ee = !0;
|
|
7345
|
+
Q && (this._drawer?.setInputAreaChips([]), this._drawer?.setPills([]));
|
|
7346
|
+
const le = s && (O === "GroundingReviewCard" || w || O === "InlineQuestionButtons");
|
|
7347
|
+
if (!w && (!g.silent || le) && (te !== "panel" || O === "ProductCard" || re && O === "ProductGrid" && !J) && (O !== "ActionButtons" || A) && !z && !(ee && w)) {
|
|
7348
|
+
const $ = this._shadow?.querySelector(".gengage-chat-messages");
|
|
7349
|
+
if ($) {
|
|
7350
|
+
const K = this._renderUISpec(f, se);
|
|
7351
|
+
g.threadId && (K.dataset.threadId = g.threadId), $.appendChild(K), this._scrollInlineIntoView(K, g.threadId), this._drawer?.refreshPresentationCollapsed(), re && O === "ProductGrid" && (E = !0);
|
|
7344
7352
|
}
|
|
7345
7353
|
}
|
|
7346
|
-
if ((
|
|
7347
|
-
const
|
|
7348
|
-
for (const
|
|
7349
|
-
const
|
|
7350
|
-
|
|
7354
|
+
if ((O === "ProductGrid" || O === "ProductCard") && g.threadId) {
|
|
7355
|
+
const $ = I?.children ?? [], K = O === "ProductGrid" ? $.map((ae) => f.elements[ae]?.props?.product).filter(Boolean) : [I?.props?.product].filter(Boolean);
|
|
7356
|
+
for (const ae of K) {
|
|
7357
|
+
const Y = ae.sku;
|
|
7358
|
+
Y && this._viewedProductSkus.add(Y);
|
|
7351
7359
|
}
|
|
7352
7360
|
}
|
|
7353
|
-
if (
|
|
7354
|
-
const
|
|
7355
|
-
|
|
7361
|
+
if (O === "ProductGrid" || O === "ProductDetailsPanel") {
|
|
7362
|
+
const $ = (O === "ProductGrid" ? (I?.children ?? []).map((K) => f.elements[K]?.props?.product).filter(Boolean) : [I?.props?.product ?? I?.props].filter(Boolean)).map((K) => K.imageUrl).filter((K) => typeof K == "string").slice(0, 5);
|
|
7363
|
+
$.length > 0 && this._bridge?.send("previewImages", { images: $ });
|
|
7356
7364
|
}
|
|
7357
7365
|
const Z = I?.children?.length ?? 0;
|
|
7358
|
-
if (
|
|
7366
|
+
if (O === "ProductGrid" && te === "panel" && !re && Z > 1 && !this._isMobileViewport && !this._modeController.isChoicePrompterHidden && !this._comparisonSelectMode && !Qi(this._currentThreadId ?? "") && (this._clearChoicePrompter(), this._choicePrompterEl = Xi({
|
|
7359
7367
|
heading: this._i18n.choicePrompterHeading,
|
|
7360
7368
|
suggestion: this._i18n.choicePrompterSuggestion,
|
|
7361
7369
|
ctaLabel: this._i18n.choicePrompterCta,
|
|
@@ -7367,27 +7375,27 @@ var Fo = class Me extends Ya {
|
|
|
7367
7375
|
onDismiss: () => {
|
|
7368
7376
|
this._choicePrompterEl = null;
|
|
7369
7377
|
}
|
|
7370
|
-
}), this._mountChoicePrompter()),
|
|
7371
|
-
const
|
|
7372
|
-
if (
|
|
7373
|
-
const K = [],
|
|
7374
|
-
for (const
|
|
7375
|
-
const
|
|
7376
|
-
label:
|
|
7377
|
-
action:
|
|
7378
|
+
}), this._mountChoicePrompter()), O === "ActionButtons") {
|
|
7379
|
+
const $ = I?.props?.buttons;
|
|
7380
|
+
if ($ && $.length > 0 && !A) {
|
|
7381
|
+
const K = [], ae = [];
|
|
7382
|
+
for (const Y of $) if (Yi(Y)) {
|
|
7383
|
+
const ge = {
|
|
7384
|
+
label: Y.label,
|
|
7385
|
+
action: Y.action
|
|
7378
7386
|
};
|
|
7379
|
-
|
|
7380
|
-
} else
|
|
7381
|
-
K.length > 0 && this._drawer?.setInputAreaChips(K.map((
|
|
7382
|
-
label:
|
|
7383
|
-
onAction: () => this._sendAction(
|
|
7384
|
-
...
|
|
7385
|
-
}))),
|
|
7386
|
-
const
|
|
7387
|
-
label:
|
|
7388
|
-
onAction: () => this._sendAction(
|
|
7387
|
+
Y.icon && (ge.icon = Y.icon), K.push(ge);
|
|
7388
|
+
} else ae.push(Y);
|
|
7389
|
+
K.length > 0 && this._drawer?.setInputAreaChips(K.map((Y) => ({
|
|
7390
|
+
label: Y.label,
|
|
7391
|
+
onAction: () => this._sendAction(Y.action),
|
|
7392
|
+
...Y.icon ? { icon: Y.icon } : {}
|
|
7393
|
+
}))), ae.length > 0 && this._drawer?.setPills(ae.map((Y) => {
|
|
7394
|
+
const ge = {
|
|
7395
|
+
label: Y.label,
|
|
7396
|
+
onAction: () => this._sendAction(Y.action)
|
|
7389
7397
|
};
|
|
7390
|
-
return
|
|
7398
|
+
return Y.icon && (ge.icon = Y.icon), Y.image && (ge.image = Y.image), Y.description && (ge.description = Y.description), ge;
|
|
7391
7399
|
}));
|
|
7392
7400
|
}
|
|
7393
7401
|
}
|
|
@@ -7395,8 +7403,8 @@ var Fo = class Me extends Ya {
|
|
|
7395
7403
|
},
|
|
7396
7404
|
onAction: (f) => {
|
|
7397
7405
|
if (!(!o && i !== this._activeRequestThreadId) && f.type === "action") {
|
|
7398
|
-
const
|
|
7399
|
-
this.config.actionHandling?.unknownActionPolicy !== void 0 && (
|
|
7406
|
+
const S = {};
|
|
7407
|
+
this.config.actionHandling?.unknownActionPolicy !== void 0 && (S.unknownActionPolicy = this.config.actionHandling.unknownActionPolicy), this.config.actionHandling?.allowScriptCall !== void 0 && (S.allowScriptCall = this.config.actionHandling.allowScriptCall), Za(f, {
|
|
7400
7408
|
openChat: () => this.open(),
|
|
7401
7409
|
navigate: (T) => {
|
|
7402
7410
|
xe(T.url) && (this._bridge?.send("navigate", T), T.newTab ? window.open(T.url, "_blank", "noopener,noreferrer") : window.location.href = T.url);
|
|
@@ -7408,41 +7416,41 @@ var Fo = class Me extends Ya {
|
|
|
7408
7416
|
scriptCall: (T) => {
|
|
7409
7417
|
_e("gengage:chat:script-call", T), this.config.onScriptCall?.(T);
|
|
7410
7418
|
}
|
|
7411
|
-
},
|
|
7419
|
+
}, S);
|
|
7412
7420
|
}
|
|
7413
7421
|
},
|
|
7414
7422
|
onMetadata: (f) => {
|
|
7415
7423
|
if (!(!o && i !== this._activeRequestThreadId) && f.type === "metadata" && f.meta) {
|
|
7416
7424
|
if (f.meta.panel !== void 0 || f.meta.messages !== void 0 || f.meta.message_id !== void 0) {
|
|
7417
7425
|
this._lastBackendContext = f.meta;
|
|
7418
|
-
const
|
|
7419
|
-
|
|
7426
|
+
const S = ue(f.meta.panel);
|
|
7427
|
+
S && (this._modeController.updateFromContext(S), this._applyUiHints());
|
|
7420
7428
|
}
|
|
7421
7429
|
if (f.meta.panelLoading) {
|
|
7422
|
-
const
|
|
7423
|
-
this.config.productDetailsExtended !== !0 && (
|
|
7430
|
+
const S = typeof f.meta.panelPendingType == "string" ? f.meta.panelPendingType : void 0;
|
|
7431
|
+
this.config.productDetailsExtended !== !0 && (S === "productDetails" || S === "productDetailsSimilars") || (k = !0, E = !1, x(), this._panel && (this._panel.currentType = null), this._drawer?.showPanelLoading(S), this._isMobileViewport && S === "productList" && this._ensureMobilePanelOverlayVisible(), S && this._panel?.updateTopBarForLoading(S));
|
|
7424
7432
|
}
|
|
7425
7433
|
if (f.meta.voice) {
|
|
7426
|
-
const
|
|
7434
|
+
const S = new CustomEvent("gengage:chat:voice", {
|
|
7427
7435
|
detail: { payload: f.meta.voice },
|
|
7428
7436
|
bubbles: !1,
|
|
7429
7437
|
cancelable: !0
|
|
7430
|
-
}), T = window.dispatchEvent(
|
|
7438
|
+
}), T = window.dispatchEvent(S);
|
|
7431
7439
|
if (za(), T) {
|
|
7432
|
-
const
|
|
7433
|
-
|
|
7440
|
+
const q = f.meta.voice;
|
|
7441
|
+
q.audio_base64 && (this._activeTtsHandle?.stop(), this._activeTtsHandle = Oi(q.audio_base64, q.content_type ?? "audio/ogg"));
|
|
7434
7442
|
}
|
|
7435
7443
|
}
|
|
7436
7444
|
if ((f.meta.redirectTarget || f.meta.redirect) && (_e("gengage:chat:redirect", {
|
|
7437
7445
|
target: f.meta.redirectTarget ?? null,
|
|
7438
7446
|
payload: f.meta.redirect ?? null
|
|
7439
|
-
}), ze("redirect", "redirect dispatched", { target: f.meta.redirectTarget ?? null }), this._handleRedirectMetadata(f.meta.redirect)), f.meta.analyzeAnimation && this.config.productDetailsExtended === !0 && (k = !0,
|
|
7440
|
-
const
|
|
7441
|
-
if (
|
|
7442
|
-
const
|
|
7443
|
-
this._drawer?.setThinkingSteps(
|
|
7447
|
+
}), ze("redirect", "redirect dispatched", { target: f.meta.redirectTarget ?? null }), this._handleRedirectMetadata(f.meta.redirect)), f.meta.analyzeAnimation && this.config.productDetailsExtended === !0 && (k = !0, E = !1, x(), this._panel && (this._panel.currentType = null), this._drawer?.showPanelLoading(), this._panel?.updateTopBarForLoading("productDetails")), f.meta.loading) {
|
|
7448
|
+
const S = Array.isArray(f.meta.thinkingMessages) ? f.meta.thinkingMessages.filter((q) => typeof q == "string") : [], T = typeof f.meta.loadingText == "string" ? f.meta.loadingText : void 0;
|
|
7449
|
+
if (S.length > 0) {
|
|
7450
|
+
const q = T && this._modeController.shouldCondenseThinking() ? [...S.slice(0, 2), T] : S;
|
|
7451
|
+
this._drawer?.setThinkingSteps(q);
|
|
7444
7452
|
}
|
|
7445
|
-
typeof T == "string" && T.length > 0 && (this._drawer?.addThinkingStep(T),
|
|
7453
|
+
typeof T == "string" && T.length > 0 && (this._drawer?.addThinkingStep(T), P || this._bridge?.send("loadingMessage", { text: T }));
|
|
7446
7454
|
}
|
|
7447
7455
|
f.meta.visitorDataResponse && this._bridge?.send("engagingMessage", f.meta.visitorDataResponse), f.meta.formType && this._bridge?.send("glovForm", {
|
|
7448
7456
|
type: f.meta.formType,
|
|
@@ -7461,20 +7469,20 @@ var Fo = class Me extends Ya {
|
|
|
7461
7469
|
sendSkipMessage: () => this._sendMessage(this._i18n.beautyPhotoStepSkipMessage),
|
|
7462
7470
|
streamDone: !0
|
|
7463
7471
|
});
|
|
7464
|
-
const
|
|
7465
|
-
k && !
|
|
7466
|
-
const T = g.content != null && g.content.length > 0 || u.length > 0 ||
|
|
7472
|
+
const S = E;
|
|
7473
|
+
k && !E && v(), k = !1, this._maybeHidePreservedMobilePanel(e.type, S), E = !1;
|
|
7474
|
+
const T = g.content != null && g.content.length > 0 || u.length > 0 || S, q = g.silent || T, I = typeof navigator < "u" && navigator.onLine === !1 && Qt(f), O = () => {
|
|
7467
7475
|
this._shadow?.querySelector(`[data-message-id="${he(g.id)}"]`)?.remove();
|
|
7468
7476
|
const te = this._messages.indexOf(g);
|
|
7469
7477
|
te >= 0 && this._messages.splice(te, 1);
|
|
7470
7478
|
};
|
|
7471
|
-
let
|
|
7472
|
-
const
|
|
7479
|
+
let J = !1;
|
|
7480
|
+
const re = () => {
|
|
7473
7481
|
if (I) return;
|
|
7474
7482
|
this.emit("error", f);
|
|
7475
7483
|
const te = f.message;
|
|
7476
7484
|
te === this._lastErrorMessage ? this._consecutiveErrorCount++ : (this._consecutiveErrorCount = 1, this._lastErrorMessage = te);
|
|
7477
|
-
const
|
|
7485
|
+
const se = f.message.trim(), ce = se.length > 0 ? se : this._i18n.errorMessage, w = {
|
|
7478
7486
|
onRetry: () => {
|
|
7479
7487
|
this._lastSentAction && this._sendAction(this._lastSentAction.action, this._lastSentAction.options);
|
|
7480
7488
|
},
|
|
@@ -7483,43 +7491,43 @@ var Fo = class Me extends Ya {
|
|
|
7483
7491
|
}
|
|
7484
7492
|
};
|
|
7485
7493
|
if (this._consecutiveErrorCount >= 2) {
|
|
7486
|
-
|
|
7494
|
+
O(), J = !0, this._drawer?.showErrorWithRecovery(this._i18n.accountInactiveMessage, w);
|
|
7487
7495
|
return;
|
|
7488
7496
|
}
|
|
7489
7497
|
if (Eo(f, ce)) {
|
|
7490
|
-
|
|
7498
|
+
O(), J = !0, this._drawer?.showErrorWithRecovery(ce, w);
|
|
7491
7499
|
return;
|
|
7492
7500
|
}
|
|
7493
7501
|
g.content = ce, g.status = "done";
|
|
7494
|
-
const
|
|
7502
|
+
const Q = be(ce.replace(/\r\n/g, `
|
|
7495
7503
|
`).split(`
|
|
7496
7504
|
`).join("<br />"));
|
|
7497
|
-
this._ensureAssistantMessageRendered(g), this._drawer?.updateBotMessage(g.id,
|
|
7505
|
+
this._ensureAssistantMessageRendered(g), this._drawer?.updateBotMessage(g.id, Q), this._drawer?.showRecoveryPillsOnly(w);
|
|
7498
7506
|
};
|
|
7499
7507
|
if (s && !T) if (c || this._hasUnavailableProductContext()) {
|
|
7500
7508
|
this._drawer?.setPills([]);
|
|
7501
7509
|
const te = this._i18n.productNotFoundMessage;
|
|
7502
7510
|
g.content = te, g.status = "done", this._ensureAssistantMessageRendered(g), this._drawer?.updateBotMessage(g.id, te), this._markUnavailableProductContext();
|
|
7503
7511
|
} else g.status = "done";
|
|
7504
|
-
else if (
|
|
7505
|
-
this._drawer?.setPills([]), g.silent ||
|
|
7506
|
-
else if (
|
|
7507
|
-
s && (this._contextPrimingInFlight = !1, this._flushQueuedUserMessages()), !
|
|
7512
|
+
else if (q)
|
|
7513
|
+
this._drawer?.setPills([]), g.silent || re();
|
|
7514
|
+
else if (re(), I) return;
|
|
7515
|
+
s && (this._contextPrimingInFlight = !1, this._flushQueuedUserMessages()), !J && g.status === "streaming" && (g.status = "error");
|
|
7508
7516
|
},
|
|
7509
7517
|
onDone: () => {
|
|
7510
7518
|
if (V && this._abortControllers.delete(V), !o && i !== this._activeRequestThreadId) return;
|
|
7511
7519
|
if (W = !0, N && this._panel && this._drawer) {
|
|
7512
7520
|
const I = this._buildRenderContext();
|
|
7513
7521
|
I.isStreaming = !1;
|
|
7514
|
-
const
|
|
7522
|
+
const O = N.elements[N.root], J = this._panel.toPanelSpec(N);
|
|
7515
7523
|
this._applyPanelListHeadingToContext(I, {
|
|
7516
7524
|
kind: "spec",
|
|
7517
|
-
spec:
|
|
7525
|
+
spec: J
|
|
7518
7526
|
});
|
|
7519
|
-
const
|
|
7520
|
-
|
|
7527
|
+
const re = O?.type ?? "ProductGrid";
|
|
7528
|
+
ne(J, I, re), X(re, O, "replace", !1), E = !0;
|
|
7521
7529
|
}
|
|
7522
|
-
N = null, D &&
|
|
7530
|
+
N = null, D && U(!1), C(), !o && i === this._activeRequestThreadId && (this._activeRequestThreadId = null), this._consecutiveErrorCount = 0, this._lastErrorMessage = "", r(!1), this._bridge?.send("loadingMessage", { text: null }), this._drawer?.removeTypingIndicator(), $n(H, {
|
|
7523
7531
|
drawer: this._drawer,
|
|
7524
7532
|
ensureRendered: () => {
|
|
7525
7533
|
},
|
|
@@ -7528,26 +7536,26 @@ var Fo = class Me extends Ya {
|
|
|
7528
7536
|
sendSkipMessage: () => this._sendMessage(this._i18n.beautyPhotoStepSkipMessage),
|
|
7529
7537
|
streamDone: !0
|
|
7530
7538
|
});
|
|
7531
|
-
const f =
|
|
7532
|
-
if (k && !
|
|
7539
|
+
const f = E;
|
|
7540
|
+
if (k && !E && v(), k = !1, this._maybeHidePreservedMobilePanel(e.type, f), c && !u && !f) {
|
|
7533
7541
|
const I = this._i18n.productNotFoundMessage;
|
|
7534
7542
|
g.content = I, this._ensureAssistantMessageRendered(g), this._drawer?.updateBotMessage(g.id, I), this._markUnavailableProductContext();
|
|
7535
7543
|
}
|
|
7536
|
-
if (
|
|
7544
|
+
if (E = !1, s) {
|
|
7537
7545
|
this._contextPrimingInFlight = !1;
|
|
7538
7546
|
const I = this._queuedUserMessages.length > 0;
|
|
7539
7547
|
this._flushQueuedUserMessages(), !I && c && this._ensurePdpPrimeSuggestedUiIfNeeded(l);
|
|
7540
7548
|
}
|
|
7541
|
-
g.status === "streaming" && (g.status = "done",
|
|
7542
|
-
const
|
|
7543
|
-
|
|
7544
|
-
const T = this._currentPanelSource,
|
|
7545
|
-
this._panel?.snapshotForMessage(g.id,
|
|
7546
|
-
source:
|
|
7549
|
+
g.status === "streaming" && (g.status = "done", yt()), this._presentation.finalizeAssistantGroup(i);
|
|
7550
|
+
const S = this._shadow?.querySelector(".gengage-chat-comparison-toggle-btn--hidden");
|
|
7551
|
+
S && (S.classList.remove("gengage-chat-comparison-toggle-btn--hidden"), S.classList.add("gengage-chat-comparison-toggle-btn--reveal")), this.emit("message", g);
|
|
7552
|
+
const T = this._currentPanelSource, q = T ? this._clonePanelSourceForHistory(T) : null;
|
|
7553
|
+
this._panel?.snapshotForMessage(g.id, q ? {
|
|
7554
|
+
source: q,
|
|
7547
7555
|
threadId: g.threadId,
|
|
7548
7556
|
rebuild: () => {
|
|
7549
7557
|
const I = this._buildRenderContext();
|
|
7550
|
-
return this._renderPanelFromSource(
|
|
7558
|
+
return this._renderPanelFromSource(q, I);
|
|
7551
7559
|
}
|
|
7552
7560
|
} : void 0), this._maybeAddPanelRestoreMessage(g), this._persistConversationState();
|
|
7553
7561
|
}
|
|
@@ -7619,7 +7627,7 @@ var Fo = class Me extends Ya {
|
|
|
7619
7627
|
const a = e?.uiSpec;
|
|
7620
7628
|
if (!a) return null;
|
|
7621
7629
|
const n = a.elements[a.root];
|
|
7622
|
-
return !n ||
|
|
7630
|
+
return !n || Yt.has(n.type) ? null : {
|
|
7623
7631
|
kind: "spec",
|
|
7624
7632
|
spec: a
|
|
7625
7633
|
};
|
|
@@ -8153,7 +8161,7 @@ var Fo = class Me extends Ya {
|
|
|
8153
8161
|
}
|
|
8154
8162
|
}
|
|
8155
8163
|
if (a.querySelector(".gengage-chat-comparison-floating-btn")?.remove(), this._comparisonSelectMode) {
|
|
8156
|
-
const i =
|
|
8164
|
+
const i = la(this._comparisonSelectedSkus, this._buildRenderContext());
|
|
8157
8165
|
this._isMobileViewport ? (this._drawer?.setComparisonDockContent(i), this._ensureMobilePanelOverlayVisible()) : (this._drawer?.setComparisonDockContent(null), a.appendChild(i));
|
|
8158
8166
|
} else this._drawer?.setComparisonDockContent(null);
|
|
8159
8167
|
}
|
|
@@ -8181,7 +8189,7 @@ var Fo = class Me extends Ya {
|
|
|
8181
8189
|
return typeof e == "string" && e.length > 0 ? e : typeof e == "number" && Number.isFinite(e) ? String(e) : "";
|
|
8182
8190
|
}
|
|
8183
8191
|
_maybeHandleDirectAddToCartCommand(e) {
|
|
8184
|
-
if (
|
|
8192
|
+
if (wt(e) !== "directAddToCart") return !1;
|
|
8185
8193
|
const a = this._resolveCurrentProductAddToCartParams();
|
|
8186
8194
|
return a ? (this._runChatAddToCartFlow(a), !0) : !1;
|
|
8187
8195
|
}
|
|
@@ -8274,7 +8282,7 @@ var Fo = class Me extends Ya {
|
|
|
8274
8282
|
if (a.type === "launchSingleProduct") {
|
|
8275
8283
|
const r = typeof a.payload == "object" && a.payload !== null && "sku" in a.payload ? a.payload.sku : void 0, i = this._coerceSkuKey(r), o = this._activeSkuForProductSummaryClick();
|
|
8276
8284
|
if (i && o && i === o) return;
|
|
8277
|
-
i &&
|
|
8285
|
+
i && at(i, a.title);
|
|
8278
8286
|
}
|
|
8279
8287
|
if (a.type === "findSimilar") {
|
|
8280
8288
|
const r = typeof a.payload == "object" && a.payload !== null && "sku" in a.payload ? String(a.payload.sku) : "";
|
|
@@ -8305,10 +8313,10 @@ var Fo = class Me extends Ya {
|
|
|
8305
8313
|
}
|
|
8306
8314
|
const i = a.url.trim();
|
|
8307
8315
|
if (!n && this.config.onProductNavigate !== void 0 && i.length > 0 && xe(i)) {
|
|
8308
|
-
|
|
8316
|
+
at(a.sku), this.config.onProductNavigate(i, a.sku, this.config.session?.sessionId ?? null);
|
|
8309
8317
|
return;
|
|
8310
8318
|
}
|
|
8311
|
-
|
|
8319
|
+
at(a.sku);
|
|
8312
8320
|
const o = a.name?.trim() ? a.name.trim() : a.sku;
|
|
8313
8321
|
this._sendAction({
|
|
8314
8322
|
title: o,
|
|
@@ -8477,7 +8485,7 @@ var Fo = class Me extends Ya {
|
|
|
8477
8485
|
_isMessageHostedUISpec(e) {
|
|
8478
8486
|
if (!e) return !1;
|
|
8479
8487
|
const a = e.elements[e.root];
|
|
8480
|
-
return !!a &&
|
|
8488
|
+
return !!a && Yt.has(a.type);
|
|
8481
8489
|
}
|
|
8482
8490
|
_isPanelAiSpec(e) {
|
|
8483
8491
|
if (!e) return !1;
|
|
@@ -8523,7 +8531,7 @@ var Fo = class Me extends Ya {
|
|
|
8523
8531
|
const a = this._currentPanelSource;
|
|
8524
8532
|
if (a?.kind !== "spec") return;
|
|
8525
8533
|
const n = a.spec.elements[a.spec.root];
|
|
8526
|
-
if (!n || n.type !== "ProductGrid" ||
|
|
8534
|
+
if (!n || n.type !== "ProductGrid" || gt(n)) return;
|
|
8527
8535
|
const r = (n.children ?? []).map((l) => {
|
|
8528
8536
|
const d = a.spec.elements[l]?.props?.product;
|
|
8529
8537
|
return d ? {
|
|
@@ -8612,7 +8620,7 @@ var Fo = class Me extends Ya {
|
|
|
8612
8620
|
const a = e.uiSpec, n = a.elements[a.root];
|
|
8613
8621
|
if (!n) return;
|
|
8614
8622
|
const r = n.type;
|
|
8615
|
-
if (r === "ActionButtons" || r === "ComparisonTable" || r === "ProductGrid" && this._panel?.snapshotTypes.get(e.id) === "ProductGrid" ||
|
|
8623
|
+
if (r === "ActionButtons" || r === "ComparisonTable" || r === "ProductGrid" && this._panel?.snapshotTypes.get(e.id) === "ProductGrid" || gt(n)) return;
|
|
8616
8624
|
const i = this._buildRenderContext(), o = this._shadow?.querySelector(".gengage-chat-messages");
|
|
8617
8625
|
if (!o) return;
|
|
8618
8626
|
if (r === "ProductDetailsPanel") {
|
|
@@ -8656,7 +8664,7 @@ var Fo = class Me extends Ya {
|
|
|
8656
8664
|
const c = ue(n.props), l = ue(c?.product) ?? c;
|
|
8657
8665
|
l && (this._currentInlineProductSummaryRecord = l);
|
|
8658
8666
|
}
|
|
8659
|
-
const r = this._resolveUISpecRegistry(), i = this.config.renderer?.unknownRenderer ??
|
|
8667
|
+
const r = this._resolveUISpecRegistry(), i = this.config.renderer?.unknownRenderer ?? da, o = (c, l) => Fr(c, l, r, i), s = this.config.renderer?.renderUISpec;
|
|
8660
8668
|
return s ? s(e, a, {
|
|
8661
8669
|
registry: r,
|
|
8662
8670
|
unknownRenderer: i,
|
|
@@ -8669,15 +8677,15 @@ function Wo() {
|
|
|
8669
8677
|
}
|
|
8670
8678
|
export {
|
|
8671
8679
|
Fi as a,
|
|
8672
|
-
|
|
8680
|
+
da as c,
|
|
8673
8681
|
Go as d,
|
|
8674
8682
|
bn as f,
|
|
8675
8683
|
yo as i,
|
|
8676
8684
|
Fr as l,
|
|
8677
8685
|
Wo as n,
|
|
8678
8686
|
Ii as o,
|
|
8679
|
-
|
|
8687
|
+
gt as r,
|
|
8680
8688
|
Hr as s,
|
|
8681
8689
|
Fo as t,
|
|
8682
|
-
|
|
8690
|
+
dt as u
|
|
8683
8691
|
};
|