tanya-chatbot 0.6.3 → 0.6.5
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
|
@@ -421,14 +421,14 @@ const it = (t) => {
|
|
|
421
421
|
}
|
|
422
422
|
}, Se = 300, Tr = ({ addToCartPwa: t }) => {
|
|
423
423
|
var s, m, h, I, v, V;
|
|
424
|
-
const e = Ae(), r = Rt((
|
|
424
|
+
const e = Ae(), r = Rt((F) => F.product.product), o = Rt((F) => F.store.store), [n, c] = L(!!r);
|
|
425
425
|
if (H(() => {
|
|
426
426
|
c(!!r);
|
|
427
427
|
}, [r]), !r) return null;
|
|
428
428
|
const l = async () => {
|
|
429
|
-
var
|
|
429
|
+
var F, z, X, dt, Y, ut, _t, Ot, pt, Ct, It, ft, $t, zt, nt, B;
|
|
430
430
|
try {
|
|
431
|
-
if (!((z = (
|
|
431
|
+
if (!((z = (F = r == null ? void 0 : r.variants) == null ? void 0 : F[0]) != null && z.product_id) && !(r.type.item || r.type.bundle) && !((dt = (X = r == null ? void 0 : r.variants) == null ? void 0 : X[0]) != null && dt.productId)) {
|
|
432
432
|
R.error("Variants not available", {
|
|
433
433
|
position: "bottom-right",
|
|
434
434
|
autoClose: 1e3
|
|
@@ -512,7 +512,9 @@ const it = (t) => {
|
|
|
512
512
|
}));
|
|
513
513
|
}
|
|
514
514
|
}, d = () => {
|
|
515
|
-
|
|
515
|
+
if (!r) return;
|
|
516
|
+
const F = window.location.origin + "/product/" + r.id;
|
|
517
|
+
console.log("path", F), window.location.href = F;
|
|
516
518
|
};
|
|
517
519
|
return console.log(r, "the prod"), /* @__PURE__ */ u(re, { children: [
|
|
518
520
|
/* @__PURE__ */ a(
|
|
@@ -533,7 +535,7 @@ const it = (t) => {
|
|
|
533
535
|
${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
536
|
`,
|
|
535
537
|
style: { willChange: "transform, opacity" },
|
|
536
|
-
onClick: (
|
|
538
|
+
onClick: (F) => F.stopPropagation(),
|
|
537
539
|
children: [
|
|
538
540
|
/* @__PURE__ */ u("div", { className: "mt-3 flex flex-row justify-between w-full ", children: [
|
|
539
541
|
/* @__PURE__ */ a("div", { children: /* @__PURE__ */ a("p", { className: "text-[#000000] font-bold font-nunitoSans", children: r.name }) }),
|
|
@@ -561,7 +563,7 @@ const it = (t) => {
|
|
|
561
563
|
}
|
|
562
564
|
) }),
|
|
563
565
|
/* @__PURE__ */ a("div", { className: "flex flex-col items-center gap-2", children: r.imageGroups.slice(1, 2).map(
|
|
564
|
-
(
|
|
566
|
+
(F) => F.images.slice(1, 2).map((z) => /* @__PURE__ */ a(
|
|
565
567
|
"img",
|
|
566
568
|
{
|
|
567
569
|
src: z.link,
|
|
@@ -615,7 +617,7 @@ const it = (t) => {
|
|
|
615
617
|
" ratings"
|
|
616
618
|
] })
|
|
617
619
|
] }) }),
|
|
618
|
-
/* @__PURE__ */ a("div", { className: "mt-2 flex flex-row items-center gap-2", children: Array.from({ length: 5 }).map((
|
|
620
|
+
/* @__PURE__ */ a("div", { className: "mt-2 flex flex-row items-center gap-2", children: Array.from({ length: 5 }).map((F, z) => {
|
|
619
621
|
var X;
|
|
620
622
|
return /* @__PURE__ */ a(
|
|
621
623
|
pr,
|
|
@@ -635,7 +637,7 @@ const it = (t) => {
|
|
|
635
637
|
"div",
|
|
636
638
|
{
|
|
637
639
|
className: "flex flex-col items-center justify-between font-nunitoSans font-semibold w-5/6 text-black gap-2",
|
|
638
|
-
style: { marginTop: "
|
|
640
|
+
style: { marginTop: "70px" },
|
|
639
641
|
children: [
|
|
640
642
|
/* @__PURE__ */ a(
|
|
641
643
|
"button",
|
|
@@ -683,7 +685,7 @@ const it = (t) => {
|
|
|
683
685
|
Others: "others"
|
|
684
686
|
}, c = xt(null), l = xt(null), d = xt(null), s = xt(null), [m, h] = L(null);
|
|
685
687
|
xt(null);
|
|
686
|
-
const [I, v] = L(!1), [V,
|
|
688
|
+
const [I, v] = L(!1), [V, F] = L(!1), [z, X] = L(!1), [dt, Y] = L(!1), [ut, _t] = L(!1), [Ot, pt] = L(!1), [Ct, It] = L(""), [ft, $t] = L(""), zt = (i) => ({
|
|
687
689
|
id: i.id,
|
|
688
690
|
title: i.name,
|
|
689
691
|
image: i.image ?? "",
|
|
@@ -711,9 +713,9 @@ const it = (t) => {
|
|
|
711
713
|
i && localStorage.setItem(`chat-token-${t.siteId}`, i);
|
|
712
714
|
}, [nt]);
|
|
713
715
|
const Wt = () => {
|
|
714
|
-
X(!0), setTimeout(() =>
|
|
716
|
+
X(!0), setTimeout(() => F(!0), 10);
|
|
715
717
|
}, At = () => {
|
|
716
|
-
|
|
718
|
+
F(!1), setTimeout(() => X(!1), 300);
|
|
717
719
|
};
|
|
718
720
|
H(() => {
|
|
719
721
|
I ? Wt() : At();
|
|
@@ -822,8 +824,8 @@ const it = (t) => {
|
|
|
822
824
|
try {
|
|
823
825
|
const W = JSON.parse(p);
|
|
824
826
|
W.index === 0 && B(
|
|
825
|
-
(
|
|
826
|
-
(A, et) => et ===
|
|
827
|
+
(N) => N.map(
|
|
828
|
+
(A, et) => et === N.length - 1 ? {
|
|
827
829
|
...A,
|
|
828
830
|
secondaryResponse: W.data,
|
|
829
831
|
secondaryLoading: !1
|
|
@@ -832,8 +834,8 @@ const it = (t) => {
|
|
|
832
834
|
);
|
|
833
835
|
} catch (W) {
|
|
834
836
|
B(
|
|
835
|
-
(
|
|
836
|
-
(A, et) => et ===
|
|
837
|
+
(N) => N.map(
|
|
838
|
+
(A, et) => et === N.length - 1 ? { ...A, secondaryLoading: !1 } : A
|
|
837
839
|
)
|
|
838
840
|
), console.error("Secondary flow JSON parse error:", W);
|
|
839
841
|
}
|
|
@@ -895,17 +897,17 @@ const it = (t) => {
|
|
|
895
897
|
if (p.startsWith("data:")) {
|
|
896
898
|
const W = p.slice(5).trim();
|
|
897
899
|
try {
|
|
898
|
-
const
|
|
899
|
-
|
|
900
|
+
const N = JSON.parse(W);
|
|
901
|
+
N.index == 1 && (M = N.data), B(
|
|
900
902
|
(A) => A.map(
|
|
901
903
|
(et, Lt) => Lt === A.length - 1 ? {
|
|
902
904
|
...et,
|
|
903
|
-
[
|
|
905
|
+
[N.index == 0 ? "response" : N.index == 1 ? "keywords" : N.index == 2 ? "potentialQuestions" : "end"]: N.data
|
|
904
906
|
} : et
|
|
905
907
|
)
|
|
906
908
|
);
|
|
907
|
-
} catch (
|
|
908
|
-
console.error("Error parsing JSON:",
|
|
909
|
+
} catch (N) {
|
|
910
|
+
console.error("Error parsing JSON:", N);
|
|
909
911
|
}
|
|
910
912
|
}
|
|
911
913
|
}
|
|
@@ -984,9 +986,9 @@ const it = (t) => {
|
|
|
984
986
|
}
|
|
985
987
|
];
|
|
986
988
|
console.log(W, "product data", "app version", Bt);
|
|
987
|
-
const
|
|
989
|
+
const N = JSON.parse(
|
|
988
990
|
sessionStorage.getItem("customerData") || "{}"
|
|
989
|
-
), A = (
|
|
991
|
+
), A = (N == null ? void 0 : N.basketId) || localStorage.getItem(Yt), et = !1, Lt = localStorage.getItem(Tt), we = Date.now();
|
|
990
992
|
if (!et || !Lt || we >= parseInt(Lt)) {
|
|
991
993
|
const or = await Ue();
|
|
992
994
|
let { customer_token: gt } = await qe(
|
|
@@ -1068,7 +1070,7 @@ const it = (t) => {
|
|
|
1068
1070
|
Y(!1);
|
|
1069
1071
|
};
|
|
1070
1072
|
return H(() => {
|
|
1071
|
-
z ? setTimeout(() =>
|
|
1073
|
+
z ? setTimeout(() => F(!0), 10) : F(!1);
|
|
1072
1074
|
}, [z]), /* @__PURE__ */ a("div", { className: "relative flex justify-center", children: /* @__PURE__ */ u(yr, { open: I, onOpenChange: v, children: [
|
|
1073
1075
|
/* @__PURE__ */ a(
|
|
1074
1076
|
vr,
|
|
@@ -1766,7 +1768,7 @@ function Lr(t) {
|
|
|
1766
1768
|
return e.name.value;
|
|
1767
1769
|
})[0] || null;
|
|
1768
1770
|
}
|
|
1769
|
-
let
|
|
1771
|
+
let E = null;
|
|
1770
1772
|
const Fe = {};
|
|
1771
1773
|
let Br = 1;
|
|
1772
1774
|
const Ur = () => class {
|
|
@@ -1779,52 +1781,52 @@ const Ur = () => class {
|
|
|
1779
1781
|
].join(":");
|
|
1780
1782
|
}
|
|
1781
1783
|
hasValue() {
|
|
1782
|
-
for (let e =
|
|
1784
|
+
for (let e = E; e; e = e.parent)
|
|
1783
1785
|
if (this.id in e.slots) {
|
|
1784
1786
|
const r = e.slots[this.id];
|
|
1785
1787
|
if (r === Fe)
|
|
1786
1788
|
break;
|
|
1787
|
-
return e !==
|
|
1789
|
+
return e !== E && (E.slots[this.id] = r), !0;
|
|
1788
1790
|
}
|
|
1789
|
-
return
|
|
1791
|
+
return E && (E.slots[this.id] = Fe), !1;
|
|
1790
1792
|
}
|
|
1791
1793
|
getValue() {
|
|
1792
1794
|
if (this.hasValue())
|
|
1793
|
-
return
|
|
1795
|
+
return E.slots[this.id];
|
|
1794
1796
|
}
|
|
1795
1797
|
withValue(e, r, o, n) {
|
|
1796
1798
|
const c = {
|
|
1797
1799
|
__proto__: null,
|
|
1798
1800
|
[this.id]: e
|
|
1799
|
-
}, l =
|
|
1800
|
-
|
|
1801
|
+
}, l = E;
|
|
1802
|
+
E = { parent: l, slots: c };
|
|
1801
1803
|
try {
|
|
1802
1804
|
return r.apply(n, o);
|
|
1803
1805
|
} finally {
|
|
1804
|
-
|
|
1806
|
+
E = l;
|
|
1805
1807
|
}
|
|
1806
1808
|
}
|
|
1807
1809
|
// Capture the current context and wrap a callback function so that it
|
|
1808
1810
|
// reestablishes the captured context when called.
|
|
1809
1811
|
static bind(e) {
|
|
1810
|
-
const r =
|
|
1812
|
+
const r = E;
|
|
1811
1813
|
return function() {
|
|
1812
|
-
const o =
|
|
1814
|
+
const o = E;
|
|
1813
1815
|
try {
|
|
1814
|
-
return
|
|
1816
|
+
return E = r, e.apply(this, arguments);
|
|
1815
1817
|
} finally {
|
|
1816
|
-
|
|
1818
|
+
E = o;
|
|
1817
1819
|
}
|
|
1818
1820
|
};
|
|
1819
1821
|
}
|
|
1820
1822
|
// Immediately run a callback function without any captured context.
|
|
1821
1823
|
static noContext(e, r, o) {
|
|
1822
|
-
if (
|
|
1823
|
-
const n =
|
|
1824
|
+
if (E) {
|
|
1825
|
+
const n = E;
|
|
1824
1826
|
try {
|
|
1825
|
-
return
|
|
1827
|
+
return E = null, e.apply(o, r);
|
|
1826
1828
|
} finally {
|
|
1827
|
-
|
|
1829
|
+
E = n;
|
|
1828
1830
|
}
|
|
1829
1831
|
} else
|
|
1830
1832
|
return e.apply(o, r);
|