@gengage/assistant-fe 0.6.50 → 0.7.1

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 (50) hide show
  1. package/dist/chat/api.d.ts +1 -1
  2. package/dist/chat/components/ChatDrawer.d.ts +4 -1
  3. package/dist/chat/features/beauty-consulting/mode-controller.d.ts +1 -1
  4. package/dist/chat/features/beauty-consulting/stream-handler.d.ts +7 -1
  5. package/dist/chat/history-storage.d.ts +36 -4
  6. package/dist/chat/runtime.d.ts +2 -2
  7. package/dist/chat/utils/chat-presentation-debug.d.ts +0 -14
  8. package/dist/chat-runtime.js +1 -1
  9. package/dist/chat.iife.js +56 -56
  10. package/dist/chat.js +1 -1
  11. package/dist/common/connection-warning.d.ts +10 -0
  12. package/dist/common/indexed-db.d.ts +35 -2
  13. package/dist/common/native-webview.d.ts +1 -1
  14. package/dist/common/streaming.d.ts +6 -1
  15. package/dist/common/transport.d.ts +2 -1
  16. package/dist/common/types.d.ts +16 -0
  17. package/dist/{common-DJFI5t11.js → common-CW6814pZ.js} +61 -65
  18. package/dist/common.js +30 -30
  19. package/dist/{connection-warning-TXqyeFaf.js → connection-warning-C0e2byq5.js} +31 -25
  20. package/dist/{fastIntent-539wPavr.js → fastIntent-CJGhUTpS.js} +2 -2
  21. package/dist/global-error-toast-DvaKvPNA.js +798 -0
  22. package/dist/index.js +29 -29
  23. package/dist/native-webview-CHKpwixw.js +303 -0
  24. package/dist/native.iife.js +27 -27
  25. package/dist/native.js +1 -1
  26. package/dist/{overlay-BPZEIyo_.js → overlay-C3XzoSKd.js} +51 -32
  27. package/dist/overlay.js +6 -6
  28. package/dist/{price-formatter-CHUmYq8I.js → price-formatter-Q3wUKrl1.js} +2 -1
  29. package/dist/qna/runtime.d.ts +1 -0
  30. package/dist/qna-runtime.js +1 -1
  31. package/dist/qna.iife.js +32 -32
  32. package/dist/qna.js +1 -1
  33. package/dist/{request-response-cache-DwADBDeB.js → request-response-cache-DItrp4fO.js} +478 -454
  34. package/dist/{runtime-9f9SB4WE.js → runtime-B9m0kyTB.js} +2796 -2697
  35. package/dist/{runtime-Do3qShrH.js → runtime-CZ363BP8.js} +231 -219
  36. package/dist/{runtime-rTw1jMhB.js → runtime-DKkw_dca.js} +230 -212
  37. package/dist/{simbut-DlWvDoPI.js → simbut-D_j8YgHS.js} +5 -5
  38. package/dist/simbut.iife.js +2 -2
  39. package/dist/simbut.js +1 -1
  40. package/dist/simrel/components/GroupTabs.d.ts +6 -0
  41. package/dist/simrel/runtime.d.ts +8 -0
  42. package/dist/{simrel-BFPU2n5p.js → simrel-BkAtQjNa.js} +15 -15
  43. package/dist/simrel-runtime.js +1 -1
  44. package/dist/simrel.iife.js +22 -22
  45. package/dist/simrel.js +2 -2
  46. package/dist/widget-base-BnUjuCt7.js +141 -0
  47. package/package.json +1 -1
  48. package/dist/context-UTzCGyR9.js +0 -543
  49. package/dist/native-webview-CYX30O3Q.js +0 -273
  50. package/dist/widget-base-BwU6SI2o.js +0 -365
@@ -1,14 +1,14 @@
1
- import { a as j, f as L, g as F, i as I, m as q, n as N, o as z, t as R } from "./request-response-cache-DwADBDeB.js";
2
- import { A as D, E as S, N as H, a as k, l as $, v as W } from "./context-UTzCGyR9.js";
3
- import { o as J, t as K } from "./widget-base-BwU6SI2o.js";
4
- import { t as Q } from "./locale-uQ5XZ2yS.js";
5
- import { a as V, n as Y, r as X, t as A } from "./price-formatter-CHUmYq8I.js";
6
- import { n as Z } from "./connection-warning-TXqyeFaf.js";
1
+ import { a as q, f as R, g as F, i as I, m as z, n as N, o as D, t as G } from "./request-response-cache-DItrp4fO.js";
2
+ import { B as H, L as $, N as A, T as W, f as k, g as J, n as K } from "./global-error-toast-DvaKvPNA.js";
3
+ import { t as Q } from "./widget-base-BnUjuCt7.js";
4
+ import { t as V } from "./locale-uQ5XZ2yS.js";
5
+ import { a as Y, n as X, r as Z, t as w } from "./price-formatter-Q3wUKrl1.js";
6
+ import { r as ee } from "./connection-warning-C0e2byq5.js";
7
7
  function M(e) {
8
8
  const t = [];
9
- for (const n of Object.values(e)) if (n.type === "ProductCard" && n.props) {
10
- const r = n.props.product ?? n.props;
11
- typeof r.sku == "string" && typeof r.name == "string" && t.push(r);
9
+ for (const r of Object.values(e)) if (r.type === "ProductCard" && r.props) {
10
+ const n = r.props.product ?? r.props;
11
+ typeof n.sku == "string" && typeof n.name == "string" && t.push(n);
12
12
  }
13
13
  return t;
14
14
  }
@@ -16,93 +16,93 @@ function U(e) {
16
16
  const t = e.headers.get("Content-Type") ?? "";
17
17
  return t.includes("application/x-ndjson") || t.includes("text/event-stream");
18
18
  }
19
- async function ee(e, t) {
20
- const n = [], r = { onEvent: (s) => {
19
+ async function te(e, t) {
20
+ const r = [], n = { onEvent: (s) => {
21
21
  const i = I(s);
22
- !i || i.type !== "ui_spec" || n.push(...M(i.spec.elements));
22
+ !i || i.type !== "ui_spec" || r.push(...M(i.spec.elements));
23
23
  } };
24
- return t !== void 0 && (r.signal = t), await L(e, r), n;
24
+ return t !== void 0 && (n.signal = t), await R(e, n), r;
25
25
  }
26
- async function te(e, t, n) {
27
- const r = N("similar_products", t), s = {
26
+ async function re(e, t, r) {
27
+ const n = N("similar_products", t), s = {
28
28
  method: "POST",
29
29
  headers: { "Content-Type": "application/json" },
30
30
  body: JSON.stringify(e)
31
31
  };
32
- n !== void 0 && (s.signal = n);
33
- const i = await R(r, s);
32
+ r !== void 0 && (s.signal = r);
33
+ const i = await G(n, s);
34
34
  if (!i.ok) throw new Error(`HTTP ${i.status}: ${i.statusText}`);
35
- if (U(i)) return ee(i, n);
35
+ if (U(i)) return te(i, r);
36
36
  const a = await i.text();
37
37
  if (!a) throw new Error("Empty response body from similar_products endpoint");
38
38
  try {
39
- return z(JSON.parse(a));
39
+ return D(JSON.parse(a));
40
40
  } catch {
41
41
  throw new Error("Invalid JSON from similar_products endpoint");
42
42
  }
43
43
  }
44
44
  async function ne(e, t) {
45
- const n = [];
46
- let r = null;
45
+ const r = [];
46
+ let n = null;
47
47
  const s = { onEvent: (i) => {
48
48
  const a = I(i);
49
49
  if (a) {
50
50
  if (a.type === "metadata" && a.meta) {
51
51
  const d = a.meta.group_name;
52
52
  if (typeof d == "string") {
53
- r = {
53
+ n = {
54
54
  name: d,
55
55
  products: []
56
56
  };
57
57
  const m = a.meta.highlight;
58
- typeof m == "string" && (r.highlight = m), n.push(r);
58
+ typeof m == "string" && (n.highlight = m), r.push(n);
59
59
  }
60
60
  }
61
- a.type === "ui_spec" && r && r.products.push(...M(a.spec.elements));
61
+ a.type === "ui_spec" && n && n.products.push(...M(a.spec.elements));
62
62
  }
63
63
  } };
64
- return t !== void 0 && (s.signal = t), await L(e, s), n;
64
+ return t !== void 0 && (s.signal = t), await R(e, s), r;
65
65
  }
66
- async function re(e, t, n) {
67
- const r = N("product_groupings", t), s = {
66
+ async function ie(e, t, r) {
67
+ const n = N("product_groupings", t), s = {
68
68
  method: "POST",
69
69
  headers: { "Content-Type": "application/json" },
70
70
  body: JSON.stringify(e)
71
71
  };
72
- n !== void 0 && (s.signal = n);
73
- const i = await R(r, s);
72
+ r !== void 0 && (s.signal = r);
73
+ const i = await G(n, s);
74
74
  if (!i.ok) throw new Error(`HTTP ${i.status}: ${i.statusText}`);
75
- if (U(i)) return ne(i, n);
75
+ if (U(i)) return ne(i, r);
76
76
  const a = await i.text();
77
77
  if (!a) return [];
78
78
  try {
79
- return j(JSON.parse(a));
79
+ return q(JSON.parse(a));
80
80
  } catch {
81
81
  throw new Error("Invalid JSON from product_groupings endpoint");
82
82
  }
83
83
  }
84
- function G(e) {
85
- const { product: t, index: n, discountType: r, onClick: s, onAddToCart: i, renderCard: a } = e, d = e.i18n, m = e.pricing;
84
+ function O(e) {
85
+ const { product: t, index: r, discountType: n, onClick: s, onAddToCart: i, renderCard: a } = e, d = e.i18n, m = e.pricing;
86
86
  if (e.renderCardElement) {
87
- const o = e.renderCardElement(t, n);
87
+ const o = e.renderCardElement(t, r);
88
88
  if (o) return o;
89
89
  }
90
90
  if (a) {
91
91
  const o = document.createElement("div");
92
- return o.className = "gengage-simrel-card gengage-simrel-card--custom gds-card gds-product-card gds-card-interactive", o.dataset.gengagePart = "simrel-product-card", o.innerHTML = H(a(t, n)), o.addEventListener("click", (c) => {
92
+ return o.className = "gengage-simrel-card gengage-simrel-card--custom gds-card gds-product-card gds-card-interactive", o.dataset.gengagePart = "simrel-product-card", o.innerHTML = H(a(t, r)), o.addEventListener("click", (c) => {
93
93
  c.target.closest(".gengage-simrel-atc") || c.target.closest(".gengage-chat-product-card-atc") || s(t);
94
94
  }), o;
95
95
  }
96
96
  const l = document.createElement("article");
97
97
  l.className = "gengage-simrel-card gengage-chat-product-card gds-card gds-product-card gds-card-interactive", l.dataset.gengagePart = "simrel-product-card", t.inStock === !1 && l.classList.add("gengage-simrel-card--out-of-stock"), l.setAttribute("role", "listitem"), l.dataset.sku = t.sku;
98
98
  const g = document.createElement("div");
99
- if (g.className = "gengage-simrel-card-image gengage-chat-product-card-img-wrapper", g.dataset.gengagePart = "simrel-product-card-image", t.imageUrl && D(t.imageUrl)) {
99
+ if (g.className = "gengage-simrel-card-image gengage-chat-product-card-img-wrapper", g.dataset.gengagePart = "simrel-product-card-image", t.imageUrl && $(t.imageUrl)) {
100
100
  const o = document.createElement("img");
101
- o.className = "gengage-chat-product-card-img", o.src = t.imageUrl, o.alt = t.name, o.loading = "lazy", Y(o), g.appendChild(o);
101
+ o.className = "gengage-chat-product-card-img", o.src = t.imageUrl, o.alt = t.name, o.loading = "lazy", X(o), g.appendChild(o);
102
102
  }
103
- if (r === "badge" && t.discountPercent && t.discountPercent > 0) {
103
+ if (n === "badge" && t.discountPercent && t.discountPercent > 0) {
104
104
  const o = document.createElement("span");
105
- o.className = "gengage-simrel-badge gengage-chat-product-card-discount-badge", o.textContent = `%${X(t.discountPercent)}`, g.appendChild(o);
105
+ o.className = "gengage-simrel-badge gengage-chat-product-card-discount-badge", o.textContent = `%${Z(t.discountPercent)}`, g.appendChild(o);
106
106
  }
107
107
  l.appendChild(g);
108
108
  const u = document.createElement("div");
@@ -113,22 +113,22 @@ function G(e) {
113
113
  const h = document.createElement("div");
114
114
  if (h.className = "gengage-simrel-card-name gengage-chat-product-card-name", h.textContent = t.name, h.title = t.name, u.appendChild(h), t.rating != null && t.rating > 0) {
115
115
  const o = document.createElement("div");
116
- if (o.className = "gengage-simrel-card-rating gengage-chat-product-card-rating", o.appendChild(V(t.rating)), t.reviewCount != null) {
116
+ if (o.className = "gengage-simrel-card-rating gengage-chat-product-card-rating", o.appendChild(Y(t.rating)), t.reviewCount != null) {
117
117
  const c = document.createElement("span");
118
118
  c.className = "gengage-simrel-card-review-count gengage-chat-product-card-review-count", c.textContent = ` (${t.reviewCount})`, o.appendChild(c);
119
119
  }
120
120
  u.appendChild(o);
121
121
  }
122
- const y = document.createElement("div");
123
- if (y.className = "gengage-simrel-card-price gengage-chat-product-card-price", t.originalPrice && t.originalPrice !== t.price && (r === "strike-through" || r === "inline" || !r)) {
122
+ const b = document.createElement("div");
123
+ if (b.className = "gengage-simrel-card-price gengage-chat-product-card-price", t.originalPrice && t.originalPrice !== t.price && (n === "strike-through" || n === "inline" || !n)) {
124
124
  const o = document.createElement("span");
125
- o.className = ["gengage-simrel-card-price-original", "gengage-chat-product-card-original-price"].join(" "), r === "inline" && o.classList.add("gengage-simrel-card-price-original--inline"), o.textContent = A(t.originalPrice, m), y.appendChild(o);
125
+ o.className = ["gengage-simrel-card-price-original", "gengage-chat-product-card-original-price"].join(" "), n === "inline" && o.classList.add("gengage-simrel-card-price-original--inline"), o.textContent = w(t.originalPrice, m), b.appendChild(o);
126
126
  }
127
127
  if (t.price && parseFloat(t.price) > 0) {
128
128
  const o = document.createElement("span");
129
- o.className = "gengage-simrel-card-price-current gengage-chat-product-card-price-current", o.textContent = A(t.price, m), y.appendChild(o);
129
+ o.className = "gengage-simrel-card-price-current gengage-chat-product-card-price-current", o.textContent = w(t.price, m), b.appendChild(o);
130
130
  }
131
- u.appendChild(y), l.appendChild(u);
131
+ u.appendChild(b), l.appendChild(u);
132
132
  const f = document.createElement("button");
133
133
  if (f.className = "gengage-simrel-card-cta gengage-chat-product-card-cta gds-btn gds-btn-secondary", f.type = "button", f.dataset.gengagePart = "simrel-product-card-cta", f.textContent = d?.ctaLabel ?? "View", f.addEventListener("click", (o) => {
134
134
  o.preventDefault(), o.stopPropagation(), s(t);
@@ -149,40 +149,44 @@ function G(e) {
149
149
  o.target.closest(".gengage-simrel-atc") || o.target.closest(".gengage-chat-product-card-atc") || o.target.closest(".gengage-chat-product-card-cta") || s(t);
150
150
  }), l;
151
151
  }
152
- function w(e) {
152
+ function P(e) {
153
153
  const t = document.createElement("div");
154
154
  t.className = "gengage-simrel-grid", t.setAttribute("role", "list"), t.setAttribute("aria-label", e.i18n?.similarProductsAriaLabel ?? "Similar products"), e.columns && t.style.setProperty("--gengage-simrel-columns", String(e.columns));
155
- for (let n = 0; n < e.products.length; n++) {
156
- const r = {
157
- product: e.products[n],
158
- index: n,
155
+ for (let r = 0; r < e.products.length; r++) {
156
+ const n = {
157
+ product: e.products[r],
158
+ index: r,
159
159
  onClick: e.onClick,
160
160
  onAddToCart: e.onAddToCart
161
161
  };
162
- e.i18n !== void 0 && (r.i18n = e.i18n), e.discountType !== void 0 && (r.discountType = e.discountType), e.renderCard !== void 0 && (r.renderCard = e.renderCard), e.renderCardElement !== void 0 && (r.renderCardElement = e.renderCardElement);
163
- const s = G(r);
162
+ e.i18n !== void 0 && (n.i18n = e.i18n), e.discountType !== void 0 && (n.discountType = e.discountType), e.renderCard !== void 0 && (n.renderCard = e.renderCard), e.renderCardElement !== void 0 && (n.renderCardElement = e.renderCardElement);
163
+ const s = O(n);
164
164
  t.appendChild(s);
165
165
  }
166
166
  return e.products.length === 0 && (t.style.display = "none", t.dataset.empty = "true"), t;
167
167
  }
168
- var ie = 0;
169
- function se(e) {
170
- const t = ie++, n = document.createElement("div");
171
- if (n.className = "gengage-simrel-groups", n.dataset.gengagePart = "simrel-groups", e.groups.length === 0)
172
- return n.style.display = "none", n.dataset.empty = "true", n;
173
- const r = document.createElement("div");
174
- r.className = "gengage-simrel-tabs gds-toolbar", r.dataset.gengagePart = "simrel-tab-bar", r.setAttribute("role", "tablist");
168
+ var se = 0, S = /* @__PURE__ */ new WeakMap();
169
+ function oe(e) {
170
+ const t = S.get(e);
171
+ t && (t.disconnect(), S.delete(e));
172
+ }
173
+ function ae(e) {
174
+ const t = se++, r = document.createElement("div");
175
+ if (r.className = "gengage-simrel-groups", r.dataset.gengagePart = "simrel-groups", e.groups.length === 0)
176
+ return r.style.display = "none", r.dataset.empty = "true", r;
177
+ const n = document.createElement("div");
178
+ n.className = "gengage-simrel-tabs gds-toolbar", n.dataset.gengagePart = "simrel-tab-bar", n.setAttribute("role", "tablist");
175
179
  const s = [], i = [];
176
180
  let a = 0;
177
181
  const d = (c) => {
178
- const b = {
182
+ const C = {
179
183
  products: c.products,
180
184
  onClick: e.onClick,
181
185
  onAddToCart: e.onAddToCart
182
186
  };
183
- return e.i18n !== void 0 && (b.i18n = e.i18n), e.discountType !== void 0 && (b.discountType = e.discountType), e.renderCard !== void 0 && (b.renderCard = e.renderCard), e.renderCardElement !== void 0 && (b.renderCardElement = e.renderCardElement), e.columns !== void 0 && (b.columns = e.columns), b;
184
- }, m = (c, b = !1) => {
185
- if (b && c !== a && e.onGroupingActivate) {
187
+ return e.i18n !== void 0 && (C.i18n = e.i18n), e.discountType !== void 0 && (C.discountType = e.discountType), e.renderCard !== void 0 && (C.renderCard = e.renderCard), e.renderCardElement !== void 0 && (C.renderCardElement = e.renderCardElement), e.columns !== void 0 && (C.columns = e.columns), C;
188
+ }, m = (c, C = !1) => {
189
+ if (C && c !== a && e.onGroupingActivate) {
186
190
  const p = e.groups[c];
187
191
  e.onGroupingActivate({
188
192
  grouping_label: p.name,
@@ -196,19 +200,19 @@ function se(e) {
196
200
  }
197
201
  const T = e.groups[c], _ = i[c];
198
202
  _.innerHTML = "";
199
- const C = w(d(T));
200
- _.appendChild(C);
203
+ const y = P(d(T));
204
+ _.appendChild(y);
201
205
  for (let p = 0; p < i.length; p++) {
202
206
  const v = p === c;
203
207
  i[p].style.display = v ? "" : "none", i[p].tabIndex = v ? 0 : -1;
204
208
  }
205
209
  };
206
210
  for (let c = 0; c < e.groups.length; c++) {
207
- const b = e.groups[c], T = `gengage-simrel-tab-${t}-${c}`, _ = `gengage-simrel-panel-${t}-${c}`, C = document.createElement("button");
208
- C.className = "gengage-simrel-tab gds-tab", C.type = "button", C.dataset.gengagePart = "simrel-tab", C.id = T, C.textContent = b.name, C.setAttribute("role", "tab"), C.setAttribute("aria-controls", _), C.setAttribute("aria-selected", String(c === 0)), C.tabIndex = c === 0 ? 0 : -1, c === 0 && C.classList.add("gengage-simrel-tab--active"), C.addEventListener("click", () => m(c, !0)), C.addEventListener("keydown", (v) => {
211
+ const C = e.groups[c], T = `gengage-simrel-tab-${t}-${c}`, _ = `gengage-simrel-panel-${t}-${c}`, y = document.createElement("button");
212
+ y.className = "gengage-simrel-tab gds-tab", y.type = "button", y.dataset.gengagePart = "simrel-tab", y.id = T, y.textContent = C.name, y.setAttribute("role", "tab"), y.setAttribute("aria-controls", _), y.setAttribute("aria-selected", String(c === 0)), y.tabIndex = c === 0 ? 0 : -1, c === 0 && y.classList.add("gengage-simrel-tab--active"), y.addEventListener("click", () => m(c, !0)), y.addEventListener("keydown", (v) => {
209
213
  let E = -1;
210
214
  v.key === "ArrowRight" || v.key === "ArrowDown" ? E = (c + 1) % e.groups.length : v.key === "ArrowLeft" || v.key === "ArrowUp" ? E = (c - 1 + e.groups.length) % e.groups.length : v.key === "Home" ? E = 0 : v.key === "End" && (E = e.groups.length - 1), E >= 0 && (v.preventDefault(), m(E, !0), s[E].focus());
211
- }), s.push(C), r.appendChild(C);
215
+ }), s.push(y), n.appendChild(y);
212
216
  const p = document.createElement("div");
213
217
  p.className = "gengage-simrel-tab-panel", p.dataset.gengagePart = "simrel-tab-panel", p.id = _, p.setAttribute("role", "tabpanel"), p.setAttribute("aria-labelledby", T), p.tabIndex = c === 0 ? 0 : -1, c !== 0 && (p.style.display = "none"), i.push(p);
214
218
  }
@@ -218,181 +222,185 @@ function se(e) {
218
222
  g.type = "button", g.className = "gengage-simrel-tabs-arrow gengage-simrel-tabs-arrow--right", g.setAttribute("aria-label", e.i18n?.scrollTabsRight ?? "Scroll tabs right"), g.innerHTML = '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polyline points="9 18 15 12 9 6"/></svg>';
219
223
  const u = 200;
220
224
  l.addEventListener("click", () => {
221
- r.scrollBy({
225
+ n.scrollBy({
222
226
  left: -200,
223
227
  behavior: "smooth"
224
228
  });
225
229
  }), g.addEventListener("click", () => {
226
- r.scrollBy({
230
+ n.scrollBy({
227
231
  left: u,
228
232
  behavior: "smooth"
229
233
  });
230
234
  });
231
235
  const h = () => {
232
- const c = r.scrollLeft <= 4, b = r.scrollLeft + r.clientWidth >= r.scrollWidth - 4;
233
- l.style.display = c ? "none" : "", g.style.display = b ? "none" : "", r.classList.toggle("gengage-simrel-tabs--peek-right", !b), r.classList.toggle("gengage-simrel-tabs--peek-left", !c);
236
+ const c = n.scrollLeft <= 4, C = n.scrollLeft + n.clientWidth >= n.scrollWidth - 4;
237
+ l.style.display = c ? "none" : "", g.style.display = C ? "none" : "", n.classList.toggle("gengage-simrel-tabs--peek-right", !C), n.classList.toggle("gengage-simrel-tabs--peek-left", !c);
234
238
  };
235
- r.addEventListener("scroll", h, { passive: !0 }), typeof ResizeObserver < "u" && new ResizeObserver(h).observe(r), l.style.display = "none", g.style.display = "none", requestAnimationFrame(h);
236
- const y = document.createElement("div");
237
- y.className = "gengage-simrel-tabs-wrapper", y.appendChild(l), y.appendChild(r), y.appendChild(g), n.appendChild(y);
238
- const f = i[0], o = w(d(e.groups[0]));
239
+ if (n.addEventListener("scroll", h, { passive: !0 }), typeof ResizeObserver < "u") {
240
+ const c = new ResizeObserver(h);
241
+ c.observe(n), S.set(r, c);
242
+ }
243
+ l.style.display = "none", g.style.display = "none", requestAnimationFrame(h);
244
+ const b = document.createElement("div");
245
+ b.className = "gengage-simrel-tabs-wrapper", b.appendChild(l), b.appendChild(n), b.appendChild(g), r.appendChild(b);
246
+ const f = i[0], o = P(d(e.groups[0]));
239
247
  f.appendChild(o);
240
- for (const c of i) n.appendChild(c);
241
- return n;
248
+ for (const c of i) r.appendChild(c);
249
+ return r;
242
250
  }
243
- function P(e) {
251
+ function L(e) {
244
252
  if (!e || typeof e != "object") return null;
245
253
  const t = e;
246
254
  if (typeof t.sku != "string" || typeof t.name != "string" || typeof t.url != "string") return null;
247
- const n = {
255
+ const r = {
248
256
  sku: t.sku,
249
257
  name: t.name,
250
258
  url: t.url
251
- }, r = t.imageUrl;
252
- typeof r == "string" && (n.imageUrl = r);
259
+ }, n = t.imageUrl;
260
+ typeof n == "string" && (r.imageUrl = n);
253
261
  const s = t.price;
254
- typeof s == "string" && (n.price = s);
262
+ typeof s == "string" && (r.price = s);
255
263
  const i = t.originalPrice;
256
- typeof i == "string" && (n.originalPrice = i);
264
+ typeof i == "string" && (r.originalPrice = i);
257
265
  const a = t.discountPercent;
258
- typeof a == "number" && (n.discountPercent = a);
266
+ typeof a == "number" && (r.discountPercent = a);
259
267
  const d = t.brand;
260
- typeof d == "string" && (n.brand = d);
268
+ typeof d == "string" && (r.brand = d);
261
269
  const m = t.rating;
262
- typeof m == "number" && (n.rating = m);
270
+ typeof m == "number" && (r.rating = m);
263
271
  const l = t.reviewCount;
264
- typeof l == "number" && (n.reviewCount = l);
272
+ typeof l == "number" && (r.reviewCount = l);
265
273
  const g = t.cartCode;
266
- typeof g == "string" && (n.cartCode = g);
274
+ typeof g == "string" && (r.cartCode = g);
267
275
  const u = t.inStock;
268
- typeof u == "boolean" && (n.inStock = u);
276
+ typeof u == "boolean" && (r.inStock = u);
269
277
  const h = t.extras;
270
- return h != null && typeof h == "object" && (n.extras = h), n;
278
+ return h != null && typeof h == "object" && (r.extras = h), r;
271
279
  }
272
- function oe(e) {
280
+ function ce(e) {
273
281
  if (!e || typeof e != "object") return null;
274
- const t = e, n = t.title, r = t.type;
275
- if (typeof n != "string" || typeof r != "string") return null;
282
+ const t = e, r = t.title, n = t.type;
283
+ if (typeof r != "string" || typeof n != "string") return null;
276
284
  const s = {
277
- title: n,
278
- type: r
285
+ title: r,
286
+ type: n
279
287
  };
280
288
  return t.payload !== void 0 && (s.payload = t.payload), s;
281
289
  }
282
- var O = {
283
- ProductGrid: ({ element: e, renderElement: t, context: n }) => {
284
- const r = document.createElement("div");
285
- r.className = "gengage-simrel-grid", r.setAttribute("role", "list");
290
+ var B = {
291
+ ProductGrid: ({ element: e, renderElement: t, context: r }) => {
292
+ const n = document.createElement("div");
293
+ n.className = "gengage-simrel-grid", n.setAttribute("role", "list");
286
294
  const s = e.props?.columns;
287
295
  let i;
288
- typeof s == "number" && Number.isFinite(s) && s > 0 ? i = Math.floor(s) : typeof n.gridColumns == "number" && Number.isFinite(n.gridColumns) && n.gridColumns > 0 && (i = Math.floor(n.gridColumns)), i !== void 0 && r.style.setProperty("--gengage-simrel-columns", String(i));
296
+ typeof s == "number" && Number.isFinite(s) && s > 0 ? i = Math.floor(s) : typeof r.gridColumns == "number" && Number.isFinite(r.gridColumns) && r.gridColumns > 0 && (i = Math.floor(r.gridColumns)), i !== void 0 && n.style.setProperty("--gengage-simrel-columns", String(i));
289
297
  for (const a of e.children ?? []) {
290
298
  const d = t(a);
291
- d && r.appendChild(d);
299
+ d && n.appendChild(d);
292
300
  }
293
- if (r.children.length === 0) {
301
+ if (n.children.length === 0) {
294
302
  const a = document.createElement("div");
295
- a.className = "gengage-simrel-empty", a.textContent = n.i18n.emptyStateMessage, r.appendChild(a);
303
+ a.className = "gengage-simrel-empty", a.textContent = r.i18n.emptyStateMessage, n.appendChild(a);
296
304
  }
297
- return r;
305
+ return n;
298
306
  },
299
307
  ProductCard: ({ element: e, context: t }) => {
300
- const n = P(e.props?.product ?? e.props);
301
- if (!n) return null;
302
- const r = e.props?.index, s = typeof r == "number" && Number.isFinite(r) ? r : 0, i = e.props?.discountType, a = i === "strike-through" || i === "badge" || i === "inline" ? i : t.discountType, d = {
303
- product: n,
308
+ const r = L(e.props?.product ?? e.props);
309
+ if (!r) return null;
310
+ const n = e.props?.index, s = typeof n == "number" && Number.isFinite(n) ? n : 0, i = e.props?.discountType, a = i === "strike-through" || i === "badge" || i === "inline" ? i : t.discountType, d = {
311
+ product: r,
304
312
  index: s,
305
313
  onClick: t.onClick,
306
314
  onAddToCart: t.onAddToCart,
307
315
  i18n: t.i18n
308
316
  };
309
- return a !== void 0 && (d.discountType = a), t.renderCard !== void 0 && (d.renderCard = t.renderCard), t.renderCardElement !== void 0 && (d.renderCardElement = t.renderCardElement), t.pricing !== void 0 && (d.pricing = t.pricing), G(d);
317
+ return a !== void 0 && (d.discountType = a), t.renderCard !== void 0 && (d.renderCard = t.renderCard), t.renderCardElement !== void 0 && (d.renderCardElement = t.renderCardElement), t.pricing !== void 0 && (d.pricing = t.pricing), O(d);
310
318
  },
311
319
  GroupTabs: ({ element: e, context: t }) => {
312
- const n = e.props?.groups;
313
- if (!Array.isArray(n)) return null;
314
- const r = [];
315
- for (const a of n) {
320
+ const r = e.props?.groups;
321
+ if (!Array.isArray(r)) return null;
322
+ const n = [];
323
+ for (const a of r) {
316
324
  if (!a || typeof a != "object") continue;
317
325
  const d = a;
318
326
  if (typeof d.name != "string") continue;
319
327
  const m = [];
320
328
  if (Array.isArray(d.products)) for (const g of d.products) {
321
- const u = P(g);
329
+ const u = L(g);
322
330
  u && m.push(u);
323
331
  }
324
332
  const l = {
325
333
  name: d.name,
326
334
  products: m
327
335
  };
328
- typeof d.highlight == "string" && (l.highlight = d.highlight), r.push(l);
336
+ typeof d.highlight == "string" && (l.highlight = d.highlight), n.push(l);
329
337
  }
330
338
  const s = {
331
- groups: r,
339
+ groups: n,
332
340
  onClick: t.onClick,
333
341
  onAddToCart: t.onAddToCart,
334
342
  i18n: t.i18n
335
343
  }, i = e.props?.columns;
336
- return typeof i == "number" && Number.isFinite(i) && i > 0 ? s.columns = Math.floor(i) : typeof t.gridColumns == "number" && Number.isFinite(t.gridColumns) && t.gridColumns > 0 && (s.columns = Math.floor(t.gridColumns)), t.discountType !== void 0 && (s.discountType = t.discountType), t.renderCard !== void 0 && (s.renderCard = t.renderCard), t.renderCardElement !== void 0 && (s.renderCardElement = t.renderCardElement), t.onGroupingActivate !== void 0 && (s.onGroupingActivate = t.onGroupingActivate), se(s);
344
+ return typeof i == "number" && Number.isFinite(i) && i > 0 ? s.columns = Math.floor(i) : typeof t.gridColumns == "number" && Number.isFinite(t.gridColumns) && t.gridColumns > 0 && (s.columns = Math.floor(t.gridColumns)), t.discountType !== void 0 && (s.discountType = t.discountType), t.renderCard !== void 0 && (s.renderCard = t.renderCard), t.renderCardElement !== void 0 && (s.renderCardElement = t.renderCardElement), t.onGroupingActivate !== void 0 && (s.onGroupingActivate = t.onGroupingActivate), ae(s);
337
345
  },
338
346
  EmptyState: ({ element: e, context: t }) => {
339
- const n = document.createElement("div");
340
- n.className = "gengage-simrel-empty";
341
- const r = e.props?.message;
342
- return n.textContent = typeof r == "string" ? r : t.i18n.emptyStateMessage, n;
347
+ const r = document.createElement("div");
348
+ r.className = "gengage-simrel-empty";
349
+ const n = e.props?.message;
350
+ return r.textContent = typeof n == "string" ? n : t.i18n.emptyStateMessage, r;
343
351
  },
344
352
  AddToCartButton: ({ element: e, context: t }) => {
345
- const n = e.props?.sku, r = e.props?.cartCode;
346
- if (typeof n != "string" || typeof r != "string") return null;
353
+ const r = e.props?.sku, n = e.props?.cartCode;
354
+ if (typeof r != "string" || typeof n != "string") return null;
347
355
  const s = document.createElement("button");
348
356
  s.className = "gengage-simrel-atc gengage-chat-product-card-cta", s.type = "button";
349
357
  const i = e.props?.label;
350
358
  return s.textContent = typeof i == "string" ? i : t.i18n.addToCartButton, s.addEventListener("click", (a) => {
351
359
  a.preventDefault(), a.stopPropagation(), t.onAddToCart({
352
- sku: n,
360
+ sku: r,
353
361
  quantity: 1,
354
- cartCode: r
362
+ cartCode: n
355
363
  });
356
364
  }), s;
357
365
  },
358
366
  QuickActions: ({ element: e, context: t }) => {
359
- const n = document.createElement("div");
360
- n.className = "gengage-simrel-quick-actions";
361
- const r = e.props?.actions;
362
- if (!Array.isArray(r) || !t.onAction) return n;
363
- for (const s of r) {
367
+ const r = document.createElement("div");
368
+ r.className = "gengage-simrel-quick-actions";
369
+ const n = e.props?.actions;
370
+ if (!Array.isArray(n) || !t.onAction) return r;
371
+ for (const s of n) {
364
372
  if (!s || typeof s != "object") continue;
365
- const i = s, a = i.label, d = oe(i.action);
373
+ const i = s, a = i.label, d = ce(i.action);
366
374
  if (typeof a != "string" || !d) continue;
367
375
  const m = document.createElement("button");
368
376
  m.className = "gengage-simrel-quick-action", m.type = "button", m.textContent = a, m.addEventListener("click", (l) => {
369
377
  l.preventDefault(), l.stopPropagation(), t.onAction?.(d);
370
- }), n.appendChild(m);
378
+ }), r.appendChild(m);
371
379
  }
372
- return n;
380
+ return r;
373
381
  }
374
- }, B = ({ element: e, renderElement: t }) => {
382
+ }, x = ({ element: e, renderElement: t }) => {
375
383
  if (!e.children || e.children.length === 0) return null;
376
- const n = document.createElement("div");
377
- for (const r of e.children) {
378
- const s = t(r);
379
- s && n.appendChild(s);
384
+ const r = document.createElement("div");
385
+ for (const n of e.children) {
386
+ const s = t(n);
387
+ s && r.appendChild(s);
380
388
  }
381
- return n;
389
+ return r;
382
390
  };
383
- function ae() {
384
- return { ...O };
391
+ function de() {
392
+ return { ...B };
385
393
  }
386
- function ce(e, t, n = O, r = B) {
394
+ function le(e, t, r = B, n = x) {
387
395
  return F({
388
396
  spec: e,
389
397
  context: t,
390
- registry: n,
398
+ registry: r,
391
399
  containerClassName: "gengage-simrel-uispec",
392
- unknownRenderer: r
400
+ unknownRenderer: n
393
401
  });
394
402
  }
395
- var x = {
403
+ var j = {
396
404
  similarProductsAriaLabel: "Benzer ürünler",
397
405
  emptyStateMessage: "Benzer ürün bulunamadı.",
398
406
  addToCartButton: "Sepete Ekle",
@@ -405,7 +413,7 @@ var x = {
405
413
  priceSuffix: " TL",
406
414
  scrollTabsLeft: "Sola kaydır",
407
415
  scrollTabsRight: "Sağa kaydır"
408
- }, de = {
416
+ }, ge = {
409
417
  similarProductsAriaLabel: "Similar products",
410
418
  emptyStateMessage: "No similar products found.",
411
419
  addToCartButton: "Add to cart",
@@ -419,26 +427,26 @@ var x = {
419
427
  scrollTabsLeft: "Scroll tabs left",
420
428
  scrollTabsRight: "Scroll tabs right"
421
429
  };
422
- function le(e) {
430
+ function ue(e) {
423
431
  return e ? e.toLowerCase().split("-")[0] ?? "tr" : "tr";
424
432
  }
425
- function ge(e) {
426
- return le(e) === "en" ? de : x;
427
- }
428
- var ue = 12e4;
429
433
  function pe(e) {
434
+ return ue(e) === "en" ? ge : j;
435
+ }
436
+ var me = 12e4;
437
+ function fe(e) {
430
438
  return e instanceof DOMException && e.name === "AbortError";
431
439
  }
432
- var me = class extends K {
440
+ var he = class extends Q {
433
441
  constructor(...e) {
434
- super(...e), this._abortController = null, this._contentEl = null, this._lastResultCount = -1, this._i18n = x, this._pendingAddToCartKeys = /* @__PURE__ */ new Set();
442
+ super(...e), this._abortController = null, this._contentEl = null, this._lastResultCount = -1, this._i18n = j, this._pendingAddToCartKeys = /* @__PURE__ */ new Set();
435
443
  }
436
444
  async init(e) {
437
445
  if (!this.isInitialised && (e.mountTarget === void 0 || e.mountTarget === null)) throw new Error("[gengage] SimRel mountTarget is required. Provide a merchant-owned mount before initializing.");
438
446
  await super.init(e);
439
447
  }
440
448
  async onInit(e) {
441
- this._i18n = this._resolveI18n(e), this._contentEl = document.createElement("div"), this._contentEl.className = "gengage-simrel-container", this._contentEl.dataset.gengagePart = "simrel-container", this._contentEl.lang = Q(e.locale);
449
+ this._i18n = this._resolveI18n(e), this._contentEl = document.createElement("div"), this._contentEl.className = "gengage-simrel-container", this._contentEl.dataset.gengagePart = "simrel-container", this._contentEl.lang = V(e.locale);
442
450
  const t = this._clampGridColumns(e.gridColumns);
443
451
  t !== void 0 && this._contentEl.style.setProperty("--gengage-simrel-columns", String(t)), this.root.appendChild(this._contentEl), this._lastSku = e.sku, await this._fetchAndRender(e.sku), W("simrel");
444
452
  }
@@ -454,7 +462,7 @@ var me = class extends K {
454
462
  onHide() {
455
463
  }
456
464
  onDestroy() {
457
- this._abort(), this._contentEl && (this._contentEl.remove(), this._contentEl = null);
465
+ this._abort(), this._disposeRenderedGroupTabs(), this._contentEl && (this._contentEl.remove(), this._contentEl = null);
458
466
  }
459
467
  _handleProductClick(e) {
460
468
  const t = {
@@ -463,13 +471,13 @@ var me = class extends K {
463
471
  url: e.url
464
472
  };
465
473
  if (e.imageUrl !== void 0 && (t.imageUrl = e.imageUrl), e.price !== void 0 && (t.price = e.price), e.originalPrice !== void 0 && (t.originalPrice = e.originalPrice), e.discountPercent !== void 0 && (t.discountPercent = e.discountPercent), e.brand !== void 0 && (t.brand = e.brand), e.rating !== void 0 && (t.rating = e.rating), e.reviewCount !== void 0 && (t.reviewCount = e.reviewCount), e.cartCode !== void 0 && (t.cartCode = e.cartCode), e.inStock !== void 0 && (t.inStock = e.inStock), this.config.onProductClick?.(t) === !1) return;
466
- const n = this.config.session?.sessionId ?? null;
474
+ const r = this.config.session?.sessionId ?? null;
467
475
  k("gengage:similar:product-click", {
468
476
  sku: e.sku,
469
477
  url: e.url,
470
- sessionId: n,
478
+ sessionId: r,
471
479
  productName: e.name
472
- }), this.config.onProductNavigate?.(e.url, e.sku, n);
480
+ }), this.config.onProductNavigate?.(e.url, e.sku, r);
473
481
  }
474
482
  async _handleAddToCart(e) {
475
483
  const t = `${e.sku}\0${e.cartCode}\0${e.quantity}`;
@@ -479,11 +487,11 @@ var me = class extends K {
479
487
  if (this.config.onAddToCart === void 0) return;
480
488
  try {
481
489
  await Promise.resolve(this.config.onAddToCart(e));
482
- } catch (n) {
483
- console.error("[gengage] simrel onAddToCart", n);
490
+ } catch (r) {
491
+ console.error("[gengage] simrel onAddToCart", r);
484
492
  return;
485
493
  }
486
- $(e.sku, e.quantity), k("gengage:similar:add-to-cart", e);
494
+ J(e.sku, e.quantity), k("gengage:similar:add-to-cart", e);
487
495
  } finally {
488
496
  this._pendingAddToCartKeys.delete(t);
489
497
  }
@@ -492,38 +500,41 @@ var me = class extends K {
492
500
  _abort() {
493
501
  this._abortController?.abort(), this._abortController = null;
494
502
  }
503
+ _disposeRenderedGroupTabs() {
504
+ this._contentEl && this._contentEl.querySelectorAll('[data-gengage-part="simrel-groups"]').forEach((e) => oe(e));
505
+ }
495
506
  _isSuperseded(e) {
496
507
  return this._abortController?.signal !== e;
497
508
  }
498
509
  _emitSimilarProductsImpression(e, t) {
499
- const n = this.config.session?.sessionId ?? null;
510
+ const r = this.config.session?.sessionId ?? null;
500
511
  k("gengage:similar:products-impression", {
501
- source_sku: this.config.sku,
512
+ source_sku: this._lastSku ?? this.config.sku,
502
513
  product_count: e,
503
514
  grouped: t,
504
- sessionId: n
515
+ sessionId: r
505
516
  });
506
517
  }
507
518
  _resolveRequestTimeoutMs() {
508
519
  const e = this.config.requestTimeoutMs;
509
- return typeof e != "number" || !Number.isFinite(e) || e <= 0 ? ue : Math.floor(e);
520
+ return typeof e != "number" || !Number.isFinite(e) || e <= 0 ? me : Math.floor(e);
510
521
  }
511
522
  async _fetchAndRender(e) {
512
523
  this._abort();
513
524
  const t = new AbortController();
514
525
  this._abortController = t;
515
- const n = t.signal;
516
- let r = !1;
526
+ const r = t.signal;
527
+ let n = !1;
517
528
  const s = setTimeout(() => {
518
- r = !0, t.abort();
529
+ n = !0, t.abort();
519
530
  }, this._resolveRequestTimeoutMs());
520
- if (n.addEventListener("abort", () => clearTimeout(s), { once: !0 }), !this._contentEl) return;
521
- this._contentEl.innerHTML = "", this._contentEl.style.display = "";
531
+ if (r.addEventListener("abort", () => clearTimeout(s), { once: !0 }), !this._contentEl) return;
532
+ this._disposeRenderedGroupTabs(), this._contentEl.innerHTML = "", this._contentEl.style.display = "";
522
533
  const i = document.createElement("div");
523
534
  i.className = "gengage-simrel-loading", i.dataset.gengagePart = "simrel-loading";
524
535
  const a = document.createElement("div");
525
536
  a.className = "gengage-simrel-spinner", a.dataset.gengagePart = "simrel-loading-spinner", i.appendChild(a), this._contentEl.appendChild(i);
526
- const d = { middlewareUrl: this.config.middlewareUrl }, m = Z({
537
+ const d = { middlewareUrl: this.config.middlewareUrl }, m = ee({
527
538
  source: "simrel",
528
539
  locale: this.config.locale
529
540
  });
@@ -535,51 +546,52 @@ var me = class extends K {
535
546
  sku: e
536
547
  };
537
548
  this.config.domain !== void 0 && (l.domain = this.config.domain);
538
- const g = await te(l, d, n);
539
- if (this._lastResultCount = g.length, !this._contentEl) return;
540
- if (this._contentEl.innerHTML = "", g.length > 0 && this.config.enableProductGroupings !== !1) try {
541
- const u = g.map((f) => f.sku), h = new Map(g.map((f) => [f.sku, f])), y = (await re({
549
+ const g = await re(l, d, r);
550
+ if (this._isSuperseded(r) || (this._lastResultCount = g.length, !this._contentEl)) return;
551
+ if (this._disposeRenderedGroupTabs(), this._contentEl.innerHTML = "", g.length > 0 && this.config.enableProductGroupings !== !1) try {
552
+ const u = g.map((f) => f.sku), h = new Map(g.map((f) => [f.sku, f])), b = (await ie({
542
553
  account_id: this.config.accountId,
543
554
  session_id: this.config.session?.sessionId ?? "",
544
555
  correlation_id: this.config.session?.sessionId ?? "",
545
556
  skus: u
546
- }, d, n)).map((f) => ({
557
+ }, d, r)).map((f) => ({
547
558
  ...f,
548
559
  products: f.products.map((o) => ({
549
560
  ...h.get(o.sku),
550
561
  ...o
551
562
  })).filter((o) => typeof o.sku == "string" && typeof o.name == "string" && typeof o.url == "string")
552
563
  })).filter((f) => f.products.length > 0);
553
- if (y.length > 0 && this._contentEl) {
554
- const f = this._buildGroupsSpec(y), o = this._renderUISpec(f);
555
- this._contentEl.appendChild(o), S("simrel"), this._emitSimilarProductsImpression(y.reduce((c, b) => c + b.products.length, 0), !0);
564
+ if (this._isSuperseded(r)) return;
565
+ if (b.length > 0 && this._contentEl) {
566
+ const f = this._buildGroupsSpec(b), o = this._renderUISpec(f);
567
+ this._contentEl.appendChild(o), A("simrel"), this._emitSimilarProductsImpression(b.reduce((c, C) => c + C.products.length, 0), !0);
556
568
  return;
557
569
  }
558
570
  } catch {
559
571
  }
560
- if (this._isSuperseded(n)) return;
572
+ if (this._isSuperseded(r)) return;
561
573
  if (this._contentEl) {
562
574
  const u = this._buildProductsSpec(g), h = this._renderUISpec(u);
563
575
  this._contentEl.appendChild(h);
564
576
  }
565
- g.length > 0 && S("simrel"), this._emitSimilarProductsImpression(g.length, !1);
577
+ g.length > 0 && A("simrel"), this._emitSimilarProductsImpression(g.length, !1);
566
578
  } catch (l) {
567
- const g = pe(l);
568
- if (g && this._isSuperseded(n)) return;
579
+ const g = fe(l);
580
+ if (g && this._isSuperseded(r)) return;
569
581
  if (k("gengage:global:error", {
570
582
  source: "simrel",
571
- code: g && r ? "REQUEST_TIMEOUT" : "FETCH_ERROR",
572
- message: J(this.config.locale, l)
583
+ code: g && n ? "REQUEST_TIMEOUT" : "FETCH_ERROR",
584
+ message: K(this.config.locale, l)
573
585
  }), this._contentEl) {
574
- this._contentEl.innerHTML = "";
586
+ this._disposeRenderedGroupTabs(), this._contentEl.innerHTML = "";
575
587
  const u = document.createElement("div");
576
588
  u.className = "gengage-simrel-error";
577
589
  const h = document.createElement("span");
578
590
  h.textContent = this._i18n.errorLoadingMessage, u.appendChild(h);
579
- const y = document.createElement("button");
580
- y.className = "gengage-simrel-retry", y.textContent = this._i18n.retryButtonText, y.addEventListener("click", () => {
581
- this._fetchAndRender(this.config.sku);
582
- }), u.appendChild(y), this._contentEl.appendChild(u);
591
+ const b = document.createElement("button");
592
+ b.className = "gengage-simrel-retry", b.textContent = this._i18n.retryButtonText, b.addEventListener("click", () => {
593
+ this._fetchAndRender(this._lastSku ?? this.config.sku);
594
+ }), u.appendChild(b), this._contentEl.appendChild(u);
583
595
  }
584
596
  } finally {
585
597
  clearTimeout(s), m();
@@ -591,45 +603,45 @@ var me = class extends K {
591
603
  }
592
604
  _resolveI18n(e) {
593
605
  return {
594
- ...ge(e.locale),
606
+ ...pe(e.locale),
595
607
  ...e.i18n
596
608
  };
597
609
  }
598
610
  _resolveUISpecRegistry() {
599
- return q(ae(), this.config.renderer?.registry);
611
+ return z(de(), this.config.renderer?.registry);
600
612
  }
601
613
  _buildRenderContext() {
602
614
  const e = this.config.renderCard, t = {
603
- onClick: (r) => this._handleProductClick(r),
604
- onAddToCart: (r) => {
605
- this._handleAddToCart(r);
615
+ onClick: (n) => this._handleProductClick(n),
616
+ onAddToCart: (n) => {
617
+ this._handleAddToCart(n);
606
618
  },
607
- onGroupingActivate: (r) => {
619
+ onGroupingActivate: (n) => {
608
620
  k("gengage:similar:grouping-click", {
609
- grouping_label: r.grouping_label,
610
- grouping_index: r.grouping_index,
621
+ grouping_label: n.grouping_label,
622
+ grouping_index: n.grouping_index,
611
623
  sessionId: this.config.session?.sessionId ?? null
612
624
  });
613
625
  },
614
626
  i18n: this._i18n
615
627
  };
616
628
  this.config.discountType !== void 0 && (t.discountType = this.config.discountType), e !== void 0 && (t.renderCard = e), this.config.renderCardElement !== void 0 && (t.renderCardElement = this.config.renderCardElement), this.config.pricing !== void 0 && (t.pricing = this.config.pricing);
617
- const n = this._clampGridColumns(this.config.gridColumns);
618
- return n !== void 0 && (t.gridColumns = n), t;
629
+ const r = this._clampGridColumns(this.config.gridColumns);
630
+ return r !== void 0 && (t.gridColumns = r), t;
619
631
  }
620
632
  _renderUISpec(e) {
621
- const t = this._resolveUISpecRegistry(), n = this._buildRenderContext(), r = this.config.renderer?.unknownRenderer ?? B, s = (a, d) => ce(a, d, t, r), i = this.config.renderer?.renderUISpec;
622
- return i ? i(e, n, {
633
+ const t = this._resolveUISpecRegistry(), r = this._buildRenderContext(), n = this.config.renderer?.unknownRenderer ?? x, s = (a, d) => le(a, d, t, n), i = this.config.renderer?.renderUISpec;
634
+ return i ? i(e, r, {
623
635
  registry: t,
624
- unknownRenderer: r,
636
+ unknownRenderer: n,
625
637
  defaultRender: s
626
- }) : s(e, n);
638
+ }) : s(e, r);
627
639
  }
628
640
  _buildProductsSpec(e) {
629
- const t = {}, n = [];
641
+ const t = {}, r = [];
630
642
  for (let i = 0; i < e.length; i++) {
631
643
  const a = e[i], d = `product-${i}`;
632
- n.push(d), t[d] = {
644
+ r.push(d), t[d] = {
633
645
  type: "ProductCard",
634
646
  props: {
635
647
  product: a,
@@ -638,11 +650,11 @@ var me = class extends K {
638
650
  }
639
651
  };
640
652
  }
641
- const r = { layout: "grid" }, s = this._clampGridColumns(this.config.gridColumns);
642
- return s !== void 0 && (r.columns = s), t.root = {
653
+ const n = { layout: "grid" }, s = this._clampGridColumns(this.config.gridColumns);
654
+ return s !== void 0 && (n.columns = s), t.root = {
643
655
  type: "ProductGrid",
644
- props: r,
645
- children: n
656
+ props: n,
657
+ children: r
646
658
  }, {
647
659
  root: "root",
648
660
  elements: t
@@ -658,14 +670,14 @@ var me = class extends K {
658
670
  };
659
671
  }
660
672
  };
661
- function Ee() {
662
- return new me();
673
+ function ke() {
674
+ return new he();
663
675
  }
664
676
  export {
665
- ce as a,
666
- B as i,
667
- Ee as n,
668
- se as o,
669
- ae as r,
670
- me as t
677
+ le as a,
678
+ x as i,
679
+ ke as n,
680
+ ae as o,
681
+ de as r,
682
+ he as t
671
683
  };