@gengage/assistant-fe 0.3.20 → 0.3.22
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/README.md +18 -6
- package/dist/{chat-CuPO9t-Z.cjs → chat-BF5pt6iX.cjs} +5 -5
- package/dist/{chat-yAf9OADM.js → chat-CHAi6Xej.js} +476 -480
- package/dist/chat.cjs +1 -1
- package/dist/chat.iife.js +17 -17
- package/dist/chat.js +1 -1
- package/dist/common/client.d.ts +4 -0
- package/dist/common/config-schema.d.ts +4 -0
- package/dist/common/overlay.d.ts +4 -0
- package/dist/common/widget-base.d.ts +6 -0
- package/dist/{common-C8NRcP7O.js → common-Ct6r0F2s.js} +35 -26
- package/dist/common-DXdLT4e0.cjs +1 -0
- package/dist/common.cjs +1 -1
- package/dist/common.js +6 -6
- package/dist/{connection-warning-CVZzlGJt.js → connection-warning-CHHi3BAf.js} +1 -1
- package/dist/{connection-warning-CL1CReZo.cjs → connection-warning-YQiIRXrz.cjs} +1 -1
- package/dist/{ga-datalayer-DkfsAHf9.cjs → ga-datalayer-BVppFxqk.cjs} +1 -1
- package/dist/{ga-datalayer-CgI6Kb_i.js → ga-datalayer-BwxWX-cr.js} +35 -32
- package/dist/index.cjs +1 -1
- package/dist/index.js +9 -9
- package/dist/native-webview-BaW1H_nZ.cjs +1 -0
- package/dist/{native-webview-B8vOoxns.js → native-webview-Cf5WtlIH.js} +72 -69
- package/dist/native.cjs +1 -1
- package/dist/native.iife.js +11 -11
- package/dist/native.js +1 -1
- package/dist/{qna-YSaIDxjs.js → qna-DXCQtwLq.js} +3 -3
- package/dist/{qna-KizG_W1J.cjs → qna-DwG8AJJf.cjs} +1 -1
- package/dist/qna.cjs +1 -1
- package/dist/qna.iife.js +1 -1
- package/dist/qna.js +1 -1
- package/dist/{schemas-B6RjqKrg.cjs → schemas-B7jnyzQI.cjs} +1 -1
- package/dist/{schemas-PkedCk_-.js → schemas-CTbgsvNJ.js} +1 -1
- package/dist/simbut/index.d.ts +3 -0
- package/dist/{simbut-BI054QK0.js → simbut-BBXTlzOg.js} +28 -20
- package/dist/simbut-D_ycY_MQ.cjs +1 -0
- package/dist/simbut.cjs +1 -1
- package/dist/simbut.iife.js +8 -8
- package/dist/simbut.js +1 -1
- package/dist/{simrel-C-DKpfVB.js → simrel-DP2EMyua.js} +3 -3
- package/dist/{simrel-vL0woDkE.cjs → simrel-DdP4lur9.cjs} +1 -1
- package/dist/simrel.cjs +1 -1
- package/dist/simrel.iife.js +1 -1
- package/dist/simrel.js +1 -1
- package/package.json +1 -1
- package/dist/common-BzegEdJs.cjs +0 -1
- package/dist/native-webview-D2lDXTh3.cjs +0 -1
- package/dist/simbut-B2jXtckF.cjs +0 -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-CHAi6Xej.js";
|
|
2
2
|
export {
|
|
3
3
|
r as CHAT_SCROLL_ELEMENT_ID,
|
|
4
4
|
e as ChatPresentationState,
|
package/dist/common/client.d.ts
CHANGED
|
@@ -4,6 +4,10 @@ import { PageContext } from './types.js';
|
|
|
4
4
|
export interface HostActions {
|
|
5
5
|
onAddToCart?: (params: import('./types.js').AddToCartParams) => void;
|
|
6
6
|
onProductNavigate?: (url: string, sku: string, sessionId: string | null) => void;
|
|
7
|
+
onFindSimilar?: (detail: {
|
|
8
|
+
sku: string;
|
|
9
|
+
imageUrl?: string;
|
|
10
|
+
}) => void;
|
|
7
11
|
onScriptCall?: (params: {
|
|
8
12
|
name: string;
|
|
9
13
|
payload?: Record<string, unknown>;
|
|
@@ -26,11 +26,15 @@ export declare const AccountRuntimeConfigSchema: z.ZodObject<{
|
|
|
26
26
|
simrel: z.ZodDefault<z.ZodObject<{
|
|
27
27
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
28
28
|
}, z.core.$strip>>;
|
|
29
|
+
simbut: z.ZodDefault<z.ZodObject<{
|
|
30
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
31
|
+
}, z.core.$strip>>;
|
|
29
32
|
}, z.core.$strip>;
|
|
30
33
|
mounts: z.ZodDefault<z.ZodObject<{
|
|
31
34
|
chat: z.ZodOptional<z.ZodString>;
|
|
32
35
|
qna: z.ZodOptional<z.ZodString>;
|
|
33
36
|
simrel: z.ZodOptional<z.ZodString>;
|
|
37
|
+
simbut: z.ZodOptional<z.ZodString>;
|
|
34
38
|
}, z.core.$strip>>;
|
|
35
39
|
transport: z.ZodDefault<z.ZodObject<{}, z.core.$strip>>;
|
|
36
40
|
analytics: z.ZodDefault<z.ZodObject<{
|
package/dist/common/overlay.d.ts
CHANGED
|
@@ -82,6 +82,10 @@ export interface OverlayWidgetsOptions {
|
|
|
82
82
|
pageContext?: Partial<PageContext>;
|
|
83
83
|
sku?: string;
|
|
84
84
|
theme?: WidgetTheme;
|
|
85
|
+
/** Backward-compatible alias for `chat.isDemoWebsite`. */
|
|
86
|
+
isDemoWebsite?: ChatWidgetConfig['isDemoWebsite'];
|
|
87
|
+
/** Backward-compatible alias for `chat.productDetailsExtended`. */
|
|
88
|
+
productDetailsExtended?: ChatWidgetConfig['productDetailsExtended'];
|
|
85
89
|
/** Price formatting options. Defaults to Turkish locale. */
|
|
86
90
|
pricing?: import('./price-formatter.js').PriceFormatConfig;
|
|
87
91
|
idempotencyKey?: string;
|
|
@@ -16,6 +16,12 @@ export declare abstract class BaseWidget<TConfig extends BaseWidgetConfig = Base
|
|
|
16
16
|
show(): void;
|
|
17
17
|
hide(): void;
|
|
18
18
|
destroy(): void;
|
|
19
|
+
/**
|
|
20
|
+
* Called at the end of destroy() to remove or clear the root node.
|
|
21
|
+
* Subclasses that mount into a merchant-owned element (e.g. SimBut) should
|
|
22
|
+
* override this to a no-op so the host page's DOM is never mutated.
|
|
23
|
+
*/
|
|
24
|
+
protected _cleanupRoot(): void;
|
|
19
25
|
on(event: string, handler: AnyHandler): () => void;
|
|
20
26
|
/** Track a checkout start event. Called by host page to attribute checkout to widget interaction. */
|
|
21
27
|
trackCheckout(type: 'start' | 'complete', data: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { f as u } from "./schemas-
|
|
2
|
-
import { h, l as f } from "./native-webview-
|
|
1
|
+
import { f as u } from "./schemas-CTbgsvNJ.js";
|
|
2
|
+
import { h, l as f } from "./native-webview-Cf5WtlIH.js";
|
|
3
3
|
var m = {
|
|
4
4
|
enabled: !0,
|
|
5
5
|
endpoint: "/analytics",
|
|
@@ -39,7 +39,7 @@ var m = {
|
|
|
39
39
|
}
|
|
40
40
|
flush() {
|
|
41
41
|
if (!this.config.enabled || this.queue.length === 0) return;
|
|
42
|
-
const e = this.queue.splice(0, this.config.batchSize), t = this.buildTransportBody(e), n =
|
|
42
|
+
const e = this.queue.splice(0, this.config.batchSize), t = this.buildTransportBody(e), n = c(this.config.endpoint, this.config.middlewareUrl);
|
|
43
43
|
this.send(n, t);
|
|
44
44
|
}
|
|
45
45
|
flushAll() {
|
|
@@ -82,7 +82,7 @@ var m = {
|
|
|
82
82
|
}
|
|
83
83
|
flushAllSync() {
|
|
84
84
|
if (!this.config.enabled) return;
|
|
85
|
-
const e =
|
|
85
|
+
const e = c(this.config.endpoint, this.config.middlewareUrl);
|
|
86
86
|
for (; this.queue.length > 0; ) {
|
|
87
87
|
const t = this.queue.splice(0, this.config.batchSize), n = this.buildTransportBody(t);
|
|
88
88
|
try {
|
|
@@ -96,7 +96,7 @@ var m = {
|
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
};
|
|
99
|
-
function
|
|
99
|
+
function U(e) {
|
|
100
100
|
return new y(e);
|
|
101
101
|
}
|
|
102
102
|
function p(e) {
|
|
@@ -111,21 +111,21 @@ function p(e) {
|
|
|
111
111
|
};
|
|
112
112
|
return e.view_id !== void 0 && (t.view_id = e.view_id), e.user_id !== void 0 && (t.user_id = e.user_id), e.widget !== void 0 && (t.widget = e.widget), e.page_type !== void 0 && (t.page_type = e.page_type), e.sku !== void 0 && (t.sku = e.sku), t;
|
|
113
113
|
}
|
|
114
|
-
function
|
|
114
|
+
function c(e, t) {
|
|
115
115
|
return /^https?:\/\//i.test(e) ? e : `${u(t)}${e.startsWith("/") ? e : `/${e}`}`;
|
|
116
116
|
}
|
|
117
117
|
function l() {
|
|
118
118
|
return typeof navigator < "u" && typeof navigator.sendBeacon == "function";
|
|
119
119
|
}
|
|
120
|
-
var
|
|
121
|
-
function
|
|
120
|
+
var E = "tr";
|
|
121
|
+
function P(e) {
|
|
122
122
|
return {
|
|
123
123
|
ACCOUNT_ID: e.accountId,
|
|
124
124
|
MIDDLEWARE_URL: e.middlewareUrl,
|
|
125
125
|
LOCALE: e.locale ?? "tr"
|
|
126
126
|
};
|
|
127
127
|
}
|
|
128
|
-
function
|
|
128
|
+
function A(e, t = {}) {
|
|
129
129
|
const n = {
|
|
130
130
|
accountId: e.accountId,
|
|
131
131
|
middlewareUrl: e.middlewareUrl,
|
|
@@ -161,7 +161,7 @@ function q(e, t = {}) {
|
|
|
161
161
|
};
|
|
162
162
|
return e.theme !== void 0 && (n.theme = e.theme), n;
|
|
163
163
|
}
|
|
164
|
-
function
|
|
164
|
+
function B(e, t = {}) {
|
|
165
165
|
return {
|
|
166
166
|
enabled: !0,
|
|
167
167
|
middlewareUrl: e,
|
|
@@ -182,6 +182,7 @@ function w(e, t) {
|
|
|
182
182
|
const n = [], i = e.mounts, r = [
|
|
183
183
|
["qna", i.qna],
|
|
184
184
|
["simrel", i.simrel],
|
|
185
|
+
["simbut", i.simbut],
|
|
185
186
|
["chat", i.chat]
|
|
186
187
|
];
|
|
187
188
|
for (const [o, a] of r)
|
|
@@ -200,6 +201,14 @@ function w(e, t) {
|
|
|
200
201
|
severity: "warn"
|
|
201
202
|
});
|
|
202
203
|
}
|
|
204
|
+
if (e.widgets.simbut.enabled && i.simbut === void 0) {
|
|
205
|
+
const o = "#gengage-simbut";
|
|
206
|
+
document.querySelector(o) || n.push({
|
|
207
|
+
code: "SIMBUT_MOUNT_REQUIRED",
|
|
208
|
+
message: `[gengage preflight] SimBut is enabled but no mount target is configured. Set mounts.simbut to your product image wrapper selector (e.g. "#product-gallery"). The default "${o}" was not found in the DOM.`,
|
|
209
|
+
severity: "error"
|
|
210
|
+
});
|
|
211
|
+
}
|
|
203
212
|
const s = e.gtm.idempotencyKey;
|
|
204
213
|
if (window[s] !== void 0 && n.push({
|
|
205
214
|
code: "DUPLICATE_IDEMPOTENCY",
|
|
@@ -207,8 +216,8 @@ function w(e, t) {
|
|
|
207
216
|
severity: "warn"
|
|
208
217
|
}), !t?.skipCspCheck) {
|
|
209
218
|
let o = !1;
|
|
210
|
-
const a = (
|
|
211
|
-
|
|
219
|
+
const a = (d) => {
|
|
220
|
+
d.blockedURI && e.middlewareUrl.startsWith(d.blockedURI) && (o = !0);
|
|
212
221
|
};
|
|
213
222
|
document.addEventListener("securitypolicyviolation", a);
|
|
214
223
|
try {
|
|
@@ -232,7 +241,7 @@ function w(e, t) {
|
|
|
232
241
|
warnings: n
|
|
233
242
|
};
|
|
234
243
|
}
|
|
235
|
-
function
|
|
244
|
+
function b(e) {
|
|
236
245
|
const t = h(e);
|
|
237
246
|
if (!t.success) {
|
|
238
247
|
const n = t.error.issues.map((i) => `${i.path.join(".")}: ${i.message}`).join("; ");
|
|
@@ -240,16 +249,16 @@ function T(e) {
|
|
|
240
249
|
}
|
|
241
250
|
return t.data;
|
|
242
251
|
}
|
|
243
|
-
function
|
|
252
|
+
function T(e, t, n) {
|
|
244
253
|
const i = {
|
|
245
254
|
accountId: e.accountId,
|
|
246
255
|
middlewareUrl: e.middlewareUrl,
|
|
247
256
|
idempotencyKey: e.gtm.idempotencyKey
|
|
248
257
|
};
|
|
249
|
-
return e.locale !== void 0 && (i.locale = e.locale), n !== void 0 && (i.pageContext = n, n.sku !== void 0 && (i.sku = n.sku)), i.chat = { enabled: e.widgets.chat.enabled }, e.mounts.chat !== void 0 && (i.chat.mountTarget = e.mounts.chat), i.qna = { enabled: e.widgets.qna.enabled }, e.mounts.qna !== void 0 && (i.qna.mountTarget = e.mounts.qna), i.simrel = { enabled: e.widgets.simrel.enabled }, e.mounts.simrel !== void 0 && (i.simrel.mountTarget = e.mounts.simrel), t?.onAddToCart !== void 0 && (i.onAddToCart = t.onAddToCart), t?.onProductNavigate !== void 0 && (i.onProductNavigate = t.onProductNavigate), t?.onScriptCall !== void 0 && (i.onScriptCall = t.onScriptCall), i;
|
|
258
|
+
return e.locale !== void 0 && (i.locale = e.locale), n !== void 0 && (i.pageContext = n, n.sku !== void 0 && (i.sku = n.sku)), i.chat = { enabled: e.widgets.chat.enabled }, e.mounts.chat !== void 0 && (i.chat.mountTarget = e.mounts.chat), i.qna = { enabled: e.widgets.qna.enabled }, e.mounts.qna !== void 0 && (i.qna.mountTarget = e.mounts.qna), i.simrel = { enabled: e.widgets.simrel.enabled }, e.mounts.simrel !== void 0 && (i.simrel.mountTarget = e.mounts.simrel), i.simbut = { enabled: e.widgets.simbut.enabled }, e.mounts.simbut !== void 0 && (i.simbut.mountTarget = e.mounts.simbut), t?.onAddToCart !== void 0 && (i.onAddToCart = t.onAddToCart), t?.onProductNavigate !== void 0 && (i.onProductNavigate = t.onProductNavigate), t?.onFindSimilar !== void 0 && (i.simbut.onFindSimilar = t.onFindSimilar), t?.onScriptCall !== void 0 && (i.onScriptCall = t.onScriptCall), i;
|
|
250
259
|
}
|
|
251
|
-
async function
|
|
252
|
-
const t =
|
|
260
|
+
async function D(e) {
|
|
261
|
+
const t = b(e.runtimeConfig);
|
|
253
262
|
if (e.preflight !== !1) {
|
|
254
263
|
const r = w(t);
|
|
255
264
|
if (!r.ok) {
|
|
@@ -257,7 +266,7 @@ async function O(e) {
|
|
|
257
266
|
throw new Error(`[gengage] Preflight failed: ${s.map((o) => o.message).join("; ")}`);
|
|
258
267
|
}
|
|
259
268
|
}
|
|
260
|
-
const n = e.contextResolver?.(), i = await f(
|
|
269
|
+
const n = e.contextResolver?.(), i = await f(T(t, e.hostActions, n));
|
|
261
270
|
if (e.contextResolver !== void 0) {
|
|
262
271
|
const r = e.contextResolver, s = () => {
|
|
263
272
|
const a = r();
|
|
@@ -342,7 +351,7 @@ function I(e) {
|
|
|
342
351
|
const r = n.match(/-p-(\d+)/i);
|
|
343
352
|
if (r?.[1]) return r[1];
|
|
344
353
|
}
|
|
345
|
-
function
|
|
354
|
+
function O(e) {
|
|
346
355
|
const t = C(e), n = { pageType: t };
|
|
347
356
|
if (t === "pdp") {
|
|
348
357
|
const i = I();
|
|
@@ -352,16 +361,16 @@ function B(e) {
|
|
|
352
361
|
}
|
|
353
362
|
export {
|
|
354
363
|
w as a,
|
|
355
|
-
|
|
364
|
+
B as c,
|
|
356
365
|
q as d,
|
|
357
366
|
y as f,
|
|
358
|
-
|
|
359
|
-
|
|
367
|
+
D as i,
|
|
368
|
+
A as l,
|
|
360
369
|
C as n,
|
|
361
|
-
|
|
362
|
-
|
|
370
|
+
E as o,
|
|
371
|
+
U as p,
|
|
363
372
|
I as r,
|
|
364
|
-
|
|
365
|
-
|
|
373
|
+
P as s,
|
|
374
|
+
O as t,
|
|
366
375
|
L as u
|
|
367
376
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const y=require("./schemas-B7jnyzQI.cjs"),l=require("./native-webview-BaW1H_nZ.cjs");var p={enabled:!0,endpoint:"/analytics",fireAndForget:!0,useBeacon:!0,keepaliveFetch:!0,timeoutMs:4e3,maxRetries:0,batchSize:10,flushIntervalMs:250},b={mode:"none",key:"",headerName:"X-API-Key",bodyField:"api_key"},f=class{constructor(e){this.queue=[],this.flushTimer=null,this.config={...p,...e,auth:{...b,...e.auth??{}}},this.onPageHideBound=()=>{this.queue.length!==0&&this.flushAllSync()},typeof window<"u"&&window.addEventListener("pagehide",this.onPageHideBound)}track(e){if(!this.config.enabled)return;const t=w(e);if(this.queue.push(t),this.queue.length>=this.config.batchSize){this.scheduleImmediateFlush();return}this.scheduleFlush()}flush(){if(!this.config.enabled||this.queue.length===0)return;const e=this.queue.splice(0,this.config.batchSize),t=this.buildTransportBody(e),r=c(this.config.endpoint,this.config.middlewareUrl);this.send(r,t)}flushAll(){for(;this.queue.length>0;)this.flush()}destroy(){this.flushTimer&&(clearTimeout(this.flushTimer),this.flushTimer=null),this.queue.length>0&&this.flushAllSync(),typeof window<"u"&&window.removeEventListener("pagehide",this.onPageHideBound)}scheduleFlush(){this.flushTimer||(this.flushTimer=setTimeout(()=>{this.flushTimer=null,this.flush()},this.config.flushIntervalMs))}scheduleImmediateFlush(){this.flushTimer&&(clearTimeout(this.flushTimer),this.flushTimer=null),this.flush()}buildTransportBody(e){const t={events:e};return this.config.auth.mode==="body-api-key"&&this.config.auth.key&&(t[this.config.auth.bodyField]=this.config.auth.key),t}send(e,t){try{const r=JSON.stringify(t);if(this.config.useBeacon&&this.config.auth.mode!=="x-api-key-header"&&this.config.auth.mode!=="bearer-header"&&d()){const o=new Blob([r],{type:"application/json"});navigator.sendBeacon(e,o);return}if(typeof fetch>"u")return;const n={"Content-Type":"application/json"};this.config.auth.mode==="x-api-key-header"&&this.config.auth.key&&(n[this.config.auth.headerName]=this.config.auth.key),this.config.auth.mode==="bearer-header"&&this.config.auth.key&&(n.Authorization=`Bearer ${this.config.auth.key}`),fetch(e,{method:"POST",headers:n,body:r,keepalive:!0}).catch(()=>{})}catch{}}flushAllSync(){if(!this.config.enabled)return;const e=c(this.config.endpoint,this.config.middlewareUrl);for(;this.queue.length>0;){const t=this.queue.splice(0,this.config.batchSize),r=this.buildTransportBody(t);try{const n=JSON.stringify(r);if(d()){const o=new Blob([n],{type:"application/json"});navigator.sendBeacon(e,o)}}catch{}}}};function v(e){return new f(e)}function w(e){const t={event_name:e.event_name,event_version:e.event_version??"1",timestamp_ms:e.timestamp_ms??Date.now(),account_id:e.account_id,session_id:e.session_id,correlation_id:e.correlation_id,payload:e.payload};return e.view_id!==void 0&&(t.view_id=e.view_id),e.user_id!==void 0&&(t.user_id=e.user_id),e.widget!==void 0&&(t.widget=e.widget),e.page_type!==void 0&&(t.page_type=e.page_type),e.sku!==void 0&&(t.sku=e.sku),t}function c(e,t){return/^https?:\/\//i.test(e)?e:`${y.normalizeMiddlewareUrl(t)}${e.startsWith("/")?e:`/${e}`}`}function d(){return typeof navigator<"u"&&typeof navigator.sendBeacon=="function"}var T="tr";function C(e){return{ACCOUNT_ID:e.accountId,MIDDLEWARE_URL:e.middlewareUrl,LOCALE:e.locale??"tr"}}function P(e,t={}){const r={accountId:e.accountId,middlewareUrl:e.middlewareUrl,session:{sessionId:e.sessionId},variant:"floating",locale:e.locale??"tr",...t};return e.theme!==void 0&&(r.theme=e.theme),r}function _(e,t={}){const r={accountId:e.accountId,middlewareUrl:e.middlewareUrl,session:{sessionId:e.sessionId},pageContext:{pageType:"pdp",sku:e.sku},mountTarget:e.mountTarget,...t};return e.theme!==void 0&&(r.theme=e.theme),r}function k(e,t={}){const r={accountId:e.accountId,middlewareUrl:e.middlewareUrl,session:{sessionId:e.sessionId},sku:e.sku,mountTarget:e.mountTarget,...t};return e.theme!==void 0&&(r.theme=e.theme),r}function I(e,t={}){return{enabled:!0,middlewareUrl:e,endpoint:"/analytics",fireAndForget:!0,useBeacon:!0,...t}}function S(e){try{return document.querySelector(e),!0}catch{return!1}}function h(e,t){const r=[],n=e.mounts,o=[["qna",n.qna],["simrel",n.simrel],["simbut",n.simbut],["chat",n.chat]];for(const[i,s]of o)if(s!==void 0){if(!S(s)){r.push({code:"INVALID_SELECTOR",message:`[gengage preflight] ${i} mount selector is invalid CSS: "${s}"`,severity:"error"});continue}document.querySelector(s)||r.push({code:"MOUNT_NOT_FOUND",message:`[gengage preflight] ${i} mount target not found: "${s}" — widget will skip or wait for DOM`,severity:"warn"})}if(e.widgets.simbut.enabled&&n.simbut===void 0){const i="#gengage-simbut";document.querySelector(i)||r.push({code:"SIMBUT_MOUNT_REQUIRED",message:`[gengage preflight] SimBut is enabled but no mount target is configured. Set mounts.simbut to your product image wrapper selector (e.g. "#product-gallery"). The default "${i}" was not found in the DOM.`,severity:"error"})}const a=e.gtm.idempotencyKey;if(window[a]!==void 0&&r.push({code:"DUPLICATE_IDEMPOTENCY",message:`[gengage preflight] window["${a}"] already exists — widgets may have already initialized`,severity:"warn"}),!t?.skipCspCheck){let i=!1;const s=u=>{u.blockedURI&&e.middlewareUrl.startsWith(u.blockedURI)&&(i=!0)};document.addEventListener("securitypolicyviolation",s);try{fetch(e.middlewareUrl,{method:"HEAD",mode:"no-cors"}).catch(()=>{})}catch{i=!0}document.removeEventListener("securitypolicyviolation",s),i&&r.push({code:"CSP_BLOCKED",message:`[gengage preflight] middleware URL may be blocked by Content-Security-Policy: "${e.middlewareUrl}". Add it to connect-src.`,severity:"warn"})}for(const i of r)i.severity==="error"?console.error(i.message):console.warn(i.message);return{ok:r.every(i=>i.severity!=="error"),warnings:r}}function U(e){const t=l.safeParseAccountRuntimeConfig(e);if(!t.success){const r=t.error.issues.map(n=>`${n.path.join(".")}: ${n.message}`).join("; ");throw new Error(`[gengage] Invalid runtime config: ${r}`)}return t.data}function O(e,t,r){const n={accountId:e.accountId,middlewareUrl:e.middlewareUrl,idempotencyKey:e.gtm.idempotencyKey};return e.locale!==void 0&&(n.locale=e.locale),r!==void 0&&(n.pageContext=r,r.sku!==void 0&&(n.sku=r.sku)),n.chat={enabled:e.widgets.chat.enabled},e.mounts.chat!==void 0&&(n.chat.mountTarget=e.mounts.chat),n.qna={enabled:e.widgets.qna.enabled},e.mounts.qna!==void 0&&(n.qna.mountTarget=e.mounts.qna),n.simrel={enabled:e.widgets.simrel.enabled},e.mounts.simrel!==void 0&&(n.simrel.mountTarget=e.mounts.simrel),n.simbut={enabled:e.widgets.simbut.enabled},e.mounts.simbut!==void 0&&(n.simbut.mountTarget=e.mounts.simbut),t?.onAddToCart!==void 0&&(n.onAddToCart=t.onAddToCart),t?.onProductNavigate!==void 0&&(n.onProductNavigate=t.onProductNavigate),t?.onFindSimilar!==void 0&&(n.simbut.onFindSimilar=t.onFindSimilar),t?.onScriptCall!==void 0&&(n.onScriptCall=t.onScriptCall),n}async function A(e){const t=U(e.runtimeConfig);if(e.preflight!==!1){const o=h(t);if(!o.ok){const a=o.warnings.filter(i=>i.severity==="error");throw new Error(`[gengage] Preflight failed: ${a.map(i=>i.message).join("; ")}`)}}const r=e.contextResolver?.(),n=await l.initOverlayWidgets(O(t,e.hostActions,r));if(e.contextResolver!==void 0){const o=e.contextResolver,a=()=>{const s=o();n.updateContext(s)};window.addEventListener("gengage:context:update",a);const i=n.destroy.bind(n);n.destroy=()=>{window.removeEventListener("gengage:context:update",a),i()}}return n}var E=[{pageType:"home",urlPatterns:["^/$","^/index\\.html?$","^/anasayfa$"]},{pageType:"search",urlPatterns:["/arama","/search","/ara\\?"],queryParam:"q"},{pageType:"cart",urlPatterns:["/sepet","/cart","/basket","/sepetim"]},{pageType:"plp",urlPatterns:["/kategori/","/category/","/c/","/koleksiyon/","/collection/"]},{pageType:"pdp",urlPatterns:["/urun/","/product/","/p/","/-p-","/-pm-"]}];function m(e,t){const r=t??(typeof window<"u"?new URL(window.location.href):null);if(!r)return"other";const n=e??E,o=r.pathname;for(const a of n)if(!(a.urlPatterns&&!a.urlPatterns.some(i=>{try{return new RegExp(i,"i").test(o)}catch{return!1}}))&&!(a.queryParam&&!r.searchParams.has(a.queryParam))&&!(a.selector&&typeof document<"u"&&!document.querySelector(a.selector)))return a.pageType;return"other"}function g(e){const t=e??(typeof window<"u"?new URL(window.location.href):null);if(!t)return;const r=t.pathname,n=r.match(/\/(?:p|urun|product)\/([^/?#]+)/i);if(n?.[1])return n[1];const o=r.match(/-p-(\d+)/i);if(o?.[1])return o[1]}function q(e){const t=m(e),r={pageType:t};if(t==="pdp"){const n=g();n&&(r.sku=n)}return typeof window<"u"&&(r.url=window.location.href),r}Object.defineProperty(exports,"AnalyticsClient",{enumerable:!0,get:function(){return f}});Object.defineProperty(exports,"DEFAULT_CUSTOMIZATION_LOCALE",{enumerable:!0,get:function(){return T}});Object.defineProperty(exports,"autoDetectPageContext",{enumerable:!0,get:function(){return q}});Object.defineProperty(exports,"createAccountIdentity",{enumerable:!0,get:function(){return C}});Object.defineProperty(exports,"createAnalyticsClient",{enumerable:!0,get:function(){return v}});Object.defineProperty(exports,"createDefaultAnalyticsConfig",{enumerable:!0,get:function(){return I}});Object.defineProperty(exports,"createFloatingChatConfig",{enumerable:!0,get:function(){return P}});Object.defineProperty(exports,"createPdpQnaConfig",{enumerable:!0,get:function(){return _}});Object.defineProperty(exports,"createPdpSimRelConfig",{enumerable:!0,get:function(){return k}});Object.defineProperty(exports,"detectPageType",{enumerable:!0,get:function(){return m}});Object.defineProperty(exports,"extractSkuFromUrl",{enumerable:!0,get:function(){return g}});Object.defineProperty(exports,"initGengageClient",{enumerable:!0,get:function(){return A}});Object.defineProperty(exports,"preflightDiagnostics",{enumerable:!0,get:function(){return h}});
|
package/dist/common.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./schemas-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./schemas-B7jnyzQI.cjs"),e=require("./ga-datalayer-BVppFxqk.cjs"),i=require("./chat-BF5pt6iX.cjs"),a=require("./connection-warning-YQiIRXrz.cjs"),t=require("./native-webview-BaW1H_nZ.cjs"),r=require("./common-DXdLT4e0.cjs");exports.AccountRuntimeConfigSchema=t.AccountRuntimeConfigSchema;exports.AnalyticsAuthModeSchema=t.AnalyticsAuthModeSchema;exports.AnalyticsClient=r.AnalyticsClient;exports.BASE_WIDGET_THEME=e.BASE_WIDGET_THEME;exports.BaseWidget=e.BaseWidget;exports.DEFAULT_CUSTOMIZATION_LOCALE=r.DEFAULT_CUSTOMIZATION_LOCALE;exports.DEFAULT_WIDGET_THEME_TOKENS=e.DEFAULT_WIDGET_THEME_TOKENS;exports.UnknownActionPolicySchema=t.UnknownActionPolicySchema;exports.VoiceInput=i.VoiceInput;exports.adaptBackendEvent=n.adaptBackendEvent;exports.applyNativeSession=t.applyNativeSession;exports.autoDetectPageContext=r.autoDetectPageContext;exports.basketAddEvent=e.basketAddEvent;exports.bootstrapSession=e.bootstrapSession;exports.buildChatEndpointUrl=n.buildChatEndpointUrl;exports.buildOverlayIdempotencyKey=t.buildOverlayIdempotencyKey;exports.chatHistorySnapshotEvent=e.chatHistorySnapshotEvent;exports.checkoutCompleteEvent=e.checkoutCompleteEvent;exports.checkoutStartEvent=e.checkoutStartEvent;exports.configureConnectionWarning=a.configureConnectionWarning;exports.consumeStream=n.consumeStream;exports.createAccountIdentity=r.createAccountIdentity;exports.createAnalyticsClient=r.createAnalyticsClient;exports.createDefaultAccountRuntimeConfig=t.createDefaultAccountRuntimeConfig;exports.createDefaultAnalyticsConfig=r.createDefaultAnalyticsConfig;exports.createFloatingChatConfig=r.createFloatingChatConfig;exports.createNativeWebViewBridge=t.createNativeWebViewBridge;exports.createPdpQnaConfig=r.createPdpQnaConfig;exports.createPdpSimRelConfig=r.createPdpSimRelConfig;exports.defaultUnknownUISpecRenderer=n.defaultUnknownUISpecRenderer;exports.destroyOverlayWidgets=t.destroyOverlayWidgets;exports.detectNativeEnvironment=t.detectNativeEnvironment;exports.detectPageType=r.detectPageType;exports.dismissGlobalErrorToast=e.dismissGlobalErrorToast;exports.dispatch=e.dispatch;exports.extractSkuFromUrl=r.extractSkuFromUrl;exports.getGlobalErrorMessage=e.getGlobalErrorMessage;exports.getOverlayWidgets=t.getOverlayWidgets;exports.getSuggestedSearchKeywords=n.getSuggestedSearchKeywords;exports.getSuggestedSearchKeywordsText=n.getSuggestedSearchKeywordsText;exports.getWindowPageContext=e.getWindowPageContext;exports.initGengageClient=r.initGengageClient;exports.initNativeOverlayWidgets=t.initNativeOverlayWidgets;exports.initOverlayWidgets=t.initOverlayWidgets;exports.isVoiceInputSupported=i.isVoiceInputSupported;exports.listen=e.listen;exports.llmUsageEvent=e.llmUsageEvent;exports.makePillLauncher=i.makePillLauncher;exports.mergeUISpecRegistry=n.mergeUISpecRegistry;exports.meteringIncrementEvent=e.meteringIncrementEvent;exports.meteringSummaryEvent=e.meteringSummaryEvent;exports.normalizeMiddlewareUrl=n.normalizeMiddlewareUrl;exports.normalizeProductGroupingsResponse=n.normalizeProductGroupingsResponse;exports.normalizeSimilarProductsResponse=n.normalizeSimilarProductsResponse;exports.parseAccountRuntimeConfig=t.parseAccountRuntimeConfig;exports.preflightDiagnostics=r.preflightDiagnostics;exports.productToNormalized=n.productToNormalized;exports.registerGlobalErrorToastListener=e.registerGlobalErrorToastListener;exports.renderUISpecWithRegistry=n.renderUISpecWithRegistry;exports.resolveSession=e.resolveSession;exports.routeStreamAction=i.routeStreamAction;exports.safeParseAccountRuntimeConfig=t.safeParseAccountRuntimeConfig;exports.sanitizeHtml=e.sanitizeHtml;exports.showGlobalErrorToast=e.showGlobalErrorToast;exports.streamChunkEvent=e.streamChunkEvent;exports.streamDoneEvent=e.streamDoneEvent;exports.streamErrorEvent=e.streamErrorEvent;exports.streamPost=n.streamPost;exports.streamStartEvent=e.streamStartEvent;exports.streamUiSpecEvent=e.streamUiSpecEvent;exports.trackConnectionWarningRequest=a.trackConnectionWarningRequest;exports.updatePageContext=e.updatePageContext;exports.widgetHistorySnapshotEvent=e.widgetHistorySnapshotEvent;exports.wireGADataLayer=e.wireGADataLayer;exports.wireQNAToChat=e.wireQNAToChat;exports.wireSimilarToChat=e.wireSimilarToChat;exports.withBaseTheme=e.withBaseTheme;exports.withDefaultWidgetTheme=e.withDefaultWidgetTheme;
|
package/dist/common.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
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-
|
|
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-
|
|
3
|
-
import { i as Z, l as j, m as J, u as X } from "./chat-
|
|
4
|
-
import { n as $, t as ee } from "./connection-warning-
|
|
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-
|
|
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-CTbgsvNJ.js";
|
|
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-CHAi6Xej.js";
|
|
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-Cf5WtlIH.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-Ct6r0F2s.js";
|
|
7
7
|
export {
|
|
8
8
|
Ee as AccountRuntimeConfigSchema,
|
|
9
9
|
re as AnalyticsAuthModeSchema,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const l=require("./ga-datalayer-
|
|
1
|
+
const l=require("./ga-datalayer-BVppFxqk.cjs");var w=8e3,h=5e3,g="https://www.google.com/favicon.ico";function m(e){e.probeUrl&&(g=e.probeUrl)}var n=new Map,f=!1,i=null,a=null,r=!1;function b(e){return typeof e=="string"&&e.toLowerCase().startsWith("tr")}function y(e){return b(e)?"İnternet bağlantısında sorun var gibi görünüyor. İstek sürerken yeniden deneyeceğiz.":"Your internet connection looks unstable. We'll keep retrying while this request is active."}function v(){let e;for(const t of n.values())e=t;return e}function u(){i&&(clearTimeout(i),i=null)}function C(){a&&(clearInterval(a),a=null)}async function d(){try{if(typeof navigator<"u"&&navigator.onLine===!1)return!1;if(typeof window<"u"){const o=window.location.hostname;if(o==="localhost"||o==="127.0.0.1")return navigator.onLine}const e=new AbortController,t=setTimeout(()=>e.abort(),3e3);try{return await fetch(g,{method:"HEAD",mode:"no-cors",cache:"no-cache",signal:e.signal}),!0}catch{return navigator.onLine}finally{clearTimeout(t)}}catch{return typeof navigator>"u"?!0:navigator.onLine}}function s(){r=!1,C(),l.dismissGlobalErrorToast()}function c(){i||r||n.size===0||(i=setTimeout(async()=>{i=null,!(r||n.size===0)&&!await d()&&n.size>0&&(r=!0,l.showGlobalErrorToast({source:"sdk",message:y(v()),sticky:!0}),a||(a=setInterval(async()=>{if(n.size===0){s();return}await d()&&(s(),c())},h)))},w))}function T(){f||typeof window>"u"||(f=!0,window.addEventListener("online",()=>{s(),c()}),window.addEventListener("offline",()=>{n.size===0||r||(r=!0,u(),l.showGlobalErrorToast({source:"sdk",message:y(v()),sticky:!0}))}))}function k(e){T();const t=Symbol(e.source);n.set(t,e.locale),c();let o=!1;return()=>{if(!o){if(o=!0,n.delete(t),n.size===0){u(),s();return}r||(u(),c())}}}Object.defineProperty(exports,"configureConnectionWarning",{enumerable:!0,get:function(){return m}});Object.defineProperty(exports,"trackConnectionWarningRequest",{enumerable:!0,get:function(){return k}});
|
|
@@ -44,4 +44,4 @@ function Z(e,t){const n={event_name:"stream.start",account_id:e.account_id,sessi
|
|
|
44
44
|
transform: translateY(0);
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
`,document.head.appendChild(e)}var b=null;function Re(){if(b!==null)return b;try{b=localStorage.getItem("gengage:debug")==="1"}catch{b=!1}return b}function S(e,t,n){if(!Re())return;const r=[`[gengage:${e}]`,t];n!==void 0&&r.push(n),console.debug(...r)}var Ue=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=W(e.theme);this.config={...e,theme:t,session:U(e.session)},this.root=this._resolveMount(e.mountTarget),this._applyTheme(t),G();const n=_("gengage:context:update",r=>this.update(r));this._cleanups.push(n),S("lifecycle",`${this.constructor.name}.init`,{accountId:e.accountId,sku:e.pageContext?.sku});try{await this.onInit(this.config)}catch(r){throw this.destroy(),r}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.config.analyticsClient?.destroy(),this._ownsRoot?this.root.remove():this.root.innerHTML="",this.isInitialised=!1)}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)}trackCheckout(e,t){const n=e==="start"?D:q;this.track(n(this.analyticsContext(),t))}flushMeteringSummary(e){this.track(M(this.analyticsContext(),e))}emit(e,...t){this._handlers.get(e)?.forEach(n=>n(...t))}addCleanup(e){this._cleanups.push(e)}track(e){this.config.analyticsClient?.track(e)}analyticsContext(){const e={account_id:this.config.accountId,session_id:this.config.session?.sessionId??"",correlation_id:this.config.session?.sessionId??""};return this.config.session?.viewId!==void 0&&(e.view_id=this.config.session.viewId),this.config.session?.userId!==void 0&&(e.user_id=this.config.session.userId),this.config.pageContext?.pageType!==void 0&&(e.page_type=this.config.pageContext.pageType),this.config.pageContext?.sku!==void 0&&(e.sku=this.config.pageContext.sku),this.config.session?.abTestVariant!==void 0&&(e.ab_test_variant=this.config.session.abTestVariant),this.config.session?.abTestExperimentId!==void 0&&(e.ab_test_experiment_id=this.config.session.abTestExperimentId),e}_resolveMount(e){if(e instanceof HTMLElement)return e;if(typeof e=="string"){const n=document.querySelector(e);if(!n)throw new Error(`[gengage] Mount target not found: "${e}"`);return n}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,n]of Object.entries(e))if(n!==void 0){const r=t.startsWith("--")?t:`--gengage-${We(t)}`;this.root.style.setProperty(r,n)}}}};function We(e){return e.replace(/([A-Z])/g,"-$1").toLowerCase()}function $e(){return typeof window<"u"&&Array.isArray(window.dataLayer)}function s(e,t){const n={event:e,...t};$e()&&window.dataLayer.push(n)}function B(e){s("gengage-on-init",{gengage_widget:e})}function C(e){s("gengage-show",{gengage_widget:e})}function Ge(e){s("gengage-hide",{gengage_widget:e})}function F(e,t){s("gengage-suggested-question",{gengage_question_title:e,gengage_action_type:t})}function He(e){s("gengage-find-similars",{gengage_sku:e})}function ze(e){s("gengage-compare-preselection",{gengage_sku:e})}function Be(e){s("gengage-compare-selected",{gengage_skus:e,gengage_product_count:e.length})}function Fe(){s("gengage-compare-clear")}function xe(e){s("gengage-compare-received",{gengage_product_count:e})}function Ve(e){s("gengage-like-product",{gengage_sku:e})}function Qe(){s("gengage-like-list")}function Ye(e,t){s("gengage-search",{gengage_search_query:e,gengage_result_count:t})}function x(e,t){s("gengage-product-detail",{gengage_sku:e,gengage_product_name:t})}function V(e,t){s("gengage-cart-add",{gengage_sku:e,gengage_quantity:t})}function Je(){s("gengage-message-sent")}function Ke(){s("gengage-message-received")}function Xe(){s("gengage-conversation-start")}function Q(){s("gengage-voice-input")}function Ze(e,t){s("gengage-error",{gengage_widget:e,gengage_error:t})}var v=null;function et(){if(typeof window>"u")return()=>{};if(v)return v;const e=[];function t(n,r){const i=u=>r(u.detail);window.addEventListener(n,i),e.push(()=>window.removeEventListener(n,i))}return t("gengage:chat:open",()=>C("chat")),t("gengage:chat:close",()=>Ge("chat")),t("gengage:chat:ready",()=>B("chat")),t("gengage:similar:add-to-cart",({sku:n,quantity:r})=>{V(n,r)}),t("gengage:similar:product-click",({sku:n})=>{x(n)}),t("gengage:qna:action",({title:n,type:r})=>{F(n,r)}),t("gengage:chat:voice",()=>Q()),t("gengage:qna:open-chat",()=>C("chat")),t("gengage:global:error",({source:n,message:r})=>{Ze(n,r)}),v=()=>{for(const n of e)n();e.length=0,v=null},v}Object.defineProperty(exports,"BASE_WIDGET_THEME",{enumerable:!0,get:function(){return g}});Object.defineProperty(exports,"BaseWidget",{enumerable:!0,get:function(){return Ue}});Object.defineProperty(exports,"DEFAULT_WIDGET_THEME_TOKENS",{enumerable:!0,get:function(){return E}});Object.defineProperty(exports,"basketAddEvent",{enumerable:!0,get:function(){return ue}});Object.defineProperty(exports,"bootstrapSession",{enumerable:!0,get:function(){return R}});Object.defineProperty(exports,"chatHistorySnapshotEvent",{enumerable:!0,get:function(){return se}});Object.defineProperty(exports,"checkoutCompleteEvent",{enumerable:!0,get:function(){return q}});Object.defineProperty(exports,"checkoutStartEvent",{enumerable:!0,get:function(){return D}});Object.defineProperty(exports,"debugLog",{enumerable:!0,get:function(){return S}});Object.defineProperty(exports,"dismissGlobalErrorToast",{enumerable:!0,get:function(){return z}});Object.defineProperty(exports,"dispatch",{enumerable:!0,get:function(){return be}});Object.defineProperty(exports,"getGlobalErrorMessage",{enumerable:!0,get:function(){return Ie}});Object.defineProperty(exports,"getWindowPageContext",{enumerable:!0,get:function(){return Ee}});Object.defineProperty(exports,"isLikelyConnectivityIssue",{enumerable:!0,get:function(){return $}});Object.defineProperty(exports,"isSafeImageUrl",{enumerable:!0,get:function(){return _e}});Object.defineProperty(exports,"isSafeUrl",{enumerable:!0,get:function(){return T}});Object.defineProperty(exports,"listen",{enumerable:!0,get:function(){return _}});Object.defineProperty(exports,"llmUsageEvent",{enumerable:!0,get:function(){return ie}});Object.defineProperty(exports,"meteringIncrementEvent",{enumerable:!0,get:function(){return oe}});Object.defineProperty(exports,"meteringSummaryEvent",{enumerable:!0,get:function(){return M}});Object.defineProperty(exports,"registerGlobalErrorToastListener",{enumerable:!0,get:function(){return G}});Object.defineProperty(exports,"resolveSession",{enumerable:!0,get:function(){return U}});Object.defineProperty(exports,"safeSetAttribute",{enumerable:!0,get:function(){return me}});Object.defineProperty(exports,"sanitizeHtml",{enumerable:!0,get:function(){return he}});Object.defineProperty(exports,"showGlobalErrorToast",{enumerable:!0,get:function(){return H}});Object.defineProperty(exports,"streamChunkEvent",{enumerable:!0,get:function(){return ee}});Object.defineProperty(exports,"streamDoneEvent",{enumerable:!0,get:function(){return ne}});Object.defineProperty(exports,"streamErrorEvent",{enumerable:!0,get:function(){return re}});Object.defineProperty(exports,"streamStartEvent",{enumerable:!0,get:function(){return Z}});Object.defineProperty(exports,"streamUiSpecEvent",{enumerable:!0,get:function(){return te}});Object.defineProperty(exports,"trackCartAdd",{enumerable:!0,get:function(){return V}});Object.defineProperty(exports,"trackCompareClear",{enumerable:!0,get:function(){return Fe}});Object.defineProperty(exports,"trackComparePreselection",{enumerable:!0,get:function(){return ze}});Object.defineProperty(exports,"trackCompareReceived",{enumerable:!0,get:function(){return xe}});Object.defineProperty(exports,"trackCompareSelected",{enumerable:!0,get:function(){return Be}});Object.defineProperty(exports,"trackConversationStart",{enumerable:!0,get:function(){return Xe}});Object.defineProperty(exports,"trackFindSimilars",{enumerable:!0,get:function(){return He}});Object.defineProperty(exports,"trackInit",{enumerable:!0,get:function(){return B}});Object.defineProperty(exports,"trackLikeList",{enumerable:!0,get:function(){return Qe}});Object.defineProperty(exports,"trackLikeProduct",{enumerable:!0,get:function(){return Ve}});Object.defineProperty(exports,"trackMessageReceived",{enumerable:!0,get:function(){return Ke}});Object.defineProperty(exports,"trackMessageSent",{enumerable:!0,get:function(){return Je}});Object.defineProperty(exports,"trackProductDetail",{enumerable:!0,get:function(){return x}});Object.defineProperty(exports,"trackSearch",{enumerable:!0,get:function(){return Ye}});Object.defineProperty(exports,"trackShow",{enumerable:!0,get:function(){return C}});Object.defineProperty(exports,"trackSuggestedQuestion",{enumerable:!0,get:function(){return F}});Object.defineProperty(exports,"trackVoiceInput",{enumerable:!0,get:function(){return Q}});Object.defineProperty(exports,"updatePageContext",{enumerable:!0,get:function(){return Se}});Object.defineProperty(exports,"widgetHistorySnapshotEvent",{enumerable:!0,get:function(){return ae}});Object.defineProperty(exports,"wireGADataLayer",{enumerable:!0,get:function(){return et}});Object.defineProperty(exports,"wireQNAToChat",{enumerable:!0,get:function(){return we}});Object.defineProperty(exports,"wireSimilarToChat",{enumerable:!0,get:function(){return ke}});Object.defineProperty(exports,"withBaseTheme",{enumerable:!0,get:function(){return Ce}});Object.defineProperty(exports,"withDefaultWidgetTheme",{enumerable:!0,get:function(){return W}});
|
|
47
|
+
`,document.head.appendChild(e)}var b=null;function Re(){if(b!==null)return b;try{b=localStorage.getItem("gengage:debug")==="1"}catch{b=!1}return b}function S(e,t,n){if(!Re())return;const r=[`[gengage:${e}]`,t];n!==void 0&&r.push(n),console.debug(...r)}var Ue=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=W(e.theme);this.config={...e,theme:t,session:U(e.session)},this.root=this._resolveMount(e.mountTarget),this._applyTheme(t),G();const n=_("gengage:context:update",r=>this.update(r));this._cleanups.push(n),S("lifecycle",`${this.constructor.name}.init`,{accountId:e.accountId,sku:e.pageContext?.sku});try{await this.onInit(this.config)}catch(r){throw this.destroy(),r}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.config.analyticsClient?.destroy(),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)}trackCheckout(e,t){const n=e==="start"?D:q;this.track(n(this.analyticsContext(),t))}flushMeteringSummary(e){this.track(M(this.analyticsContext(),e))}emit(e,...t){this._handlers.get(e)?.forEach(n=>n(...t))}addCleanup(e){this._cleanups.push(e)}track(e){this.config.analyticsClient?.track(e)}analyticsContext(){const e={account_id:this.config.accountId,session_id:this.config.session?.sessionId??"",correlation_id:this.config.session?.sessionId??""};return this.config.session?.viewId!==void 0&&(e.view_id=this.config.session.viewId),this.config.session?.userId!==void 0&&(e.user_id=this.config.session.userId),this.config.pageContext?.pageType!==void 0&&(e.page_type=this.config.pageContext.pageType),this.config.pageContext?.sku!==void 0&&(e.sku=this.config.pageContext.sku),this.config.session?.abTestVariant!==void 0&&(e.ab_test_variant=this.config.session.abTestVariant),this.config.session?.abTestExperimentId!==void 0&&(e.ab_test_experiment_id=this.config.session.abTestExperimentId),e}_resolveMount(e){if(e instanceof HTMLElement)return e;if(typeof e=="string"){const n=document.querySelector(e);if(!n)throw new Error(`[gengage] Mount target not found: "${e}"`);return n}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,n]of Object.entries(e))if(n!==void 0){const r=t.startsWith("--")?t:`--gengage-${We(t)}`;this.root.style.setProperty(r,n)}}}};function We(e){return e.replace(/([A-Z])/g,"-$1").toLowerCase()}function $e(){return typeof window<"u"&&Array.isArray(window.dataLayer)}function s(e,t){const n={event:e,...t};$e()&&window.dataLayer.push(n)}function B(e){s("gengage-on-init",{gengage_widget:e})}function C(e){s("gengage-show",{gengage_widget:e})}function Ge(e){s("gengage-hide",{gengage_widget:e})}function F(e,t){s("gengage-suggested-question",{gengage_question_title:e,gengage_action_type:t})}function He(e){s("gengage-find-similars",{gengage_sku:e})}function ze(e){s("gengage-compare-preselection",{gengage_sku:e})}function Be(e){s("gengage-compare-selected",{gengage_skus:e,gengage_product_count:e.length})}function Fe(){s("gengage-compare-clear")}function xe(e){s("gengage-compare-received",{gengage_product_count:e})}function Ve(e){s("gengage-like-product",{gengage_sku:e})}function Qe(){s("gengage-like-list")}function Ye(e,t){s("gengage-search",{gengage_search_query:e,gengage_result_count:t})}function x(e,t){s("gengage-product-detail",{gengage_sku:e,gengage_product_name:t})}function V(e,t){s("gengage-cart-add",{gengage_sku:e,gengage_quantity:t})}function Je(){s("gengage-message-sent")}function Ke(){s("gengage-message-received")}function Xe(){s("gengage-conversation-start")}function Q(){s("gengage-voice-input")}function Ze(e,t){s("gengage-error",{gengage_widget:e,gengage_error:t})}var v=null;function et(){if(typeof window>"u")return()=>{};if(v)return v;const e=[];function t(n,r){const i=u=>r(u.detail);window.addEventListener(n,i),e.push(()=>window.removeEventListener(n,i))}return t("gengage:chat:open",()=>C("chat")),t("gengage:chat:close",()=>Ge("chat")),t("gengage:chat:ready",()=>B("chat")),t("gengage:similar:add-to-cart",({sku:n,quantity:r})=>{V(n,r)}),t("gengage:similar:product-click",({sku:n})=>{x(n)}),t("gengage:qna:action",({title:n,type:r})=>{F(n,r)}),t("gengage:chat:voice",()=>Q()),t("gengage:qna:open-chat",()=>C("chat")),t("gengage:global:error",({source:n,message:r})=>{Ze(n,r)}),v=()=>{for(const n of e)n();e.length=0,v=null},v}Object.defineProperty(exports,"BASE_WIDGET_THEME",{enumerable:!0,get:function(){return g}});Object.defineProperty(exports,"BaseWidget",{enumerable:!0,get:function(){return Ue}});Object.defineProperty(exports,"DEFAULT_WIDGET_THEME_TOKENS",{enumerable:!0,get:function(){return E}});Object.defineProperty(exports,"basketAddEvent",{enumerable:!0,get:function(){return ue}});Object.defineProperty(exports,"bootstrapSession",{enumerable:!0,get:function(){return R}});Object.defineProperty(exports,"chatHistorySnapshotEvent",{enumerable:!0,get:function(){return se}});Object.defineProperty(exports,"checkoutCompleteEvent",{enumerable:!0,get:function(){return q}});Object.defineProperty(exports,"checkoutStartEvent",{enumerable:!0,get:function(){return D}});Object.defineProperty(exports,"debugLog",{enumerable:!0,get:function(){return S}});Object.defineProperty(exports,"dismissGlobalErrorToast",{enumerable:!0,get:function(){return z}});Object.defineProperty(exports,"dispatch",{enumerable:!0,get:function(){return be}});Object.defineProperty(exports,"getGlobalErrorMessage",{enumerable:!0,get:function(){return Ie}});Object.defineProperty(exports,"getWindowPageContext",{enumerable:!0,get:function(){return Ee}});Object.defineProperty(exports,"isLikelyConnectivityIssue",{enumerable:!0,get:function(){return $}});Object.defineProperty(exports,"isSafeImageUrl",{enumerable:!0,get:function(){return _e}});Object.defineProperty(exports,"isSafeUrl",{enumerable:!0,get:function(){return T}});Object.defineProperty(exports,"listen",{enumerable:!0,get:function(){return _}});Object.defineProperty(exports,"llmUsageEvent",{enumerable:!0,get:function(){return ie}});Object.defineProperty(exports,"meteringIncrementEvent",{enumerable:!0,get:function(){return oe}});Object.defineProperty(exports,"meteringSummaryEvent",{enumerable:!0,get:function(){return M}});Object.defineProperty(exports,"registerGlobalErrorToastListener",{enumerable:!0,get:function(){return G}});Object.defineProperty(exports,"resolveSession",{enumerable:!0,get:function(){return U}});Object.defineProperty(exports,"safeSetAttribute",{enumerable:!0,get:function(){return me}});Object.defineProperty(exports,"sanitizeHtml",{enumerable:!0,get:function(){return he}});Object.defineProperty(exports,"showGlobalErrorToast",{enumerable:!0,get:function(){return H}});Object.defineProperty(exports,"streamChunkEvent",{enumerable:!0,get:function(){return ee}});Object.defineProperty(exports,"streamDoneEvent",{enumerable:!0,get:function(){return ne}});Object.defineProperty(exports,"streamErrorEvent",{enumerable:!0,get:function(){return re}});Object.defineProperty(exports,"streamStartEvent",{enumerable:!0,get:function(){return Z}});Object.defineProperty(exports,"streamUiSpecEvent",{enumerable:!0,get:function(){return te}});Object.defineProperty(exports,"trackCartAdd",{enumerable:!0,get:function(){return V}});Object.defineProperty(exports,"trackCompareClear",{enumerable:!0,get:function(){return Fe}});Object.defineProperty(exports,"trackComparePreselection",{enumerable:!0,get:function(){return ze}});Object.defineProperty(exports,"trackCompareReceived",{enumerable:!0,get:function(){return xe}});Object.defineProperty(exports,"trackCompareSelected",{enumerable:!0,get:function(){return Be}});Object.defineProperty(exports,"trackConversationStart",{enumerable:!0,get:function(){return Xe}});Object.defineProperty(exports,"trackFindSimilars",{enumerable:!0,get:function(){return He}});Object.defineProperty(exports,"trackInit",{enumerable:!0,get:function(){return B}});Object.defineProperty(exports,"trackLikeList",{enumerable:!0,get:function(){return Qe}});Object.defineProperty(exports,"trackLikeProduct",{enumerable:!0,get:function(){return Ve}});Object.defineProperty(exports,"trackMessageReceived",{enumerable:!0,get:function(){return Ke}});Object.defineProperty(exports,"trackMessageSent",{enumerable:!0,get:function(){return Je}});Object.defineProperty(exports,"trackProductDetail",{enumerable:!0,get:function(){return x}});Object.defineProperty(exports,"trackSearch",{enumerable:!0,get:function(){return Ye}});Object.defineProperty(exports,"trackShow",{enumerable:!0,get:function(){return C}});Object.defineProperty(exports,"trackSuggestedQuestion",{enumerable:!0,get:function(){return F}});Object.defineProperty(exports,"trackVoiceInput",{enumerable:!0,get:function(){return Q}});Object.defineProperty(exports,"updatePageContext",{enumerable:!0,get:function(){return Se}});Object.defineProperty(exports,"widgetHistorySnapshotEvent",{enumerable:!0,get:function(){return ae}});Object.defineProperty(exports,"wireGADataLayer",{enumerable:!0,get:function(){return et}});Object.defineProperty(exports,"wireQNAToChat",{enumerable:!0,get:function(){return we}});Object.defineProperty(exports,"wireSimilarToChat",{enumerable:!0,get:function(){return ke}});Object.defineProperty(exports,"withBaseTheme",{enumerable:!0,get:function(){return Ce}});Object.defineProperty(exports,"withDefaultWidgetTheme",{enumerable:!0,get:function(){return W}});
|
|
@@ -325,8 +325,8 @@ function G(e) {
|
|
|
325
325
|
if (!n) continue;
|
|
326
326
|
const r = n.indexOf(":");
|
|
327
327
|
if (r === -1) continue;
|
|
328
|
-
const d = n.slice(0, r).trim().toLowerCase(),
|
|
329
|
-
V.has(d) && (B.test(
|
|
328
|
+
const d = n.slice(0, r).trim().toLowerCase(), f = n.slice(r + 1).trim();
|
|
329
|
+
V.has(d) && (B.test(f) || t.push(n));
|
|
330
330
|
}
|
|
331
331
|
return t.join("; ");
|
|
332
332
|
}
|
|
@@ -348,8 +348,8 @@ function k(e, t) {
|
|
|
348
348
|
for (const g of o) k(g, t);
|
|
349
349
|
return;
|
|
350
350
|
}
|
|
351
|
-
const r = E["*"] ?? /* @__PURE__ */ new Set(), d = E[n] ?? /* @__PURE__ */ new Set(),
|
|
352
|
-
for (const o of
|
|
351
|
+
const r = E["*"] ?? /* @__PURE__ */ new Set(), d = E[n] ?? /* @__PURE__ */ new Set(), f = Array.from(i.attributes);
|
|
352
|
+
for (const o of f) {
|
|
353
353
|
const g = o.name.toLowerCase();
|
|
354
354
|
if (!r.has(g) && !d.has(g)) {
|
|
355
355
|
i.removeAttribute(o.name);
|
|
@@ -388,7 +388,7 @@ function Ne(e) {
|
|
|
388
388
|
return !1;
|
|
389
389
|
}
|
|
390
390
|
}
|
|
391
|
-
function
|
|
391
|
+
function R(e) {
|
|
392
392
|
if (e.startsWith("/") && !e.startsWith("//")) return !0;
|
|
393
393
|
try {
|
|
394
394
|
const t = new URL(e);
|
|
@@ -397,10 +397,10 @@ function O(e) {
|
|
|
397
397
|
return !1;
|
|
398
398
|
}
|
|
399
399
|
}
|
|
400
|
-
function
|
|
401
|
-
(t === "href" || t === "src") && !
|
|
400
|
+
function Re(e, t, i) {
|
|
401
|
+
(t === "href" || t === "src") && !R(i) || e.setAttribute(t, i);
|
|
402
402
|
}
|
|
403
|
-
function
|
|
403
|
+
function Oe(e) {
|
|
404
404
|
if (!e) return "";
|
|
405
405
|
const t = new DOMParser().parseFromString(e, "text/html").body, i = Array.from(t.childNodes);
|
|
406
406
|
for (const n of i) k(n, t);
|
|
@@ -446,7 +446,7 @@ function Pe(e) {
|
|
|
446
446
|
let t = !1;
|
|
447
447
|
const i = [];
|
|
448
448
|
let n = 0, r = null, d = 0;
|
|
449
|
-
const
|
|
449
|
+
const f = 100, p = 5e3;
|
|
450
450
|
function o() {
|
|
451
451
|
return window.gengage?.chat ?? null;
|
|
452
452
|
}
|
|
@@ -468,7 +468,7 @@ function Pe(e) {
|
|
|
468
468
|
function b() {
|
|
469
469
|
r !== null && (window.clearInterval(r), r = null);
|
|
470
470
|
}
|
|
471
|
-
function
|
|
471
|
+
function O() {
|
|
472
472
|
const a = o();
|
|
473
473
|
if (!a) return !1;
|
|
474
474
|
if (n > 0 && (a.open?.(), n = 0), i.length > 0) {
|
|
@@ -479,8 +479,8 @@ function Pe(e) {
|
|
|
479
479
|
}
|
|
480
480
|
function S() {
|
|
481
481
|
r === null && (d = Date.now(), r = window.setInterval(() => {
|
|
482
|
-
|
|
483
|
-
},
|
|
482
|
+
O() || Date.now() - d >= p && (i.length = 0, n = 0, b());
|
|
483
|
+
}, f));
|
|
484
484
|
}
|
|
485
485
|
const D = w("gengage:qna:action", (a) => {
|
|
486
486
|
const c = o();
|
|
@@ -503,7 +503,7 @@ function Pe(e) {
|
|
|
503
503
|
}
|
|
504
504
|
function $e() {
|
|
505
505
|
return w("gengage:similar:product-click", ({ sku: e, url: t, sessionId: i }) => {
|
|
506
|
-
i && window.gengage?.chat?.saveSession(i, e),
|
|
506
|
+
i && window.gengage?.chat?.saveSession(i, e), R(t) && (window.location.href = t);
|
|
507
507
|
});
|
|
508
508
|
}
|
|
509
509
|
function Y() {
|
|
@@ -622,7 +622,7 @@ function ze(e) {
|
|
|
622
622
|
...e
|
|
623
623
|
};
|
|
624
624
|
}
|
|
625
|
-
var
|
|
625
|
+
var l = "gengage-global-toast-root", A = "gengage-global-toast-style", C = "gengage-global-toast-root--visible", X = 4200, Z = 1500, ee = 15e3, te = [
|
|
626
626
|
"--gengage-font-family",
|
|
627
627
|
"--surface-card",
|
|
628
628
|
"--text-primary",
|
|
@@ -679,7 +679,7 @@ function oe(e) {
|
|
|
679
679
|
}
|
|
680
680
|
function se() {
|
|
681
681
|
if (typeof document > "u") return;
|
|
682
|
-
const e = document.getElementById(
|
|
682
|
+
const e = document.getElementById(l);
|
|
683
683
|
e && (e.classList.remove(C), e.innerHTML = "", _ && (clearTimeout(_), _ = null));
|
|
684
684
|
}
|
|
685
685
|
function ae(e) {
|
|
@@ -695,10 +695,10 @@ function ae(e) {
|
|
|
695
695
|
}
|
|
696
696
|
}
|
|
697
697
|
function de() {
|
|
698
|
-
const e = document.getElementById(
|
|
698
|
+
const e = document.getElementById(l);
|
|
699
699
|
if (e instanceof HTMLElement) return e;
|
|
700
700
|
const t = document.createElement("div");
|
|
701
|
-
return t.id =
|
|
701
|
+
return t.id = l, t.className = "gengage-global-toast-root", document.body.appendChild(t), t;
|
|
702
702
|
}
|
|
703
703
|
function ge(e) {
|
|
704
704
|
if (typeof document > "u" || typeof window > "u") return;
|
|
@@ -717,22 +717,22 @@ function ce() {
|
|
|
717
717
|
if (document.getElementById(A)) return;
|
|
718
718
|
const e = document.createElement("style");
|
|
719
719
|
e.id = A;
|
|
720
|
-
const t = u["--surface-card"] ?? u.backgroundColor ?? "#ffffff", i = u["--text-primary"] ?? u.foregroundColor ?? "#111827", n = u["--border-default"] ?? "rgba(17, 24, 39, 0.10)", r = u["--error"] ?? "#dc2626", d = u["--shadow-3"] ?? "0 10px 24px rgba(16, 24, 40, 0.12)",
|
|
720
|
+
const t = u["--surface-card"] ?? u.backgroundColor ?? "#ffffff", i = u["--text-primary"] ?? u.foregroundColor ?? "#111827", n = u["--border-default"] ?? "rgba(17, 24, 39, 0.10)", r = u["--error"] ?? "#dc2626", d = u["--shadow-3"] ?? "0 10px 24px rgba(16, 24, 40, 0.12)", f = u["--radius-card"] ?? "16px", p = u["--text-muted"] ?? "#6b7280";
|
|
721
721
|
e.textContent = `
|
|
722
|
-
#${
|
|
722
|
+
#${l} {
|
|
723
723
|
position: fixed;
|
|
724
724
|
top: 16px;
|
|
725
725
|
right: 16px;
|
|
726
726
|
z-index: 2147483646;
|
|
727
727
|
pointer-events: none;
|
|
728
728
|
}
|
|
729
|
-
#${
|
|
729
|
+
#${l}.${C} {
|
|
730
730
|
pointer-events: auto;
|
|
731
731
|
}
|
|
732
|
-
#${
|
|
732
|
+
#${l} .gengage-global-toast {
|
|
733
733
|
min-width: 260px;
|
|
734
734
|
max-width: min(92vw, 420px);
|
|
735
|
-
border-radius: var(--radius-card, ${
|
|
735
|
+
border-radius: var(--radius-card, ${f});
|
|
736
736
|
border: 1px solid var(--ds-toast-error-border, color-mix(in srgb, var(--error, ${r}) 18%, var(--border-default, ${n})));
|
|
737
737
|
border-left: 4px solid var(--ds-toast-error-accent, var(--error, ${r}));
|
|
738
738
|
background: var(--ds-toast-error-bg, color-mix(in srgb, var(--error, ${r}) 5%, var(--surface-card, ${t})));
|
|
@@ -744,13 +744,13 @@ function ce() {
|
|
|
744
744
|
line-height: 1.4;
|
|
745
745
|
animation: gengage-global-toast-in 180ms ease-out forwards;
|
|
746
746
|
}
|
|
747
|
-
#${
|
|
747
|
+
#${l} .gengage-global-toast-title {
|
|
748
748
|
margin: 0 0 4px;
|
|
749
749
|
font-size: 12px;
|
|
750
750
|
font-weight: 700;
|
|
751
751
|
color: var(--text-muted, ${p});
|
|
752
752
|
}
|
|
753
|
-
#${
|
|
753
|
+
#${l} .gengage-global-toast-message {
|
|
754
754
|
margin: 0;
|
|
755
755
|
font-weight: 500;
|
|
756
756
|
}
|
|
@@ -767,7 +767,7 @@ function ce() {
|
|
|
767
767
|
`, document.head.appendChild(e);
|
|
768
768
|
}
|
|
769
769
|
var m = null;
|
|
770
|
-
function
|
|
770
|
+
function le() {
|
|
771
771
|
if (m !== null) return m;
|
|
772
772
|
try {
|
|
773
773
|
m = localStorage.getItem("gengage:debug") === "1";
|
|
@@ -777,7 +777,7 @@ function fe() {
|
|
|
777
777
|
return m;
|
|
778
778
|
}
|
|
779
779
|
function M(e, t, i) {
|
|
780
|
-
if (!
|
|
780
|
+
if (!le()) return;
|
|
781
781
|
const n = [`[gengage:${e}]`, t];
|
|
782
782
|
i !== void 0 && n.push(i), console.debug(...n);
|
|
783
783
|
}
|
|
@@ -827,7 +827,10 @@ var Fe = class {
|
|
|
827
827
|
this.isVisible && (this.isVisible = !1, this.root.style.display = "none", this.onHide(), this.emit("hide"));
|
|
828
828
|
}
|
|
829
829
|
destroy() {
|
|
830
|
-
this._destroying || (this._destroying = !0, this.emit("destroy"), this._cleanups.forEach((e) => e()), this._cleanups.length = 0, this._handlers.clear(), this.onDestroy(), this.config.analyticsClient?.destroy(), this.
|
|
830
|
+
this._destroying || (this._destroying = !0, this.emit("destroy"), this._cleanups.forEach((e) => e()), this._cleanups.length = 0, this._handlers.clear(), this.onDestroy(), this.config.analyticsClient?.destroy(), this._cleanupRoot(), this.isInitialised = !1);
|
|
831
|
+
}
|
|
832
|
+
_cleanupRoot() {
|
|
833
|
+
this._ownsRoot ? this.root.remove() : this.root.innerHTML = "";
|
|
831
834
|
}
|
|
832
835
|
on(e, t) {
|
|
833
836
|
return this._handlers.has(e) || this._handlers.set(e, /* @__PURE__ */ new Set()), this._handlers.get(e).add(t), () => this._handlers.get(e)?.delete(t);
|
|
@@ -869,13 +872,13 @@ var Fe = class {
|
|
|
869
872
|
_applyTheme(e) {
|
|
870
873
|
if (e) {
|
|
871
874
|
for (const [t, i] of Object.entries(e)) if (i !== void 0) {
|
|
872
|
-
const n = t.startsWith("--") ? t : `--gengage-${
|
|
875
|
+
const n = t.startsWith("--") ? t : `--gengage-${fe(t)}`;
|
|
873
876
|
this.root.style.setProperty(n, i);
|
|
874
877
|
}
|
|
875
878
|
}
|
|
876
879
|
}
|
|
877
880
|
};
|
|
878
|
-
function
|
|
881
|
+
function fe(e) {
|
|
879
882
|
return e.replace(/([A-Z])/g, "-$1").toLowerCase();
|
|
880
883
|
}
|
|
881
884
|
function _e() {
|
|
@@ -989,7 +992,7 @@ function et() {
|
|
|
989
992
|
export {
|
|
990
993
|
Se as $,
|
|
991
994
|
Y as A,
|
|
992
|
-
|
|
995
|
+
Re as B,
|
|
993
996
|
ne as C,
|
|
994
997
|
ze as D,
|
|
995
998
|
u as E,
|
|
@@ -1009,7 +1012,7 @@ export {
|
|
|
1009
1012
|
xe as S,
|
|
1010
1013
|
oe as T,
|
|
1011
1014
|
Le as U,
|
|
1012
|
-
|
|
1015
|
+
Oe as V,
|
|
1013
1016
|
z as W,
|
|
1014
1017
|
Ee as X,
|
|
1015
1018
|
Ce as Y,
|
|
@@ -1040,5 +1043,5 @@ export {
|
|
|
1040
1043
|
re as w,
|
|
1041
1044
|
se as x,
|
|
1042
1045
|
Fe as y,
|
|
1043
|
-
|
|
1046
|
+
R as z
|
|
1044
1047
|
};
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./schemas-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./schemas-B7jnyzQI.cjs"),i=require("./ga-datalayer-BVppFxqk.cjs"),n=require("./chat-BF5pt6iX.cjs"),u=require("./connection-warning-YQiIRXrz.cjs"),r=require("./qna-DwG8AJJf.cjs"),c=require("./simrel-DdP4lur9.cjs"),o=require("./simbut-D_ycY_MQ.cjs"),e=require("./native-webview-BaW1H_nZ.cjs"),t=require("./common-DXdLT4e0.cjs");exports.AccountRuntimeConfigSchema=e.AccountRuntimeConfigSchema;exports.AnalyticsAuthModeSchema=e.AnalyticsAuthModeSchema;exports.BASE_WIDGET_THEME=i.BASE_WIDGET_THEME;exports.DEFAULT_CUSTOMIZATION_LOCALE=t.DEFAULT_CUSTOMIZATION_LOCALE;exports.DEFAULT_WIDGET_THEME_TOKENS=i.DEFAULT_WIDGET_THEME_TOKENS;exports.GengageChat=n.GengageChat;exports.GengageQNA=r.GengageQNA;exports.GengageSimBut=o.GengageSimBut;exports.GengageSimRel=c.GengageSimRel;exports.UnknownActionPolicySchema=e.UnknownActionPolicySchema;exports.VoiceInput=n.VoiceInput;exports.applyNativeSession=e.applyNativeSession;exports.autoDetectPageContext=t.autoDetectPageContext;exports.bootstrapSession=i.bootstrapSession;exports.buildChatEndpointUrl=a.buildChatEndpointUrl;exports.buildOverlayIdempotencyKey=e.buildOverlayIdempotencyKey;exports.configureConnectionWarning=u.configureConnectionWarning;exports.consumeStream=a.consumeStream;exports.createAccountIdentity=t.createAccountIdentity;exports.createAnalyticsClient=t.createAnalyticsClient;exports.createChatWidget=n.createChatWidget;exports.createDefaultAccountRuntimeConfig=e.createDefaultAccountRuntimeConfig;exports.createDefaultAnalyticsConfig=t.createDefaultAnalyticsConfig;exports.createDefaultChatUISpecRegistry=n.createDefaultChatUISpecRegistry;exports.createDefaultQnaUISpecRegistry=r.createDefaultQnaUISpecRegistry;exports.createDefaultSimRelUISpecRegistry=c.createDefaultSimRelUISpecRegistry;exports.createFloatingChatConfig=t.createFloatingChatConfig;exports.createNativeWebViewBridge=e.createNativeWebViewBridge;exports.createPdpQnaConfig=t.createPdpQnaConfig;exports.createPdpSimRelConfig=t.createPdpSimRelConfig;exports.createQNAWidget=r.createQNAWidget;exports.createSimButWidget=o.createSimButWidget;exports.createSimRelWidget=c.createSimRelWidget;exports.defaultChatUnknownUISpecRenderer=n.defaultChatUnknownUISpecRenderer;exports.defaultQnaUnknownUISpecRenderer=r.defaultQnaUnknownUISpecRenderer;exports.defaultSimRelUnknownUISpecRenderer=c.defaultSimRelUnknownUISpecRenderer;exports.defaultUnknownUISpecRenderer=a.defaultUnknownUISpecRenderer;exports.destroyOverlayWidgets=e.destroyOverlayWidgets;exports.detectNativeEnvironment=e.detectNativeEnvironment;exports.detectPageType=t.detectPageType;exports.dispatch=i.dispatch;exports.extractSkuFromUrl=t.extractSkuFromUrl;exports.getOverlayWidgets=e.getOverlayWidgets;exports.initGengageClient=t.initGengageClient;exports.initNativeOverlayWidgets=e.initNativeOverlayWidgets;exports.initOverlayWidgets=e.initOverlayWidgets;exports.isVoiceInputSupported=n.isVoiceInputSupported;exports.listen=i.listen;exports.makePillLauncher=n.makePillLauncher;exports.normalizeMiddlewareUrl=a.normalizeMiddlewareUrl;exports.parseAccountRuntimeConfig=e.parseAccountRuntimeConfig;exports.preflightDiagnostics=t.preflightDiagnostics;exports.renderChatUISpec=n.renderUISpec;exports.renderQnaUISpec=r.renderQnaUISpec;exports.renderSimRelUISpec=c.renderSimRelUISpec;exports.renderUISpecWithRegistry=a.renderUISpecWithRegistry;exports.routeStreamAction=n.routeStreamAction;exports.safeParseAccountRuntimeConfig=e.safeParseAccountRuntimeConfig;exports.streamPost=a.streamPost;exports.updatePageContext=i.updatePageContext;exports.wireGADataLayer=i.wireGADataLayer;exports.wireQNAToChat=i.wireQNAToChat;exports.wireSimilarToChat=i.wireSimilarToChat;exports.withBaseTheme=i.withBaseTheme;exports.withDefaultWidgetTheme=i.withDefaultWidgetTheme;
|