tanya-chatbot 0.3.3 → 0.3.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,5 +1,5 @@
|
|
|
1
|
-
import { useEffect as bt, useState as P, useRef as
|
|
2
|
-
import { jsx as a, jsxs as u, Fragment as
|
|
1
|
+
import { useEffect as bt, useState as P, useRef as It } from "react";
|
|
2
|
+
import { jsx as a, jsxs as u, Fragment as re } from "react/jsx-runtime";
|
|
3
3
|
import { createHttpLink as ir, ApolloClient as sr, InMemoryCache as lr, ApolloProvider as cr } from "@apollo/client";
|
|
4
4
|
import { Provider as dr, useDispatch as Ae, useSelector as Mt } from "react-redux";
|
|
5
5
|
import { createSlice as De, configureStore as ur } from "@reduxjs/toolkit";
|
|
@@ -73,7 +73,7 @@ const fr = {
|
|
|
73
73
|
t.product = e.payload;
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
|
-
}), { setProduct:
|
|
76
|
+
}), { setProduct: oe } = Ue.actions, wr = Ue.reducer, gr = ur({
|
|
77
77
|
reducer: {
|
|
78
78
|
store: mr,
|
|
79
79
|
product: wr
|
|
@@ -212,7 +212,7 @@ const Z = () => sessionStorage.getItem("Host"), R = () => sessionStorage.getItem
|
|
|
212
212
|
centAmount: (r = t.masterVariant) == null ? void 0 : r.prices[0].value.centAmount,
|
|
213
213
|
currencyCode: (o = t.masterVariant) == null ? void 0 : o.prices[0].value.currencyCode
|
|
214
214
|
};
|
|
215
|
-
}, Sr = (t) => t.charAt(0).toUpperCase() + t.slice(1), ke = (t, e) => t.length < e ? t : t.slice(0, e) + "...",
|
|
215
|
+
}, Sr = (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) => {
|
|
216
216
|
const o = e.match(/^(\d+)\.\s(.+)/);
|
|
217
217
|
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/>";
|
|
218
218
|
}).join("");
|
|
@@ -236,7 +236,7 @@ const _r = ({
|
|
|
236
236
|
);
|
|
237
237
|
}, d = async (i) => {
|
|
238
238
|
const x = await He(i);
|
|
239
|
-
e(
|
|
239
|
+
e(oe(x));
|
|
240
240
|
};
|
|
241
241
|
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
242
|
(t == null ? void 0 : t.length) > r && /* @__PURE__ */ a(
|
|
@@ -329,7 +329,7 @@ const _r = ({
|
|
|
329
329
|
}
|
|
330
330
|
)
|
|
331
331
|
] }) });
|
|
332
|
-
},
|
|
332
|
+
}, 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(
|
|
333
333
|
"div",
|
|
334
334
|
{
|
|
335
335
|
className: "mb-4 p-3 rounded-xl",
|
|
@@ -413,18 +413,18 @@ const _r = ({
|
|
|
413
413
|
} catch (s) {
|
|
414
414
|
return E.isAxiosError(s) ? { status: (l = s.response) == null ? void 0 : l.status, data: null } : { status: null, data: null };
|
|
415
415
|
}
|
|
416
|
-
},
|
|
416
|
+
}, Rt = "sfcc_basket_id", Se = "sfcc_customer_token", Tt = "sfcc_token_expiry", Fr = 300 * 1e3, Ft = "1.0.0";
|
|
417
417
|
const xt = (t) => {
|
|
418
418
|
try {
|
|
419
|
-
t ? localStorage.setItem(
|
|
419
|
+
t ? localStorage.setItem(Rt, t) : localStorage.removeItem(Rt);
|
|
420
420
|
} catch (e) {
|
|
421
421
|
console.error("Error saving basket ID to storage:", e);
|
|
422
422
|
}
|
|
423
|
-
},
|
|
423
|
+
}, Yt = (t) => {
|
|
424
424
|
try {
|
|
425
425
|
if (t) {
|
|
426
426
|
localStorage.setItem(Se, t);
|
|
427
|
-
const e = Date.now() +
|
|
427
|
+
const e = Date.now() + Fr;
|
|
428
428
|
localStorage.setItem(Tt, e.toString());
|
|
429
429
|
} else
|
|
430
430
|
localStorage.removeItem(Se);
|
|
@@ -457,8 +457,8 @@ const xt = (t) => {
|
|
|
457
457
|
console.log(p, "the product data");
|
|
458
458
|
const _t = JSON.parse(
|
|
459
459
|
sessionStorage.getItem("customerData") || "{}"
|
|
460
|
-
), nt = _t == null ? void 0 : _t.basketId,
|
|
461
|
-
if (!
|
|
460
|
+
), nt = (_t == null ? void 0 : _t.basketId) || localStorage.getItem(Rt), Kt = !1, jt = localStorage.getItem(Tt), Y = Date.now();
|
|
461
|
+
if (!Kt || !jt || Y >= parseInt(jt)) {
|
|
462
462
|
let $ = "";
|
|
463
463
|
{
|
|
464
464
|
const K = await Ot();
|
|
@@ -469,7 +469,7 @@ const xt = (t) => {
|
|
|
469
469
|
return;
|
|
470
470
|
}
|
|
471
471
|
const At = Y + 300 * 1e3;
|
|
472
|
-
if (
|
|
472
|
+
if (Yt($), localStorage.setItem(Tt, At.toString()), nt) {
|
|
473
473
|
const K = await Re({
|
|
474
474
|
basketId: nt,
|
|
475
475
|
customer_token: $
|
|
@@ -491,7 +491,7 @@ const xt = (t) => {
|
|
|
491
491
|
return;
|
|
492
492
|
}
|
|
493
493
|
}
|
|
494
|
-
const
|
|
494
|
+
const Gt = {
|
|
495
495
|
productItems: [
|
|
496
496
|
{
|
|
497
497
|
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),
|
|
@@ -500,7 +500,7 @@ const xt = (t) => {
|
|
|
500
500
|
]
|
|
501
501
|
};
|
|
502
502
|
console.log("before create basket");
|
|
503
|
-
const h = await Ve($,
|
|
503
|
+
const h = await Ve($, Gt);
|
|
504
504
|
if (console.log(
|
|
505
505
|
h,
|
|
506
506
|
h == null ? void 0 : h.basket_id,
|
|
@@ -535,7 +535,7 @@ const xt = (t) => {
|
|
|
535
535
|
position: "bottom-right",
|
|
536
536
|
autoClose: 3e3
|
|
537
537
|
}), ((zt = p == null ? void 0 : p.response) == null ? void 0 : zt.status) === 404 || // Basket not found
|
|
538
|
-
((Ct = p == null ? void 0 : p.response) == null ? void 0 : Ct.status) === 401 ? (((O = p == null ? void 0 : p.response) == null ? void 0 : O.status) === 404 && xt(null), ((dt = p == null ? void 0 : p.response) == null ? void 0 : dt.status) === 401 && (xt(null),
|
|
538
|
+
((Ct = p == null ? void 0 : p.response) == null ? void 0 : Ct.status) === 401 ? (((O = p == null ? void 0 : p.response) == null ? void 0 : O.status) === 404 && xt(null), ((dt = p == null ? void 0 : p.response) == null ? void 0 : dt.status) === 401 && (xt(null), Yt(null))) : (console.error("Failed to add product to basket:", p.message), U.error("Failed to add product to cart", {
|
|
539
539
|
position: "bottom-right",
|
|
540
540
|
autoClose: 3e3
|
|
541
541
|
}));
|
|
@@ -543,13 +543,13 @@ const xt = (t) => {
|
|
|
543
543
|
}, s = () => {
|
|
544
544
|
e && (window.location.href = e.c_pdpUrl);
|
|
545
545
|
};
|
|
546
|
-
return console.log(e, "the prod"), /* @__PURE__ */ u(
|
|
546
|
+
return console.log(e, "the prod"), /* @__PURE__ */ u(re, { children: [
|
|
547
547
|
/* @__PURE__ */ a(
|
|
548
548
|
"div",
|
|
549
549
|
{
|
|
550
550
|
className: "fixed inset-0 z-40 bg-black/30",
|
|
551
551
|
onClick: () => {
|
|
552
|
-
n(!1), setTimeout(() => t(
|
|
552
|
+
n(!1), setTimeout(() => t(oe(null)), Ce);
|
|
553
553
|
}
|
|
554
554
|
}
|
|
555
555
|
),
|
|
@@ -573,7 +573,7 @@ const xt = (t) => {
|
|
|
573
573
|
className: "text-[#555555] w-6 h-6 cursor-pointer",
|
|
574
574
|
onClick: () => {
|
|
575
575
|
n(!1), setTimeout(
|
|
576
|
-
() => t(
|
|
576
|
+
() => t(oe(null)),
|
|
577
577
|
Ce
|
|
578
578
|
);
|
|
579
579
|
}
|
|
@@ -624,7 +624,9 @@ const xt = (t) => {
|
|
|
624
624
|
"div",
|
|
625
625
|
{
|
|
626
626
|
className: "text-[#68656E] font-normal font-nunitoSans text-xs pl-2 mt-3",
|
|
627
|
-
dangerouslySetInnerHTML: {
|
|
627
|
+
dangerouslySetInnerHTML: {
|
|
628
|
+
__html: e.short_description || e.longDescription
|
|
629
|
+
}
|
|
628
630
|
}
|
|
629
631
|
)
|
|
630
632
|
] }),
|
|
@@ -706,18 +708,18 @@ const xt = (t) => {
|
|
|
706
708
|
"Niece/Nephew": "his/her niece/nephew",
|
|
707
709
|
"My Friends": "his/her friends",
|
|
708
710
|
Others: "others"
|
|
709
|
-
}, o =
|
|
711
|
+
}, 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) => ({
|
|
710
712
|
id: c.id,
|
|
711
713
|
title: c.name,
|
|
712
714
|
image: c.image ?? "",
|
|
713
715
|
price: c.price ?? 0
|
|
714
|
-
}), [Ct, O] = P([]), dt =
|
|
716
|
+
}), [Ct, O] = P([]), dt = It(null), p = Mt((c) => c.store.store), _t = Mt((c) => c.product.product), nt = () => {
|
|
715
717
|
j(!0), setTimeout(() => S(!0), 10);
|
|
716
|
-
},
|
|
718
|
+
}, Kt = () => {
|
|
717
719
|
S(!1), setTimeout(() => j(!1), 300);
|
|
718
720
|
};
|
|
719
721
|
bt(() => {
|
|
720
|
-
x ? nt() :
|
|
722
|
+
x ? nt() : Kt();
|
|
721
723
|
}, [x]);
|
|
722
724
|
const jt = (c) => {
|
|
723
725
|
$t(r[c]);
|
|
@@ -753,7 +755,7 @@ const xt = (t) => {
|
|
|
753
755
|
} catch (c) {
|
|
754
756
|
return console.error("Error obtaining JWT token:", c), Y = null, $ = null, null;
|
|
755
757
|
}
|
|
756
|
-
},
|
|
758
|
+
}, Gt = async () => {
|
|
757
759
|
const c = await Ot();
|
|
758
760
|
c != null && i(c);
|
|
759
761
|
};
|
|
@@ -762,7 +764,7 @@ const xt = (t) => {
|
|
|
762
764
|
const { clientID: c, host: k, organizationID: w, shortCode: y, siteId: f } = t;
|
|
763
765
|
sessionStorage.setItem("Host", k), sessionStorage.setItem("SiteId", f), sessionStorage.setItem("pubCfg", btoa(c)), sessionStorage.setItem("envRef", y), sessionStorage.setItem("orgRef", w);
|
|
764
766
|
}
|
|
765
|
-
|
|
767
|
+
Gt(), console.log("scapi environment v1");
|
|
766
768
|
}, []);
|
|
767
769
|
const h = async () => {
|
|
768
770
|
const c = JSON.parse(
|
|
@@ -770,9 +772,9 @@ const xt = (t) => {
|
|
|
770
772
|
).customerId;
|
|
771
773
|
return (await vr(c || "")).c_interests;
|
|
772
774
|
}, J = async (c, k) => {
|
|
773
|
-
console.log("in secondary flow",
|
|
775
|
+
console.log("in secondary flow", Ft);
|
|
774
776
|
const w = await h();
|
|
775
|
-
if (console.log(w, "interests of customer",
|
|
777
|
+
if (console.log(w, "interests of customer", Ft), !!w)
|
|
776
778
|
try {
|
|
777
779
|
O(
|
|
778
780
|
(L) => L.map(
|
|
@@ -818,8 +820,8 @@ const xt = (t) => {
|
|
|
818
820
|
try {
|
|
819
821
|
const B = JSON.parse(m);
|
|
820
822
|
B.index === 0 && O(
|
|
821
|
-
(
|
|
822
|
-
(T, X) => X ===
|
|
823
|
+
(I) => I.map(
|
|
824
|
+
(T, X) => X === I.length - 1 ? {
|
|
823
825
|
...T,
|
|
824
826
|
secondaryResponse: B.data,
|
|
825
827
|
secondaryLoading: !1
|
|
@@ -828,8 +830,8 @@ const xt = (t) => {
|
|
|
828
830
|
);
|
|
829
831
|
} catch (B) {
|
|
830
832
|
O(
|
|
831
|
-
(
|
|
832
|
-
(T, X) => X ===
|
|
833
|
+
(I) => I.map(
|
|
834
|
+
(T, X) => X === I.length - 1 ? { ...T, secondaryLoading: !1 } : T
|
|
833
835
|
)
|
|
834
836
|
), console.error("Secondary flow JSON parse error:", B);
|
|
835
837
|
}
|
|
@@ -891,17 +893,17 @@ const xt = (t) => {
|
|
|
891
893
|
if (m.startsWith("data:")) {
|
|
892
894
|
const B = m.slice(5).trim();
|
|
893
895
|
try {
|
|
894
|
-
const
|
|
895
|
-
|
|
896
|
+
const I = JSON.parse(B);
|
|
897
|
+
I.index == 1 && (L = I.data), O(
|
|
896
898
|
(T) => T.map(
|
|
897
899
|
(X, Dt) => Dt === T.length - 1 ? {
|
|
898
900
|
...X,
|
|
899
|
-
[
|
|
901
|
+
[I.index == 0 ? "response" : I.index == 1 ? "keywords" : I.index == 2 ? "potentialQuestions" : "end"]: I.data
|
|
900
902
|
} : X
|
|
901
903
|
)
|
|
902
904
|
);
|
|
903
|
-
} catch (
|
|
904
|
-
console.error("Error parsing JSON:",
|
|
905
|
+
} catch (I) {
|
|
906
|
+
console.error("Error parsing JSON:", I);
|
|
905
907
|
}
|
|
906
908
|
}
|
|
907
909
|
}
|
|
@@ -974,7 +976,7 @@ const xt = (t) => {
|
|
|
974
976
|
const k = JSON.parse(
|
|
975
977
|
sessionStorage.getItem("customerData") || "{}"
|
|
976
978
|
);
|
|
977
|
-
(k == null ? void 0 : k.isGuest) == !1 ? (console.log("running secondary flow",
|
|
979
|
+
(k == null ? void 0 : k.isGuest) == !1 ? (console.log("running secondary flow", Ft), J(o.current, 0)) : console.log("not running secondary flow", Ft);
|
|
978
980
|
}
|
|
979
981
|
ot(!1);
|
|
980
982
|
}, rr = async (c, k) => {
|
|
@@ -995,10 +997,10 @@ const xt = (t) => {
|
|
|
995
997
|
quantity: k
|
|
996
998
|
}
|
|
997
999
|
];
|
|
998
|
-
console.log(B, "product data", "app version",
|
|
999
|
-
const
|
|
1000
|
+
console.log(B, "product data", "app version", Ft);
|
|
1001
|
+
const I = JSON.parse(
|
|
1000
1002
|
sessionStorage.getItem("customerData") || "{}"
|
|
1001
|
-
), T = (
|
|
1003
|
+
), T = (I == null ? void 0 : I.basketId) || localStorage.getItem(Rt), X = !1, Dt = localStorage.getItem(Tt), he = Date.now();
|
|
1002
1004
|
if (!X || !Dt || he >= parseInt(Dt)) {
|
|
1003
1005
|
const or = await qe();
|
|
1004
1006
|
let { customer_token: at } = await Me(
|
|
@@ -1009,18 +1011,18 @@ const xt = (t) => {
|
|
|
1009
1011
|
return;
|
|
1010
1012
|
}
|
|
1011
1013
|
const nr = he + 300 * 1e3;
|
|
1012
|
-
if (
|
|
1014
|
+
if (Yt(at), localStorage.setItem(Tt, nr.toString()), console.log(T, "basketIdFromCustomer"), T) {
|
|
1013
1015
|
const we = await Re({
|
|
1014
1016
|
basketId: T,
|
|
1015
1017
|
customer_token: at
|
|
1016
1018
|
});
|
|
1017
1019
|
if (we.status === 200 && we) {
|
|
1018
|
-
const
|
|
1020
|
+
const Wt = await Vt(
|
|
1019
1021
|
T,
|
|
1020
1022
|
B,
|
|
1021
1023
|
at
|
|
1022
1024
|
);
|
|
1023
|
-
((pt =
|
|
1025
|
+
((pt = Wt == null ? void 0 : Wt.product_items) == null ? void 0 : pt.length) > 0 && (U.success("Added to cart", {
|
|
1024
1026
|
position: "bottom-right",
|
|
1025
1027
|
autoClose: 3e3,
|
|
1026
1028
|
hideProgressBar: !1,
|
|
@@ -1070,7 +1072,7 @@ const xt = (t) => {
|
|
|
1070
1072
|
position: "bottom-right",
|
|
1071
1073
|
autoClose: 3e3
|
|
1072
1074
|
}), ((L = m == null ? void 0 : m.response) == null ? void 0 : L.status) === 404 || // Basket not found
|
|
1073
|
-
((H = m == null ? void 0 : m.response) == null ? void 0 : H.status) === 401 ? (((V = m == null ? void 0 : m.response) == null ? void 0 : V.status) === 404 && xt(null), ((W = m == null ? void 0 : m.response) == null ? void 0 : W.status) === 401 && (xt(null),
|
|
1075
|
+
((H = m == null ? void 0 : m.response) == null ? void 0 : H.status) === 401 ? (((V = m == null ? void 0 : m.response) == null ? void 0 : V.status) === 404 && xt(null), ((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", {
|
|
1074
1076
|
position: "bottom-right",
|
|
1075
1077
|
autoClose: 3e3
|
|
1076
1078
|
}));
|
|
@@ -1141,7 +1143,7 @@ const xt = (t) => {
|
|
|
1141
1143
|
) })
|
|
1142
1144
|
}
|
|
1143
1145
|
),
|
|
1144
|
-
_ && /* @__PURE__ */ u(
|
|
1146
|
+
_ && /* @__PURE__ */ u(re, { children: [
|
|
1145
1147
|
/* @__PURE__ */ a(
|
|
1146
1148
|
"div",
|
|
1147
1149
|
{
|
|
@@ -1328,7 +1330,7 @@ const xt = (t) => {
|
|
|
1328
1330
|
{
|
|
1329
1331
|
className: "font-nunitoSans animate-pulse font-bold text-sm text-[#494949] bg-[#FFFFFF] px-7 py-1 rounded-r-xl rounded-bl-2xl w-full",
|
|
1330
1332
|
dangerouslySetInnerHTML: {
|
|
1331
|
-
__html:
|
|
1333
|
+
__html: Xt(c.response)
|
|
1332
1334
|
}
|
|
1333
1335
|
}
|
|
1334
1336
|
) }) : /* @__PURE__ */ a("div", { children: /* @__PURE__ */ a(
|
|
@@ -1336,13 +1338,13 @@ const xt = (t) => {
|
|
|
1336
1338
|
{
|
|
1337
1339
|
className: "font-nunitoSans font-bold text-sm text-[#494949] bg-[#FFFFFF] px-7 py-1 rounded-r-xl rounded-bl-2xl w-full",
|
|
1338
1340
|
dangerouslySetInnerHTML: {
|
|
1339
|
-
__html:
|
|
1341
|
+
__html: Xt(c.response)
|
|
1340
1342
|
}
|
|
1341
1343
|
}
|
|
1342
1344
|
) }),
|
|
1343
1345
|
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" }) }),
|
|
1344
1346
|
(c == null ? void 0 : c.products) && ((y = c == null ? void 0 : c.products) == null ? void 0 : y.length) > 0 && /* @__PURE__ */ a(
|
|
1345
|
-
|
|
1347
|
+
Ir,
|
|
1346
1348
|
{
|
|
1347
1349
|
chat: c.products,
|
|
1348
1350
|
storeDetails: p
|
|
@@ -1403,7 +1405,7 @@ const xt = (t) => {
|
|
|
1403
1405
|
]
|
|
1404
1406
|
}
|
|
1405
1407
|
) }),
|
|
1406
|
-
c.secondaryResponse && /* @__PURE__ */ a(
|
|
1408
|
+
c.secondaryResponse && /* @__PURE__ */ a(re, { children: /* @__PURE__ */ u("div", { className: "mt-3 mb-8 px-4 bg-indigo-300 rounded-tr-[5px]", children: [
|
|
1407
1409
|
/* @__PURE__ */ a(
|
|
1408
1410
|
"div",
|
|
1409
1411
|
{
|
|
@@ -1412,7 +1414,7 @@ const xt = (t) => {
|
|
|
1412
1414
|
backgroundColor: p.tanyaThemeColorLight
|
|
1413
1415
|
},
|
|
1414
1416
|
dangerouslySetInnerHTML: {
|
|
1415
|
-
__html:
|
|
1417
|
+
__html: Xt(
|
|
1416
1418
|
c.secondaryResponse
|
|
1417
1419
|
)
|
|
1418
1420
|
}
|
|
@@ -1652,16 +1654,16 @@ function Or(t, e) {
|
|
|
1652
1654
|
e.indexOf(o[n]) < 0 && Object.prototype.propertyIsEnumerable.call(t, o[n]) && (r[o[n]] = t[o[n]]);
|
|
1653
1655
|
return r;
|
|
1654
1656
|
}
|
|
1655
|
-
var
|
|
1657
|
+
var Qt = "Invariant Violation", _e = Object.setPrototypeOf, Pr = _e === void 0 ? function(t, e) {
|
|
1656
1658
|
return t.__proto__ = e, t;
|
|
1657
1659
|
} : _e, Ye = (
|
|
1658
1660
|
/** @class */
|
|
1659
1661
|
(function(t) {
|
|
1660
1662
|
Tr(e, t);
|
|
1661
1663
|
function e(r) {
|
|
1662
|
-
r === void 0 && (r =
|
|
1663
|
-
var o = t.call(this, typeof r == "number" ?
|
|
1664
|
-
return o.framesToPop = 1, o.name =
|
|
1664
|
+
r === void 0 && (r = Qt);
|
|
1665
|
+
var o = t.call(this, typeof r == "number" ? Qt + ": " + r + " (see https://github.com/apollographql/invariant-packages)" : r) || this;
|
|
1666
|
+
return o.framesToPop = 1, o.name = Qt, Pr(o, e.prototype), o;
|
|
1665
1667
|
}
|
|
1666
1668
|
return e;
|
|
1667
1669
|
})(Error)
|
|
@@ -1706,10 +1708,10 @@ const ae = wt(function() {
|
|
|
1706
1708
|
wt(function() {
|
|
1707
1709
|
return wt.constructor("return this")();
|
|
1708
1710
|
});
|
|
1709
|
-
var
|
|
1711
|
+
var Ie = /* @__PURE__ */ new Map();
|
|
1710
1712
|
function zr(t) {
|
|
1711
|
-
var e =
|
|
1712
|
-
return
|
|
1713
|
+
var e = Ie.get(t) || 1;
|
|
1714
|
+
return Ie.set(t, e + 1), "".concat(t, ":").concat(e, ":").concat(Math.random().toString(36).slice(2));
|
|
1713
1715
|
}
|
|
1714
1716
|
function jr(t, e) {
|
|
1715
1717
|
var r = zr("stringifyForDisplay");
|
|
@@ -1728,7 +1730,7 @@ function Bt(t) {
|
|
|
1728
1730
|
t.apply(void 0, [e].concat(r));
|
|
1729
1731
|
};
|
|
1730
1732
|
}
|
|
1731
|
-
var
|
|
1733
|
+
var Zt = Object.assign(function(e, r) {
|
|
1732
1734
|
for (var o = [], n = 2; n < arguments.length; n++)
|
|
1733
1735
|
o[n - 2] = arguments[n];
|
|
1734
1736
|
e || it(e, le(r, o) || ce(r, o));
|
|
@@ -1743,7 +1745,7 @@ function Ge(t) {
|
|
|
1743
1745
|
e[r - 1] = arguments[r];
|
|
1744
1746
|
return new Ye(le(t, e) || ce(t, e));
|
|
1745
1747
|
}
|
|
1746
|
-
var
|
|
1748
|
+
var Fe = Symbol.for("ApolloErrorMessageHandler_" + Ke);
|
|
1747
1749
|
function We(t) {
|
|
1748
1750
|
if (typeof t == "string")
|
|
1749
1751
|
return t;
|
|
@@ -1755,7 +1757,7 @@ function We(t) {
|
|
|
1755
1757
|
}
|
|
1756
1758
|
function le(t, e) {
|
|
1757
1759
|
if (e === void 0 && (e = []), !!t)
|
|
1758
|
-
return ae[
|
|
1760
|
+
return ae[Fe] && ae[Fe](t, e.map(We));
|
|
1759
1761
|
}
|
|
1760
1762
|
function ce(t, e) {
|
|
1761
1763
|
if (e === void 0 && (e = []), !!t)
|
|
@@ -1772,7 +1774,7 @@ function Ar(t) {
|
|
|
1772
1774
|
return e.name.value;
|
|
1773
1775
|
})[0] || null;
|
|
1774
1776
|
}
|
|
1775
|
-
let
|
|
1777
|
+
let F = null;
|
|
1776
1778
|
const Ne = {};
|
|
1777
1779
|
let Dr = 1;
|
|
1778
1780
|
const Lr = () => class {
|
|
@@ -1785,52 +1787,52 @@ const Lr = () => class {
|
|
|
1785
1787
|
].join(":");
|
|
1786
1788
|
}
|
|
1787
1789
|
hasValue() {
|
|
1788
|
-
for (let e =
|
|
1790
|
+
for (let e = F; e; e = e.parent)
|
|
1789
1791
|
if (this.id in e.slots) {
|
|
1790
1792
|
const r = e.slots[this.id];
|
|
1791
1793
|
if (r === Ne)
|
|
1792
1794
|
break;
|
|
1793
|
-
return e !==
|
|
1795
|
+
return e !== F && (F.slots[this.id] = r), !0;
|
|
1794
1796
|
}
|
|
1795
|
-
return
|
|
1797
|
+
return F && (F.slots[this.id] = Ne), !1;
|
|
1796
1798
|
}
|
|
1797
1799
|
getValue() {
|
|
1798
1800
|
if (this.hasValue())
|
|
1799
|
-
return
|
|
1801
|
+
return F.slots[this.id];
|
|
1800
1802
|
}
|
|
1801
1803
|
withValue(e, r, o, n) {
|
|
1802
1804
|
const l = {
|
|
1803
1805
|
__proto__: null,
|
|
1804
1806
|
[this.id]: e
|
|
1805
|
-
}, s =
|
|
1806
|
-
|
|
1807
|
+
}, s = F;
|
|
1808
|
+
F = { parent: s, slots: l };
|
|
1807
1809
|
try {
|
|
1808
1810
|
return r.apply(n, o);
|
|
1809
1811
|
} finally {
|
|
1810
|
-
|
|
1812
|
+
F = s;
|
|
1811
1813
|
}
|
|
1812
1814
|
}
|
|
1813
1815
|
// Capture the current context and wrap a callback function so that it
|
|
1814
1816
|
// reestablishes the captured context when called.
|
|
1815
1817
|
static bind(e) {
|
|
1816
|
-
const r =
|
|
1818
|
+
const r = F;
|
|
1817
1819
|
return function() {
|
|
1818
|
-
const o =
|
|
1820
|
+
const o = F;
|
|
1819
1821
|
try {
|
|
1820
|
-
return
|
|
1822
|
+
return F = r, e.apply(this, arguments);
|
|
1821
1823
|
} finally {
|
|
1822
|
-
|
|
1824
|
+
F = o;
|
|
1823
1825
|
}
|
|
1824
1826
|
};
|
|
1825
1827
|
}
|
|
1826
1828
|
// Immediately run a callback function without any captured context.
|
|
1827
1829
|
static noContext(e, r, o) {
|
|
1828
|
-
if (
|
|
1829
|
-
const n =
|
|
1830
|
+
if (F) {
|
|
1831
|
+
const n = F;
|
|
1830
1832
|
try {
|
|
1831
|
-
return
|
|
1833
|
+
return F = null, e.apply(o, r);
|
|
1832
1834
|
} finally {
|
|
1833
|
-
|
|
1835
|
+
F = n;
|
|
1834
1836
|
}
|
|
1835
1837
|
} else
|
|
1836
1838
|
return e.apply(o, r);
|
|
@@ -1842,7 +1844,7 @@ function Ee(t) {
|
|
|
1842
1844
|
} catch {
|
|
1843
1845
|
}
|
|
1844
1846
|
}
|
|
1845
|
-
const
|
|
1847
|
+
const te = "@wry/context:Slot", Br = (
|
|
1846
1848
|
// Prefer globalThis when available.
|
|
1847
1849
|
// https://github.com/benjamn/wryware/issues/347
|
|
1848
1850
|
Ee(() => globalThis) || // Fall back to global, which works in Node.js and may be converted by some
|
|
@@ -1852,11 +1854,11 @@ const Zt = "@wry/context:Slot", Br = (
|
|
|
1852
1854
|
// back to using the Array constructor as a namespace, but that was flagged in
|
|
1853
1855
|
// https://github.com/benjamn/wryware/issues/347, and can be avoided.
|
|
1854
1856
|
/* @__PURE__ */ Object.create(null)
|
|
1855
|
-
), Te = Br, de = Te[
|
|
1857
|
+
), Te = Br, de = Te[te] || // Earlier versions of this package stored the globalKey property on the Array
|
|
1856
1858
|
// constructor, so we check there as well, to prevent Slot class duplication.
|
|
1857
|
-
Array[
|
|
1859
|
+
Array[te] || (function(t) {
|
|
1858
1860
|
try {
|
|
1859
|
-
Object.defineProperty(Te,
|
|
1861
|
+
Object.defineProperty(Te, te, {
|
|
1860
1862
|
value: t,
|
|
1861
1863
|
enumerable: !1,
|
|
1862
1864
|
writable: !1,
|
|
@@ -1918,7 +1920,7 @@ var pe = function() {
|
|
|
1918
1920
|
};
|
|
1919
1921
|
pe() && !fe("observable") && (Symbol.observable = Symbol("observable"));
|
|
1920
1922
|
var Mr = me("iterator"), ie = me("observable"), Xe = me("species");
|
|
1921
|
-
function
|
|
1923
|
+
function Jt(t, e) {
|
|
1922
1924
|
var r = t[e];
|
|
1923
1925
|
if (r != null) {
|
|
1924
1926
|
if (typeof r != "function") throw new TypeError(r + " is not a function");
|
|
@@ -1953,7 +1955,7 @@ function Qe(t) {
|
|
|
1953
1955
|
if (typeof e == "function")
|
|
1954
1956
|
e();
|
|
1955
1957
|
else {
|
|
1956
|
-
var r =
|
|
1958
|
+
var r = Jt(e, "unsubscribe");
|
|
1957
1959
|
r && r.call(e);
|
|
1958
1960
|
}
|
|
1959
1961
|
} catch (o) {
|
|
@@ -1975,7 +1977,7 @@ function Ze(t, e, r) {
|
|
|
1975
1977
|
t._state = "running";
|
|
1976
1978
|
var o = t._observer;
|
|
1977
1979
|
try {
|
|
1978
|
-
var n =
|
|
1980
|
+
var n = Jt(o, e);
|
|
1979
1981
|
switch (e) {
|
|
1980
1982
|
case "next":
|
|
1981
1983
|
n && n.call(o, r);
|
|
@@ -1993,7 +1995,7 @@ function Ze(t, e, r) {
|
|
|
1993
1995
|
}
|
|
1994
1996
|
t._state === "closed" ? Qe(t) : t._state === "running" && (t._state = "ready");
|
|
1995
1997
|
}
|
|
1996
|
-
function
|
|
1998
|
+
function ee(t, e, r) {
|
|
1997
1999
|
if (t._state !== "closed") {
|
|
1998
2000
|
if (t._state === "buffering") {
|
|
1999
2001
|
t._queue.push({
|
|
@@ -2040,11 +2042,11 @@ var Rr = /* @__PURE__ */ (function() {
|
|
|
2040
2042
|
}
|
|
2041
2043
|
var e = t.prototype;
|
|
2042
2044
|
return e.next = function(o) {
|
|
2043
|
-
|
|
2045
|
+
ee(this._subscription, "next", o);
|
|
2044
2046
|
}, e.error = function(o) {
|
|
2045
|
-
|
|
2047
|
+
ee(this._subscription, "error", o);
|
|
2046
2048
|
}, e.complete = function() {
|
|
2047
|
-
|
|
2049
|
+
ee(this._subscription, "complete");
|
|
2048
2050
|
}, ue(t, [{
|
|
2049
2051
|
key: "closed",
|
|
2050
2052
|
get: function() {
|
|
@@ -2227,7 +2229,7 @@ var Rr = /* @__PURE__ */ (function() {
|
|
|
2227
2229
|
}, t.from = function(o) {
|
|
2228
2230
|
var n = typeof this == "function" ? this : t;
|
|
2229
2231
|
if (o == null) throw new TypeError(o + " is not an object");
|
|
2230
|
-
var l =
|
|
2232
|
+
var l = Jt(o, ie);
|
|
2231
2233
|
if (l) {
|
|
2232
2234
|
var s = l.call(o);
|
|
2233
2235
|
if (Object(s) !== s) throw new TypeError(s + " is not an object");
|
|
@@ -2235,7 +2237,7 @@ var Rr = /* @__PURE__ */ (function() {
|
|
|
2235
2237
|
return s.subscribe(d);
|
|
2236
2238
|
});
|
|
2237
2239
|
}
|
|
2238
|
-
if (fe("iterator") && (l =
|
|
2240
|
+
if (fe("iterator") && (l = Jt(o, Mr), l))
|
|
2239
2241
|
return new n(function(d) {
|
|
2240
2242
|
qt(function() {
|
|
2241
2243
|
if (!d.closed) {
|
|
@@ -2387,7 +2389,7 @@ var tr = (
|
|
|
2387
2389
|
}, t.concat = function(e, r) {
|
|
2388
2390
|
var o = Et(e);
|
|
2389
2391
|
if (Ut(o))
|
|
2390
|
-
return globalThis.__DEV__ !== !1 &&
|
|
2392
|
+
return globalThis.__DEV__ !== !1 && Zt.warn(47, o), o;
|
|
2391
2393
|
var n = Et(r), l;
|
|
2392
2394
|
return Ut(n) ? l = new t(function(s) {
|
|
2393
2395
|
return o.request(s, function(d) {
|
|
@@ -2406,12 +2408,12 @@ var tr = (
|
|
|
2406
2408
|
throw Ge(48);
|
|
2407
2409
|
}, t.prototype.onError = function(e, r) {
|
|
2408
2410
|
if (globalThis.__DEV__ !== !1 && eo("onError", function() {
|
|
2409
|
-
globalThis.__DEV__ !== !1 &&
|
|
2411
|
+
globalThis.__DEV__ !== !1 && Zt.warn(49);
|
|
2410
2412
|
}), r && r.error)
|
|
2411
2413
|
return r.error(e), !1;
|
|
2412
2414
|
throw e;
|
|
2413
2415
|
}, t.prototype.setOnError = function(e) {
|
|
2414
|
-
return globalThis.__DEV__ !== !1 && globalThis.__DEV__ !== !1 &&
|
|
2416
|
+
return globalThis.__DEV__ !== !1 && globalThis.__DEV__ !== !1 && Zt.warn(50), this.onError = e, this;
|
|
2415
2417
|
}, t;
|
|
2416
2418
|
})()
|
|
2417
2419
|
);
|