@gengage/assistant-fe 0.1.8 → 0.2.0
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 +79 -286
- package/dist/assistant-fe.css +1 -1
- package/dist/chat/api.d.ts +1 -12
- package/dist/chat/api.d.ts.map +1 -1
- package/dist/chat/components/CategoriesContainer.d.ts.map +1 -1
- package/dist/chat/components/ChatDrawer.d.ts +15 -1
- package/dist/chat/components/ChatDrawer.d.ts.map +1 -1
- package/dist/chat/components/ChoicePrompter.d.ts +1 -0
- package/dist/chat/components/ChoicePrompter.d.ts.map +1 -1
- package/dist/chat/components/ComparisonTable.d.ts +5 -3
- package/dist/chat/components/ComparisonTable.d.ts.map +1 -1
- package/dist/chat/components/PanelTopBar.d.ts +2 -0
- package/dist/chat/components/PanelTopBar.d.ts.map +1 -1
- package/dist/chat/components/ProductSummaryCard.d.ts.map +1 -1
- package/dist/chat/components/ReviewHighlights.d.ts +3 -0
- package/dist/chat/components/ReviewHighlights.d.ts.map +1 -1
- package/dist/chat/components/renderUISpec.d.ts +0 -5
- package/dist/chat/components/renderUISpec.d.ts.map +1 -1
- package/dist/chat/index.d.ts +18 -9
- package/dist/chat/index.d.ts.map +1 -1
- package/dist/chat/locales/en.d.ts.map +1 -1
- package/dist/chat/locales/tr.d.ts.map +1 -1
- package/dist/chat/session-persistence.d.ts +3 -0
- package/dist/chat/session-persistence.d.ts.map +1 -1
- package/dist/chat/types.d.ts +23 -25
- package/dist/chat/types.d.ts.map +1 -1
- package/dist/chat.cjs +1 -1
- package/dist/chat.iife.js +22 -22
- package/dist/chat.iife.js.map +1 -1
- package/dist/chat.js +8 -9
- package/dist/chat.js.map +1 -1
- package/dist/common/action-router.d.ts.map +1 -1
- package/dist/common/activity-tracker.d.ts +1 -1
- package/dist/common/analytics.d.ts +12 -8
- package/dist/common/analytics.d.ts.map +1 -1
- package/dist/common/api-paths.d.ts +2 -5
- package/dist/common/api-paths.d.ts.map +1 -1
- package/dist/common/config-schema.d.ts.map +1 -1
- package/dist/common/debug.d.ts +14 -0
- package/dist/common/debug.d.ts.map +1 -0
- package/dist/common/events.d.ts.map +1 -1
- package/dist/common/index.d.ts +2 -2
- package/dist/common/index.d.ts.map +1 -1
- package/dist/common/native-webview.d.ts.map +1 -1
- package/dist/common/overlay.d.ts +19 -0
- package/dist/common/overlay.d.ts.map +1 -1
- package/dist/common/product-utils.d.ts +10 -0
- package/dist/common/product-utils.d.ts.map +1 -1
- package/dist/common/{v1-protocol-adapter.d.ts → protocol-adapter.d.ts} +2 -2
- package/dist/common/protocol-adapter.d.ts.map +1 -0
- package/dist/common/quantity-stepper.d.ts +10 -10
- package/dist/common/quantity-stepper.d.ts.map +1 -1
- package/dist/common/safe-html.d.ts.map +1 -1
- package/dist/common/streaming.d.ts.map +1 -1
- package/dist/common/tts-player.d.ts +2 -0
- package/dist/common/tts-player.d.ts.map +1 -1
- package/dist/common/types.d.ts +1 -1
- package/dist/common/voice-input.d.ts +1 -0
- package/dist/common/voice-input.d.ts.map +1 -1
- package/dist/common/widget-base.d.ts.map +1 -1
- package/dist/common.cjs +1 -1
- package/dist/common.cjs.map +1 -1
- package/dist/common.js +173 -172
- package/dist/common.js.map +1 -1
- package/dist/index-BA7N_XOO.cjs +2 -0
- package/dist/index-BA7N_XOO.cjs.map +1 -0
- package/dist/{index-CcOJTzYu.js → index-C6KDzSjm.js} +155 -159
- package/dist/index-C6KDzSjm.js.map +1 -0
- package/dist/index-RmQRBt6w.js +4449 -0
- package/dist/index-RmQRBt6w.js.map +1 -0
- package/dist/index-VgLdYuZV.cjs +13 -0
- package/dist/index-VgLdYuZV.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +16 -16
- package/dist/native.cjs +1 -1
- package/dist/native.iife.js +23 -23
- package/dist/native.iife.js.map +1 -1
- package/dist/native.js +1 -1
- package/dist/qna/index.d.ts +19 -0
- package/dist/qna/index.d.ts.map +1 -1
- package/dist/qna/types.d.ts +2 -2
- package/dist/qna/types.d.ts.map +1 -1
- package/dist/qna.cjs +1 -1
- package/dist/qna.cjs.map +1 -1
- package/dist/qna.css +1 -1
- package/dist/qna.iife.js +7 -7
- package/dist/qna.iife.js.map +1 -1
- package/dist/qna.js +14 -14
- package/dist/qna.js.map +1 -1
- package/dist/quantity-stepper-BKtPQUR1.js +78 -0
- package/dist/quantity-stepper-BKtPQUR1.js.map +1 -0
- package/dist/quantity-stepper-DU6va4sS.cjs +2 -0
- package/dist/quantity-stepper-DU6va4sS.cjs.map +1 -0
- package/dist/{schemas-yF4IOEUi.js → schemas-BAEbjFPE.js} +1181 -957
- package/dist/schemas-BAEbjFPE.js.map +1 -0
- package/dist/schemas-DIyHm5pa.cjs +86 -0
- package/dist/schemas-DIyHm5pa.cjs.map +1 -0
- package/dist/simrel/api.d.ts +1 -1
- package/dist/simrel/api.d.ts.map +1 -1
- package/dist/simrel/components/GroupTabs.d.ts +1 -1
- package/dist/simrel/components/GroupTabs.d.ts.map +1 -1
- package/dist/simrel/components/ProductCard.d.ts +1 -1
- package/dist/simrel/components/ProductCard.d.ts.map +1 -1
- package/dist/simrel/components/ProductGrid.d.ts +1 -1
- package/dist/simrel/components/ProductGrid.d.ts.map +1 -1
- package/dist/simrel/index.d.ts +20 -1
- package/dist/simrel/index.d.ts.map +1 -1
- package/dist/simrel/locales/en.d.ts.map +1 -1
- package/dist/simrel/locales/tr.d.ts.map +1 -1
- package/dist/simrel/types.d.ts +2 -0
- package/dist/simrel/types.d.ts.map +1 -1
- package/dist/simrel.cjs +1 -1
- package/dist/simrel.cjs.map +1 -1
- package/dist/simrel.css +1 -1
- package/dist/simrel.iife.js +11 -11
- package/dist/simrel.iife.js.map +1 -1
- package/dist/simrel.js +281 -267
- package/dist/simrel.js.map +1 -1
- package/package.json +1 -1
- package/dist/chat/components/ProactivePopup.d.ts +0 -20
- package/dist/chat/components/ProactivePopup.d.ts.map +0 -1
- package/dist/chat/heartbeat.d.ts +0 -71
- package/dist/chat/heartbeat.d.ts.map +0 -1
- package/dist/common/v1-protocol-adapter.d.ts.map +0 -1
- package/dist/index-BqIzV4ni.cjs +0 -2
- package/dist/index-BqIzV4ni.cjs.map +0 -1
- package/dist/index-CcOJTzYu.js.map +0 -1
- package/dist/index-DZ3Mi5xF.cjs +0 -13
- package/dist/index-DZ3Mi5xF.cjs.map +0 -1
- package/dist/index-FnP8WtfG.js +0 -4571
- package/dist/index-FnP8WtfG.js.map +0 -1
- package/dist/quantity-stepper-B8kX8GbN.js +0 -209
- package/dist/quantity-stepper-B8kX8GbN.js.map +0 -1
- package/dist/quantity-stepper-UbAp53Ow.cjs +0 -2
- package/dist/quantity-stepper-UbAp53Ow.cjs.map +0 -1
- package/dist/schemas-DHzfUzwA.cjs +0 -86
- package/dist/schemas-DHzfUzwA.cjs.map +0 -1
- package/dist/schemas-yF4IOEUi.js.map +0 -1
package/dist/common.js
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { B as
|
|
3
|
-
import { i as f, s as
|
|
4
|
-
import { A as _e, a as
|
|
5
|
-
import { V as ze, i as
|
|
6
|
-
import { s as Ve } from "./quantity-stepper-B8kX8GbN.js";
|
|
1
|
+
import { a0 as h } from "./schemas-BAEbjFPE.js";
|
|
2
|
+
import { B as z, a1 as W, a as H, C as G, a2 as j, b as K, R as V, a3 as Q, a4 as J, c as X, a5 as Y, a6 as Z, j as ee, k as te, a7 as ae, a8 as ne, T as oe, m as ie, Q as se, a9 as re, q as ce, p as de, aa as le, ab as ue, r as he, Z as fe, v as ge, ac as me, X as pe, h as ye, l as ve, ad as we, g as Te, U as be, ae as Ee, w as Se, af as ke, $ as Ce, ag as Ie, ah as Ue } from "./schemas-BAEbjFPE.js";
|
|
3
|
+
import { i as f, s as g } from "./index-C6KDzSjm.js";
|
|
4
|
+
import { A as _e, a as xe, U as Pe, b as Le, c as Re, d as qe, e as De, f as Be, g as Oe, h as Fe, j as Ne, p as Me } from "./index-C6KDzSjm.js";
|
|
5
|
+
import { V as ze, i as We, r as He } from "./index-RmQRBt6w.js";
|
|
7
6
|
import "./qna.js";
|
|
8
7
|
import "./simrel.js";
|
|
9
|
-
const
|
|
8
|
+
const m = {
|
|
10
9
|
enabled: !0,
|
|
11
10
|
endpoint: "/analytics",
|
|
12
11
|
fireAndForget: !0,
|
|
13
12
|
useBeacon: !0,
|
|
14
13
|
keepaliveFetch: !0,
|
|
15
14
|
timeoutMs: 4e3,
|
|
16
|
-
maxRetries:
|
|
15
|
+
maxRetries: 0,
|
|
17
16
|
batchSize: 10,
|
|
18
17
|
flushIntervalMs: 250
|
|
19
18
|
}, p = {
|
|
@@ -25,14 +24,14 @@ const g = {
|
|
|
25
24
|
class y {
|
|
26
25
|
constructor(t) {
|
|
27
26
|
this.queue = [], this.flushTimer = null, this.config = {
|
|
28
|
-
...
|
|
27
|
+
...m,
|
|
29
28
|
...t,
|
|
30
29
|
auth: {
|
|
31
30
|
...p,
|
|
32
31
|
...t.auth ?? {}
|
|
33
32
|
}
|
|
34
33
|
}, this.onPageHideBound = () => {
|
|
35
|
-
this.queue.length !== 0 && this.
|
|
34
|
+
this.queue.length !== 0 && this.flushAllSync();
|
|
36
35
|
}, typeof window < "u" && window.addEventListener("pagehide", this.onPageHideBound);
|
|
37
36
|
}
|
|
38
37
|
track(t) {
|
|
@@ -44,18 +43,18 @@ class y {
|
|
|
44
43
|
}
|
|
45
44
|
this.scheduleFlush();
|
|
46
45
|
}
|
|
47
|
-
|
|
46
|
+
flush() {
|
|
48
47
|
if (!this.config.enabled || this.queue.length === 0) return;
|
|
49
|
-
const
|
|
50
|
-
|
|
48
|
+
const t = this.queue.splice(0, this.config.batchSize), a = this.buildTransportBody(t), n = d(this.config.endpoint, this.config.middlewareUrl);
|
|
49
|
+
this.send(n, a);
|
|
51
50
|
}
|
|
52
|
-
/** Drain the entire queue
|
|
53
|
-
|
|
51
|
+
/** Drain the entire queue synchronously (used on page hide). */
|
|
52
|
+
flushAll() {
|
|
54
53
|
for (; this.queue.length > 0; )
|
|
55
|
-
|
|
54
|
+
this.flush();
|
|
56
55
|
}
|
|
57
56
|
destroy() {
|
|
58
|
-
this.flushTimer && (clearTimeout(this.flushTimer), this.flushTimer = null), this.queue.length > 0 && this.
|
|
57
|
+
this.flushTimer && (clearTimeout(this.flushTimer), this.flushTimer = null), this.queue.length > 0 && this.flushAllSync(), typeof window < "u" && window.removeEventListener("pagehide", this.onPageHideBound);
|
|
59
58
|
}
|
|
60
59
|
scheduleFlush() {
|
|
61
60
|
this.flushTimer || (this.flushTimer = setTimeout(() => {
|
|
@@ -69,43 +68,45 @@ class y {
|
|
|
69
68
|
const a = { events: t };
|
|
70
69
|
return this.config.auth.mode === "body-api-key" && this.config.auth.key && (a[this.config.auth.bodyField] = this.config.auth.key), a;
|
|
71
70
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
for (; o <= this.config.maxRetries; ) {
|
|
75
|
-
o += 1;
|
|
76
|
-
try {
|
|
77
|
-
if (await this.send(t, a, n)) return;
|
|
78
|
-
} catch {
|
|
79
|
-
}
|
|
80
|
-
o <= this.config.maxRetries && await new Promise((r) => setTimeout(r, Math.min(1e3, 100 * Math.pow(2, o - 1))));
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
async send(t, a, n) {
|
|
84
|
-
const o = JSON.stringify(a);
|
|
85
|
-
if (n && this.config.useBeacon && this.config.auth.mode !== "x-api-key-header" && this.config.auth.mode !== "bearer-header" && T()) {
|
|
86
|
-
const d = new Blob([o], { type: "application/json" });
|
|
87
|
-
if (navigator.sendBeacon(t, d)) return !0;
|
|
88
|
-
}
|
|
89
|
-
if (typeof fetch > "u") return !1;
|
|
90
|
-
const i = {
|
|
91
|
-
"Content-Type": "application/json"
|
|
92
|
-
};
|
|
93
|
-
this.config.auth.mode === "x-api-key-header" && this.config.auth.key && (i[this.config.auth.headerName] = this.config.auth.key), this.config.auth.mode === "bearer-header" && this.config.auth.key && (i.Authorization = `Bearer ${this.config.auth.key}`);
|
|
94
|
-
const s = typeof AbortController < "u" ? new AbortController() : null, c = s ? setTimeout(() => s.abort(), this.config.timeoutMs) : null;
|
|
71
|
+
/** Best-effort send — all errors silently suppressed. */
|
|
72
|
+
send(t, a) {
|
|
95
73
|
try {
|
|
96
|
-
const
|
|
74
|
+
const n = JSON.stringify(a);
|
|
75
|
+
if (this.config.useBeacon && this.config.auth.mode !== "x-api-key-header" && this.config.auth.mode !== "bearer-header" && l()) {
|
|
76
|
+
const o = new Blob([n], { type: "application/json" });
|
|
77
|
+
navigator.sendBeacon(t, o);
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
if (typeof fetch > "u") return;
|
|
81
|
+
const i = { "Content-Type": "application/json" };
|
|
82
|
+
this.config.auth.mode === "x-api-key-header" && this.config.auth.key && (i[this.config.auth.headerName] = this.config.auth.key), this.config.auth.mode === "bearer-header" && this.config.auth.key && (i.Authorization = `Bearer ${this.config.auth.key}`), fetch(t, {
|
|
97
83
|
method: "POST",
|
|
98
84
|
headers: i,
|
|
99
|
-
body:
|
|
100
|
-
keepalive:
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
}
|
|
104
|
-
|
|
85
|
+
body: n,
|
|
86
|
+
keepalive: !0
|
|
87
|
+
}).catch(() => {
|
|
88
|
+
});
|
|
89
|
+
} catch {
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
/** Synchronous flush using sendBeacon only (for page unload). */
|
|
93
|
+
flushAllSync() {
|
|
94
|
+
if (!this.config.enabled) return;
|
|
95
|
+
const t = d(this.config.endpoint, this.config.middlewareUrl);
|
|
96
|
+
for (; this.queue.length > 0; ) {
|
|
97
|
+
const a = this.queue.splice(0, this.config.batchSize), n = this.buildTransportBody(a);
|
|
98
|
+
try {
|
|
99
|
+
const i = JSON.stringify(n);
|
|
100
|
+
if (l()) {
|
|
101
|
+
const o = new Blob([i], { type: "application/json" });
|
|
102
|
+
navigator.sendBeacon(t, o);
|
|
103
|
+
}
|
|
104
|
+
} catch {
|
|
105
|
+
}
|
|
105
106
|
}
|
|
106
107
|
}
|
|
107
108
|
}
|
|
108
|
-
function
|
|
109
|
+
function P(e) {
|
|
109
110
|
return new y(e);
|
|
110
111
|
}
|
|
111
112
|
function v(e) {
|
|
@@ -120,15 +121,15 @@ function v(e) {
|
|
|
120
121
|
};
|
|
121
122
|
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;
|
|
122
123
|
}
|
|
123
|
-
function
|
|
124
|
+
function d(e, t) {
|
|
124
125
|
if (/^https?:\/\//i.test(e)) return e;
|
|
125
126
|
const a = h(t), n = e.startsWith("/") ? e : `/${e}`;
|
|
126
127
|
return `${a}${n}`;
|
|
127
128
|
}
|
|
128
|
-
function
|
|
129
|
+
function l() {
|
|
129
130
|
return typeof navigator < "u" && typeof navigator.sendBeacon == "function";
|
|
130
131
|
}
|
|
131
|
-
const
|
|
132
|
+
const w = {
|
|
132
133
|
primaryColor: "#000000",
|
|
133
134
|
primaryForeground: "#ffffff",
|
|
134
135
|
backgroundColor: "#ffffff",
|
|
@@ -153,29 +154,29 @@ const E = {
|
|
|
153
154
|
"--gengage-qna-input-radius": "14px",
|
|
154
155
|
"--gengage-simrel-card-radius": "14px"
|
|
155
156
|
};
|
|
156
|
-
function
|
|
157
|
-
return { ...
|
|
157
|
+
function L(e) {
|
|
158
|
+
return { ...w, ...e };
|
|
158
159
|
}
|
|
159
|
-
const
|
|
160
|
-
function
|
|
160
|
+
const u = "tr";
|
|
161
|
+
function R(e) {
|
|
161
162
|
return {
|
|
162
163
|
ACCOUNT_ID: e.accountId,
|
|
163
164
|
MIDDLEWARE_URL: e.middlewareUrl,
|
|
164
|
-
LOCALE: e.locale ??
|
|
165
|
+
LOCALE: e.locale ?? u
|
|
165
166
|
};
|
|
166
167
|
}
|
|
167
|
-
function
|
|
168
|
+
function q(e, t = {}) {
|
|
168
169
|
const a = {
|
|
169
170
|
accountId: e.accountId,
|
|
170
171
|
middlewareUrl: e.middlewareUrl,
|
|
171
172
|
session: { sessionId: e.sessionId },
|
|
172
173
|
variant: "floating",
|
|
173
|
-
locale: e.locale ??
|
|
174
|
+
locale: e.locale ?? u,
|
|
174
175
|
...t
|
|
175
176
|
};
|
|
176
177
|
return e.theme !== void 0 && (a.theme = e.theme), a;
|
|
177
178
|
}
|
|
178
|
-
function
|
|
179
|
+
function D(e, t = {}) {
|
|
179
180
|
const a = {
|
|
180
181
|
accountId: e.accountId,
|
|
181
182
|
middlewareUrl: e.middlewareUrl,
|
|
@@ -186,7 +187,7 @@ function F(e, t = {}) {
|
|
|
186
187
|
};
|
|
187
188
|
return e.theme !== void 0 && (a.theme = e.theme), a;
|
|
188
189
|
}
|
|
189
|
-
function
|
|
190
|
+
function B(e, t = {}) {
|
|
190
191
|
const a = {
|
|
191
192
|
accountId: e.accountId,
|
|
192
193
|
middlewareUrl: e.middlewareUrl,
|
|
@@ -207,67 +208,67 @@ function O(e, t = {}) {
|
|
|
207
208
|
...t
|
|
208
209
|
};
|
|
209
210
|
}
|
|
210
|
-
function
|
|
211
|
+
function T(e) {
|
|
211
212
|
try {
|
|
212
213
|
return document.querySelector(e), !0;
|
|
213
214
|
} catch {
|
|
214
215
|
return !1;
|
|
215
216
|
}
|
|
216
217
|
}
|
|
217
|
-
function
|
|
218
|
-
const a = [], n = e.mounts,
|
|
218
|
+
function b(e, t) {
|
|
219
|
+
const a = [], n = e.mounts, i = [
|
|
219
220
|
["qna", n.qna],
|
|
220
221
|
["simrel", n.simrel],
|
|
221
222
|
["chat", n.chat]
|
|
222
223
|
];
|
|
223
|
-
for (const [
|
|
224
|
-
if (
|
|
225
|
-
if (!
|
|
224
|
+
for (const [s, r] of i)
|
|
225
|
+
if (r !== void 0) {
|
|
226
|
+
if (!T(r)) {
|
|
226
227
|
a.push({
|
|
227
228
|
code: "INVALID_SELECTOR",
|
|
228
|
-
message: `[gengage preflight] ${
|
|
229
|
+
message: `[gengage preflight] ${s} mount selector is invalid CSS: "${r}"`,
|
|
229
230
|
severity: "error"
|
|
230
231
|
});
|
|
231
232
|
continue;
|
|
232
233
|
}
|
|
233
|
-
document.querySelector(
|
|
234
|
+
document.querySelector(r) || a.push({
|
|
234
235
|
code: "MOUNT_NOT_FOUND",
|
|
235
|
-
message: `[gengage preflight] ${
|
|
236
|
+
message: `[gengage preflight] ${s} mount target not found: "${r}" — widget will skip or wait for DOM`,
|
|
236
237
|
severity: "warn"
|
|
237
238
|
});
|
|
238
239
|
}
|
|
239
|
-
const
|
|
240
|
-
if (window[
|
|
240
|
+
const o = e.gtm.idempotencyKey;
|
|
241
|
+
if (window[o] !== void 0 && a.push({
|
|
241
242
|
code: "DUPLICATE_IDEMPOTENCY",
|
|
242
|
-
message: `[gengage preflight] window["${
|
|
243
|
+
message: `[gengage preflight] window["${o}"] already exists — widgets may have already initialized`,
|
|
243
244
|
severity: "warn"
|
|
244
245
|
}), !t?.skipCspCheck) {
|
|
245
|
-
let
|
|
246
|
-
const
|
|
247
|
-
c.blockedURI && e.middlewareUrl.startsWith(c.blockedURI) && (
|
|
246
|
+
let s = !1;
|
|
247
|
+
const r = (c) => {
|
|
248
|
+
c.blockedURI && e.middlewareUrl.startsWith(c.blockedURI) && (s = !0);
|
|
248
249
|
};
|
|
249
|
-
document.addEventListener("securitypolicyviolation",
|
|
250
|
+
document.addEventListener("securitypolicyviolation", r);
|
|
250
251
|
try {
|
|
251
252
|
fetch(e.middlewareUrl, { method: "HEAD", mode: "no-cors" }).catch(() => {
|
|
252
253
|
});
|
|
253
254
|
} catch {
|
|
254
|
-
|
|
255
|
+
s = !0;
|
|
255
256
|
}
|
|
256
|
-
document.removeEventListener("securitypolicyviolation",
|
|
257
|
+
document.removeEventListener("securitypolicyviolation", r), s && a.push({
|
|
257
258
|
code: "CSP_BLOCKED",
|
|
258
259
|
message: `[gengage preflight] middleware URL may be blocked by Content-Security-Policy: "${e.middlewareUrl}". Add it to connect-src.`,
|
|
259
260
|
severity: "warn"
|
|
260
261
|
});
|
|
261
262
|
}
|
|
262
|
-
for (const
|
|
263
|
-
|
|
263
|
+
for (const s of a)
|
|
264
|
+
s.severity === "error" ? console.error(s.message) : console.warn(s.message);
|
|
264
265
|
return {
|
|
265
|
-
ok: a.every((
|
|
266
|
+
ok: a.every((s) => s.severity !== "error"),
|
|
266
267
|
warnings: a
|
|
267
268
|
};
|
|
268
269
|
}
|
|
269
|
-
function
|
|
270
|
-
const t =
|
|
270
|
+
function E(e) {
|
|
271
|
+
const t = g(e);
|
|
271
272
|
if (!t.success) {
|
|
272
273
|
const a = t.error.issues.map((n) => `${n.path.join(".")}: ${n.message}`).join("; ");
|
|
273
274
|
throw new Error(`[gengage] Invalid runtime config: ${a}`);
|
|
@@ -288,30 +289,30 @@ function S(e, t, a) {
|
|
|
288
289
|
enabled: e.widgets.simrel.enabled
|
|
289
290
|
}, e.mounts.simrel !== void 0 && (n.simrel.mountTarget = e.mounts.simrel), t?.onAddToCart !== void 0 && (n.onAddToCart = t.onAddToCart), t?.onProductNavigate !== void 0 && (n.onProductNavigate = t.onProductNavigate), t?.onScriptCall !== void 0 && (n.onScriptCall = t.onScriptCall), n;
|
|
290
291
|
}
|
|
291
|
-
async function
|
|
292
|
-
const t =
|
|
292
|
+
async function F(e) {
|
|
293
|
+
const t = E(e.runtimeConfig);
|
|
293
294
|
if (e.preflight !== !1) {
|
|
294
|
-
const
|
|
295
|
-
if (!
|
|
296
|
-
const
|
|
297
|
-
throw new Error(`[gengage] Preflight failed: ${
|
|
295
|
+
const o = b(t);
|
|
296
|
+
if (!o.ok) {
|
|
297
|
+
const s = o.warnings.filter((r) => r.severity === "error");
|
|
298
|
+
throw new Error(`[gengage] Preflight failed: ${s.map((r) => r.message).join("; ")}`);
|
|
298
299
|
}
|
|
299
300
|
}
|
|
300
|
-
const a = e.contextResolver?.(), n = S(t, e.hostActions, a),
|
|
301
|
+
const a = e.contextResolver?.(), n = S(t, e.hostActions, a), i = await f(n);
|
|
301
302
|
if (e.contextResolver !== void 0) {
|
|
302
|
-
const
|
|
303
|
-
const c =
|
|
304
|
-
|
|
303
|
+
const o = e.contextResolver, s = () => {
|
|
304
|
+
const c = o();
|
|
305
|
+
i.updateContext(c);
|
|
305
306
|
};
|
|
306
|
-
window.addEventListener("gengage:context:update",
|
|
307
|
-
const
|
|
308
|
-
|
|
309
|
-
window.removeEventListener("gengage:context:update",
|
|
307
|
+
window.addEventListener("gengage:context:update", s);
|
|
308
|
+
const r = i.destroy.bind(i);
|
|
309
|
+
i.destroy = () => {
|
|
310
|
+
window.removeEventListener("gengage:context:update", s), r();
|
|
310
311
|
};
|
|
311
312
|
}
|
|
312
|
-
return
|
|
313
|
+
return i;
|
|
313
314
|
}
|
|
314
|
-
const
|
|
315
|
+
const k = [
|
|
315
316
|
{
|
|
316
317
|
pageType: "home",
|
|
317
318
|
urlPatterns: ["^/$", "^/index\\.html?$", "^/anasayfa$"]
|
|
@@ -334,110 +335,110 @@ const A = [
|
|
|
334
335
|
urlPatterns: ["/urun/", "/product/", "/p/", "/-p-", "/-pm-"]
|
|
335
336
|
}
|
|
336
337
|
];
|
|
337
|
-
function
|
|
338
|
+
function C(e, t) {
|
|
338
339
|
const a = t ?? (typeof window < "u" ? new URL(window.location.href) : null);
|
|
339
340
|
if (!a) return "other";
|
|
340
|
-
const n = e ??
|
|
341
|
-
for (const
|
|
342
|
-
if (!(
|
|
341
|
+
const n = e ?? k, i = a.pathname;
|
|
342
|
+
for (const o of n)
|
|
343
|
+
if (!(o.urlPatterns && !o.urlPatterns.some((r) => {
|
|
343
344
|
try {
|
|
344
|
-
return new RegExp(
|
|
345
|
+
return new RegExp(r, "i").test(i);
|
|
345
346
|
} catch {
|
|
346
347
|
return !1;
|
|
347
348
|
}
|
|
348
|
-
})) && !(
|
|
349
|
-
return
|
|
349
|
+
})) && !(o.queryParam && !a.searchParams.has(o.queryParam)) && !(o.selector && typeof document < "u" && !document.querySelector(o.selector)))
|
|
350
|
+
return o.pageType;
|
|
350
351
|
return "other";
|
|
351
352
|
}
|
|
352
|
-
function
|
|
353
|
+
function I(e) {
|
|
353
354
|
const t = e ?? (typeof window < "u" ? new URL(window.location.href) : null);
|
|
354
355
|
if (!t) return;
|
|
355
356
|
const a = t.pathname, n = a.match(/\/(?:p|urun|product)\/([^/?#]+)/i);
|
|
356
357
|
if (n?.[1]) return n[1];
|
|
357
|
-
const
|
|
358
|
-
if (
|
|
358
|
+
const i = a.match(/-p-(\d+)/i);
|
|
359
|
+
if (i?.[1]) return i[1];
|
|
359
360
|
}
|
|
360
|
-
function
|
|
361
|
-
const t =
|
|
361
|
+
function N(e) {
|
|
362
|
+
const t = C(e), a = { pageType: t };
|
|
362
363
|
if (t === "pdp") {
|
|
363
|
-
const n =
|
|
364
|
+
const n = I();
|
|
364
365
|
n && (a.sku = n);
|
|
365
366
|
}
|
|
366
367
|
return typeof window < "u" && (a.url = window.location.href), a;
|
|
367
368
|
}
|
|
368
369
|
export {
|
|
369
370
|
_e as AccountRuntimeConfigSchema,
|
|
370
|
-
|
|
371
|
+
xe as AnalyticsAuthModeSchema,
|
|
371
372
|
y as AnalyticsClient,
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
373
|
+
w as BASE_WIDGET_THEME,
|
|
374
|
+
z as BaseWidget,
|
|
375
|
+
u as DEFAULT_CUSTOMIZATION_LOCALE,
|
|
376
|
+
W as DEFAULT_WIDGET_THEME_TOKENS,
|
|
377
|
+
Pe as UnknownActionPolicySchema,
|
|
377
378
|
ze as VoiceInput,
|
|
378
|
-
|
|
379
|
+
H as adaptBackendEvent,
|
|
379
380
|
Le as applyNativeSession,
|
|
380
|
-
|
|
381
|
-
|
|
381
|
+
N as autoDetectPageContext,
|
|
382
|
+
G as basketAddEvent,
|
|
382
383
|
j as bootstrapSession,
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
384
|
+
K as buildChatEndpointUrl,
|
|
385
|
+
Re as buildOverlayIdempotencyKey,
|
|
386
|
+
V as chatHistorySnapshotEvent,
|
|
387
|
+
Q as checkoutCompleteEvent,
|
|
388
|
+
J as checkoutStartEvent,
|
|
389
|
+
X as consumeStream,
|
|
390
|
+
R as createAccountIdentity,
|
|
391
|
+
P as createAnalyticsClient,
|
|
391
392
|
qe as createDefaultAccountRuntimeConfig,
|
|
392
393
|
O as createDefaultAnalyticsConfig,
|
|
393
|
-
|
|
394
|
+
q as createFloatingChatConfig,
|
|
394
395
|
De as createNativeWebViewBridge,
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
396
|
+
D as createPdpQnaConfig,
|
|
397
|
+
B as createPdpSimRelConfig,
|
|
398
|
+
Y as defaultUnknownUISpecRenderer,
|
|
399
|
+
Be as destroyOverlayWidgets,
|
|
400
|
+
Oe as detectNativeEnvironment,
|
|
401
|
+
C as detectPageType,
|
|
402
|
+
Z as dismissGlobalErrorToast,
|
|
403
|
+
ee as dispatch,
|
|
404
|
+
I as extractSkuFromUrl,
|
|
405
|
+
te as getGlobalErrorMessage,
|
|
406
|
+
Fe as getOverlayWidgets,
|
|
407
|
+
ae as getWindowPageContext,
|
|
408
|
+
F as initGengageClient,
|
|
409
|
+
Ne as initNativeOverlayWidgets,
|
|
409
410
|
f as initOverlayWidgets,
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
411
|
+
We as isVoiceInputSupported,
|
|
412
|
+
ne as listen,
|
|
413
|
+
oe as llmUsageEvent,
|
|
414
|
+
ie as mergeUISpecRegistry,
|
|
415
|
+
se as meteringIncrementEvent,
|
|
416
|
+
re as meteringSummaryEvent,
|
|
416
417
|
h as normalizeMiddlewareUrl,
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
418
|
+
ce as normalizeProductGroupingsResponse,
|
|
419
|
+
de as normalizeSimilarProductsResponse,
|
|
420
|
+
Me as parseAccountRuntimeConfig,
|
|
421
|
+
b as preflightDiagnostics,
|
|
422
|
+
le as productToNormalized,
|
|
423
|
+
ue as registerGlobalErrorToastListener,
|
|
424
|
+
he as renderUISpecWithRegistry,
|
|
425
|
+
fe as resolveSession,
|
|
426
|
+
He as routeStreamAction,
|
|
427
|
+
g as safeParseAccountRuntimeConfig,
|
|
428
|
+
ge as sanitizeHtml,
|
|
429
|
+
me as showGlobalErrorToast,
|
|
430
|
+
pe as streamChunkEvent,
|
|
431
|
+
ye as streamDoneEvent,
|
|
432
|
+
ve as streamErrorEvent,
|
|
433
|
+
we as streamPost,
|
|
434
|
+
Te as streamStartEvent,
|
|
434
435
|
be as streamUiSpecEvent,
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
436
|
+
Ee as updatePageContext,
|
|
437
|
+
Se as widgetHistorySnapshotEvent,
|
|
438
|
+
ke as wireGADataLayer,
|
|
439
|
+
Ce as wireQNAToChat,
|
|
439
440
|
Ie as wireSimilarToChat,
|
|
440
|
-
|
|
441
|
+
L as withBaseTheme,
|
|
441
442
|
Ue as withDefaultWidgetTheme
|
|
442
443
|
};
|
|
443
444
|
//# sourceMappingURL=common.js.map
|