tanya-chatbot 0.3.5 → 0.3.7

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=${V()}`
104
+ `${t}api/auth/token-bm-grant?baseUrl=${Z()}&siteId=${q()}`
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=${V()}&pubCfg=${tt()}&envRef=${et()}&orgRef=${rt()}`,
114
+ `${e}api/auth/token-existing-guest-customer?dwsid=${r}&baseUrl=${Z()}&siteId=${q()}&pubCfg=${tt()}&envRef=${et()}&orgRef=${rt()}`,
115
115
  {},
116
116
  {
117
117
  headers: {
@@ -126,31 +126,36 @@ const st = () => ({ aiConversationUrl: "https://mdv3qwfi2j.execute-api.us-east-1
126
126
  }
127
127
  };
128
128
  async function Ot() {
129
- var s;
130
- const t = localStorage.getItem("expires_in"), e = localStorage.getItem("access_token"), r = ((s = JSON.parse(sessionStorage.getItem("customerData") || "{}")) == null ? void 0 : s.isGuest) || !0;
131
- if (t && e && (/* @__PURE__ */ new Date()).getTime() < parseInt(t) && (r === localStorage.getItem("isGuest") || !0))
132
- return console.log("access token found in local storage"), { access_token: e, expires_in: t };
133
- const { serverUrl: o } = st(), n = JSON.parse(
129
+ var i;
130
+ const e = "access_token_" + q(), r = localStorage.getItem("expires_in"), o = localStorage.getItem(e);
131
+ console.log(o);
132
+ const n = ((i = JSON.parse(sessionStorage.getItem("customerData") || "{}")) == null ? void 0 : i.isGuest) || !0;
133
+ if (
134
+ // expires_in &&
135
+ o
136
+ )
137
+ return console.log("access token found in local storage"), { access_token: o, expires_in: r };
138
+ const { serverUrl: l } = st(), s = JSON.parse(
134
139
  sessionStorage.getItem("customerData") || "{}"
135
- ).dwsid, l = JSON.parse(
140
+ ).dwsid, d = JSON.parse(
136
141
  sessionStorage.getItem("customerData") || "{}"
137
142
  ).usrRef;
138
143
  try {
139
- const d = r ? "unregister-auth" : "register-auth", i = await E.get(
140
- `${o}sc-api/${d}?dwsid=${n}&email=${l}&pubCfg=${tt()}&envRef=${et()}&orgRef=${rt()}&siteId=${V()}&token=true`,
144
+ const g = n ? "unregister-auth" : "register-auth", w = await E.get(
145
+ `${l}sc-api/${g}?dwsid=${s}&email=${d}&pubCfg=${tt()}&envRef=${et()}&orgRef=${rt()}&siteId=${q()}&token=true`,
141
146
  {
142
147
  withCredentials: !0
143
148
  }
144
149
  );
145
- return localStorage.setItem("access_token", i.data.access_token), localStorage.setItem(
150
+ return localStorage.setItem(e, w.data.access_token), localStorage.setItem(
146
151
  "expires_in",
147
- String((/* @__PURE__ */ new Date()).getTime() + i.data.expires_in * 1e3)
148
- ), localStorage.setItem("isGuest", r ? "true" : "false"), i.data;
149
- } catch (d) {
150
- console.log(d);
152
+ String((/* @__PURE__ */ new Date()).getTime() + w.data.expires_in * 1e3)
153
+ ), localStorage.setItem("isGuest", n ? "true" : "false"), w.data;
154
+ } catch (g) {
155
+ console.log(g);
151
156
  }
152
157
  }
153
- const Z = () => sessionStorage.getItem("Host"), V = () => sessionStorage.getItem("SiteId"), tt = () => sessionStorage.getItem("pubCfg"), et = () => sessionStorage.getItem("envRef"), rt = () => sessionStorage.getItem("orgRef"), be = async (t) => {
158
+ const Z = () => sessionStorage.getItem("Host"), q = () => sessionStorage.getItem("SiteId"), tt = () => sessionStorage.getItem("pubCfg"), et = () => sessionStorage.getItem("envRef"), rt = () => sessionStorage.getItem("orgRef"), be = async (t) => {
154
159
  console.log("fetching results");
155
160
  const { serverUrl: e, basePath: r } = st();
156
161
  let o = "";
@@ -161,7 +166,7 @@ const Z = () => sessionStorage.getItem("Host"), V = () => sessionStorage.getItem
161
166
  try {
162
167
  const n = Z();
163
168
  return (await E.get(
164
- `${e}${r}/search-sfcc?baseUrl=${n}&query=${t}&siteId=${V()}&pubCfg=${tt()}&envRef=${et()}&orgRef=${rt()}`,
169
+ `${e}${r}/search-sfcc?baseUrl=${n}&query=${t}&siteId=${q()}&pubCfg=${tt()}&envRef=${et()}&orgRef=${rt()}`,
165
170
  {
166
171
  headers: {
167
172
  "Content-Type": "application/json",
@@ -178,7 +183,7 @@ const Z = () => sessionStorage.getItem("Host"), V = () => sessionStorage.getItem
178
183
  console.log("calling access");
179
184
  const { access_token: n } = await Ot();
180
185
  return console.log(n), (await E.get(
181
- `${e}${r}/product-sfcc/${t}?baseUrl=${o}&siteId=${V()}&pubCfg=${tt()}&envRef=${et()}&orgRef=${rt()}`,
186
+ `${e}${r}/product-sfcc/${t}?baseUrl=${o}&siteId=${q()}&pubCfg=${tt()}&envRef=${et()}&orgRef=${rt()}`,
182
187
  {
183
188
  headers: {
184
189
  "Content-Type": "application/json",
@@ -192,7 +197,7 @@ const Z = () => sessionStorage.getItem("Host"), V = () => sessionStorage.getItem
192
197
  e
193
198
  ), { serverUrl: o, basePath: n } = st(), s = (await Ot()).access_token;
194
199
  return (await E.get(
195
- `${o}${n}/get-interest?baseUrl=${Z()}&customerId=${t}&siteId=${V()}&pubCfg=${tt()}&envRef=${et()}&orgRef=${rt()}`,
200
+ `${o}${n}/get-interest?baseUrl=${Z()}&customerId=${t}&siteId=${q()}&pubCfg=${tt()}&envRef=${et()}&orgRef=${rt()}`,
196
201
  {
197
202
  headers: {
198
203
  "Content-Type": "application/json",
@@ -235,8 +240,8 @@ const _r = ({
235
240
  (i) => i - r < 0 ? t.length - (t.length % r || r) : i - r
236
241
  );
237
242
  }, d = async (i) => {
238
- const x = await He(i);
239
- e(oe(x));
243
+ const g = await He(i);
244
+ e(oe(g));
240
245
  };
241
246
  return /* @__PURE__ */ a("div", { className: "mt-2 overflow-x-hidden", children: /* @__PURE__ */ u("div", { className: "flex items-center justify-center gap-4 relative", children: [
242
247
  (t == null ? void 0 : t.length) > r && /* @__PURE__ */ a(
@@ -247,14 +252,13 @@ const _r = ({
247
252
  style: {
248
253
  height: "30px",
249
254
  width: "30px",
250
- boxShadow: "0 4px 10px rgba(0, 0, 0, 0.25)",
251
- borderRadius: "8px"
255
+ boxShadow: "0 4px 10px rgba(0, 0, 0, 0.25)"
252
256
  },
253
257
  children: "<"
254
258
  }
255
259
  ),
256
260
  /* @__PURE__ */ a("div", { className: "flex gap-5 justify-center flex-1 overflow-hidden", children: t.slice(o, o + r).map((i) => {
257
- var x, b, C, S;
261
+ var g, w, C, S;
258
262
  return /* @__PURE__ */ u(
259
263
  "div",
260
264
  {
@@ -266,7 +270,7 @@ const _r = ({
266
270
  /* @__PURE__ */ a("div", { className: "w-full p-2 flex items-center justify-center bg-white", children: /* @__PURE__ */ a(
267
271
  "img",
268
272
  {
269
- src: ((x = ye(i)[0]) == null ? void 0 : x.link) || ye(i)[0] || // fallback if it's a string
273
+ src: ((g = ye(i)[0]) == null ? void 0 : g.link) || ye(i)[0] || // fallback if it's a string
270
274
  "https://via.placeholder.com/120",
271
275
  alt: i != null && i.productName ? i.productName : "Product",
272
276
  className: "w-28 h-28 rounded-[10px] transition-transform duration-300 hover:scale-125 object-cover"
@@ -279,7 +283,7 @@ const _r = ({
279
283
  children: [
280
284
  /* @__PURE__ */ u("div", { className: "relative inline-block group", children: [
281
285
  /* @__PURE__ */ a("div", { className: "w-full line-clamp-1 overflow-hidden text-ellipsis text-[#000000] font-medium font-nunitoSans", children: i != null && i.productName ? i.productName : i != null && i.product_name ? i.product_name : ke(
282
- xe((b = i == null ? void 0 : i.name) == null ? void 0 : b["en-US"]),
286
+ xe((w = i == null ? void 0 : i.name) == null ? void 0 : w["en-US"]),
283
287
  60
284
288
  ) || "Product" }),
285
289
  /* @__PURE__ */ a(
@@ -326,8 +330,7 @@ const _r = ({
326
330
  style: {
327
331
  height: "30px",
328
332
  width: "30px",
329
- boxShadow: "0 4px 10px rgba(0, 0, 0, 0.25)",
330
- borderRadius: "8px"
333
+ boxShadow: "0 4px 10px rgba(0, 0, 0, 0.25)"
331
334
  },
332
335
  children: ">"
333
336
  }
@@ -359,13 +362,13 @@ const _r = ({
359
362
  ]
360
363
  },
361
364
  o
362
- )) }), Re = async (t, e) => {
365
+ )) }), Ve = async (t, e) => {
363
366
  const { serverUrl: r, basePath: o } = st(), n = `${r}`;
364
367
  console.log(`customer_token
365
368
  `, t);
366
369
  try {
367
370
  return (await E.post(
368
- `${n}${o}/basket/create?baseUrl=${Z()}&siteId=${V()}&pubCfg=${tt()}&envRef=${et()}&orgRef=${rt()}`,
371
+ `${n}${o}/basket/create?baseUrl=${Z()}&siteId=${q()}&pubCfg=${tt()}&envRef=${et()}&orgRef=${rt()}`,
369
372
  e,
370
373
  {
371
374
  headers: {
@@ -377,11 +380,11 @@ const _r = ({
377
380
  } catch (l) {
378
381
  return E.isAxiosError(l) ? console.error("Error creating basket:", l.response || l.message) : console.error("Unexpected error:", l), null;
379
382
  }
380
- }, Rt = async (t, e, r) => {
383
+ }, Vt = async (t, e, r) => {
381
384
  const { serverUrl: o, basePath: n } = st(), l = `${o}`;
382
385
  try {
383
386
  const s = await E.post(
384
- `${l}${n}/basket/add-product/${t}?baseUrl=${Z()}&siteId=${V()}&pubCfg=${tt()}&envRef=${et()}&orgRef=${rt()}`,
387
+ `${l}${n}/basket/add-product/${t}?baseUrl=${Z()}&siteId=${q()}&pubCfg=${tt()}&envRef=${et()}&orgRef=${rt()}`,
385
388
  e,
386
389
  {
387
390
  headers: {
@@ -397,7 +400,7 @@ const _r = ({
397
400
  s.response || s.message
398
401
  ) : console.error("Unexpected error:", s), null;
399
402
  }
400
- }, Ve = async ({
403
+ }, Re = async ({
401
404
  basketId: t,
402
405
  customer_token: e
403
406
  }) => {
@@ -405,7 +408,7 @@ const _r = ({
405
408
  const { serverUrl: r, basePath: o } = st(), n = `${r}`;
406
409
  try {
407
410
  const s = await E.get(
408
- `${n}${o}/basket/${t}?baseUrl=${Z()}&siteId=${V()}&pubCfg=${tt()}&envRef=${et()}&orgRef=${rt()}`,
411
+ `${n}${o}/basket/${t}?baseUrl=${Z()}&siteId=${q()}&pubCfg=${tt()}&envRef=${et()}&orgRef=${rt()}`,
409
412
  {
410
413
  headers: {
411
414
  "Content-Type": "application/json",
@@ -417,10 +420,10 @@ const _r = ({
417
420
  } catch (s) {
418
421
  return E.isAxiosError(s) ? { status: (l = s.response) == null ? void 0 : l.status, data: null } : { status: null, data: null };
419
422
  }
420
- }, Vt = "sfcc_basket_id", Se = "sfcc_customer_token", Tt = "sfcc_token_expiry", Fr = 300 * 1e3, Ft = "1.0.0";
423
+ }, Rt = "sfcc_basket_id", Se = "sfcc_customer_token", Tt = "sfcc_token_expiry", Fr = 300 * 1e3, Ft = "1.0.0";
421
424
  const xt = (t) => {
422
425
  try {
423
- t ? localStorage.setItem(Vt, t) : localStorage.removeItem(Vt);
426
+ t ? localStorage.setItem(Rt, t) : localStorage.removeItem(Rt);
424
427
  } catch (e) {
425
428
  console.error("Error saving basket ID to storage:", e);
426
429
  }
@@ -436,16 +439,16 @@ const xt = (t) => {
436
439
  console.error("Error storing token:", e);
437
440
  }
438
441
  }, Ce = 300, Nr = () => {
439
- var d, i, x, b, C, S;
442
+ var d, i, g, w, C, S;
440
443
  const t = Ae(), e = Mt((_) => _.product.product), r = Mt((_) => _.store.store), [o, n] = P(!!e);
441
444
  if (bt(() => {
442
445
  n(!!e);
443
446
  }, [e]), !e) return null;
444
447
  const l = async () => {
445
- var _, j, q, M, lt, vt, Pt, ot, kt, St, ct, $t, zt, Ct, O, dt;
448
+ var _, j, M, H, lt, vt, Pt, ot, kt, St, ct, $t, zt, Ct, O, dt;
446
449
  console.log(e, "the prod");
447
450
  try {
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)) {
451
+ 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)) {
449
452
  U.error("Variants not available", {
450
453
  position: "bottom-right",
451
454
  autoClose: 1e3
@@ -461,12 +464,12 @@ const xt = (t) => {
461
464
  console.log(p, "the product data");
462
465
  const _t = JSON.parse(
463
466
  sessionStorage.getItem("customerData") || "{}"
464
- ), nt = (_t == null ? void 0 : _t.basketId) || localStorage.getItem(Vt), Kt = !1, jt = localStorage.getItem(Tt), Y = Date.now();
465
- if (!Kt || !jt || Y >= parseInt(jt)) {
467
+ ), nt = (_t == null ? void 0 : _t.basketId) || localStorage.getItem(Rt), Jt = !1, jt = localStorage.getItem(Tt), Y = Date.now();
468
+ if (!Jt || !jt || Y >= parseInt(jt)) {
466
469
  let $ = "";
467
470
  {
468
- const K = await Ot();
469
- console.log("token from auth data"), $ = "Bearer " + K.access_token;
471
+ const J = await Ot();
472
+ console.log("token from auth data"), $ = "Bearer " + J.access_token;
470
473
  }
471
474
  if (!$) {
472
475
  console.error("Failed to get customer_token");
@@ -474,17 +477,17 @@ const xt = (t) => {
474
477
  }
475
478
  const At = Y + 300 * 1e3;
476
479
  if (Yt($), localStorage.setItem(Tt, At.toString()), nt) {
477
- const K = await Ve({
480
+ const J = await Re({
478
481
  basketId: nt,
479
482
  customer_token: $
480
483
  });
481
- if (console.log(nt, "basket id from customer"), K.status === 200 && K) {
482
- const G = await Rt(
484
+ if (console.log(nt, "basket id from customer"), J.status === 200 && J) {
485
+ const W = await Vt(
483
486
  nt,
484
487
  p,
485
488
  $
486
489
  );
487
- (((Pt = G == null ? void 0 : G.product_items) == null ? void 0 : Pt.length) > 0 || ((ot = G == null ? void 0 : G.productItems) == null ? void 0 : ot.length) > 0) && (U.success("Added to cart", {
490
+ (((Pt = W == null ? void 0 : W.product_items) == null ? void 0 : Pt.length) > 0 || ((ot = W == null ? void 0 : W.productItems) == null ? void 0 : ot.length) > 0) && (U.success("Added to cart", {
488
491
  position: "bottom-right",
489
492
  autoClose: 3e3,
490
493
  hideProgressBar: !1,
@@ -495,7 +498,7 @@ const xt = (t) => {
495
498
  return;
496
499
  }
497
500
  }
498
- const Gt = {
501
+ const Wt = {
499
502
  productItems: [
500
503
  {
501
504
  productId: ((kt = e.variants) == null ? void 0 : kt[0].product_id) || ((St = e.variants) == null ? void 0 : St[0].productId) || (e == null ? void 0 : e.id),
@@ -504,7 +507,7 @@ const xt = (t) => {
504
507
  ]
505
508
  };
506
509
  console.log("before create basket");
507
- const h = await Re($, Gt);
510
+ const h = await Ve($, Wt);
508
511
  if (console.log(
509
512
  h,
510
513
  h == null ? void 0 : h.basket_id,
@@ -520,12 +523,12 @@ const xt = (t) => {
520
523
  ), xt(
521
524
  (h == null ? void 0 : h.basket_id) || (h == null ? void 0 : h.basketId)
522
525
  ), console.log("adding product to basket");
523
- const J = await Rt(
526
+ const K = await Vt(
524
527
  (h == null ? void 0 : h.basket_id) || (h == null ? void 0 : h.basketId),
525
528
  p,
526
529
  $
527
530
  );
528
- console.log("object added to basket"), (((ct = J == null ? void 0 : J.product_items) == null ? void 0 : ct.length) > 0 || (($t = J == null ? void 0 : J.productItems) == null ? void 0 : $t.length) > 0) && U.success("Added to cart", {
531
+ console.log("object added to basket"), (((ct = K == null ? void 0 : K.product_items) == null ? void 0 : ct.length) > 0 || (($t = K == null ? void 0 : K.productItems) == null ? void 0 : $t.length) > 0) && U.success("Added to cart", {
529
532
  position: "bottom-right",
530
533
  autoClose: 3e3,
531
534
  hideProgressBar: !1,
@@ -588,7 +591,7 @@ const xt = (t) => {
588
591
  /* @__PURE__ */ a("div", { className: "flex flex-row items-center justify-center w-[120px] h-[120px] my-5", children: /* @__PURE__ */ a(
589
592
  "img",
590
593
  {
591
- src: (b = (x = (i = (d = e.imageGroups) == null ? void 0 : d[0]) == null ? void 0 : i.images) == null ? void 0 : x[0]) == null ? void 0 : b.link,
594
+ src: (w = (g = (i = (d = e.imageGroups) == null ? void 0 : d[0]) == null ? void 0 : i.images) == null ? void 0 : g[0]) == null ? void 0 : w.link,
592
595
  alt: e.name,
593
596
  className: "rounded-[10px]"
594
597
  }
@@ -649,7 +652,7 @@ const xt = (t) => {
649
652
  ] })
650
653
  ] }) }),
651
654
  /* @__PURE__ */ a("div", { className: "mt-2 flex flex-row items-center gap-2", children: Array.from({ length: 5 }).map((_, j) => {
652
- var q;
655
+ var M;
653
656
  return /* @__PURE__ */ a(
654
657
  ge,
655
658
  {
@@ -657,7 +660,7 @@ const xt = (t) => {
657
660
  width: "20",
658
661
  height: "20",
659
662
  className: `text-yellow-500
660
- ${((q = e == null ? void 0 : e.rating) == null ? void 0 : q.rate) > j ? "text-yellow-500" : "text-gray-300"}
663
+ ${((M = e == null ? void 0 : e.rating) == null ? void 0 : M.rate) > j ? "text-yellow-500" : "text-gray-300"}
661
664
  `
662
665
  },
663
666
  j
@@ -712,19 +715,19 @@ const xt = (t) => {
712
715
  "Niece/Nephew": "his/her niece/nephew",
713
716
  "My Friends": "his/her friends",
714
717
  Others: "others"
715
- }, o = It(null), n = It(null), l = It(null), s = It(null), [d, i] = P(null), [x, b] = 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) => ({
718
+ }, 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), [M, H] = P(!1), [lt, vt] = P(!1), [Pt, ot] = P(!1), [kt, St] = P(""), [ct, $t] = P(""), zt = (c) => ({
716
719
  id: c.id,
717
720
  title: c.name,
718
721
  image: c.image ?? "",
719
722
  price: c.price ?? 0
720
723
  }), [Ct, O] = P([]), dt = It(null), p = Mt((c) => c.store.store), _t = Mt((c) => c.product.product), nt = () => {
721
724
  j(!0), setTimeout(() => S(!0), 10);
722
- }, Kt = () => {
725
+ }, Jt = () => {
723
726
  S(!1), setTimeout(() => j(!1), 300);
724
727
  };
725
728
  bt(() => {
726
- x ? nt() : Kt();
727
- }, [x]);
729
+ g ? nt() : Jt();
730
+ }, [g]);
728
731
  const jt = (c) => {
729
732
  $t(r[c]);
730
733
  };
@@ -741,54 +744,54 @@ const xt = (t) => {
741
744
  client_id: "4i8rd70sgt961tc4dhskgf08c",
742
745
  client_secret: "bnsfq1220loh2cn2cm2ttn8fdhdpt0u8m1fgj8vfk2rn61aurjg",
743
746
  scope: "default-m2m-resource-server-8xzfzo/read"
744
- }), w = await fetch(c, {
747
+ }), b = await fetch(c, {
745
748
  method: "POST",
746
749
  headers: {
747
750
  "Content-Type": "application/x-www-form-urlencoded"
748
751
  },
749
752
  body: k
750
753
  });
751
- if (!w.ok)
754
+ if (!b.ok)
752
755
  throw new Error(
753
- `Token request failed! status: ${w.status}`
756
+ `Token request failed! status: ${b.status}`
754
757
  );
755
- const y = await w.json();
758
+ const y = await b.json();
756
759
  Y = y.access_token;
757
760
  const f = y.expires_in || 3600;
758
761
  return $ = Date.now() + (f - 60) * 1e3, Y;
759
762
  } catch (c) {
760
763
  return console.error("Error obtaining JWT token:", c), Y = null, $ = null, null;
761
764
  }
762
- }, Gt = async () => {
765
+ }, Wt = async () => {
763
766
  const c = await Ot();
764
767
  c != null && i(c);
765
768
  };
766
769
  bt(() => {
767
770
  if (t != null && t.siteId) {
768
- const { clientID: c, host: k, organizationID: w, shortCode: y, siteId: f } = t;
769
- sessionStorage.setItem("Host", k), sessionStorage.setItem("SiteId", f), sessionStorage.setItem("pubCfg", btoa(c)), sessionStorage.setItem("envRef", y), sessionStorage.setItem("orgRef", w);
771
+ const { clientID: c, host: k, organizationID: b, shortCode: y, siteId: f } = t;
772
+ sessionStorage.setItem("Host", k), sessionStorage.setItem("SiteId", f), sessionStorage.setItem("pubCfg", btoa(c)), sessionStorage.setItem("envRef", y), sessionStorage.setItem("orgRef", b);
770
773
  }
771
- Gt(), console.log("scapi environment v1");
774
+ Wt(), console.log("scapi environment v1");
772
775
  }, []);
773
776
  const h = async () => {
774
777
  const c = JSON.parse(
775
778
  sessionStorage.getItem("customerData") || "{}"
776
779
  ).customerId;
777
780
  return (await vr(c || "")).c_interests;
778
- }, J = async (c, k) => {
781
+ }, K = async (c, k) => {
779
782
  console.log("in secondary flow", Ft);
780
- const w = await h();
781
- if (console.log(w, "interests of customer", Ft), !!w)
783
+ const b = await h();
784
+ if (console.log(b, "interests of customer", Ft), !!b)
782
785
  try {
783
786
  O(
784
787
  (L) => L.map(
785
- (H, R) => R === L.length - 1 ? { ...H, secondaryLoading: !0 } : H
788
+ (V, R) => R === L.length - 1 ? { ...V, secondaryLoading: !0 } : V
786
789
  )
787
790
  );
788
791
  const y = await At();
789
792
  if (!y) throw new Error("Failed to fetch token");
790
- const f = localStorage.getItem("customerNumber"), g = localStorage.getItem("isLoggedIn"), ut = `https://tanya.aspiresystems.com/api/bedrock/invoke/stream?${new URLSearchParams({
791
- registered: String(g || !1),
793
+ const f = localStorage.getItem("customerNumber"), x = localStorage.getItem("isLoggedIn"), ut = `https://tanya.aspiresystems.com/api/bedrock/invoke/stream?${new URLSearchParams({
794
+ registered: String(x || !1),
792
795
  userId: String(f || (/* @__PURE__ */ new Date()).getTime())
793
796
  }).toString()}`, pt = JSON.stringify({
794
797
  flowId: "Q166PR519W",
@@ -797,7 +800,7 @@ const xt = (t) => {
797
800
  loyaltyPoints: "",
798
801
  productName: c,
799
802
  productPoints: String(k || 0),
800
- interests: w
803
+ interests: b
801
804
  }
802
805
  }), A = await fetch(ut, {
803
806
  signal: AbortSignal.timeout(3e4),
@@ -812,15 +815,15 @@ const xt = (t) => {
812
815
  const ft = A.body.getReader(), mt = new TextDecoder();
813
816
  let D = "";
814
817
  for (; ; ) {
815
- const { done: L, value: H } = await ft.read();
818
+ const { done: L, value: V } = await ft.read();
816
819
  if (L) break;
817
- D += mt.decode(H, { stream: !0 });
820
+ D += mt.decode(V, { stream: !0 });
818
821
  const R = D.split(`
819
822
  `);
820
823
  D = R.pop() || "";
821
- for (const W of R)
822
- if (W.startsWith("data:")) {
823
- const m = W.slice(5).trim();
824
+ for (const G of R)
825
+ if (G.startsWith("data:")) {
826
+ const m = G.slice(5).trim();
824
827
  try {
825
828
  const B = JSON.parse(m);
826
829
  B.index === 0 && O(
@@ -844,11 +847,11 @@ const xt = (t) => {
844
847
  } catch (y) {
845
848
  console.error("Secondary flow error:", y);
846
849
  }
847
- }, K = async (c) => {
850
+ }, J = async (c) => {
848
851
  const k = c || kt.trim();
849
852
  if (k) {
850
- vt(!0), St(""), o.current = null, n.current = null, l.current = null, s.current = null, O((w) => [
851
- ...w,
853
+ vt(!0), St(""), o.current = null, n.current = null, l.current = null, s.current = null, O((b) => [
854
+ ...b,
852
855
  {
853
856
  query: k,
854
857
  response: "Thinking for what suits you best...",
@@ -858,8 +861,8 @@ const xt = (t) => {
858
861
  }
859
862
  ]);
860
863
  try {
861
- const w = ct, y = localStorage.getItem("customerNumber"), f = localStorage.getItem("isLoggedIn"), g = await At();
862
- if (!g)
864
+ const b = ct, y = localStorage.getItem("customerNumber"), f = localStorage.getItem("isLoggedIn"), x = await At();
865
+ if (!x)
863
866
  throw new Error("Failed to obtain access token");
864
867
  const ut = `https://tanya.aspiresystems.com/api/bedrock/invoke/stream?${new URLSearchParams({
865
868
  registered: String(f || !1),
@@ -869,14 +872,14 @@ const xt = (t) => {
869
872
  flowAliasId: "SZF9ZK1ATE",
870
873
  input: {
871
874
  userPrompt: k,
872
- whom: w
875
+ whom: b
873
876
  }
874
877
  }), A = await fetch(ut, {
875
878
  signal: AbortSignal.timeout(3e4),
876
879
  method: "POST",
877
880
  headers: {
878
881
  "Content-Type": "application/json",
879
- Authorization: `Bearer ${g}`
882
+ Authorization: `Bearer ${x}`
880
883
  },
881
884
  body: pt
882
885
  });
@@ -887,13 +890,13 @@ const xt = (t) => {
887
890
  let D = "", L = "";
888
891
  for (; ; ) {
889
892
  ot(!0);
890
- const { done: H, value: R } = await ft.read();
891
- if (H) break;
893
+ const { done: V, value: R } = await ft.read();
894
+ if (V) break;
892
895
  D += mt.decode(R, { stream: !0 });
893
- const W = D.split(`
896
+ const G = D.split(`
894
897
  `);
895
- D = W.pop() || "";
896
- for (const m of W)
898
+ D = G.pop() || "";
899
+ for (const m of G)
897
900
  if (m.startsWith("data:")) {
898
901
  const B = m.slice(5).trim();
899
902
  try {
@@ -911,14 +914,14 @@ const xt = (t) => {
911
914
  }
912
915
  }
913
916
  }
914
- er(G(L));
915
- } catch (w) {
916
- console.error("Error sending message to Tanya:", w);
917
+ er(W(L));
918
+ } catch (b) {
919
+ console.error("Error sending message to Tanya:", b);
917
920
  } finally {
918
921
  vt(!1);
919
922
  }
920
923
  }
921
- }, G = (c) => {
924
+ }, W = (c) => {
922
925
  const k = c.match(
923
926
  /top five relevant product or category names are: (.*)/i
924
927
  ), f = (k ? k[1] : c).split(", ").map((z) => z.replace(/\s*(Toys|Bags|Miniature|etc\.*)\s*/gi, "").trim());
@@ -927,35 +930,35 @@ const xt = (t) => {
927
930
  if (typeof c == "string") {
928
931
  console.log(c, "keywords");
929
932
  const k = c.split(",");
930
- for (const w of k) {
931
- const y = await be(w);
933
+ for (const b of k) {
934
+ const y = await be(b);
932
935
  if (ot(!1), (y == null ? void 0 : y.length) > 0 && (O(
933
936
  (f) => f.map(
934
- (g, z) => z === f.length - 1 ? {
935
- ...g,
937
+ (x, z) => z === f.length - 1 ? {
938
+ ...x,
936
939
  products: [
937
- ...g.products || [],
938
- { keyword: w, items: y, loading: !1 }
940
+ ...x.products || [],
941
+ { keyword: b, items: y, loading: !1 }
939
942
  ]
940
- } : g
943
+ } : x
941
944
  )
942
945
  ), !o.current || n.current == null)) {
943
946
  const f = y[0];
944
947
  o.current = String((f == null ? void 0 : f.product_name) ?? ""), l.current = f.image.link, n.current = f.product_id;
945
- const g = typeof (f == null ? void 0 : f.price) == "number" ? f.price : void 0;
946
- s.current = typeof g == "number" && Number.isFinite(g) ? g : null;
948
+ const x = typeof (f == null ? void 0 : f.price) == "number" ? f.price : void 0;
949
+ s.current = typeof x == "number" && Number.isFinite(x) ? x : null;
947
950
  }
948
951
  }
949
952
  } else
950
953
  for (const k of c) {
951
- const w = await be(k);
952
- ot(!1), (w == null ? void 0 : w.length) > 0 && O(
954
+ const b = await be(k);
955
+ ot(!1), (b == null ? void 0 : b.length) > 0 && O(
953
956
  (y) => y.map(
954
- (f, g) => g === y.length - 1 ? {
957
+ (f, x) => x === y.length - 1 ? {
955
958
  ...f,
956
959
  products: [
957
960
  ...f.products || [],
958
- { keyword: k, items: w, loading: !1 }
961
+ { keyword: k, items: b, loading: !1 }
959
962
  ]
960
963
  } : f
961
964
  )
@@ -963,8 +966,8 @@ const xt = (t) => {
963
966
  }
964
967
  if (o.current) {
965
968
  O(
966
- (w) => w.map(
967
- (y, f) => f === w.length - 1 ? {
969
+ (b) => b.map(
970
+ (y, f) => f === b.length - 1 ? {
968
971
  ...y,
969
972
  productSnapshot: {
970
973
  id: n.current,
@@ -980,16 +983,16 @@ const xt = (t) => {
980
983
  const k = JSON.parse(
981
984
  sessionStorage.getItem("customerData") || "{}"
982
985
  );
983
- (k == null ? void 0 : k.isGuest) == !1 ? (console.log("running secondary flow", Ft), J(o.current, 0)) : console.log("not running secondary flow", Ft);
986
+ (k == null ? void 0 : k.isGuest) == !1 ? (console.log("running secondary flow", Ft), K(o.current, 0)) : console.log("not running secondary flow", Ft);
984
987
  }
985
988
  ot(!1);
986
989
  }, rr = async (c, k) => {
987
- var w, y, f, g, z, ut, pt, A, ft, mt, D, L, H, R, W;
988
- M(!0);
990
+ var b, y, f, x, z, ut, pt, A, ft, mt, D, L, V, R, G;
991
+ H(!0);
989
992
  try {
990
993
  const m = await He(c.id);
991
- if (!((y = (w = m == null ? void 0 : m.variants) == null ? void 0 : w[0]) != null && y.product_id || (g = (f = m == null ? void 0 : m.variants) == null ? void 0 : f[0]) != null && g.productId) && !(m.type.item || m.type.bundle)) {
992
- M(!1), U.error("Variants not found", {
994
+ 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)) {
995
+ H(!1), U.error("Variants not found", {
993
996
  position: "bottom-right",
994
997
  autoClose: 1e3
995
998
  }), console.error("No product variant found");
@@ -1004,7 +1007,7 @@ const xt = (t) => {
1004
1007
  console.log(B, "product data", "app version", Ft);
1005
1008
  const I = JSON.parse(
1006
1009
  sessionStorage.getItem("customerData") || "{}"
1007
- ), T = (I == null ? void 0 : I.basketId) || localStorage.getItem(Vt), X = !1, Dt = localStorage.getItem(Tt), he = Date.now();
1010
+ ), T = (I == null ? void 0 : I.basketId) || localStorage.getItem(Rt), X = !1, Dt = localStorage.getItem(Tt), he = Date.now();
1008
1011
  if (!X || !Dt || he >= parseInt(Dt)) {
1009
1012
  const or = await qe();
1010
1013
  let { customer_token: at } = await Me(
@@ -1016,24 +1019,24 @@ const xt = (t) => {
1016
1019
  }
1017
1020
  const nr = he + 300 * 1e3;
1018
1021
  if (Yt(at), localStorage.setItem(Tt, nr.toString()), console.log(T, "basketIdFromCustomer"), T) {
1019
- const we = await Ve({
1022
+ const we = await Re({
1020
1023
  basketId: T,
1021
1024
  customer_token: at
1022
1025
  });
1023
1026
  if (we.status === 200 && we) {
1024
- const Wt = await Rt(
1027
+ const Gt = await Vt(
1025
1028
  T,
1026
1029
  B,
1027
1030
  at
1028
1031
  );
1029
- ((pt = Wt == null ? void 0 : Wt.product_items) == null ? void 0 : pt.length) > 0 && (U.success("Added to cart", {
1032
+ ((pt = Gt == null ? void 0 : Gt.product_items) == null ? void 0 : pt.length) > 0 && (U.success("Added to cart", {
1030
1033
  position: "bottom-right",
1031
1034
  autoClose: 3e3,
1032
1035
  hideProgressBar: !1,
1033
1036
  closeOnClick: !0,
1034
1037
  pauseOnHover: !0,
1035
1038
  draggable: !0
1036
- }), Ht(T), M(!1));
1039
+ }), Ht(T), H(!1));
1037
1040
  return;
1038
1041
  }
1039
1042
  }
@@ -1044,20 +1047,20 @@ const xt = (t) => {
1044
1047
  quantity: 1
1045
1048
  }
1046
1049
  ]
1047
- }, v = await Re(at, ar);
1050
+ }, v = await Ve(at, ar);
1048
1051
  if (console.log(
1049
1052
  v,
1050
1053
  v == null ? void 0 : v.basket_id,
1051
1054
  v == null ? void 0 : v.basketId,
1052
1055
  "the basket response"
1053
1056
  ), !(v != null && v.basket_id || !(v != null && v.basketId))) {
1054
- M(!1), console.error("Failed to create basket");
1057
+ H(!1), console.error("Failed to create basket");
1055
1058
  return;
1056
1059
  }
1057
1060
  xt(
1058
1061
  (v == null ? void 0 : v.basket_id) || (v == null ? void 0 : v.basketId)
1059
1062
  );
1060
- const ht = await Rt(
1063
+ const ht = await Vt(
1061
1064
  (v == null ? void 0 : v.basket_id) || (v == null ? void 0 : v.basketId),
1062
1065
  B,
1063
1066
  at
@@ -1072,22 +1075,22 @@ const xt = (t) => {
1072
1075
  }), Ht(v.basket_id || (v == null ? void 0 : v.basketId));
1073
1076
  }
1074
1077
  } catch (m) {
1075
- M(!1), console.error("Error adding to cart:", m), U.error("Failed to add product to cart", {
1078
+ H(!1), console.error("Error adding to cart:", m), U.error("Failed to add product to cart", {
1076
1079
  position: "bottom-right",
1077
1080
  autoClose: 3e3
1078
1081
  }), ((L = m == null ? void 0 : m.response) == null ? void 0 : L.status) === 404 || // Basket not found
1079
- ((H = m == null ? void 0 : m.response) == null ? void 0 : H.status) === 401 ? (((R = m == null ? void 0 : m.response) == null ? void 0 : R.status) === 404 && xt(null), ((W = m == null ? void 0 : m.response) == null ? void 0 : W.status) === 401 && (xt(null), Yt(null))) : (console.error("Failed to add product to basket:", m.message), U.error("Failed to add product to cart", {
1082
+ ((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", {
1080
1083
  position: "bottom-right",
1081
1084
  autoClose: 3e3
1082
1085
  }));
1083
1086
  }
1084
- M(!1);
1087
+ H(!1);
1085
1088
  };
1086
- return /* @__PURE__ */ a("div", { className: "relative flex justify-center", children: /* @__PURE__ */ u(xr, { open: x, onOpenChange: b, children: [
1089
+ return /* @__PURE__ */ a("div", { className: "relative flex justify-center", children: /* @__PURE__ */ u(xr, { open: g, onOpenChange: w, children: [
1087
1090
  /* @__PURE__ */ a(
1088
1091
  yr,
1089
1092
  {
1090
- onClick: () => b(!0),
1093
+ onClick: () => w(!0),
1091
1094
  style: {
1092
1095
  // background: storeDetails.tanyaThemeColor,
1093
1096
  },
@@ -1152,7 +1155,7 @@ const xt = (t) => {
1152
1155
  "div",
1153
1156
  {
1154
1157
  className: "fixed inset-0 z-40 bg-black/30",
1155
- onClick: () => b(!1)
1158
+ onClick: () => w(!1)
1156
1159
  }
1157
1160
  ),
1158
1161
  /* @__PURE__ */ u(
@@ -1243,7 +1246,7 @@ const xt = (t) => {
1243
1246
  gap: "1.25rem",
1244
1247
  margin: "0.75rem"
1245
1248
  },
1246
- children: /* @__PURE__ */ a("button", { onClick: () => b(!1), children: /* @__PURE__ */ u(
1249
+ children: /* @__PURE__ */ a("button", { onClick: () => w(!1), children: /* @__PURE__ */ u(
1247
1250
  "svg",
1248
1251
  {
1249
1252
  width: "24",
@@ -1326,7 +1329,7 @@ const xt = (t) => {
1326
1329
  }
1327
1330
  ),
1328
1331
  Ct.map((c, k) => {
1329
- var w, y;
1332
+ var b, y;
1330
1333
  return /* @__PURE__ */ u("div", { children: [
1331
1334
  /* @__PURE__ */ a("div", { className: "flex justify-end", children: /* @__PURE__ */ a("p", { className: "text-sm font-nunitoSans font-bold text-[#000000] bg-[#E2DBFF] border border-[#C9C2DE] rounded-l-xl p-2 m-3 mb-4 rounded-br-xl max-w-[75%]", children: c.query }) }),
1332
1335
  c.response && c.response.includes("Thinking") ? /* @__PURE__ */ a("div", { children: /* @__PURE__ */ a(
@@ -1346,7 +1349,7 @@ const xt = (t) => {
1346
1349
  }
1347
1350
  }
1348
1351
  ) }),
1349
- Pt && !c.response.includes("Thinking") && ((w = c.products) == null ? void 0 : w.length) == 0 && /* @__PURE__ */ a("div", { children: /* @__PURE__ */ a("p", { className: "text-sm animate-pulse font-nunitoSans font-bold text-[#000000] bg-[#E2DBFF] border border-[#C9C2DE] rounded-l-xl p-2 m-3 mb-4 rounded-br-xl max-w-[75%]", children: "Finding best products for you" }) }),
1352
+ Pt && !c.response.includes("Thinking") && ((b = c.products) == null ? void 0 : b.length) == 0 && /* @__PURE__ */ a("div", { children: /* @__PURE__ */ a("p", { className: "text-sm animate-pulse font-nunitoSans font-bold text-[#000000] bg-[#E2DBFF] border border-[#C9C2DE] rounded-l-xl p-2 m-3 mb-4 rounded-br-xl max-w-[75%]", children: "Finding best products for you" }) }),
1350
1353
  (c == null ? void 0 : c.products) && ((y = c == null ? void 0 : c.products) == null ? void 0 : y.length) > 0 && /* @__PURE__ */ a(
1351
1354
  Ir,
1352
1355
  {
@@ -1363,17 +1366,17 @@ const xt = (t) => {
1363
1366
  children: "Why not explore these inquiries..."
1364
1367
  }
1365
1368
  ),
1366
- c.potentialQuestions.split(",").map((f, g) => /* @__PURE__ */ a(
1369
+ c.potentialQuestions.split(",").map((f, x) => /* @__PURE__ */ a(
1367
1370
  "button",
1368
1371
  {
1369
1372
  className: `cursor-pointer font-nunitoSans font-semibold text-[#232323] border bg-[#804C9E0D] border-${p.themeDarkColor} m-1 rounded-xl px-2 py-1`,
1370
- onClick: () => K(f),
1373
+ onClick: () => J(f),
1371
1374
  style: {
1372
1375
  backgroundColor: p.tanyaThemeColorLight
1373
1376
  },
1374
1377
  children: f
1375
1378
  },
1376
- g
1379
+ x
1377
1380
  ))
1378
1381
  ] }),
1379
1382
  c.secondaryLoading && /* @__PURE__ */ a("div", { className: "mt-3 mb-4 px-4", children: /* @__PURE__ */ u(
@@ -1479,16 +1482,16 @@ const xt = (t) => {
1479
1482
  className: "px-3 py-1 text-sm",
1480
1483
  onClick: () => O(
1481
1484
  (f) => f.map(
1482
- (g, z) => z === k && g.productSnapshot ? {
1483
- ...g,
1485
+ (x, z) => z === k && x.productSnapshot ? {
1486
+ ...x,
1484
1487
  productSnapshot: {
1485
- ...g.productSnapshot,
1488
+ ...x.productSnapshot,
1486
1489
  quantity: Math.max(
1487
1490
  1,
1488
- g.productSnapshot.quantity - 1
1491
+ x.productSnapshot.quantity - 1
1489
1492
  )
1490
1493
  }
1491
- } : g
1494
+ } : x
1492
1495
  )
1493
1496
  ),
1494
1497
  style: {
@@ -1505,13 +1508,13 @@ const xt = (t) => {
1505
1508
  className: "px-3 py-1 text-sm",
1506
1509
  onClick: () => O(
1507
1510
  (f) => f.map(
1508
- (g, z) => z === k && g.productSnapshot ? {
1509
- ...g,
1511
+ (x, z) => z === k && x.productSnapshot ? {
1512
+ ...x,
1510
1513
  productSnapshot: {
1511
- ...g.productSnapshot,
1512
- quantity: g.productSnapshot.quantity + 1
1514
+ ...x.productSnapshot,
1515
+ quantity: x.productSnapshot.quantity + 1
1513
1516
  }
1514
- } : g
1517
+ } : x
1515
1518
  )
1516
1519
  ),
1517
1520
  style: {
@@ -1533,14 +1536,14 @@ const xt = (t) => {
1533
1536
  c.productSnapshot.quantity
1534
1537
  );
1535
1538
  },
1536
- disabled: q,
1539
+ disabled: M,
1537
1540
  className: "px-4 py-2 rounded-full font-medium",
1538
1541
  style: {
1539
1542
  background: p.tanyaThemeColor,
1540
1543
  color: (p == null ? void 0 : p.tanyaThemeContrastColor) || "#fff",
1541
- opacity: q ? 0.8 : 1
1544
+ opacity: M ? 0.8 : 1
1542
1545
  },
1543
- children: q ? "Adding..." : "Add to cart"
1546
+ children: M ? "Adding..." : "Add to cart"
1544
1547
  }
1545
1548
  )
1546
1549
  ] })
@@ -1572,7 +1575,7 @@ const xt = (t) => {
1572
1575
  autoFocus: !0,
1573
1576
  onChange: (c) => St(c.target.value),
1574
1577
  onKeyDown: (c) => {
1575
- c.key === "Enter" && !lt && K();
1578
+ c.key === "Enter" && !lt && J();
1576
1579
  }
1577
1580
  }
1578
1581
  ),
@@ -1582,7 +1585,7 @@ const xt = (t) => {
1582
1585
  type: "submit",
1583
1586
  disabled: lt,
1584
1587
  className: "p-3",
1585
- onClick: () => K(),
1588
+ onClick: () => J(),
1586
1589
  children: lt ? /* @__PURE__ */ a(
1587
1590
  "div",
1588
1591
  {
@@ -1676,10 +1679,10 @@ function it(t, e) {
1676
1679
  if (!t)
1677
1680
  throw new Ye(e);
1678
1681
  }
1679
- var Je = ["debug", "log", "warn", "error", "silent"], $r = Je.indexOf("log");
1682
+ var Ke = ["debug", "log", "warn", "error", "silent"], $r = Ke.indexOf("log");
1680
1683
  function Lt(t) {
1681
1684
  return function() {
1682
- if (Je.indexOf(t) >= $r) {
1685
+ if (Ke.indexOf(t) >= $r) {
1683
1686
  var e = console[t] || console.log;
1684
1687
  return e.apply(console, arguments);
1685
1688
  }
@@ -1688,7 +1691,7 @@ function Lt(t) {
1688
1691
  (function(t) {
1689
1692
  t.debug = Lt("debug"), t.log = Lt("log"), t.warn = Lt("warn"), t.error = Lt("error");
1690
1693
  })(it || (it = {}));
1691
- var Ke = "3.14.0";
1694
+ var Je = "3.14.0";
1692
1695
  function wt(t) {
1693
1696
  try {
1694
1697
  return t();
@@ -1744,13 +1747,13 @@ var Zt = Object.assign(function(e, r) {
1744
1747
  warn: Bt(it.warn),
1745
1748
  error: Bt(it.error)
1746
1749
  });
1747
- function Ge(t) {
1750
+ function We(t) {
1748
1751
  for (var e = [], r = 1; r < arguments.length; r++)
1749
1752
  e[r - 1] = arguments[r];
1750
1753
  return new Ye(le(t, e) || ce(t, e));
1751
1754
  }
1752
- var Fe = Symbol.for("ApolloErrorMessageHandler_" + Ke);
1753
- function We(t) {
1755
+ var Fe = Symbol.for("ApolloErrorMessageHandler_" + Je);
1756
+ function Ge(t) {
1754
1757
  if (typeof t == "string")
1755
1758
  return t;
1756
1759
  try {
@@ -1761,14 +1764,14 @@ function We(t) {
1761
1764
  }
1762
1765
  function le(t, e) {
1763
1766
  if (e === void 0 && (e = []), !!t)
1764
- return ae[Fe] && ae[Fe](t, e.map(We));
1767
+ return ae[Fe] && ae[Fe](t, e.map(Ge));
1765
1768
  }
1766
1769
  function ce(t, e) {
1767
1770
  if (e === void 0 && (e = []), !!t)
1768
1771
  return "An error occurred! For more details, see the full error text at https://go.apollo.dev/c/err#".concat(encodeURIComponent(JSON.stringify({
1769
- version: Ke,
1772
+ version: Je,
1770
1773
  message: t,
1771
- args: e.map(We)
1774
+ args: e.map(Ge)
1772
1775
  })));
1773
1776
  }
1774
1777
  function Ar(t) {
@@ -1924,7 +1927,7 @@ var pe = function() {
1924
1927
  };
1925
1928
  pe() && !fe("observable") && (Symbol.observable = Symbol("observable"));
1926
1929
  var Mr = me("iterator"), ie = me("observable"), Xe = me("species");
1927
- function Jt(t, e) {
1930
+ function Kt(t, e) {
1928
1931
  var r = t[e];
1929
1932
  if (r != null) {
1930
1933
  if (typeof r != "function") throw new TypeError(r + " is not a function");
@@ -1959,7 +1962,7 @@ function Qe(t) {
1959
1962
  if (typeof e == "function")
1960
1963
  e();
1961
1964
  else {
1962
- var r = Jt(e, "unsubscribe");
1965
+ var r = Kt(e, "unsubscribe");
1963
1966
  r && r.call(e);
1964
1967
  }
1965
1968
  } catch (o) {
@@ -1969,7 +1972,7 @@ function Qe(t) {
1969
1972
  function se(t) {
1970
1973
  t._observer = void 0, t._queue = void 0, t._state = "closed";
1971
1974
  }
1972
- function Rr(t) {
1975
+ function Vr(t) {
1973
1976
  var e = t._queue;
1974
1977
  if (e) {
1975
1978
  t._queue = void 0, t._state = "ready";
@@ -1981,7 +1984,7 @@ function Ze(t, e, r) {
1981
1984
  t._state = "running";
1982
1985
  var o = t._observer;
1983
1986
  try {
1984
- var n = Jt(o, e);
1987
+ var n = Kt(o, e);
1985
1988
  switch (e) {
1986
1989
  case "next":
1987
1990
  n && n.call(o, r);
@@ -2013,14 +2016,14 @@ function ee(t, e, r) {
2013
2016
  type: e,
2014
2017
  value: r
2015
2018
  }], qt(function() {
2016
- return Rr(t);
2019
+ return Vr(t);
2017
2020
  });
2018
2021
  return;
2019
2022
  }
2020
2023
  Ze(t, e, r);
2021
2024
  }
2022
2025
  }
2023
- var Vr = /* @__PURE__ */ (function() {
2026
+ var Rr = /* @__PURE__ */ (function() {
2024
2027
  function t(r, o) {
2025
2028
  this._cleanup = void 0, this._observer = r, this._queue = void 0, this._state = "initializing";
2026
2029
  var n = new Yr(this);
@@ -2069,7 +2072,7 @@ var Vr = /* @__PURE__ */ (function() {
2069
2072
  next: o,
2070
2073
  error: arguments[1],
2071
2074
  complete: arguments[2]
2072
- }), new Vr(o, this._subscriber);
2075
+ }), new Rr(o, this._subscriber);
2073
2076
  }, e.forEach = function(o) {
2074
2077
  var n = this;
2075
2078
  return new Promise(function(l, s) {
@@ -2081,11 +2084,11 @@ var Vr = /* @__PURE__ */ (function() {
2081
2084
  i.unsubscribe(), l();
2082
2085
  }
2083
2086
  var i = n.subscribe({
2084
- next: function(x) {
2087
+ next: function(g) {
2085
2088
  try {
2086
- o(x, d);
2087
- } catch (b) {
2088
- s(b), i.unsubscribe();
2089
+ o(g, d);
2090
+ } catch (w) {
2091
+ s(w), i.unsubscribe();
2089
2092
  }
2090
2093
  },
2091
2094
  error: s,
@@ -2139,26 +2142,26 @@ var Vr = /* @__PURE__ */ (function() {
2139
2142
  }, e.reduce = function(o) {
2140
2143
  var n = this;
2141
2144
  if (typeof o != "function") throw new TypeError(o + " is not a function");
2142
- var l = Nt(this), s = arguments.length > 1, d = !1, i = arguments[1], x = i;
2143
- return new l(function(b) {
2145
+ var l = Nt(this), s = arguments.length > 1, d = !1, i = arguments[1], g = i;
2146
+ return new l(function(w) {
2144
2147
  return n.subscribe({
2145
2148
  next: function(C) {
2146
2149
  var S = !d;
2147
2150
  if (d = !0, !S || s)
2148
2151
  try {
2149
- x = o(x, C);
2152
+ g = o(g, C);
2150
2153
  } catch (_) {
2151
- return b.error(_);
2154
+ return w.error(_);
2152
2155
  }
2153
2156
  else
2154
- x = C;
2157
+ g = C;
2155
2158
  },
2156
2159
  error: function(C) {
2157
- b.error(C);
2160
+ w.error(C);
2158
2161
  },
2159
2162
  complete: function() {
2160
- if (!d && !s) return b.error(new TypeError("Cannot reduce an empty sequence"));
2161
- b.next(x), b.complete();
2163
+ if (!d && !s) return w.error(new TypeError("Cannot reduce an empty sequence"));
2164
+ w.next(g), w.complete();
2162
2165
  }
2163
2166
  });
2164
2167
  });
@@ -2167,9 +2170,9 @@ var Vr = /* @__PURE__ */ (function() {
2167
2170
  l[s] = arguments[s];
2168
2171
  var d = Nt(this);
2169
2172
  return new d(function(i) {
2170
- var x, b = 0;
2173
+ var g, w = 0;
2171
2174
  function C(S) {
2172
- x = S.subscribe({
2175
+ g = S.subscribe({
2173
2176
  next: function(_) {
2174
2177
  i.next(_);
2175
2178
  },
@@ -2177,12 +2180,12 @@ var Vr = /* @__PURE__ */ (function() {
2177
2180
  i.error(_);
2178
2181
  },
2179
2182
  complete: function() {
2180
- b === l.length ? (x = void 0, i.complete()) : C(d.from(l[b++]));
2183
+ w === l.length ? (g = void 0, i.complete()) : C(d.from(l[w++]));
2181
2184
  }
2182
2185
  });
2183
2186
  }
2184
2187
  return C(o), function() {
2185
- x && (x.unsubscribe(), x = void 0);
2188
+ g && (g.unsubscribe(), g = void 0);
2186
2189
  };
2187
2190
  });
2188
2191
  }, e.flatMap = function(o) {
@@ -2191,14 +2194,14 @@ var Vr = /* @__PURE__ */ (function() {
2191
2194
  var l = Nt(this);
2192
2195
  return new l(function(s) {
2193
2196
  var d = [], i = n.subscribe({
2194
- next: function(b) {
2197
+ next: function(w) {
2195
2198
  if (o)
2196
2199
  try {
2197
- b = o(b);
2200
+ w = o(w);
2198
2201
  } catch (S) {
2199
2202
  return s.error(S);
2200
2203
  }
2201
- var C = l.from(b).subscribe({
2204
+ var C = l.from(w).subscribe({
2202
2205
  next: function(S) {
2203
2206
  s.next(S);
2204
2207
  },
@@ -2207,24 +2210,24 @@ var Vr = /* @__PURE__ */ (function() {
2207
2210
  },
2208
2211
  complete: function() {
2209
2212
  var S = d.indexOf(C);
2210
- S >= 0 && d.splice(S, 1), x();
2213
+ S >= 0 && d.splice(S, 1), g();
2211
2214
  }
2212
2215
  });
2213
2216
  d.push(C);
2214
2217
  },
2215
- error: function(b) {
2216
- s.error(b);
2218
+ error: function(w) {
2219
+ s.error(w);
2217
2220
  },
2218
2221
  complete: function() {
2219
- x();
2222
+ g();
2220
2223
  }
2221
2224
  });
2222
- function x() {
2225
+ function g() {
2223
2226
  i.closed && d.length === 0 && s.complete();
2224
2227
  }
2225
2228
  return function() {
2226
- d.forEach(function(b) {
2227
- return b.unsubscribe();
2229
+ d.forEach(function(w) {
2230
+ return w.unsubscribe();
2228
2231
  }), i.unsubscribe();
2229
2232
  };
2230
2233
  });
@@ -2233,7 +2236,7 @@ var Vr = /* @__PURE__ */ (function() {
2233
2236
  }, t.from = function(o) {
2234
2237
  var n = typeof this == "function" ? this : t;
2235
2238
  if (o == null) throw new TypeError(o + " is not an object");
2236
- var l = Jt(o, ie);
2239
+ var l = Kt(o, ie);
2237
2240
  if (l) {
2238
2241
  var s = l.call(o);
2239
2242
  if (Object(s) !== s) throw new TypeError(s + " is not an object");
@@ -2241,13 +2244,13 @@ var Vr = /* @__PURE__ */ (function() {
2241
2244
  return s.subscribe(d);
2242
2245
  });
2243
2246
  }
2244
- if (fe("iterator") && (l = Jt(o, Mr), l))
2247
+ if (fe("iterator") && (l = Kt(o, Mr), l))
2245
2248
  return new n(function(d) {
2246
2249
  qt(function() {
2247
2250
  if (!d.closed) {
2248
- for (var i = Ur(l.call(o)), x; !(x = i()).done; ) {
2249
- var b = x.value;
2250
- if (d.next(b), d.closed) return;
2251
+ for (var i = Ur(l.call(o)), g; !(g = i()).done; ) {
2252
+ var w = g.value;
2253
+ if (d.next(w), d.closed) return;
2251
2254
  }
2252
2255
  d.complete();
2253
2256
  }
@@ -2291,7 +2294,7 @@ pe() && Object.defineProperty(N, Symbol("extensions"), {
2291
2294
  },
2292
2295
  configurable: !0
2293
2296
  });
2294
- function Jr(t) {
2297
+ function Kr(t) {
2295
2298
  var e, r = t.Symbol;
2296
2299
  if (typeof r == "function")
2297
2300
  if (r.observable)
@@ -2309,12 +2312,12 @@ function Jr(t) {
2309
2312
  }
2310
2313
  var gt;
2311
2314
  typeof self < "u" ? gt = self : typeof window < "u" ? gt = window : typeof global < "u" ? gt = global : typeof module < "u" ? gt = module : gt = Function("return this")();
2312
- Jr(gt);
2315
+ Kr(gt);
2313
2316
  var $e = N.prototype, ze = "@@observable";
2314
2317
  $e[ze] || ($e[ze] = function() {
2315
2318
  return this;
2316
2319
  });
2317
- function Kr(t) {
2320
+ function Jr(t) {
2318
2321
  for (var e = [
2319
2322
  "query",
2320
2323
  "operationName",
@@ -2324,11 +2327,11 @@ function Kr(t) {
2324
2327
  ], r = 0, o = Object.keys(t); r < o.length; r++) {
2325
2328
  var n = o[r];
2326
2329
  if (e.indexOf(n) < 0)
2327
- throw Ge(58, n);
2330
+ throw We(58, n);
2328
2331
  }
2329
2332
  return t;
2330
2333
  }
2331
- function Gr(t, e) {
2334
+ function Wr(t, e) {
2332
2335
  var r = Q({}, t), o = function(l) {
2333
2336
  typeof l == "function" ? r = Q(Q({}, r), l(r)) : r = Q(Q({}, r), l);
2334
2337
  }, n = function() {
@@ -2342,7 +2345,7 @@ function Gr(t, e) {
2342
2345
  value: n
2343
2346
  }), e;
2344
2347
  }
2345
- function Wr(t) {
2348
+ function Gr(t) {
2346
2349
  var e = {
2347
2350
  variables: t.variables || {},
2348
2351
  extensions: t.extensions || {},
@@ -2389,7 +2392,7 @@ var tr = (
2389
2392
  return e(d) ? n.request(d, i) || N.of() : l.request(d, i) || N.of();
2390
2393
  }), Object.assign(s, { left: n, right: l });
2391
2394
  }, t.execute = function(e, r) {
2392
- return e.request(Gr(r.context, Wr(Kr(r)))) || N.of();
2395
+ return e.request(Wr(r.context, Gr(Jr(r)))) || N.of();
2393
2396
  }, t.concat = function(e, r) {
2394
2397
  var o = Et(e);
2395
2398
  if (Ut(o))
@@ -2409,7 +2412,7 @@ var tr = (
2409
2412
  }, t.prototype.concat = function(e) {
2410
2413
  return t.concat(this, e);
2411
2414
  }, t.prototype.request = function(e, r) {
2412
- throw Ge(48);
2415
+ throw We(48);
2413
2416
  }, t.prototype.onError = function(e, r) {
2414
2417
  if (globalThis.__DEV__ !== !1 && eo("onError", function() {
2415
2418
  globalThis.__DEV__ !== !1 && Zt.warn(49);