tanya-chatbot 0.3.8 → 0.3.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.
@@ -101,7 +101,7 @@ const st = () => ({ aiConversationUrl: "https://mdv3qwfi2j.execute-api.us-east-1
101
101
  const t = "https://tanya-sfcc-server.vercel.app/";
102
102
  try {
103
103
  const e = await E.post(
104
- `${t}api/auth/token-bm-grant?baseUrl=${Z()}&siteId=${q()}`
104
+ `${t}api/auth/token-bm-grant?baseUrl=${Z()}&siteId=${R()}`
105
105
  );
106
106
  return e.status === 200 && e.data.access_token ? e.data.access_token : (console.error("Failed to fetch token:", e.data), null);
107
107
  } catch (e) {
@@ -111,7 +111,7 @@ const st = () => ({ aiConversationUrl: "https://mdv3qwfi2j.execute-api.us-east-1
111
111
  const e = "https://tanya-sfcc-server.vercel.app/";
112
112
  try {
113
113
  const r = JSON.parse(sessionStorage.getItem("customerData") || "{}").dwsid, o = await E.post(
114
- `${e}api/auth/token-existing-guest-customer?dwsid=${r}&baseUrl=${Z()}&siteId=${q()}&pubCfg=${tt()}&envRef=${et()}&orgRef=${rt()}`,
114
+ `${e}api/auth/token-existing-guest-customer?dwsid=${r}&baseUrl=${Z()}&siteId=${R()}&pubCfg=${tt()}&envRef=${et()}&orgRef=${rt()}`,
115
115
  {},
116
116
  {
117
117
  headers: {
@@ -126,33 +126,33 @@ const st = () => ({ aiConversationUrl: "https://mdv3qwfi2j.execute-api.us-east-1
126
126
  }
127
127
  };
128
128
  async function Ot() {
129
- var g;
130
- const t = q(), e = "access_token_" + t, r = "expires_in_" + t, o = localStorage.getItem(r), n = localStorage.getItem(e);
131
- console.log(n);
132
- const s = ((g = JSON.parse(sessionStorage.getItem("customerData") || "{}")) == null ? void 0 : g.isGuest) || !0;
133
- if (o && n && (/* @__PURE__ */ new Date()).getTime() < parseInt(o))
134
- return console.log("access token found in local storage"), { access_token: n, expires_in: o };
135
- const { serverUrl: l } = st(), d = JSON.parse(
129
+ var i;
130
+ const t = "access_token", e = "expires_in", r = localStorage.getItem(e), o = localStorage.getItem(t);
131
+ console.log(o);
132
+ const n = ((i = JSON.parse(sessionStorage.getItem("customerData") || "{}")) == null ? void 0 : i.isGuest) || !0;
133
+ if (r && o && (/* @__PURE__ */ new Date()).getTime() < parseInt(r))
134
+ return console.log("access token found in local storage"), { access_token: o, expires_in: r };
135
+ const { serverUrl: l } = st(), s = JSON.parse(
136
136
  sessionStorage.getItem("customerData") || "{}"
137
- ).dwsid, i = JSON.parse(
137
+ ).dwsid, d = JSON.parse(
138
138
  sessionStorage.getItem("customerData") || "{}"
139
139
  ).usrRef;
140
140
  try {
141
- const w = s ? "unregister-auth" : "register-auth", S = await E.get(
142
- `${l}sc-api/${w}?dwsid=${d}&email=${i}&pubCfg=${tt()}&envRef=${et()}&orgRef=${rt()}&siteId=${q()}&token=true`,
141
+ const g = n ? "unregister-auth" : "register-auth", w = await E.get(
142
+ `${l}sc-api/${g}?dwsid=${s}&email=${d}&pubCfg=${tt()}&envRef=${et()}&orgRef=${rt()}&siteId=${R()}&token=true`,
143
143
  {
144
144
  withCredentials: !0
145
145
  }
146
146
  );
147
- return localStorage.setItem(e, S.data.access_token), localStorage.setItem(
148
- r,
149
- String((/* @__PURE__ */ new Date()).getTime() + S.data.expires_in * 1e3)
150
- ), localStorage.setItem("isGuest", s ? "true" : "false"), S.data;
151
- } catch (w) {
152
- console.log(w);
147
+ return localStorage.setItem(t, w.data.access_token), localStorage.setItem(
148
+ e,
149
+ String((/* @__PURE__ */ new Date()).getTime() + w.data.expires_in * 1e3)
150
+ ), localStorage.setItem("isGuest", n ? "true" : "false"), w.data;
151
+ } catch (g) {
152
+ console.log(g);
153
153
  }
154
154
  }
155
- const Z = () => sessionStorage.getItem("Host"), q = () => sessionStorage.getItem("SiteId"), tt = () => sessionStorage.getItem("pubCfg"), et = () => sessionStorage.getItem("envRef"), rt = () => sessionStorage.getItem("orgRef"), be = async (t) => {
155
+ const Z = () => sessionStorage.getItem("Host"), R = () => sessionStorage.getItem("SiteId"), tt = () => sessionStorage.getItem("pubCfg"), et = () => sessionStorage.getItem("envRef"), rt = () => sessionStorage.getItem("orgRef"), be = async (t) => {
156
156
  console.log("fetching results");
157
157
  const { serverUrl: e, basePath: r } = st();
158
158
  let o = "";
@@ -163,7 +163,7 @@ const Z = () => sessionStorage.getItem("Host"), q = () => sessionStorage.getItem
163
163
  try {
164
164
  const n = Z();
165
165
  return (await E.get(
166
- `${e}${r}/search-sfcc?baseUrl=${n}&query=${t}&siteId=${q()}&pubCfg=${tt()}&envRef=${et()}&orgRef=${rt()}`,
166
+ `${e}${r}/search-sfcc?baseUrl=${n}&query=${t}&siteId=${R()}&pubCfg=${tt()}&envRef=${et()}&orgRef=${rt()}`,
167
167
  {
168
168
  headers: {
169
169
  "Content-Type": "application/json",
@@ -180,7 +180,7 @@ const Z = () => sessionStorage.getItem("Host"), q = () => sessionStorage.getItem
180
180
  console.log("calling access");
181
181
  const { access_token: n } = await Ot();
182
182
  return console.log(n), (await E.get(
183
- `${e}${r}/product-sfcc/${t}?baseUrl=${o}&siteId=${q()}&pubCfg=${tt()}&envRef=${et()}&orgRef=${rt()}`,
183
+ `${e}${r}/product-sfcc/${t}?baseUrl=${o}&siteId=${R()}&pubCfg=${tt()}&envRef=${et()}&orgRef=${rt()}`,
184
184
  {
185
185
  headers: {
186
186
  "Content-Type": "application/json",
@@ -192,13 +192,13 @@ const Z = () => sessionStorage.getItem("Host"), q = () => sessionStorage.getItem
192
192
  if (!t) throw new Error("customerId is required");
193
193
  const e = await qe(), { customer_token: r } = await Me(
194
194
  e
195
- ), { serverUrl: o, basePath: n } = st(), l = (await Ot()).access_token;
195
+ ), { serverUrl: o, basePath: n } = st(), s = (await Ot()).access_token;
196
196
  return (await E.get(
197
- `${o}${n}/get-interest?baseUrl=${Z()}&customerId=${t}&siteId=${q()}&pubCfg=${tt()}&envRef=${et()}&orgRef=${rt()}`,
197
+ `${o}${n}/get-interest?baseUrl=${Z()}&customerId=${t}&siteId=${R()}&pubCfg=${tt()}&envRef=${et()}&orgRef=${rt()}`,
198
198
  {
199
199
  headers: {
200
200
  "Content-Type": "application/json",
201
- Authorization: `Bearer ${l}`
201
+ Authorization: `Bearer ${s}`
202
202
  }
203
203
  }
204
204
  )).data;
@@ -228,11 +228,11 @@ function Cr() {
228
228
  const _r = ({
229
229
  product: t
230
230
  }) => {
231
- const e = Ae(), r = Cr(), [o, n] = P(0), s = () => {
231
+ const e = Ae(), r = Cr(), [o, n] = P(0), l = () => {
232
232
  n(
233
233
  (i) => i + r >= t.length ? 0 : i + r
234
234
  );
235
- }, l = () => {
235
+ }, s = () => {
236
236
  n(
237
237
  (i) => i - r < 0 ? t.length - (t.length % r || r) : i - r
238
238
  );
@@ -244,7 +244,7 @@ const _r = ({
244
244
  (t == null ? void 0 : t.length) > r && /* @__PURE__ */ a(
245
245
  "button",
246
246
  {
247
- onClick: l,
247
+ onClick: s,
248
248
  className: "absolute z-50 left-0 text-[#000000] bg-[#ffffff] rounded-full p-2 flex items-center h-fit",
249
249
  style: {
250
250
  height: "30px",
@@ -255,7 +255,7 @@ const _r = ({
255
255
  }
256
256
  ),
257
257
  /* @__PURE__ */ a("div", { className: "flex gap-5 justify-center flex-1 overflow-hidden", children: t.slice(o, o + r).map((i) => {
258
- var g, w, S, C;
258
+ var g, w, C, S;
259
259
  return /* @__PURE__ */ u(
260
260
  "div",
261
261
  {
@@ -295,7 +295,7 @@ const _r = ({
295
295
  zIndex: 50
296
296
  },
297
297
  children: i != null && i.productName ? i.productName : i != null && i.product_name ? i.product_name : ke(
298
- xe((S = i == null ? void 0 : i.name) == null ? void 0 : S["en-US"]),
298
+ xe((C = i == null ? void 0 : i.name) == null ? void 0 : C["en-US"]),
299
299
  60
300
300
  ) || "Product"
301
301
  }
@@ -304,7 +304,7 @@ const _r = ({
304
304
  /* @__PURE__ */ u("div", { className: " flex text-center items-center gap-2 text-[14px] text-[#14121F] font-bold font-nunitoSans text-base mb-1", children: [
305
305
  /* @__PURE__ */ a("p", { children: kr(
306
306
  i != null && i.price ? Number(i == null ? void 0 : i.price) : ve(i).centAmount || 0,
307
- (C = ve(i)) == null ? void 0 : C.currencyCode
307
+ (S = ve(i)) == null ? void 0 : S.currencyCode
308
308
  ) }),
309
309
  /* @__PURE__ */ u("p", { className: "text-[#14121F] font-normal line-through text-sm font-nunitoSans truncate", children: [
310
310
  "$",
@@ -322,7 +322,7 @@ const _r = ({
322
322
  (t == null ? void 0 : t.length) > r && /* @__PURE__ */ a(
323
323
  "button",
324
324
  {
325
- onClick: s,
325
+ onClick: l,
326
326
  className: "absolute z-50 right-0 text-[#000000] bg-[#ffffff] rounded-full p-2 flex items-center h-fit",
327
327
  style: {
328
328
  height: "30px",
@@ -365,7 +365,7 @@ const _r = ({
365
365
  `, t);
366
366
  try {
367
367
  return (await E.post(
368
- `${n}${o}/basket/create?baseUrl=${Z()}&siteId=${q()}&pubCfg=${tt()}&envRef=${et()}&orgRef=${rt()}`,
368
+ `${n}${o}/basket/create?baseUrl=${Z()}&siteId=${R()}&pubCfg=${tt()}&envRef=${et()}&orgRef=${rt()}`,
369
369
  e,
370
370
  {
371
371
  headers: {
@@ -374,14 +374,14 @@ const _r = ({
374
374
  }
375
375
  }
376
376
  )).data;
377
- } catch (s) {
378
- return E.isAxiosError(s) ? console.error("Error creating basket:", s.response || s.message) : console.error("Unexpected error:", s), null;
377
+ } catch (l) {
378
+ return E.isAxiosError(l) ? console.error("Error creating basket:", l.response || l.message) : console.error("Unexpected error:", l), null;
379
379
  }
380
380
  }, Vt = async (t, e, r) => {
381
- const { serverUrl: o, basePath: n } = st(), s = `${o}`;
381
+ const { serverUrl: o, basePath: n } = st(), l = `${o}`;
382
382
  try {
383
- const l = await E.post(
384
- `${s}${n}/basket/add-product/${t}?baseUrl=${Z()}&siteId=${q()}&pubCfg=${tt()}&envRef=${et()}&orgRef=${rt()}`,
383
+ const s = await E.post(
384
+ `${l}${n}/basket/add-product/${t}?baseUrl=${Z()}&siteId=${R()}&pubCfg=${tt()}&envRef=${et()}&orgRef=${rt()}`,
385
385
  e,
386
386
  {
387
387
  headers: {
@@ -390,22 +390,22 @@ const _r = ({
390
390
  }
391
391
  }
392
392
  );
393
- return l.status === 200 && l.data ? l.data : null;
394
- } catch (l) {
395
- return E.isAxiosError(l) ? console.error(
393
+ return s.status === 200 && s.data ? s.data : null;
394
+ } catch (s) {
395
+ return E.isAxiosError(s) ? console.error(
396
396
  "Error adding products to basket:",
397
- l.response || l.message
398
- ) : console.error("Unexpected error:", l), null;
397
+ s.response || s.message
398
+ ) : console.error("Unexpected error:", s), null;
399
399
  }
400
400
  }, Re = async ({
401
401
  basketId: t,
402
402
  customer_token: e
403
403
  }) => {
404
- var s;
404
+ var l;
405
405
  const { serverUrl: r, basePath: o } = st(), n = `${r}`;
406
406
  try {
407
- const l = await E.get(
408
- `${n}${o}/basket/${t}?baseUrl=${Z()}&siteId=${q()}&pubCfg=${tt()}&envRef=${et()}&orgRef=${rt()}`,
407
+ const s = await E.get(
408
+ `${n}${o}/basket/${t}?baseUrl=${Z()}&siteId=${R()}&pubCfg=${tt()}&envRef=${et()}&orgRef=${rt()}`,
409
409
  {
410
410
  headers: {
411
411
  "Content-Type": "application/json",
@@ -413,9 +413,9 @@ const _r = ({
413
413
  }
414
414
  }
415
415
  );
416
- return { status: l.status, data: l.data };
417
- } catch (l) {
418
- return E.isAxiosError(l) ? { status: (s = l.response) == null ? void 0 : s.status, data: null } : { status: null, data: null };
416
+ return { status: s.status, data: s.data };
417
+ } catch (s) {
418
+ return E.isAxiosError(s) ? { status: (l = s.response) == null ? void 0 : l.status, data: null } : { status: null, data: null };
419
419
  }
420
420
  }, Rt = "sfcc_basket_id", Se = "sfcc_customer_token", Tt = "sfcc_token_expiry", Fr = 300 * 1e3, Ft = "1.0.0";
421
421
  const xt = (t) => {
@@ -436,16 +436,16 @@ const xt = (t) => {
436
436
  console.error("Error storing token:", e);
437
437
  }
438
438
  }, Ce = 300, Nr = () => {
439
- var d, i, g, w, S, C;
439
+ var d, i, g, w, C, S;
440
440
  const t = Ae(), e = Mt((_) => _.product.product), r = Mt((_) => _.store.store), [o, n] = P(!!e);
441
441
  if (bt(() => {
442
442
  n(!!e);
443
443
  }, [e]), !e) return null;
444
- const s = async () => {
445
- var _, j, M, H, lt, vt, Pt, ot, kt, St, ct, $t, zt, Ct, O, dt;
444
+ const l = async () => {
445
+ var _, j, q, M, lt, vt, Pt, ot, kt, St, ct, $t, zt, Ct, O, dt;
446
446
  console.log(e, "the prod");
447
447
  try {
448
- if (!((j = (_ = e == null ? void 0 : e.variants) == null ? void 0 : _[0]) != null && j.product_id) && !(e.type.item || e.type.bundle) && !((H = (M = e == null ? void 0 : e.variants) == null ? void 0 : M[0]) != null && H.productId)) {
448
+ if (!((j = (_ = e == null ? void 0 : e.variants) == null ? void 0 : _[0]) != null && j.product_id) && !(e.type.item || e.type.bundle) && !((M = (q = e == null ? void 0 : e.variants) == null ? void 0 : q[0]) != null && M.productId)) {
449
449
  U.error("Variants not available", {
450
450
  position: "bottom-right",
451
451
  autoClose: 1e3
@@ -544,7 +544,7 @@ const xt = (t) => {
544
544
  autoClose: 3e3
545
545
  }));
546
546
  }
547
- }, l = () => {
547
+ }, s = () => {
548
548
  e && (window.location.href = e.c_pdpUrl);
549
549
  };
550
550
  return console.log(e, "the prod"), /* @__PURE__ */ u(re, { children: [
@@ -637,19 +637,19 @@ const xt = (t) => {
637
637
  /* @__PURE__ */ u("div", { className: "mt-4 flex flex-col gap-2 w-full p-2", children: [
638
638
  /* @__PURE__ */ a("div", { className: "flex flex-row items-center gap-2", children: /* @__PURE__ */ u("div", { className: "flex items-center gap-2 text-left font-nunitoSans", children: [
639
639
  /* @__PURE__ */ u("div", { className: "text-[#323135] font-bold", children: [
640
- ((S = e == null ? void 0 : e.rating) == null ? void 0 : S.rate) || 0,
640
+ ((C = e == null ? void 0 : e.rating) == null ? void 0 : C.rate) || 0,
641
641
  " /",
642
642
  " ",
643
643
  /* @__PURE__ */ a("span", { className: "text-[#68656E]", children: "5" })
644
644
  ] }),
645
645
  /* @__PURE__ */ a("div", { className: "text-[#323135] font-semibold text-sm", children: "Overall Rating" }),
646
646
  /* @__PURE__ */ u("div", { className: "text-[#68656E] font-semibold text-sm", children: [
647
- ((C = e == null ? void 0 : e.rating) == null ? void 0 : C.count) || 0,
647
+ ((S = e == null ? void 0 : e.rating) == null ? void 0 : S.count) || 0,
648
648
  " ratings"
649
649
  ] })
650
650
  ] }) }),
651
651
  /* @__PURE__ */ a("div", { className: "mt-2 flex flex-row items-center gap-2", children: Array.from({ length: 5 }).map((_, j) => {
652
- var M;
652
+ var q;
653
653
  return /* @__PURE__ */ a(
654
654
  ge,
655
655
  {
@@ -657,7 +657,7 @@ const xt = (t) => {
657
657
  width: "20",
658
658
  height: "20",
659
659
  className: `text-yellow-500
660
- ${((M = e == null ? void 0 : e.rating) == null ? void 0 : M.rate) > j ? "text-yellow-500" : "text-gray-300"}
660
+ ${((q = e == null ? void 0 : e.rating) == null ? void 0 : q.rate) > j ? "text-yellow-500" : "text-gray-300"}
661
661
  `
662
662
  },
663
663
  j
@@ -675,7 +675,7 @@ const xt = (t) => {
675
675
  {
676
676
  className: "rounded-[5px] shadow-sm text-[#FBFBFC] bg-[#6851C6] p-2 w-full text-center cursor-pointer",
677
677
  style: { backgroundColor: r.tanyaThemeColor },
678
- onClick: s,
678
+ onClick: l,
679
679
  children: "Add to Cart"
680
680
  }
681
681
  ),
@@ -684,7 +684,7 @@ const xt = (t) => {
684
684
  {
685
685
  className: "rounded-[5px] shadow-sm text-[#FBFBFC] bg-[#6851C6] p-2 w-full text-center cursor-pointer mb-16",
686
686
  style: { backgroundColor: r.tanyaThemeColor },
687
- onClick: l,
687
+ onClick: s,
688
688
  children: "View more"
689
689
  }
690
690
  )
@@ -712,15 +712,15 @@ const xt = (t) => {
712
712
  "Niece/Nephew": "his/her niece/nephew",
713
713
  "My Friends": "his/her friends",
714
714
  Others: "others"
715
- }, o = It(null), n = It(null), s = It(null), l = It(null), [d, i] = P(null), [g, w] = P(!1), [S, C] = P(!1), [_, j] = P(!1), [M, H] = P(!1), [lt, vt] = P(!1), [Pt, ot] = P(!1), [kt, St] = P(""), [ct, $t] = P(""), zt = (c) => ({
715
+ }, o = It(null), n = It(null), l = It(null), s = It(null), [d, i] = P(null), [g, w] = P(!1), [C, S] = P(!1), [_, j] = P(!1), [q, M] = P(!1), [lt, vt] = P(!1), [Pt, ot] = P(!1), [kt, St] = P(""), [ct, $t] = P(""), zt = (c) => ({
716
716
  id: c.id,
717
717
  title: c.name,
718
718
  image: c.image ?? "",
719
719
  price: c.price ?? 0
720
720
  }), [Ct, O] = P([]), dt = It(null), p = Mt((c) => c.store.store), _t = Mt((c) => c.product.product), nt = () => {
721
- j(!0), setTimeout(() => C(!0), 10);
721
+ j(!0), setTimeout(() => S(!0), 10);
722
722
  }, Jt = () => {
723
- C(!1), setTimeout(() => j(!1), 300);
723
+ S(!1), setTimeout(() => j(!1), 300);
724
724
  };
725
725
  bt(() => {
726
726
  g ? nt() : Jt();
@@ -782,7 +782,7 @@ const xt = (t) => {
782
782
  try {
783
783
  O(
784
784
  (L) => L.map(
785
- (V, R) => R === L.length - 1 ? { ...V, secondaryLoading: !0 } : V
785
+ (H, V) => V === L.length - 1 ? { ...H, secondaryLoading: !0 } : H
786
786
  )
787
787
  );
788
788
  const y = await At();
@@ -812,13 +812,13 @@ const xt = (t) => {
812
812
  const ft = A.body.getReader(), mt = new TextDecoder();
813
813
  let D = "";
814
814
  for (; ; ) {
815
- const { done: L, value: V } = await ft.read();
815
+ const { done: L, value: H } = await ft.read();
816
816
  if (L) break;
817
- D += mt.decode(V, { stream: !0 });
818
- const R = D.split(`
817
+ D += mt.decode(H, { stream: !0 });
818
+ const V = D.split(`
819
819
  `);
820
- D = R.pop() || "";
821
- for (const G of R)
820
+ D = V.pop() || "";
821
+ for (const G of V)
822
822
  if (G.startsWith("data:")) {
823
823
  const m = G.slice(5).trim();
824
824
  try {
@@ -847,7 +847,7 @@ const xt = (t) => {
847
847
  }, J = async (c) => {
848
848
  const k = c || kt.trim();
849
849
  if (k) {
850
- vt(!0), St(""), o.current = null, n.current = null, s.current = null, l.current = null, O((b) => [
850
+ vt(!0), St(""), o.current = null, n.current = null, l.current = null, s.current = null, O((b) => [
851
851
  ...b,
852
852
  {
853
853
  query: k,
@@ -887,9 +887,9 @@ const xt = (t) => {
887
887
  let D = "", L = "";
888
888
  for (; ; ) {
889
889
  ot(!0);
890
- const { done: V, value: R } = await ft.read();
891
- if (V) break;
892
- D += mt.decode(R, { stream: !0 });
890
+ const { done: H, value: V } = await ft.read();
891
+ if (H) break;
892
+ D += mt.decode(V, { stream: !0 });
893
893
  const G = D.split(`
894
894
  `);
895
895
  D = G.pop() || "";
@@ -941,9 +941,9 @@ const xt = (t) => {
941
941
  )
942
942
  ), !o.current || n.current == null)) {
943
943
  const f = y[0];
944
- o.current = String((f == null ? void 0 : f.product_name) ?? ""), s.current = f.image.link, n.current = f.product_id;
944
+ o.current = String((f == null ? void 0 : f.product_name) ?? ""), l.current = f.image.link, n.current = f.product_id;
945
945
  const x = typeof (f == null ? void 0 : f.price) == "number" ? f.price : void 0;
946
- l.current = typeof x == "number" && Number.isFinite(x) ? x : null;
946
+ s.current = typeof x == "number" && Number.isFinite(x) ? x : null;
947
947
  }
948
948
  }
949
949
  } else
@@ -969,8 +969,8 @@ const xt = (t) => {
969
969
  productSnapshot: {
970
970
  id: n.current,
971
971
  name: o.current,
972
- image: s.current,
973
- price: l.current ?? null,
972
+ image: l.current,
973
+ price: s.current ?? null,
974
974
  points: 0,
975
975
  quantity: 1
976
976
  }
@@ -984,12 +984,12 @@ const xt = (t) => {
984
984
  }
985
985
  ot(!1);
986
986
  }, rr = async (c, k) => {
987
- var b, y, f, x, z, ut, pt, A, ft, mt, D, L, V, R, G;
988
- H(!0);
987
+ var b, y, f, x, z, ut, pt, A, ft, mt, D, L, H, V, G;
988
+ M(!0);
989
989
  try {
990
990
  const m = await He(c.id);
991
991
  if (!((y = (b = m == null ? void 0 : m.variants) == null ? void 0 : b[0]) != null && y.product_id || (x = (f = m == null ? void 0 : m.variants) == null ? void 0 : f[0]) != null && x.productId) && !(m.type.item || m.type.bundle)) {
992
- H(!1), U.error("Variants not found", {
992
+ M(!1), U.error("Variants not found", {
993
993
  position: "bottom-right",
994
994
  autoClose: 1e3
995
995
  }), console.error("No product variant found");
@@ -1033,7 +1033,7 @@ const xt = (t) => {
1033
1033
  closeOnClick: !0,
1034
1034
  pauseOnHover: !0,
1035
1035
  draggable: !0
1036
- }), Ht(T), H(!1));
1036
+ }), Ht(T), M(!1));
1037
1037
  return;
1038
1038
  }
1039
1039
  }
@@ -1051,7 +1051,7 @@ const xt = (t) => {
1051
1051
  v == null ? void 0 : v.basketId,
1052
1052
  "the basket response"
1053
1053
  ), !(v != null && v.basket_id || !(v != null && v.basketId))) {
1054
- H(!1), console.error("Failed to create basket");
1054
+ M(!1), console.error("Failed to create basket");
1055
1055
  return;
1056
1056
  }
1057
1057
  xt(
@@ -1072,16 +1072,16 @@ const xt = (t) => {
1072
1072
  }), Ht(v.basket_id || (v == null ? void 0 : v.basketId));
1073
1073
  }
1074
1074
  } catch (m) {
1075
- H(!1), console.error("Error adding to cart:", m), U.error("Failed to add product to cart", {
1075
+ M(!1), console.error("Error adding to cart:", m), U.error("Failed to add product to cart", {
1076
1076
  position: "bottom-right",
1077
1077
  autoClose: 3e3
1078
1078
  }), ((L = m == null ? void 0 : m.response) == null ? void 0 : L.status) === 404 || // Basket not found
1079
- ((V = m == null ? void 0 : m.response) == null ? void 0 : V.status) === 401 ? (((R = m == null ? void 0 : m.response) == null ? void 0 : R.status) === 404 && xt(null), ((G = m == null ? void 0 : m.response) == null ? void 0 : G.status) === 401 && (xt(null), Yt(null))) : (console.error("Failed to add product to basket:", m.message), U.error("Failed to add product to cart", {
1079
+ ((H = m == null ? void 0 : m.response) == null ? void 0 : H.status) === 401 ? (((V = m == null ? void 0 : m.response) == null ? void 0 : V.status) === 404 && xt(null), ((G = m == null ? void 0 : m.response) == null ? void 0 : G.status) === 401 && (xt(null), Yt(null))) : (console.error("Failed to add product to basket:", m.message), U.error("Failed to add product to cart", {
1080
1080
  position: "bottom-right",
1081
1081
  autoClose: 3e3
1082
1082
  }));
1083
1083
  }
1084
- H(!1);
1084
+ M(!1);
1085
1085
  };
1086
1086
  return /* @__PURE__ */ a("div", { className: "relative flex justify-center", children: /* @__PURE__ */ u(xr, { open: g, onOpenChange: w, children: [
1087
1087
  /* @__PURE__ */ a(
@@ -1163,9 +1163,9 @@ const xt = (t) => {
1163
1163
  top-0 right-0
1164
1164
  transition-transform duration-300 ease-in-out
1165
1165
  lg:transform
1166
- ${S ? "lg:translate-x-0" : "lg:translate-x-full"}
1166
+ ${C ? "lg:translate-x-0" : "lg:translate-x-full"}
1167
1167
  // For mobile: animate from bottom
1168
- ${S ? "translate-y-0" : "translate-y-full"}
1168
+ ${C ? "translate-y-0" : "translate-y-full"}
1169
1169
  lg:translate-y-0
1170
1170
  `,
1171
1171
  style: {
@@ -1533,14 +1533,14 @@ const xt = (t) => {
1533
1533
  c.productSnapshot.quantity
1534
1534
  );
1535
1535
  },
1536
- disabled: M,
1536
+ disabled: q,
1537
1537
  className: "px-4 py-2 rounded-full font-medium",
1538
1538
  style: {
1539
1539
  background: p.tanyaThemeColor,
1540
1540
  color: (p == null ? void 0 : p.tanyaThemeContrastColor) || "#fff",
1541
- opacity: M ? 0.8 : 1
1541
+ opacity: q ? 0.8 : 1
1542
1542
  },
1543
- children: M ? "Adding..." : "Add to cart"
1543
+ children: q ? "Adding..." : "Add to cart"
1544
1544
  }
1545
1545
  )
1546
1546
  ] })
@@ -1645,7 +1645,7 @@ var Q = function() {
1645
1645
  return Q = Object.assign || function(e) {
1646
1646
  for (var r, o = 1, n = arguments.length; o < n; o++) {
1647
1647
  r = arguments[o];
1648
- for (var s in r) Object.prototype.hasOwnProperty.call(r, s) && (e[s] = r[s]);
1648
+ for (var l in r) Object.prototype.hasOwnProperty.call(r, l) && (e[l] = r[l]);
1649
1649
  }
1650
1650
  return e;
1651
1651
  }, Q.apply(this, arguments);
@@ -1805,15 +1805,15 @@ const Lr = () => class {
1805
1805
  return F.slots[this.id];
1806
1806
  }
1807
1807
  withValue(e, r, o, n) {
1808
- const s = {
1808
+ const l = {
1809
1809
  __proto__: null,
1810
1810
  [this.id]: e
1811
- }, l = F;
1812
- F = { parent: l, slots: s };
1811
+ }, s = F;
1812
+ F = { parent: s, slots: l };
1813
1813
  try {
1814
1814
  return r.apply(n, o);
1815
1815
  } finally {
1816
- F = l;
1816
+ F = s;
1817
1817
  }
1818
1818
  }
1819
1819
  // Capture the current context and wrap a callback function so that it
@@ -1994,8 +1994,8 @@ function Ze(t, e, r) {
1994
1994
  se(t), n && n.call(o);
1995
1995
  break;
1996
1996
  }
1997
- } catch (s) {
1998
- yt(s);
1997
+ } catch (l) {
1998
+ yt(l);
1999
1999
  }
2000
2000
  t._state === "closed" ? Qe(t) : t._state === "running" && (t._state = "ready");
2001
2001
  }
@@ -2026,8 +2026,8 @@ var Rr = /* @__PURE__ */ (function() {
2026
2026
  var n = new Yr(this);
2027
2027
  try {
2028
2028
  this._cleanup = o.call(void 0, n);
2029
- } catch (s) {
2030
- n.error(s);
2029
+ } catch (l) {
2030
+ n.error(l);
2031
2031
  }
2032
2032
  this._state === "initializing" && (this._state = "ready");
2033
2033
  }
@@ -2072,104 +2072,104 @@ var Rr = /* @__PURE__ */ (function() {
2072
2072
  }), new Rr(o, this._subscriber);
2073
2073
  }, e.forEach = function(o) {
2074
2074
  var n = this;
2075
- return new Promise(function(s, l) {
2075
+ return new Promise(function(l, s) {
2076
2076
  if (typeof o != "function") {
2077
- l(new TypeError(o + " is not a function"));
2077
+ s(new TypeError(o + " is not a function"));
2078
2078
  return;
2079
2079
  }
2080
2080
  function d() {
2081
- i.unsubscribe(), s();
2081
+ i.unsubscribe(), l();
2082
2082
  }
2083
2083
  var i = n.subscribe({
2084
2084
  next: function(g) {
2085
2085
  try {
2086
2086
  o(g, d);
2087
2087
  } catch (w) {
2088
- l(w), i.unsubscribe();
2088
+ s(w), i.unsubscribe();
2089
2089
  }
2090
2090
  },
2091
- error: l,
2092
- complete: s
2091
+ error: s,
2092
+ complete: l
2093
2093
  });
2094
2094
  });
2095
2095
  }, e.map = function(o) {
2096
2096
  var n = this;
2097
2097
  if (typeof o != "function") throw new TypeError(o + " is not a function");
2098
- var s = Nt(this);
2099
- return new s(function(l) {
2098
+ var l = Nt(this);
2099
+ return new l(function(s) {
2100
2100
  return n.subscribe({
2101
2101
  next: function(d) {
2102
2102
  try {
2103
2103
  d = o(d);
2104
2104
  } catch (i) {
2105
- return l.error(i);
2105
+ return s.error(i);
2106
2106
  }
2107
- l.next(d);
2107
+ s.next(d);
2108
2108
  },
2109
2109
  error: function(d) {
2110
- l.error(d);
2110
+ s.error(d);
2111
2111
  },
2112
2112
  complete: function() {
2113
- l.complete();
2113
+ s.complete();
2114
2114
  }
2115
2115
  });
2116
2116
  });
2117
2117
  }, e.filter = function(o) {
2118
2118
  var n = this;
2119
2119
  if (typeof o != "function") throw new TypeError(o + " is not a function");
2120
- var s = Nt(this);
2121
- return new s(function(l) {
2120
+ var l = Nt(this);
2121
+ return new l(function(s) {
2122
2122
  return n.subscribe({
2123
2123
  next: function(d) {
2124
2124
  try {
2125
2125
  if (!o(d)) return;
2126
2126
  } catch (i) {
2127
- return l.error(i);
2127
+ return s.error(i);
2128
2128
  }
2129
- l.next(d);
2129
+ s.next(d);
2130
2130
  },
2131
2131
  error: function(d) {
2132
- l.error(d);
2132
+ s.error(d);
2133
2133
  },
2134
2134
  complete: function() {
2135
- l.complete();
2135
+ s.complete();
2136
2136
  }
2137
2137
  });
2138
2138
  });
2139
2139
  }, e.reduce = function(o) {
2140
2140
  var n = this;
2141
2141
  if (typeof o != "function") throw new TypeError(o + " is not a function");
2142
- var s = Nt(this), l = arguments.length > 1, d = !1, i = arguments[1], g = i;
2143
- return new s(function(w) {
2142
+ var l = Nt(this), s = arguments.length > 1, d = !1, i = arguments[1], g = i;
2143
+ return new l(function(w) {
2144
2144
  return n.subscribe({
2145
- next: function(S) {
2146
- var C = !d;
2147
- if (d = !0, !C || l)
2145
+ next: function(C) {
2146
+ var S = !d;
2147
+ if (d = !0, !S || s)
2148
2148
  try {
2149
- g = o(g, S);
2149
+ g = o(g, C);
2150
2150
  } catch (_) {
2151
2151
  return w.error(_);
2152
2152
  }
2153
2153
  else
2154
- g = S;
2154
+ g = C;
2155
2155
  },
2156
- error: function(S) {
2157
- w.error(S);
2156
+ error: function(C) {
2157
+ w.error(C);
2158
2158
  },
2159
2159
  complete: function() {
2160
- if (!d && !l) return w.error(new TypeError("Cannot reduce an empty sequence"));
2160
+ if (!d && !s) return w.error(new TypeError("Cannot reduce an empty sequence"));
2161
2161
  w.next(g), w.complete();
2162
2162
  }
2163
2163
  });
2164
2164
  });
2165
2165
  }, e.concat = function() {
2166
- for (var o = this, n = arguments.length, s = new Array(n), l = 0; l < n; l++)
2167
- s[l] = arguments[l];
2166
+ for (var o = this, n = arguments.length, l = new Array(n), s = 0; s < n; s++)
2167
+ l[s] = arguments[s];
2168
2168
  var d = Nt(this);
2169
2169
  return new d(function(i) {
2170
2170
  var g, w = 0;
2171
- function S(C) {
2172
- g = C.subscribe({
2171
+ function C(S) {
2172
+ g = S.subscribe({
2173
2173
  next: function(_) {
2174
2174
  i.next(_);
2175
2175
  },
@@ -2177,50 +2177,50 @@ var Rr = /* @__PURE__ */ (function() {
2177
2177
  i.error(_);
2178
2178
  },
2179
2179
  complete: function() {
2180
- w === s.length ? (g = void 0, i.complete()) : S(d.from(s[w++]));
2180
+ w === l.length ? (g = void 0, i.complete()) : C(d.from(l[w++]));
2181
2181
  }
2182
2182
  });
2183
2183
  }
2184
- return S(o), function() {
2184
+ return C(o), function() {
2185
2185
  g && (g.unsubscribe(), g = void 0);
2186
2186
  };
2187
2187
  });
2188
2188
  }, e.flatMap = function(o) {
2189
2189
  var n = this;
2190
2190
  if (typeof o != "function") throw new TypeError(o + " is not a function");
2191
- var s = Nt(this);
2192
- return new s(function(l) {
2191
+ var l = Nt(this);
2192
+ return new l(function(s) {
2193
2193
  var d = [], i = n.subscribe({
2194
2194
  next: function(w) {
2195
2195
  if (o)
2196
2196
  try {
2197
2197
  w = o(w);
2198
- } catch (C) {
2199
- return l.error(C);
2198
+ } catch (S) {
2199
+ return s.error(S);
2200
2200
  }
2201
- var S = s.from(w).subscribe({
2202
- next: function(C) {
2203
- l.next(C);
2201
+ var C = l.from(w).subscribe({
2202
+ next: function(S) {
2203
+ s.next(S);
2204
2204
  },
2205
- error: function(C) {
2206
- l.error(C);
2205
+ error: function(S) {
2206
+ s.error(S);
2207
2207
  },
2208
2208
  complete: function() {
2209
- var C = d.indexOf(S);
2210
- C >= 0 && d.splice(C, 1), g();
2209
+ var S = d.indexOf(C);
2210
+ S >= 0 && d.splice(S, 1), g();
2211
2211
  }
2212
2212
  });
2213
- d.push(S);
2213
+ d.push(C);
2214
2214
  },
2215
2215
  error: function(w) {
2216
- l.error(w);
2216
+ s.error(w);
2217
2217
  },
2218
2218
  complete: function() {
2219
2219
  g();
2220
2220
  }
2221
2221
  });
2222
2222
  function g() {
2223
- i.closed && d.length === 0 && l.complete();
2223
+ i.closed && d.length === 0 && s.complete();
2224
2224
  }
2225
2225
  return function() {
2226
2226
  d.forEach(function(w) {
@@ -2233,19 +2233,19 @@ var Rr = /* @__PURE__ */ (function() {
2233
2233
  }, t.from = function(o) {
2234
2234
  var n = typeof this == "function" ? this : t;
2235
2235
  if (o == null) throw new TypeError(o + " is not an object");
2236
- var s = Kt(o, ie);
2237
- if (s) {
2238
- var l = s.call(o);
2239
- if (Object(l) !== l) throw new TypeError(l + " is not an object");
2240
- return Hr(l) && l.constructor === n ? l : new n(function(d) {
2241
- return l.subscribe(d);
2236
+ var l = Kt(o, ie);
2237
+ if (l) {
2238
+ var s = l.call(o);
2239
+ if (Object(s) !== s) throw new TypeError(s + " is not an object");
2240
+ return Hr(s) && s.constructor === n ? s : new n(function(d) {
2241
+ return s.subscribe(d);
2242
2242
  });
2243
2243
  }
2244
- if (fe("iterator") && (s = Kt(o, Mr), s))
2244
+ if (fe("iterator") && (l = Kt(o, Mr), l))
2245
2245
  return new n(function(d) {
2246
2246
  qt(function() {
2247
2247
  if (!d.closed) {
2248
- for (var i = Ur(s.call(o)), g; !(g = i()).done; ) {
2248
+ for (var i = Ur(l.call(o)), g; !(g = i()).done; ) {
2249
2249
  var w = g.value;
2250
2250
  if (d.next(w), d.closed) return;
2251
2251
  }
@@ -2265,10 +2265,10 @@ var Rr = /* @__PURE__ */ (function() {
2265
2265
  });
2266
2266
  throw new TypeError(o + " is not observable");
2267
2267
  }, t.of = function() {
2268
- for (var o = arguments.length, n = new Array(o), s = 0; s < o; s++)
2269
- n[s] = arguments[s];
2270
- var l = typeof this == "function" ? this : t;
2271
- return new l(function(d) {
2268
+ for (var o = arguments.length, n = new Array(o), l = 0; l < o; l++)
2269
+ n[l] = arguments[l];
2270
+ var s = typeof this == "function" ? this : t;
2271
+ return new s(function(d) {
2272
2272
  qt(function() {
2273
2273
  if (!d.closed) {
2274
2274
  for (var i = 0; i < n.length; ++i)
@@ -2329,8 +2329,8 @@ function Jr(t) {
2329
2329
  return t;
2330
2330
  }
2331
2331
  function Wr(t, e) {
2332
- var r = Q({}, t), o = function(s) {
2333
- typeof s == "function" ? r = Q(Q({}, r), s(r)) : r = Q(Q({}, r), s);
2332
+ var r = Q({}, t), o = function(l) {
2333
+ typeof l == "function" ? r = Q(Q({}, r), l(r)) : r = Q(Q({}, r), l);
2334
2334
  }, n = function() {
2335
2335
  return Q({}, r);
2336
2336
  };
@@ -2382,28 +2382,28 @@ var tr = (
2382
2382
  return r.concat(o);
2383
2383
  });
2384
2384
  }, t.split = function(e, r, o) {
2385
- var n = Et(r), s = Et(o || new t(je)), l;
2386
- return Ut(n) && Ut(s) ? l = new t(function(d) {
2387
- return e(d) ? n.request(d) || N.of() : s.request(d) || N.of();
2388
- }) : l = new t(function(d, i) {
2389
- return e(d) ? n.request(d, i) || N.of() : s.request(d, i) || N.of();
2390
- }), Object.assign(l, { left: n, right: s });
2385
+ var n = Et(r), l = Et(o || new t(je)), s;
2386
+ return Ut(n) && Ut(l) ? s = new t(function(d) {
2387
+ return e(d) ? n.request(d) || N.of() : l.request(d) || N.of();
2388
+ }) : s = new t(function(d, i) {
2389
+ return e(d) ? n.request(d, i) || N.of() : l.request(d, i) || N.of();
2390
+ }), Object.assign(s, { left: n, right: l });
2391
2391
  }, t.execute = function(e, r) {
2392
2392
  return e.request(Wr(r.context, Gr(Jr(r)))) || N.of();
2393
2393
  }, t.concat = function(e, r) {
2394
2394
  var o = Et(e);
2395
2395
  if (Ut(o))
2396
2396
  return globalThis.__DEV__ !== !1 && Zt.warn(47, o), o;
2397
- var n = Et(r), s;
2398
- return Ut(n) ? s = new t(function(l) {
2399
- return o.request(l, function(d) {
2397
+ var n = Et(r), l;
2398
+ return Ut(n) ? l = new t(function(s) {
2399
+ return o.request(s, function(d) {
2400
2400
  return n.request(d) || N.of();
2401
2401
  }) || N.of();
2402
- }) : s = new t(function(l, d) {
2403
- return o.request(l, function(i) {
2402
+ }) : l = new t(function(s, d) {
2403
+ return o.request(s, function(i) {
2404
2404
  return n.request(i, d) || N.of();
2405
2405
  }) || N.of();
2406
- }), Object.assign(s, { left: o, right: n });
2406
+ }), Object.assign(l, { left: o, right: n });
2407
2407
  }, t.prototype.split = function(e, r, o) {
2408
2408
  return this.concat(t.split(e, r, o || new t(je)));
2409
2409
  }, t.prototype.concat = function(e) {
@@ -2425,17 +2425,17 @@ function ro(t) {
2425
2425
  return new tr(function(e, r) {
2426
2426
  var o = Or(e, []);
2427
2427
  return new N(function(n) {
2428
- var s, l = !1;
2428
+ var l, s = !1;
2429
2429
  return Promise.resolve(o).then(function(d) {
2430
2430
  return t(d, e.getContext());
2431
2431
  }).then(e.setContext).then(function() {
2432
- l || (s = r(e).subscribe({
2432
+ s || (l = r(e).subscribe({
2433
2433
  next: n.next.bind(n),
2434
2434
  error: n.error.bind(n),
2435
2435
  complete: n.complete.bind(n)
2436
2436
  }));
2437
2437
  }).catch(n.error.bind(n)), function() {
2438
- l = !0, s && s.unsubscribe();
2438
+ s = !0, l && l.unsubscribe();
2439
2439
  };
2440
2440
  });
2441
2441
  });