@gengage/assistant-fe 0.3.24 → 0.3.25
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/catalog.d.ts +2 -4
- package/dist/chat/components/ChatDrawer.d.ts +1 -2
- package/dist/chat/components/PhotoAnalysisCard.d.ts +1 -2
- package/dist/chat/types.d.ts +1 -2
- package/dist/{chat-q65kDKeT.js → chat-B1bVP6dh.js} +294 -296
- package/dist/chat.iife.js +4 -4
- package/dist/chat.js +1 -1
- package/dist/{common-uTYBcG11.js → common-B-CaKFN9.js} +1 -1
- package/dist/common.js +3 -3
- package/dist/index.js +3 -3
- package/dist/{native-webview-5TioIwea.js → native-webview-Dx5logj9.js} +1 -1
- package/dist/native.iife.js +1 -1
- package/dist/native.js +1 -1
- package/package.json +1 -1
|
@@ -167,7 +167,7 @@ function za(t) {
|
|
|
167
167
|
function Ra(t, e) {
|
|
168
168
|
const a = t.type, n = t.payload != null && typeof t.payload == "object" && !Array.isArray(t.payload) ? t.payload : {}, i = (r) => {
|
|
169
169
|
const o = { ...n };
|
|
170
|
-
for (const [l,
|
|
170
|
+
for (const [l, g] of Object.entries(r)) l in o || (o[l] = g);
|
|
171
171
|
return o;
|
|
172
172
|
};
|
|
173
173
|
switch (a) {
|
|
@@ -207,32 +207,32 @@ function Ra(t, e) {
|
|
|
207
207
|
}
|
|
208
208
|
var Ha = { user_message: "inputText" };
|
|
209
209
|
function Fa(t) {
|
|
210
|
-
const { action: e, type: a, payload: n, ...i } = t, r = a ?? e?.type ?? "inputText", o = n ?? e?.payload, l = Ha[r] ?? r,
|
|
210
|
+
const { action: e, type: a, payload: n, ...i } = t, r = a ?? e?.type ?? "inputText", o = n ?? e?.payload, l = Ha[r] ?? r, g = {
|
|
211
211
|
...i,
|
|
212
212
|
type: l
|
|
213
213
|
};
|
|
214
|
-
return o !== void 0 && (
|
|
214
|
+
return o !== void 0 && (g.payload = typeof o == "string" ? { text: o } : o), JSON.stringify(g);
|
|
215
215
|
}
|
|
216
216
|
function Da(t, e, a) {
|
|
217
217
|
const n = Jt("process_action", a), i = new AbortController();
|
|
218
218
|
return (async () => {
|
|
219
219
|
try {
|
|
220
220
|
const o = Fa(t), l = a.attachment !== void 0;
|
|
221
|
-
let
|
|
221
|
+
let g;
|
|
222
222
|
if (l) {
|
|
223
223
|
const p = new FormData();
|
|
224
|
-
p.append("request", o), a.attachment !== void 0 && p.append("attachment", a.attachment),
|
|
224
|
+
p.append("request", o), a.attachment !== void 0 && p.append("attachment", a.attachment), g = {
|
|
225
225
|
method: "POST",
|
|
226
226
|
body: p,
|
|
227
227
|
signal: i.signal
|
|
228
228
|
};
|
|
229
|
-
} else
|
|
229
|
+
} else g = {
|
|
230
230
|
method: "POST",
|
|
231
231
|
headers: { "Content-Type": "application/json" },
|
|
232
232
|
body: o,
|
|
233
233
|
signal: i.signal
|
|
234
234
|
};
|
|
235
|
-
const c = await fetch(n,
|
|
235
|
+
const c = await fetch(n, g);
|
|
236
236
|
if (!c.ok) {
|
|
237
237
|
let p = c.statusText;
|
|
238
238
|
try {
|
|
@@ -243,9 +243,9 @@ function Da(t, e, a) {
|
|
|
243
243
|
e.onError(/* @__PURE__ */ new Error(`HTTP ${c.status}: ${p}`));
|
|
244
244
|
return;
|
|
245
245
|
}
|
|
246
|
-
let
|
|
246
|
+
let d = !1;
|
|
247
247
|
const s = () => {
|
|
248
|
-
|
|
248
|
+
d || (d = !0, e.onDone());
|
|
249
249
|
};
|
|
250
250
|
await Qt(c, {
|
|
251
251
|
onEvent: (p) => {
|
|
@@ -792,16 +792,16 @@ function Bt(t, e, a) {
|
|
|
792
792
|
o.className = "gengage-chat-beauty-photo-step-icon", o.setAttribute("aria-hidden", "true"), o.textContent = "✦";
|
|
793
793
|
const l = document.createElement("div");
|
|
794
794
|
l.className = "gengage-chat-beauty-photo-step-content";
|
|
795
|
-
const
|
|
796
|
-
|
|
795
|
+
const g = document.createElement("div");
|
|
796
|
+
g.className = "gengage-chat-beauty-photo-step-title", g.textContent = (typeof n.title == "string" ? n.title : void 0) ?? e.i18n?.beautyPhotoStepTitle ?? "Upload a Photo";
|
|
797
797
|
const c = document.createElement("p");
|
|
798
798
|
c.className = "gengage-chat-beauty-photo-step-desc", c.textContent = (typeof n.description == "string" ? n.description : void 0) ?? e.i18n?.beautyPhotoStepDescription ?? "Share a selfie so we can analyze your skin and recommend the right products.";
|
|
799
|
-
const
|
|
800
|
-
|
|
799
|
+
const d = document.createElement("div");
|
|
800
|
+
d.className = "gengage-chat-beauty-photo-step-actions";
|
|
801
801
|
const s = document.createElement("button");
|
|
802
802
|
s.type = "button", s.className = "gengage-chat-beauty-photo-step-upload gds-btn gds-btn-primary", s.textContent = i ? e.i18n?.beautyPhotoStepProcessing ?? "Analyzing..." : (typeof n.upload_label == "string" ? n.upload_label : void 0) ?? e.i18n?.beautyPhotoStepUpload ?? "Upload Photo", s.disabled = i, a?.onUpload && s.addEventListener("click", () => a.onUpload());
|
|
803
803
|
const p = document.createElement("button");
|
|
804
|
-
return p.type = "button", p.className = "gengage-chat-beauty-photo-step-skip gds-btn gds-btn-ghost", p.textContent = (typeof n.skip_label == "string" ? n.skip_label : void 0) ?? e.i18n?.beautyPhotoStepSkip ?? "Skip", a?.onSkip && p.addEventListener("click", () => a.onSkip()),
|
|
804
|
+
return p.type = "button", p.className = "gengage-chat-beauty-photo-step-skip gds-btn gds-btn-ghost", p.textContent = (typeof n.skip_label == "string" ? n.skip_label : void 0) ?? e.i18n?.beautyPhotoStepSkip ?? "Skip", a?.onSkip && p.addEventListener("click", () => a.onSkip()), d.appendChild(s), d.appendChild(p), l.appendChild(g), l.appendChild(c), l.appendChild(d), r.appendChild(o), r.appendChild(l), r;
|
|
805
805
|
}
|
|
806
806
|
function tn(t, e) {
|
|
807
807
|
if (t) return t;
|
|
@@ -835,16 +835,16 @@ function an(t, e, a, n, i) {
|
|
|
835
835
|
return r.appendChild(o), r;
|
|
836
836
|
}
|
|
837
837
|
function zt(t) {
|
|
838
|
-
const e = typeof t.summary == "string" ? t.summary : "", a = Array.isArray(t.
|
|
839
|
-
if (!e && a.length === 0 && n.length === 0 && i.length === 0
|
|
840
|
-
const
|
|
838
|
+
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") : [], i = Array.isArray(t.details) ? t.details.filter((c) => typeof c == "string") : [];
|
|
839
|
+
if (!e && a.length === 0 && n.length === 0 && i.length === 0) return null;
|
|
840
|
+
const r = {
|
|
841
841
|
summary: e,
|
|
842
|
-
|
|
843
|
-
},
|
|
844
|
-
return
|
|
842
|
+
details: i
|
|
843
|
+
}, o = typeof t.celeb_style == "string" ? t.celeb_style : void 0, l = typeof t.celeb_style_reason == "string" ? t.celeb_style_reason : void 0, g = typeof t.next_question == "string" ? t.next_question : void 0;
|
|
844
|
+
return a.length > 0 && (r.strengths = a), n.length > 0 && (r.focusPoints = n), o && (r.celebStyle = o), l && (r.celebStyleReason = l), g && (r.nextQuestion = g), r;
|
|
845
845
|
}
|
|
846
846
|
function Je(t) {
|
|
847
|
-
const e = t.details
|
|
847
|
+
const e = t.details;
|
|
848
848
|
return t.strengths && t.strengths.length > 0 || t.focusPoints && t.focusPoints.length > 0 ? {
|
|
849
849
|
...t,
|
|
850
850
|
details: e
|
|
@@ -888,28 +888,28 @@ function et(t, e) {
|
|
|
888
888
|
if (o && r.appendChild(o), l && r.appendChild(l), r.childElementCount > 0 && i.appendChild(r), e.celebStyle) {
|
|
889
889
|
const c = document.createElement("section");
|
|
890
890
|
c.className = "gengage-chat-photo-analysis-section gengage-chat-photo-analysis-section--celeb";
|
|
891
|
-
const
|
|
892
|
-
|
|
891
|
+
const d = document.createElement("h4");
|
|
892
|
+
d.className = "gengage-chat-photo-analysis-section-title", d.textContent = t.celebStyle;
|
|
893
893
|
const s = document.createElement("p");
|
|
894
|
-
if (s.className = "gengage-chat-photo-analysis-celeb-name", s.textContent = e.celebStyle, c.appendChild(
|
|
894
|
+
if (s.className = "gengage-chat-photo-analysis-celeb-name", s.textContent = e.celebStyle, c.appendChild(d), c.appendChild(s), e.celebStyleReason) {
|
|
895
895
|
const p = document.createElement("p");
|
|
896
896
|
p.className = "gengage-chat-photo-analysis-celeb-reason", p.textContent = e.celebStyleReason, c.appendChild(p);
|
|
897
897
|
}
|
|
898
898
|
i.appendChild(c);
|
|
899
899
|
}
|
|
900
|
-
const
|
|
901
|
-
if (
|
|
900
|
+
const g = e.details.filter(Boolean);
|
|
901
|
+
if (g.length > 0) {
|
|
902
902
|
const c = document.createElement("details");
|
|
903
903
|
c.className = "gengage-chat-photo-analysis-details";
|
|
904
|
-
const
|
|
905
|
-
|
|
904
|
+
const d = document.createElement("summary");
|
|
905
|
+
d.className = "gengage-chat-photo-analysis-details-summary", d.textContent = t.seeMore;
|
|
906
906
|
const s = document.createElement("ul");
|
|
907
907
|
s.className = "gengage-chat-photo-analysis-points";
|
|
908
|
-
for (const p of
|
|
908
|
+
for (const p of g) {
|
|
909
909
|
const h = document.createElement("li");
|
|
910
910
|
h.textContent = p, s.appendChild(h);
|
|
911
911
|
}
|
|
912
|
-
c.appendChild(
|
|
912
|
+
c.appendChild(d), c.appendChild(s), i.appendChild(c);
|
|
913
913
|
}
|
|
914
914
|
if (e.nextQuestion) {
|
|
915
915
|
const c = document.createElement("p");
|
|
@@ -929,7 +929,7 @@ function nn(t) {
|
|
|
929
929
|
function rn(t, e) {
|
|
930
930
|
const a = Je(zt(t.props ?? {}) ?? {
|
|
931
931
|
summary: "",
|
|
932
|
-
|
|
932
|
+
details: []
|
|
933
933
|
});
|
|
934
934
|
return et(nn(e), a);
|
|
935
935
|
}
|
|
@@ -938,13 +938,12 @@ function on(t, e, a, n) {
|
|
|
938
938
|
t.appendChild(et(a, Je(n)));
|
|
939
939
|
return;
|
|
940
940
|
}
|
|
941
|
-
const i = e.split(/(?<=[.!?])\s+/).map((c) => c.trim()).filter(Boolean), r = i[0] ?? e, o = i.slice(1).filter((c) => !c.includes("?")).slice(0, 4), l = i.find((c) => c.includes("?")),
|
|
941
|
+
const i = e.split(/(?<=[.!?])\s+/).map((c) => c.trim()).filter(Boolean), r = i[0] ?? e, o = i.slice(1).filter((c) => !c.includes("?")).slice(0, 4), l = i.find((c) => c.includes("?")), g = Je({
|
|
942
942
|
summary: r,
|
|
943
|
-
clues: o,
|
|
944
943
|
details: o,
|
|
945
944
|
...l ? { nextQuestion: l } : {}
|
|
946
945
|
});
|
|
947
|
-
t.appendChild(et(a,
|
|
946
|
+
t.appendChild(et(a, g));
|
|
948
947
|
}
|
|
949
948
|
var pt = {
|
|
950
949
|
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>',
|
|
@@ -1017,21 +1016,21 @@ var pn = class {
|
|
|
1017
1016
|
r.className = "gengage-chat-header gds-shell-header", r.dataset.gengagePart = "chat-header";
|
|
1018
1017
|
const o = document.createElement("div");
|
|
1019
1018
|
o.className = "gengage-chat-header-left", o.dataset.gengagePart = "chat-header-left";
|
|
1020
|
-
const l = e.headerAvatarUrl ?? e.launcherImageUrl,
|
|
1019
|
+
const l = e.headerAvatarUrl ?? e.launcherImageUrl, g = typeof e.headerAvatarUrl == "string" && e.headerAvatarUrl.length > 0 && e.headerAvatarUrl !== e.launcherImageUrl;
|
|
1021
1020
|
if (l) {
|
|
1022
1021
|
const C = document.createElement("img");
|
|
1023
|
-
C.className = "gengage-chat-header-avatar",
|
|
1022
|
+
C.className = "gengage-chat-header-avatar", g && C.classList.add("gengage-chat-header-avatar--logo"), C.dataset.gengagePart = "chat-header-avatar", C.src = l, C.alt = e.headerTitle ?? "Assistant", o.appendChild(C);
|
|
1024
1023
|
}
|
|
1025
1024
|
const c = document.createElement("div");
|
|
1026
1025
|
c.className = "gengage-chat-header-info", c.dataset.gengagePart = "chat-header-info";
|
|
1027
|
-
const
|
|
1028
|
-
|
|
1026
|
+
const d = document.createElement("div");
|
|
1027
|
+
d.className = "gengage-chat-header-title-row", d.dataset.gengagePart = "chat-header-title-row";
|
|
1029
1028
|
const s = document.createElement("span");
|
|
1030
|
-
if (s.className = "gengage-chat-header-title", s.dataset.gengagePart = "chat-header-title", s.textContent = e.headerTitle ?? this.i18n.headerTitle ?? "Product Expert",
|
|
1029
|
+
if (s.className = "gengage-chat-header-title", s.dataset.gengagePart = "chat-header-title", s.textContent = e.headerTitle ?? this.i18n.headerTitle ?? "Product Expert", d.appendChild(s), e.headerBadge) {
|
|
1031
1030
|
const C = document.createElement("span");
|
|
1032
|
-
C.className = "gengage-chat-header-badge gds-badge gds-badge-brand", C.dataset.gengagePart = "chat-header-badge", C.textContent = e.headerBadge,
|
|
1031
|
+
C.className = "gengage-chat-header-badge gds-badge gds-badge-brand", C.dataset.gengagePart = "chat-header-badge", C.textContent = e.headerBadge, d.appendChild(C);
|
|
1033
1032
|
}
|
|
1034
|
-
c.appendChild(
|
|
1033
|
+
c.appendChild(d);
|
|
1035
1034
|
const p = document.createElement("a");
|
|
1036
1035
|
p.className = "gengage-chat-header-powered", p.dataset.gengagePart = "chat-header-powered-by", p.href = "https://gengage.ai/", p.target = "_blank", p.rel = "noopener noreferrer", p.innerHTML = `<svg viewBox="0 0 15 15" fill="none" aria-hidden="true"><path d="M15 5.88941C12.2201 5.88941 9.72762 7.14107 8.05571 9.11059H0C2.77991 9.11059 5.27238 7.85893 6.94429 5.88941H15Z" fill="currentColor"/><path d="M9.10964 0C9.10964 2.24394 8.29524 4.30038 6.94429 5.88941C5.27238 7.85962 2.77922 9.11059 0 9.11059V5.88941C3.24802 5.88941 5.89036 3.2465 5.89036 0H9.10964Z" fill="currentColor" fill-opacity="0.68"/><path d="M15 5.88941V9.11059C11.752 9.11059 9.10964 11.7535 9.10964 15H5.89036C5.89036 12.7561 6.70476 10.6996 8.05571 9.11059C9.72762 7.14038 12.2208 5.88941 15 5.88941Z" fill="currentColor" fill-opacity="0.68"/></svg>${this.i18n.poweredBy}`, c.appendChild(p), o.appendChild(c), r.appendChild(o);
|
|
1037
1036
|
const h = document.createElement("div");
|
|
@@ -1582,18 +1581,18 @@ var pn = class {
|
|
|
1582
1581
|
o.className = "gengage-chat-comparison-recommended";
|
|
1583
1582
|
const l = document.createElement("div");
|
|
1584
1583
|
l.className = "gengage-chat-comparison-skeleton-shimmer gengage-chat-comparison-skeleton-rec-label", o.appendChild(l);
|
|
1585
|
-
const
|
|
1586
|
-
|
|
1584
|
+
const g = document.createElement("div");
|
|
1585
|
+
g.className = "gengage-chat-comparison-recommended-body";
|
|
1587
1586
|
const c = document.createElement("div");
|
|
1588
1587
|
c.className = "gengage-chat-comparison-skeleton-shimmer gengage-chat-comparison-skeleton-rec-img", c.setAttribute("aria-hidden", "true");
|
|
1589
|
-
const
|
|
1590
|
-
|
|
1588
|
+
const d = document.createElement("div");
|
|
1589
|
+
d.className = "gengage-chat-comparison-recommended-info";
|
|
1591
1590
|
for (let B = 0; B < 2; B++) {
|
|
1592
1591
|
const P = document.createElement("div");
|
|
1593
|
-
P.className = "gengage-chat-comparison-skeleton-shimmer gengage-chat-comparison-skeleton-rec-title", B === 1 && P.classList.add("gengage-chat-comparison-skeleton-rec-title--short"),
|
|
1592
|
+
P.className = "gengage-chat-comparison-skeleton-shimmer gengage-chat-comparison-skeleton-rec-title", B === 1 && P.classList.add("gengage-chat-comparison-skeleton-rec-title--short"), d.appendChild(P);
|
|
1594
1593
|
}
|
|
1595
1594
|
const s = document.createElement("div");
|
|
1596
|
-
s.className = "gengage-chat-comparison-skeleton-shimmer gengage-chat-comparison-skeleton-rec-price",
|
|
1595
|
+
s.className = "gengage-chat-comparison-skeleton-shimmer gengage-chat-comparison-skeleton-rec-price", d.appendChild(s), g.appendChild(c), g.appendChild(d), o.appendChild(g);
|
|
1597
1596
|
const p = document.createElement("div");
|
|
1598
1597
|
p.className = "gengage-chat-comparison-highlights";
|
|
1599
1598
|
const h = document.createElement("div");
|
|
@@ -1705,10 +1704,10 @@ var pn = class {
|
|
|
1705
1704
|
if (a <= 0) return;
|
|
1706
1705
|
const n = Math.min(160, Math.max(48, a * 0.28));
|
|
1707
1706
|
t.scrollTop = n;
|
|
1708
|
-
const i = Math.min(720, Math.max(380, 320 + Math.sqrt(n) * 28)), r = performance.now(), o = (
|
|
1707
|
+
const i = Math.min(720, Math.max(380, 320 + Math.sqrt(n) * 28)), r = performance.now(), o = (g) => 1 - (1 - g) ** 5, l = (g) => {
|
|
1709
1708
|
if (e !== this._panelListScrollAnimToken) return;
|
|
1710
|
-
const c =
|
|
1711
|
-
t.scrollTop = n * (1 - o(
|
|
1709
|
+
const c = g - r, d = Math.min(1, c / i);
|
|
1710
|
+
t.scrollTop = n * (1 - o(d)), d < 1 ? requestAnimationFrame(l) : t.scrollTop = 0;
|
|
1712
1711
|
};
|
|
1713
1712
|
requestAnimationFrame(l);
|
|
1714
1713
|
});
|
|
@@ -1727,8 +1726,8 @@ var pn = class {
|
|
|
1727
1726
|
if (!(this._options.getMobileViewport?.() ?? window.innerWidth <= 768)) return;
|
|
1728
1727
|
const o = r.changedTouches[0];
|
|
1729
1728
|
if (!o) return;
|
|
1730
|
-
const l = o.clientX - e,
|
|
1731
|
-
Math.abs(l) > 50 && Math.abs(l) > Math.abs(
|
|
1729
|
+
const l = o.clientX - e, g = o.clientY - a;
|
|
1730
|
+
Math.abs(l) > 50 && Math.abs(l) > Math.abs(g) * 2 && (this.togglePanel(), this._onPanelToggle?.());
|
|
1732
1731
|
};
|
|
1733
1732
|
t.addEventListener("touchstart", n, { passive: !0 }), t.addEventListener("touchend", i, { passive: !0 }), this._cleanups.push(() => {
|
|
1734
1733
|
t.removeEventListener("touchstart", n), t.removeEventListener("touchend", i);
|
|
@@ -1771,7 +1770,7 @@ var pn = class {
|
|
|
1771
1770
|
r.className = t === "chat" ? "gengage-chat-typing-text gds-progress-label" : "gengage-chat-panel-loading-label gds-progress-label", i.appendChild(r);
|
|
1772
1771
|
const o = document.createElement("span");
|
|
1773
1772
|
o.className = t === "chat" ? "gengage-chat-typing-dots gds-progress-dots" : "gds-progress-dots", o.setAttribute("aria-hidden", "true");
|
|
1774
|
-
for (let
|
|
1773
|
+
for (let g = 0; g < 3; g++) {
|
|
1775
1774
|
const c = document.createElement("span");
|
|
1776
1775
|
c.className = "gds-progress-dot", o.appendChild(c);
|
|
1777
1776
|
}
|
|
@@ -1970,12 +1969,12 @@ var pn = class {
|
|
|
1970
1969
|
const t = (e) => {
|
|
1971
1970
|
if (e.key !== "Tab") return;
|
|
1972
1971
|
const a = Array.from(this.root.querySelectorAll('a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])')).filter((c) => {
|
|
1973
|
-
const
|
|
1974
|
-
return c.hidden || c.getAttribute("aria-hidden") === "true" ||
|
|
1972
|
+
const d = getComputedStyle(c);
|
|
1973
|
+
return c.hidden || c.getAttribute("aria-hidden") === "true" || d.display === "none" || d.visibility === "hidden" ? !1 : c.getClientRects().length > 0;
|
|
1975
1974
|
});
|
|
1976
1975
|
if (a.length === 0) return;
|
|
1977
|
-
const n = a[0], i = a[a.length - 1], r = e.composedPath().find((c) => c instanceof HTMLElement && this.root.contains(c)) ?? null, o = this.root.getRootNode(), l = r ?? (o instanceof ShadowRoot && o.activeElement instanceof HTMLElement ? o.activeElement : document.activeElement instanceof HTMLElement ? document.activeElement : null),
|
|
1978
|
-
e.shiftKey ? (
|
|
1976
|
+
const n = a[0], i = a[a.length - 1], r = e.composedPath().find((c) => c instanceof HTMLElement && this.root.contains(c)) ?? null, o = this.root.getRootNode(), l = r ?? (o instanceof ShadowRoot && o.activeElement instanceof HTMLElement ? o.activeElement : document.activeElement instanceof HTMLElement ? document.activeElement : null), g = l && this.root.contains(l) ? l : null;
|
|
1977
|
+
e.shiftKey ? (g === n || !this.root.contains(g)) && (e.preventDefault(), i.focus()) : (g === i || !this.root.contains(g)) && (e.preventDefault(), n.focus());
|
|
1979
1978
|
};
|
|
1980
1979
|
this._focusTrapHandler = t, this.root.addEventListener("keydown", t);
|
|
1981
1980
|
}
|
|
@@ -2234,12 +2233,12 @@ function Tn(t) {
|
|
|
2234
2233
|
return n.className = "gengage-chat-comparison-recommended-rating-value", n.textContent = e.toFixed(1), a.appendChild(n), a;
|
|
2235
2234
|
}
|
|
2236
2235
|
function In(t) {
|
|
2237
|
-
const { recommended: e, products: a, attributes: n, highlights: i, specialCases: r, onProductClick: o, i18n: l } = t,
|
|
2238
|
-
if (
|
|
2236
|
+
const { recommended: e, products: a, attributes: n, highlights: i, specialCases: r, onProductClick: o, i18n: l } = t, g = document.createElement("div");
|
|
2237
|
+
if (g.className = "gengage-chat-comparison", g.dataset.gengagePart = "comparison-dialog", g.setAttribute("role", "dialog"), g.setAttribute("aria-label", l?.comparisonHeading ?? "Comparison Results"), e) {
|
|
2239
2238
|
const c = document.createElement("article");
|
|
2240
2239
|
c.className = "gengage-chat-comparison-recommended gds-card", c.dataset.gengagePart = "comparison-recommended-card";
|
|
2241
|
-
const
|
|
2242
|
-
|
|
2240
|
+
const d = document.createElement("div");
|
|
2241
|
+
d.className = "gengage-chat-comparison-recommended-label", d.textContent = l?.recommendedChoiceLabel ?? "Recommended Choice", c.appendChild(d);
|
|
2243
2242
|
const s = document.createElement("div");
|
|
2244
2243
|
s.className = "gengage-chat-comparison-recommended-body", s.classList.add("gds-clickable"), s.tabIndex = 0, s.setAttribute("role", "button"), s.setAttribute("aria-label", e.name);
|
|
2245
2244
|
const p = document.createElement("div");
|
|
@@ -2287,33 +2286,33 @@ function In(t) {
|
|
|
2287
2286
|
}
|
|
2288
2287
|
x.appendChild(S), c.appendChild(x);
|
|
2289
2288
|
}
|
|
2290
|
-
|
|
2289
|
+
g.appendChild(c);
|
|
2291
2290
|
}
|
|
2292
2291
|
if (t.keyDifferencesHtml) {
|
|
2293
2292
|
const c = document.createElement("details");
|
|
2294
2293
|
c.className = "gengage-chat-comparison-key-differences", c.dataset.gengagePart = "comparison-key-differences";
|
|
2295
|
-
const
|
|
2296
|
-
|
|
2294
|
+
const d = document.createElement("summary");
|
|
2295
|
+
d.className = "gengage-chat-comparison-key-differences-summary";
|
|
2297
2296
|
const s = document.createElement("span");
|
|
2298
2297
|
s.className = "gengage-chat-comparison-key-differences-summary-label", s.textContent = l?.keyDifferencesLabel ?? "Key Differences";
|
|
2299
2298
|
const p = document.createElement("span");
|
|
2300
|
-
p.className = "gengage-chat-comparison-key-differences-summary-meta", p.textContent = l?.viewMoreLabel ?? "Show More",
|
|
2299
|
+
p.className = "gengage-chat-comparison-key-differences-summary-meta", p.textContent = l?.viewMoreLabel ?? "Show More", d.appendChild(s), d.appendChild(p), c.appendChild(d);
|
|
2301
2300
|
const h = document.createElement("div");
|
|
2302
|
-
h.className = "gengage-chat-comparison-key-differences-content", h.innerHTML = ue(Nn(t.keyDifferencesHtml)), c.appendChild(h),
|
|
2301
|
+
h.className = "gengage-chat-comparison-key-differences-content", h.innerHTML = ue(Nn(t.keyDifferencesHtml)), c.appendChild(h), g.appendChild(c);
|
|
2303
2302
|
}
|
|
2304
2303
|
if (r && r.length > 0) {
|
|
2305
2304
|
const c = document.createElement("details");
|
|
2306
2305
|
c.className = "gengage-chat-comparison-special gds-evidence-card gds-evidence-card-warning", c.dataset.gengagePart = "comparison-special-cases";
|
|
2307
|
-
const
|
|
2308
|
-
|
|
2306
|
+
const d = document.createElement("summary");
|
|
2307
|
+
d.textContent = l?.specialCasesLabel ?? "For Special Cases", c.appendChild(d);
|
|
2309
2308
|
const s = document.createElement("ul");
|
|
2310
2309
|
for (const p of r) Mn(s, p);
|
|
2311
|
-
s.childElementCount > 0 && c.appendChild(s),
|
|
2310
|
+
s.childElementCount > 0 && c.appendChild(s), g.appendChild(c);
|
|
2312
2311
|
}
|
|
2313
2312
|
if (a.length > 0 && n.length > 0) {
|
|
2314
2313
|
const c = document.createElement("table");
|
|
2315
2314
|
c.className = "gengage-chat-comparison-table gds-comparison-table";
|
|
2316
|
-
const
|
|
2315
|
+
const d = document.createElement("thead"), s = document.createElement("tr"), p = document.createElement("th");
|
|
2317
2316
|
s.appendChild(p);
|
|
2318
2317
|
for (const u of a) {
|
|
2319
2318
|
const f = document.createElement("th");
|
|
@@ -2344,7 +2343,7 @@ function In(t) {
|
|
|
2344
2343
|
}
|
|
2345
2344
|
f.appendChild(x), s.appendChild(f);
|
|
2346
2345
|
}
|
|
2347
|
-
|
|
2346
|
+
d.appendChild(s), c.appendChild(d);
|
|
2348
2347
|
const h = document.createElement("tbody");
|
|
2349
2348
|
for (const u of n) {
|
|
2350
2349
|
const f = document.createElement("tr"), x = document.createElement("td");
|
|
@@ -2357,15 +2356,15 @@ function In(t) {
|
|
|
2357
2356
|
}
|
|
2358
2357
|
c.appendChild(h);
|
|
2359
2358
|
const v = document.createElement("div");
|
|
2360
|
-
v.className = "gengage-chat-comparison-table-wrapper", v.dataset.gengagePart = "comparison-table-wrapper", v.appendChild(c),
|
|
2359
|
+
v.className = "gengage-chat-comparison-table-wrapper", v.dataset.gengagePart = "comparison-table-wrapper", v.appendChild(c), g.appendChild(v);
|
|
2361
2360
|
}
|
|
2362
|
-
return
|
|
2361
|
+
return g.addEventListener("keydown", (c) => {
|
|
2363
2362
|
if (c.key !== "Tab") return;
|
|
2364
|
-
const
|
|
2365
|
-
if (
|
|
2366
|
-
const s =
|
|
2363
|
+
const d = g.querySelectorAll('button, [href], input, [tabindex]:not([tabindex="-1"])');
|
|
2364
|
+
if (d.length === 0) return;
|
|
2365
|
+
const s = d[0], p = d[d.length - 1];
|
|
2367
2366
|
c.shiftKey && document.activeElement === s ? (c.preventDefault(), p.focus()) : !c.shiftKey && document.activeElement === p && (c.preventDefault(), s.focus());
|
|
2368
|
-
}),
|
|
2367
|
+
}), g;
|
|
2369
2368
|
}
|
|
2370
2369
|
function Nn(t) {
|
|
2371
2370
|
if (/<[uo]l[\s>]/i.test(t) || /<li[\s>]/i.test(t)) return t;
|
|
@@ -2460,17 +2459,17 @@ function On(t, e) {
|
|
|
2460
2459
|
const u = document.createElement("div");
|
|
2461
2460
|
return u.className = "gengage-chat-review-empty", u.textContent = e?.emptyReviewsMessage ?? "No review summary found.", a.appendChild(u), a;
|
|
2462
2461
|
}
|
|
2463
|
-
const l = (e?.reviewFilterPositive ?? "positive").toLowerCase(),
|
|
2462
|
+
const l = (e?.reviewFilterPositive ?? "positive").toLowerCase(), g = (e?.reviewFilterNegative ?? "negative").toLowerCase(), c = document.createElement("div");
|
|
2464
2463
|
c.className = "gengage-chat-review-subjects-heading", c.textContent = e?.reviewSubjectsHeading ?? "Select to learn more", a.appendChild(c);
|
|
2465
|
-
let
|
|
2464
|
+
let d = o[0]?.key ?? null;
|
|
2466
2465
|
const s = document.createElement("div");
|
|
2467
2466
|
s.className = "gengage-chat-review-subjects gds-toolbar gds-toolbar-compact";
|
|
2468
2467
|
const p = document.createElement("section");
|
|
2469
2468
|
p.className = "gengage-chat-review-detail gds-evidence-card";
|
|
2470
2469
|
const h = () => {
|
|
2471
2470
|
for (; p.firstChild; ) p.removeChild(p.firstChild);
|
|
2472
|
-
if (!
|
|
2473
|
-
const u = o.find((S) => S.key ===
|
|
2471
|
+
if (!d) return;
|
|
2472
|
+
const u = o.find((S) => S.key === d);
|
|
2474
2473
|
if (!u) return;
|
|
2475
2474
|
const f = document.createElement("div");
|
|
2476
2475
|
f.className = "gengage-chat-review-detail-meta";
|
|
@@ -2481,7 +2480,7 @@ function On(t, e) {
|
|
|
2481
2480
|
}
|
|
2482
2481
|
if (u.negative > 0) {
|
|
2483
2482
|
const S = document.createElement("span");
|
|
2484
|
-
S.className = "gengage-chat-review-detail-negative", S.textContent = `${u.negative} ${
|
|
2483
|
+
S.className = "gengage-chat-review-detail-negative", S.textContent = `${u.negative} ${g}`, f.appendChild(S);
|
|
2485
2484
|
}
|
|
2486
2485
|
p.appendChild(f);
|
|
2487
2486
|
const N = document.createElement("div");
|
|
@@ -2499,7 +2498,7 @@ function On(t, e) {
|
|
|
2499
2498
|
p.appendChild(N);
|
|
2500
2499
|
}, v = () => {
|
|
2501
2500
|
for (const u of s.querySelectorAll(".gengage-chat-review-subject")) {
|
|
2502
|
-
const f = u.dataset.subjectKey ===
|
|
2501
|
+
const f = u.dataset.subjectKey === d;
|
|
2503
2502
|
u.classList.toggle("gengage-chat-review-subject--active", f), u.classList.toggle("gds-chip-active", f), u.setAttribute("aria-pressed", String(f));
|
|
2504
2503
|
}
|
|
2505
2504
|
};
|
|
@@ -2512,7 +2511,7 @@ function On(t, e) {
|
|
|
2512
2511
|
S.className = "gengage-chat-review-subject-label", S.textContent = u.label, x.appendChild(S);
|
|
2513
2512
|
const E = document.createElement("span");
|
|
2514
2513
|
E.className = "gengage-chat-review-subject-count", E.textContent = `(${u.mentions})`, x.appendChild(E), x.addEventListener("click", () => {
|
|
2515
|
-
|
|
2514
|
+
d = u.key, v(), h();
|
|
2516
2515
|
}), s.appendChild(x);
|
|
2517
2516
|
}
|
|
2518
2517
|
return a.appendChild(s), v(), h(), a.appendChild(p), a;
|
|
@@ -2606,26 +2605,26 @@ function Gn(t, e, a, n, i) {
|
|
|
2606
2605
|
const c = document.createElement("img");
|
|
2607
2606
|
c.className = "gengage-chat-ai-toppick-img", c.dataset.gengagePart = "ai-top-pick-image", ne(c, "src", l), c.loading = "lazy", c.alt = e, ve(c), r.appendChild(c);
|
|
2608
2607
|
}
|
|
2609
|
-
const
|
|
2610
|
-
if (
|
|
2608
|
+
const g = Ft(t);
|
|
2609
|
+
if (g && !i?.skipOverlayActions) {
|
|
2611
2610
|
const c = document.createElement("div");
|
|
2612
2611
|
if (c.className = "gengage-chat-product-card-img-actions", n.onFavoriteToggle) {
|
|
2613
2612
|
const h = document.createElement("button");
|
|
2614
|
-
h.className = "gengage-chat-favorite-btn", h.type = "button", h.dataset.gengageFavoriteSku =
|
|
2615
|
-
const v = n.favoritedSkus?.has(
|
|
2613
|
+
h.className = "gengage-chat-favorite-btn", h.type = "button", h.dataset.gengageFavoriteSku = g, h.setAttribute("aria-label", n.i18n?.addToFavoritesLabel ?? "Add to favorites");
|
|
2614
|
+
const v = n.favoritedSkus?.has(g) ?? !1;
|
|
2616
2615
|
v && h.classList.add("gengage-chat-favorite-btn--active"), h.innerHTML = `<svg width="14" height="14" viewBox="0 0 24 24" fill="${v ? "currentColor" : "none"}" stroke="currentColor" stroke-width="2"><path d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"/></svg>`, h.addEventListener("click", (u) => {
|
|
2617
|
-
u.stopPropagation(), h.classList.toggle("gengage-chat-favorite-btn--active"), h.querySelector("svg")?.setAttribute("fill", h.classList.contains("gengage-chat-favorite-btn--active") ? "currentColor" : "none"), n.onFavoriteToggle?.(
|
|
2616
|
+
u.stopPropagation(), h.classList.toggle("gengage-chat-favorite-btn--active"), h.querySelector("svg")?.setAttribute("fill", h.classList.contains("gengage-chat-favorite-btn--active") ? "currentColor" : "none"), n.onFavoriteToggle?.(g, o);
|
|
2618
2617
|
}), c.appendChild(h);
|
|
2619
2618
|
}
|
|
2620
|
-
const
|
|
2621
|
-
s.className = "gengage-chat-find-similar-pill", s.type = "button", s.setAttribute("aria-label",
|
|
2619
|
+
const d = n.i18n?.findSimilarLabel ?? "Find Similar", s = document.createElement("button");
|
|
2620
|
+
s.className = "gengage-chat-find-similar-pill", s.type = "button", s.setAttribute("aria-label", d), s.dataset.tooltip = d, s.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>';
|
|
2622
2621
|
const p = document.createElement("span");
|
|
2623
|
-
p.className = "gengage-chat-find-similar-pill-text", p.textContent =
|
|
2622
|
+
p.className = "gengage-chat-find-similar-pill-text", p.textContent = d, s.appendChild(p), s.addEventListener("click", (h) => {
|
|
2624
2623
|
h.stopPropagation(), n.onAction({
|
|
2625
|
-
title:
|
|
2624
|
+
title: d,
|
|
2626
2625
|
type: "findSimilar",
|
|
2627
2626
|
payload: {
|
|
2628
|
-
sku:
|
|
2627
|
+
sku: g,
|
|
2629
2628
|
...l ? { image_url: l } : {}
|
|
2630
2629
|
}
|
|
2631
2630
|
});
|
|
@@ -2636,47 +2635,47 @@ function Gn(t, e, a, n, i) {
|
|
|
2636
2635
|
function Wn(t, e, a) {
|
|
2637
2636
|
const n = t.price, i = t.originalPrice;
|
|
2638
2637
|
if (!n) return;
|
|
2639
|
-
const r = Te(a, t), o = ze(a, t), l = !!(i && i !== n),
|
|
2640
|
-
if (
|
|
2638
|
+
const r = Te(a, t), o = ze(a, t), l = !!(i && i !== n), g = !!(r && l), c = $e(a, t), d = document.createElement("div");
|
|
2639
|
+
if (d.className = "gengage-chat-ai-toppick-price", d.dataset.gengagePart = "ai-top-pick-price", g) {
|
|
2641
2640
|
const s = Ge({
|
|
2642
2641
|
reasonText: r,
|
|
2643
2642
|
salePriceFormatted: W(n, a.pricing),
|
|
2644
2643
|
...c !== void 0 ? { logoUrl: c } : {}
|
|
2645
2644
|
});
|
|
2646
2645
|
if (l && o === "inline") {
|
|
2647
|
-
|
|
2646
|
+
d.classList.add("gengage-chat-ai-toppick-price--inline"), d.appendChild(s);
|
|
2648
2647
|
const p = document.createElement("span");
|
|
2649
2648
|
p.className = "gengage-chat-ai-toppick-price-sep", p.setAttribute("aria-hidden", "true");
|
|
2650
2649
|
const h = document.createElement("span");
|
|
2651
|
-
h.className = "gengage-chat-ai-toppick-original-price", h.textContent = W(i, a.pricing),
|
|
2650
|
+
h.className = "gengage-chat-ai-toppick-original-price", h.textContent = W(i, a.pricing), d.appendChild(p), d.appendChild(h);
|
|
2652
2651
|
} else {
|
|
2653
2652
|
const p = document.createElement("span");
|
|
2654
|
-
p.className = "gengage-chat-ai-toppick-original-price", p.textContent = W(i, a.pricing),
|
|
2653
|
+
p.className = "gengage-chat-ai-toppick-original-price", p.textContent = W(i, a.pricing), d.appendChild(p), d.appendChild(document.createTextNode(" ")), d.appendChild(s);
|
|
2655
2654
|
}
|
|
2656
|
-
e.appendChild(
|
|
2655
|
+
e.appendChild(d);
|
|
2657
2656
|
return;
|
|
2658
2657
|
}
|
|
2659
2658
|
if (l && o === "inline") {
|
|
2660
|
-
|
|
2659
|
+
d.classList.add("gengage-chat-ai-toppick-price--inline");
|
|
2661
2660
|
const s = document.createElement("span");
|
|
2662
2661
|
s.className = "gengage-chat-ai-toppick-price-current", s.textContent = W(n, a.pricing);
|
|
2663
2662
|
const p = document.createElement("span");
|
|
2664
2663
|
p.className = "gengage-chat-ai-toppick-price-sep", p.setAttribute("aria-hidden", "true");
|
|
2665
2664
|
const h = document.createElement("span");
|
|
2666
|
-
h.className = "gengage-chat-ai-toppick-original-price", h.textContent = W(i, a.pricing),
|
|
2665
|
+
h.className = "gengage-chat-ai-toppick-original-price", h.textContent = W(i, a.pricing), d.appendChild(s), d.appendChild(p), d.appendChild(h);
|
|
2667
2666
|
} else if (l) {
|
|
2668
2667
|
const s = document.createElement("span");
|
|
2669
|
-
s.className = "gengage-chat-ai-toppick-original-price", s.textContent = W(i, a.pricing),
|
|
2668
|
+
s.className = "gengage-chat-ai-toppick-original-price", s.textContent = W(i, a.pricing), d.appendChild(s), d.appendChild(document.createTextNode(" "));
|
|
2670
2669
|
const p = document.createElement("span");
|
|
2671
|
-
p.className = "gengage-chat-ai-toppick-price-current", p.textContent = W(n, a.pricing),
|
|
2670
|
+
p.className = "gengage-chat-ai-toppick-price-current", p.textContent = W(n, a.pricing), d.appendChild(p);
|
|
2672
2671
|
} else {
|
|
2673
2672
|
const s = document.createElement("span");
|
|
2674
|
-
s.className = "gengage-chat-ai-toppick-price-current", s.textContent = W(n, a.pricing),
|
|
2673
|
+
s.className = "gengage-chat-ai-toppick-price-current", s.textContent = W(n, a.pricing), d.appendChild(s);
|
|
2675
2674
|
}
|
|
2676
2675
|
if (r) {
|
|
2677
2676
|
const s = document.createElement("div");
|
|
2678
|
-
s.className = "gengage-chat-ai-toppick-price-stack", s.appendChild(Ve(r)), s.appendChild(
|
|
2679
|
-
} else e.appendChild(
|
|
2677
|
+
s.className = "gengage-chat-ai-toppick-price-stack", s.appendChild(Ve(r)), s.appendChild(d), e.appendChild(s);
|
|
2678
|
+
} else e.appendChild(d);
|
|
2680
2679
|
}
|
|
2681
2680
|
function Yn(t, e) {
|
|
2682
2681
|
const a = typeof t.reason == "string" ? t.reason.trim() : "", n = typeof t.reviewHighlight == "string" ? t.reviewHighlight.trim() : "";
|
|
@@ -2694,14 +2693,14 @@ function Yn(t, e) {
|
|
|
2694
2693
|
function bt(t, e, a) {
|
|
2695
2694
|
const n = document.createElement("div");
|
|
2696
2695
|
n.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", n.dataset.gengagePart = a ? "ai-top-pick-card-winner" : "ai-top-pick-card";
|
|
2697
|
-
const i = t.product, r = Ft(t), o = i.url ?? "", l = i.cartCode,
|
|
2696
|
+
const i = t.product, r = Ft(t), o = i.url ?? "", l = i.cartCode, g = i.inStock, c = !!(r && l && g !== !1), d = t.action;
|
|
2698
2697
|
r && e.onProductClick ? (n.classList.add("gds-clickable"), n.addEventListener("click", (k) => {
|
|
2699
2698
|
k.target.closest(".gengage-chat-ai-toppick-cta") || k.target.closest(".gengage-chat-favorite-btn") || k.target.closest(".gengage-chat-find-similar-pill") || e.onProductClick?.({
|
|
2700
2699
|
sku: r,
|
|
2701
2700
|
url: o
|
|
2702
2701
|
});
|
|
2703
|
-
})) :
|
|
2704
|
-
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(
|
|
2702
|
+
})) : d && (n.classList.add("gds-clickable"), n.addEventListener("click", (k) => {
|
|
2703
|
+
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(d);
|
|
2705
2704
|
}));
|
|
2706
2705
|
const s = i.name || "Product image", p = !a && e.isMobile === !0, h = a ? mt(t.role, e.i18n) ?? e.i18n?.roleWinner ?? "TOP MATCH" : mt(t.role, e.i18n);
|
|
2707
2706
|
if (h && !p) {
|
|
@@ -2732,8 +2731,8 @@ function bt(t, e, a) {
|
|
|
2732
2731
|
}
|
|
2733
2732
|
}
|
|
2734
2733
|
N.childNodes.length > 0 && n.appendChild(N);
|
|
2735
|
-
const S = !!(r && e.topPicksLoadingSku === r), E = (c ||
|
|
2736
|
-
if (S || c ||
|
|
2734
|
+
const S = !!(r && e.topPicksLoadingSku === r), E = (c || d) && !p;
|
|
2735
|
+
if (S || c || d) {
|
|
2737
2736
|
const k = document.createElement("div");
|
|
2738
2737
|
if (k.className = "gengage-chat-ai-toppick-spinner", k.dataset.gengagePart = "ai-top-pick-spinner", k.style.display = S ? "" : "none", n.appendChild(k), E) {
|
|
2739
2738
|
const I = document.createElement("button");
|
|
@@ -2750,15 +2749,15 @@ function bt(t, e, a) {
|
|
|
2750
2749
|
});
|
|
2751
2750
|
return;
|
|
2752
2751
|
}
|
|
2753
|
-
if (
|
|
2754
|
-
if (
|
|
2752
|
+
if (d) {
|
|
2753
|
+
if (d.type === "findSimilar" && r && e.onProductClick) {
|
|
2755
2754
|
e.onProductClick({
|
|
2756
2755
|
sku: r,
|
|
2757
2756
|
url: o
|
|
2758
2757
|
});
|
|
2759
2758
|
return;
|
|
2760
2759
|
}
|
|
2761
|
-
e.onAction(
|
|
2760
|
+
e.onAction(d);
|
|
2762
2761
|
}
|
|
2763
2762
|
}), n.appendChild(I);
|
|
2764
2763
|
}
|
|
@@ -2778,9 +2777,9 @@ function Kn(t, e) {
|
|
|
2778
2777
|
if (r.appendChild(bt(o, e, !0)), n.length > 1) {
|
|
2779
2778
|
const l = document.createElement("div");
|
|
2780
2779
|
l.className = "gengage-chat-ai-top-picks-rest", l.dataset.gengagePart = "ai-top-picks-rest";
|
|
2781
|
-
for (let
|
|
2782
|
-
const c = n[
|
|
2783
|
-
l.appendChild(bt(c, e,
|
|
2780
|
+
for (let g = 1; g < n.length; g++) {
|
|
2781
|
+
const c = n[g], d = c.role === "winner";
|
|
2782
|
+
l.appendChild(bt(c, e, d));
|
|
2784
2783
|
}
|
|
2785
2784
|
r.appendChild(l);
|
|
2786
2785
|
}
|
|
@@ -2798,16 +2797,16 @@ function Zn(t) {
|
|
|
2798
2797
|
function Xn(t, e) {
|
|
2799
2798
|
const a = document.createElement("div");
|
|
2800
2799
|
a.className = "gengage-chat-grounding-review gds-evidence-card", a.dataset.gengagePart = "grounding-review-card";
|
|
2801
|
-
const n = t.props ?? {}, i = n.title, r = n.reviewCount, o = n.action, l = e.i18n?.groundingReviewCta ?? "Read Reviews",
|
|
2802
|
-
|
|
2800
|
+
const n = t.props ?? {}, i = n.title, r = n.reviewCount, o = n.action, l = e.i18n?.groundingReviewCta ?? "Read Reviews", g = document.createElement("span");
|
|
2801
|
+
g.className = "gengage-chat-grounding-review-icon", g.appendChild(Me([
|
|
2803
2802
|
"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",
|
|
2804
2803
|
"M8 9h8",
|
|
2805
2804
|
"M8 13h6"
|
|
2806
|
-
])), a.appendChild(
|
|
2805
|
+
])), a.appendChild(g);
|
|
2807
2806
|
const c = document.createElement("div");
|
|
2808
2807
|
c.className = "gengage-chat-grounding-review-body", c.dataset.gengagePart = "grounding-review-body";
|
|
2809
|
-
const
|
|
2810
|
-
if (
|
|
2808
|
+
const d = document.createElement("div");
|
|
2809
|
+
if (d.className = "gengage-chat-grounding-review-title", d.dataset.gengagePart = "grounding-review-title", d.textContent = i ?? e.i18n?.customerReviewsTitle ?? "Customer Reviews", c.appendChild(d), r) {
|
|
2811
2810
|
const v = document.createElement("div");
|
|
2812
2811
|
v.className = "gengage-chat-grounding-review-subtitle", v.dataset.gengagePart = "grounding-review-subtitle", v.textContent = (e.i18n?.groundingReviewSubtitle ?? "{count} yorum mevcut").replace("{count}", r), c.appendChild(v);
|
|
2813
2812
|
}
|
|
@@ -2852,15 +2851,15 @@ function Jn(t, e) {
|
|
|
2852
2851
|
const o = document.createElement("div");
|
|
2853
2852
|
o.className = "gengage-chat-grouping-cards-scroll", o.dataset.gengagePart = "ai-grouping-cards-scroll";
|
|
2854
2853
|
for (const l of n) {
|
|
2855
|
-
const
|
|
2856
|
-
if (
|
|
2854
|
+
const g = document.createElement("div");
|
|
2855
|
+
if (g.className = "gengage-chat-grouping-card gds-card", g.dataset.gengagePart = "ai-grouping-card", g.classList.add("gds-clickable"), g.addEventListener("click", () => e.onAction(Qn(l))), l.image && be(l.image)) {
|
|
2857
2856
|
const p = document.createElement("img");
|
|
2858
|
-
p.className = "gengage-chat-grouping-card-img", p.dataset.gengagePart = "ai-grouping-card-image", p.src = l.image, p.alt = l.name, p.width = 64, p.height = 64,
|
|
2857
|
+
p.className = "gengage-chat-grouping-card-img", p.dataset.gengagePart = "ai-grouping-card-image", p.src = l.image, p.alt = l.name, p.width = 64, p.height = 64, g.appendChild(p);
|
|
2859
2858
|
}
|
|
2860
2859
|
const c = document.createElement("div");
|
|
2861
2860
|
c.className = "gengage-chat-grouping-card-body", c.dataset.gengagePart = "ai-grouping-card-body";
|
|
2862
|
-
const
|
|
2863
|
-
if (
|
|
2861
|
+
const d = document.createElement("span");
|
|
2862
|
+
if (d.className = "gengage-chat-grouping-card-name", d.dataset.gengagePart = "ai-grouping-card-name", d.textContent = l.name, c.appendChild(d), l.labels && l.labels.length > 0) {
|
|
2864
2863
|
const p = document.createElement("div");
|
|
2865
2864
|
p.className = "gengage-chat-grouping-card-labels", p.dataset.gengagePart = "ai-grouping-card-labels";
|
|
2866
2865
|
for (const h of l.labels.slice(0, 2)) {
|
|
@@ -2869,9 +2868,9 @@ function Jn(t, e) {
|
|
|
2869
2868
|
}
|
|
2870
2869
|
c.appendChild(p);
|
|
2871
2870
|
}
|
|
2872
|
-
|
|
2871
|
+
g.appendChild(c);
|
|
2873
2872
|
const s = document.createElement("span");
|
|
2874
|
-
s.className = "gengage-chat-grouping-card-arrow", s.textContent = "↳",
|
|
2873
|
+
s.className = "gengage-chat-grouping-card-arrow", s.textContent = "↳", g.insertBefore(s, g.firstChild), o.appendChild(g);
|
|
2875
2874
|
}
|
|
2876
2875
|
return a.appendChild(o), a;
|
|
2877
2876
|
}
|
|
@@ -2883,8 +2882,8 @@ function ei(t, e) {
|
|
|
2883
2882
|
for (const i of n) {
|
|
2884
2883
|
const r = document.createElement("div");
|
|
2885
2884
|
if (r.className = "gengage-chat-suggested-search-card gds-card", r.dataset.gengagePart = "ai-suggested-search-card", r.classList.add("gds-clickable"), r.addEventListener("click", () => e.onAction(i.action)), i.image && be(i.image)) {
|
|
2886
|
-
const
|
|
2887
|
-
|
|
2885
|
+
const g = document.createElement("img");
|
|
2886
|
+
g.className = "gengage-chat-suggested-search-card-img", g.dataset.gengagePart = "ai-suggested-search-card-image", g.src = i.image, g.alt = i.shortName, g.width = 64, g.height = 64, r.appendChild(g);
|
|
2888
2887
|
}
|
|
2889
2888
|
const o = document.createElement("div");
|
|
2890
2889
|
o.className = "gengage-chat-suggested-search-card-body", o.dataset.gengagePart = "ai-suggested-search-card-body";
|
|
@@ -2900,22 +2899,22 @@ function Dt(t, e) {
|
|
|
2900
2899
|
o.className = "gengage-chat-comparison-floating-summary";
|
|
2901
2900
|
const l = document.createElement("span");
|
|
2902
2901
|
l.className = "gengage-chat-comparison-floating-count", l.textContent = String(t.length), o.appendChild(l);
|
|
2903
|
-
const
|
|
2904
|
-
|
|
2902
|
+
const g = document.createElement("div");
|
|
2903
|
+
g.className = "gengage-chat-comparison-floating-copy";
|
|
2905
2904
|
const c = document.createElement("div");
|
|
2906
|
-
if (c.className = "gengage-chat-comparison-floating-title", c.textContent = a ? `${n} (${t.length})` : e.i18n?.compareMinHint ?? "Select at least 2 products",
|
|
2905
|
+
if (c.className = "gengage-chat-comparison-floating-title", c.textContent = a ? `${n} (${t.length})` : e.i18n?.compareMinHint ?? "Select at least 2 products", g.appendChild(c), i) {
|
|
2907
2906
|
const s = document.createElement("div");
|
|
2908
|
-
s.className = "gengage-chat-comparison-floating-warning", s.setAttribute("role", "status"), s.setAttribute("aria-live", "polite"), s.textContent = i,
|
|
2907
|
+
s.className = "gengage-chat-comparison-floating-warning", s.setAttribute("role", "status"), s.setAttribute("aria-live", "polite"), s.textContent = i, g.appendChild(s);
|
|
2909
2908
|
}
|
|
2910
|
-
o.appendChild(
|
|
2911
|
-
const
|
|
2912
|
-
if (
|
|
2909
|
+
o.appendChild(g), r.appendChild(o);
|
|
2910
|
+
const d = document.createElement("button");
|
|
2911
|
+
if (d.className = "gengage-chat-comparison-floating-action gds-btn gds-btn-primary", d.type = "button", d.textContent = n, d.disabled = !a, a || d.classList.add("gengage-chat-comparison-floating-action--disabled"), d.addEventListener("click", () => {
|
|
2913
2912
|
a && e.onAction({
|
|
2914
2913
|
title: n,
|
|
2915
2914
|
type: "getComparisonTable",
|
|
2916
2915
|
payload: { sku_list: [...t] }
|
|
2917
2916
|
});
|
|
2918
|
-
}), r.appendChild(
|
|
2917
|
+
}), r.appendChild(d), e.onToggleComparisonSku) {
|
|
2919
2918
|
const s = document.createElement("button");
|
|
2920
2919
|
s.className = "gengage-chat-comparison-floating-close gds-btn gds-btn-ghost gds-icon-btn", s.dataset.gengagePart = "comparison-dock-close", s.type = "button", s.setAttribute("aria-label", e.i18n?.closeAriaLabel ?? "Close"), s.innerHTML = '<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" aria-hidden="true"><path d="M18 6L6 18"/><path d="M6 6l12 12"/></svg>', s.addEventListener("click", (p) => {
|
|
2921
2920
|
p.preventDefault(), p.stopPropagation(), e.onToggleComparisonSku?.("");
|
|
@@ -2938,8 +2937,8 @@ function ti(t) {
|
|
|
2938
2937
|
for (const o of n) {
|
|
2939
2938
|
const l = document.createElement("li");
|
|
2940
2939
|
l.className = "gengage-chat-pros-cons-item", l.dataset.gengagePart = "pros-item";
|
|
2941
|
-
const
|
|
2942
|
-
|
|
2940
|
+
const g = document.createElement("span");
|
|
2941
|
+
g.className = "gengage-chat-pros-cons-icon gengage-chat-pros-cons-icon--pro", g.textContent = "✓", l.appendChild(g);
|
|
2943
2942
|
const c = document.createElement("span");
|
|
2944
2943
|
c.textContent = o, l.appendChild(c), r.appendChild(l);
|
|
2945
2944
|
}
|
|
@@ -2951,8 +2950,8 @@ function ti(t) {
|
|
|
2951
2950
|
for (const o of i) {
|
|
2952
2951
|
const l = document.createElement("li");
|
|
2953
2952
|
l.className = "gengage-chat-pros-cons-item", l.dataset.gengagePart = "cons-item";
|
|
2954
|
-
const
|
|
2955
|
-
|
|
2953
|
+
const g = document.createElement("span");
|
|
2954
|
+
g.className = "gengage-chat-pros-cons-icon gengage-chat-pros-cons-icon--con", g.textContent = "✗", l.appendChild(g);
|
|
2956
2955
|
const c = document.createElement("span");
|
|
2957
2956
|
c.textContent = o, l.appendChild(c), r.appendChild(l);
|
|
2958
2957
|
}
|
|
@@ -2965,21 +2964,21 @@ function ai(t, e) {
|
|
|
2965
2964
|
if (i.className = "gengage-chat-categories", i.dataset.gengagePart = "categories-container", a.length === 0) return i;
|
|
2966
2965
|
const r = document.createElement("div");
|
|
2967
2966
|
r.className = "gengage-chat-categories-tabs gds-toolbar", r.dataset.gengagePart = "categories-tab-bar", r.setAttribute("role", "tablist");
|
|
2968
|
-
const o = [], l = [],
|
|
2969
|
-
for (let
|
|
2970
|
-
const s =
|
|
2971
|
-
o[
|
|
2967
|
+
const o = [], l = [], g = (c) => {
|
|
2968
|
+
for (let d = 0; d < o.length; d++) {
|
|
2969
|
+
const s = d === c;
|
|
2970
|
+
o[d].classList.toggle("gengage-chat-categories-tab--active", s), o[d].classList.toggle("is-active", s), o[d].setAttribute("aria-selected", String(s)), o[d].tabIndex = s ? 0 : -1, l[d].style.display = s ? "" : "none";
|
|
2972
2971
|
}
|
|
2973
2972
|
};
|
|
2974
2973
|
for (let c = 0; c < a.length; c++) {
|
|
2975
|
-
const
|
|
2976
|
-
h.className = "gengage-chat-categories-tab gds-tab", h.type = "button", h.dataset.gengagePart = "categories-tab", h.id = s, h.setAttribute("role", "tab"), h.setAttribute("aria-controls", p), h.setAttribute("aria-selected", String(c === 0)), h.tabIndex = c === 0 ? 0 : -1, c === 0 && h.classList.add("gengage-chat-categories-tab--active", "is-active"), h.textContent =
|
|
2974
|
+
const d = a[c], s = `gengage-cat-tab-${c}`, p = `gengage-cat-panel-${c}`, h = document.createElement("button");
|
|
2975
|
+
h.className = "gengage-chat-categories-tab gds-tab", h.type = "button", h.dataset.gengagePart = "categories-tab", h.id = s, h.setAttribute("role", "tab"), h.setAttribute("aria-controls", p), h.setAttribute("aria-selected", String(c === 0)), h.tabIndex = c === 0 ? 0 : -1, c === 0 && h.classList.add("gengage-chat-categories-tab--active", "is-active"), h.textContent = d.groupName, h.addEventListener("click", () => g(c)), h.addEventListener("keydown", (u) => {
|
|
2977
2976
|
let f = -1;
|
|
2978
|
-
u.key === "ArrowRight" || u.key === "ArrowDown" ? f = (c + 1) % a.length : u.key === "ArrowLeft" || u.key === "ArrowUp" ? f = (c - 1 + a.length) % a.length : u.key === "Home" ? f = 0 : u.key === "End" && (f = a.length - 1), f >= 0 && (u.preventDefault(),
|
|
2977
|
+
u.key === "ArrowRight" || u.key === "ArrowDown" ? f = (c + 1) % a.length : u.key === "ArrowLeft" || u.key === "ArrowUp" ? f = (c - 1 + a.length) % a.length : u.key === "Home" ? f = 0 : u.key === "End" && (f = a.length - 1), f >= 0 && (u.preventDefault(), g(f), o[f].focus());
|
|
2979
2978
|
}), o.push(h), r.appendChild(h);
|
|
2980
2979
|
const v = document.createElement("div");
|
|
2981
2980
|
v.className = "gengage-chat-categories-grid", v.dataset.gengagePart = "categories-panel", v.id = p, v.setAttribute("role", "tabpanel"), v.setAttribute("aria-labelledby", s), c !== 0 && (v.style.display = "none");
|
|
2982
|
-
for (const u of
|
|
2981
|
+
for (const u of d.products) {
|
|
2983
2982
|
const f = ni(u, e);
|
|
2984
2983
|
v.appendChild(f);
|
|
2985
2984
|
}
|
|
@@ -2990,10 +2989,10 @@ function ai(t, e) {
|
|
|
2990
2989
|
if (n.length > 0) {
|
|
2991
2990
|
const c = document.createElement("div");
|
|
2992
2991
|
c.className = "gengage-chat-categories-filter-tags gds-toolbar", c.dataset.gengagePart = "categories-filter-tags";
|
|
2993
|
-
for (const
|
|
2992
|
+
for (const d of n) {
|
|
2994
2993
|
const s = document.createElement("button");
|
|
2995
|
-
s.className = "gengage-chat-categories-filter-tag gds-chip", s.type = "button", s.dataset.gengagePart = "categories-filter-tag", s.textContent =
|
|
2996
|
-
e.onAction(
|
|
2994
|
+
s.className = "gengage-chat-categories-filter-tag gds-chip", s.type = "button", s.dataset.gengagePart = "categories-filter-tag", s.textContent = d.title, d.action && s.addEventListener("click", () => {
|
|
2995
|
+
e.onAction(d.action);
|
|
2997
2996
|
}), c.appendChild(s);
|
|
2998
2997
|
}
|
|
2999
2998
|
i.appendChild(c);
|
|
@@ -3061,24 +3060,24 @@ function ri(t, e) {
|
|
|
3061
3060
|
const v = o && !l.toLowerCase().startsWith(o.toLowerCase()) ? `${o} ${l}` : l;
|
|
3062
3061
|
h.textContent = v, h.title = v, r.appendChild(h);
|
|
3063
3062
|
}
|
|
3064
|
-
const
|
|
3065
|
-
if (typeof
|
|
3063
|
+
const g = a.rating, c = a.reviewCount;
|
|
3064
|
+
if (typeof g == "number" && Number.isFinite(g) && g > 0) {
|
|
3066
3065
|
const h = document.createElement("div");
|
|
3067
|
-
if (h.className = "gengage-chat-product-summary__rating", h.dataset.gengagePart = "product-summary-rating", h.appendChild(Tt(
|
|
3066
|
+
if (h.className = "gengage-chat-product-summary__rating", h.dataset.gengagePart = "product-summary-rating", h.appendChild(Tt(g)), typeof c == "number" && Number.isFinite(c)) {
|
|
3068
3067
|
const v = document.createElement("span");
|
|
3069
3068
|
v.className = "gengage-chat-product-summary__review-count", v.textContent = ` (${c})`, h.appendChild(v);
|
|
3070
3069
|
}
|
|
3071
3070
|
r.appendChild(h);
|
|
3072
3071
|
}
|
|
3073
|
-
const
|
|
3074
|
-
if (
|
|
3075
|
-
const h = Te(e, a), v = ze(e, a), u = !!(s && s !==
|
|
3072
|
+
const d = a.price, s = a.originalPrice;
|
|
3073
|
+
if (d) {
|
|
3074
|
+
const h = Te(e, a), v = ze(e, a), u = !!(s && s !== d), f = document.createElement("div");
|
|
3076
3075
|
f.className = "gengage-chat-product-summary__price", f.dataset.gengagePart = "product-summary-price";
|
|
3077
3076
|
const x = !!(h && u), N = $e(e, a);
|
|
3078
3077
|
if (x) {
|
|
3079
3078
|
const S = Ge({
|
|
3080
3079
|
reasonText: h,
|
|
3081
|
-
salePriceFormatted: W(
|
|
3080
|
+
salePriceFormatted: W(d, e.pricing),
|
|
3082
3081
|
...N !== void 0 ? { logoUrl: N } : {}
|
|
3083
3082
|
});
|
|
3084
3083
|
if (u && v === "inline") {
|
|
@@ -3096,7 +3095,7 @@ function ri(t, e) {
|
|
|
3096
3095
|
if (u && v === "inline") {
|
|
3097
3096
|
f.classList.add("gengage-chat-product-summary__price--inline");
|
|
3098
3097
|
const S = document.createElement("span");
|
|
3099
|
-
S.className = "gengage-chat-product-summary__price-current", S.textContent = W(
|
|
3098
|
+
S.className = "gengage-chat-product-summary__price-current", S.textContent = W(d, e.pricing);
|
|
3100
3099
|
const E = document.createElement("span");
|
|
3101
3100
|
E.className = "gengage-chat-product-summary__price-sep", E.setAttribute("aria-hidden", "true");
|
|
3102
3101
|
const k = document.createElement("span");
|
|
@@ -3105,10 +3104,10 @@ function ri(t, e) {
|
|
|
3105
3104
|
const S = document.createElement("span");
|
|
3106
3105
|
S.className = "gengage-chat-product-summary__price-original", S.textContent = W(s, e.pricing), f.appendChild(S), f.appendChild(document.createTextNode(" "));
|
|
3107
3106
|
const E = document.createElement("span");
|
|
3108
|
-
E.className = "gengage-chat-product-summary__price-current", E.textContent = W(
|
|
3107
|
+
E.className = "gengage-chat-product-summary__price-current", E.textContent = W(d, e.pricing), f.appendChild(E);
|
|
3109
3108
|
} else {
|
|
3110
3109
|
const S = document.createElement("span");
|
|
3111
|
-
S.className = "gengage-chat-product-summary__price-current", S.textContent = W(
|
|
3110
|
+
S.className = "gengage-chat-product-summary__price-current", S.textContent = W(d, e.pricing), f.appendChild(S);
|
|
3112
3111
|
}
|
|
3113
3112
|
if (h) {
|
|
3114
3113
|
const S = document.createElement("div");
|
|
@@ -3144,9 +3143,9 @@ function ci(t, e, a, n, i) {
|
|
|
3144
3143
|
o.className = "gengage-chat-consulting-style-picker-title", o.textContent = (a === "watch_expert" ? i?.i18n?.watchStylesPreparedTitle ?? "Prepared {count} style directions for you" : i?.i18n?.beautyStylesPreparedTitle ?? "Prepared {count} beauty styles for you").replace("{count}", String(n.length)), r.appendChild(o);
|
|
3145
3144
|
const l = document.createElement("div");
|
|
3146
3145
|
l.className = "gengage-chat-consulting-style-grid", r.appendChild(l);
|
|
3147
|
-
const
|
|
3146
|
+
const g = (d) => {
|
|
3148
3147
|
e.innerHTML = "";
|
|
3149
|
-
const s = Array.isArray(
|
|
3148
|
+
const s = Array.isArray(d.product_list) ? d.product_list : [], p = Array.isArray(d.recommendation_groups) ? d.recommendation_groups : [];
|
|
3150
3149
|
if (p.length > 0) {
|
|
3151
3150
|
const h = /* @__PURE__ */ new Map();
|
|
3152
3151
|
for (const f of s) {
|
|
@@ -3210,21 +3209,21 @@ function ci(t, e, a, n, i) {
|
|
|
3210
3209
|
}
|
|
3211
3210
|
};
|
|
3212
3211
|
let c = 0;
|
|
3213
|
-
n.forEach((
|
|
3212
|
+
n.forEach((d, s) => {
|
|
3214
3213
|
const p = document.createElement("button");
|
|
3215
|
-
p.type = "button", p.className = "gengage-chat-consulting-style-btn gds-card", s === 0 && p.classList.add("gengage-chat-consulting-style-btn--active"), p.setAttribute("aria-label",
|
|
3214
|
+
p.type = "button", p.className = "gengage-chat-consulting-style-btn gds-card", s === 0 && p.classList.add("gengage-chat-consulting-style-btn--active"), p.setAttribute("aria-label", d.style_label ?? `Style ${s + 1}`);
|
|
3216
3215
|
const h = document.createElement("div");
|
|
3217
3216
|
h.className = "gengage-chat-consulting-style-media";
|
|
3218
|
-
const v = si(
|
|
3217
|
+
const v = si(d.image_url);
|
|
3219
3218
|
if (v && ce(v)) {
|
|
3220
3219
|
const f = document.createElement("img");
|
|
3221
|
-
f.className = "gengage-chat-consulting-style-image", ne(f, "src", v), f.alt =
|
|
3220
|
+
f.className = "gengage-chat-consulting-style-image", ne(f, "src", v), f.alt = d.style_label ?? `Style ${s + 1}`, f.loading = "lazy", ve(f), h.appendChild(f);
|
|
3222
3221
|
}
|
|
3223
3222
|
const u = document.createElement("span");
|
|
3224
|
-
u.className = "gengage-chat-consulting-style-caption", u.textContent =
|
|
3225
|
-
c !== s && (c = s, l.querySelectorAll(".gengage-chat-consulting-style-btn").forEach((f, x) => f.classList.toggle("gengage-chat-consulting-style-btn--active", x === s)), d
|
|
3223
|
+
u.className = "gengage-chat-consulting-style-caption", u.textContent = d.style_label ?? `Style ${s + 1}`, h.appendChild(u), p.appendChild(h), p.addEventListener("click", () => {
|
|
3224
|
+
c !== s && (c = s, l.querySelectorAll(".gengage-chat-consulting-style-btn").forEach((f, x) => f.classList.toggle("gengage-chat-consulting-style-btn--active", x === s)), g(d));
|
|
3226
3225
|
}), l.appendChild(p);
|
|
3227
|
-
}), t.appendChild(r),
|
|
3226
|
+
}), t.appendChild(r), g(n[0] ?? {});
|
|
3228
3227
|
}
|
|
3229
3228
|
function li(t) {
|
|
3230
3229
|
const e = typeof t.props?.source == "string" ? t.props.source : void 0, a = (Array.isArray(t.props?.styleVariations) ? t.props.styleVariations : []).filter((n) => Array.isArray(n.product_list) && n.product_list.length > 0);
|
|
@@ -3306,9 +3305,9 @@ function ui(t, e) {
|
|
|
3306
3305
|
}
|
|
3307
3306
|
function ft(t, e, a, n, i) {
|
|
3308
3307
|
t.replaceChildren();
|
|
3309
|
-
const r = ze(e, a), o = !!(i && n && i !== n), l = Te(e, a),
|
|
3308
|
+
const r = ze(e, a), o = !!(i && n && i !== n), l = Te(e, a), g = !!(l && o), c = $e(e, a);
|
|
3310
3309
|
if (!n || parseFloat(n) <= 0) return;
|
|
3311
|
-
if (
|
|
3310
|
+
if (g) {
|
|
3312
3311
|
const s = Ge({
|
|
3313
3312
|
reasonText: l,
|
|
3314
3313
|
salePriceFormatted: W(n, e.pricing),
|
|
@@ -3344,8 +3343,8 @@ function ft(t, e, a, n, i) {
|
|
|
3344
3343
|
return;
|
|
3345
3344
|
}
|
|
3346
3345
|
t.classList.remove("gengage-chat-product-card-price-block--inline");
|
|
3347
|
-
const
|
|
3348
|
-
if (
|
|
3346
|
+
const d = document.createElement("span");
|
|
3347
|
+
if (d.className = "gengage-chat-product-card-current-price", d.textContent = W(n, e.pricing), t.appendChild(d), o) {
|
|
3349
3348
|
t.appendChild(document.createTextNode(" "));
|
|
3350
3349
|
const s = document.createElement("span");
|
|
3351
3350
|
s.className = "gengage-chat-product-card-original-price", s.textContent = W(i, e.pricing), t.appendChild(s);
|
|
@@ -3353,8 +3352,8 @@ function ft(t, e, a, n, i) {
|
|
|
3353
3352
|
}
|
|
3354
3353
|
function vt(t, e, a, n, i, r, o) {
|
|
3355
3354
|
t.classList.remove("gengage-chat-product-details-price--inline"), t.replaceChildren(), t.className = "gengage-chat-product-details-price";
|
|
3356
|
-
const l = Te(e, a),
|
|
3357
|
-
if (
|
|
3355
|
+
const l = Te(e, a), g = !!(l && o), c = $e(e, a);
|
|
3356
|
+
if (g) {
|
|
3358
3357
|
const s = Ge({
|
|
3359
3358
|
reasonText: l,
|
|
3360
3359
|
salePriceFormatted: W(n, e.pricing),
|
|
@@ -3389,10 +3388,10 @@ function vt(t, e, a, n, i, r, o) {
|
|
|
3389
3388
|
const s = document.createElement("span");
|
|
3390
3389
|
s.className = "gengage-chat-product-details-current-price", s.textContent = W(n, e.pricing), t.appendChild(s);
|
|
3391
3390
|
}
|
|
3392
|
-
const
|
|
3393
|
-
if (typeof
|
|
3391
|
+
const d = je(a, "discountPercent", "price_discount_rate");
|
|
3392
|
+
if (typeof d == "number" && d > 0) {
|
|
3394
3393
|
const s = document.createElement("span");
|
|
3395
|
-
s.className = "gengage-chat-product-details-discount-badge", s.textContent = `%${It(
|
|
3394
|
+
s.className = "gengage-chat-product-details-discount-badge", s.textContent = `%${It(d)}`, t.appendChild(s);
|
|
3396
3395
|
}
|
|
3397
3396
|
}
|
|
3398
3397
|
function Fe(t, e) {
|
|
@@ -3458,12 +3457,12 @@ function Fe(t, e) {
|
|
|
3458
3457
|
}
|
|
3459
3458
|
const l = document.createElement("div");
|
|
3460
3459
|
l.className = "gengage-chat-product-card-body";
|
|
3461
|
-
const
|
|
3462
|
-
if (
|
|
3460
|
+
const g = n.brand;
|
|
3461
|
+
if (g) {
|
|
3463
3462
|
const b = document.createElement("div");
|
|
3464
|
-
b.className = "gengage-chat-product-card-brand", b.textContent =
|
|
3463
|
+
b.className = "gengage-chat-product-card-brand", b.textContent = g, l.appendChild(b);
|
|
3465
3464
|
}
|
|
3466
|
-
const c = n.rating,
|
|
3465
|
+
const c = n.rating, d = n.reviewCount, s = n.price, p = n.originalPrice, h = n.price_async, v = Te(e, n), u = ze(e, n), f = !!(v || p && s && p !== s && parseFloat(s) > 0 && u === "inline"), x = typeof c == "number" && Number.isFinite(c) && c > 0, N = document.createElement("div");
|
|
3467
3466
|
N.className = "gengage-chat-product-card-meta-row";
|
|
3468
3467
|
const S = document.createElement("div");
|
|
3469
3468
|
S.className = "gengage-chat-product-card-price gengage-chat-product-card-price-block";
|
|
@@ -3481,7 +3480,7 @@ function Fe(t, e) {
|
|
|
3481
3480
|
const b = document.createElement("div");
|
|
3482
3481
|
b.className = "gengage-chat-product-card-rating gengage-chat-product-card-rating-compact";
|
|
3483
3482
|
const m = Nt(c), _ = [`${m.toFixed(1)}`, "out of 5 stars"];
|
|
3484
|
-
typeof
|
|
3483
|
+
typeof d == "number" && Number.isFinite(d) && _.push(`(${d} reviews)`), b.setAttribute("aria-label", _.join(" "));
|
|
3485
3484
|
const y = document.createElement("span");
|
|
3486
3485
|
y.className = "gengage-chat-product-card-rating-compact-star", y.setAttribute("aria-hidden", "true"), y.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>';
|
|
3487
3486
|
const A = document.createElement("span");
|
|
@@ -3734,20 +3733,20 @@ function Ni(t) {
|
|
|
3734
3733
|
function Mi(t) {
|
|
3735
3734
|
const e = Ni(t);
|
|
3736
3735
|
if (e) return e;
|
|
3737
|
-
const a = re(t, "sku"), n = De(t, "inStock", "in_stock"), i = [], r = /* @__PURE__ */ new Set(), o = (
|
|
3738
|
-
if (!Ti(
|
|
3739
|
-
const
|
|
3740
|
-
if (!
|
|
3741
|
-
const s = Ii(
|
|
3736
|
+
const a = re(t, "sku"), n = De(t, "inStock", "in_stock"), i = [], r = /* @__PURE__ */ new Set(), o = (g, c) => {
|
|
3737
|
+
if (!Ti(g) || typeof c != "string" && typeof c != "number" && typeof c != "boolean") return;
|
|
3738
|
+
const d = String(c).trim();
|
|
3739
|
+
if (!d) return;
|
|
3740
|
+
const s = Ii(g), p = `${s.toLowerCase()}:${d.toLowerCase()}`;
|
|
3742
3741
|
r.has(p) || (r.add(p), i.push({
|
|
3743
3742
|
name: s,
|
|
3744
|
-
value:
|
|
3743
|
+
value: d,
|
|
3745
3744
|
sku: a,
|
|
3746
3745
|
inStock: n
|
|
3747
3746
|
}));
|
|
3748
3747
|
}, l = yi(t, "facetHits", "facet_hits");
|
|
3749
|
-
if (l) for (const [
|
|
3750
|
-
for (const
|
|
3748
|
+
if (l) for (const [g, c] of Object.entries(l)) o(g, c);
|
|
3749
|
+
for (const g of qt(t)) o(g.key, g.value);
|
|
3751
3750
|
return i;
|
|
3752
3751
|
}
|
|
3753
3752
|
function Bi(t, e) {
|
|
@@ -3759,7 +3758,7 @@ function zi(t, e) {
|
|
|
3759
3758
|
a.className = "gengage-chat-product-details-panel";
|
|
3760
3759
|
const n = t.props?.product ?? t.props;
|
|
3761
3760
|
if (!n) return a;
|
|
3762
|
-
const i = re(n, "name"), r = re(n, "brand"), o = re(n, "sku"), l = re(n, "cartCode", "cart_code"),
|
|
3761
|
+
const i = re(n, "name"), r = re(n, "brand"), o = re(n, "sku"), l = re(n, "cartCode", "cart_code"), g = re(n, "price"), c = re(n, "originalPrice", "price_original"), d = De(n, "price_async"), s = Te(e, n), p = ze(e, n), h = !!(c && g && c !== g), v = De(n, "inStock", "in_stock"), u = je(n, "reviewCount", "review_count"), f = je(n, "rating"), x = _i(n), N = qt(n).slice(0, 4);
|
|
3763
3762
|
if (x.length > 1) {
|
|
3764
3763
|
const b = document.createElement("div");
|
|
3765
3764
|
b.className = "gengage-chat-product-details-media gengage-chat-product-details-gallery gengage-chat-product-details-img-wrap";
|
|
@@ -3846,18 +3845,18 @@ function zi(t, e) {
|
|
|
3846
3845
|
_.className = "gengage-chat-product-details-price-stack", _.appendChild(Ve(s)), S.appendChild(_), b = _;
|
|
3847
3846
|
}
|
|
3848
3847
|
const m = document.createElement("div");
|
|
3849
|
-
if (m.className = "gengage-chat-product-details-price",
|
|
3848
|
+
if (m.className = "gengage-chat-product-details-price", d === !0) {
|
|
3850
3849
|
const _ = document.createElement("span");
|
|
3851
3850
|
_.className = "gengage-chat-price-skeleton", m.appendChild(_), b.appendChild(m), setTimeout(() => {
|
|
3852
3851
|
if (_.parentElement)
|
|
3853
|
-
if (
|
|
3852
|
+
if (g && parseFloat(g) > 0) vt(m, e, n, g, c, p, h);
|
|
3854
3853
|
else {
|
|
3855
3854
|
const y = m.parentElement;
|
|
3856
3855
|
m.remove(), y?.classList.contains("gengage-chat-product-details-price-stack") && y.remove();
|
|
3857
3856
|
}
|
|
3858
3857
|
}, 300);
|
|
3859
|
-
} else if (
|
|
3860
|
-
vt(m, e, n,
|
|
3858
|
+
} else if (g && parseFloat(g) > 0)
|
|
3859
|
+
vt(m, e, n, g, c, p, h), b.appendChild(m);
|
|
3861
3860
|
else if (s) {
|
|
3862
3861
|
const _ = b;
|
|
3863
3862
|
_.classList.contains("gengage-chat-product-details-price-stack") && _.remove();
|
|
@@ -3919,7 +3918,7 @@ function zi(t, e) {
|
|
|
3919
3918
|
const $ = document.createElement("span");
|
|
3920
3919
|
$.className = "gengage-chat-product-variant-label", $.textContent = z, L.appendChild($);
|
|
3921
3920
|
const te = Li(y);
|
|
3922
|
-
if (te && String(te) !== String(
|
|
3921
|
+
if (te && String(te) !== String(g)) {
|
|
3923
3922
|
const j = document.createElement("span");
|
|
3924
3923
|
j.className = "gengage-chat-product-variant-price", j.textContent = W(String(te), e.pricing), L.appendChild(j);
|
|
3925
3924
|
}
|
|
@@ -4043,35 +4042,35 @@ function Fi(t, e, a) {
|
|
|
4043
4042
|
if (t) {
|
|
4044
4043
|
const l = document.createElement("button");
|
|
4045
4044
|
l.className = "gengage-chat-product-detail-tab gds-tab gengage-chat-product-detail-tab--active is-active", l.type = "button", l.setAttribute("aria-selected", "true"), l.textContent = a.i18n?.productInfoTab ?? "Product Info", i.appendChild(l);
|
|
4046
|
-
const
|
|
4047
|
-
|
|
4045
|
+
const g = document.createElement("div");
|
|
4046
|
+
g.className = "gengage-chat-product-detail-tab-panel", Hi(g, t), r.push(g);
|
|
4048
4047
|
}
|
|
4049
4048
|
if (e) {
|
|
4050
4049
|
const l = document.createElement("button");
|
|
4051
4050
|
l.className = `gengage-chat-product-detail-tab gds-tab${t ? "" : " gengage-chat-product-detail-tab--active is-active"}`, l.type = "button", l.setAttribute("aria-selected", t ? "false" : "true"), l.textContent = a.i18n?.specificationsTab ?? "Specifications", i.appendChild(l);
|
|
4052
|
-
const
|
|
4053
|
-
|
|
4051
|
+
const g = document.createElement("div");
|
|
4052
|
+
g.className = "gengage-chat-product-detail-tab-panel", t && (g.style.display = "none");
|
|
4054
4053
|
const c = document.createElement("table");
|
|
4055
4054
|
c.className = "gengage-chat-product-specs-table";
|
|
4056
|
-
const
|
|
4055
|
+
const d = Array.isArray(e) ? e : Object.entries(e).map(([s, p]) => ({
|
|
4057
4056
|
key: s,
|
|
4058
4057
|
value: p
|
|
4059
4058
|
}));
|
|
4060
|
-
for (const s of
|
|
4059
|
+
for (const s of d) {
|
|
4061
4060
|
const p = document.createElement("tr"), h = document.createElement("td");
|
|
4062
4061
|
h.className = "gengage-chat-product-specs-key", h.textContent = s.key;
|
|
4063
4062
|
const v = document.createElement("td");
|
|
4064
4063
|
v.className = "gengage-chat-product-specs-value", v.textContent = s.value, p.appendChild(h), p.appendChild(v), c.appendChild(p);
|
|
4065
4064
|
}
|
|
4066
|
-
|
|
4065
|
+
g.appendChild(c), r.push(g);
|
|
4067
4066
|
}
|
|
4068
4067
|
const o = i.querySelectorAll(".gengage-chat-product-detail-tab");
|
|
4069
|
-
o.forEach((l,
|
|
4068
|
+
o.forEach((l, g) => {
|
|
4070
4069
|
l.addEventListener("click", () => {
|
|
4071
4070
|
o.forEach((c) => {
|
|
4072
4071
|
c.classList.remove("gengage-chat-product-detail-tab--active", "is-active"), c.setAttribute("aria-selected", "false");
|
|
4073
|
-
}), l.classList.add("gengage-chat-product-detail-tab--active", "is-active"), l.setAttribute("aria-selected", "true"), r.forEach((c,
|
|
4074
|
-
c.style.display =
|
|
4072
|
+
}), l.classList.add("gengage-chat-product-detail-tab--active", "is-active"), l.setAttribute("aria-selected", "true"), r.forEach((c, d) => {
|
|
4073
|
+
c.style.display = d === g ? "" : "none";
|
|
4075
4074
|
});
|
|
4076
4075
|
});
|
|
4077
4076
|
}), n.appendChild(i);
|
|
@@ -4128,8 +4127,8 @@ function Oi(t, e, a, n) {
|
|
|
4128
4127
|
function qi(t, e, a, n) {
|
|
4129
4128
|
const i = document.createElement("div");
|
|
4130
4129
|
i.className = "gengage-chat-product-grid-wrapper";
|
|
4131
|
-
const r = li(t), o = r.isConsulting, l = t.children ?? [],
|
|
4132
|
-
|
|
4130
|
+
const r = li(t), o = r.isConsulting, l = t.children ?? [], g = document.createElement("div");
|
|
4131
|
+
g.className = "gengage-chat-product-grid";
|
|
4133
4132
|
const c = n?.panelProductListHeading;
|
|
4134
4133
|
if (!o && l.length > 1 && n?.onSortChange) {
|
|
4135
4134
|
const p = document.createElement("div");
|
|
@@ -4206,7 +4205,7 @@ function qi(t, e, a, n) {
|
|
|
4206
4205
|
L.className = "gengage-chat-product-sort-option-label", L.textContent = m.label;
|
|
4207
4206
|
const z = document.createElement("span");
|
|
4208
4207
|
z.className = "gengage-chat-product-sort-option-check", z.innerHTML = Ui(), z.setAttribute("aria-hidden", "true"), y || z.classList.add("gengage-chat-product-sort-option-check--hidden"), _.appendChild(M), _.appendChild(L), _.appendChild(z), _.addEventListener("click", () => {
|
|
4209
|
-
h = m.sortState, n.onSortChange?.(m.sortState), Oi(
|
|
4208
|
+
h = m.sortState, n.onSortChange?.(m.sortState), Oi(g, l, e, m.sortState), I.querySelectorAll(".gengage-chat-product-sort-option").forEach((T) => {
|
|
4210
4209
|
const O = T, H = O.dataset.sortKey === A;
|
|
4211
4210
|
O.classList.toggle("gengage-chat-product-sort-option--active", H), O.classList.toggle("gds-menu-option-active", H), O.setAttribute("aria-selected", H ? "true" : "false"), O.querySelector(".gengage-chat-product-sort-option-check")?.classList.toggle("gengage-chat-product-sort-option-check--hidden", !H);
|
|
4212
4211
|
}), E(m.sortState), V();
|
|
@@ -4239,18 +4238,18 @@ function qi(t, e, a, n) {
|
|
|
4239
4238
|
const h = document.createElement("span");
|
|
4240
4239
|
h.className = "gengage-chat-product-grid-head-title", h.textContent = c, p.appendChild(h), i.appendChild(p);
|
|
4241
4240
|
}
|
|
4242
|
-
if (o) gi(i,
|
|
4241
|
+
if (o) gi(i, g, r, n);
|
|
4243
4242
|
else {
|
|
4244
4243
|
const p = Gt(l, e, n?.productSort);
|
|
4245
4244
|
for (const h of p) {
|
|
4246
4245
|
if (!e.elements[h]) continue;
|
|
4247
4246
|
const v = a(h);
|
|
4248
|
-
v && (v.dataset.elementId = h,
|
|
4247
|
+
v && (v.dataset.elementId = h, g.appendChild(v));
|
|
4249
4248
|
}
|
|
4250
4249
|
}
|
|
4251
|
-
(n?.isMobile ?? tt()) &&
|
|
4252
|
-
const
|
|
4253
|
-
if (!o &&
|
|
4250
|
+
(n?.isMobile ?? tt()) && g.classList.add("gengage-chat-product-grid--mobile"), i.appendChild(g);
|
|
4251
|
+
const d = t.props?.endOfList;
|
|
4252
|
+
if (!o && d !== !0 && l.length > 0) {
|
|
4254
4253
|
const p = n?.i18n?.viewMoreLabel ?? "Show More", h = document.createElement("button");
|
|
4255
4254
|
h.className = "gengage-chat-product-grid-view-more", h.type = "button", h.textContent = p, h.addEventListener("click", () => {
|
|
4256
4255
|
n?.onAction({
|
|
@@ -4268,14 +4267,14 @@ function qi(t, e, a, n) {
|
|
|
4268
4267
|
return i;
|
|
4269
4268
|
}
|
|
4270
4269
|
function Vi(t, e) {
|
|
4271
|
-
const a = t.props ?? {}, n = a.keyDifferencesHtml, i = a.recommended, r = a.products ?? [], o = a.attributes ?? [], l = a.highlights ?? [],
|
|
4270
|
+
const a = t.props ?? {}, n = a.keyDifferencesHtml, i = a.recommended, r = a.products ?? [], o = a.attributes ?? [], l = a.highlights ?? [], g = a.specialCases, c = a.recommendedText, d = a.winnerHits, s = a.productActions;
|
|
4272
4271
|
if (!i) return document.createElement("div");
|
|
4273
4272
|
const p = {
|
|
4274
4273
|
recommended: i,
|
|
4275
4274
|
products: r,
|
|
4276
4275
|
attributes: o,
|
|
4277
4276
|
highlights: l,
|
|
4278
|
-
specialCases:
|
|
4277
|
+
specialCases: g,
|
|
4279
4278
|
onProductClick: ({ sku: v, name: u }) => {
|
|
4280
4279
|
e.onProductClick?.({
|
|
4281
4280
|
sku: v,
|
|
@@ -4285,7 +4284,7 @@ function Vi(t, e) {
|
|
|
4285
4284
|
},
|
|
4286
4285
|
pricing: e.pricing
|
|
4287
4286
|
};
|
|
4288
|
-
c !== void 0 && (p.recommendedText = c),
|
|
4287
|
+
c !== void 0 && (p.recommendedText = c), d !== void 0 && (p.winnerHits = d), s !== void 0 && (p.productActions = s), n !== void 0 && (p.keyDifferencesHtml = n), e.i18n && (p.i18n = {
|
|
4289
4288
|
comparisonHeading: e.i18n.panelTitleComparisonResults,
|
|
4290
4289
|
recommendedChoiceLabel: e.i18n.recommendedChoiceLabel,
|
|
4291
4290
|
highlightsLabel: e.i18n.highlightsLabel,
|
|
@@ -4360,26 +4359,26 @@ function Zi(t) {
|
|
|
4360
4359
|
isRunning: !1
|
|
4361
4360
|
};
|
|
4362
4361
|
e.innerHTML = "";
|
|
4363
|
-
let
|
|
4362
|
+
let g = 0, c = null, d = !0;
|
|
4364
4363
|
function s() {
|
|
4365
|
-
if (!
|
|
4366
|
-
|
|
4364
|
+
if (!d || g >= l.length) {
|
|
4365
|
+
d = !1, r?.();
|
|
4367
4366
|
return;
|
|
4368
4367
|
}
|
|
4369
|
-
const p = l[
|
|
4368
|
+
const p = l[g], h = document.createElement("span");
|
|
4370
4369
|
h.className = "gengage-chat-typewriter-block";
|
|
4371
4370
|
for (const v of p) h.appendChild(v.cloneNode(!0));
|
|
4372
|
-
e.appendChild(h),
|
|
4371
|
+
e.appendChild(h), g++, i?.(), g < l.length ? c = setTimeout(s, n) : (d = !1, r?.());
|
|
4373
4372
|
}
|
|
4374
4373
|
return s(), {
|
|
4375
4374
|
complete() {
|
|
4376
|
-
|
|
4375
|
+
d && (c !== null && clearTimeout(c), d = !1, e.innerHTML = a, r?.());
|
|
4377
4376
|
},
|
|
4378
4377
|
cancel() {
|
|
4379
|
-
c !== null && clearTimeout(c),
|
|
4378
|
+
c !== null && clearTimeout(c), d = !1;
|
|
4380
4379
|
},
|
|
4381
4380
|
get isRunning() {
|
|
4382
|
-
return
|
|
4381
|
+
return d;
|
|
4383
4382
|
}
|
|
4384
4383
|
};
|
|
4385
4384
|
}
|
|
@@ -4395,27 +4394,27 @@ function Xi(t) {
|
|
|
4395
4394
|
if (i.size !== 0)
|
|
4396
4395
|
for (const [r, o] of i) {
|
|
4397
4396
|
const l = document.createTreeWalker(e, NodeFilter.SHOW_TEXT);
|
|
4398
|
-
let
|
|
4399
|
-
for (;
|
|
4400
|
-
const
|
|
4397
|
+
let g = l.nextNode(), c = !1;
|
|
4398
|
+
for (; g && !c; ) {
|
|
4399
|
+
const d = g.textContent ?? "", s = d.toLowerCase().indexOf(r);
|
|
4401
4400
|
if (s === -1) {
|
|
4402
|
-
|
|
4401
|
+
g = l.nextNode();
|
|
4403
4402
|
continue;
|
|
4404
4403
|
}
|
|
4405
|
-
const p = s > 0 ?
|
|
4404
|
+
const p = s > 0 ? d[s - 1] : void 0, h = d[s + o.short_name.length];
|
|
4406
4405
|
if (kt(p) || kt(h)) {
|
|
4407
|
-
|
|
4406
|
+
g = l.nextNode();
|
|
4408
4407
|
continue;
|
|
4409
4408
|
}
|
|
4410
|
-
const v =
|
|
4409
|
+
const v = d.slice(0, s), u = d.slice(s, s + o.short_name.length), f = d.slice(s + o.short_name.length), x = g.parentNode;
|
|
4411
4410
|
if (!x) {
|
|
4412
|
-
|
|
4411
|
+
g = l.nextNode();
|
|
4413
4412
|
continue;
|
|
4414
4413
|
}
|
|
4415
4414
|
const N = document.createElement("a");
|
|
4416
4415
|
N.className = "gengage-product-mention", N.textContent = u, N.href = "#", N.addEventListener("click", (S) => {
|
|
4417
4416
|
S.preventDefault(), n(o.sku);
|
|
4418
|
-
}), v && x.insertBefore(document.createTextNode(v),
|
|
4417
|
+
}), v && x.insertBefore(document.createTextNode(v), g), x.insertBefore(N, g), f && x.insertBefore(document.createTextNode(f), g), x.removeChild(g), c = !0;
|
|
4419
4418
|
}
|
|
4420
4419
|
}
|
|
4421
4420
|
}
|
|
@@ -4675,8 +4674,8 @@ var cr = class {
|
|
|
4675
4674
|
if (this.currentType = o, r.querySelector(".gengage-chat-product-grid-head-title") && o === "ProductGrid") {
|
|
4676
4675
|
const l = this.deps.currentThreadId();
|
|
4677
4676
|
if (l) {
|
|
4678
|
-
const
|
|
4679
|
-
this.deps.drawer()?.updatePanelTopBar(c,
|
|
4677
|
+
const g = this.threads.indexOf(l), c = g > 0, d = g >= 0 && g < this.threads.length - 1;
|
|
4678
|
+
this.deps.drawer()?.updatePanelTopBar(c, d, "");
|
|
4680
4679
|
}
|
|
4681
4680
|
} else this.updateTopBar(o);
|
|
4682
4681
|
return !0;
|
|
@@ -4953,7 +4952,7 @@ function ur(t, e) {
|
|
|
4953
4952
|
return null;
|
|
4954
4953
|
}
|
|
4955
4954
|
function mr(t) {
|
|
4956
|
-
const { label: e, avatarUrl: a, primaryColor: n, secondaryColor: i = "#111827", fontFamily: r = "inherit", labelClassName: o = "gengage-pill-launcher-label", styleId: l = "gengage-pill-launcher-style", mobileBreakpoint:
|
|
4955
|
+
const { label: e, avatarUrl: a, primaryColor: n, secondaryColor: i = "#111827", fontFamily: r = "inherit", labelClassName: o = "gengage-pill-launcher-label", styleId: l = "gengage-pill-launcher-style", mobileBreakpoint: g = 768, desktopWidth: c = "188px", desktopHeight: d = "60px", iconSize: s = "46px" } = t, p = `${parseInt(c, 10) - 14}px`, h = `${parseInt(d, 10) - 4}px`, v = `${parseInt(s, 10) - 4}px`, u = `
|
|
4957
4956
|
:host {
|
|
4958
4957
|
--pill-primary: ${n};
|
|
4959
4958
|
--pill-secondary: ${i};
|
|
@@ -4965,8 +4964,8 @@ button[data-gengage-part="chat-launcher-button"] {
|
|
|
4965
4964
|
width: ${c} !important;
|
|
4966
4965
|
min-width: ${c} !important;
|
|
4967
4966
|
max-width: ${c} !important;
|
|
4968
|
-
height: ${
|
|
4969
|
-
min-height: ${
|
|
4967
|
+
height: ${d} !important;
|
|
4968
|
+
min-height: ${d} !important;
|
|
4970
4969
|
padding: 6px 7px 6px 22px !important;
|
|
4971
4970
|
display: inline-flex !important;
|
|
4972
4971
|
flex-direction: row-reverse !important;
|
|
@@ -5011,7 +5010,7 @@ button[data-gengage-part="chat-launcher-button"] img {
|
|
|
5011
5010
|
box-shadow: none !important;
|
|
5012
5011
|
}
|
|
5013
5012
|
|
|
5014
|
-
@media (max-width: ${
|
|
5013
|
+
@media (max-width: ${g}px) {
|
|
5015
5014
|
button[data-gengage-part="chat-launcher-button"] {
|
|
5016
5015
|
width: ${p} !important;
|
|
5017
5016
|
min-width: ${p} !important;
|
|
@@ -5349,12 +5348,11 @@ var Pr = ':where(:root,.gengage-chat-root,.gengage-qna-container,.gengage-simrel
|
|
|
5349
5348
|
user_sentiment: w().optional()
|
|
5350
5349
|
}), Wr = U({
|
|
5351
5350
|
summary: w(),
|
|
5352
|
-
clues: Y(w()),
|
|
5353
5351
|
strengths: Y(w()).optional(),
|
|
5354
5352
|
focus_points: Y(w()).optional(),
|
|
5355
5353
|
celeb_style: w().optional(),
|
|
5356
5354
|
celeb_style_reason: w().optional(),
|
|
5357
|
-
details: Y(w())
|
|
5355
|
+
details: Y(w()),
|
|
5358
5356
|
next_question: w().optional(),
|
|
5359
5357
|
style_images: Y(w()).optional()
|
|
5360
5358
|
}), Yr = U({
|
|
@@ -5574,9 +5572,9 @@ var Kr = class Ae extends Ea {
|
|
|
5574
5572
|
i18n: () => this._i18n,
|
|
5575
5573
|
rollbackToThread: (u) => this._rollbackToThread(u)
|
|
5576
5574
|
}), o !== "inline" && this._drawer.getElement().classList.add("gengage-chat-drawer--hidden");
|
|
5577
|
-
const
|
|
5575
|
+
const g = this._drawer.restorePanelState(e.accountId), c = e.panelMode ?? "auto";
|
|
5578
5576
|
c === "collapsed" ? this._drawer.setPanelCollapsed(!0) : c === "expanded" && this._drawer.setForceExpanded();
|
|
5579
|
-
const
|
|
5577
|
+
const d = sessionStorage.getItem("gengage_restore_session_id"), s = sessionStorage.getItem("gengage_restore_sku"), p = !!(d && s);
|
|
5580
5578
|
p && (sessionStorage.removeItem("gengage_restore_session_id"), sessionStorage.removeItem("gengage_restore_sku"));
|
|
5581
5579
|
try {
|
|
5582
5580
|
const u = new cr();
|
|
@@ -5863,7 +5861,7 @@ var Kr = class Ae extends Ea {
|
|
|
5863
5861
|
return typeof r == "string" && r.trim().length > 0 ? r.trim() : void 0;
|
|
5864
5862
|
}
|
|
5865
5863
|
_readContextStringListField(e) {
|
|
5866
|
-
const a = this.config.pageContext, n = a?.extra && typeof a.extra == "object" && !Array.isArray(a.extra) ? a.extra : void 0, i = e.replace(/_([a-z])/g, (l,
|
|
5864
|
+
const a = this.config.pageContext, n = a?.extra && typeof a.extra == "object" && !Array.isArray(a.extra) ? a.extra : void 0, i = e.replace(/_([a-z])/g, (l, g) => g.toUpperCase()), r = a?.[e] ?? n?.[e] ?? a?.[i] ?? n?.[i];
|
|
5867
5865
|
if (!Array.isArray(r)) return;
|
|
5868
5866
|
const o = r.filter((l) => typeof l == "string" && l.trim().length > 0);
|
|
5869
5867
|
return o.length > 0 ? o : void 0;
|
|
@@ -6055,7 +6053,7 @@ var Kr = class Ae extends Ea {
|
|
|
6055
6053
|
return;
|
|
6056
6054
|
}
|
|
6057
6055
|
let o = this._currentPanelSource, l = !1;
|
|
6058
|
-
const
|
|
6056
|
+
const g = () => {
|
|
6059
6057
|
l || a?.preservePanel || (o = this._currentPanelSource, l = !0);
|
|
6060
6058
|
}, c = () => {
|
|
6061
6059
|
if (this._drawer?.isPanelLoading()) {
|
|
@@ -6068,7 +6066,7 @@ var Kr = class Ae extends Ea {
|
|
|
6068
6066
|
}
|
|
6069
6067
|
};
|
|
6070
6068
|
e.type === "getComparisonTable" && (this._drawer?.showPanelLoading("comparisonTable"), this._panel?.updateTopBarForLoading("comparisonTable")), !a?.silent && !i && this._pruneEmptyStreamingAssistantPlaceholders(), this._drawer?.showTypingIndicator();
|
|
6071
|
-
let
|
|
6069
|
+
let d = "";
|
|
6072
6070
|
const s = this._createMessage("assistant", "");
|
|
6073
6071
|
s.threadId = n, s.status = "streaming", a?.silent && (s.silent = !0), this._messages.push(s), this._presentation.registerAssistantActivity(n), this._presentation.requestThreadFocus(n, "smooth"), (a?.silent || i) && this._drawer?.setPresentationFocus(n), this._drawer?.setFormerMessagesButtonVisible(!1), setTimeout(() => this._flushPresentationScroll(), 40), a?.preservePanel || this._abortAllActiveRequests();
|
|
6074
6072
|
const p = {
|
|
@@ -6136,7 +6134,7 @@ var Kr = class Ae extends Ea {
|
|
|
6136
6134
|
let b = null;
|
|
6137
6135
|
if (b = Da(f, {
|
|
6138
6136
|
onTextChunk: (m, _, y) => {
|
|
6139
|
-
if (!i && n !== this._activeRequestThreadId || (
|
|
6137
|
+
if (!i && n !== this._activeRequestThreadId || (d += m, this._drawer?.removeTypingIndicator(), y?.skuToProductItem && (this._skuToProductItem = {
|
|
6140
6138
|
...this._skuToProductItem,
|
|
6141
6139
|
...y.skuToProductItem
|
|
6142
6140
|
}), y?.conversationMode && (this._conversationMode = y.conversationMode), y?.renderHint && (s.renderHint = y.renderHint), this.track(ca(this.analyticsContext(), {
|
|
@@ -6144,7 +6142,7 @@ var Kr = class Ae extends Ea {
|
|
|
6144
6142
|
chunk_index: S++,
|
|
6145
6143
|
widget: "chat"
|
|
6146
6144
|
})), !this._drawer)) return;
|
|
6147
|
-
let A =
|
|
6145
|
+
let A = d;
|
|
6148
6146
|
const M = y?.kvkk === !0 || r && ot(A);
|
|
6149
6147
|
if (_ && M) {
|
|
6150
6148
|
const z = this.config.accountId;
|
|
@@ -6378,7 +6376,7 @@ var Kr = class Ae extends Ea {
|
|
|
6378
6376
|
}
|
|
6379
6377
|
if (m.meta.panelLoading) {
|
|
6380
6378
|
const y = typeof m.meta.panelPendingType == "string" ? m.meta.panelPendingType : void 0;
|
|
6381
|
-
this.config.productDetailsExtended !== !0 && (y === "productDetails" || y === "productDetailsSimilars") || (E = !0, k = !1,
|
|
6379
|
+
this.config.productDetailsExtended !== !0 && (y === "productDetails" || y === "productDetailsSimilars") || (E = !0, k = !1, g(), this._panel && (this._panel.currentType = null), this._drawer?.showPanelLoading(y), y && this._panel?.updateTopBarForLoading(y));
|
|
6382
6380
|
}
|
|
6383
6381
|
if (m.meta.voice) {
|
|
6384
6382
|
const y = new CustomEvent("gengage:chat:voice", {
|
|
@@ -6394,7 +6392,7 @@ var Kr = class Ae extends Ea {
|
|
|
6394
6392
|
if ((m.meta.redirectTarget || m.meta.redirect) && (le("gengage:chat:redirect", {
|
|
6395
6393
|
target: m.meta.redirectTarget ?? null,
|
|
6396
6394
|
payload: m.meta.redirect ?? null
|
|
6397
|
-
}), Se("redirect", "redirect dispatched", { target: m.meta.redirectTarget ?? null }), this._handleRedirectMetadata(m.meta.redirect)), m.meta.analyzeAnimation && this.config.productDetailsExtended === !0 && (E = !0, k = !1,
|
|
6395
|
+
}), Se("redirect", "redirect dispatched", { target: m.meta.redirectTarget ?? null }), this._handleRedirectMetadata(m.meta.redirect)), m.meta.analyzeAnimation && this.config.productDetailsExtended === !0 && (E = !0, k = !1, g(), this._panel && (this._panel.currentType = null), this._drawer?.showPanelLoading(), this._panel?.updateTopBarForLoading("productDetails")), m.meta.loading) {
|
|
6398
6396
|
const y = Array.isArray(m.meta.thinkingMessages) ? m.meta.thinkingMessages.filter((M) => typeof M == "string") : [], A = typeof m.meta.loadingText == "string" ? m.meta.loadingText : void 0;
|
|
6399
6397
|
if (y.length > 0) {
|
|
6400
6398
|
const M = A && this._modeController.shouldCondenseThinking() ? [...y.slice(0, 2), A] : y;
|
|
@@ -6428,7 +6426,7 @@ var Kr = class Ae extends Ea {
|
|
|
6428
6426
|
});
|
|
6429
6427
|
const _ = k;
|
|
6430
6428
|
E && !k && c(), E = !1, k = !1;
|
|
6431
|
-
const y = s.silent || s.content != null && s.content.length > 0 ||
|
|
6429
|
+
const y = s.silent || s.content != null && s.content.length > 0 || d.length > 0 || _, A = typeof navigator < "u" && navigator.onLine === !1 && Lt(m), M = () => {
|
|
6432
6430
|
this._shadow?.querySelector(`[data-message-id="${CSS.escape(s.id)}"]`)?.remove();
|
|
6433
6431
|
const T = this._messages.indexOf(s);
|
|
6434
6432
|
T >= 0 && this._messages.splice(T, 1);
|
|
@@ -6499,7 +6497,7 @@ var Kr = class Ae extends Ea {
|
|
|
6499
6497
|
streamDone: !0
|
|
6500
6498
|
});
|
|
6501
6499
|
const m = k;
|
|
6502
|
-
if (E && !k && c(), E = !1, r && !
|
|
6500
|
+
if (E && !k && c(), E = !1, r && !d && !m) {
|
|
6503
6501
|
const A = this._i18n.productNotFoundMessage;
|
|
6504
6502
|
s.content = A, this._ensureAssistantMessageRendered(s), this._drawer?.updateBotMessage(s.id, A), this._markUnavailableProductContext();
|
|
6505
6503
|
}
|
|
@@ -6702,49 +6700,49 @@ var Kr = class Ae extends Ea {
|
|
|
6702
6700
|
if (!r || r.messages.length === 0) return;
|
|
6703
6701
|
const o = this.config.pageContext?.sku;
|
|
6704
6702
|
if (o && r.sku && r.sku !== o) return;
|
|
6705
|
-
if (this._pdpLaunched = !0, this._drawer?.lockScrollForRestore(), this._currentThreadId = r.currentThreadId, this._lastThreadId = r.lastThreadId, this._currentThreadId && this._lastThreadId && this._currentThreadId > this._lastThreadId && (this._currentThreadId = this._lastThreadId), this._chatCreatedAt = r.createdAt, r.panelThreads && (this._panel.threads = r.panelThreads), r.thumbnailEntries && (this._thumbnailEntries = r.thumbnailEntries, this._drawer?.setThumbnails(this._thumbnailEntries)), r.panelSnapshotHtml) for (const [
|
|
6706
|
-
const
|
|
6707
|
-
|
|
6703
|
+
if (this._pdpLaunched = !0, this._drawer?.lockScrollForRestore(), this._currentThreadId = r.currentThreadId, this._lastThreadId = r.lastThreadId, this._currentThreadId && this._lastThreadId && this._currentThreadId > this._lastThreadId && (this._currentThreadId = this._lastThreadId), this._chatCreatedAt = r.createdAt, r.panelThreads && (this._panel.threads = r.panelThreads), r.thumbnailEntries && (this._thumbnailEntries = r.thumbnailEntries, this._drawer?.setThumbnails(this._thumbnailEntries)), r.panelSnapshotHtml) for (const [g, c] of Object.entries(r.panelSnapshotHtml)) {
|
|
6704
|
+
const d = document.createElement("div");
|
|
6705
|
+
d.innerHTML = ue(c), this._panel.snapshots.set(g, d);
|
|
6708
6706
|
}
|
|
6709
6707
|
let l = 0;
|
|
6710
|
-
for (const
|
|
6708
|
+
for (const g of r.messages) {
|
|
6711
6709
|
const c = {
|
|
6712
|
-
id:
|
|
6713
|
-
role:
|
|
6714
|
-
timestamp:
|
|
6715
|
-
status:
|
|
6710
|
+
id: g.id,
|
|
6711
|
+
role: g.role,
|
|
6712
|
+
timestamp: g.timestamp,
|
|
6713
|
+
status: g.status
|
|
6716
6714
|
};
|
|
6717
|
-
if (
|
|
6715
|
+
if (g.threadId !== void 0 && (c.threadId = g.threadId), g.content !== void 0 && (c.content = g.content), g.silent && (c.silent = !0), this._messages.push(c), c.silent) continue;
|
|
6718
6716
|
c.role === "assistant" && c.threadId && !this._threadsWithFirstBot.has(c.threadId) && (this._threadsWithFirstBot.add(c.threadId), this._drawer?.markFirstBotMessage(c.id)), this._drawer?.addMessage(c);
|
|
6719
|
-
const
|
|
6720
|
-
if (!isNaN(
|
|
6717
|
+
const d = parseInt(g.id.replace("msg-", ""), 10);
|
|
6718
|
+
if (!isNaN(d) && d > l && (l = d), c.role === "assistant" && c.threadId) {
|
|
6721
6719
|
const s = await this._loadPayload(c.threadId, c.id);
|
|
6722
6720
|
s && (c.uiSpec = s, this._restoreInlineUISpec(c), delete c.uiSpec);
|
|
6723
6721
|
}
|
|
6724
6722
|
}
|
|
6725
6723
|
if (l > this._currentMessageId && (this._currentMessageId = l), this._currentThreadId) {
|
|
6726
|
-
let
|
|
6727
|
-
|
|
6724
|
+
let g = await this._session.db?.loadContext(a, this._currentThreadId);
|
|
6725
|
+
g || (g = await this._session.db?.loadLatestContext(a)), g && (this._lastBackendContext = g.context);
|
|
6728
6726
|
}
|
|
6729
6727
|
if (this._currentThreadId) {
|
|
6730
|
-
const
|
|
6731
|
-
|
|
6728
|
+
const g = [...this._messages].reverse().find((c) => c.role === "assistant" && c.threadId === this._currentThreadId && !c.silent);
|
|
6729
|
+
g && this._panel.snapshots.has(g.id) && this._panel?.restoreForMessage(g.id);
|
|
6732
6730
|
}
|
|
6733
6731
|
if (this._currentThreadId) {
|
|
6734
|
-
const
|
|
6735
|
-
for (const c of this._messages) c.threadId && c.threadId >
|
|
6732
|
+
const g = this._currentThreadId;
|
|
6733
|
+
for (const c of this._messages) c.threadId && c.threadId > g && this._shadow?.querySelector(`[data-message-id="${CSS.escape(c.id)}"]`)?.classList.add("gengage-chat-bubble--hidden");
|
|
6736
6734
|
this._shadow?.querySelectorAll("[data-thread-id]").forEach((c) => {
|
|
6737
|
-
c instanceof HTMLElement && c.dataset.threadId && c.dataset.threadId >
|
|
6735
|
+
c instanceof HTMLElement && c.dataset.threadId && c.dataset.threadId > g && c.classList.add("gengage-chat-bubble--hidden");
|
|
6738
6736
|
});
|
|
6739
6737
|
}
|
|
6740
6738
|
if (this._panel.threads.length > 0 && this._currentThreadId) {
|
|
6741
|
-
const
|
|
6742
|
-
if (
|
|
6743
|
-
const c = [...this._messages].reverse().find((
|
|
6739
|
+
const g = this._panel.threads[this._panel.threads.length - 1];
|
|
6740
|
+
if (g) {
|
|
6741
|
+
const c = [...this._messages].reverse().find((d) => d.role === "assistant" && d.threadId === g);
|
|
6744
6742
|
if (c?.threadId) {
|
|
6745
|
-
const
|
|
6746
|
-
if (
|
|
6747
|
-
const s =
|
|
6743
|
+
const d = await this._loadPayload(c.threadId, c.id);
|
|
6744
|
+
if (d) {
|
|
6745
|
+
const s = d.elements[d.root];
|
|
6748
6746
|
s && this._panel?.updateTopBar(s.type);
|
|
6749
6747
|
}
|
|
6750
6748
|
}
|
|
@@ -6819,18 +6817,18 @@ var Kr = class Ae extends Ea {
|
|
|
6819
6817
|
}
|
|
6820
6818
|
continue;
|
|
6821
6819
|
}
|
|
6822
|
-
const l = o.dataset.sku,
|
|
6823
|
-
|
|
6820
|
+
const l = o.dataset.sku, g = document.createElement("div");
|
|
6821
|
+
g.className = "gengage-chat-comparison-select-wrapper";
|
|
6824
6822
|
const c = this._comparisonSelectedSkus.includes(l);
|
|
6825
|
-
c &&
|
|
6826
|
-
const
|
|
6827
|
-
|
|
6823
|
+
c && g.classList.add("gengage-chat-comparison-select-wrapper--selected");
|
|
6824
|
+
const d = document.createElement("button");
|
|
6825
|
+
d.type = "button", d.className = "gengage-chat-comparison-checkbox", d.dataset.selected = c ? "true" : "false", d.setAttribute("aria-pressed", c ? "true" : "false");
|
|
6828
6826
|
const s = document.createElement("span");
|
|
6829
6827
|
s.className = "gengage-chat-comparison-checkbox-icon", s.innerHTML = c ? '<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M20 6L9 17l-5-5"/></svg>' : '<span class="gengage-chat-comparison-checkbox-dot"></span>';
|
|
6830
6828
|
const p = document.createElement("span");
|
|
6831
|
-
p.className = "gengage-chat-comparison-checkbox-label", p.textContent = c ? this._i18n.comparisonSelectedLabel ?? "Selected" : this._i18n.comparisonSelectLabel ?? "Select to compare",
|
|
6829
|
+
p.className = "gengage-chat-comparison-checkbox-label", p.textContent = c ? this._i18n.comparisonSelectedLabel ?? "Selected" : this._i18n.comparisonSelectLabel ?? "Select to compare", d.appendChild(s), d.appendChild(p), d.addEventListener("click", (h) => {
|
|
6832
6830
|
h.stopPropagation(), this._toggleComparisonSku(l);
|
|
6833
|
-
}), o.parentNode.insertBefore(
|
|
6831
|
+
}), o.parentNode.insertBefore(g, o), g.appendChild(d), g.appendChild(o), g.classList.add("gds-clickable"), g.addEventListener("click", (h) => {
|
|
6834
6832
|
h.target.closest(".gengage-chat-comparison-checkbox") || (h.stopPropagation(), this._toggleComparisonSku(l));
|
|
6835
6833
|
});
|
|
6836
6834
|
}
|
|
@@ -7118,16 +7116,16 @@ var Kr = class Ae extends Ea {
|
|
|
7118
7116
|
const r = this._buildRenderContext(), o = this._shadow?.querySelector(".gengage-chat-messages");
|
|
7119
7117
|
if (!o) return;
|
|
7120
7118
|
if (i === "ProductDetailsPanel") {
|
|
7121
|
-
const
|
|
7122
|
-
if (!
|
|
7119
|
+
const g = n.props?.product;
|
|
7120
|
+
if (!g) return;
|
|
7123
7121
|
const c = {
|
|
7124
7122
|
root: "root",
|
|
7125
7123
|
elements: { root: {
|
|
7126
7124
|
type: "ProductSummaryCard",
|
|
7127
|
-
props: { product:
|
|
7125
|
+
props: { product: g }
|
|
7128
7126
|
} }
|
|
7129
|
-
},
|
|
7130
|
-
e.threadId && (
|
|
7127
|
+
}, d = this._renderUISpec(c, r);
|
|
7128
|
+
e.threadId && (d.dataset.threadId = e.threadId), o.appendChild(d), this._drawer?.refreshPresentationCollapsed();
|
|
7131
7129
|
return;
|
|
7132
7130
|
}
|
|
7133
7131
|
const l = this._renderUISpec(a, r);
|
|
@@ -7152,7 +7150,7 @@ var Kr = class Ae extends Ea {
|
|
|
7152
7150
|
return Zt(di(), this.config.renderer?.registry);
|
|
7153
7151
|
}
|
|
7154
7152
|
_renderUISpec(e, a) {
|
|
7155
|
-
const n = this._resolveUISpecRegistry(), i = this.config.renderer?.unknownRenderer ?? jt, r = (l,
|
|
7153
|
+
const n = this._resolveUISpecRegistry(), i = this.config.renderer?.unknownRenderer ?? jt, r = (l, g) => pi(l, g, n, i), o = this.config.renderer?.renderUISpec;
|
|
7156
7154
|
return o ? o(e, a, {
|
|
7157
7155
|
registry: n,
|
|
7158
7156
|
unknownRenderer: i,
|