@gengage/assistant-fe 0.6.34 → 0.6.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chat-runtime.js +1 -1
- package/dist/chat.iife.js +1 -1
- package/dist/chat.js +1 -1
- package/dist/common/index.d.ts +2 -1
- package/dist/{common-CB1Vjd-T.js → common-C-lXfS-s.js} +1 -1
- package/dist/common.js +68 -67
- package/dist/{connection-warning-DBE8pkFv.js → connection-warning-DrXU9qN9.js} +1 -1
- package/dist/{fastIntent-D9jYpC8V.js → fastIntent-Diz6Vo0W.js} +1 -1
- package/dist/index.js +21 -21
- package/dist/native.iife.js +1 -1
- package/dist/qna-runtime.js +1 -1
- package/dist/qna.iife.js +1 -1
- package/dist/qna.js +1 -1
- package/dist/request-response-cache-DmnzO4Hu.js +1426 -0
- package/dist/{runtime-By-msZ8j.js → runtime-CiO-HX8B.js} +198 -199
- package/dist/{runtime-DyG44pqo.js → runtime-D0v-KyzN.js} +36 -37
- package/dist/{runtime-CABcQc-L.js → runtime-hci1VRsa.js} +8 -9
- package/dist/{simbut-CsQSH5vN.js → simbut-D-IPkTT8.js} +1 -1
- package/dist/simbut.iife.js +1 -1
- package/dist/simbut.js +1 -1
- package/dist/{simrel-bxdmsMmZ.js → simrel-BjMCvCdo.js} +1 -1
- package/dist/simrel-runtime.js +1 -1
- package/dist/simrel.iife.js +1 -1
- package/dist/simrel.js +2 -2
- package/dist/{widget-base-C_RZ-VIr.js → widget-base-_HBDf5VH.js} +1 -1
- package/package.json +3 -19
- package/dist/agent-ui-steps-DIWmTMuV.js +0 -3199
- package/dist/agentic/adaptor/create-adaptor.d.ts +0 -22
- package/dist/agentic/adaptor/fetch-bridge.d.ts +0 -31
- package/dist/agentic/adaptor/mount.d.ts +0 -45
- package/dist/agentic/algos/similarity.d.ts +0 -86
- package/dist/agentic/algos/similarity.js +0 -261
- package/dist/agentic/context/chat-context.d.ts +0 -17
- package/dist/agentic/context/context-store.d.ts +0 -57
- package/dist/agentic/context/persistence.d.ts +0 -14
- package/dist/agentic/contracts/agentic-contracts.d.ts +0 -133
- package/dist/agentic/debug/activity-collector.d.ts +0 -15
- package/dist/agentic/debug/activity-instrumentation.d.ts +0 -22
- package/dist/agentic/debug/activity-overlay.d.ts +0 -3
- package/dist/agentic/debug/activity-state.d.ts +0 -37
- package/dist/agentic/debug/local-dev.d.ts +0 -18
- package/dist/agentic/events/builders.d.ts +0 -10
- package/dist/agentic/events/comparison.d.ts +0 -6
- package/dist/agentic/events/context-products.d.ts +0 -6
- package/dist/agentic/events/error-taxonomy.d.ts +0 -27
- package/dist/agentic/events/product-normalize.d.ts +0 -50
- package/dist/agentic/events/ui-specs.d.ts +0 -41
- package/dist/agentic/flow/create-flow.d.ts +0 -2
- package/dist/agentic/flow/dispatch.d.ts +0 -3
- package/dist/agentic/index.d.ts +0 -65
- package/dist/agentic/index.js +0 -3493
- package/dist/agentic/types.d.ts +0 -360
- package/dist/agentic/util/account-config.d.ts +0 -8
- package/dist/agentic/util/assistant-host.d.ts +0 -11
- package/dist/agentic/util/be-url.d.ts +0 -4
- package/dist/agentic/util/browser-memory.d.ts +0 -13
- package/dist/agentic/util/browser-tools.d.ts +0 -31
- package/dist/agentic/util/cache-key.d.ts +0 -15
- package/dist/agentic/util/common/declarative-cache.d.ts +0 -21
- package/dist/agentic/util/common/fallback-status.d.ts +0 -10
- package/dist/agentic/util/common/flow-steps.d.ts +0 -8
- package/dist/agentic/util/common/gss-tool-aliases.d.ts +0 -66
- package/dist/agentic/util/common/iframe-scraper.d.ts +0 -22
- package/dist/agentic/util/common/llm-routing.d.ts +0 -50
- package/dist/agentic/util/common/object.d.ts +0 -1
- package/dist/agentic/util/common/open-product-page.d.ts +0 -30
- package/dist/agentic/util/common/panel-context.d.ts +0 -3
- package/dist/agentic/util/common/privacy.d.ts +0 -14
- package/dist/agentic/util/common/product-resolver.d.ts +0 -20
- package/dist/agentic/util/common/product-surface.d.ts +0 -24
- package/dist/agentic/util/common/ref-store.d.ts +0 -15
- package/dist/agentic/util/common/retail-privacy.d.ts +0 -4
- package/dist/agentic/util/common/route-params.d.ts +0 -3
- package/dist/agentic/util/common/similarity-ranking.d.ts +0 -2
- package/dist/agentic/util/common/site-awareness.d.ts +0 -130
- package/dist/agentic/util/lazy-runtime-loader.d.ts +0 -10
- package/dist/agentic/util/privacy.d.ts +0 -12
- package/dist/agentic/util/request-text.d.ts +0 -3
- package/dist/agentic/util/time.d.ts +0 -2
- package/dist/agentic/widgets/endpoints.d.ts +0 -12
- package/dist/agentic/worker/agent-ui-steps.d.ts +0 -43
- package/dist/agentic/worker/agent-ui.d.ts +0 -44
- package/dist/agentic/worker/be-client.d.ts +0 -32
- package/dist/agentic/worker/coalesce.d.ts +0 -25
- package/dist/agentic/worker/compaction.d.ts +0 -12
- package/dist/agentic/worker/entry.d.ts +0 -2
- package/dist/agentic/worker/flow-runner.d.ts +0 -24
- package/dist/agentic/worker/jwt-mint.d.ts +0 -21
- package/dist/agentic/worker/pdp-hydrate.d.ts +0 -30
- package/dist/agentic/worker/rpc.d.ts +0 -47
- package/dist/agentic/worker/tool-bridge.d.ts +0 -2
- package/dist/agentic/worker/tool-schema.d.ts +0 -19
- package/dist/agentic/worker.d.ts +0 -52
- package/dist/agentic/worker.js +0 -432
- package/dist/agentic.iife.js +0 -445
- package/dist/api-paths-DZQ4Xx7u.js +0 -1274
- package/dist/request-response-cache-BxRsKGJ0.js +0 -154
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { c as Sa,
|
|
2
|
-
import { A as ke, C as
|
|
3
|
-
import { i as ze, s as Xt, t as
|
|
4
|
-
import { d as pe, f as
|
|
1
|
+
import { c as Zt, f as Sa, g as Ea, i as Pa, l as La, m as Ta, n as Aa, t as Ia } from "./request-response-cache-DmnzO4Hu.js";
|
|
2
|
+
import { A as ke, C as Ma, D as Na, E as Ba, M as ge, N as fe, O as za, S as xt, T as Ra, _ as Ha, a as we, b as Fa, d as Da, f as Ua, g as Oa, h as ja, j as ve, l as $a, m as qa, p as Va, u as Ga, v as Wa, w as tt, x as Ka } from "./context-UTzCGyR9.js";
|
|
3
|
+
import { i as ze, s as Xt, t as Ya } from "./widget-base-_HBDf5VH.js";
|
|
4
|
+
import { d as pe, f as Za, i as Xa, n as Qa, p as Ja, r as en, t as yt, u as tn } from "./fastIntent-Diz6Vo0W.js";
|
|
5
5
|
import { t as Oe } from "./locale-uQ5XZ2yS.js";
|
|
6
|
-
import { t as tn } from "./request-response-cache-BxRsKGJ0.js";
|
|
7
6
|
import { a as Qt, i as Jt, n as be, r as ea, t as ae } from "./price-formatter-CHUmYq8I.js";
|
|
8
7
|
function wt() {
|
|
9
8
|
const t = Date.now(), e = new Uint8Array(16);
|
|
@@ -65,7 +64,7 @@ var on = [
|
|
|
65
64
|
"image/jpeg",
|
|
66
65
|
"image/png",
|
|
67
66
|
"image/webp"
|
|
68
|
-
],
|
|
67
|
+
], qo = 5 * 1024 * 1024;
|
|
69
68
|
function sn(t) {
|
|
70
69
|
return on.includes(t.type) ? t.size > 5242880 ? {
|
|
71
70
|
ok: !1,
|
|
@@ -179,7 +178,7 @@ function _t(t, e) {
|
|
|
179
178
|
};
|
|
180
179
|
}
|
|
181
180
|
function pn(t, e, a) {
|
|
182
|
-
const n = new AbortController(), r = a.injectorAdapter ??
|
|
181
|
+
const n = new AbortController(), r = a.injectorAdapter ?? tn(a.accountId);
|
|
183
182
|
return r ? ((async () => {
|
|
184
183
|
const o = _t(e, n.signal);
|
|
185
184
|
try {
|
|
@@ -207,7 +206,7 @@ function pn(t, e, a) {
|
|
|
207
206
|
body: s,
|
|
208
207
|
signal: n.signal
|
|
209
208
|
};
|
|
210
|
-
const p = c ? await fetch(o, l) : await
|
|
209
|
+
const p = c ? await fetch(o, l) : await Ia(o, l);
|
|
211
210
|
if (!p.ok) {
|
|
212
211
|
let h = p.statusText;
|
|
213
212
|
try {
|
|
@@ -219,9 +218,9 @@ function pn(t, e, a) {
|
|
|
219
218
|
return;
|
|
220
219
|
}
|
|
221
220
|
const d = _t(e);
|
|
222
|
-
await
|
|
221
|
+
await Sa(p, {
|
|
223
222
|
onEvent: (h) => {
|
|
224
|
-
const m =
|
|
223
|
+
const m = Pa(h);
|
|
225
224
|
if (m)
|
|
226
225
|
switch (m.type) {
|
|
227
226
|
case "text_chunk":
|
|
@@ -289,7 +288,7 @@ var gt = "gengage-chat-scroll", Be = null;
|
|
|
289
288
|
function kt(t) {
|
|
290
289
|
Be = t;
|
|
291
290
|
}
|
|
292
|
-
function
|
|
291
|
+
function Vo() {
|
|
293
292
|
if (Be && Be.isConnected) return Be;
|
|
294
293
|
Be = null;
|
|
295
294
|
const t = document.getElementById(gt);
|
|
@@ -1069,7 +1068,7 @@ var Bn = class {
|
|
|
1069
1068
|
S && this._routeAttachmentFile(S);
|
|
1070
1069
|
});
|
|
1071
1070
|
const re = document.createElement("div");
|
|
1072
|
-
re.className = "gengage-chat-input-pill gds-input-shell", re.dataset.gengagePart = "chat-input-shell", re.appendChild(f), re.appendChild(this.inputEl), this._voiceEnabled &&
|
|
1071
|
+
re.className = "gengage-chat-input-pill gds-input-shell", re.dataset.gengagePart = "chat-input-shell", re.appendChild(f), re.appendChild(this.inputEl), this._voiceEnabled && Xa() && (this._micBtn = document.createElement("button"), this._micBtn.className = "gengage-chat-mic-btn gds-btn gds-btn-ghost", this._micBtn.dataset.gengagePart = "chat-mic-button", this._micBtn.type = "button", this._micBtn.setAttribute("aria-label", this.i18n.voiceButton), this._micBtn.innerHTML = '<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z"/><path d="M19 10v2a7 7 0 0 1-14 0v-2"/><line x1="12" y1="19" x2="12" y2="23"/><line x1="8" y1="23" x2="16" y2="23"/></svg>', this._micBtn.addEventListener("click", () => this._toggleVoice()), re.appendChild(this._micBtn), this._voiceInput = new en({
|
|
1073
1072
|
onInterim: (w) => {
|
|
1074
1073
|
this._resizeRafId !== null && (cancelAnimationFrame(this._resizeRafId), this._resizeRafId = null), this.inputEl.value = w, this.inputEl.style.height = "auto", this.inputEl.style.height = `${Math.min(this.inputEl.scrollHeight, 120)}px`;
|
|
1075
1074
|
},
|
|
@@ -3070,7 +3069,7 @@ function Rr() {
|
|
|
3070
3069
|
return { ...la };
|
|
3071
3070
|
}
|
|
3072
3071
|
function Hr(t, e, a = la, n = ga) {
|
|
3073
|
-
return
|
|
3072
|
+
return Ea({
|
|
3074
3073
|
spec: t,
|
|
3075
3074
|
context: e,
|
|
3076
3075
|
registry: a,
|
|
@@ -4367,7 +4366,7 @@ function _i(t) {
|
|
|
4367
4366
|
function mt(t) {
|
|
4368
4367
|
const e = typeof t.props?.source == "string" ? t.props.source : void 0, a = (Array.isArray(t.props?.styleVariations) ? t.props.styleVariations : []).filter((n) => typeof n.style_label == "string" && n.style_label.trim().length > 0);
|
|
4369
4368
|
return {
|
|
4370
|
-
isConsulting:
|
|
4369
|
+
isConsulting: La(e) && a.length > 0,
|
|
4371
4370
|
source: e,
|
|
4372
4371
|
styleVariations: a
|
|
4373
4372
|
};
|
|
@@ -5956,7 +5955,7 @@ var vo = class {
|
|
|
5956
5955
|
});
|
|
5957
5956
|
}
|
|
5958
5957
|
async saveAndOpenURL(t, e, a, n = (r) => {
|
|
5959
|
-
|
|
5958
|
+
Ja(r);
|
|
5960
5959
|
}) {
|
|
5961
5960
|
try {
|
|
5962
5961
|
await e();
|
|
@@ -6183,7 +6182,7 @@ function ct(t) {
|
|
|
6183
6182
|
function lt(t) {
|
|
6184
6183
|
return t?.type === "ProductGrid" && t.props?.similarsAppend === !0;
|
|
6185
6184
|
}
|
|
6186
|
-
var Ho = class Me extends
|
|
6185
|
+
var Ho = class Me extends Ya {
|
|
6187
6186
|
constructor(...e) {
|
|
6188
6187
|
super(...e), this._shadow = null, this._rootEl = null, this._backdropEl = null, this._launcher = null, this._floatingLauncher = null, this._inlineLauncher = null, this._drawer = null, this._bridge = null, this._drawerVisible = !1, this._pillLauncherApply = null, this._hostScrollLockActive = !1, this._hostOverflowRestore = null, this._hostScrollLockViewport = null, this._hostScrollPinning = !1, this._preventHostDocumentTouchMove = (a) => {
|
|
6189
6188
|
this._hostScrollLockActive && (this._hostScrollEventShouldReachChatScroller(a) || a.preventDefault());
|
|
@@ -6215,7 +6214,7 @@ var Ho = class Me extends Ka {
|
|
|
6215
6214
|
}
|
|
6216
6215
|
async onInit(e) {
|
|
6217
6216
|
if (this._i18n = this._resolveI18n(e), this._chatCreatedAt = (/* @__PURE__ */ new Date()).toISOString(), e.pillLauncher) {
|
|
6218
|
-
const u =
|
|
6217
|
+
const u = Qa(e.pillLauncher);
|
|
6219
6218
|
e.launcherImageUrl = u.launcherImageUrl, e.headerAvatarUrl === void 0 && (e.headerAvatarUrl = e.pillLauncher.avatarUrl), this._pillLauncherApply = () => u.apply(this._shadow ?? void 0);
|
|
6220
6219
|
}
|
|
6221
6220
|
this._shadow = this.root.attachShadow({ mode: "open" });
|
|
@@ -6286,7 +6285,7 @@ var Ho = class Me extends Ka {
|
|
|
6286
6285
|
e.headerCartUrl ? this._saveSessionAndOpenURL(e.headerCartUrl) : e.onCartClick?.();
|
|
6287
6286
|
} } : {},
|
|
6288
6287
|
onFavoritesClick: () => {
|
|
6289
|
-
if (
|
|
6288
|
+
if (Fa(), typeof e.onFavoritesClick == "function") {
|
|
6290
6289
|
e.onFavoritesClick();
|
|
6291
6290
|
return;
|
|
6292
6291
|
}
|
|
@@ -6377,7 +6376,7 @@ var Ho = class Me extends Ka {
|
|
|
6377
6376
|
};
|
|
6378
6377
|
e.allowedOrigins !== void 0 && (v.allowedOrigins = e.allowedOrigins), this._bridge = new an(v), this._lastSku = this.config.pageContext?.sku, this._lastPageType = this.config.pageContext?.pageType, this._lastSkuListKey = this.config.pageContext?.skuList?.slice(0, 48).join(","), this._initComplete = !0;
|
|
6379
6378
|
for (const u of this._pendingActions) this._sendAction(u.action, u.options);
|
|
6380
|
-
this._pendingActions = [], this._pillLauncherApply && o === "floating" && (await this._pillLauncherApply(), this._pillLauncherApply = null), we("gengage:chat:ready", {}),
|
|
6379
|
+
this._pendingActions = [], this._pillLauncherApply && o === "floating" && (await this._pillLauncherApply(), this._pillLauncherApply = null), we("gengage:chat:ready", {}), Wa("chat"), e.onReady?.();
|
|
6381
6380
|
}
|
|
6382
6381
|
onUpdate(e) {
|
|
6383
6382
|
if (this.config.pageContext && e.pageType !== void 0) {
|
|
@@ -6395,7 +6394,7 @@ var Ho = class Me extends Ka {
|
|
|
6395
6394
|
a && (this._resetForNewPage(), this._drawerVisible && this.config.pageContext?.pageType === "pdp" && this.config.pageContext?.sku && this._primeOpenPageContext());
|
|
6396
6395
|
}
|
|
6397
6396
|
onShow() {
|
|
6398
|
-
this._inlineLauncher?.setActive(!0), this._showDrawer(), this.emit("open"), we("gengage:chat:open", { state: this._openState }),
|
|
6397
|
+
this._inlineLauncher?.setActive(!0), this._showDrawer(), this.emit("open"), we("gengage:chat:open", { state: this._openState }), Ba("chat"), this.config.onOpen?.(), this._primeOpenPageContext();
|
|
6399
6398
|
}
|
|
6400
6399
|
_primeOpenPageContext() {
|
|
6401
6400
|
this._showWelcomeIfNeeded(), this._maybePrimeEntryContextOpening(), !this._pdpLaunched && this.config.pageContext?.pageType === "pdp" && this.config.pageContext?.sku && (this._pdpLaunched = !0, this._contextPrimingInFlight = !0, this._sendAction({
|
|
@@ -6881,7 +6880,7 @@ var Ho = class Me extends Ka {
|
|
|
6881
6880
|
}
|
|
6882
6881
|
_maybeTrackChatbotMainPaneGa() {
|
|
6883
6882
|
const e = this._mainPaneExpandedForAnalytics();
|
|
6884
|
-
e && !this._gaPrevMainPaneExpanded &&
|
|
6883
|
+
e && !this._gaPrevMainPaneExpanded && Ga(), this._gaPrevMainPaneExpanded = e;
|
|
6885
6884
|
}
|
|
6886
6885
|
_syncHostDocumentScrollLock() {
|
|
6887
6886
|
if (!(typeof document > "u")) {
|
|
@@ -6966,7 +6965,7 @@ var Ho = class Me extends Ka {
|
|
|
6966
6965
|
}
|
|
6967
6966
|
if (this._maybeHandleDirectAddToCartCommand(e)) return;
|
|
6968
6967
|
}
|
|
6969
|
-
this._contextPrimingInFlight && (this._abortAllActiveRequests(), this._contextPrimingInFlight = !1, this._queuedUserMessages = []), this._ensureMobileFullSheetForPanel(),
|
|
6968
|
+
this._contextPrimingInFlight && (this._abortAllActiveRequests(), this._contextPrimingInFlight = !1, this._queuedUserMessages = []), this._ensureMobileFullSheetForPanel(), Ma(), this._messages.some((r) => r.role === "user") || Oa(), ze("chat", "sendMessage", {
|
|
6970
6969
|
mode: this._assistantMode,
|
|
6971
6970
|
hasAttachment: a !== void 0,
|
|
6972
6971
|
textLength: e.length
|
|
@@ -7219,11 +7218,11 @@ var Ho = class Me extends Ka {
|
|
|
7219
7218
|
const re = U === "ProductDetailsPanel" && L !== "panel" ? "panel" : L, ie = this._buildRenderContext();
|
|
7220
7219
|
if (ie.isStreaming = !0, U === "ComparisonTable") {
|
|
7221
7220
|
const z = I?.props?.products;
|
|
7222
|
-
|
|
7221
|
+
qa(Array.isArray(z) ? z.length : 0);
|
|
7223
7222
|
}
|
|
7224
7223
|
if (U === "ProductGrid") {
|
|
7225
7224
|
const z = I?.children?.length ?? 0;
|
|
7226
|
-
|
|
7225
|
+
Ra(void 0, z);
|
|
7227
7226
|
}
|
|
7228
7227
|
const ce = re === "panel" && this._panel ? this._panel.toPanelSpec(f) : f;
|
|
7229
7228
|
if (re === "panel" && this._panel && !te && U === "ProductGrid" && I) {
|
|
@@ -7338,7 +7337,7 @@ var Ho = class Me extends Ka {
|
|
|
7338
7337
|
onAction: (f) => {
|
|
7339
7338
|
if (!(!o && i !== this._activeRequestThreadId) && f.type === "action") {
|
|
7340
7339
|
const P = {};
|
|
7341
|
-
this.config.actionHandling?.unknownActionPolicy !== void 0 && (P.unknownActionPolicy = this.config.actionHandling.unknownActionPolicy), this.config.actionHandling?.allowScriptCall !== void 0 && (P.allowScriptCall = this.config.actionHandling.allowScriptCall),
|
|
7340
|
+
this.config.actionHandling?.unknownActionPolicy !== void 0 && (P.unknownActionPolicy = this.config.actionHandling.unknownActionPolicy), this.config.actionHandling?.allowScriptCall !== void 0 && (P.allowScriptCall = this.config.actionHandling.allowScriptCall), Za(f, {
|
|
7342
7341
|
openChat: () => this.open(),
|
|
7343
7342
|
navigate: (L) => {
|
|
7344
7343
|
ve(L.url) && (this._bridge?.send("navigate", L), L.newTab ? window.open(L.url, "_blank", "noopener,noreferrer") : window.location.href = L.url);
|
|
@@ -7370,7 +7369,7 @@ var Ho = class Me extends Ka {
|
|
|
7370
7369
|
bubbles: !1,
|
|
7371
7370
|
cancelable: !0
|
|
7372
7371
|
}), L = window.dispatchEvent(P);
|
|
7373
|
-
if (
|
|
7372
|
+
if (za(), L) {
|
|
7374
7373
|
const q = f.meta.voice;
|
|
7375
7374
|
q.audio_base64 && (this._activeTtsHandle?.stop(), this._activeTtsHandle = Di(q.audio_base64, q.content_type ?? "audio/ogg"));
|
|
7376
7375
|
}
|
|
@@ -8021,7 +8020,7 @@ var Ho = class Me extends Ka {
|
|
|
8021
8020
|
}
|
|
8022
8021
|
_toggleComparisonSku(e) {
|
|
8023
8022
|
if (e === "")
|
|
8024
|
-
this._comparisonSelectMode = !this._comparisonSelectMode, this._comparisonSelectionWarning = null, this._comparisonSelectMode && (Qi(this._currentThreadId ?? ""), this._clearChoicePrompter()), this._comparisonSelectMode || (this._comparisonSelectedSkus = [], this._comparisonSelectionWarning = null,
|
|
8023
|
+
this._comparisonSelectMode = !this._comparisonSelectMode, this._comparisonSelectionWarning = null, this._comparisonSelectMode && (Qi(this._currentThreadId ?? ""), this._clearChoicePrompter()), this._comparisonSelectMode || (this._comparisonSelectedSkus = [], this._comparisonSelectionWarning = null, Da());
|
|
8025
8024
|
else if (this._comparisonSelectedSkus.indexOf(e) >= 0)
|
|
8026
8025
|
this._comparisonSelectedSkus = this._comparisonSelectedSkus.filter((a) => a !== e), this._comparisonSelectionWarning = null;
|
|
8027
8026
|
else {
|
|
@@ -8031,7 +8030,7 @@ var Ho = class Me extends Ka {
|
|
|
8031
8030
|
});
|
|
8032
8031
|
return;
|
|
8033
8032
|
}
|
|
8034
|
-
this._comparisonSelectedSkus = [...this._comparisonSelectedSkus, e], this._comparisonSelectionWarning = null,
|
|
8033
|
+
this._comparisonSelectedSkus = [...this._comparisonSelectedSkus, e], this._comparisonSelectionWarning = null, Ua(e);
|
|
8035
8034
|
}
|
|
8036
8035
|
this._comparisonRefreshRafId !== null && cancelAnimationFrame(this._comparisonRefreshRafId), this._comparisonRefreshRafId = requestAnimationFrame(() => {
|
|
8037
8036
|
this._comparisonRefreshRafId = null, this._refreshComparisonUI();
|
|
@@ -8167,7 +8166,7 @@ var Ho = class Me extends Ka {
|
|
|
8167
8166
|
return;
|
|
8168
8167
|
}
|
|
8169
8168
|
if (!await this._runEventCallbacks("gengage-cart-add", n)) return;
|
|
8170
|
-
|
|
8169
|
+
$a(e.sku, e.quantity), we("gengage:chat:add-to-cart", n), this._bridge?.send("addToCart", e), this._sendAction({
|
|
8171
8170
|
title: this._i18n.addToCartButton ?? "Add to Cart",
|
|
8172
8171
|
type: "addToCart",
|
|
8173
8172
|
payload: {
|
|
@@ -8190,7 +8189,7 @@ var Ho = class Me extends Ka {
|
|
|
8190
8189
|
this._restorePanelFromFrontendMessage(a.payload);
|
|
8191
8190
|
return;
|
|
8192
8191
|
}
|
|
8193
|
-
if (
|
|
8192
|
+
if (Na(a.title, a.type), a.type === "addToCart") {
|
|
8194
8193
|
const r = this._parseAddToCartActionPayload(a.payload);
|
|
8195
8194
|
if (r) {
|
|
8196
8195
|
this._runChatAddToCartFlow(r);
|
|
@@ -8204,12 +8203,12 @@ var Ho = class Me extends Ka {
|
|
|
8204
8203
|
}
|
|
8205
8204
|
if (a.type === "findSimilar") {
|
|
8206
8205
|
const r = typeof a.payload == "object" && a.payload !== null && "sku" in a.payload ? String(a.payload.sku) : "";
|
|
8207
|
-
|
|
8206
|
+
Ha(r);
|
|
8208
8207
|
}
|
|
8209
8208
|
if (a.type === "getComparisonTable") {
|
|
8210
8209
|
const r = a.payload, i = r && typeof r == "object" ? r : null, o = i && typeof i.gengage_analytics_source == "string" ? i.gengage_analytics_source : "";
|
|
8211
8210
|
let s = [];
|
|
8212
|
-
i && Array.isArray(i.sku_list) && (s = i.sku_list.filter((c) => typeof c == "string")), o === "floating_compare_dock" ?
|
|
8211
|
+
i && Array.isArray(i.sku_list) && (s = i.sku_list.filter((c) => typeof c == "string")), o === "floating_compare_dock" ? Va(s) : ja(s.length > 0 ? s : this._comparisonSelectedSkus);
|
|
8213
8212
|
}
|
|
8214
8213
|
const n = a.type === "addToCart" || a.type === "like";
|
|
8215
8214
|
this._sendAction(a, n ? { preservePanel: !0 } : void 0);
|
|
@@ -8346,7 +8345,7 @@ var Ho = class Me extends Ka {
|
|
|
8346
8345
|
return;
|
|
8347
8346
|
}
|
|
8348
8347
|
if (await this._toggleFavorite(e, a), n) {
|
|
8349
|
-
|
|
8348
|
+
Ka(e);
|
|
8350
8349
|
const o = a.name ?? e;
|
|
8351
8350
|
this._sendAction({
|
|
8352
8351
|
title: o,
|
|
@@ -8555,7 +8554,7 @@ var Ho = class Me extends Ka {
|
|
|
8555
8554
|
};
|
|
8556
8555
|
}
|
|
8557
8556
|
_resolveUISpecRegistry() {
|
|
8558
|
-
return
|
|
8557
|
+
return Ta(Rr(), this.config.renderer?.registry);
|
|
8559
8558
|
}
|
|
8560
8559
|
_renderUISpec(e, a) {
|
|
8561
8560
|
const n = e.elements[e.root];
|
|
@@ -8571,17 +8570,17 @@ var Ho = class Me extends Ka {
|
|
|
8571
8570
|
}) : o(e, a);
|
|
8572
8571
|
}
|
|
8573
8572
|
};
|
|
8574
|
-
function
|
|
8573
|
+
function Go() {
|
|
8575
8574
|
return new Ho();
|
|
8576
8575
|
}
|
|
8577
8576
|
export {
|
|
8578
8577
|
Hi as a,
|
|
8579
8578
|
ga as c,
|
|
8580
|
-
|
|
8579
|
+
Vo as d,
|
|
8581
8580
|
bn as f,
|
|
8582
8581
|
xo as i,
|
|
8583
8582
|
Hr as l,
|
|
8584
|
-
|
|
8583
|
+
Go as n,
|
|
8585
8584
|
Ai as o,
|
|
8586
8585
|
lt as r,
|
|
8587
8586
|
Rr as s,
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { a as j,
|
|
1
|
+
import { a as j, f as L, g as F, i as I, m as q, n as N, o as z, t as R } from "./request-response-cache-DmnzO4Hu.js";
|
|
2
2
|
import { A as D, E as S, N as H, a as k, l as $, v as W } from "./context-UTzCGyR9.js";
|
|
3
|
-
import { o as J, t as K } from "./widget-base-
|
|
3
|
+
import { o as J, t as K } from "./widget-base-_HBDf5VH.js";
|
|
4
4
|
import { t as Q } from "./locale-uQ5XZ2yS.js";
|
|
5
|
-
import { t as R } from "./request-response-cache-BxRsKGJ0.js";
|
|
6
5
|
import { a as V, n as Y, r as X, t as A } from "./price-formatter-CHUmYq8I.js";
|
|
7
|
-
import { n as Z } from "./connection-warning-
|
|
6
|
+
import { n as Z } from "./connection-warning-DrXU9qN9.js";
|
|
8
7
|
function M(e) {
|
|
9
8
|
const t = [];
|
|
10
9
|
for (const n of Object.values(e)) if (n.type === "ProductCard" && n.props) {
|
|
@@ -37,7 +36,7 @@ async function te(e, t, n) {
|
|
|
37
36
|
const a = await i.text();
|
|
38
37
|
if (!a) throw new Error("Empty response body from similar_products endpoint");
|
|
39
38
|
try {
|
|
40
|
-
return
|
|
39
|
+
return z(JSON.parse(a));
|
|
41
40
|
} catch {
|
|
42
41
|
throw new Error("Invalid JSON from similar_products endpoint");
|
|
43
42
|
}
|
|
@@ -77,7 +76,7 @@ async function re(e, t, n) {
|
|
|
77
76
|
const a = await i.text();
|
|
78
77
|
if (!a) return [];
|
|
79
78
|
try {
|
|
80
|
-
return
|
|
79
|
+
return j(JSON.parse(a));
|
|
81
80
|
} catch {
|
|
82
81
|
throw new Error("Invalid JSON from product_groupings endpoint");
|
|
83
82
|
}
|
|
@@ -597,7 +596,7 @@ var me = class extends K {
|
|
|
597
596
|
};
|
|
598
597
|
}
|
|
599
598
|
_resolveUISpecRegistry() {
|
|
600
|
-
return
|
|
599
|
+
return q(ae(), this.config.renderer?.registry);
|
|
601
600
|
}
|
|
602
601
|
_buildRenderContext() {
|
|
603
602
|
const e = this.config.renderCard, t = {
|
|
@@ -659,13 +658,13 @@ var me = class extends K {
|
|
|
659
658
|
};
|
|
660
659
|
}
|
|
661
660
|
};
|
|
662
|
-
function
|
|
661
|
+
function Ee() {
|
|
663
662
|
return new me();
|
|
664
663
|
}
|
|
665
664
|
export {
|
|
666
665
|
ce as a,
|
|
667
666
|
B as i,
|
|
668
|
-
|
|
667
|
+
Ee as n,
|
|
669
668
|
se as o,
|
|
670
669
|
ae as r,
|
|
671
670
|
me as t
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { A as m, D as h, _ as u, j as f, v as p } from "./context-UTzCGyR9.js";
|
|
2
|
-
import { t as b } from "./widget-base-
|
|
2
|
+
import { t as b } from "./widget-base-_HBDf5VH.js";
|
|
3
3
|
import { t as y } from "./locale-uQ5XZ2yS.js";
|
|
4
4
|
var g = { findSimilarLabel: "Benzerlerini Bul" }, _ = { findSimilarLabel: "Find Similar" };
|
|
5
5
|
function S(t, n) {
|
package/dist/simbut.iife.js
CHANGED
|
@@ -44,4 +44,4 @@
|
|
|
44
44
|
transform: translateY(0);
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
`,document.head.appendChild(e)}var f=null;function Y(){if(f!==null)return f;try{f=localStorage.getItem("gengage:debug")==="1"}catch{f=!1}return f}function S(e,t,i){if(!Y())return;const n=[`[gengage:${e}]`,t];i!==void 0&&n.push(i),console.debug(...n)}var j=("0.6.
|
|
47
|
+
`,document.head.appendChild(e)}var f=null;function Y(){if(f!==null)return f;try{f=localStorage.getItem("gengage:debug")==="1"}catch{f=!1}return f}function S(e,t,i){if(!Y())return;const n=[`[gengage:${e}]`,t];i!==void 0&&n.push(i),console.debug(...n)}var j=("0.6.35".trim(),"0.6.35".trim()),J=("iife-build".trim(),"iife-build".trim());function K(){if(typeof window>"u")return;const e=window;e.__gengageSdkRuntimeInfoLogged||(e.__gengageSdkRuntimeInfoLogged=!0,console.info(`[gengage] @gengage/assistant-fe v${j} (${J})`))}var Q=class{constructor(){this.isVisible=!1,this.isInitialised=!1,this._handlers=new Map,this._cleanups=[],this._ownsRoot=!1,this._destroying=!1}async init(e){if(this.isInitialised){console.warn("[gengage] Widget already initialised. Call update() instead.");return}const t=U(e.theme);K(),this.config={...e,theme:t,session:N(e.session)},this.root=this._resolveMount(e.mountTarget),this._applyTheme(t),O();const i=x("gengage:context:update",n=>this.update(n));this._cleanups.push(i),S("lifecycle",`${this.constructor.name}.init`,{accountId:e.accountId,sku:e.pageContext?.sku});try{await this.onInit(this.config)}catch(n){throw this.destroy(),n}this._destroying||(this.isInitialised=!0,S("lifecycle",`${this.constructor.name} ready`),this.emit("ready"))}update(e){this.isInitialised&&(this.config.pageContext?this.config={...this.config,pageContext:{...this.config.pageContext,...e}}:e.pageType!==void 0&&(this.config={...this.config,pageContext:e}),this.onUpdate(e),this.emit("context-update",this.config.pageContext))}show(){this.isVisible||(this.isVisible=!0,this.root.style.display="",this.onShow(),this.emit("show"))}hide(){this.isVisible&&(this.isVisible=!1,this.root.style.display="none",this.onHide(),this.emit("hide"))}destroy(){this._destroying||(this._destroying=!0,this.emit("destroy"),this._cleanups.forEach(e=>e()),this._cleanups.length=0,this._handlers.clear(),this.onDestroy(),this._cleanupRoot(),this.isInitialised=!1)}_cleanupRoot(){this._ownsRoot?this.root.remove():this.root.innerHTML=""}on(e,t){return this._handlers.has(e)||this._handlers.set(e,new Set),this._handlers.get(e).add(t),()=>this._handlers.get(e)?.delete(t)}emit(e,...t){this._handlers.get(e)?.forEach(i=>i(...t))}addCleanup(e){this._cleanups.push(e)}_resolveMount(e){if(e instanceof HTMLElement)return e;if(typeof e=="string"){const i=document.querySelector(e);if(!i)throw new Error(`[gengage] Mount target not found: "${e}"`);return i}const t=document.createElement("div");return t.dataset.gengageWidget=this.constructor.name.toLowerCase(),document.body.insertBefore(t,document.body.firstChild),this._ownsRoot=!0,t}_applyTheme(e){if(e){for(const[t,i]of Object.entries(e))if(i!==void 0){const n=t.startsWith("--")?t:`--gengage-${X(t)}`;this.root.style.setProperty(n,i)}}}};function X(e){return e.replace(/([A-Z])/g,"-$1").toLowerCase()}function Z(e){const t=e?.trim();return t||"tr"}var C={findSimilarLabel:"Benzerlerini Bul"},ee={findSimilarLabel:"Find Similar"};function te(e,t){return t?.findSimilarLabel?t.findSimilarLabel:(e??"tr").toLowerCase().startsWith("en")?ee.findSimilarLabel:C.findSimilarLabel}function h(e){const t=typeof e.sku=="string"&&e.sku.length>0?e.sku:void 0,i=typeof e.pageContext?.sku=="string"&&e.pageContext.sku.length>0?e.pageContext.sku:void 0;return t??i}var E=class extends Q{constructor(...e){super(...e),this._button=null,this._inlineFrame=null,this._label=C.findSimilarLabel}async onInit(e){this._label=te(e.locale,e.i18n);const t=e.layout??"overlay";this.root.classList.add("gengage-simbut-root"),this.root.classList.toggle("gengage-simbut-root--overlay",t==="overlay"),this.root.classList.toggle("gengage-simbut-root--inline-card",t==="inline-card"),t==="overlay"&&window.getComputedStyle(this.root).position==="static"&&(this.root.style.position="relative");const i=document.createElement("button");i.type="button",i.className="gengage-chat-find-similar-pill",i.lang=Z(e.locale),i.textContent=this._label,this._button=i;const n=()=>{i.disabled=!(h(this.config)&&(this.config.onFindSimilar||this.config.chat))};if(i.addEventListener("click",r=>{r.stopPropagation();const s=h(this.config);if(!s)return;const o=this.config.imageUrl,g=typeof o=="string"&&L(o)?o:void 0;if(F(this._label,"findSimilar"),R(s),this.config.onFindSimilar){this.config.onFindSimilar(g?{sku:s,imageUrl:g}:{sku:s});return}const u=this.config.chat;if(!u)return;const a={title:this._label,type:"findSimilar",payload:{sku:s}};u.openWithAction(a,{sku:s})}),t==="inline-card"){const r=this._createInlineCard(e,i);this._inlineFrame=r,this.root.appendChild(r)}else this.root.appendChild(i);n(),k("simbut")}_createInlineCard(e,t){const i=e.inlineCard,n=typeof i?.title=="string"?i.title.trim():"",r=typeof i?.description=="string"?i.description.trim():"",s=typeof i?.imageUrl=="string"?i.imageUrl.trim():"",o=document.createElement("section");o.className="gengage-simbut-inline-card",o.dataset.gengagePart="simbut-inline-card";const g=document.createElement("div");if(g.className="gengage-simbut-inline-copy",g.dataset.gengagePart="simbut-inline-copy",n){const a=document.createElement("h4");a.className="gengage-simbut-inline-title",a.dataset.gengagePart="simbut-inline-title",a.textContent=n,g.appendChild(a)}if(r){const a=document.createElement("p");a.className="gengage-simbut-inline-description",a.dataset.gengagePart="simbut-inline-description",a.textContent=r,g.appendChild(a)}g.children.length>0&&o.appendChild(g);const u=document.createElement("div");if(u.className="gengage-simbut-inline-action",u.dataset.gengagePart="simbut-inline-action",u.appendChild(t),o.appendChild(u),s&&I(s)){const a=document.createElement("img");a.className="gengage-simbut-inline-image",a.dataset.gengagePart="simbut-inline-image",a.src=s,a.alt=typeof i?.imageAlt=="string"?i.imageAlt:"",a.loading="lazy",a.addEventListener("error",()=>{a.style.display="none"},{once:!0}),o.appendChild(a)}return o}onUpdate(e){if(!this._button)return;const t=!!h(this.config)&&(!!this.config.onFindSimilar||!!this.config.chat);this._button.disabled=!t}hide(){this.isVisible&&(this.isVisible=!1,this._inlineFrame&&(this._inlineFrame.style.display="none"),this._button&&(this._button.style.display="none"),this.onHide(),this.emit("hide"))}show(){this.isVisible||(this.isVisible=!0,this._inlineFrame&&(this._inlineFrame.style.display=""),this._button&&(this._button.style.display=""),this.onShow(),this.emit("show"))}_cleanupRoot(){}onShow(){}onHide(){}onDestroy(){this._inlineFrame?.remove(),this._inlineFrame=null,this._button?.remove(),this._button=null}setChat(e){if(this.config.chat=e,this._button){const t=!!h(this.config)&&(!!this.config.onFindSimilar||!!this.config.chat);this._button.disabled=!t}}};function ie(){return new E}m.GengageSimBut=E,m.createSimButWidget=ie})(this.Gengage=this.Gengage||{});
|
package/dist/simbut.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { A, j as S } from "./context-UTzCGyR9.js";
|
|
2
2
|
import { n as $, t as L } from "./price-formatter-CHUmYq8I.js";
|
|
3
3
|
import { a as C, c as f, n as q, o as h, t as k, u as H } from "./schemas-BnYUhYSy.js";
|
|
4
|
-
import { o as j } from "./runtime-
|
|
4
|
+
import { o as j } from "./runtime-hci1VRsa.js";
|
|
5
5
|
var V = {
|
|
6
6
|
images: [
|
|
7
7
|
"images",
|
package/dist/simrel-runtime.js
CHANGED