@gengage/assistant-fe 0.2.3 → 0.2.4

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 (94) hide show
  1. package/dist/assistant-fe.css +1 -1
  2. package/dist/chat/catalog.d.ts +2 -0
  3. package/dist/chat/catalog.d.ts.map +1 -1
  4. package/dist/chat/components/ChatDrawer.d.ts +47 -2
  5. package/dist/chat/components/ChatDrawer.d.ts.map +1 -1
  6. package/dist/chat/components/ChoicePrompter.d.ts +3 -1
  7. package/dist/chat/components/ChoicePrompter.d.ts.map +1 -1
  8. package/dist/chat/components/ComparisonTable.d.ts.map +1 -1
  9. package/dist/chat/components/PanelTopBar.d.ts +1 -0
  10. package/dist/chat/components/PanelTopBar.d.ts.map +1 -1
  11. package/dist/chat/components/ProductSummaryCard.d.ts.map +1 -1
  12. package/dist/chat/components/ReviewHighlights.d.ts.map +1 -1
  13. package/dist/chat/components/renderUISpec.d.ts.map +1 -1
  14. package/dist/chat/index.d.ts +22 -0
  15. package/dist/chat/index.d.ts.map +1 -1
  16. package/dist/chat/locales/en.d.ts.map +1 -1
  17. package/dist/chat/locales/tr.d.ts.map +1 -1
  18. package/dist/chat/panel-manager.d.ts +6 -4
  19. package/dist/chat/panel-manager.d.ts.map +1 -1
  20. package/dist/chat/session-persistence.d.ts +6 -1
  21. package/dist/chat/session-persistence.d.ts.map +1 -1
  22. package/dist/chat/types.d.ts +23 -1
  23. package/dist/chat/types.d.ts.map +1 -1
  24. package/dist/chat.cjs +1 -1
  25. package/dist/chat.iife.js +29 -29
  26. package/dist/chat.iife.js.map +1 -1
  27. package/dist/chat.js +2 -2
  28. package/dist/common/communication-bridge.d.ts.map +1 -1
  29. package/dist/common/price-formatter.d.ts +1 -1
  30. package/dist/common/price-formatter.d.ts.map +1 -1
  31. package/dist/common/product-utils.d.ts.map +1 -1
  32. package/dist/common/quantity-stepper.d.ts +1 -1
  33. package/dist/common/quantity-stepper.d.ts.map +1 -1
  34. package/dist/common/skeleton.d.ts +9 -0
  35. package/dist/common/skeleton.d.ts.map +1 -0
  36. package/dist/common/widget-base.d.ts.map +1 -1
  37. package/dist/common.cjs +1 -1
  38. package/dist/common.js +5 -5
  39. package/dist/index-BQVIyEOM.cjs +13 -0
  40. package/dist/index-BQVIyEOM.cjs.map +1 -0
  41. package/dist/index-Cdmhc_35.js +4783 -0
  42. package/dist/index-Cdmhc_35.js.map +1 -0
  43. package/dist/{index-Bctbyou5.cjs → index-DjdiNtXX.cjs} +2 -2
  44. package/dist/{index-Bctbyou5.cjs.map → index-DjdiNtXX.cjs.map} +1 -1
  45. package/dist/{index-BaG-fiAK.js → index-hUs4nTXp.js} +3 -3
  46. package/dist/{index-BaG-fiAK.js.map → index-hUs4nTXp.js.map} +1 -1
  47. package/dist/index.cjs +1 -1
  48. package/dist/index.js +3 -3
  49. package/dist/native.cjs +1 -1
  50. package/dist/native.iife.js +29 -29
  51. package/dist/native.iife.js.map +1 -1
  52. package/dist/native.js +1 -1
  53. package/dist/qna/index.d.ts.map +1 -1
  54. package/dist/qna.cjs +1 -1
  55. package/dist/qna.cjs.map +1 -1
  56. package/dist/qna.css +1 -1
  57. package/dist/qna.iife.js +13 -13
  58. package/dist/qna.iife.js.map +1 -1
  59. package/dist/qna.js +53 -44
  60. package/dist/qna.js.map +1 -1
  61. package/dist/quantity-stepper-CQWgexMO.cjs +2 -0
  62. package/dist/quantity-stepper-CQWgexMO.cjs.map +1 -0
  63. package/dist/quantity-stepper-CjY_cpgJ.js +80 -0
  64. package/dist/quantity-stepper-CjY_cpgJ.js.map +1 -0
  65. package/dist/{schemas-D1Kd4wn8.js → schemas-C7h8aelU.js} +2 -2
  66. package/dist/schemas-C7h8aelU.js.map +1 -0
  67. package/dist/{schemas-DOxyUYVA.cjs → schemas-DXvpS-Yg.cjs} +2 -2
  68. package/dist/schemas-DXvpS-Yg.cjs.map +1 -0
  69. package/dist/simrel/components/GroupTabs.d.ts.map +1 -1
  70. package/dist/simrel/components/ProductCard.d.ts.map +1 -1
  71. package/dist/simrel/components/ProductGrid.d.ts.map +1 -1
  72. package/dist/simrel/index.d.ts.map +1 -1
  73. package/dist/simrel/locales/en.d.ts.map +1 -1
  74. package/dist/simrel/locales/tr.d.ts.map +1 -1
  75. package/dist/simrel/types.d.ts +2 -0
  76. package/dist/simrel/types.d.ts.map +1 -1
  77. package/dist/simrel.cjs +1 -1
  78. package/dist/simrel.cjs.map +1 -1
  79. package/dist/simrel.css +1 -1
  80. package/dist/simrel.iife.js +11 -11
  81. package/dist/simrel.iife.js.map +1 -1
  82. package/dist/simrel.js +149 -148
  83. package/dist/simrel.js.map +1 -1
  84. package/package.json +1 -1
  85. package/dist/index-BHaQLt-o.js +0 -4468
  86. package/dist/index-BHaQLt-o.js.map +0 -1
  87. package/dist/index-CO5VnxEn.cjs +0 -13
  88. package/dist/index-CO5VnxEn.cjs.map +0 -1
  89. package/dist/quantity-stepper-BKtPQUR1.js +0 -78
  90. package/dist/quantity-stepper-BKtPQUR1.js.map +0 -1
  91. package/dist/quantity-stepper-DU6va4sS.cjs +0 -2
  92. package/dist/quantity-stepper-DU6va4sS.cjs.map +0 -1
  93. package/dist/schemas-D1Kd4wn8.js.map +0 -1
  94. package/dist/schemas-DOxyUYVA.cjs.map +0 -1
package/dist/simrel.js CHANGED
@@ -1,6 +1,6 @@
1
- import { b as P, p as j, q as M, c as N, a as I, v as B, x as q, r as z, o as b, s as h, f as H, e as $, _ as x, y as E, B as F, t as J, z as W, j as v, A as Q, C as V, g as Y, i as k, h as _, w as S, k as K, l as X, m as Z } from "./schemas-D1Kd4wn8.js";
2
- import { a as ee, c as te, b as ne, f as T, d as re } from "./quantity-stepper-BKtPQUR1.js";
3
- function R(n) {
1
+ import { b as P, p as j, q as B, c as I, a as R, v as q, x as H, r as M, o as b, s as h, f as z, e as $, _ as N, y as E, B as F, t as J, z as W, j as v, A as Q, C as V, g as Y, i as k, h as _, w as S, k as K, l as X, m as Z } from "./schemas-C7h8aelU.js";
2
+ import { a as ee, c as te, b as ne, f as T, d as re } from "./quantity-stepper-CjY_cpgJ.js";
3
+ function L(n) {
4
4
  const e = [];
5
5
  for (const t of Object.values(n))
6
6
  if (t.type === "ProductCard" && t.props) {
@@ -9,18 +9,18 @@ function R(n) {
9
9
  }
10
10
  return e;
11
11
  }
12
- function L(n) {
12
+ function x(n) {
13
13
  const e = n.headers.get("Content-Type") ?? "";
14
14
  return e.includes("application/x-ndjson") || e.includes("text/event-stream");
15
15
  }
16
16
  async function ie(n, e) {
17
17
  const t = [], r = {
18
18
  onEvent: (i) => {
19
- const a = I(i);
20
- !a || a.type !== "ui_spec" || t.push(...R(a.spec.elements));
19
+ const a = R(i);
20
+ !a || a.type !== "ui_spec" || t.push(...L(a.spec.elements));
21
21
  }
22
22
  };
23
- return e !== void 0 && (r.signal = e), await N(n, r), t;
23
+ return e !== void 0 && (r.signal = e), await I(n, r), t;
24
24
  }
25
25
  async function oe(n, e, t) {
26
26
  const r = P("similar_products", e), i = {
@@ -32,7 +32,7 @@ async function oe(n, e, t) {
32
32
  const a = await fetch(r, i);
33
33
  if (!a.ok)
34
34
  throw new Error(`HTTP ${a.status}: ${a.statusText}`);
35
- if (L(a))
35
+ if (x(a))
36
36
  return ie(a, t);
37
37
  const s = await a.text();
38
38
  if (!s) return [];
@@ -47,21 +47,21 @@ async function ae(n, e) {
47
47
  let r = null;
48
48
  const i = {
49
49
  onEvent: (a) => {
50
- const s = I(a);
50
+ const s = R(a);
51
51
  if (s) {
52
52
  if (s.type === "metadata" && s.meta) {
53
- const p = s.meta.group_name;
54
- if (typeof p == "string") {
55
- r = { name: p, products: [] };
56
- const d = s.meta.highlight;
57
- typeof d == "string" && (r.highlight = d), t.push(r);
53
+ const u = s.meta.group_name;
54
+ if (typeof u == "string") {
55
+ r = { name: u, products: [] };
56
+ const g = s.meta.highlight;
57
+ typeof g == "string" && (r.highlight = g), t.push(r);
58
58
  }
59
59
  }
60
- s.type === "ui_spec" && r && r.products.push(...R(s.spec.elements));
60
+ s.type === "ui_spec" && r && r.products.push(...L(s.spec.elements));
61
61
  }
62
62
  }
63
63
  };
64
- return e !== void 0 && (i.signal = e), await N(n, i), t;
64
+ return e !== void 0 && (i.signal = e), await I(n, i), t;
65
65
  }
66
66
  async function se(n, e, t) {
67
67
  const r = P("product_groupings", e), i = {
@@ -73,32 +73,32 @@ async function se(n, e, t) {
73
73
  const a = await fetch(r, i);
74
74
  if (!a.ok)
75
75
  throw new Error(`HTTP ${a.status}: ${a.statusText}`);
76
- if (L(a))
76
+ if (x(a))
77
77
  return ae(a, t);
78
78
  const s = await a.text();
79
79
  if (!s) return [];
80
80
  try {
81
- return M(JSON.parse(s));
81
+ return B(JSON.parse(s));
82
82
  } catch {
83
83
  throw new Error("Invalid JSON from product_groupings endpoint");
84
84
  }
85
85
  }
86
86
  function U(n) {
87
- const { product: e, index: t, discountType: r, onClick: i, onAddToCart: a, renderCard: s } = n, p = n.i18n, d = n.pricing;
87
+ const { product: e, index: t, discountType: r, onClick: i, onAddToCart: a, renderCard: s } = n, u = n.i18n, g = n.pricing;
88
88
  if (n.renderCardElement) {
89
89
  const o = n.renderCardElement(e, t);
90
90
  if (o) return o;
91
91
  }
92
92
  if (s) {
93
93
  const o = document.createElement("div");
94
- return o.className = "gengage-simrel-card gengage-simrel-card--custom", o.innerHTML = B(s(e, t)), o.addEventListener("click", (f) => {
94
+ return o.className = "gengage-simrel-card gengage-simrel-card--custom", o.innerHTML = q(s(e, t)), o.addEventListener("click", (f) => {
95
95
  f.target.closest(".gengage-simrel-atc") || f.target.closest(".gengage-chat-product-card-atc") || i(e);
96
96
  }), o;
97
97
  }
98
- const u = document.createElement("article");
99
- u.className = "gengage-simrel-card gengage-chat-product-card", u.setAttribute("role", "listitem"), u.dataset.sku = e.sku;
98
+ const l = document.createElement("article");
99
+ l.className = "gengage-simrel-card gengage-chat-product-card", e.inStock === !1 && l.classList.add("gengage-simrel-card--out-of-stock"), l.setAttribute("role", "listitem"), l.dataset.sku = e.sku;
100
100
  const c = document.createElement("div");
101
- if (c.className = "gengage-simrel-card-image gengage-chat-product-card-img-wrapper", e.imageUrl && q(e.imageUrl)) {
101
+ if (c.className = "gengage-simrel-card-image gengage-chat-product-card-img-wrapper", e.imageUrl && H(e.imageUrl)) {
102
102
  const o = document.createElement("img");
103
103
  o.className = "gengage-chat-product-card-img", o.src = e.imageUrl, o.alt = e.name, o.loading = "lazy", ee(o), c.appendChild(o);
104
104
  }
@@ -106,50 +106,52 @@ function U(n) {
106
106
  const o = document.createElement("span");
107
107
  o.className = "gengage-simrel-badge gengage-chat-product-card-discount-badge", o.textContent = `%${te(e.discountPercent)}`, c.appendChild(o);
108
108
  }
109
- u.appendChild(c);
110
- const g = document.createElement("div");
111
- if (g.className = "gengage-simrel-card-info gengage-chat-product-card-body", e.brand) {
109
+ l.appendChild(c);
110
+ const p = document.createElement("div");
111
+ if (p.className = "gengage-simrel-card-info gengage-chat-product-card-body", e.brand) {
112
112
  const o = document.createElement("div");
113
- o.className = "gengage-simrel-card-brand gengage-chat-product-card-brand", o.textContent = e.brand, g.appendChild(o);
113
+ o.className = "gengage-simrel-card-brand gengage-chat-product-card-brand", o.textContent = e.brand, p.appendChild(o);
114
114
  }
115
115
  const m = document.createElement("div");
116
- if (m.className = "gengage-simrel-card-name gengage-chat-product-card-name", m.textContent = e.name, g.appendChild(m), e.rating != null && e.rating > 0) {
116
+ if (m.className = "gengage-simrel-card-name gengage-chat-product-card-name", m.textContent = e.name, m.title = e.name, p.appendChild(m), e.rating != null && e.rating > 0) {
117
117
  const o = document.createElement("div");
118
118
  if (o.className = "gengage-simrel-card-rating gengage-chat-product-card-rating", o.appendChild(ne(e.rating)), e.reviewCount != null) {
119
119
  const f = document.createElement("span");
120
120
  f.className = "gengage-simrel-card-review-count gengage-chat-product-card-review-count", f.textContent = ` (${e.reviewCount})`, o.appendChild(f);
121
121
  }
122
- g.appendChild(o);
122
+ p.appendChild(o);
123
123
  }
124
- const C = document.createElement("div");
125
- if (C.className = "gengage-simrel-card-price gengage-chat-product-card-price", e.originalPrice && e.originalPrice !== e.price && (r === "strike-through" || !r)) {
124
+ const y = document.createElement("div");
125
+ if (y.className = "gengage-simrel-card-price gengage-chat-product-card-price", e.originalPrice && e.originalPrice !== e.price && (r === "strike-through" || !r)) {
126
126
  const o = document.createElement("span");
127
- o.className = "gengage-simrel-card-price-original gengage-chat-product-card-original-price", o.textContent = T(e.originalPrice, d), C.appendChild(o);
127
+ o.className = "gengage-simrel-card-price-original gengage-chat-product-card-original-price", o.textContent = T(e.originalPrice, g), y.appendChild(o);
128
128
  }
129
- if (e.price) {
129
+ if (e.price && parseFloat(e.price) > 0) {
130
130
  const o = document.createElement("span");
131
- o.className = "gengage-simrel-card-price-current gengage-chat-product-card-price-current", o.textContent = T(e.price, d), C.appendChild(o);
131
+ o.className = "gengage-simrel-card-price-current gengage-chat-product-card-price-current", o.textContent = T(e.price, g), y.appendChild(o);
132
132
  }
133
- g.appendChild(C), u.appendChild(g);
134
- const l = document.createElement("button");
135
- if (l.className = "gengage-simrel-card-cta gengage-chat-product-card-cta", l.type = "button", l.textContent = p?.ctaLabel ?? "View", l.addEventListener("click", (o) => {
133
+ p.appendChild(y), l.appendChild(p);
134
+ const d = document.createElement("button");
135
+ if (d.className = "gengage-simrel-card-cta gengage-chat-product-card-cta", d.type = "button", d.textContent = u?.ctaLabel ?? "View", d.addEventListener("click", (o) => {
136
136
  o.preventDefault(), o.stopPropagation(), i(e);
137
- }), u.appendChild(l), e.inStock === !1) {
137
+ }), l.appendChild(d), e.inStock === !1) {
138
138
  const o = document.createElement("div");
139
- o.className = "gengage-simrel-card-oos", o.textContent = p?.outOfStockLabel ?? "Out of Stock", u.appendChild(o);
139
+ o.className = "gengage-simrel-card-oos", o.textContent = u?.outOfStockLabel ?? "Out of Stock", l.appendChild(o);
140
140
  } else if (e.cartCode) {
141
141
  const o = e.cartCode, f = re({
142
142
  compact: !0,
143
- label: p?.addToCartButton ?? "Add to Cart",
144
- onSubmit: (y) => {
145
- a({ sku: e.sku, quantity: y, cartCode: o });
143
+ label: u?.addToCartButton ?? "Add to Cart",
144
+ decreaseLabel: u?.decreaseLabel,
145
+ increaseLabel: u?.increaseLabel,
146
+ onSubmit: (C) => {
147
+ a({ sku: e.sku, quantity: C, cartCode: o });
146
148
  }
147
149
  });
148
- f.classList.add("gengage-simrel-atc"), u.appendChild(f);
150
+ f.classList.add("gengage-simrel-atc"), l.appendChild(f);
149
151
  }
150
- return u.addEventListener("click", (o) => {
152
+ return l.addEventListener("click", (o) => {
151
153
  o.target.closest(".gengage-simrel-atc") || o.target.closest(".gengage-chat-product-card-atc") || o.target.closest(".gengage-chat-product-card-cta") || i(e);
152
- }), u;
154
+ }), l;
153
155
  }
154
156
  function w(n) {
155
157
  const e = document.createElement("div");
@@ -165,54 +167,48 @@ function w(n) {
165
167
  const a = U(i);
166
168
  e.appendChild(a);
167
169
  }
168
- if (n.products.length === 0) {
169
- const t = document.createElement("div");
170
- t.className = "gengage-simrel-empty", t.textContent = n.i18n?.emptyStateMessage ?? "No similar products found.", e.appendChild(t);
171
- }
172
- return e;
170
+ return n.products.length === 0 && (e.style.display = "none", e.dataset.empty = "true"), e;
173
171
  }
174
172
  let ce = 0;
175
173
  function de(n) {
176
174
  const e = ce++, t = document.createElement("div");
177
- if (t.className = "gengage-simrel-groups", n.groups.length === 0) {
178
- const c = document.createElement("div");
179
- return c.className = "gengage-simrel-empty", c.textContent = n.i18n?.emptyStateMessage ?? "No similar products found.", t.appendChild(c), t;
180
- }
175
+ if (t.className = "gengage-simrel-groups", n.groups.length === 0)
176
+ return t.style.display = "none", t.dataset.empty = "true", t;
181
177
  const r = document.createElement("div");
182
178
  r.className = "gengage-simrel-tabs", r.setAttribute("role", "tablist");
183
179
  const i = [], a = [], s = (c) => {
184
- const g = {
180
+ const p = {
185
181
  products: c.products,
186
182
  onClick: n.onClick,
187
183
  onAddToCart: n.onAddToCart
188
184
  };
189
- return n.i18n !== void 0 && (g.i18n = n.i18n), n.discountType !== void 0 && (g.discountType = n.discountType), n.renderCard !== void 0 && (g.renderCard = n.renderCard), n.renderCardElement !== void 0 && (g.renderCardElement = n.renderCardElement), g;
190
- }, p = (c) => {
191
- for (let l = 0; l < i.length; l++) {
192
- const o = l === c;
193
- i[l].classList.toggle("gengage-simrel-tab--active", o), i[l].setAttribute("aria-selected", String(o)), i[l].tabIndex = o ? 0 : -1;
185
+ return n.i18n !== void 0 && (p.i18n = n.i18n), n.discountType !== void 0 && (p.discountType = n.discountType), n.renderCard !== void 0 && (p.renderCard = n.renderCard), n.renderCardElement !== void 0 && (p.renderCardElement = n.renderCardElement), p;
186
+ }, u = (c) => {
187
+ for (let d = 0; d < i.length; d++) {
188
+ const o = d === c;
189
+ i[d].classList.toggle("gengage-simrel-tab--active", o), i[d].setAttribute("aria-selected", String(o)), i[d].tabIndex = o ? 0 : -1;
194
190
  }
195
- const g = n.groups[c], m = a[c];
191
+ const p = n.groups[c], m = a[c];
196
192
  m.innerHTML = "";
197
- const C = w(s(g));
198
- m.appendChild(C);
199
- for (let l = 0; l < a.length; l++) {
200
- const o = l === c;
201
- a[l].style.display = o ? "" : "none", a[l].tabIndex = o ? 0 : -1;
193
+ const y = w(s(p));
194
+ m.appendChild(y);
195
+ for (let d = 0; d < a.length; d++) {
196
+ const o = d === c;
197
+ a[d].style.display = o ? "" : "none", a[d].tabIndex = o ? 0 : -1;
202
198
  }
203
199
  };
204
200
  for (let c = 0; c < n.groups.length; c++) {
205
- const g = n.groups[c], m = `gengage-simrel-tab-${e}-${c}`, C = `gengage-simrel-panel-${e}-${c}`, l = document.createElement("button");
206
- l.className = "gengage-simrel-tab", l.type = "button", l.id = m, l.textContent = g.name, l.setAttribute("role", "tab"), l.setAttribute("aria-controls", C), l.setAttribute("aria-selected", String(c === 0)), l.tabIndex = c === 0 ? 0 : -1, c === 0 && l.classList.add("gengage-simrel-tab--active"), l.addEventListener("click", () => p(c)), l.addEventListener("keydown", (f) => {
207
- let y = -1;
208
- f.key === "ArrowRight" || f.key === "ArrowDown" ? y = (c + 1) % n.groups.length : f.key === "ArrowLeft" || f.key === "ArrowUp" ? y = (c - 1 + n.groups.length) % n.groups.length : f.key === "Home" ? y = 0 : f.key === "End" && (y = n.groups.length - 1), y >= 0 && (f.preventDefault(), p(y), i[y].focus());
209
- }), i.push(l), r.appendChild(l);
201
+ const p = n.groups[c], m = `gengage-simrel-tab-${e}-${c}`, y = `gengage-simrel-panel-${e}-${c}`, d = document.createElement("button");
202
+ d.className = "gengage-simrel-tab", d.type = "button", d.id = m, d.textContent = p.name, d.setAttribute("role", "tab"), d.setAttribute("aria-controls", y), d.setAttribute("aria-selected", String(c === 0)), d.tabIndex = c === 0 ? 0 : -1, c === 0 && d.classList.add("gengage-simrel-tab--active"), d.addEventListener("click", () => u(c)), d.addEventListener("keydown", (f) => {
203
+ let C = -1;
204
+ f.key === "ArrowRight" || f.key === "ArrowDown" ? C = (c + 1) % n.groups.length : f.key === "ArrowLeft" || f.key === "ArrowUp" ? C = (c - 1 + n.groups.length) % n.groups.length : f.key === "Home" ? C = 0 : f.key === "End" && (C = n.groups.length - 1), C >= 0 && (f.preventDefault(), u(C), i[C].focus());
205
+ }), i.push(d), r.appendChild(d);
210
206
  const o = document.createElement("div");
211
- o.className = "gengage-simrel-tab-panel", o.id = C, o.setAttribute("role", "tabpanel"), o.setAttribute("aria-labelledby", m), o.tabIndex = c === 0 ? 0 : -1, c !== 0 && (o.style.display = "none"), a.push(o);
207
+ o.className = "gengage-simrel-tab-panel", o.id = y, o.setAttribute("role", "tabpanel"), o.setAttribute("aria-labelledby", m), o.tabIndex = c === 0 ? 0 : -1, c !== 0 && (o.style.display = "none"), a.push(o);
212
208
  }
213
209
  t.appendChild(r);
214
- const d = a[0], u = w(s(n.groups[0]));
215
- d.appendChild(u);
210
+ const g = a[0], l = w(s(n.groups[0]));
211
+ g.appendChild(l);
216
212
  for (const c of a) t.appendChild(c);
217
213
  return t;
218
214
  }
@@ -233,16 +229,16 @@ function A(n) {
233
229
  typeof a == "string" && (t.originalPrice = a);
234
230
  const s = e.discountPercent;
235
231
  typeof s == "number" && (t.discountPercent = s);
236
- const p = e.brand;
237
- typeof p == "string" && (t.brand = p);
238
- const d = e.rating;
239
- typeof d == "number" && (t.rating = d);
240
- const u = e.reviewCount;
241
- typeof u == "number" && (t.reviewCount = u);
232
+ const u = e.brand;
233
+ typeof u == "string" && (t.brand = u);
234
+ const g = e.rating;
235
+ typeof g == "number" && (t.rating = g);
236
+ const l = e.reviewCount;
237
+ typeof l == "number" && (t.reviewCount = l);
242
238
  const c = e.cartCode;
243
239
  typeof c == "string" && (t.cartCode = c);
244
- const g = e.inStock;
245
- typeof g == "boolean" && (t.inStock = g);
240
+ const p = e.inStock;
241
+ typeof p == "boolean" && (t.inStock = p);
246
242
  const m = e.extras;
247
243
  return m != null && typeof m == "object" && (t.extras = m), t;
248
244
  }
@@ -272,14 +268,14 @@ const O = {
272
268
  ProductCard: ({ element: n, context: e }) => {
273
269
  const t = n.props?.product ?? n.props, r = A(t);
274
270
  if (!r) return null;
275
- const i = n.props?.index, a = typeof i == "number" && Number.isFinite(i) ? i : 0, s = n.props?.discountType, p = s === "strike-through" || s === "badge" ? s : e.discountType, d = {
271
+ const i = n.props?.index, a = typeof i == "number" && Number.isFinite(i) ? i : 0, s = n.props?.discountType, u = s === "strike-through" || s === "badge" ? s : e.discountType, g = {
276
272
  product: r,
277
273
  index: a,
278
274
  onClick: e.onClick,
279
275
  onAddToCart: e.onAddToCart,
280
276
  i18n: e.i18n
281
277
  };
282
- return p !== void 0 && (d.discountType = p), e.renderCard !== void 0 && (d.renderCard = e.renderCard), e.renderCardElement !== void 0 && (d.renderCardElement = e.renderCardElement), e.pricing !== void 0 && (d.pricing = e.pricing), U(d);
278
+ return u !== void 0 && (g.discountType = u), e.renderCard !== void 0 && (g.renderCard = e.renderCard), e.renderCardElement !== void 0 && (g.renderCardElement = e.renderCardElement), e.pricing !== void 0 && (g.pricing = e.pricing), U(g);
283
279
  },
284
280
  GroupTabs: ({ element: n, context: e }) => {
285
281
  const t = n.props?.groups;
@@ -289,17 +285,17 @@ const O = {
289
285
  if (!a || typeof a != "object") continue;
290
286
  const s = a;
291
287
  if (typeof s.name != "string") continue;
292
- const p = [];
288
+ const u = [];
293
289
  if (Array.isArray(s.products))
294
- for (const u of s.products) {
295
- const c = A(u);
296
- c && p.push(c);
290
+ for (const l of s.products) {
291
+ const c = A(l);
292
+ c && u.push(c);
297
293
  }
298
- const d = {
294
+ const g = {
299
295
  name: s.name,
300
- products: p
296
+ products: u
301
297
  };
302
- typeof s.highlight == "string" && (d.highlight = s.highlight), r.push(d);
298
+ typeof s.highlight == "string" && (g.highlight = s.highlight), r.push(g);
303
299
  }
304
300
  const i = {
305
301
  groups: r,
@@ -332,12 +328,12 @@ const O = {
332
328
  if (!Array.isArray(r) || !e.onAction) return t;
333
329
  for (const i of r) {
334
330
  if (!i || typeof i != "object") continue;
335
- const a = i, s = a.label, p = le(a.action);
336
- if (typeof s != "string" || !p) continue;
337
- const d = document.createElement("button");
338
- d.className = "gengage-simrel-quick-action", d.type = "button", d.textContent = s, d.addEventListener("click", (u) => {
339
- u.preventDefault(), u.stopPropagation(), e.onAction?.(p);
340
- }), t.appendChild(d);
331
+ const a = i, s = a.label, u = le(a.action);
332
+ if (typeof s != "string" || !u) continue;
333
+ const g = document.createElement("button");
334
+ g.className = "gengage-simrel-quick-action", g.type = "button", g.textContent = s, g.addEventListener("click", (l) => {
335
+ l.preventDefault(), l.stopPropagation(), e.onAction?.(u);
336
+ }), t.appendChild(g);
341
337
  }
342
338
  return t;
343
339
  }
@@ -358,7 +354,7 @@ function ue() {
358
354
  return { ...O };
359
355
  }
360
356
  function ge(n, e, t = O, r = G) {
361
- return z({
357
+ return M({
362
358
  spec: n,
363
359
  context: e,
364
360
  registry: t,
@@ -372,6 +368,8 @@ const D = {
372
368
  addToCartButton: "Sepete Ekle",
373
369
  ctaLabel: "İncele",
374
370
  outOfStockLabel: "Stokta Yok",
371
+ decreaseLabel: "Azalt",
372
+ increaseLabel: "Artır",
375
373
  priceSuffix: " TL"
376
374
  }, pe = {
377
375
  similarProductsAriaLabel: "Similar products",
@@ -379,6 +377,8 @@ const D = {
379
377
  addToCartButton: "Add to cart",
380
378
  ctaLabel: "View",
381
379
  outOfStockLabel: "Out of Stock",
380
+ decreaseLabel: "Decrease",
381
+ increaseLabel: "Increase",
382
382
  priceSuffix: ""
383
383
  };
384
384
  function me(n) {
@@ -398,19 +398,19 @@ const he = b({
398
398
  brand: h().optional(),
399
399
  rating: E().min(0).max(5).optional(),
400
400
  reviewCount: E().int().nonnegative().optional()
401
- }), Ce = b({
402
- layout: x(["grid", "carousel"]).optional(),
403
- columns: E().int().positive().optional()
404
401
  }), ye = b({
402
+ layout: N(["grid", "carousel"]).optional(),
403
+ columns: E().int().positive().optional()
404
+ }), Ce = b({
405
405
  product: he,
406
406
  index: E().int().nonnegative(),
407
- discountType: x(["strike-through", "badge"]).optional()
407
+ discountType: N(["strike-through", "badge"]).optional()
408
408
  }), be = b({
409
409
  sku: h(),
410
410
  label: h().optional(),
411
411
  cartCode: h()
412
412
  }), Ee = b({
413
- actions: H(
413
+ actions: z(
414
414
  b({
415
415
  label: h(),
416
416
  action: b({
@@ -425,11 +425,11 @@ const he = b({
425
425
  }), Te = {
426
426
  components: {
427
427
  ProductGrid: {
428
- schema: Ce,
428
+ schema: ye,
429
429
  description: "Outer grid or carousel container for similar products."
430
430
  },
431
431
  ProductCard: {
432
- schema: ye,
432
+ schema: Ce,
433
433
  description: "A single product card with image, title, price, and actions."
434
434
  },
435
435
  AddToCartButton: {
@@ -506,58 +506,58 @@ class ke extends F {
506
506
  }
507
507
  async _fetchAndRender(e) {
508
508
  this._abort(), this._abortController = new AbortController();
509
- const t = this._abortController.signal;
510
- if (!this._contentEl) return;
509
+ const t = this._abortController.signal, r = setTimeout(() => this._abortController?.abort(), 1e4);
510
+ if (t.addEventListener("abort", () => clearTimeout(r)), !this._contentEl) return;
511
511
  this._contentEl.innerHTML = "", this._contentEl.style.display = "";
512
- const r = document.createElement("div");
513
- r.className = "gengage-simrel-loading";
514
512
  const i = document.createElement("div");
515
- i.className = "gengage-simrel-spinner", r.appendChild(i), this._contentEl.appendChild(r);
516
- const a = {
513
+ i.className = "gengage-simrel-loading";
514
+ const a = document.createElement("div");
515
+ a.className = "gengage-simrel-spinner", i.appendChild(a), this._contentEl.appendChild(i);
516
+ const s = {
517
517
  middlewareUrl: this.config.middlewareUrl
518
- }, s = crypto.randomUUID(), p = Date.now();
518
+ }, u = crypto.randomUUID(), g = Date.now();
519
519
  this.track(
520
520
  Y(this.analyticsContext(), {
521
521
  endpoint: "similar_products",
522
- request_id: s,
522
+ request_id: u,
523
523
  widget: "simrel"
524
524
  })
525
525
  );
526
526
  try {
527
- const d = {
527
+ const l = {
528
528
  account_id: this.config.accountId,
529
529
  session_id: this.config.session?.sessionId ?? "",
530
530
  correlation_id: this.config.session?.sessionId ?? "",
531
531
  sku: e
532
532
  };
533
- this.config.domain !== void 0 && (d.domain = this.config.domain);
534
- const u = await oe(d, a, t);
533
+ this.config.domain !== void 0 && (l.domain = this.config.domain);
534
+ const c = await oe(l, s, t);
535
535
  if (!this._contentEl) return;
536
- if (this._contentEl.innerHTML = "", u.length > 0)
536
+ if (this._contentEl.innerHTML = "", c.length > 0)
537
537
  try {
538
- const c = u.map((m) => m.sku), g = await se(
538
+ const p = c.map((y) => y.sku), m = await se(
539
539
  {
540
540
  account_id: this.config.accountId,
541
541
  session_id: this.config.session?.sessionId ?? "",
542
542
  correlation_id: this.config.session?.sessionId ?? "",
543
- skus: c
543
+ skus: p
544
544
  },
545
- a,
545
+ s,
546
546
  t
547
547
  );
548
- if (g.length > 0 && this._contentEl) {
549
- const m = this._buildGroupsSpec(g), C = this._renderUISpec(m);
550
- this._contentEl.appendChild(C), k("simrel"), this.track(
548
+ if (m.length > 0 && this._contentEl) {
549
+ const y = this._buildGroupsSpec(m), d = this._renderUISpec(y);
550
+ this._contentEl.appendChild(d), k("simrel"), this.track(
551
551
  _(this.analyticsContext(), {
552
- request_id: s,
553
- latency_ms: Date.now() - p,
554
- chunk_count: g.reduce((l, o) => l + o.products.length, 0),
552
+ request_id: u,
553
+ latency_ms: Date.now() - g,
554
+ chunk_count: m.reduce((o, f) => o + f.products.length, 0),
555
555
  widget: "simrel"
556
556
  })
557
557
  ), this.track(
558
558
  S(this.analyticsContext(), {
559
- message_count: g.reduce((l, o) => l + o.products.length, 0),
560
- history_ref: s,
559
+ message_count: m.reduce((o, f) => o + f.products.length, 0),
560
+ history_ref: u,
561
561
  redaction_level: "none",
562
562
  widget: "simrel"
563
563
  })
@@ -566,48 +566,49 @@ class ke extends F {
566
566
  }
567
567
  } catch {
568
568
  }
569
+ if (t.aborted) return;
569
570
  if (this._contentEl) {
570
- const c = this._buildProductsSpec(u), g = this._renderUISpec(c);
571
- this._contentEl.appendChild(g);
571
+ const p = this._buildProductsSpec(c), m = this._renderUISpec(p);
572
+ this._contentEl.appendChild(m);
572
573
  }
573
- u.length > 0 && k("simrel"), this.track(
574
+ c.length > 0 && k("simrel"), this.track(
574
575
  _(this.analyticsContext(), {
575
- request_id: s,
576
- latency_ms: Date.now() - p,
577
- chunk_count: u.length,
576
+ request_id: u,
577
+ latency_ms: Date.now() - g,
578
+ chunk_count: c.length,
578
579
  widget: "simrel"
579
580
  })
580
581
  ), this.track(
581
582
  S(this.analyticsContext(), {
582
- message_count: u.length,
583
- history_ref: s,
583
+ message_count: c.length,
584
+ history_ref: u,
584
585
  redaction_level: "none",
585
586
  widget: "simrel"
586
587
  })
587
588
  );
588
- } catch (d) {
589
- if (d instanceof DOMException && d.name === "AbortError") return;
589
+ } catch (l) {
590
+ if (l instanceof DOMException && l.name === "AbortError") return;
590
591
  if (v("gengage:global:error", {
591
592
  source: "simrel",
592
593
  code: "FETCH_ERROR",
593
594
  message: K(this.config.locale)
594
595
  }), this.track(
595
596
  X(this.analyticsContext(), {
596
- request_id: s,
597
+ request_id: u,
597
598
  error_code: "FETCH_ERROR",
598
- error_message: d instanceof Error ? d.message : String(d),
599
+ error_message: l instanceof Error ? l.message : String(l),
599
600
  widget: "simrel"
600
601
  })
601
602
  ), this._contentEl) {
602
603
  this._contentEl.innerHTML = "";
603
- const u = document.createElement("div");
604
- u.className = "gengage-simrel-error", u.style.cssText = "text-align:center;padding:16px;color:#6b7280;font-size:13px;";
605
- const c = document.createElement("span");
606
- c.textContent = this.config.locale?.startsWith("tr") ? "Benzer ürünler yüklenemedi." : "Could not load similar products.", u.appendChild(c);
607
- const g = document.createElement("button");
608
- g.textContent = this.config.locale?.startsWith("tr") ? "Tekrar dene" : "Try again", g.style.cssText = "margin-left:8px;border:1px solid #d1d5db;background:#fff;border-radius:6px;padding:4px 12px;cursor:pointer;font-size:13px;color:#374151;", g.addEventListener("click", () => {
604
+ const c = document.createElement("div");
605
+ c.className = "gengage-simrel-error";
606
+ const p = document.createElement("span");
607
+ p.textContent = this.config.locale?.startsWith("tr") ? "Benzer ürünler yüklenemedi." : "Could not load similar products.", c.appendChild(p);
608
+ const m = document.createElement("button");
609
+ m.className = "gengage-simrel-retry", m.textContent = this.config.locale?.startsWith("tr") ? "Tekrar dene" : "Try again", m.addEventListener("click", () => {
609
610
  this._fetchAndRender(this.config.sku);
610
- }), u.appendChild(g), this._contentEl.appendChild(u);
611
+ }), c.appendChild(m), this._contentEl.appendChild(c);
611
612
  }
612
613
  }
613
614
  }
@@ -627,7 +628,7 @@ class ke extends F {
627
628
  return 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), t;
628
629
  }
629
630
  _renderUISpec(e) {
630
- const t = this._resolveUISpecRegistry(), r = this._buildRenderContext(), i = this.config.renderer?.unknownRenderer ?? G, a = (d, u) => ge(d, u, t, i), s = this.config.renderer?.renderUISpec;
631
+ const t = this._resolveUISpecRegistry(), r = this._buildRenderContext(), i = this.config.renderer?.unknownRenderer ?? G, a = (g, l) => ge(g, l, t, i), s = this.config.renderer?.renderUISpec;
631
632
  return s ? s(e, r, {
632
633
  registry: t,
633
634
  unknownRenderer: i,