tanya-chatbot 0.4.9 → 0.5.0
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
|
@@ -78,7 +78,7 @@ const mr = {
|
|
|
78
78
|
store: wr,
|
|
79
79
|
product: br
|
|
80
80
|
}
|
|
81
|
-
}), yr = ({ children: t }) => /* @__PURE__ */ a(pr, { store: xr, children: t }),
|
|
81
|
+
}), yr = ({ children: t }) => /* @__PURE__ */ a(pr, { store: xr, children: t }), Vt = (t) => {
|
|
82
82
|
const e = new CustomEvent("reactCartUpdated", {
|
|
83
83
|
detail: {
|
|
84
84
|
cartUpdated: !0,
|
|
@@ -101,7 +101,7 @@ const kt = () => ({ 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 T.post(
|
|
104
|
-
`${t}api/auth/token-bm-grant?baseUrl=${X()}&siteId=${
|
|
104
|
+
`${t}api/auth/token-bm-grant?baseUrl=${X()}&siteId=${R()}`
|
|
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 kt = () => ({ 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 T.post(
|
|
114
|
-
`${e}api/auth/token-existing-guest-customer?dwsid=${r}&baseUrl=${X()}&siteId=${
|
|
114
|
+
`${e}api/auth/token-existing-guest-customer?dwsid=${r}&baseUrl=${X()}&siteId=${R()}&pubCfg=${at()}&envRef=${it()}&orgRef=${st()}`,
|
|
115
115
|
{},
|
|
116
116
|
{
|
|
117
117
|
headers: {
|
|
@@ -127,10 +127,10 @@ const kt = () => ({ aiConversationUrl: "https://mdv3qwfi2j.execute-api.us-east-1
|
|
|
127
127
|
};
|
|
128
128
|
async function Pt() {
|
|
129
129
|
var c;
|
|
130
|
-
const t =
|
|
130
|
+
const t = R(), e = "access_token_" + t, r = "expires_in_" + t, o = localStorage.getItem(r), n = localStorage.getItem(e);
|
|
131
131
|
return console.log(n), (c = JSON.parse(sessionStorage.getItem("customerData") || "{}")) != null && c.isGuest, console.log("access token found in local storage"), { access_token: n, expires_in: o };
|
|
132
132
|
}
|
|
133
|
-
const X = () => sessionStorage.getItem("Host"),
|
|
133
|
+
const X = () => sessionStorage.getItem("Host"), R = () => sessionStorage.getItem("SiteId"), at = () => sessionStorage.getItem("pubCfg"), it = () => sessionStorage.getItem("envRef"), st = () => sessionStorage.getItem("orgRef"), xe = async (t) => {
|
|
134
134
|
console.log("fetching results");
|
|
135
135
|
const { serverUrl: e, basePath: r } = kt();
|
|
136
136
|
let o = "";
|
|
@@ -141,7 +141,7 @@ const X = () => sessionStorage.getItem("Host"), V = () => sessionStorage.getItem
|
|
|
141
141
|
try {
|
|
142
142
|
const n = X();
|
|
143
143
|
return (await T.get(
|
|
144
|
-
`${e}${r}/search-sfcc?baseUrl=${n}&query=${t}&siteId=${
|
|
144
|
+
`${e}${r}/search-sfcc?baseUrl=${n}&query=${t}&siteId=${R()}&pubCfg=${at()}&envRef=${it()}&orgRef=${st()}`,
|
|
145
145
|
{
|
|
146
146
|
headers: {
|
|
147
147
|
"Content-Type": "application/json",
|
|
@@ -152,13 +152,13 @@ const X = () => sessionStorage.getItem("Host"), V = () => sessionStorage.getItem
|
|
|
152
152
|
} catch (n) {
|
|
153
153
|
throw console.error("Error fetching search results:", n), n;
|
|
154
154
|
}
|
|
155
|
-
},
|
|
155
|
+
}, Ve = async (t) => {
|
|
156
156
|
if (!t) throw new Error("Product ID is required");
|
|
157
157
|
const { serverUrl: e, basePath: r } = kt(), o = X();
|
|
158
158
|
console.log("calling access");
|
|
159
159
|
const { access_token: n } = await Pt();
|
|
160
160
|
return console.log(n), (await T.get(
|
|
161
|
-
`${e}${r}/product-sfcc/${t}?baseUrl=${o}&siteId=${
|
|
161
|
+
`${e}${r}/product-sfcc/${t}?baseUrl=${o}&siteId=${R()}&pubCfg=${at()}&envRef=${it()}&orgRef=${st()}`,
|
|
162
162
|
{
|
|
163
163
|
headers: {
|
|
164
164
|
"Content-Type": "application/json",
|
|
@@ -172,7 +172,7 @@ const X = () => sessionStorage.getItem("Host"), V = () => sessionStorage.getItem
|
|
|
172
172
|
e
|
|
173
173
|
), { serverUrl: o, basePath: n } = kt(), l = (await Pt()).access_token;
|
|
174
174
|
return (await T.get(
|
|
175
|
-
`${o}${n}/get-interest?baseUrl=${X()}&customerId=${t}&siteId=${
|
|
175
|
+
`${o}${n}/get-interest?baseUrl=${X()}&customerId=${t}&siteId=${R()}&pubCfg=${at()}&envRef=${it()}&orgRef=${st()}`,
|
|
176
176
|
{
|
|
177
177
|
headers: {
|
|
178
178
|
"Content-Type": "application/json",
|
|
@@ -215,8 +215,8 @@ const Fr = ({
|
|
|
215
215
|
(i) => i - r < 0 ? t.length - (t.length % r || r) : i - r
|
|
216
216
|
);
|
|
217
217
|
}, d = async (i) => {
|
|
218
|
-
const
|
|
219
|
-
e(oe(
|
|
218
|
+
const v = await Ve(i);
|
|
219
|
+
e(oe(v));
|
|
220
220
|
};
|
|
221
221
|
return /* @__PURE__ */ a("div", { className: "mt-2 overflow-x-hidden", children: /* @__PURE__ */ u("div", { className: "flex items-center justify-center gap-4 relative", children: [
|
|
222
222
|
(t == null ? void 0 : t.length) > r && /* @__PURE__ */ a(
|
|
@@ -233,7 +233,7 @@ const Fr = ({
|
|
|
233
233
|
}
|
|
234
234
|
),
|
|
235
235
|
/* @__PURE__ */ a("div", { className: "flex gap-5 justify-center flex-1 overflow-hidden", children: t.slice(o, o + r).map((i) => {
|
|
236
|
-
var
|
|
236
|
+
var v, k, C, _;
|
|
237
237
|
return /* @__PURE__ */ u(
|
|
238
238
|
"div",
|
|
239
239
|
{
|
|
@@ -245,7 +245,7 @@ const Fr = ({
|
|
|
245
245
|
/* @__PURE__ */ a("div", { className: "w-full p-2 flex items-center justify-center bg-white", children: /* @__PURE__ */ a(
|
|
246
246
|
"img",
|
|
247
247
|
{
|
|
248
|
-
src: ((
|
|
248
|
+
src: ((v = ve(i)[0]) == null ? void 0 : v.link) || ve(i)[0] || // fallback if it's a string
|
|
249
249
|
"https://via.placeholder.com/120",
|
|
250
250
|
alt: i != null && i.productName ? i.productName : "Product",
|
|
251
251
|
className: "w-28 h-28 rounded-[10px] transition-transform duration-300 hover:scale-125 object-cover"
|
|
@@ -258,7 +258,7 @@ const Fr = ({
|
|
|
258
258
|
children: [
|
|
259
259
|
/* @__PURE__ */ u("div", { className: "relative inline-block group", children: [
|
|
260
260
|
/* @__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 : Se(
|
|
261
|
-
ye((
|
|
261
|
+
ye((k = i == null ? void 0 : i.name) == null ? void 0 : k["en-US"]),
|
|
262
262
|
60
|
|
263
263
|
) || "Product" }),
|
|
264
264
|
/* @__PURE__ */ a(
|
|
@@ -282,7 +282,7 @@ const Fr = ({
|
|
|
282
282
|
/* @__PURE__ */ u("div", { className: " flex text-center items-center gap-2 text-[14px] text-[#14121F] font-bold font-nunitoSans text-base mb-1", children: [
|
|
283
283
|
/* @__PURE__ */ a("p", { children: _r(
|
|
284
284
|
i != null && i.price ? Number(i == null ? void 0 : i.price) : ke(i).centAmount || 0,
|
|
285
|
-
(
|
|
285
|
+
(_ = ke(i)) == null ? void 0 : _.currencyCode
|
|
286
286
|
) }),
|
|
287
287
|
/* @__PURE__ */ u("p", { className: "text-[#14121F] font-normal line-through text-sm font-nunitoSans truncate", children: [
|
|
288
288
|
"$",
|
|
@@ -337,14 +337,14 @@ const Fr = ({
|
|
|
337
337
|
]
|
|
338
338
|
},
|
|
339
339
|
o
|
|
340
|
-
)) }),
|
|
340
|
+
)) }), Re = async (t, e) => {
|
|
341
341
|
var c, l;
|
|
342
342
|
const { serverUrl: r, basePath: o } = kt(), n = `${r}`;
|
|
343
343
|
console.log(`customer_token
|
|
344
344
|
`, t);
|
|
345
345
|
try {
|
|
346
346
|
const d = await T.post(
|
|
347
|
-
`${n}${o}/basket/create?baseUrl=${X()}&siteId=${
|
|
347
|
+
`${n}${o}/basket/create?baseUrl=${X()}&siteId=${R()}&pubCfg=${at()}&envRef=${it()}&orgRef=${st()}`,
|
|
348
348
|
e,
|
|
349
349
|
{
|
|
350
350
|
headers: {
|
|
@@ -367,7 +367,7 @@ const Fr = ({
|
|
|
367
367
|
const { serverUrl: o, basePath: n } = kt(), c = `${o}`;
|
|
368
368
|
try {
|
|
369
369
|
const l = await T.post(
|
|
370
|
-
`${c}${n}/basket/add-product/${t}?baseUrl=${X()}&siteId=${
|
|
370
|
+
`${c}${n}/basket/add-product/${t}?baseUrl=${X()}&siteId=${R()}&pubCfg=${at()}&envRef=${it()}&orgRef=${st()}`,
|
|
371
371
|
e,
|
|
372
372
|
{
|
|
373
373
|
headers: {
|
|
@@ -391,7 +391,7 @@ const Fr = ({
|
|
|
391
391
|
const { serverUrl: r, basePath: o } = kt(), n = `${r}`;
|
|
392
392
|
try {
|
|
393
393
|
const l = await T.get(
|
|
394
|
-
`${n}${o}/basket/${t}?baseUrl=${X()}&siteId=${
|
|
394
|
+
`${n}${o}/basket/${t}?baseUrl=${X()}&siteId=${R()}&pubCfg=${at()}&envRef=${it()}&orgRef=${st()}`,
|
|
395
395
|
{
|
|
396
396
|
headers: {
|
|
397
397
|
"Content-Type": "application/json",
|
|
@@ -403,10 +403,10 @@ const Fr = ({
|
|
|
403
403
|
} catch (l) {
|
|
404
404
|
return T.isAxiosError(l) ? { status: (c = l.response) == null ? void 0 : c.status, data: null } : { status: null, data: null };
|
|
405
405
|
}
|
|
406
|
-
},
|
|
406
|
+
}, Rt = "sfcc_basket_id", _e = "sfcc_customer_token", Ot = "sfcc_token_expiry", Er = 300 * 1e3, Nt = "1.0.0";
|
|
407
407
|
const nt = (t) => {
|
|
408
408
|
try {
|
|
409
|
-
t ? localStorage.setItem(
|
|
409
|
+
t ? localStorage.setItem(Rt, t) : localStorage.removeItem(Rt);
|
|
410
410
|
} catch (e) {
|
|
411
411
|
console.error("Error saving basket ID to storage:", e);
|
|
412
412
|
}
|
|
@@ -422,7 +422,7 @@ const nt = (t) => {
|
|
|
422
422
|
console.error("Error storing token:", e);
|
|
423
423
|
}
|
|
424
424
|
}, Ce = 300, Tr = () => {
|
|
425
|
-
var d, i,
|
|
425
|
+
var d, i, v, k, C, _;
|
|
426
426
|
const t = De(), e = Ht((I) => I.product.product), r = Ht((I) => I.store.store), [o, n] = P(!!e);
|
|
427
427
|
if (L(() => {
|
|
428
428
|
n(!!e);
|
|
@@ -447,7 +447,7 @@ const nt = (t) => {
|
|
|
447
447
|
console.log(b, "the product data");
|
|
448
448
|
const et = JSON.parse(
|
|
449
449
|
sessionStorage.getItem("customerData") || "{}"
|
|
450
|
-
),
|
|
450
|
+
), S = (et == null ? void 0 : et.basketId) || localStorage.getItem(Rt), Jt = !1, jt = localStorage.getItem(Ot), Dt = Date.now();
|
|
451
451
|
if (!Jt || !jt || Dt >= parseInt(jt)) {
|
|
452
452
|
let q = "";
|
|
453
453
|
{
|
|
@@ -459,14 +459,14 @@ const nt = (t) => {
|
|
|
459
459
|
return;
|
|
460
460
|
}
|
|
461
461
|
const rt = Dt + 300 * 1e3;
|
|
462
|
-
if (Yt(q), localStorage.setItem(Ot, rt.toString()),
|
|
462
|
+
if (Yt(q), localStorage.setItem(Ot, rt.toString()), S) {
|
|
463
463
|
const pt = await Ye({
|
|
464
|
-
basketId:
|
|
464
|
+
basketId: S,
|
|
465
465
|
customer_token: q
|
|
466
466
|
});
|
|
467
|
-
if (console.log(
|
|
467
|
+
if (console.log(S, "basket id from customer"), pt.status === 200 && pt) {
|
|
468
468
|
const K = await ne(
|
|
469
|
-
|
|
469
|
+
S,
|
|
470
470
|
b,
|
|
471
471
|
q
|
|
472
472
|
);
|
|
@@ -477,7 +477,7 @@ const nt = (t) => {
|
|
|
477
477
|
closeOnClick: !0,
|
|
478
478
|
pauseOnHover: !0,
|
|
479
479
|
draggable: !0
|
|
480
|
-
}),
|
|
480
|
+
}), Vt(S));
|
|
481
481
|
return;
|
|
482
482
|
}
|
|
483
483
|
}
|
|
@@ -490,7 +490,7 @@ const nt = (t) => {
|
|
|
490
490
|
]
|
|
491
491
|
};
|
|
492
492
|
console.log("before create basket");
|
|
493
|
-
const p = await
|
|
493
|
+
const p = await Re(q, ut);
|
|
494
494
|
if (console.log(
|
|
495
495
|
p,
|
|
496
496
|
p == null ? void 0 : p.basket_id,
|
|
@@ -518,7 +518,7 @@ const nt = (t) => {
|
|
|
518
518
|
closeOnClick: !0,
|
|
519
519
|
pauseOnHover: !0,
|
|
520
520
|
draggable: !0
|
|
521
|
-
}),
|
|
521
|
+
}), Vt(p.basket_id || (p == null ? void 0 : p.basketId));
|
|
522
522
|
}
|
|
523
523
|
} catch (b) {
|
|
524
524
|
console.error("Error adding to cart:", b), B.error("Failed to add product to cart", {
|
|
@@ -574,7 +574,7 @@ const nt = (t) => {
|
|
|
574
574
|
/* @__PURE__ */ a("div", { className: "flex flex-row items-center justify-center w-[120px] h-[120px] my-5", children: /* @__PURE__ */ a(
|
|
575
575
|
"img",
|
|
576
576
|
{
|
|
577
|
-
src: (
|
|
577
|
+
src: (k = (v = (i = (d = e.imageGroups) == null ? void 0 : d[0]) == null ? void 0 : i.images) == null ? void 0 : v[0]) == null ? void 0 : k.link,
|
|
578
578
|
alt: e.name,
|
|
579
579
|
className: "rounded-[10px]"
|
|
580
580
|
}
|
|
@@ -630,7 +630,7 @@ const nt = (t) => {
|
|
|
630
630
|
] }),
|
|
631
631
|
/* @__PURE__ */ a("div", { className: "text-[#323135] font-semibold text-sm", children: "Overall Rating" }),
|
|
632
632
|
/* @__PURE__ */ u("div", { className: "text-[#68656E] font-semibold text-sm", children: [
|
|
633
|
-
((
|
|
633
|
+
((_ = e == null ? void 0 : e.rating) == null ? void 0 : _.count) || 0,
|
|
634
634
|
" ratings"
|
|
635
635
|
] })
|
|
636
636
|
] }) }),
|
|
@@ -700,12 +700,12 @@ const nt = (t) => {
|
|
|
700
700
|
"Niece/Nephew": "his/her niece/nephew",
|
|
701
701
|
"My Friends": "his/her friends",
|
|
702
702
|
Others: "others"
|
|
703
|
-
}, c = Ft(null), l = Ft(null), d = Ft(null), i = Ft(null), [
|
|
703
|
+
}, c = Ft(null), l = Ft(null), d = Ft(null), i = Ft(null), [v, k] = P(null), [C, _] = P(!1), [I, z] = P(!1), [Q, St] = P(!1), [lt, U] = P(!1), [ct, _t] = P(!1), [$t, Z] = P(!1), [Ct, It] = P(""), [dt, zt] = P(""), At = (s) => ({
|
|
704
704
|
id: s.id,
|
|
705
705
|
title: s.name,
|
|
706
706
|
image: s.image ?? "",
|
|
707
707
|
price: s.price ?? 0
|
|
708
|
-
}), [tt, b] = P([]), et = Ft(null),
|
|
708
|
+
}), [tt, b] = P([]), et = Ft(null), S = Ht((s) => s.store.store), Jt = Ht((s) => s.product.product);
|
|
709
709
|
L(() => {
|
|
710
710
|
const s = localStorage.getItem(
|
|
711
711
|
`access_token_${t.siteId}`
|
|
@@ -771,7 +771,7 @@ const nt = (t) => {
|
|
|
771
771
|
}
|
|
772
772
|
}, Y = async () => {
|
|
773
773
|
const s = await Pt();
|
|
774
|
-
s != null &&
|
|
774
|
+
s != null && k(s);
|
|
775
775
|
};
|
|
776
776
|
L(() => {
|
|
777
777
|
if (t != null && t.siteId) {
|
|
@@ -783,7 +783,7 @@ const nt = (t) => {
|
|
|
783
783
|
e && (console.log("setting the basket id", e), nt(e));
|
|
784
784
|
}, [e]), L(() => {
|
|
785
785
|
const s = async () => {
|
|
786
|
-
|
|
786
|
+
_(!1);
|
|
787
787
|
};
|
|
788
788
|
return window.addEventListener("reactCartUpdated", s), () => window.removeEventListener("reactCartUpdated", s);
|
|
789
789
|
}, []);
|
|
@@ -839,22 +839,22 @@ const nt = (t) => {
|
|
|
839
839
|
if (J.startsWith("data:")) {
|
|
840
840
|
const h = J.slice(5).trim();
|
|
841
841
|
try {
|
|
842
|
-
const
|
|
843
|
-
|
|
842
|
+
const V = JSON.parse(h);
|
|
843
|
+
V.index === 0 && b(
|
|
844
844
|
(F) => F.map(
|
|
845
845
|
(O, W) => W === F.length - 1 ? {
|
|
846
846
|
...O,
|
|
847
|
-
secondaryResponse:
|
|
847
|
+
secondaryResponse: V.data,
|
|
848
848
|
secondaryLoading: !1
|
|
849
849
|
} : O
|
|
850
850
|
)
|
|
851
851
|
);
|
|
852
|
-
} catch (
|
|
852
|
+
} catch (V) {
|
|
853
853
|
b(
|
|
854
854
|
(F) => F.map(
|
|
855
855
|
(O, W) => W === F.length - 1 ? { ...O, secondaryLoading: !1 } : O
|
|
856
856
|
)
|
|
857
|
-
), console.error("Secondary flow JSON parse error:",
|
|
857
|
+
), console.error("Secondary flow JSON parse error:", V);
|
|
858
858
|
}
|
|
859
859
|
}
|
|
860
860
|
}
|
|
@@ -912,9 +912,9 @@ const nt = (t) => {
|
|
|
912
912
|
j = J.pop() || "";
|
|
913
913
|
for (const h of J)
|
|
914
914
|
if (h.startsWith("data:")) {
|
|
915
|
-
const
|
|
915
|
+
const V = h.slice(5).trim();
|
|
916
916
|
try {
|
|
917
|
-
const F = JSON.parse(
|
|
917
|
+
const F = JSON.parse(V);
|
|
918
918
|
F.index == 1 && (D = F.data), b(
|
|
919
919
|
(O) => O.map(
|
|
920
920
|
(W, Lt) => Lt === O.length - 1 ? {
|
|
@@ -1004,7 +1004,7 @@ const nt = (t) => {
|
|
|
1004
1004
|
var m, x, f, w, $, ft, ht, A, mt, wt, j, D, M, H, J;
|
|
1005
1005
|
U(!0);
|
|
1006
1006
|
try {
|
|
1007
|
-
const h = await
|
|
1007
|
+
const h = await Ve(s.id);
|
|
1008
1008
|
if (!((x = (m = h == null ? void 0 : h.variants) == null ? void 0 : m[0]) != null && x.product_id || (w = (f = h == null ? void 0 : h.variants) == null ? void 0 : f[0]) != null && w.productId) && !(h.type.item || h.type.bundle)) {
|
|
1009
1009
|
U(!1), B.error("Variants not found", {
|
|
1010
1010
|
position: "bottom-right",
|
|
@@ -1012,22 +1012,22 @@ const nt = (t) => {
|
|
|
1012
1012
|
}), console.error("No product variant found");
|
|
1013
1013
|
return;
|
|
1014
1014
|
}
|
|
1015
|
-
const
|
|
1015
|
+
const V = [
|
|
1016
1016
|
{
|
|
1017
1017
|
product_id: (($ = h.variants) == null ? void 0 : $[0].product_id) || ((ft = h.variants) == null ? void 0 : ft[0].productId) || (h == null ? void 0 : h.id),
|
|
1018
1018
|
quantity: g
|
|
1019
1019
|
}
|
|
1020
1020
|
];
|
|
1021
|
-
console.log(
|
|
1021
|
+
console.log(V, "product data", "app version", Nt);
|
|
1022
1022
|
const F = JSON.parse(
|
|
1023
1023
|
sessionStorage.getItem("customerData") || "{}"
|
|
1024
|
-
), O = (F == null ? void 0 : F.basketId) || localStorage.getItem(
|
|
1024
|
+
), O = (F == null ? void 0 : F.basketId) || localStorage.getItem(Rt), W = !1, Lt = localStorage.getItem(Ot), we = Date.now();
|
|
1025
1025
|
if (!W || !Lt || we >= parseInt(Lt)) {
|
|
1026
1026
|
const ar = await Me();
|
|
1027
1027
|
let { customer_token: gt } = await He(
|
|
1028
1028
|
ar
|
|
1029
1029
|
);
|
|
1030
|
-
if (gt = "Bearer " +
|
|
1030
|
+
if (gt = "Bearer " + v.access_token, !gt) {
|
|
1031
1031
|
console.error("Failed to get customer_token");
|
|
1032
1032
|
return;
|
|
1033
1033
|
}
|
|
@@ -1040,7 +1040,7 @@ const nt = (t) => {
|
|
|
1040
1040
|
if (ge.status === 200 && ge) {
|
|
1041
1041
|
const Gt = await ne(
|
|
1042
1042
|
O,
|
|
1043
|
-
|
|
1043
|
+
V,
|
|
1044
1044
|
gt
|
|
1045
1045
|
);
|
|
1046
1046
|
((ht = Gt == null ? void 0 : Gt.product_items) == null ? void 0 : ht.length) > 0 && (B.success("Added to cart", {
|
|
@@ -1050,7 +1050,7 @@ const nt = (t) => {
|
|
|
1050
1050
|
closeOnClick: !0,
|
|
1051
1051
|
pauseOnHover: !0,
|
|
1052
1052
|
draggable: !0
|
|
1053
|
-
}),
|
|
1053
|
+
}), Vt(O), U(!1));
|
|
1054
1054
|
return;
|
|
1055
1055
|
}
|
|
1056
1056
|
}
|
|
@@ -1061,23 +1061,26 @@ const nt = (t) => {
|
|
|
1061
1061
|
quantity: 1
|
|
1062
1062
|
}
|
|
1063
1063
|
]
|
|
1064
|
-
},
|
|
1064
|
+
}, y = await Re(gt, sr);
|
|
1065
1065
|
if (console.log(
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1066
|
+
y,
|
|
1067
|
+
y == null ? void 0 : y.basket_id,
|
|
1068
|
+
y == null ? void 0 : y.basketId,
|
|
1069
1069
|
"the basket response"
|
|
1070
|
-
), !(
|
|
1070
|
+
), !(y != null && y.basket_id || !(y != null && y.basketId))) {
|
|
1071
1071
|
U(!1), console.error("Failed to create basket");
|
|
1072
1072
|
return;
|
|
1073
1073
|
}
|
|
1074
1074
|
nt(
|
|
1075
|
-
(
|
|
1075
|
+
(y == null ? void 0 : y.basket_id) || (y == null ? void 0 : y.basketId)
|
|
1076
|
+
);
|
|
1077
|
+
const bt = await r(
|
|
1078
|
+
{
|
|
1079
|
+
productId: l,
|
|
1080
|
+
quantity: g
|
|
1081
|
+
},
|
|
1082
|
+
(y == null ? void 0 : y.basket_id) || (y == null ? void 0 : y.basketId)
|
|
1076
1083
|
);
|
|
1077
|
-
const bt = await r({
|
|
1078
|
-
productId: l,
|
|
1079
|
-
quantity: g
|
|
1080
|
-
});
|
|
1081
1084
|
(((wt = bt == null ? void 0 : bt.product_items) == null ? void 0 : wt.length) > 0 || ((j = bt == null ? void 0 : bt.productItems) == null ? void 0 : j.length) > 0) && B.success("Added to cart", {
|
|
1082
1085
|
position: "bottom-right",
|
|
1083
1086
|
autoClose: 3e3,
|
|
@@ -1085,7 +1088,7 @@ const nt = (t) => {
|
|
|
1085
1088
|
closeOnClick: !0,
|
|
1086
1089
|
pauseOnHover: !0,
|
|
1087
1090
|
draggable: !0
|
|
1088
|
-
}),
|
|
1091
|
+
}), Vt(y.basket_id || (y == null ? void 0 : y.basketId));
|
|
1089
1092
|
}
|
|
1090
1093
|
} catch (h) {
|
|
1091
1094
|
U(!1), console.error("Error adding to cart:", h), B.error("Failed to add product to cart", {
|
|
@@ -1099,11 +1102,11 @@ const nt = (t) => {
|
|
|
1099
1102
|
}
|
|
1100
1103
|
U(!1);
|
|
1101
1104
|
};
|
|
1102
|
-
return /* @__PURE__ */ a("div", { className: "relative flex justify-center", children: /* @__PURE__ */ u(vr, { open: C, onOpenChange:
|
|
1105
|
+
return /* @__PURE__ */ a("div", { className: "relative flex justify-center", children: /* @__PURE__ */ u(vr, { open: C, onOpenChange: _, children: [
|
|
1103
1106
|
/* @__PURE__ */ a(
|
|
1104
1107
|
kr,
|
|
1105
1108
|
{
|
|
1106
|
-
onClick: () =>
|
|
1109
|
+
onClick: () => _(!0),
|
|
1107
1110
|
style: {
|
|
1108
1111
|
// background: storeDetails.tanyaThemeColor,
|
|
1109
1112
|
},
|
|
@@ -1168,7 +1171,7 @@ const nt = (t) => {
|
|
|
1168
1171
|
"div",
|
|
1169
1172
|
{
|
|
1170
1173
|
className: "fixed inset-0 z-40 bg-black/30",
|
|
1171
|
-
onClick: () =>
|
|
1174
|
+
onClick: () => _(!1)
|
|
1172
1175
|
}
|
|
1173
1176
|
),
|
|
1174
1177
|
/* @__PURE__ */ u(
|
|
@@ -1198,7 +1201,7 @@ const nt = (t) => {
|
|
|
1198
1201
|
{
|
|
1199
1202
|
style: {
|
|
1200
1203
|
display: "flex",
|
|
1201
|
-
color:
|
|
1204
|
+
color: S.tanyaThemeContrastColor,
|
|
1202
1205
|
alignItems: "center",
|
|
1203
1206
|
gap: "0.5rem"
|
|
1204
1207
|
},
|
|
@@ -1259,7 +1262,7 @@ const nt = (t) => {
|
|
|
1259
1262
|
gap: "1.25rem",
|
|
1260
1263
|
margin: "0.75rem"
|
|
1261
1264
|
},
|
|
1262
|
-
children: /* @__PURE__ */ a("button", { onClick: () =>
|
|
1265
|
+
children: /* @__PURE__ */ a("button", { onClick: () => _(!1), children: /* @__PURE__ */ u(
|
|
1263
1266
|
"svg",
|
|
1264
1267
|
{
|
|
1265
1268
|
width: "24",
|
|
@@ -1319,7 +1322,7 @@ const nt = (t) => {
|
|
|
1319
1322
|
ref: et,
|
|
1320
1323
|
className: "overflow-y-auto pr-5 pb-2 space-y-4 hide-scrollbar flex-grow mb-24",
|
|
1321
1324
|
children: [
|
|
1322
|
-
(
|
|
1325
|
+
(S == null ? void 0 : S.whomRequired) && /* @__PURE__ */ u(
|
|
1323
1326
|
"div",
|
|
1324
1327
|
{
|
|
1325
1328
|
className: "mx-3 p-3 rounded-2xl bg-[#FFFFFF]",
|
|
@@ -1367,7 +1370,7 @@ const nt = (t) => {
|
|
|
1367
1370
|
Nr,
|
|
1368
1371
|
{
|
|
1369
1372
|
chat: s.products,
|
|
1370
|
-
storeDetails:
|
|
1373
|
+
storeDetails: S
|
|
1371
1374
|
}
|
|
1372
1375
|
),
|
|
1373
1376
|
s.potentialQuestions.length > 0 && /* @__PURE__ */ u("div", { className: "my-2 px-4 text-sm text-gray-700", children: [
|
|
@@ -1375,17 +1378,17 @@ const nt = (t) => {
|
|
|
1375
1378
|
"p",
|
|
1376
1379
|
{
|
|
1377
1380
|
className: "font-nunitoSans font-bold text-sm text-[#494949]",
|
|
1378
|
-
style: { color:
|
|
1381
|
+
style: { color: S.themeDarkColor },
|
|
1379
1382
|
children: "Why not explore these inquiries..."
|
|
1380
1383
|
}
|
|
1381
1384
|
),
|
|
1382
1385
|
s.potentialQuestions.split(",").map((f, w) => /* @__PURE__ */ a(
|
|
1383
1386
|
"button",
|
|
1384
1387
|
{
|
|
1385
|
-
className: `cursor-pointer font-nunitoSans font-semibold text-[#232323] border bg-[#804C9E0D] border-${
|
|
1388
|
+
className: `cursor-pointer font-nunitoSans font-semibold text-[#232323] border bg-[#804C9E0D] border-${S.themeDarkColor} m-1 rounded-xl px-2 py-1`,
|
|
1386
1389
|
onClick: () => Wt(f),
|
|
1387
1390
|
style: {
|
|
1388
|
-
backgroundColor:
|
|
1391
|
+
backgroundColor: S.tanyaThemeColorLight
|
|
1389
1392
|
},
|
|
1390
1393
|
children: f
|
|
1391
1394
|
},
|
|
@@ -1410,7 +1413,7 @@ const nt = (t) => {
|
|
|
1410
1413
|
"p",
|
|
1411
1414
|
{
|
|
1412
1415
|
className: "font-semibold tanya-pulse",
|
|
1413
|
-
style: { color:
|
|
1416
|
+
style: { color: S.themeDarkColor },
|
|
1414
1417
|
children: "I’ve found a special surprise crafted just for you… hang on a sec!"
|
|
1415
1418
|
}
|
|
1416
1419
|
),
|
|
@@ -1418,7 +1421,7 @@ const nt = (t) => {
|
|
|
1418
1421
|
"p",
|
|
1419
1422
|
{
|
|
1420
1423
|
className: "tanya-dots mt-1",
|
|
1421
|
-
style: { color:
|
|
1424
|
+
style: { color: S.themeDarkColor },
|
|
1422
1425
|
children: "• • •"
|
|
1423
1426
|
}
|
|
1424
1427
|
)
|
|
@@ -1431,7 +1434,7 @@ const nt = (t) => {
|
|
|
1431
1434
|
{
|
|
1432
1435
|
className: "text-sm text-[#232323] bg-[#FFFFFF] px-7 py-4 rounded-br-xl rounded-bl-2xl w-full",
|
|
1433
1436
|
style: {
|
|
1434
|
-
backgroundColor:
|
|
1437
|
+
backgroundColor: S.tanyaThemeColorLight
|
|
1435
1438
|
},
|
|
1436
1439
|
dangerouslySetInnerHTML: {
|
|
1437
1440
|
__html: Xt(
|
|
@@ -1446,7 +1449,7 @@ const nt = (t) => {
|
|
|
1446
1449
|
{
|
|
1447
1450
|
className: "flex gap-4 items-stretch rounded-2xl p-4",
|
|
1448
1451
|
style: {
|
|
1449
|
-
backgroundColor:
|
|
1452
|
+
backgroundColor: S.tanyaThemeColorLight
|
|
1450
1453
|
},
|
|
1451
1454
|
children: [
|
|
1452
1455
|
/* @__PURE__ */ a(
|
|
@@ -1473,7 +1476,7 @@ const nt = (t) => {
|
|
|
1473
1476
|
/* @__PURE__ */ a("p", { className: "font-semibold text-[15px] leading-snug", children: s.productSnapshot.name }),
|
|
1474
1477
|
/* @__PURE__ */ a("p", { className: "mt-1 text-[14px] font-medium", children: s.productSnapshot.price != null ? new Intl.NumberFormat(void 0, {
|
|
1475
1478
|
style: "currency",
|
|
1476
|
-
currency: (
|
|
1479
|
+
currency: (S == null ? void 0 : S.currency) || "USD"
|
|
1477
1480
|
}).format(
|
|
1478
1481
|
s.productSnapshot.price
|
|
1479
1482
|
) : "" }),
|
|
@@ -1509,7 +1512,7 @@ const nt = (t) => {
|
|
|
1509
1512
|
),
|
|
1510
1513
|
style: {
|
|
1511
1514
|
background: "transparent",
|
|
1512
|
-
color:
|
|
1515
|
+
color: S.themeDarkColor
|
|
1513
1516
|
},
|
|
1514
1517
|
children: "−"
|
|
1515
1518
|
}
|
|
@@ -1532,7 +1535,7 @@ const nt = (t) => {
|
|
|
1532
1535
|
),
|
|
1533
1536
|
style: {
|
|
1534
1537
|
background: "transparent",
|
|
1535
|
-
color:
|
|
1538
|
+
color: S.themeDarkColor
|
|
1536
1539
|
},
|
|
1537
1540
|
children: "+"
|
|
1538
1541
|
}
|
|
@@ -1552,8 +1555,8 @@ const nt = (t) => {
|
|
|
1552
1555
|
disabled: lt,
|
|
1553
1556
|
className: "px-4 py-2 rounded-full font-medium",
|
|
1554
1557
|
style: {
|
|
1555
|
-
background:
|
|
1556
|
-
color: (
|
|
1558
|
+
background: S.tanyaThemeColor,
|
|
1559
|
+
color: (S == null ? void 0 : S.tanyaThemeContrastColor) || "#fff",
|
|
1557
1560
|
opacity: lt ? 0.8 : 1
|
|
1558
1561
|
},
|
|
1559
1562
|
children: lt ? "Adding..." : "Add to cart"
|
|
@@ -1605,7 +1608,7 @@ const nt = (t) => {
|
|
|
1605
1608
|
className: "p-3 animate-spin rounded-full h-3 w-3 border-b-2",
|
|
1606
1609
|
style: {
|
|
1607
1610
|
borderBottom: "2px solid",
|
|
1608
|
-
color:
|
|
1611
|
+
color: S.tanyaThemeColor
|
|
1609
1612
|
}
|
|
1610
1613
|
}
|
|
1611
1614
|
) : /* @__PURE__ */ a(
|
|
@@ -1939,7 +1942,7 @@ var fe = function() {
|
|
|
1939
1942
|
return he(t) ? Symbol[t] : "@@" + t;
|
|
1940
1943
|
};
|
|
1941
1944
|
fe() && !he("observable") && (Symbol.observable = Symbol("observable"));
|
|
1942
|
-
var
|
|
1945
|
+
var Vr = me("iterator"), se = me("observable"), Qe = me("species");
|
|
1943
1946
|
function Kt(t, e) {
|
|
1944
1947
|
var r = t[e];
|
|
1945
1948
|
if (r != null) {
|
|
@@ -1951,7 +1954,7 @@ function Et(t) {
|
|
|
1951
1954
|
var e = t.constructor;
|
|
1952
1955
|
return e !== void 0 && (e = e[Qe], e === null && (e = void 0)), e !== void 0 ? e : E;
|
|
1953
1956
|
}
|
|
1954
|
-
function
|
|
1957
|
+
function Rr(t) {
|
|
1955
1958
|
return t instanceof E;
|
|
1956
1959
|
}
|
|
1957
1960
|
function vt(t) {
|
|
@@ -2097,11 +2100,11 @@ var Kr = /* @__PURE__ */ (function() {
|
|
|
2097
2100
|
i.unsubscribe(), c();
|
|
2098
2101
|
}
|
|
2099
2102
|
var i = n.subscribe({
|
|
2100
|
-
next: function(
|
|
2103
|
+
next: function(v) {
|
|
2101
2104
|
try {
|
|
2102
|
-
o(
|
|
2103
|
-
} catch (
|
|
2104
|
-
l(
|
|
2105
|
+
o(v, d);
|
|
2106
|
+
} catch (k) {
|
|
2107
|
+
l(k), i.unsubscribe();
|
|
2105
2108
|
}
|
|
2106
2109
|
},
|
|
2107
2110
|
error: l,
|
|
@@ -2155,26 +2158,26 @@ var Kr = /* @__PURE__ */ (function() {
|
|
|
2155
2158
|
}, e.reduce = function(o) {
|
|
2156
2159
|
var n = this;
|
|
2157
2160
|
if (typeof o != "function") throw new TypeError(o + " is not a function");
|
|
2158
|
-
var c = Et(this), l = arguments.length > 1, d = !1, i = arguments[1],
|
|
2159
|
-
return new c(function(
|
|
2161
|
+
var c = Et(this), l = arguments.length > 1, d = !1, i = arguments[1], v = i;
|
|
2162
|
+
return new c(function(k) {
|
|
2160
2163
|
return n.subscribe({
|
|
2161
2164
|
next: function(C) {
|
|
2162
|
-
var
|
|
2163
|
-
if (d = !0, !
|
|
2165
|
+
var _ = !d;
|
|
2166
|
+
if (d = !0, !_ || l)
|
|
2164
2167
|
try {
|
|
2165
|
-
|
|
2168
|
+
v = o(v, C);
|
|
2166
2169
|
} catch (I) {
|
|
2167
|
-
return
|
|
2170
|
+
return k.error(I);
|
|
2168
2171
|
}
|
|
2169
2172
|
else
|
|
2170
|
-
|
|
2173
|
+
v = C;
|
|
2171
2174
|
},
|
|
2172
2175
|
error: function(C) {
|
|
2173
|
-
|
|
2176
|
+
k.error(C);
|
|
2174
2177
|
},
|
|
2175
2178
|
complete: function() {
|
|
2176
|
-
if (!d && !l) return
|
|
2177
|
-
|
|
2179
|
+
if (!d && !l) return k.error(new TypeError("Cannot reduce an empty sequence"));
|
|
2180
|
+
k.next(v), k.complete();
|
|
2178
2181
|
}
|
|
2179
2182
|
});
|
|
2180
2183
|
});
|
|
@@ -2183,9 +2186,9 @@ var Kr = /* @__PURE__ */ (function() {
|
|
|
2183
2186
|
c[l] = arguments[l];
|
|
2184
2187
|
var d = Et(this);
|
|
2185
2188
|
return new d(function(i) {
|
|
2186
|
-
var
|
|
2187
|
-
function C(
|
|
2188
|
-
|
|
2189
|
+
var v, k = 0;
|
|
2190
|
+
function C(_) {
|
|
2191
|
+
v = _.subscribe({
|
|
2189
2192
|
next: function(I) {
|
|
2190
2193
|
i.next(I);
|
|
2191
2194
|
},
|
|
@@ -2193,12 +2196,12 @@ var Kr = /* @__PURE__ */ (function() {
|
|
|
2193
2196
|
i.error(I);
|
|
2194
2197
|
},
|
|
2195
2198
|
complete: function() {
|
|
2196
|
-
|
|
2199
|
+
k === c.length ? (v = void 0, i.complete()) : C(d.from(c[k++]));
|
|
2197
2200
|
}
|
|
2198
2201
|
});
|
|
2199
2202
|
}
|
|
2200
2203
|
return C(o), function() {
|
|
2201
|
-
|
|
2204
|
+
v && (v.unsubscribe(), v = void 0);
|
|
2202
2205
|
};
|
|
2203
2206
|
});
|
|
2204
2207
|
}, e.flatMap = function(o) {
|
|
@@ -2207,40 +2210,40 @@ var Kr = /* @__PURE__ */ (function() {
|
|
|
2207
2210
|
var c = Et(this);
|
|
2208
2211
|
return new c(function(l) {
|
|
2209
2212
|
var d = [], i = n.subscribe({
|
|
2210
|
-
next: function(
|
|
2213
|
+
next: function(k) {
|
|
2211
2214
|
if (o)
|
|
2212
2215
|
try {
|
|
2213
|
-
|
|
2214
|
-
} catch (
|
|
2215
|
-
return l.error(
|
|
2216
|
+
k = o(k);
|
|
2217
|
+
} catch (_) {
|
|
2218
|
+
return l.error(_);
|
|
2216
2219
|
}
|
|
2217
|
-
var C = c.from(
|
|
2218
|
-
next: function(
|
|
2219
|
-
l.next(
|
|
2220
|
+
var C = c.from(k).subscribe({
|
|
2221
|
+
next: function(_) {
|
|
2222
|
+
l.next(_);
|
|
2220
2223
|
},
|
|
2221
|
-
error: function(
|
|
2222
|
-
l.error(
|
|
2224
|
+
error: function(_) {
|
|
2225
|
+
l.error(_);
|
|
2223
2226
|
},
|
|
2224
2227
|
complete: function() {
|
|
2225
|
-
var
|
|
2226
|
-
|
|
2228
|
+
var _ = d.indexOf(C);
|
|
2229
|
+
_ >= 0 && d.splice(_, 1), v();
|
|
2227
2230
|
}
|
|
2228
2231
|
});
|
|
2229
2232
|
d.push(C);
|
|
2230
2233
|
},
|
|
2231
|
-
error: function(
|
|
2232
|
-
l.error(
|
|
2234
|
+
error: function(k) {
|
|
2235
|
+
l.error(k);
|
|
2233
2236
|
},
|
|
2234
2237
|
complete: function() {
|
|
2235
|
-
|
|
2238
|
+
v();
|
|
2236
2239
|
}
|
|
2237
2240
|
});
|
|
2238
|
-
function
|
|
2241
|
+
function v() {
|
|
2239
2242
|
i.closed && d.length === 0 && l.complete();
|
|
2240
2243
|
}
|
|
2241
2244
|
return function() {
|
|
2242
|
-
d.forEach(function(
|
|
2243
|
-
return
|
|
2245
|
+
d.forEach(function(k) {
|
|
2246
|
+
return k.unsubscribe();
|
|
2244
2247
|
}), i.unsubscribe();
|
|
2245
2248
|
};
|
|
2246
2249
|
});
|
|
@@ -2253,17 +2256,17 @@ var Kr = /* @__PURE__ */ (function() {
|
|
|
2253
2256
|
if (c) {
|
|
2254
2257
|
var l = c.call(o);
|
|
2255
2258
|
if (Object(l) !== l) throw new TypeError(l + " is not an object");
|
|
2256
|
-
return
|
|
2259
|
+
return Rr(l) && l.constructor === n ? l : new n(function(d) {
|
|
2257
2260
|
return l.subscribe(d);
|
|
2258
2261
|
});
|
|
2259
2262
|
}
|
|
2260
|
-
if (he("iterator") && (c = Kt(o,
|
|
2263
|
+
if (he("iterator") && (c = Kt(o, Vr), c))
|
|
2261
2264
|
return new n(function(d) {
|
|
2262
2265
|
Mt(function() {
|
|
2263
2266
|
if (!d.closed) {
|
|
2264
|
-
for (var i = Mr(c.call(o)),
|
|
2265
|
-
var
|
|
2266
|
-
if (d.next(
|
|
2267
|
+
for (var i = Mr(c.call(o)), v; !(v = i()).done; ) {
|
|
2268
|
+
var k = v.value;
|
|
2269
|
+
if (d.next(k), d.closed) return;
|
|
2267
2270
|
}
|
|
2268
2271
|
d.complete();
|
|
2269
2272
|
}
|