@gengage/assistant-fe 0.3.27 → 0.3.28
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/index.d.ts +9 -3
- package/dist/{chat-CWnNdto9.js → chat-DaFZJmwK.js} +1882 -1840
- package/dist/chat.iife.js +22 -22
- package/dist/chat.js +1 -1
- package/dist/common/types.d.ts +2 -0
- package/dist/{common-DKSCFuWo.js → common-CYirxrL9.js} +1 -1
- package/dist/common.js +3 -3
- package/dist/index.js +3 -3
- package/dist/{native-webview-CaasrbNn.js → native-webview-CO5A74dl.js} +70 -70
- package/dist/native.iife.js +34 -34
- package/dist/native.js +1 -1
- package/package.json +1 -1
package/dist/chat.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as e, c as t, d as r, f as s, n, o as C, p as c, r as h, s as l, t as o } from "./chat-
|
|
1
|
+
import { a as e, c as t, d as r, f as s, n, o as C, p as c, r as h, s as l, t as o } from "./chat-DaFZJmwK.js";
|
|
2
2
|
export {
|
|
3
3
|
r as CHAT_SCROLL_ELEMENT_ID,
|
|
4
4
|
e as ChatPresentationState,
|
package/dist/common/types.d.ts
CHANGED
|
@@ -18,6 +18,8 @@ export interface PageContext {
|
|
|
18
18
|
pageType: 'pdp' | 'plp' | 'home' | 'cart' | 'search' | 'other';
|
|
19
19
|
/** Product SKU — required on PDP pages for QNA and Similar Products. */
|
|
20
20
|
sku?: string;
|
|
21
|
+
/** Product SKU list — for PLP pages, used with the launchProductList init action. */
|
|
22
|
+
skuList?: string[];
|
|
21
23
|
/** Product price, formatted as a string (e.g. "149.99"). */
|
|
22
24
|
price?: string;
|
|
23
25
|
/** Category path array, from broad to specific (e.g. ["Electronics", "TVs"]). */
|
package/dist/common.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { C as a, S as t, b as s, d as r, f as n, g as i, h as o, m as c, p as m, v as l, w as g, x as d, y as u } from "./schemas-DJ1qbfi8.js";
|
|
2
2
|
import { $ as E, A as S, D as h, E as v, F as y, G as C, H as f, I as A, J as T, K as w, L as U, M as W, N as I, O as P, P as D, Q as k, S as R, T as b, U as G, V as O, W as N, X as x, Y as L, Z as M, et as _, j as H, k as z, q as B, v as F, w as K, x as V, y as Q } from "./ga-datalayer-BwxWX-cr.js";
|
|
3
|
-
import { i as Z, l as j, m as J, u as X } from "./chat-
|
|
3
|
+
import { i as Z, l as j, m as J, u as X } from "./chat-DaFZJmwK.js";
|
|
4
4
|
import { n as $, t as ee } from "./connection-warning-CHHi3BAf.js";
|
|
5
|
-
import { a as te, c as se, d as re, f as ne, h as ie, i as oe, l as ce, m as me, n as le, o as ge, p as de, r as ue, s as pe, u as Ee } from "./native-webview-
|
|
6
|
-
import { a as he, c as ve, d as ye, f as Ce, i as fe, l as Ae, n as Te, o as we, p as Ue, r as We, s as Ie, t as Pe, u as De } from "./common-
|
|
5
|
+
import { a as te, c as se, d as re, f as ne, h as ie, i as oe, l as ce, m as me, n as le, o as ge, p as de, r as ue, s as pe, u as Ee } from "./native-webview-CO5A74dl.js";
|
|
6
|
+
import { a as he, c as ve, d as ye, f as Ce, i as fe, l as Ae, n as Te, o as we, p as Ue, r as We, s as Ie, t as Pe, u as De } from "./common-CYirxrL9.js";
|
|
7
7
|
export {
|
|
8
8
|
Ee as AccountRuntimeConfigSchema,
|
|
9
9
|
re as AnalyticsAuthModeSchema,
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { C as a, b as t, d as s, f as i, w as n, x as r } from "./schemas-DJ1qbfi8.js";
|
|
2
2
|
import { A as c, D as m, E as l, F as d, I as g, L as p, N as u, O as S, P as f, k as C, v as U } from "./ga-datalayer-BwxWX-cr.js";
|
|
3
|
-
import { c as A, i as I, l as y, m as R, n as D, o as E, s as T, t as W, u as w } from "./chat-
|
|
3
|
+
import { c as A, i as I, l as y, m as R, n as D, o as E, s as T, t as W, u as w } from "./chat-DaFZJmwK.js";
|
|
4
4
|
import { t as N } from "./connection-warning-CHHi3BAf.js";
|
|
5
5
|
import { a as P, i as k, n as G, o as L, t as Q } from "./qna-D33BNaWd.js";
|
|
6
6
|
import { a as b, i as x, n as B, o as F, t as M } from "./simrel-DstZ5m2H.js";
|
|
7
7
|
import { n as H, t as K } from "./simbut-BBXTlzOg.js";
|
|
8
|
-
import { a as Z, c as j, d as q, f as J, h as X, i as Y, l as $, m as ee, n as ae, o as te, p as se, r as ie, s as ne, u as re } from "./native-webview-
|
|
9
|
-
import { a as ce, c as me, d as le, i as de, l as ge, n as pe, o as ue, p as Se, r as fe, s as Ce, t as Ue, u as he } from "./common-
|
|
8
|
+
import { a as Z, c as j, d as q, f as J, h as X, i as Y, l as $, m as ee, n as ae, o as te, p as se, r as ie, s as ne, u as re } from "./native-webview-CO5A74dl.js";
|
|
9
|
+
import { a as ce, c as me, d as le, i as de, l as ge, n as pe, o as ue, p as Se, r as fe, s as Ce, t as Ue, u as he } from "./common-CYirxrL9.js";
|
|
10
10
|
export {
|
|
11
11
|
re as AccountRuntimeConfigSchema,
|
|
12
12
|
q as AnalyticsAuthModeSchema,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import { I as H, M as Q, b as
|
|
3
|
-
import { t as V } from "./chat-
|
|
1
|
+
import { a as k, c as h, i as D, o as f, r as m, t as A } from "./schemas-DJ1qbfi8.js";
|
|
2
|
+
import { I as H, M as Q, b as M, z as K } from "./ga-datalayer-BwxWX-cr.js";
|
|
3
|
+
import { t as V } from "./chat-DaFZJmwK.js";
|
|
4
4
|
import { t as j } from "./qna-D33BNaWd.js";
|
|
5
5
|
import { t as $ } from "./simrel-DstZ5m2H.js";
|
|
6
6
|
import { t as G } from "./simbut-BBXTlzOg.js";
|
|
@@ -9,7 +9,7 @@ var b = f({ enabled: m().default(!0) }), Y = f({
|
|
|
9
9
|
qna: h().optional(),
|
|
10
10
|
simrel: h().optional(),
|
|
11
11
|
simbut: h().optional()
|
|
12
|
-
}), J = f({}), X =
|
|
12
|
+
}), J = f({}), X = A([
|
|
13
13
|
"none",
|
|
14
14
|
"x-api-key-header",
|
|
15
15
|
"bearer-header",
|
|
@@ -29,19 +29,19 @@ var b = f({ enabled: m().default(!0) }), Y = f({
|
|
|
29
29
|
fireAndForget: m().default(!0),
|
|
30
30
|
useBeacon: m().default(!0),
|
|
31
31
|
keepaliveFetch: m().default(!0),
|
|
32
|
-
timeoutMs:
|
|
33
|
-
maxRetries:
|
|
32
|
+
timeoutMs: k().int().positive().default(4e3),
|
|
33
|
+
maxRetries: k().int().min(0).max(5).default(1)
|
|
34
34
|
}), R = "__gengageWidgetsInit", ee = f({
|
|
35
35
|
idempotencyKey: h().default(R),
|
|
36
36
|
requireDomReady: m().default(!0)
|
|
37
|
-
}), te =
|
|
37
|
+
}), te = A([
|
|
38
38
|
"log-and-ignore",
|
|
39
39
|
"throw",
|
|
40
40
|
"delegate"
|
|
41
41
|
]), ie = f({
|
|
42
42
|
unknownActionPolicy: te.default("log-and-ignore"),
|
|
43
43
|
allowScriptCall: m().default(!1)
|
|
44
|
-
}),
|
|
44
|
+
}), L = f({
|
|
45
45
|
version: D("1", { error: 'version must be "1"' }),
|
|
46
46
|
accountId: h({ error: "accountId must be a non-empty string" }).min(1, { error: "accountId must be a non-empty string" }),
|
|
47
47
|
middlewareUrl: h({ error: 'middlewareUrl must be a valid URL (e.g. "https://your-backend.example.com")' }).url({ error: 'middlewareUrl must be a valid URL (e.g. "https://your-backend.example.com")' }),
|
|
@@ -77,15 +77,15 @@ var b = f({ enabled: m().default(!0) }), Y = f({
|
|
|
77
77
|
})
|
|
78
78
|
});
|
|
79
79
|
function ne(e) {
|
|
80
|
-
|
|
81
|
-
const t =
|
|
82
|
-
return
|
|
80
|
+
M("config", "parsing account runtime config", e);
|
|
81
|
+
const t = L.parse(e);
|
|
82
|
+
return M("config", "config resolved", {
|
|
83
83
|
accountId: t.accountId,
|
|
84
84
|
middlewareUrl: t.middlewareUrl
|
|
85
85
|
}), t;
|
|
86
86
|
}
|
|
87
87
|
function qe(e) {
|
|
88
|
-
return
|
|
88
|
+
return L.safeParse(e);
|
|
89
89
|
}
|
|
90
90
|
function Se(e) {
|
|
91
91
|
return ne({
|
|
@@ -101,7 +101,7 @@ function Se(e) {
|
|
|
101
101
|
}
|
|
102
102
|
});
|
|
103
103
|
}
|
|
104
|
-
var
|
|
104
|
+
var B = `${R}_overlay_`, se = "#gengage-qna", oe = "#gengage-simrel", ae = "#gengage-simbut";
|
|
105
105
|
function q() {
|
|
106
106
|
const e = window;
|
|
107
107
|
return e.__gengageOverlayRegistry || (e.__gengageOverlayRegistry = {
|
|
@@ -111,7 +111,7 @@ function q() {
|
|
|
111
111
|
}
|
|
112
112
|
function re(e) {
|
|
113
113
|
const t = { pageType: e.pageContext?.pageType ?? (e.sku !== void 0 ? "pdp" : "other") }, i = e.pageContext;
|
|
114
|
-
return i?.sku !== void 0 && (t.sku = i.sku), i?.price !== void 0 && (t.price = i.price), i?.categoryTree !== void 0 && (t.categoryTree = i.categoryTree), i?.url !== void 0 && (t.url = i.url), i?.extra !== void 0 && (t.extra = i.extra), e.sku !== void 0 && (t.sku = e.sku), t;
|
|
114
|
+
return i?.sku !== void 0 && (t.sku = i.sku), i?.skuList !== void 0 && (t.skuList = i.skuList), i?.price !== void 0 && (t.price = i.price), i?.categoryTree !== void 0 && (t.categoryTree = i.categoryTree), i?.url !== void 0 && (t.url = i.url), i?.extra !== void 0 && (t.extra = i.extra), e.sku !== void 0 && (t.sku = e.sku), t;
|
|
115
115
|
}
|
|
116
116
|
function de(e, t) {
|
|
117
117
|
const i = {
|
|
@@ -119,17 +119,17 @@ function de(e, t) {
|
|
|
119
119
|
...t,
|
|
120
120
|
pageType: t.pageType ?? e.pageType
|
|
121
121
|
};
|
|
122
|
-
return t.sku === void 0 && e.sku !== void 0 && (i.sku = e.sku), i;
|
|
122
|
+
return t.pageType !== void 0 && t.pageType !== e.pageType ? (t.pageType !== "pdp" && t.sku === void 0 && delete i.sku, t.pageType !== "plp" && t.skuList === void 0 && delete i.skuList) : (t.sku === void 0 && e.sku !== void 0 && (i.sku = e.sku), t.skuList === void 0 && e.skuList !== void 0 && (i.skuList = e.skuList)), i;
|
|
123
123
|
}
|
|
124
124
|
function I(e) {
|
|
125
125
|
return e instanceof HTMLElement || document.querySelector(e) ? e : null;
|
|
126
126
|
}
|
|
127
|
-
function
|
|
128
|
-
return e.idempotencyKey ?? `${
|
|
127
|
+
function O(e) {
|
|
128
|
+
return e.idempotencyKey ?? `${B}${e.accountId}`;
|
|
129
129
|
}
|
|
130
130
|
var le = class {
|
|
131
131
|
constructor(e, t) {
|
|
132
|
-
this.options = e, this.onDestroy = t, this._chat = null, this._qna = null, this._simrel = null, this._simbut = null, this._analyticsClient = null, this._offQnaWire = null, this._destroyed = !1, this._queue = Promise.resolve(), this._warnedQnaMountMissing = !1, this._warnedSimRelMountMissing = !1, this._warnedSimButMountMissing = !1, this._warnedSimButNoChat = !1, this.idempotencyKey =
|
|
132
|
+
this.options = e, this.onDestroy = t, this._chat = null, this._qna = null, this._simrel = null, this._simbut = null, this._analyticsClient = null, this._offQnaWire = null, this._destroyed = !1, this._queue = Promise.resolve(), this._warnedQnaMountMissing = !1, this._warnedSimRelMountMissing = !1, this._warnedSimButMountMissing = !1, this._warnedSimButNoChat = !1, this.idempotencyKey = O(e), this.session = Q(e.session), this._pageContext = re(e);
|
|
133
133
|
}
|
|
134
134
|
get chat() {
|
|
135
135
|
return this._chat;
|
|
@@ -157,7 +157,7 @@ var le = class {
|
|
|
157
157
|
}
|
|
158
158
|
async updateContext(e) {
|
|
159
159
|
this._destroyed || await this._enqueue(async () => {
|
|
160
|
-
this._pageContext = de(this._pageContext, e), window.gengage || (window.gengage = {}), window.gengage.pageContext = this._pageContext, this._chat?.update(
|
|
160
|
+
this._pageContext = de(this._pageContext, e), window.gengage || (window.gengage = {}), window.gengage.pageContext = this._pageContext, this._chat?.update(this._pageContext), this._qna?.update(this._pageContext), this._simrel?.update(this._pageContext), this._simbut?.update(this._pageContext), await this._syncPdpWidgets();
|
|
161
161
|
});
|
|
162
162
|
}
|
|
163
163
|
async updateSku(e, t = "pdp") {
|
|
@@ -231,8 +231,8 @@ var le = class {
|
|
|
231
231
|
sku: e,
|
|
232
232
|
mountTarget: s
|
|
233
233
|
};
|
|
234
|
-
this.options.theme !== void 0 && (n.theme = this.options.theme), this.options.pricing !== void 0 && (n.pricing = this.options.pricing), this.options.simrel?.discountType !== void 0 && (n.discountType = this.options.simrel.discountType), this.options.simrel?.renderCardElement !== void 0 && (n.renderCardElement = this.options.simrel.renderCardElement), this.options.simrel?.renderer !== void 0 && (n.renderer = this.options.simrel.renderer), this.options.onAddToCart !== void 0 && (n.onAddToCart = this.options.onAddToCart), this.options.onProductNavigate !== void 0 ? n.onProductNavigate = this.options.onProductNavigate : n.onProductNavigate = (d,
|
|
235
|
-
K(d) && (this._chat?.saveSession(a ?? this.session.sessionId,
|
|
234
|
+
this.options.theme !== void 0 && (n.theme = this.options.theme), this.options.pricing !== void 0 && (n.pricing = this.options.pricing), this.options.simrel?.discountType !== void 0 && (n.discountType = this.options.simrel.discountType), this.options.simrel?.renderCardElement !== void 0 && (n.renderCardElement = this.options.simrel.renderCardElement), this.options.simrel?.renderer !== void 0 && (n.renderer = this.options.simrel.renderer), this.options.onAddToCart !== void 0 && (n.onAddToCart = this.options.onAddToCart), this.options.onProductNavigate !== void 0 ? n.onProductNavigate = this.options.onProductNavigate : n.onProductNavigate = (d, c, a) => {
|
|
235
|
+
K(d) && (this._chat?.saveSession(a ?? this.session.sessionId, c), window.location.href = d);
|
|
236
236
|
}, await o.init(n), this._simrel = o;
|
|
237
237
|
}
|
|
238
238
|
else
|
|
@@ -272,27 +272,27 @@ var le = class {
|
|
|
272
272
|
}), t;
|
|
273
273
|
}
|
|
274
274
|
};
|
|
275
|
-
async function
|
|
276
|
-
const t =
|
|
275
|
+
async function ue(e) {
|
|
276
|
+
const t = O(e), i = q(), s = i.instances[t];
|
|
277
277
|
if (s) return s;
|
|
278
278
|
const o = i.pending[t];
|
|
279
279
|
if (o) return o;
|
|
280
280
|
const n = new le(e, () => {
|
|
281
|
-
const
|
|
282
|
-
delete
|
|
283
|
-
}), d = n.init().then(() => (i.instances[t] = n, delete i.pending[t], n)).catch((
|
|
284
|
-
throw delete i.pending[t],
|
|
281
|
+
const c = q();
|
|
282
|
+
delete c.instances[t], delete c.pending[t];
|
|
283
|
+
}), d = n.init().then(() => (i.instances[t] = n, delete i.pending[t], n)).catch((c) => {
|
|
284
|
+
throw delete i.pending[t], c;
|
|
285
285
|
});
|
|
286
286
|
return i.pending[t] = d, d;
|
|
287
287
|
}
|
|
288
|
-
function
|
|
288
|
+
function ce(e) {
|
|
289
289
|
return q().instances[e] ?? null;
|
|
290
290
|
}
|
|
291
291
|
function Ne(e) {
|
|
292
|
-
|
|
292
|
+
ce(e)?.destroy();
|
|
293
293
|
}
|
|
294
|
-
function
|
|
295
|
-
return `${
|
|
294
|
+
function ke(e) {
|
|
295
|
+
return `${B}${e}`;
|
|
296
296
|
}
|
|
297
297
|
var ge = [
|
|
298
298
|
"gengage:chat:open",
|
|
@@ -305,7 +305,7 @@ var ge = [
|
|
|
305
305
|
"gengage:similar:add-to-cart",
|
|
306
306
|
"gengage:global:error",
|
|
307
307
|
"gengage:context:update"
|
|
308
|
-
], he = 32, U = "#gengage-qna",
|
|
308
|
+
], he = 32, U = "#gengage-qna", x = "#gengage-simrel";
|
|
309
309
|
function pe(e) {
|
|
310
310
|
let t = e;
|
|
311
311
|
if (typeof e == "string") {
|
|
@@ -353,15 +353,15 @@ function fe(e) {
|
|
|
353
353
|
function S(e, t) {
|
|
354
354
|
return t instanceof HTMLElement ? !0 : typeof t != "string" ? !1 : e.document.querySelector(t) !== null;
|
|
355
355
|
}
|
|
356
|
-
function
|
|
356
|
+
function E(e, t, i) {
|
|
357
357
|
if (t instanceof HTMLElement || S(e, t) || typeof t != "string") return t;
|
|
358
358
|
if (t.startsWith("#")) {
|
|
359
359
|
const n = t.slice(1);
|
|
360
360
|
if (n.length > 0) {
|
|
361
361
|
const d = e.document.getElementById(n);
|
|
362
362
|
if (d) return d;
|
|
363
|
-
const
|
|
364
|
-
return
|
|
363
|
+
const c = e.document.createElement("div");
|
|
364
|
+
return c.id = n, e.document.body.appendChild(c), c;
|
|
365
365
|
}
|
|
366
366
|
}
|
|
367
367
|
const s = e.document.getElementById(i);
|
|
@@ -369,7 +369,7 @@ function A(e, t, i) {
|
|
|
369
369
|
const o = e.document.createElement("div");
|
|
370
370
|
return o.id = i, e.document.body.appendChild(o), o;
|
|
371
371
|
}
|
|
372
|
-
function
|
|
372
|
+
function P(e, t) {
|
|
373
373
|
const i = e.webkit?.messageHandlers?.[t];
|
|
374
374
|
return i && typeof i.postMessage == "function" ? i.postMessage.bind(i) : null;
|
|
375
375
|
}
|
|
@@ -379,7 +379,7 @@ function w(e, t) {
|
|
|
379
379
|
}
|
|
380
380
|
function me(e = {}) {
|
|
381
381
|
const t = e.win ?? window, i = e.iosHandlerName ?? "gengage", s = e.androidInterfaceName ?? "GengageNative", o = e.reactNativeInterfaceName ?? "ReactNativeWebView";
|
|
382
|
-
return
|
|
382
|
+
return P(t, i) ? "ios" : w(t, s) ? "android" : w(t, o) ? "react-native" : "browser";
|
|
383
383
|
}
|
|
384
384
|
function ve(e, t = {}) {
|
|
385
385
|
const i = t.win ?? window;
|
|
@@ -399,27 +399,27 @@ function ve(e, t = {}) {
|
|
|
399
399
|
function ye(e = {}) {
|
|
400
400
|
const t = e.win ?? window, i = t;
|
|
401
401
|
if (i.gengageNative) return i.gengageNative;
|
|
402
|
-
const s = e.iosHandlerName ?? "gengage", o = e.androidInterfaceName ?? "GengageNative", n = e.reactNativeInterfaceName ?? "ReactNativeWebView", d = e.trackedEvents ?? [...ge],
|
|
402
|
+
const s = e.iosHandlerName ?? "gengage", o = e.androidInterfaceName ?? "GengageNative", n = e.reactNativeInterfaceName ?? "ReactNativeWebView", d = e.trackedEvents ?? [...ge], c = me({
|
|
403
403
|
win: t,
|
|
404
404
|
iosHandlerName: s,
|
|
405
405
|
androidInterfaceName: o,
|
|
406
406
|
reactNativeInterfaceName: n
|
|
407
407
|
});
|
|
408
408
|
let a = t.gengage?.overlay ?? null;
|
|
409
|
-
const
|
|
409
|
+
const u = [], v = (l, r) => {
|
|
410
410
|
const p = r === void 0 ? { type: l } : {
|
|
411
411
|
type: l,
|
|
412
412
|
payload: r
|
|
413
413
|
};
|
|
414
|
-
if (
|
|
415
|
-
|
|
414
|
+
if (c === "ios") {
|
|
415
|
+
P(t, s)?.(p);
|
|
416
416
|
return;
|
|
417
417
|
}
|
|
418
|
-
if (
|
|
418
|
+
if (c === "android") {
|
|
419
419
|
w(t, o)?.postMessage(JSON.stringify(p));
|
|
420
420
|
return;
|
|
421
421
|
}
|
|
422
|
-
if (
|
|
422
|
+
if (c === "react-native") {
|
|
423
423
|
w(t, n)?.postMessage(JSON.stringify(p));
|
|
424
424
|
return;
|
|
425
425
|
}
|
|
@@ -432,7 +432,7 @@ function ye(e = {}) {
|
|
|
432
432
|
});
|
|
433
433
|
};
|
|
434
434
|
t.addEventListener("gengage:bridge:message", y);
|
|
435
|
-
const
|
|
435
|
+
const F = d.map((l) => {
|
|
436
436
|
const r = (p) => {
|
|
437
437
|
const g = p.detail;
|
|
438
438
|
v("widget_event", {
|
|
@@ -445,10 +445,10 @@ function ye(e = {}) {
|
|
|
445
445
|
handler: r
|
|
446
446
|
};
|
|
447
447
|
}), _ = (l) => {
|
|
448
|
-
|
|
448
|
+
u.length >= he && u.shift(), u.push(l);
|
|
449
449
|
}, W = () => {
|
|
450
|
-
if (!a ||
|
|
451
|
-
const l =
|
|
450
|
+
if (!a || u.length === 0) return;
|
|
451
|
+
const l = u.splice(0, u.length);
|
|
452
452
|
for (const r of l) N(r);
|
|
453
453
|
}, N = (l) => {
|
|
454
454
|
const r = pe(l);
|
|
@@ -490,7 +490,7 @@ function ye(e = {}) {
|
|
|
490
490
|
}, t.location.origin), e.logUnhandled && console.warn("[gengage:native-bridge] Unhandled inbound type forwarded:", p);
|
|
491
491
|
}
|
|
492
492
|
}, C = {
|
|
493
|
-
env:
|
|
493
|
+
env: c,
|
|
494
494
|
sendToNative: v,
|
|
495
495
|
receive: N,
|
|
496
496
|
setController(l) {
|
|
@@ -498,23 +498,23 @@ function ye(e = {}) {
|
|
|
498
498
|
},
|
|
499
499
|
destroy() {
|
|
500
500
|
t.removeEventListener("gengage:bridge:message", y);
|
|
501
|
-
for (const l of
|
|
502
|
-
|
|
501
|
+
for (const l of F) t.removeEventListener(l.event, l.handler);
|
|
502
|
+
u.splice(0, u.length), t.gengageNative === C && delete t.gengageNative;
|
|
503
503
|
}
|
|
504
504
|
};
|
|
505
505
|
return i.gengageNative = C, C;
|
|
506
506
|
}
|
|
507
|
-
async function
|
|
507
|
+
async function Me(e) {
|
|
508
508
|
const { nativeBridge: t, emitReadyEvent: i = !0, ...s } = e, o = ye(t), n = { ...s };
|
|
509
|
-
n.onAddToCart || (n.onAddToCart = (
|
|
509
|
+
n.onAddToCart || (n.onAddToCart = (u) => {
|
|
510
510
|
o.sendToNative("addToCart", {
|
|
511
|
-
sku:
|
|
512
|
-
quantity:
|
|
513
|
-
cartCode:
|
|
511
|
+
sku: u.sku,
|
|
512
|
+
quantity: u.quantity,
|
|
513
|
+
cartCode: u.cartCode
|
|
514
514
|
});
|
|
515
|
-
}), n.onProductNavigate || (n.onProductNavigate = (
|
|
515
|
+
}), n.onProductNavigate || (n.onProductNavigate = (u, v, y) => {
|
|
516
516
|
o.sendToNative("productNavigate", {
|
|
517
|
-
url:
|
|
517
|
+
url: u,
|
|
518
518
|
sku: v,
|
|
519
519
|
sessionId: y
|
|
520
520
|
});
|
|
@@ -522,24 +522,24 @@ async function ke(e) {
|
|
|
522
522
|
const d = n.qna?.enabled === !0 || n.qna?.mountTarget !== void 0;
|
|
523
523
|
if (n.qna?.enabled !== !1)
|
|
524
524
|
if (d) {
|
|
525
|
-
const
|
|
525
|
+
const u = E(window, n.qna?.mountTarget ?? U, "gengage-qna");
|
|
526
526
|
n.qna = {
|
|
527
527
|
...n.qna,
|
|
528
528
|
enabled: !0,
|
|
529
|
-
mountTarget:
|
|
529
|
+
mountTarget: u
|
|
530
530
|
};
|
|
531
531
|
} else S(window, U) || (n.qna = { enabled: !1 });
|
|
532
|
-
const
|
|
532
|
+
const c = n.simrel?.enabled === !0 || n.simrel?.mountTarget !== void 0;
|
|
533
533
|
if (n.simrel?.enabled !== !1)
|
|
534
|
-
if (
|
|
535
|
-
const
|
|
534
|
+
if (c) {
|
|
535
|
+
const u = E(window, n.simrel?.mountTarget ?? x, "gengage-simrel");
|
|
536
536
|
n.simrel = {
|
|
537
537
|
...n.simrel,
|
|
538
538
|
enabled: !0,
|
|
539
|
-
mountTarget:
|
|
539
|
+
mountTarget: u
|
|
540
540
|
};
|
|
541
|
-
} else S(window,
|
|
542
|
-
const a = await
|
|
541
|
+
} else S(window, x) || (n.simrel = { enabled: !1 });
|
|
542
|
+
const a = await ue(n);
|
|
543
543
|
return o.setController(a), i && o.sendToNative("ready", {
|
|
544
544
|
sessionId: a.session.sessionId,
|
|
545
545
|
widgets: {
|
|
@@ -556,19 +556,19 @@ async function ke(e) {
|
|
|
556
556
|
};
|
|
557
557
|
}
|
|
558
558
|
export {
|
|
559
|
-
|
|
560
|
-
|
|
559
|
+
Me as a,
|
|
560
|
+
ce as c,
|
|
561
561
|
X as d,
|
|
562
562
|
te as f,
|
|
563
563
|
qe as h,
|
|
564
564
|
me as i,
|
|
565
|
-
|
|
565
|
+
ue as l,
|
|
566
566
|
ne as m,
|
|
567
567
|
ve as n,
|
|
568
|
-
|
|
568
|
+
ke as o,
|
|
569
569
|
Se as p,
|
|
570
570
|
ye as r,
|
|
571
571
|
Ne as s,
|
|
572
572
|
ge as t,
|
|
573
|
-
|
|
573
|
+
L as u
|
|
574
574
|
};
|