tanya-chatbot 0.4.3 → 0.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/tanya-chatbot.es.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { useEffect as it, useState as z, useRef as
|
|
1
|
+
import { useEffect as it, useState as z, useRef as Ft } from "react";
|
|
2
2
|
import { jsx as a, jsxs as u, Fragment as re } from "react/jsx-runtime";
|
|
3
3
|
import { createHttpLink as sr, ApolloClient as lr, InMemoryCache as cr, ApolloProvider as dr } from "@apollo/client";
|
|
4
|
-
import { Provider as ur, useDispatch as
|
|
5
|
-
import { createSlice as
|
|
4
|
+
import { Provider as ur, useDispatch as je, useSelector as Ht } from "react-redux";
|
|
5
|
+
import { createSlice as De, configureStore as pr } from "@reduxjs/toolkit";
|
|
6
6
|
import * as Le from "@radix-ui/react-popover";
|
|
7
7
|
import "clsx";
|
|
8
8
|
import "tailwind-merge";
|
|
@@ -21,7 +21,7 @@ function vo() {
|
|
|
21
21
|
}
|
|
22
22
|
}, []), null;
|
|
23
23
|
}
|
|
24
|
-
const
|
|
24
|
+
const hr = {
|
|
25
25
|
store: {
|
|
26
26
|
storeCode: "",
|
|
27
27
|
storeName: "",
|
|
@@ -55,17 +55,17 @@ const mr = {
|
|
|
55
55
|
mobile: []
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
-
}, Be =
|
|
58
|
+
}, Be = De({
|
|
59
59
|
name: "store",
|
|
60
|
-
initialState:
|
|
60
|
+
initialState: hr,
|
|
61
61
|
reducers: {
|
|
62
62
|
setStore: (t, e) => {
|
|
63
63
|
t.store = e.payload;
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
-
}), { setStore: ko } = Be.actions,
|
|
66
|
+
}), { setStore: ko } = Be.actions, mr = Be.reducer, wr = {
|
|
67
67
|
product: null
|
|
68
|
-
}, Ue =
|
|
68
|
+
}, Ue = De({
|
|
69
69
|
name: "product",
|
|
70
70
|
initialState: wr,
|
|
71
71
|
reducers: {
|
|
@@ -75,7 +75,7 @@ const mr = {
|
|
|
75
75
|
}
|
|
76
76
|
}), { setProduct: oe } = Ue.actions, gr = Ue.reducer, br = pr({
|
|
77
77
|
reducer: {
|
|
78
|
-
store:
|
|
78
|
+
store: mr,
|
|
79
79
|
product: gr
|
|
80
80
|
}
|
|
81
81
|
}), xr = ({ children: t }) => /* @__PURE__ */ a(ur, { store: br, children: t }), Vt = (t) => {
|
|
@@ -138,18 +138,15 @@ async function Ot() {
|
|
|
138
138
|
sessionStorage.getItem("customerData") || "{}"
|
|
139
139
|
).usrRef;
|
|
140
140
|
try {
|
|
141
|
-
const
|
|
142
|
-
|
|
141
|
+
const m = d ? "unregister-auth" : "register-auth";
|
|
142
|
+
return (await T.get(
|
|
143
|
+
`${s}sc-api/${m}?dwsid=${l}&email=${i}&pubCfg=${Z()}&envRef=${tt()}&orgRef=${et()}&siteId=${H()}&token=true`,
|
|
143
144
|
{
|
|
144
145
|
withCredentials: !0
|
|
145
146
|
}
|
|
146
|
-
);
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
String((/* @__PURE__ */ new Date()).getTime() + S.data.expires_in * 1e3)
|
|
150
|
-
), localStorage.setItem("isGuest", d ? "true" : "false"), S.data;
|
|
151
|
-
} catch (h) {
|
|
152
|
-
console.log(h);
|
|
147
|
+
)).data;
|
|
148
|
+
} catch (m) {
|
|
149
|
+
console.log(m);
|
|
153
150
|
}
|
|
154
151
|
}
|
|
155
152
|
const Q = () => sessionStorage.getItem("Host"), H = () => sessionStorage.getItem("SiteId"), Z = () => sessionStorage.getItem("pubCfg"), tt = () => sessionStorage.getItem("envRef"), et = () => sessionStorage.getItem("orgRef"), be = async (t) => {
|
|
@@ -214,21 +211,21 @@ const Q = () => sessionStorage.getItem("Host"), H = () => sessionStorage.getItem
|
|
|
214
211
|
centAmount: (r = t.masterVariant) == null ? void 0 : r.prices[0].value.centAmount,
|
|
215
212
|
currencyCode: (o = t.masterVariant) == null ? void 0 : o.prices[0].value.currencyCode
|
|
216
213
|
};
|
|
217
|
-
},
|
|
214
|
+
}, Cr = (t) => t.charAt(0).toUpperCase() + t.slice(1), ke = (t, e) => t.length < e ? t : t.slice(0, e) + "...", Xt = (t) => t.split("\\n").map((e, r) => {
|
|
218
215
|
const o = e.match(/^(\d+)\.\s(.+)/);
|
|
219
216
|
return o ? `<p key=${r} class="mb-2"><strong>${o[1]}.</strong> ${o[2]}</p>` : e.trim() ? `<p key=${r} class="mb-2">${e}</p>` : "<br/>";
|
|
220
217
|
}).join("");
|
|
221
|
-
function
|
|
218
|
+
function _r() {
|
|
222
219
|
const t = () => window.innerWidth < 425 ? 1 : window.innerWidth < 768 ? 2 : 4, [e, r] = z(t);
|
|
223
220
|
return it(() => {
|
|
224
221
|
const o = () => r(t());
|
|
225
222
|
return window.addEventListener("resize", o), () => window.removeEventListener("resize", o);
|
|
226
223
|
}, []), e;
|
|
227
224
|
}
|
|
228
|
-
const
|
|
225
|
+
const Fr = ({
|
|
229
226
|
product: t
|
|
230
227
|
}) => {
|
|
231
|
-
const e =
|
|
228
|
+
const e = je(), r = _r(), [o, n] = z(0), d = () => {
|
|
232
229
|
n(
|
|
233
230
|
(i) => i + r >= t.length ? 0 : i + r
|
|
234
231
|
);
|
|
@@ -255,7 +252,7 @@ const Ir = ({
|
|
|
255
252
|
}
|
|
256
253
|
),
|
|
257
254
|
/* @__PURE__ */ a("div", { className: "flex gap-5 justify-center flex-1 overflow-hidden", children: t.slice(o, o + r).map((i) => {
|
|
258
|
-
var b,
|
|
255
|
+
var b, m, S, _;
|
|
259
256
|
return /* @__PURE__ */ u(
|
|
260
257
|
"div",
|
|
261
258
|
{
|
|
@@ -280,7 +277,7 @@ const Ir = ({
|
|
|
280
277
|
children: [
|
|
281
278
|
/* @__PURE__ */ u("div", { className: "relative inline-block group", children: [
|
|
282
279
|
/* @__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(
|
|
283
|
-
xe((
|
|
280
|
+
xe((m = i == null ? void 0 : i.name) == null ? void 0 : m["en-US"]),
|
|
284
281
|
60
|
|
285
282
|
) || "Product" }),
|
|
286
283
|
/* @__PURE__ */ a(
|
|
@@ -304,7 +301,7 @@ const Ir = ({
|
|
|
304
301
|
/* @__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
302
|
/* @__PURE__ */ a("p", { children: Sr(
|
|
306
303
|
i != null && i.price ? Number(i == null ? void 0 : i.price) : ve(i).centAmount || 0,
|
|
307
|
-
(
|
|
304
|
+
(_ = ve(i)) == null ? void 0 : _.currencyCode
|
|
308
305
|
) }),
|
|
309
306
|
/* @__PURE__ */ u("p", { className: "text-[#14121F] font-normal line-through text-sm font-nunitoSans truncate", children: [
|
|
310
307
|
"$",
|
|
@@ -333,7 +330,7 @@ const Ir = ({
|
|
|
333
330
|
}
|
|
334
331
|
)
|
|
335
332
|
] }) });
|
|
336
|
-
},
|
|
333
|
+
}, Ir = ({ chat: t, storeDetails: e }) => /* @__PURE__ */ a("div", { className: "bg-[#FFFFFF] px-7 py-4 rounded-r-xl rounded-bl-2xl w-full", children: t.map((r, o) => /* @__PURE__ */ u(
|
|
337
334
|
"div",
|
|
338
335
|
{
|
|
339
336
|
className: "mb-4 p-3 rounded-xl",
|
|
@@ -346,11 +343,11 @@ const Ir = ({
|
|
|
346
343
|
"div",
|
|
347
344
|
{
|
|
348
345
|
className: "font-nunitoSans font-bold text-sm text-[#494949] p-2 w-fit rounded-[20px]",
|
|
349
|
-
children:
|
|
346
|
+
children: Cr(r.keyword) || "No keyword"
|
|
350
347
|
}
|
|
351
348
|
),
|
|
352
349
|
/* @__PURE__ */ a(
|
|
353
|
-
|
|
350
|
+
Fr,
|
|
354
351
|
{
|
|
355
352
|
product: r.items,
|
|
356
353
|
storeDetails: e
|
|
@@ -425,7 +422,7 @@ const Ir = ({
|
|
|
425
422
|
} catch (s) {
|
|
426
423
|
return T.isAxiosError(s) ? { status: (d = s.response) == null ? void 0 : d.status, data: null } : { status: null, data: null };
|
|
427
424
|
}
|
|
428
|
-
}, Yt = "sfcc_basket_id", Se = "sfcc_customer_token", Tt = "sfcc_token_expiry", Nr = 300 * 1e3,
|
|
425
|
+
}, Yt = "sfcc_basket_id", Se = "sfcc_customer_token", Tt = "sfcc_token_expiry", Nr = 300 * 1e3, It = "1.0.0";
|
|
429
426
|
const st = (t) => {
|
|
430
427
|
try {
|
|
431
428
|
t ? localStorage.setItem(Yt, t) : localStorage.removeItem(Yt);
|
|
@@ -443,34 +440,34 @@ const st = (t) => {
|
|
|
443
440
|
} catch (e) {
|
|
444
441
|
console.error("Error storing token:", e);
|
|
445
442
|
}
|
|
446
|
-
},
|
|
447
|
-
var l, i, b,
|
|
448
|
-
const t =
|
|
443
|
+
}, Ce = 300, Er = () => {
|
|
444
|
+
var l, i, b, m, S, _;
|
|
445
|
+
const t = je(), e = Ht((F) => F.product.product), r = Ht((F) => F.store.store), [o, n] = z(!!e);
|
|
449
446
|
if (it(() => {
|
|
450
447
|
n(!!e);
|
|
451
448
|
}, [e]), !e) return null;
|
|
452
449
|
const d = async () => {
|
|
453
|
-
var
|
|
450
|
+
var F, j, K, ct, V, dt, kt, Pt, rt, St, Ct, ut, $t, zt, _t, P;
|
|
454
451
|
console.log(e, "the prod");
|
|
455
452
|
try {
|
|
456
|
-
if (!((
|
|
453
|
+
if (!((j = (F = e == null ? void 0 : e.variants) == null ? void 0 : F[0]) != null && j.product_id) && !(e.type.item || e.type.bundle) && !((ct = (K = e == null ? void 0 : e.variants) == null ? void 0 : K[0]) != null && ct.productId)) {
|
|
457
454
|
M.error("Variants not available", {
|
|
458
455
|
position: "bottom-right",
|
|
459
456
|
autoClose: 1e3
|
|
460
457
|
}), console.error("No product variant found");
|
|
461
458
|
return;
|
|
462
459
|
}
|
|
463
|
-
const
|
|
460
|
+
const C = [
|
|
464
461
|
{
|
|
465
462
|
product_id: ((V = e.variants) == null ? void 0 : V[0].product_id) || ((dt = e.variants) == null ? void 0 : dt[0].productId) || (e == null ? void 0 : e.id),
|
|
466
463
|
quantity: 1
|
|
467
464
|
}
|
|
468
465
|
];
|
|
469
|
-
console.log(
|
|
466
|
+
console.log(C, "the product data");
|
|
470
467
|
const k = JSON.parse(
|
|
471
468
|
sessionStorage.getItem("customerData") || "{}"
|
|
472
|
-
), ot = (k == null ? void 0 : k.basketId) || localStorage.getItem(Yt), Wt = !1, At = localStorage.getItem(Tt),
|
|
473
|
-
if (!Wt || !At ||
|
|
469
|
+
), ot = (k == null ? void 0 : k.basketId) || localStorage.getItem(Yt), Wt = !1, At = localStorage.getItem(Tt), jt = Date.now();
|
|
470
|
+
if (!Wt || !At || jt >= parseInt(At)) {
|
|
474
471
|
let $ = "";
|
|
475
472
|
{
|
|
476
473
|
const ft = await Ot();
|
|
@@ -480,19 +477,19 @@ const st = (t) => {
|
|
|
480
477
|
console.error("Failed to get customer_token");
|
|
481
478
|
return;
|
|
482
479
|
}
|
|
483
|
-
const pt =
|
|
480
|
+
const pt = jt + 300 * 1e3;
|
|
484
481
|
if (Kt($), localStorage.setItem(Tt, pt.toString()), ot) {
|
|
485
482
|
const ft = await Re({
|
|
486
483
|
basketId: ot,
|
|
487
484
|
customer_token: $
|
|
488
485
|
});
|
|
489
486
|
if (console.log(ot, "basket id from customer"), ft.status === 200 && ft) {
|
|
490
|
-
const
|
|
487
|
+
const D = await Rt(
|
|
491
488
|
ot,
|
|
492
|
-
|
|
489
|
+
C,
|
|
493
490
|
$
|
|
494
491
|
);
|
|
495
|
-
(((kt =
|
|
492
|
+
(((kt = D == null ? void 0 : D.product_items) == null ? void 0 : kt.length) > 0 || ((Pt = D == null ? void 0 : D.productItems) == null ? void 0 : Pt.length) > 0) && (M.success("Added to cart", {
|
|
496
493
|
position: "bottom-right",
|
|
497
494
|
autoClose: 3e3,
|
|
498
495
|
hideProgressBar: !1,
|
|
@@ -503,7 +500,7 @@ const st = (t) => {
|
|
|
503
500
|
return;
|
|
504
501
|
}
|
|
505
502
|
}
|
|
506
|
-
const
|
|
503
|
+
const Dt = {
|
|
507
504
|
productItems: [
|
|
508
505
|
{
|
|
509
506
|
productId: ((rt = e.variants) == null ? void 0 : rt[0].product_id) || ((St = e.variants) == null ? void 0 : St[0].productId) || (e == null ? void 0 : e.id),
|
|
@@ -512,42 +509,42 @@ const st = (t) => {
|
|
|
512
509
|
]
|
|
513
510
|
};
|
|
514
511
|
console.log("before create basket");
|
|
515
|
-
const
|
|
512
|
+
const h = await Ve($, Dt);
|
|
516
513
|
if (console.log(
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
514
|
+
h,
|
|
515
|
+
h == null ? void 0 : h.basket_id,
|
|
516
|
+
h == null ? void 0 : h.basketId,
|
|
520
517
|
"the basket response"
|
|
521
|
-
), !(
|
|
518
|
+
), !(h != null && h.basket_id) && !(h != null && h.basketId)) {
|
|
522
519
|
console.error("Failed to create basket");
|
|
523
520
|
return;
|
|
524
521
|
}
|
|
525
522
|
console.log(
|
|
526
523
|
"setting stored id",
|
|
527
|
-
(
|
|
524
|
+
(h == null ? void 0 : h.basket_id) || (h == null ? void 0 : h.basketId)
|
|
528
525
|
), st(
|
|
529
|
-
(
|
|
526
|
+
(h == null ? void 0 : h.basket_id) || (h == null ? void 0 : h.basketId)
|
|
530
527
|
), console.log("adding product to basket");
|
|
531
528
|
const J = await Rt(
|
|
532
|
-
(
|
|
533
|
-
|
|
529
|
+
(h == null ? void 0 : h.basket_id) || (h == null ? void 0 : h.basketId),
|
|
530
|
+
C,
|
|
534
531
|
$
|
|
535
532
|
);
|
|
536
|
-
console.log("object added to basket"), (((
|
|
533
|
+
console.log("object added to basket"), (((Ct = J == null ? void 0 : J.product_items) == null ? void 0 : Ct.length) > 0 || ((ut = J == null ? void 0 : J.productItems) == null ? void 0 : ut.length) > 0) && M.success("Added to cart", {
|
|
537
534
|
position: "bottom-right",
|
|
538
535
|
autoClose: 3e3,
|
|
539
536
|
hideProgressBar: !1,
|
|
540
537
|
closeOnClick: !0,
|
|
541
538
|
pauseOnHover: !0,
|
|
542
539
|
draggable: !0
|
|
543
|
-
}), Vt(
|
|
540
|
+
}), Vt(h.basket_id || (h == null ? void 0 : h.basketId));
|
|
544
541
|
}
|
|
545
|
-
} catch (
|
|
546
|
-
console.error("Error adding to cart:",
|
|
542
|
+
} catch (C) {
|
|
543
|
+
console.error("Error adding to cart:", C), M.error("Failed to add product to cart", {
|
|
547
544
|
position: "bottom-right",
|
|
548
545
|
autoClose: 3e3
|
|
549
|
-
}), (($t =
|
|
550
|
-
((zt =
|
|
546
|
+
}), (($t = C == null ? void 0 : C.response) == null ? void 0 : $t.status) === 404 || // Basket not found
|
|
547
|
+
((zt = C == null ? void 0 : C.response) == null ? void 0 : zt.status) === 401 ? (((_t = C == null ? void 0 : C.response) == null ? void 0 : _t.status) === 404 && st(null), ((P = C == null ? void 0 : C.response) == null ? void 0 : P.status) === 401 && (st(null), Kt(null))) : (console.error("Failed to add product to basket:", C.message), M.error("Failed to add product to cart", {
|
|
551
548
|
position: "bottom-right",
|
|
552
549
|
autoClose: 3e3
|
|
553
550
|
}));
|
|
@@ -561,7 +558,7 @@ const st = (t) => {
|
|
|
561
558
|
{
|
|
562
559
|
className: "fixed inset-0 z-40 bg-black/30",
|
|
563
560
|
onClick: () => {
|
|
564
|
-
n(!1), setTimeout(() => t(oe(null)),
|
|
561
|
+
n(!1), setTimeout(() => t(oe(null)), Ce);
|
|
565
562
|
}
|
|
566
563
|
}
|
|
567
564
|
),
|
|
@@ -574,7 +571,7 @@ const st = (t) => {
|
|
|
574
571
|
${o ? "translate-y-0 md:translate-y-0 md:translate-x-0 opacity-100" : "translate-y-full md:translate-y-0 md:translate-x-full opacity-0 pointer-events-none"}
|
|
575
572
|
`,
|
|
576
573
|
style: { willChange: "transform, opacity" },
|
|
577
|
-
onClick: (
|
|
574
|
+
onClick: (F) => F.stopPropagation(),
|
|
578
575
|
children: [
|
|
579
576
|
/* @__PURE__ */ u("div", { className: "mt-3 flex flex-row justify-between w-full ", children: [
|
|
580
577
|
/* @__PURE__ */ a("div", { children: /* @__PURE__ */ a("p", { className: "text-[#000000] font-bold font-nunitoSans", children: e.name }) }),
|
|
@@ -586,7 +583,7 @@ const st = (t) => {
|
|
|
586
583
|
onClick: () => {
|
|
587
584
|
n(!1), setTimeout(
|
|
588
585
|
() => t(oe(null)),
|
|
589
|
-
|
|
586
|
+
Ce
|
|
590
587
|
);
|
|
591
588
|
}
|
|
592
589
|
}
|
|
@@ -596,20 +593,20 @@ const st = (t) => {
|
|
|
596
593
|
/* @__PURE__ */ a("div", { className: "flex flex-row items-center justify-center w-[120px] h-[120px] my-5", children: /* @__PURE__ */ a(
|
|
597
594
|
"img",
|
|
598
595
|
{
|
|
599
|
-
src: (
|
|
596
|
+
src: (m = (b = (i = (l = e.imageGroups) == null ? void 0 : l[0]) == null ? void 0 : i.images) == null ? void 0 : b[0]) == null ? void 0 : m.link,
|
|
600
597
|
alt: e.name,
|
|
601
598
|
className: "rounded-[10px]"
|
|
602
599
|
}
|
|
603
600
|
) }),
|
|
604
601
|
/* @__PURE__ */ a("div", { className: "flex flex-col items-center gap-2", children: e.imageGroups.slice(1, 2).map(
|
|
605
|
-
(
|
|
602
|
+
(F) => F.images.slice(1, 2).map((j) => /* @__PURE__ */ a(
|
|
606
603
|
"img",
|
|
607
604
|
{
|
|
608
|
-
src:
|
|
605
|
+
src: j.link,
|
|
609
606
|
alt: e.name,
|
|
610
607
|
className: "rounded-[10px] w-[60px] h-[60px]"
|
|
611
608
|
},
|
|
612
|
-
|
|
609
|
+
j.link
|
|
613
610
|
))
|
|
614
611
|
) })
|
|
615
612
|
] }),
|
|
@@ -652,11 +649,11 @@ const st = (t) => {
|
|
|
652
649
|
] }),
|
|
653
650
|
/* @__PURE__ */ a("div", { className: "text-[#323135] font-semibold text-sm", children: "Overall Rating" }),
|
|
654
651
|
/* @__PURE__ */ u("div", { className: "text-[#68656E] font-semibold text-sm", children: [
|
|
655
|
-
((
|
|
652
|
+
((_ = e == null ? void 0 : e.rating) == null ? void 0 : _.count) || 0,
|
|
656
653
|
" ratings"
|
|
657
654
|
] })
|
|
658
655
|
] }) }),
|
|
659
|
-
/* @__PURE__ */ a("div", { className: "mt-2 flex flex-row items-center gap-2", children: Array.from({ length: 5 }).map((
|
|
656
|
+
/* @__PURE__ */ a("div", { className: "mt-2 flex flex-row items-center gap-2", children: Array.from({ length: 5 }).map((F, j) => {
|
|
660
657
|
var K;
|
|
661
658
|
return /* @__PURE__ */ a(
|
|
662
659
|
ge,
|
|
@@ -665,10 +662,10 @@ const st = (t) => {
|
|
|
665
662
|
width: "20",
|
|
666
663
|
height: "20",
|
|
667
664
|
className: `text-yellow-500
|
|
668
|
-
${((K = e == null ? void 0 : e.rating) == null ? void 0 : K.rate) >
|
|
665
|
+
${((K = e == null ? void 0 : e.rating) == null ? void 0 : K.rate) > j ? "text-yellow-500" : "text-gray-300"}
|
|
669
666
|
`
|
|
670
667
|
},
|
|
671
|
-
|
|
668
|
+
j
|
|
672
669
|
);
|
|
673
670
|
}) })
|
|
674
671
|
] }),
|
|
@@ -721,27 +718,27 @@ const st = (t) => {
|
|
|
721
718
|
"Niece/Nephew": "his/her niece/nephew",
|
|
722
719
|
"My Friends": "his/her friends",
|
|
723
720
|
Others: "others"
|
|
724
|
-
}, n =
|
|
721
|
+
}, n = Ft(null), d = Ft(null), s = Ft(null), l = Ft(null), [i, b] = z(null), [m, S] = z(!1), [_, F] = z(!1), [j, K] = z(!1), [ct, V] = z(!1), [dt, kt] = z(!1), [Pt, rt] = z(!1), [St, Ct] = z(""), [ut, $t] = z(""), zt = (c) => ({
|
|
725
722
|
id: c.id,
|
|
726
723
|
title: c.name,
|
|
727
724
|
image: c.image ?? "",
|
|
728
725
|
price: c.price ?? 0
|
|
729
|
-
}), [
|
|
730
|
-
K(!0), setTimeout(() =>
|
|
726
|
+
}), [_t, P] = z([]), C = Ft(null), k = Ht((c) => c.store.store), ot = Ht((c) => c.product.product), Wt = () => {
|
|
727
|
+
K(!0), setTimeout(() => F(!0), 10);
|
|
731
728
|
}, At = () => {
|
|
732
|
-
|
|
729
|
+
F(!1), setTimeout(() => K(!1), 300);
|
|
733
730
|
};
|
|
734
731
|
it(() => {
|
|
735
|
-
|
|
736
|
-
}, [
|
|
737
|
-
const
|
|
732
|
+
m ? Wt() : At();
|
|
733
|
+
}, [m]);
|
|
734
|
+
const jt = (c) => {
|
|
738
735
|
$t(o[c]);
|
|
739
736
|
};
|
|
740
737
|
it(() => {
|
|
741
|
-
|
|
742
|
-
}, [
|
|
738
|
+
C.current && (C.current.scrollTop += 150);
|
|
739
|
+
}, [_t]);
|
|
743
740
|
let $ = null, pt = null;
|
|
744
|
-
const
|
|
741
|
+
const Dt = async () => {
|
|
745
742
|
if ($ && pt && Date.now() < pt)
|
|
746
743
|
return $;
|
|
747
744
|
try {
|
|
@@ -768,7 +765,7 @@ const st = (t) => {
|
|
|
768
765
|
} catch (c) {
|
|
769
766
|
return console.error("Error obtaining JWT token:", c), $ = null, pt = null, null;
|
|
770
767
|
}
|
|
771
|
-
},
|
|
768
|
+
}, h = async () => {
|
|
772
769
|
const c = await Ot();
|
|
773
770
|
c != null && b(c);
|
|
774
771
|
};
|
|
@@ -777,7 +774,7 @@ const st = (t) => {
|
|
|
777
774
|
const { clientID: c, host: v, organizationID: w, shortCode: x, siteId: p } = t;
|
|
778
775
|
sessionStorage.setItem("Host", v), sessionStorage.setItem("SiteId", p), sessionStorage.setItem("pubCfg", btoa(c)), sessionStorage.setItem("envRef", x), sessionStorage.setItem("orgRef", w);
|
|
779
776
|
}
|
|
780
|
-
|
|
777
|
+
h(), console.log("scapi environment v1");
|
|
781
778
|
}, []), it(() => {
|
|
782
779
|
e && (console.log("setting the basket id", e), st(e));
|
|
783
780
|
}, [e]);
|
|
@@ -787,21 +784,21 @@ const st = (t) => {
|
|
|
787
784
|
).customerId;
|
|
788
785
|
return (await kr(c || "")).c_interests;
|
|
789
786
|
}, ft = async (c, v) => {
|
|
790
|
-
console.log("in secondary flow",
|
|
787
|
+
console.log("in secondary flow", It);
|
|
791
788
|
const w = await J();
|
|
792
|
-
if (console.log(w, "interests of customer",
|
|
789
|
+
if (console.log(w, "interests of customer", It), !!w)
|
|
793
790
|
try {
|
|
794
791
|
P(
|
|
795
792
|
(U) => U.map(
|
|
796
793
|
(R, Y) => Y === U.length - 1 ? { ...R, secondaryLoading: !0 } : R
|
|
797
794
|
)
|
|
798
795
|
);
|
|
799
|
-
const x = await
|
|
796
|
+
const x = await Dt();
|
|
800
797
|
if (!x) throw new Error("Failed to fetch token");
|
|
801
|
-
const p = localStorage.getItem("customerNumber"), g = localStorage.getItem("isLoggedIn"),
|
|
798
|
+
const p = localStorage.getItem("customerNumber"), g = localStorage.getItem("isLoggedIn"), ht = `https://tanya.aspiresystems.com/api/bedrock/invoke/stream?${new URLSearchParams({
|
|
802
799
|
registered: String(g || !1),
|
|
803
800
|
userId: String(p || (/* @__PURE__ */ new Date()).getTime())
|
|
804
|
-
}).toString()}`,
|
|
801
|
+
}).toString()}`, mt = JSON.stringify({
|
|
805
802
|
flowId: "Q166PR519W",
|
|
806
803
|
flowAliasId: "HKFUVLWVH2",
|
|
807
804
|
input: {
|
|
@@ -810,14 +807,14 @@ const st = (t) => {
|
|
|
810
807
|
productPoints: String(v || 0),
|
|
811
808
|
interests: w
|
|
812
809
|
}
|
|
813
|
-
}), L = await fetch(
|
|
810
|
+
}), L = await fetch(ht, {
|
|
814
811
|
signal: AbortSignal.timeout(3e4),
|
|
815
812
|
method: "POST",
|
|
816
813
|
headers: {
|
|
817
814
|
"Content-Type": "application/json",
|
|
818
815
|
Authorization: `Bearer ${x}`
|
|
819
816
|
},
|
|
820
|
-
body:
|
|
817
|
+
body: mt
|
|
821
818
|
});
|
|
822
819
|
if (!L.body) throw new Error("Readable stream not supported");
|
|
823
820
|
const wt = L.body.getReader(), gt = new TextDecoder();
|
|
@@ -835,8 +832,8 @@ const st = (t) => {
|
|
|
835
832
|
try {
|
|
836
833
|
const q = JSON.parse(f);
|
|
837
834
|
q.index === 0 && P(
|
|
838
|
-
(
|
|
839
|
-
(O, G) => G ===
|
|
835
|
+
(I) => I.map(
|
|
836
|
+
(O, G) => G === I.length - 1 ? {
|
|
840
837
|
...O,
|
|
841
838
|
secondaryResponse: q.data,
|
|
842
839
|
secondaryLoading: !1
|
|
@@ -845,8 +842,8 @@ const st = (t) => {
|
|
|
845
842
|
);
|
|
846
843
|
} catch (q) {
|
|
847
844
|
P(
|
|
848
|
-
(
|
|
849
|
-
(O, G) => G ===
|
|
845
|
+
(I) => I.map(
|
|
846
|
+
(O, G) => G === I.length - 1 ? { ...O, secondaryLoading: !1 } : O
|
|
850
847
|
)
|
|
851
848
|
), console.error("Secondary flow JSON parse error:", q);
|
|
852
849
|
}
|
|
@@ -855,10 +852,10 @@ const st = (t) => {
|
|
|
855
852
|
} catch (x) {
|
|
856
853
|
console.error("Secondary flow error:", x);
|
|
857
854
|
}
|
|
858
|
-
},
|
|
855
|
+
}, D = async (c) => {
|
|
859
856
|
const v = c || St.trim();
|
|
860
857
|
if (v) {
|
|
861
|
-
kt(!0),
|
|
858
|
+
kt(!0), Ct(""), n.current = null, d.current = null, s.current = null, l.current = null, P((w) => [
|
|
862
859
|
...w,
|
|
863
860
|
{
|
|
864
861
|
query: v,
|
|
@@ -869,27 +866,27 @@ const st = (t) => {
|
|
|
869
866
|
}
|
|
870
867
|
]);
|
|
871
868
|
try {
|
|
872
|
-
const w = ut, x = localStorage.getItem("customerNumber"), p = localStorage.getItem("isLoggedIn"), g = await
|
|
869
|
+
const w = ut, x = localStorage.getItem("customerNumber"), p = localStorage.getItem("isLoggedIn"), g = await Dt();
|
|
873
870
|
if (!g)
|
|
874
871
|
throw new Error("Failed to obtain access token");
|
|
875
|
-
const
|
|
872
|
+
const ht = `https://tanya.aspiresystems.com/api/bedrock/invoke/stream?${new URLSearchParams({
|
|
876
873
|
registered: String(p || !1),
|
|
877
874
|
userId: String(x || (/* @__PURE__ */ new Date()).getTime())
|
|
878
|
-
}).toString()}`,
|
|
875
|
+
}).toString()}`, mt = JSON.stringify({
|
|
879
876
|
flowId: "MMHQKYI1NE",
|
|
880
877
|
flowAliasId: "SZF9ZK1ATE",
|
|
881
878
|
input: {
|
|
882
879
|
userPrompt: v,
|
|
883
880
|
whom: w
|
|
884
881
|
}
|
|
885
|
-
}), L = await fetch(
|
|
882
|
+
}), L = await fetch(ht, {
|
|
886
883
|
signal: AbortSignal.timeout(3e4),
|
|
887
884
|
method: "POST",
|
|
888
885
|
headers: {
|
|
889
886
|
"Content-Type": "application/json",
|
|
890
887
|
Authorization: `Bearer ${g}`
|
|
891
888
|
},
|
|
892
|
-
body:
|
|
889
|
+
body: mt
|
|
893
890
|
});
|
|
894
891
|
if (!L.ok)
|
|
895
892
|
throw new Error(`HTTP error! status: ${L.status}`);
|
|
@@ -908,17 +905,17 @@ const st = (t) => {
|
|
|
908
905
|
if (f.startsWith("data:")) {
|
|
909
906
|
const q = f.slice(5).trim();
|
|
910
907
|
try {
|
|
911
|
-
const
|
|
912
|
-
|
|
908
|
+
const I = JSON.parse(q);
|
|
909
|
+
I.index == 1 && (U = I.data), P(
|
|
913
910
|
(O) => O.map(
|
|
914
911
|
(G, Lt) => Lt === O.length - 1 ? {
|
|
915
912
|
...G,
|
|
916
|
-
[
|
|
913
|
+
[I.index == 0 ? "response" : I.index == 1 ? "keywords" : I.index == 2 ? "potentialQuestions" : "end"]: I.data
|
|
917
914
|
} : G
|
|
918
915
|
)
|
|
919
916
|
);
|
|
920
|
-
} catch (
|
|
921
|
-
console.error("Error parsing JSON:",
|
|
917
|
+
} catch (I) {
|
|
918
|
+
console.error("Error parsing JSON:", I);
|
|
922
919
|
}
|
|
923
920
|
}
|
|
924
921
|
}
|
|
@@ -991,11 +988,11 @@ const st = (t) => {
|
|
|
991
988
|
const v = JSON.parse(
|
|
992
989
|
sessionStorage.getItem("customerData") || "{}"
|
|
993
990
|
);
|
|
994
|
-
(v == null ? void 0 : v.isGuest) == !1 ? (console.log("running secondary flow",
|
|
991
|
+
(v == null ? void 0 : v.isGuest) == !1 ? (console.log("running secondary flow", It), ft(n.current, 0)) : console.log("not running secondary flow", It);
|
|
995
992
|
}
|
|
996
993
|
rt(!1);
|
|
997
994
|
}, or = async (c, v) => {
|
|
998
|
-
var w, x, p, g, A,
|
|
995
|
+
var w, x, p, g, A, ht, mt, L, wt, gt, B, U, R, Y, W;
|
|
999
996
|
V(!0);
|
|
1000
997
|
try {
|
|
1001
998
|
const f = await He(c.id);
|
|
@@ -1008,15 +1005,15 @@ const st = (t) => {
|
|
|
1008
1005
|
}
|
|
1009
1006
|
const q = [
|
|
1010
1007
|
{
|
|
1011
|
-
product_id: ((A = f.variants) == null ? void 0 : A[0].product_id) || ((
|
|
1008
|
+
product_id: ((A = f.variants) == null ? void 0 : A[0].product_id) || ((ht = f.variants) == null ? void 0 : ht[0].productId) || (f == null ? void 0 : f.id),
|
|
1012
1009
|
quantity: v
|
|
1013
1010
|
}
|
|
1014
1011
|
];
|
|
1015
|
-
console.log(q, "product data", "app version",
|
|
1016
|
-
const
|
|
1012
|
+
console.log(q, "product data", "app version", It);
|
|
1013
|
+
const I = JSON.parse(
|
|
1017
1014
|
sessionStorage.getItem("customerData") || "{}"
|
|
1018
|
-
), O = (
|
|
1019
|
-
if (!G || !Lt ||
|
|
1015
|
+
), O = (I == null ? void 0 : I.basketId) || localStorage.getItem(Yt), G = !1, Lt = localStorage.getItem(Tt), me = Date.now();
|
|
1016
|
+
if (!G || !Lt || me >= parseInt(Lt)) {
|
|
1020
1017
|
const nr = await qe();
|
|
1021
1018
|
let { customer_token: nt } = await Me(
|
|
1022
1019
|
nr
|
|
@@ -1025,7 +1022,7 @@ const st = (t) => {
|
|
|
1025
1022
|
console.error("Failed to get customer_token");
|
|
1026
1023
|
return;
|
|
1027
1024
|
}
|
|
1028
|
-
const ar =
|
|
1025
|
+
const ar = me + 300 * 1e3;
|
|
1029
1026
|
if (Kt(nt), localStorage.setItem(Tt, ar.toString()), console.log(O, "basketIdFromCustomer"), O) {
|
|
1030
1027
|
const we = await Re({
|
|
1031
1028
|
basketId: O,
|
|
@@ -1037,7 +1034,7 @@ const st = (t) => {
|
|
|
1037
1034
|
q,
|
|
1038
1035
|
nt
|
|
1039
1036
|
);
|
|
1040
|
-
((
|
|
1037
|
+
((mt = Gt == null ? void 0 : Gt.product_items) == null ? void 0 : mt.length) > 0 && (M.success("Added to cart", {
|
|
1041
1038
|
position: "bottom-right",
|
|
1042
1039
|
autoClose: 3e3,
|
|
1043
1040
|
hideProgressBar: !1,
|
|
@@ -1094,7 +1091,7 @@ const st = (t) => {
|
|
|
1094
1091
|
}
|
|
1095
1092
|
V(!1);
|
|
1096
1093
|
};
|
|
1097
|
-
return /* @__PURE__ */ a("div", { className: "relative flex justify-center", children: /* @__PURE__ */ u(yr, { open:
|
|
1094
|
+
return /* @__PURE__ */ a("div", { className: "relative flex justify-center", children: /* @__PURE__ */ u(yr, { open: m, onOpenChange: S, children: [
|
|
1098
1095
|
/* @__PURE__ */ a(
|
|
1099
1096
|
vr,
|
|
1100
1097
|
{
|
|
@@ -1158,7 +1155,7 @@ const st = (t) => {
|
|
|
1158
1155
|
) })
|
|
1159
1156
|
}
|
|
1160
1157
|
),
|
|
1161
|
-
|
|
1158
|
+
j && /* @__PURE__ */ u(re, { children: [
|
|
1162
1159
|
/* @__PURE__ */ a(
|
|
1163
1160
|
"div",
|
|
1164
1161
|
{
|
|
@@ -1174,9 +1171,9 @@ const st = (t) => {
|
|
|
1174
1171
|
top-0 right-0
|
|
1175
1172
|
transition-transform duration-300 ease-in-out
|
|
1176
1173
|
lg:transform
|
|
1177
|
-
${
|
|
1174
|
+
${_ ? "lg:translate-x-0" : "lg:translate-x-full"}
|
|
1178
1175
|
// For mobile: animate from bottom
|
|
1179
|
-
${
|
|
1176
|
+
${_ ? "translate-y-0" : "translate-y-full"}
|
|
1180
1177
|
lg:translate-y-0
|
|
1181
1178
|
`,
|
|
1182
1179
|
style: {
|
|
@@ -1311,7 +1308,7 @@ const st = (t) => {
|
|
|
1311
1308
|
/* @__PURE__ */ u(
|
|
1312
1309
|
"div",
|
|
1313
1310
|
{
|
|
1314
|
-
ref:
|
|
1311
|
+
ref: C,
|
|
1315
1312
|
className: "overflow-y-auto pr-5 pb-2 space-y-4 hide-scrollbar flex-grow mb-24",
|
|
1316
1313
|
children: [
|
|
1317
1314
|
(k == null ? void 0 : k.whomRequired) && /* @__PURE__ */ u(
|
|
@@ -1323,7 +1320,7 @@ const st = (t) => {
|
|
|
1323
1320
|
/* @__PURE__ */ a("div", { className: "flex flex-wrap gap-2 mt-2", children: r.map((c) => /* @__PURE__ */ a(
|
|
1324
1321
|
"button",
|
|
1325
1322
|
{
|
|
1326
|
-
onClick: () =>
|
|
1323
|
+
onClick: () => jt(c),
|
|
1327
1324
|
className: "px-2 py-2 font-semibold text-xs text-[#18181B] bg-[#F3F3F3] rounded-2xl",
|
|
1328
1325
|
style: {
|
|
1329
1326
|
backgroundColor: ut === o[c] ? "#FFFFFF" : "#F3F3F3",
|
|
@@ -1336,7 +1333,7 @@ const st = (t) => {
|
|
|
1336
1333
|
]
|
|
1337
1334
|
}
|
|
1338
1335
|
),
|
|
1339
|
-
|
|
1336
|
+
_t.map((c, v) => {
|
|
1340
1337
|
var w, x;
|
|
1341
1338
|
return /* @__PURE__ */ u("div", { children: [
|
|
1342
1339
|
/* @__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 }) }),
|
|
@@ -1359,7 +1356,7 @@ const st = (t) => {
|
|
|
1359
1356
|
) }),
|
|
1360
1357
|
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" }) }),
|
|
1361
1358
|
(c == null ? void 0 : c.products) && ((x = c == null ? void 0 : c.products) == null ? void 0 : x.length) > 0 && /* @__PURE__ */ a(
|
|
1362
|
-
|
|
1359
|
+
Ir,
|
|
1363
1360
|
{
|
|
1364
1361
|
chat: c.products,
|
|
1365
1362
|
storeDetails: k
|
|
@@ -1378,7 +1375,7 @@ const st = (t) => {
|
|
|
1378
1375
|
"button",
|
|
1379
1376
|
{
|
|
1380
1377
|
className: `cursor-pointer font-nunitoSans font-semibold text-[#232323] border bg-[#804C9E0D] border-${k.themeDarkColor} m-1 rounded-xl px-2 py-1`,
|
|
1381
|
-
onClick: () =>
|
|
1378
|
+
onClick: () => D(p),
|
|
1382
1379
|
style: {
|
|
1383
1380
|
backgroundColor: k.tanyaThemeColorLight
|
|
1384
1381
|
},
|
|
@@ -1581,9 +1578,9 @@ const st = (t) => {
|
|
|
1581
1578
|
placeholder: "How can I help you...",
|
|
1582
1579
|
value: St,
|
|
1583
1580
|
autoFocus: !0,
|
|
1584
|
-
onChange: (c) =>
|
|
1581
|
+
onChange: (c) => Ct(c.target.value),
|
|
1585
1582
|
onKeyDown: (c) => {
|
|
1586
|
-
c.key === "Enter" && !dt &&
|
|
1583
|
+
c.key === "Enter" && !dt && D();
|
|
1587
1584
|
}
|
|
1588
1585
|
}
|
|
1589
1586
|
),
|
|
@@ -1593,7 +1590,7 @@ const st = (t) => {
|
|
|
1593
1590
|
type: "submit",
|
|
1594
1591
|
disabled: dt,
|
|
1595
1592
|
className: "p-3",
|
|
1596
|
-
onClick: () =>
|
|
1593
|
+
onClick: () => D(),
|
|
1597
1594
|
children: dt ? /* @__PURE__ */ a(
|
|
1598
1595
|
"div",
|
|
1599
1596
|
{
|
|
@@ -1669,9 +1666,9 @@ function Pr(t, e) {
|
|
|
1669
1666
|
e.indexOf(o[n]) < 0 && Object.prototype.propertyIsEnumerable.call(t, o[n]) && (r[o[n]] = t[o[n]]);
|
|
1670
1667
|
return r;
|
|
1671
1668
|
}
|
|
1672
|
-
var Qt = "Invariant Violation",
|
|
1669
|
+
var Qt = "Invariant Violation", _e = Object.setPrototypeOf, $r = _e === void 0 ? function(t, e) {
|
|
1673
1670
|
return t.__proto__ = e, t;
|
|
1674
|
-
} :
|
|
1671
|
+
} : _e, Ye = (
|
|
1675
1672
|
/** @class */
|
|
1676
1673
|
(function(t) {
|
|
1677
1674
|
Or(e, t);
|
|
@@ -1723,12 +1720,12 @@ const ae = xt(function() {
|
|
|
1723
1720
|
xt(function() {
|
|
1724
1721
|
return xt.constructor("return this")();
|
|
1725
1722
|
});
|
|
1726
|
-
var
|
|
1723
|
+
var Fe = /* @__PURE__ */ new Map();
|
|
1727
1724
|
function Ar(t) {
|
|
1728
|
-
var e =
|
|
1729
|
-
return
|
|
1725
|
+
var e = Fe.get(t) || 1;
|
|
1726
|
+
return Fe.set(t, e + 1), "".concat(t, ":").concat(e, ":").concat(Math.random().toString(36).slice(2));
|
|
1730
1727
|
}
|
|
1731
|
-
function
|
|
1728
|
+
function jr(t, e) {
|
|
1732
1729
|
var r = Ar("stringifyForDisplay");
|
|
1733
1730
|
return JSON.stringify(t, function(o, n) {
|
|
1734
1731
|
return n === void 0 ? r : n;
|
|
@@ -1760,19 +1757,19 @@ function We(t) {
|
|
|
1760
1757
|
e[r - 1] = arguments[r];
|
|
1761
1758
|
return new Ye(le(t, e) || ce(t, e));
|
|
1762
1759
|
}
|
|
1763
|
-
var
|
|
1760
|
+
var Ie = Symbol.for("ApolloErrorMessageHandler_" + Je);
|
|
1764
1761
|
function Ge(t) {
|
|
1765
1762
|
if (typeof t == "string")
|
|
1766
1763
|
return t;
|
|
1767
1764
|
try {
|
|
1768
|
-
return
|
|
1765
|
+
return jr(t, 2).slice(0, 1e3);
|
|
1769
1766
|
} catch {
|
|
1770
1767
|
return "<non-serializable>";
|
|
1771
1768
|
}
|
|
1772
1769
|
}
|
|
1773
1770
|
function le(t, e) {
|
|
1774
1771
|
if (e === void 0 && (e = []), !!t)
|
|
1775
|
-
return ae[
|
|
1772
|
+
return ae[Ie] && ae[Ie](t, e.map(Ge));
|
|
1776
1773
|
}
|
|
1777
1774
|
function ce(t, e) {
|
|
1778
1775
|
if (e === void 0 && (e = []), !!t)
|
|
@@ -1782,7 +1779,7 @@ function ce(t, e) {
|
|
|
1782
1779
|
args: e.map(Ge)
|
|
1783
1780
|
})));
|
|
1784
1781
|
}
|
|
1785
|
-
function
|
|
1782
|
+
function Dr(t) {
|
|
1786
1783
|
return t.definitions.filter(function(e) {
|
|
1787
1784
|
return e.kind === "OperationDefinition" && !!e.name;
|
|
1788
1785
|
}).map(function(e) {
|
|
@@ -1888,7 +1885,7 @@ Array[te] || (function(t) {
|
|
|
1888
1885
|
} finally {
|
|
1889
1886
|
return t;
|
|
1890
1887
|
}
|
|
1891
|
-
})(Br()), { bind:
|
|
1888
|
+
})(Br()), { bind: Co, noContext: _o } = de;
|
|
1892
1889
|
new de();
|
|
1893
1890
|
function qr(t, e) {
|
|
1894
1891
|
var r = typeof Symbol < "u" && t[Symbol.iterator] || t["@@iterator"];
|
|
@@ -1930,11 +1927,11 @@ var pe = function() {
|
|
|
1930
1927
|
return typeof Symbol == "function";
|
|
1931
1928
|
}, fe = function(t) {
|
|
1932
1929
|
return pe() && !!Symbol[t];
|
|
1933
|
-
},
|
|
1930
|
+
}, he = function(t) {
|
|
1934
1931
|
return fe(t) ? Symbol[t] : "@@" + t;
|
|
1935
1932
|
};
|
|
1936
1933
|
pe() && !fe("observable") && (Symbol.observable = Symbol("observable"));
|
|
1937
|
-
var Hr =
|
|
1934
|
+
var Hr = he("iterator"), ie = he("observable"), Xe = he("species");
|
|
1938
1935
|
function Jt(t, e) {
|
|
1939
1936
|
var r = t[e];
|
|
1940
1937
|
if (r != null) {
|
|
@@ -2095,8 +2092,8 @@ var Yr = /* @__PURE__ */ (function() {
|
|
|
2095
2092
|
next: function(b) {
|
|
2096
2093
|
try {
|
|
2097
2094
|
o(b, l);
|
|
2098
|
-
} catch (
|
|
2099
|
-
s(
|
|
2095
|
+
} catch (m) {
|
|
2096
|
+
s(m), i.unsubscribe();
|
|
2100
2097
|
}
|
|
2101
2098
|
},
|
|
2102
2099
|
error: s,
|
|
@@ -2151,25 +2148,25 @@ var Yr = /* @__PURE__ */ (function() {
|
|
|
2151
2148
|
var n = this;
|
|
2152
2149
|
if (typeof o != "function") throw new TypeError(o + " is not a function");
|
|
2153
2150
|
var d = Nt(this), s = arguments.length > 1, l = !1, i = arguments[1], b = i;
|
|
2154
|
-
return new d(function(
|
|
2151
|
+
return new d(function(m) {
|
|
2155
2152
|
return n.subscribe({
|
|
2156
2153
|
next: function(S) {
|
|
2157
|
-
var
|
|
2158
|
-
if (l = !0, !
|
|
2154
|
+
var _ = !l;
|
|
2155
|
+
if (l = !0, !_ || s)
|
|
2159
2156
|
try {
|
|
2160
2157
|
b = o(b, S);
|
|
2161
|
-
} catch (
|
|
2162
|
-
return
|
|
2158
|
+
} catch (F) {
|
|
2159
|
+
return m.error(F);
|
|
2163
2160
|
}
|
|
2164
2161
|
else
|
|
2165
2162
|
b = S;
|
|
2166
2163
|
},
|
|
2167
2164
|
error: function(S) {
|
|
2168
|
-
|
|
2165
|
+
m.error(S);
|
|
2169
2166
|
},
|
|
2170
2167
|
complete: function() {
|
|
2171
|
-
if (!l && !s) return
|
|
2172
|
-
|
|
2168
|
+
if (!l && !s) return m.error(new TypeError("Cannot reduce an empty sequence"));
|
|
2169
|
+
m.next(b), m.complete();
|
|
2173
2170
|
}
|
|
2174
2171
|
});
|
|
2175
2172
|
});
|
|
@@ -2178,17 +2175,17 @@ var Yr = /* @__PURE__ */ (function() {
|
|
|
2178
2175
|
d[s] = arguments[s];
|
|
2179
2176
|
var l = Nt(this);
|
|
2180
2177
|
return new l(function(i) {
|
|
2181
|
-
var b,
|
|
2182
|
-
function S(
|
|
2183
|
-
b =
|
|
2184
|
-
next: function(
|
|
2185
|
-
i.next(
|
|
2178
|
+
var b, m = 0;
|
|
2179
|
+
function S(_) {
|
|
2180
|
+
b = _.subscribe({
|
|
2181
|
+
next: function(F) {
|
|
2182
|
+
i.next(F);
|
|
2186
2183
|
},
|
|
2187
|
-
error: function(
|
|
2188
|
-
i.error(
|
|
2184
|
+
error: function(F) {
|
|
2185
|
+
i.error(F);
|
|
2189
2186
|
},
|
|
2190
2187
|
complete: function() {
|
|
2191
|
-
|
|
2188
|
+
m === d.length ? (b = void 0, i.complete()) : S(l.from(d[m++]));
|
|
2192
2189
|
}
|
|
2193
2190
|
});
|
|
2194
2191
|
}
|
|
@@ -2202,29 +2199,29 @@ var Yr = /* @__PURE__ */ (function() {
|
|
|
2202
2199
|
var d = Nt(this);
|
|
2203
2200
|
return new d(function(s) {
|
|
2204
2201
|
var l = [], i = n.subscribe({
|
|
2205
|
-
next: function(
|
|
2202
|
+
next: function(m) {
|
|
2206
2203
|
if (o)
|
|
2207
2204
|
try {
|
|
2208
|
-
|
|
2209
|
-
} catch (
|
|
2210
|
-
return s.error(
|
|
2205
|
+
m = o(m);
|
|
2206
|
+
} catch (_) {
|
|
2207
|
+
return s.error(_);
|
|
2211
2208
|
}
|
|
2212
|
-
var S = d.from(
|
|
2213
|
-
next: function(
|
|
2214
|
-
s.next(
|
|
2209
|
+
var S = d.from(m).subscribe({
|
|
2210
|
+
next: function(_) {
|
|
2211
|
+
s.next(_);
|
|
2215
2212
|
},
|
|
2216
|
-
error: function(
|
|
2217
|
-
s.error(
|
|
2213
|
+
error: function(_) {
|
|
2214
|
+
s.error(_);
|
|
2218
2215
|
},
|
|
2219
2216
|
complete: function() {
|
|
2220
|
-
var
|
|
2221
|
-
|
|
2217
|
+
var _ = l.indexOf(S);
|
|
2218
|
+
_ >= 0 && l.splice(_, 1), b();
|
|
2222
2219
|
}
|
|
2223
2220
|
});
|
|
2224
2221
|
l.push(S);
|
|
2225
2222
|
},
|
|
2226
|
-
error: function(
|
|
2227
|
-
s.error(
|
|
2223
|
+
error: function(m) {
|
|
2224
|
+
s.error(m);
|
|
2228
2225
|
},
|
|
2229
2226
|
complete: function() {
|
|
2230
2227
|
b();
|
|
@@ -2234,8 +2231,8 @@ var Yr = /* @__PURE__ */ (function() {
|
|
|
2234
2231
|
i.closed && l.length === 0 && s.complete();
|
|
2235
2232
|
}
|
|
2236
2233
|
return function() {
|
|
2237
|
-
l.forEach(function(
|
|
2238
|
-
return
|
|
2234
|
+
l.forEach(function(m) {
|
|
2235
|
+
return m.unsubscribe();
|
|
2239
2236
|
}), i.unsubscribe();
|
|
2240
2237
|
};
|
|
2241
2238
|
});
|
|
@@ -2257,8 +2254,8 @@ var Yr = /* @__PURE__ */ (function() {
|
|
|
2257
2254
|
Mt(function() {
|
|
2258
2255
|
if (!l.closed) {
|
|
2259
2256
|
for (var i = qr(d.call(o)), b; !(b = i()).done; ) {
|
|
2260
|
-
var
|
|
2261
|
-
if (l.next(
|
|
2257
|
+
var m = b.value;
|
|
2258
|
+
if (l.next(m), l.closed) return;
|
|
2262
2259
|
}
|
|
2263
2260
|
l.complete();
|
|
2264
2261
|
}
|
|
@@ -2360,7 +2357,7 @@ function Xr(t) {
|
|
|
2360
2357
|
operationName: t.operationName,
|
|
2361
2358
|
query: t.query
|
|
2362
2359
|
};
|
|
2363
|
-
return e.operationName || (e.operationName = typeof e.query != "string" ?
|
|
2360
|
+
return e.operationName || (e.operationName = typeof e.query != "string" ? Dr(e.query) || void 0 : ""), e;
|
|
2364
2361
|
}
|
|
2365
2362
|
var Qr = Symbol.for("apollo.deprecations"), Zr = ae, to = new de();
|
|
2366
2363
|
function eo(t) {
|
|
@@ -2487,12 +2484,12 @@ const no = async () => {
|
|
|
2487
2484
|
fetchPolicy: "cache-and-network"
|
|
2488
2485
|
}
|
|
2489
2486
|
}
|
|
2490
|
-
}),
|
|
2487
|
+
}), Fo = (t) => {
|
|
2491
2488
|
const { tanyaConfig: e } = t;
|
|
2492
2489
|
return /* @__PURE__ */ a(dr, { client: lo, children: /* @__PURE__ */ a(xr, { children: /* @__PURE__ */ a(Tr, { tanyaConfig: e }) }) });
|
|
2493
2490
|
};
|
|
2494
2491
|
export {
|
|
2495
|
-
|
|
2492
|
+
Fo as TanyaChatbot,
|
|
2496
2493
|
vo as TanyaChatbotProvider
|
|
2497
2494
|
};
|
|
2498
2495
|
//# sourceMappingURL=tanya-chatbot.es.js.map
|