tanya-chatbot 0.5.8 → 0.5.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.
package/dist/tanya-chatbot.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useEffect as j, useState as
|
|
1
|
+
import { useEffect as j, useState as $, useRef as xt } from "react";
|
|
2
2
|
import { jsx as a, jsxs as u, Fragment as oe } from "react/jsx-runtime";
|
|
3
3
|
import { createHttpLink as cr, ApolloClient as dr, InMemoryCache as ur, ApolloProvider as pr } from "@apollo/client";
|
|
4
4
|
import { Provider as fr, useDispatch as Le, useSelector as Rt } from "react-redux";
|
|
@@ -197,7 +197,7 @@ const tt = () => sessionStorage.getItem("Host"), K = () => sessionStorage.getIte
|
|
|
197
197
|
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/>";
|
|
198
198
|
}).join("");
|
|
199
199
|
function Fr() {
|
|
200
|
-
const t = () => window.innerWidth < 425 ? 1 : window.innerWidth < 768 ? 2 : 4, [e, r] =
|
|
200
|
+
const t = () => window.innerWidth < 425 ? 1 : window.innerWidth < 768 ? 2 : 4, [e, r] = $(t);
|
|
201
201
|
return j(() => {
|
|
202
202
|
const o = () => r(t());
|
|
203
203
|
return window.addEventListener("resize", o), () => window.removeEventListener("resize", o);
|
|
@@ -206,7 +206,7 @@ function Fr() {
|
|
|
206
206
|
const Nr = ({
|
|
207
207
|
product: t
|
|
208
208
|
}) => {
|
|
209
|
-
const e = Le(), r = Fr(), [o, n] =
|
|
209
|
+
const e = Le(), r = Fr(), [o, n] = $(0), c = () => {
|
|
210
210
|
n(
|
|
211
211
|
(s) => s + r >= t.length ? 0 : s + r
|
|
212
212
|
);
|
|
@@ -421,14 +421,14 @@ const at = (t) => {
|
|
|
421
421
|
}
|
|
422
422
|
}, Ie = 300, Pr = ({ addToCartPwa: t }) => {
|
|
423
423
|
var s, y, v, C, _, P;
|
|
424
|
-
const e = Le(), r = Rt((
|
|
424
|
+
const e = Le(), r = Rt((z) => z.product.product), o = Rt((z) => z.store.store), [n, c] = $(!!r);
|
|
425
425
|
if (j(() => {
|
|
426
426
|
c(!!r);
|
|
427
427
|
}, [r]), !r) return null;
|
|
428
428
|
const l = async () => {
|
|
429
|
-
var O,
|
|
429
|
+
var z, O, q, _t, ct, M, dt, Ct, zt, et, It, Ft, ut, At, jt, J;
|
|
430
430
|
try {
|
|
431
|
-
if (!((
|
|
431
|
+
if (!((O = (z = r == null ? void 0 : r.variants) == null ? void 0 : z[0]) != null && O.product_id) && !(r.type.item || r.type.bundle) && !((_t = (q = r == null ? void 0 : r.variants) == null ? void 0 : q[0]) != null && _t.productId)) {
|
|
432
432
|
U.error("Variants not available", {
|
|
433
433
|
position: "bottom-right",
|
|
434
434
|
autoClose: 1e3
|
|
@@ -533,7 +533,7 @@ const at = (t) => {
|
|
|
533
533
|
${n ? "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"}
|
|
534
534
|
`,
|
|
535
535
|
style: { willChange: "transform, opacity" },
|
|
536
|
-
onClick: (
|
|
536
|
+
onClick: (z) => z.stopPropagation(),
|
|
537
537
|
children: [
|
|
538
538
|
/* @__PURE__ */ u("div", { className: "mt-3 flex flex-row justify-between w-full ", children: [
|
|
539
539
|
/* @__PURE__ */ a("div", { children: /* @__PURE__ */ a("p", { className: "text-[#000000] font-bold font-nunitoSans", children: r.name }) }),
|
|
@@ -561,14 +561,14 @@ const at = (t) => {
|
|
|
561
561
|
}
|
|
562
562
|
) }),
|
|
563
563
|
/* @__PURE__ */ a("div", { className: "flex flex-col items-center gap-2", children: r.imageGroups.slice(1, 2).map(
|
|
564
|
-
(
|
|
564
|
+
(z) => z.images.slice(1, 2).map((O) => /* @__PURE__ */ a(
|
|
565
565
|
"img",
|
|
566
566
|
{
|
|
567
|
-
src:
|
|
567
|
+
src: O.link,
|
|
568
568
|
alt: r.name,
|
|
569
569
|
className: "rounded-[10px] w-[60px] h-[60px]"
|
|
570
570
|
},
|
|
571
|
-
|
|
571
|
+
O.link
|
|
572
572
|
))
|
|
573
573
|
) })
|
|
574
574
|
] }),
|
|
@@ -615,7 +615,7 @@ const at = (t) => {
|
|
|
615
615
|
" ratings"
|
|
616
616
|
] })
|
|
617
617
|
] }) }),
|
|
618
|
-
/* @__PURE__ */ a("div", { className: "mt-2 flex flex-row items-center gap-2", children: Array.from({ length: 5 }).map((
|
|
618
|
+
/* @__PURE__ */ a("div", { className: "mt-2 flex flex-row items-center gap-2", children: Array.from({ length: 5 }).map((z, O) => {
|
|
619
619
|
var q;
|
|
620
620
|
return /* @__PURE__ */ a(
|
|
621
621
|
xe,
|
|
@@ -624,10 +624,10 @@ const at = (t) => {
|
|
|
624
624
|
width: "20",
|
|
625
625
|
height: "20",
|
|
626
626
|
className: `text-yellow-500
|
|
627
|
-
${((q = r == null ? void 0 : r.rating) == null ? void 0 : q.rate) >
|
|
627
|
+
${((q = r == null ? void 0 : r.rating) == null ? void 0 : q.rate) > O ? "text-yellow-500" : "text-gray-300"}
|
|
628
628
|
`
|
|
629
629
|
},
|
|
630
|
-
|
|
630
|
+
O
|
|
631
631
|
);
|
|
632
632
|
}) })
|
|
633
633
|
] }),
|
|
@@ -681,12 +681,12 @@ const at = (t) => {
|
|
|
681
681
|
"Niece/Nephew": "his/her niece/nephew",
|
|
682
682
|
"My Friends": "his/her friends",
|
|
683
683
|
Others: "others"
|
|
684
|
-
}, c = xt(null), l = xt(null), d = xt(null), s = xt(null), [y, v] =
|
|
684
|
+
}, c = xt(null), l = xt(null), d = xt(null), s = xt(null), [y, v] = $(null), C = xt(null), [_, P] = $(!1), [z, O] = $(!1), [q, _t] = $(!1), [ct, M] = $(!1), [dt, Ct] = $(!1), [zt, et] = $(!1), [It, Ft] = $(""), [ut, At] = $(""), jt = (i) => ({
|
|
685
685
|
id: i.id,
|
|
686
686
|
title: i.name,
|
|
687
687
|
image: i.image ?? "",
|
|
688
688
|
price: i.price ?? 0
|
|
689
|
-
}), [J, b] =
|
|
689
|
+
}), [J, b] = $([]), rt = xt(null), k = Rt((i) => i.store.store), Wt = Rt((i) => i.product.product);
|
|
690
690
|
j(() => {
|
|
691
691
|
const i = localStorage.getItem(
|
|
692
692
|
`access_token_${t.siteId}`
|
|
@@ -709,9 +709,9 @@ const at = (t) => {
|
|
|
709
709
|
i && localStorage.setItem(`chat-token-${t.siteId}`, i);
|
|
710
710
|
}, [J]);
|
|
711
711
|
const Dt = () => {
|
|
712
|
-
_t(!0), setTimeout(() =>
|
|
712
|
+
_t(!0), setTimeout(() => O(!0), 10);
|
|
713
713
|
}, Lt = () => {
|
|
714
|
-
|
|
714
|
+
O(!1), setTimeout(() => _t(!1), 300);
|
|
715
715
|
};
|
|
716
716
|
j(() => {
|
|
717
717
|
_ ? Dt() : Lt();
|
|
@@ -1081,7 +1081,7 @@ const at = (t) => {
|
|
|
1081
1081
|
return j(() => {
|
|
1082
1082
|
C.current && C.current.scrollIntoView({ behavior: "smooth" });
|
|
1083
1083
|
}, [C.current]), j(() => {
|
|
1084
|
-
q ? setTimeout(() =>
|
|
1084
|
+
q ? setTimeout(() => O(!0), 10) : O(!1);
|
|
1085
1085
|
}, [q]), /* @__PURE__ */ a("div", { className: "relative flex justify-center", children: /* @__PURE__ */ u(kr, { open: _, onOpenChange: P, children: [
|
|
1086
1086
|
/* @__PURE__ */ a(
|
|
1087
1087
|
Sr,
|
|
@@ -1161,15 +1161,13 @@ const at = (t) => {
|
|
|
1161
1161
|
fixed z-50 h-screen w-[100vw] sm:w-[80vw] md:w-[770px] border-0 bg-white lg:rounded-l-xl overflow-hidden flex flex-col shadow-[0px_4px_10px_0px_#5F499840]
|
|
1162
1162
|
top-0 right-0
|
|
1163
1163
|
transition-transform duration-300 ease-in-out
|
|
1164
|
-
lg:transform
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
`,
|
|
1164
|
+
lg:transform lg:translate-y-0
|
|
1165
|
+
|
|
1166
|
+
`,
|
|
1168
1167
|
style: {
|
|
1169
1168
|
background: "linear-gradient(170.1deg, #FFFFFF 60.03%, #E3DEEF 99.59%)"
|
|
1170
1169
|
},
|
|
1171
1170
|
children: [
|
|
1172
|
-
"header",
|
|
1173
1171
|
/* @__PURE__ */ u(
|
|
1174
1172
|
"div",
|
|
1175
1173
|
{
|