@gengage/assistant-fe 0.1.8 → 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 +79 -286
  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-CcOJTzYu.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-BqIzV4ni.cjs +0 -2
  122. package/dist/index-BqIzV4ni.cjs.map +0 -1
  123. package/dist/index-CcOJTzYu.js.map +0 -1
  124. package/dist/index-DZ3Mi5xF.cjs +0 -13
  125. package/dist/index-DZ3Mi5xF.cjs.map +0 -1
  126. package/dist/index-FnP8WtfG.js +0 -4571
  127. package/dist/index-FnP8WtfG.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/simrel.js CHANGED
@@ -1,18 +1,18 @@
1
- import { b as A, p as D, q as j, c as I, a as R, r as M, o as b, s as h, f as q, e as B, _ as N, v, B as H, t as z, x as $, j as _, y as F, z as J, g as Q, i as E, h as k, w as S, k as W, l as V, m as Y } from "./schemas-yF4IOEUi.js";
2
- import { s as K, i as X, a as Z, c as ee, r as te, f as T, b as ne } from "./quantity-stepper-B8kX8GbN.js";
3
- function x(n) {
1
+ import { b as P, p as D, q as j, c as I, a as N, v as M, x as B, r as q, o as b, s as f, f as z, e as H, _ as x, y as v, B as $, t as F, z as J, j as E, A as W, C as Q, g as V, i as _, h as k, w as S, k as Y, l as K, m as X } from "./schemas-DIhL3DkL.js";
2
+ import { a as Z, c as ee, r as te, f as T, b as ne } from "./quantity-stepper-C-nV4lwi.js";
3
+ function R(n) {
4
4
  const e = n.headers.get("Content-Type") ?? "";
5
5
  return e.includes("application/x-ndjson") || e.includes("text/event-stream");
6
6
  }
7
7
  async function re(n, e) {
8
8
  const t = [], r = {
9
9
  onEvent: (i) => {
10
- const o = R(i);
10
+ const o = N(i);
11
11
  if (!(!o || o.type !== "ui_spec")) {
12
12
  for (const s of Object.values(o.spec.elements))
13
13
  if (s.type === "ProductCard" && s.props) {
14
- const u = s.props.product ?? s.props;
15
- typeof u.sku == "string" && typeof u.name == "string" && t.push(u);
14
+ const g = s.props.product ?? s.props;
15
+ typeof g.sku == "string" && typeof g.name == "string" && t.push(g);
16
16
  }
17
17
  }
18
18
  }
@@ -20,7 +20,7 @@ async function re(n, e) {
20
20
  return e !== void 0 && (r.signal = e), await I(n, r), t;
21
21
  }
22
22
  async function ie(n, e, t) {
23
- const r = A("similar_products", e), i = {
23
+ const r = P("similar_products", e), i = {
24
24
  method: "POST",
25
25
  headers: { "Content-Type": "application/json" },
26
26
  body: JSON.stringify(n)
@@ -29,7 +29,7 @@ async function ie(n, e, t) {
29
29
  const o = await fetch(r, i);
30
30
  if (!o.ok)
31
31
  throw new Error(`HTTP ${o.status}: ${o.statusText}`);
32
- if (x(o))
32
+ if (R(o))
33
33
  return re(o, t);
34
34
  const s = await o.text();
35
35
  if (!s) return [];
@@ -44,20 +44,20 @@ async function oe(n, e) {
44
44
  let r = null;
45
45
  const i = {
46
46
  onEvent: (o) => {
47
- const s = R(o);
47
+ const s = N(o);
48
48
  if (s) {
49
49
  if (s.type === "metadata" && s.meta) {
50
- const u = s.meta.group_name;
51
- if (typeof u == "string") {
52
- r = { name: u, products: [] };
50
+ const g = s.meta.group_name;
51
+ if (typeof g == "string") {
52
+ r = { name: g, products: [] };
53
53
  const d = s.meta.highlight;
54
54
  typeof d == "string" && (r.highlight = d), t.push(r);
55
55
  }
56
56
  }
57
57
  if (s.type === "ui_spec" && r) {
58
- for (const u of Object.values(s.spec.elements))
59
- if (u.type === "ProductCard" && u.props) {
60
- const d = u.props.product ?? u.props;
58
+ for (const g of Object.values(s.spec.elements))
59
+ if (g.type === "ProductCard" && g.props) {
60
+ const d = g.props.product ?? g.props;
61
61
  typeof d.sku == "string" && typeof d.name == "string" && r.products.push(d);
62
62
  }
63
63
  }
@@ -67,7 +67,7 @@ async function oe(n, e) {
67
67
  return e !== void 0 && (i.signal = e), await I(n, i), t;
68
68
  }
69
69
  async function se(n, e, t) {
70
- const r = A("product_groupings", e), i = {
70
+ const r = P("product_groupings", e), i = {
71
71
  method: "POST",
72
72
  headers: { "Content-Type": "application/json" },
73
73
  body: JSON.stringify(n)
@@ -76,7 +76,7 @@ async function se(n, e, t) {
76
76
  const o = await fetch(r, i);
77
77
  if (!o.ok)
78
78
  throw new Error(`HTTP ${o.status}: ${o.statusText}`);
79
- if (x(o))
79
+ if (R(o))
80
80
  return oe(o, t);
81
81
  const s = await o.text();
82
82
  if (!s) return [];
@@ -87,17 +87,17 @@ async function se(n, e, t) {
87
87
  }
88
88
  }
89
89
  function U(n) {
90
- const { product: e, index: t, discountType: r, onClick: i, onAddToCart: o, renderCard: s } = n, u = n.i18n, d = n.pricing;
90
+ const { product: e, index: t, discountType: r, onClick: i, onAddToCart: o, renderCard: s } = n, g = n.i18n, d = n.pricing;
91
91
  if (s) {
92
92
  const a = document.createElement("div");
93
- return a.className = "gengage-simrel-card gengage-simrel-card--custom", a.innerHTML = K(s(e, t)), a.addEventListener("click", (m) => {
93
+ return a.className = "gengage-simrel-card gengage-simrel-card--custom", a.innerHTML = M(s(e, t)), a.addEventListener("click", (m) => {
94
94
  m.target.closest(".gengage-simrel-atc") || m.target.closest(".gengage-chat-product-card-atc") || i(e);
95
95
  }), a;
96
96
  }
97
- const g = document.createElement("article");
98
- g.className = "gengage-simrel-card gengage-chat-product-card", g.setAttribute("role", "listitem"), g.dataset.sku = e.sku;
97
+ const u = document.createElement("article");
98
+ u.className = "gengage-simrel-card gengage-chat-product-card", u.setAttribute("role", "listitem"), u.dataset.sku = e.sku;
99
99
  const c = document.createElement("div");
100
- if (c.className = "gengage-simrel-card-image gengage-chat-product-card-img-wrapper", e.imageUrl && X(e.imageUrl)) {
100
+ if (c.className = "gengage-simrel-card-image gengage-chat-product-card-img-wrapper", e.imageUrl && B(e.imageUrl)) {
101
101
  const a = document.createElement("img");
102
102
  a.className = "gengage-chat-product-card-img", a.src = e.imageUrl, a.alt = e.name, a.loading = "lazy", Z(a), c.appendChild(a);
103
103
  }
@@ -105,14 +105,14 @@ function U(n) {
105
105
  const a = document.createElement("span");
106
106
  a.className = "gengage-simrel-badge gengage-chat-product-card-discount-badge", a.textContent = `%${ee(e.discountPercent)}`, c.appendChild(a);
107
107
  }
108
- g.appendChild(c);
108
+ u.appendChild(c);
109
109
  const p = document.createElement("div");
110
110
  if (p.className = "gengage-simrel-card-info gengage-chat-product-card-body", e.brand) {
111
111
  const a = document.createElement("div");
112
112
  a.className = "gengage-simrel-card-brand gengage-chat-product-card-brand", a.textContent = e.brand, p.appendChild(a);
113
113
  }
114
- const f = document.createElement("div");
115
- if (f.className = "gengage-simrel-card-name gengage-chat-product-card-name", f.textContent = e.name, p.appendChild(f), e.rating != null && e.rating > 0) {
114
+ const h = document.createElement("div");
115
+ if (h.className = "gengage-simrel-card-name gengage-chat-product-card-name", h.textContent = e.name, p.appendChild(h), e.rating != null && e.rating > 0) {
116
116
  const a = document.createElement("div");
117
117
  if (a.className = "gengage-simrel-card-rating gengage-chat-product-card-rating", a.textContent = te(e.rating), e.reviewCount != null) {
118
118
  const m = document.createElement("span");
@@ -129,23 +129,23 @@ function U(n) {
129
129
  const a = document.createElement("span");
130
130
  a.className = "gengage-simrel-card-price-current gengage-chat-product-card-price-current", a.textContent = T(e.price, d), y.appendChild(a);
131
131
  }
132
- p.appendChild(y), g.appendChild(p);
132
+ p.appendChild(y), u.appendChild(p);
133
133
  const l = document.createElement("button");
134
- if (l.className = "gengage-simrel-card-cta gengage-chat-product-card-cta", l.type = "button", l.textContent = "İncele", l.addEventListener("click", (a) => {
134
+ if (l.className = "gengage-simrel-card-cta gengage-chat-product-card-cta", l.type = "button", l.textContent = g?.ctaLabel ?? "View", l.addEventListener("click", (a) => {
135
135
  a.preventDefault(), a.stopPropagation(), i(e);
136
- }), g.appendChild(l), e.cartCode && e.inStock !== !1) {
136
+ }), u.appendChild(l), e.cartCode && e.inStock !== !1) {
137
137
  const a = e.cartCode, m = ne({
138
138
  compact: !0,
139
- label: u?.addToCartButton ?? "Sepete Ekle",
139
+ label: g?.addToCartButton ?? "Add to Cart",
140
140
  onSubmit: (C) => {
141
141
  o({ sku: e.sku, quantity: C, cartCode: a });
142
142
  }
143
143
  });
144
- m.classList.add("gengage-simrel-atc", "gengage-chat-product-card-atc"), g.appendChild(m);
144
+ m.classList.add("gengage-simrel-atc", "gengage-chat-product-card-atc"), u.appendChild(m);
145
145
  }
146
- return g.addEventListener("click", (a) => {
146
+ return u.addEventListener("click", (a) => {
147
147
  a.target.closest(".gengage-simrel-atc") || a.target.closest(".gengage-chat-product-card-atc") || a.target.closest(".gengage-chat-product-card-cta") || i(e);
148
- }), g;
148
+ }), u;
149
149
  }
150
150
  function w(n) {
151
151
  const e = document.createElement("div");
@@ -163,7 +163,7 @@ function w(n) {
163
163
  }
164
164
  if (n.products.length === 0) {
165
165
  const t = document.createElement("div");
166
- t.className = "gengage-simrel-empty", t.textContent = n.i18n?.emptyStateMessage ?? "Benzer ürün bulunamadı.", e.appendChild(t);
166
+ t.className = "gengage-simrel-empty", t.textContent = n.i18n?.emptyStateMessage ?? "No similar products found.", e.appendChild(t);
167
167
  }
168
168
  return e;
169
169
  }
@@ -172,7 +172,7 @@ function ce(n) {
172
172
  const e = ae++, t = document.createElement("div");
173
173
  if (t.className = "gengage-simrel-groups", n.groups.length === 0) {
174
174
  const c = document.createElement("div");
175
- return c.className = "gengage-simrel-empty", c.textContent = n.i18n?.emptyStateMessage ?? "Benzer ürün bulunamadı.", t.appendChild(c), t;
175
+ return c.className = "gengage-simrel-empty", c.textContent = n.i18n?.emptyStateMessage ?? "No similar products found.", t.appendChild(c), t;
176
176
  }
177
177
  const r = document.createElement("div");
178
178
  r.className = "gengage-simrel-tabs", r.setAttribute("role", "tablist");
@@ -183,36 +183,36 @@ function ce(n) {
183
183
  onAddToCart: n.onAddToCart
184
184
  };
185
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), p;
186
- }, u = (c) => {
186
+ }, g = (c) => {
187
187
  for (let l = 0; l < i.length; l++) {
188
188
  const a = l === c;
189
189
  i[l].classList.toggle("gengage-simrel-tab--active", a), i[l].setAttribute("aria-selected", String(a)), i[l].tabIndex = a ? 0 : -1;
190
190
  }
191
- const p = n.groups[c], f = o[c];
192
- f.innerHTML = "";
191
+ const p = n.groups[c], h = o[c];
192
+ h.innerHTML = "";
193
193
  const y = w(s(p));
194
- f.appendChild(y);
194
+ h.appendChild(y);
195
195
  for (let l = 0; l < o.length; l++) {
196
196
  const a = l === c;
197
197
  o[l].style.display = a ? "" : "none", o[l].tabIndex = a ? 0 : -1;
198
198
  }
199
199
  };
200
200
  for (let c = 0; c < n.groups.length; c++) {
201
- const p = n.groups[c], f = `gengage-simrel-tab-${e}-${c}`, y = `gengage-simrel-panel-${e}-${c}`, l = document.createElement("button");
202
- l.className = "gengage-simrel-tab", l.type = "button", l.id = f, l.textContent = p.name, l.setAttribute("role", "tab"), l.setAttribute("aria-controls", y), 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", () => u(c)), l.addEventListener("keydown", (m) => {
201
+ const p = n.groups[c], h = `gengage-simrel-tab-${e}-${c}`, y = `gengage-simrel-panel-${e}-${c}`, l = document.createElement("button");
202
+ l.className = "gengage-simrel-tab", l.type = "button", l.id = h, l.textContent = p.name, l.setAttribute("role", "tab"), l.setAttribute("aria-controls", y), 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", () => g(c)), l.addEventListener("keydown", (m) => {
203
203
  let C = -1;
204
- m.key === "ArrowRight" || m.key === "ArrowDown" ? C = (c + 1) % n.groups.length : m.key === "ArrowLeft" || m.key === "ArrowUp" ? C = (c - 1 + n.groups.length) % n.groups.length : m.key === "Home" ? C = 0 : m.key === "End" && (C = n.groups.length - 1), C >= 0 && (m.preventDefault(), u(C), i[C].focus());
204
+ m.key === "ArrowRight" || m.key === "ArrowDown" ? C = (c + 1) % n.groups.length : m.key === "ArrowLeft" || m.key === "ArrowUp" ? C = (c - 1 + n.groups.length) % n.groups.length : m.key === "Home" ? C = 0 : m.key === "End" && (C = n.groups.length - 1), C >= 0 && (m.preventDefault(), g(C), i[C].focus());
205
205
  }), i.push(l), r.appendChild(l);
206
206
  const a = document.createElement("div");
207
- a.className = "gengage-simrel-tab-panel", a.id = y, a.setAttribute("role", "tabpanel"), a.setAttribute("aria-labelledby", f), a.tabIndex = c === 0 ? 0 : -1, c !== 0 && (a.style.display = "none"), o.push(a);
207
+ a.className = "gengage-simrel-tab-panel", a.id = y, a.setAttribute("role", "tabpanel"), a.setAttribute("aria-labelledby", h), a.tabIndex = c === 0 ? 0 : -1, c !== 0 && (a.style.display = "none"), o.push(a);
208
208
  }
209
209
  t.appendChild(r);
210
- const d = o[0], g = w(s(n.groups[0]));
211
- d.appendChild(g);
210
+ const d = o[0], u = w(s(n.groups[0]));
211
+ d.appendChild(u);
212
212
  for (const c of o) t.appendChild(c);
213
213
  return t;
214
214
  }
215
- function P(n) {
215
+ function A(n) {
216
216
  if (!n || typeof n != "object") return null;
217
217
  const e = n;
218
218
  if (typeof e.sku != "string" || typeof e.name != "string" || typeof e.url != "string")
@@ -229,12 +229,12 @@ function P(n) {
229
229
  typeof o == "string" && (t.originalPrice = o);
230
230
  const s = e.discountPercent;
231
231
  typeof s == "number" && (t.discountPercent = s);
232
- const u = e.brand;
233
- typeof u == "string" && (t.brand = u);
232
+ const g = e.brand;
233
+ typeof g == "string" && (t.brand = g);
234
234
  const d = e.rating;
235
235
  typeof d == "number" && (t.rating = d);
236
- const g = e.reviewCount;
237
- typeof g == "number" && (t.reviewCount = g);
236
+ const u = e.reviewCount;
237
+ typeof u == "number" && (t.reviewCount = u);
238
238
  const c = e.cartCode;
239
239
  typeof c == "string" && (t.cartCode = c);
240
240
  const p = e.inStock;
@@ -264,16 +264,16 @@ const L = {
264
264
  return r;
265
265
  },
266
266
  ProductCard: ({ element: n, context: e }) => {
267
- const t = n.props?.product ?? n.props, r = P(t);
267
+ const t = n.props?.product ?? n.props, r = A(t);
268
268
  if (!r) return null;
269
- const i = n.props?.index, o = typeof i == "number" && Number.isFinite(i) ? i : 0, s = n.props?.discountType, u = s === "strike-through" || s === "badge" ? s : e.discountType, d = {
269
+ const i = n.props?.index, o = typeof i == "number" && Number.isFinite(i) ? i : 0, s = n.props?.discountType, g = s === "strike-through" || s === "badge" ? s : e.discountType, d = {
270
270
  product: r,
271
271
  index: o,
272
272
  onClick: e.onClick,
273
273
  onAddToCart: e.onAddToCart,
274
274
  i18n: e.i18n
275
275
  };
276
- return u !== void 0 && (d.discountType = u), e.renderCard !== void 0 && (d.renderCard = e.renderCard), e.pricing !== void 0 && (d.pricing = e.pricing), U(d);
276
+ return g !== void 0 && (d.discountType = g), e.renderCard !== void 0 && (d.renderCard = e.renderCard), e.pricing !== void 0 && (d.pricing = e.pricing), U(d);
277
277
  },
278
278
  GroupTabs: ({ element: n, context: e }) => {
279
279
  const t = n.props?.groups;
@@ -283,15 +283,15 @@ const L = {
283
283
  if (!o || typeof o != "object") continue;
284
284
  const s = o;
285
285
  if (typeof s.name != "string") continue;
286
- const u = [];
286
+ const g = [];
287
287
  if (Array.isArray(s.products))
288
- for (const g of s.products) {
289
- const c = P(g);
290
- c && u.push(c);
288
+ for (const u of s.products) {
289
+ const c = A(u);
290
+ c && g.push(c);
291
291
  }
292
292
  const d = {
293
293
  name: s.name,
294
- products: u
294
+ products: g
295
295
  };
296
296
  typeof s.highlight == "string" && (d.highlight = s.highlight), r.push(d);
297
297
  }
@@ -326,11 +326,11 @@ const L = {
326
326
  if (!Array.isArray(r) || !e.onAction) return t;
327
327
  for (const i of r) {
328
328
  if (!i || typeof i != "object") continue;
329
- const o = i, s = o.label, u = de(o.action);
330
- if (typeof s != "string" || !u) continue;
329
+ const o = i, s = o.label, g = de(o.action);
330
+ if (typeof s != "string" || !g) continue;
331
331
  const d = document.createElement("button");
332
- d.className = "gengage-simrel-quick-action", d.type = "button", d.textContent = s, d.addEventListener("click", (g) => {
333
- g.preventDefault(), g.stopPropagation(), e.onAction?.(u);
332
+ d.className = "gengage-simrel-quick-action", d.type = "button", d.textContent = s, d.addEventListener("click", (u) => {
333
+ u.preventDefault(), u.stopPropagation(), e.onAction?.(g);
334
334
  }), t.appendChild(d);
335
335
  }
336
336
  return t;
@@ -352,7 +352,7 @@ function le() {
352
352
  return { ...L };
353
353
  }
354
354
  function ue(n, e, t = L, r = G) {
355
- return M({
355
+ return q({
356
356
  spec: n,
357
357
  context: e,
358
358
  registry: t,
@@ -364,11 +364,13 @@ const O = {
364
364
  similarProductsAriaLabel: "Benzer ürünler",
365
365
  emptyStateMessage: "Benzer ürün bulunamadı.",
366
366
  addToCartButton: "Sepete Ekle",
367
+ ctaLabel: "İncele",
367
368
  priceSuffix: " TL"
368
369
  }, ge = {
369
370
  similarProductsAriaLabel: "Similar products",
370
371
  emptyStateMessage: "No similar products found.",
371
372
  addToCartButton: "Add to cart",
373
+ ctaLabel: "View",
372
374
  priceSuffix: ""
373
375
  };
374
376
  function pe(n) {
@@ -377,45 +379,45 @@ function pe(n) {
377
379
  function me(n) {
378
380
  return pe(n) === "en" ? ge : O;
379
381
  }
380
- const he = b({
381
- sku: h(),
382
- name: h(),
383
- imageUrl: h().url().optional(),
384
- price: h().optional(),
385
- originalPrice: h().optional(),
382
+ const fe = b({
383
+ sku: f(),
384
+ name: f(),
385
+ imageUrl: f().url().optional(),
386
+ price: f().optional(),
387
+ originalPrice: f().optional(),
386
388
  discountPercent: v().optional(),
387
- url: h().url(),
388
- brand: h().optional(),
389
+ url: f().url(),
390
+ brand: f().optional(),
389
391
  rating: v().min(0).max(5).optional(),
390
392
  reviewCount: v().int().nonnegative().optional()
391
- }), fe = b({
392
- layout: N(["grid", "carousel"]).optional(),
393
+ }), he = b({
394
+ layout: x(["grid", "carousel"]).optional(),
393
395
  columns: v().int().positive().optional()
394
396
  }), ye = b({
395
- product: he,
397
+ product: fe,
396
398
  index: v().int().nonnegative(),
397
- discountType: N(["strike-through", "badge"]).optional()
399
+ discountType: x(["strike-through", "badge"]).optional()
398
400
  }), Ce = b({
399
- sku: h(),
400
- label: h().optional(),
401
- cartCode: h()
401
+ sku: f(),
402
+ label: f().optional(),
403
+ cartCode: f()
402
404
  }), be = b({
403
- actions: q(
405
+ actions: z(
404
406
  b({
405
- label: h(),
407
+ label: f(),
406
408
  action: b({
407
- title: h(),
408
- type: h(),
409
- payload: B().optional()
409
+ title: f(),
410
+ type: f(),
411
+ payload: H().optional()
410
412
  })
411
413
  })
412
414
  )
413
415
  }), ve = b({
414
- message: h().optional()
416
+ message: f().optional()
415
417
  }), Se = {
416
418
  components: {
417
419
  ProductGrid: {
418
- schema: fe,
420
+ schema: he,
419
421
  description: "Outer grid or carousel container for similar products."
420
422
  },
421
423
  ProductCard: {
@@ -436,12 +438,12 @@ const he = b({
436
438
  }
437
439
  }
438
440
  };
439
- class _e extends H {
441
+ class Ee extends $ {
440
442
  constructor() {
441
443
  super(...arguments), this._abortController = null, this._contentEl = null, this._i18n = O;
442
444
  }
443
445
  async onInit(e) {
444
- this._i18n = this._resolveI18n(e), this._contentEl = document.createElement("div"), this._contentEl.className = "gengage-simrel-container", this.root.appendChild(this._contentEl), this._lastSku = e.sku, await this._fetchAndRender(e.sku), this.isVisible = !0, z("simrel");
446
+ this._i18n = this._resolveI18n(e), this._contentEl = document.createElement("div"), this._contentEl.className = "gengage-simrel-container", this.root.appendChild(this._contentEl), this._lastSku = e.sku, await this._fetchAndRender(e.sku), this.isVisible = !0, F("simrel");
445
447
  }
446
448
  onUpdate(e) {
447
449
  const t = e.sku;
@@ -467,17 +469,17 @@ class _e extends H {
467
469
  url: e.url
468
470
  };
469
471
  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;
470
- $(e.sku, e.name);
472
+ J(e.sku, e.name);
471
473
  const r = this.config.session?.sessionId ?? null;
472
- _("gengage:similar:product-click", {
474
+ E("gengage:similar:product-click", {
473
475
  sku: e.sku,
474
476
  url: e.url,
475
477
  sessionId: r
476
478
  }), this.config.onProductNavigate?.(e.url, e.sku, r);
477
479
  }
478
480
  _handleAddToCart(e) {
479
- F(e.sku, e.quantity), this.config.onAddToCart?.(e), _("gengage:similar:add-to-cart", e), this.track(
480
- J(this.analyticsContext(), {
481
+ W(e.sku, e.quantity), this.config.onAddToCart?.(e), E("gengage:similar:add-to-cart", e), this.track(
482
+ Q(this.analyticsContext(), {
481
483
  attribution_source: "simrel",
482
484
  attribution_action_id: crypto.randomUUID(),
483
485
  cart_value: 0,
@@ -505,9 +507,9 @@ class _e extends H {
505
507
  i.className = "gengage-simrel-spinner", r.appendChild(i), this._contentEl.appendChild(r);
506
508
  const o = {
507
509
  middlewareUrl: this.config.middlewareUrl
508
- }, s = crypto.randomUUID(), u = Date.now();
510
+ }, s = crypto.randomUUID(), g = Date.now();
509
511
  this.track(
510
- Q(this.analyticsContext(), {
512
+ V(this.analyticsContext(), {
511
513
  endpoint: "similar_products",
512
514
  request_id: s,
513
515
  widget: "simrel"
@@ -521,11 +523,11 @@ class _e extends H {
521
523
  sku: e
522
524
  };
523
525
  this.config.domain !== void 0 && (d.domain = this.config.domain);
524
- const g = await ie(d, o, t);
526
+ const u = await ie(d, o, t);
525
527
  if (!this._contentEl) return;
526
- if (this._contentEl.innerHTML = "", g.length > 0)
528
+ if (this._contentEl.innerHTML = "", u.length > 0)
527
529
  try {
528
- const c = g.map((f) => f.sku), p = await se(
530
+ const c = u.map((h) => h.sku), p = await se(
529
531
  {
530
532
  account_id: this.config.accountId,
531
533
  session_id: this.config.session?.sessionId ?? "",
@@ -536,11 +538,11 @@ class _e extends H {
536
538
  t
537
539
  );
538
540
  if (p.length > 0 && this._contentEl) {
539
- const f = this._buildGroupsSpec(p), y = this._renderUISpec(f);
540
- this._contentEl.appendChild(y), E("simrel"), this.track(
541
+ const h = this._buildGroupsSpec(p), y = this._renderUISpec(h);
542
+ this._contentEl.appendChild(y), _("simrel"), this.track(
541
543
  k(this.analyticsContext(), {
542
544
  request_id: s,
543
- latency_ms: Date.now() - u,
545
+ latency_ms: Date.now() - g,
544
546
  chunk_count: p.reduce((l, a) => l + a.products.length, 0),
545
547
  widget: "simrel"
546
548
  })
@@ -557,19 +559,19 @@ class _e extends H {
557
559
  } catch {
558
560
  }
559
561
  if (this._contentEl) {
560
- const c = this._buildProductsSpec(g), p = this._renderUISpec(c);
562
+ const c = this._buildProductsSpec(u), p = this._renderUISpec(c);
561
563
  this._contentEl.appendChild(p);
562
564
  }
563
- g.length > 0 && E("simrel"), this.track(
565
+ u.length > 0 && _("simrel"), this.track(
564
566
  k(this.analyticsContext(), {
565
567
  request_id: s,
566
- latency_ms: Date.now() - u,
567
- chunk_count: g.length,
568
+ latency_ms: Date.now() - g,
569
+ chunk_count: u.length,
568
570
  widget: "simrel"
569
571
  })
570
572
  ), this.track(
571
573
  S(this.analyticsContext(), {
572
- message_count: g.length,
574
+ message_count: u.length,
573
575
  history_ref: s,
574
576
  redaction_level: "none",
575
577
  widget: "simrel"
@@ -577,18 +579,28 @@ class _e extends H {
577
579
  );
578
580
  } catch (d) {
579
581
  if (d instanceof DOMException && d.name === "AbortError") return;
580
- _("gengage:global:error", {
582
+ if (E("gengage:global:error", {
581
583
  source: "simrel",
582
584
  code: "FETCH_ERROR",
583
- message: W(this.config.locale)
585
+ message: Y(this.config.locale)
584
586
  }), this.track(
585
- V(this.analyticsContext(), {
587
+ K(this.analyticsContext(), {
586
588
  request_id: s,
587
589
  error_code: "FETCH_ERROR",
588
590
  error_message: d instanceof Error ? d.message : String(d),
589
591
  widget: "simrel"
590
592
  })
591
- ), this._contentEl && (this._contentEl.innerHTML = "", this._contentEl.style.display = "none");
593
+ ), this._contentEl) {
594
+ this._contentEl.innerHTML = "";
595
+ const u = document.createElement("div");
596
+ u.className = "gengage-simrel-error", u.style.cssText = "text-align:center;padding:16px;color:#6b7280;font-size:13px;";
597
+ const c = document.createElement("span");
598
+ c.textContent = this.config.locale?.startsWith("tr") ? "Benzer ürünler yüklenemedi." : "Could not load similar products.", u.appendChild(c);
599
+ const p = document.createElement("button");
600
+ p.textContent = this.config.locale?.startsWith("tr") ? "Tekrar dene" : "Try again", p.style.cssText = "margin-left:8px;border:1px solid #d1d5db;background:#fff;border-radius:6px;padding:4px 12px;cursor:pointer;font-size:13px;color:#374151;", p.addEventListener("click", () => {
601
+ this._fetchAndRender(this.config.sku);
602
+ }), u.appendChild(p), this._contentEl.appendChild(u);
603
+ }
592
604
  }
593
605
  }
594
606
  _resolveI18n(e) {
@@ -596,7 +608,7 @@ class _e extends H {
596
608
  }
597
609
  _resolveUISpecRegistry() {
598
610
  const e = le();
599
- return Y(e, this.config.renderer?.registry);
611
+ return X(e, this.config.renderer?.registry);
600
612
  }
601
613
  _buildRenderContext() {
602
614
  const e = this.config.renderCard, t = {
@@ -607,7 +619,7 @@ class _e extends H {
607
619
  return this.config.discountType !== void 0 && (t.discountType = this.config.discountType), e !== void 0 && (t.renderCard = e), this.config.pricing !== void 0 && (t.pricing = this.config.pricing), t;
608
620
  }
609
621
  _renderUISpec(e) {
610
- const t = this._resolveUISpecRegistry(), r = this._buildRenderContext(), i = this.config.renderer?.unknownRenderer ?? G, o = (d, g) => ue(d, g, t, i), s = this.config.renderer?.renderUISpec;
622
+ const t = this._resolveUISpecRegistry(), r = this._buildRenderContext(), i = this.config.renderer?.unknownRenderer ?? G, o = (d, u) => ue(d, u, t, i), s = this.config.renderer?.renderUISpec;
611
623
  return s ? s(e, r, {
612
624
  registry: t,
613
625
  unknownRenderer: i,
@@ -651,10 +663,10 @@ class _e extends H {
651
663
  }
652
664
  }
653
665
  function Te() {
654
- return new _e();
666
+ return new Ee();
655
667
  }
656
668
  export {
657
- _e as GengageSimRel,
669
+ Ee as GengageSimRel,
658
670
  le as createDefaultSimRelUISpecRegistry,
659
671
  Te as createSimRelWidget,
660
672
  G as defaultSimRelUnknownUISpecRenderer,