@gengage/assistant-fe 0.1.7 → 0.1.9

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.
Files changed (134) hide show
  1. package/README.md +80 -282
  2. package/dist/assistant-fe.css +1 -1
  3. package/dist/chat/api.d.ts +1 -12
  4. package/dist/chat/api.d.ts.map +1 -1
  5. package/dist/chat/components/ChatDrawer.d.ts +15 -1
  6. package/dist/chat/components/ChatDrawer.d.ts.map +1 -1
  7. package/dist/chat/components/ChoicePrompter.d.ts +1 -0
  8. package/dist/chat/components/ChoicePrompter.d.ts.map +1 -1
  9. package/dist/chat/components/ComparisonTable.d.ts +5 -3
  10. package/dist/chat/components/ComparisonTable.d.ts.map +1 -1
  11. package/dist/chat/components/PanelTopBar.d.ts +2 -0
  12. package/dist/chat/components/PanelTopBar.d.ts.map +1 -1
  13. package/dist/chat/components/ProductSummaryCard.d.ts.map +1 -1
  14. package/dist/chat/components/ReviewHighlights.d.ts +3 -0
  15. package/dist/chat/components/ReviewHighlights.d.ts.map +1 -1
  16. package/dist/chat/components/renderUISpec.d.ts +0 -5
  17. package/dist/chat/components/renderUISpec.d.ts.map +1 -1
  18. package/dist/chat/index.d.ts +18 -9
  19. package/dist/chat/index.d.ts.map +1 -1
  20. package/dist/chat/locales/en.d.ts.map +1 -1
  21. package/dist/chat/locales/tr.d.ts.map +1 -1
  22. package/dist/chat/session-persistence.d.ts +3 -0
  23. package/dist/chat/session-persistence.d.ts.map +1 -1
  24. package/dist/chat/types.d.ts +23 -25
  25. package/dist/chat/types.d.ts.map +1 -1
  26. package/dist/chat.cjs +1 -1
  27. package/dist/chat.iife.js +24 -24
  28. package/dist/chat.iife.js.map +1 -1
  29. package/dist/chat.js +8 -9
  30. package/dist/chat.js.map +1 -1
  31. package/dist/common/action-router.d.ts.map +1 -1
  32. package/dist/common/activity-tracker.d.ts +1 -1
  33. package/dist/common/analytics.d.ts +12 -8
  34. package/dist/common/analytics.d.ts.map +1 -1
  35. package/dist/common/api-paths.d.ts +2 -5
  36. package/dist/common/api-paths.d.ts.map +1 -1
  37. package/dist/common/config-schema.d.ts.map +1 -1
  38. package/dist/common/debug.d.ts +14 -0
  39. package/dist/common/debug.d.ts.map +1 -0
  40. package/dist/common/events.d.ts.map +1 -1
  41. package/dist/common/index.d.ts +2 -2
  42. package/dist/common/index.d.ts.map +1 -1
  43. package/dist/common/overlay.d.ts +19 -0
  44. package/dist/common/overlay.d.ts.map +1 -1
  45. package/dist/common/{v1-protocol-adapter.d.ts → protocol-adapter.d.ts} +2 -2
  46. package/dist/common/protocol-adapter.d.ts.map +1 -0
  47. package/dist/common/quantity-stepper.d.ts +10 -10
  48. package/dist/common/quantity-stepper.d.ts.map +1 -1
  49. package/dist/common/safe-html.d.ts.map +1 -1
  50. package/dist/common/streaming.d.ts.map +1 -1
  51. package/dist/common/tts-player.d.ts +2 -0
  52. package/dist/common/tts-player.d.ts.map +1 -1
  53. package/dist/common/types.d.ts +1 -1
  54. package/dist/common/voice-input.d.ts +1 -0
  55. package/dist/common/voice-input.d.ts.map +1 -1
  56. package/dist/common/widget-base.d.ts.map +1 -1
  57. package/dist/common.cjs +1 -1
  58. package/dist/common.cjs.map +1 -1
  59. package/dist/common.js +173 -172
  60. package/dist/common.js.map +1 -1
  61. package/dist/index-BWPx4pM7.cjs +13 -0
  62. package/dist/index-BWPx4pM7.cjs.map +1 -0
  63. package/dist/index-CEt87kCd.js +4463 -0
  64. package/dist/index-CEt87kCd.js.map +1 -0
  65. package/dist/index-DL4CAkyL.cjs +2 -0
  66. package/dist/index-DL4CAkyL.cjs.map +1 -0
  67. package/dist/{index-BH-V2lWn.js → index-DR2uepzb.js} +108 -106
  68. package/dist/index-DR2uepzb.js.map +1 -0
  69. package/dist/index.cjs +1 -1
  70. package/dist/index.js +16 -16
  71. package/dist/native.cjs +1 -1
  72. package/dist/native.iife.js +18 -18
  73. package/dist/native.iife.js.map +1 -1
  74. package/dist/native.js +1 -1
  75. package/dist/qna/index.d.ts +19 -0
  76. package/dist/qna/index.d.ts.map +1 -1
  77. package/dist/qna/types.d.ts +2 -2
  78. package/dist/qna/types.d.ts.map +1 -1
  79. package/dist/qna.cjs +1 -1
  80. package/dist/qna.cjs.map +1 -1
  81. package/dist/qna.css +1 -1
  82. package/dist/qna.iife.js +7 -7
  83. package/dist/qna.iife.js.map +1 -1
  84. package/dist/qna.js +14 -14
  85. package/dist/qna.js.map +1 -1
  86. package/dist/quantity-stepper-C-nV4lwi.js +77 -0
  87. package/dist/quantity-stepper-C-nV4lwi.js.map +1 -0
  88. package/dist/quantity-stepper-CURMkwRF.cjs +2 -0
  89. package/dist/quantity-stepper-CURMkwRF.cjs.map +1 -0
  90. package/dist/{schemas-yF4IOEUi.js → schemas-DIhL3DkL.js} +1166 -947
  91. package/dist/schemas-DIhL3DkL.js.map +1 -0
  92. package/dist/schemas-Dsr0bbO_.cjs +86 -0
  93. package/dist/schemas-Dsr0bbO_.cjs.map +1 -0
  94. package/dist/simrel/api.d.ts +1 -1
  95. package/dist/simrel/api.d.ts.map +1 -1
  96. package/dist/simrel/components/GroupTabs.d.ts +1 -1
  97. package/dist/simrel/components/GroupTabs.d.ts.map +1 -1
  98. package/dist/simrel/components/ProductCard.d.ts +1 -1
  99. package/dist/simrel/components/ProductCard.d.ts.map +1 -1
  100. package/dist/simrel/components/ProductGrid.d.ts +1 -1
  101. package/dist/simrel/components/ProductGrid.d.ts.map +1 -1
  102. package/dist/simrel/index.d.ts +20 -1
  103. package/dist/simrel/index.d.ts.map +1 -1
  104. package/dist/simrel/locales/en.d.ts.map +1 -1
  105. package/dist/simrel/locales/tr.d.ts.map +1 -1
  106. package/dist/simrel/types.d.ts +1 -0
  107. package/dist/simrel/types.d.ts.map +1 -1
  108. package/dist/simrel.cjs +1 -1
  109. package/dist/simrel.cjs.map +1 -1
  110. package/dist/simrel.css +1 -1
  111. package/dist/simrel.iife.js +11 -11
  112. package/dist/simrel.iife.js.map +1 -1
  113. package/dist/simrel.js +123 -111
  114. package/dist/simrel.js.map +1 -1
  115. package/package.json +1 -1
  116. package/dist/chat/components/ProactivePopup.d.ts +0 -20
  117. package/dist/chat/components/ProactivePopup.d.ts.map +0 -1
  118. package/dist/chat/heartbeat.d.ts +0 -71
  119. package/dist/chat/heartbeat.d.ts.map +0 -1
  120. package/dist/common/v1-protocol-adapter.d.ts.map +0 -1
  121. package/dist/index-1yPxOqAw.cjs +0 -13
  122. package/dist/index-1yPxOqAw.cjs.map +0 -1
  123. package/dist/index-BH-V2lWn.js.map +0 -1
  124. package/dist/index-BelS6Vnv.cjs +0 -2
  125. package/dist/index-BelS6Vnv.cjs.map +0 -1
  126. package/dist/index-CERWfDdF.js +0 -4571
  127. package/dist/index-CERWfDdF.js.map +0 -1
  128. package/dist/quantity-stepper-B8kX8GbN.js +0 -209
  129. package/dist/quantity-stepper-B8kX8GbN.js.map +0 -1
  130. package/dist/quantity-stepper-UbAp53Ow.cjs +0 -2
  131. package/dist/quantity-stepper-UbAp53Ow.cjs.map +0 -1
  132. package/dist/schemas-DHzfUzwA.cjs +0 -86
  133. package/dist/schemas-DHzfUzwA.cjs.map +0 -1
  134. package/dist/schemas-yF4IOEUi.js.map +0 -1
package/dist/common.js CHANGED
@@ -1,19 +1,18 @@
1
- import { A as h } from "./schemas-yF4IOEUi.js";
2
- import { B as H, X as G, a as K, z as V, Y as j, b as Q, N as Y, Z as X, $ as Z, c as J, a0 as ee, a1 as te, j as ae, k as ne, a2 as oe, a3 as ie, P as re, m as se, M as ce, a4 as de, q as le, p as ue, a5 as he, a6 as fe, r as me, V as ge, a7 as pe, T as ye, h as ve, l as we, a8 as Te, g as Ee, Q as be, a9 as ke, w as Ce, aa as Se, W as Ae, ab as Ie, ac as Ue } from "./schemas-yF4IOEUi.js";
3
- import { i as f, s as m } from "./index-BH-V2lWn.js";
4
- import { A as _e, a as Pe, U as Re, b as Le, c as Be, d as qe, e as De, f as Fe, g as Ne, h as Oe, j as Me, p as $e } from "./index-BH-V2lWn.js";
5
- import { V as ze, i as He, r as Ge } from "./index-CERWfDdF.js";
6
- import { s as Ve } from "./quantity-stepper-B8kX8GbN.js";
1
+ import { a0 as h } from "./schemas-DIhL3DkL.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-DIhL3DkL.js";
3
+ import { i as f, s as g } from "./index-DR2uepzb.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-DR2uepzb.js";
5
+ import { V as ze, i as We, r as He } from "./index-CEt87kCd.js";
7
6
  import "./qna.js";
8
7
  import "./simrel.js";
9
- const g = {
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: 1,
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
- ...g,
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.flushAll({ preferBeacon: !0 });
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
- async flush(t = {}) {
46
+ flush() {
48
47
  if (!this.config.enabled || this.queue.length === 0) return;
49
- const a = this.queue.splice(0, this.config.batchSize), n = this.buildTransportBody(a), o = w(this.config.endpoint, this.config.middlewareUrl), r = t.preferBeacon ?? this.config.useBeacon;
50
- await this.sendWithRetry(o, n, r);
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, flushing in batch-sized chunks. */
53
- async flushAll(t = {}) {
51
+ /** Drain the entire queue synchronously (used on page hide). */
52
+ flushAll() {
54
53
  for (; this.queue.length > 0; )
55
- await this.flush(t);
54
+ this.flush();
56
55
  }
57
56
  destroy() {
58
- this.flushTimer && (clearTimeout(this.flushTimer), this.flushTimer = null), this.queue.length > 0 && this.flushAll({ preferBeacon: !0 }), typeof window < "u" && window.removeEventListener("pagehide", this.onPageHideBound);
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
- async sendWithRetry(t, a, n) {
73
- let o = 0;
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 d = {
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: o,
100
- keepalive: this.config.keepaliveFetch && this.config.fireAndForget
101
- };
102
- return s && (d.signal = s.signal), (await fetch(t, d)).ok;
103
- } finally {
104
- c && clearTimeout(c);
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 L(e) {
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 w(e, t) {
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 T() {
129
+ function l() {
129
130
  return typeof navigator < "u" && typeof navigator.sendBeacon == "function";
130
131
  }
131
- const E = {
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 B(e) {
157
- return { ...E, ...e };
157
+ function L(e) {
158
+ return { ...w, ...e };
158
159
  }
159
- const l = "tr";
160
- function q(e) {
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 ?? l
165
+ LOCALE: e.locale ?? u
165
166
  };
166
167
  }
167
- function D(e, t = {}) {
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 ?? l,
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 F(e, t = {}) {
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 N(e, t = {}) {
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 b(e) {
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 k(e, t) {
218
- const a = [], n = e.mounts, o = [
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 [i, s] of o)
224
- if (s !== void 0) {
225
- if (!b(s)) {
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] ${i} mount selector is invalid CSS: "${s}"`,
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(s) || a.push({
234
+ document.querySelector(r) || a.push({
234
235
  code: "MOUNT_NOT_FOUND",
235
- message: `[gengage preflight] ${i} mount target not found: "${s}" — widget will skip or wait for DOM`,
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 r = e.gtm.idempotencyKey;
240
- if (window[r] !== void 0 && a.push({
240
+ const o = e.gtm.idempotencyKey;
241
+ if (window[o] !== void 0 && a.push({
241
242
  code: "DUPLICATE_IDEMPOTENCY",
242
- message: `[gengage preflight] window["${r}"] already exists — widgets may have already initialized`,
243
+ message: `[gengage preflight] window["${o}"] already exists — widgets may have already initialized`,
243
244
  severity: "warn"
244
245
  }), !t?.skipCspCheck) {
245
- let i = !1;
246
- const s = (c) => {
247
- c.blockedURI && e.middlewareUrl.startsWith(c.blockedURI) && (i = !0);
246
+ let s = !1;
247
+ const r = (c) => {
248
+ c.blockedURI && e.middlewareUrl.startsWith(c.blockedURI) && (s = !0);
248
249
  };
249
- document.addEventListener("securitypolicyviolation", s);
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
- i = !0;
255
+ s = !0;
255
256
  }
256
- document.removeEventListener("securitypolicyviolation", s), i && a.push({
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 i of a)
263
- i.severity === "error" ? console.error(i.message) : console.warn(i.message);
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((i) => i.severity !== "error"),
266
+ ok: a.every((s) => s.severity !== "error"),
266
267
  warnings: a
267
268
  };
268
269
  }
269
- function C(e) {
270
- const t = m(e);
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 M(e) {
292
- const t = C(e.runtimeConfig);
292
+ async function F(e) {
293
+ const t = E(e.runtimeConfig);
293
294
  if (e.preflight !== !1) {
294
- const r = k(t);
295
- if (!r.ok) {
296
- const i = r.warnings.filter((s) => s.severity === "error");
297
- throw new Error(`[gengage] Preflight failed: ${i.map((s) => s.message).join("; ")}`);
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), o = await f(n);
301
+ const a = e.contextResolver?.(), n = S(t, e.hostActions, a), i = await f(n);
301
302
  if (e.contextResolver !== void 0) {
302
- const r = e.contextResolver, i = () => {
303
- const c = r();
304
- o.updateContext(c);
303
+ const o = e.contextResolver, s = () => {
304
+ const c = o();
305
+ i.updateContext(c);
305
306
  };
306
- window.addEventListener("gengage:context:update", i);
307
- const s = o.destroy.bind(o);
308
- o.destroy = () => {
309
- window.removeEventListener("gengage:context:update", i), s();
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 o;
313
+ return i;
313
314
  }
314
- const A = [
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 I(e, t) {
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 ?? A, o = a.pathname;
341
- for (const r of n)
342
- if (!(r.urlPatterns && !r.urlPatterns.some((s) => {
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(s, "i").test(o);
345
+ return new RegExp(r, "i").test(i);
345
346
  } catch {
346
347
  return !1;
347
348
  }
348
- })) && !(r.queryParam && !a.searchParams.has(r.queryParam)) && !(r.selector && typeof document < "u" && !document.querySelector(r.selector)))
349
- return r.pageType;
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 U(e) {
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 o = a.match(/-p-(\d+)/i);
358
- if (o?.[1]) return o[1];
358
+ const i = a.match(/-p-(\d+)/i);
359
+ if (i?.[1]) return i[1];
359
360
  }
360
- function $(e) {
361
- const t = I(e), a = { pageType: t };
361
+ function N(e) {
362
+ const t = C(e), a = { pageType: t };
362
363
  if (t === "pdp") {
363
- const n = U();
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
- Pe as AnalyticsAuthModeSchema,
371
+ xe as AnalyticsAuthModeSchema,
371
372
  y as AnalyticsClient,
372
- E as BASE_WIDGET_THEME,
373
- H as BaseWidget,
374
- l as DEFAULT_CUSTOMIZATION_LOCALE,
375
- G as DEFAULT_WIDGET_THEME_TOKENS,
376
- Re as UnknownActionPolicySchema,
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
- K as adaptV1Event,
379
+ H as adaptBackendEvent,
379
380
  Le as applyNativeSession,
380
- $ as autoDetectPageContext,
381
- V as basketAddEvent,
381
+ N as autoDetectPageContext,
382
+ G as basketAddEvent,
382
383
  j as bootstrapSession,
383
- Q as buildChatEndpointUrl,
384
- Be as buildOverlayIdempotencyKey,
385
- Y as chatHistorySnapshotEvent,
386
- X as checkoutCompleteEvent,
387
- Z as checkoutStartEvent,
388
- J as consumeStream,
389
- q as createAccountIdentity,
390
- L as createAnalyticsClient,
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
- D as createFloatingChatConfig,
394
+ q as createFloatingChatConfig,
394
395
  De as createNativeWebViewBridge,
395
- F as createPdpQnaConfig,
396
- N as createPdpSimRelConfig,
397
- ee as defaultUnknownUISpecRenderer,
398
- Fe as destroyOverlayWidgets,
399
- Ne as detectNativeEnvironment,
400
- I as detectPageType,
401
- te as dismissGlobalErrorToast,
402
- ae as dispatch,
403
- U as extractSkuFromUrl,
404
- ne as getGlobalErrorMessage,
405
- Oe as getOverlayWidgets,
406
- oe as getWindowPageContext,
407
- M as initGengageClient,
408
- Me as initNativeOverlayWidgets,
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
- He as isVoiceInputSupported,
411
- ie as listen,
412
- re as llmUsageEvent,
413
- se as mergeUISpecRegistry,
414
- ce as meteringIncrementEvent,
415
- de as meteringSummaryEvent,
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
- le as normalizeProductGroupingsResponse,
418
- ue as normalizeSimilarProductsResponse,
419
- $e as parseAccountRuntimeConfig,
420
- k as preflightDiagnostics,
421
- he as productToNormalized,
422
- fe as registerGlobalErrorToastListener,
423
- me as renderUISpecWithRegistry,
424
- ge as resolveSession,
425
- Ge as routeStreamAction,
426
- m as safeParseAccountRuntimeConfig,
427
- Ve as sanitizeHtml,
428
- pe as showGlobalErrorToast,
429
- ye as streamChunkEvent,
430
- ve as streamDoneEvent,
431
- we as streamErrorEvent,
432
- Te as streamPost,
433
- Ee as streamStartEvent,
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
- ke as updatePageContext,
436
- Ce as widgetHistorySnapshotEvent,
437
- Se as wireGADataLayer,
438
- Ae as wireQNAToChat,
436
+ Ee as updatePageContext,
437
+ Se as widgetHistorySnapshotEvent,
438
+ ke as wireGADataLayer,
439
+ Ce as wireQNAToChat,
439
440
  Ie as wireSimilarToChat,
440
- B as withBaseTheme,
441
+ L as withBaseTheme,
441
442
  Ue as withDefaultWidgetTheme
442
443
  };
443
444
  //# sourceMappingURL=common.js.map