@springmicro/cart 0.6.2 → 0.6.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/index.js
CHANGED
|
@@ -29364,7 +29364,7 @@ const oC = _n(
|
|
|
29364
29364
|
type: "submit",
|
|
29365
29365
|
disabled: u,
|
|
29366
29366
|
color: d ? "error" : void 0,
|
|
29367
|
-
children: "
|
|
29367
|
+
children: "Review"
|
|
29368
29368
|
}
|
|
29369
29369
|
),
|
|
29370
29370
|
/* @__PURE__ */ m.jsx(qe, { sx: { mt: 1 }, children: /* @__PURE__ */ m.jsx(aC, {}) })
|
|
@@ -33185,16 +33185,23 @@ async function _I(e, t, n) {
|
|
|
33185
33185
|
return i.searchParams.set("orderId", a.id), i.searchParams.set("orderRef", a.reference), window.history.pushState({}, "", i), a;
|
|
33186
33186
|
}
|
|
33187
33187
|
async function jI(e, t, n, r, a, i) {
|
|
33188
|
-
i && console.log("Getting tax")
|
|
33188
|
+
i && console.log("Getting tax", n), i && console.log(
|
|
33189
|
+
"Getting product data",
|
|
33190
|
+
a,
|
|
33191
|
+
a[n[0].product_id]
|
|
33192
|
+
);
|
|
33189
33193
|
const s = n.filter(
|
|
33190
|
-
(c) => c.unit_amount > 0 && a[c.product_id].type
|
|
33194
|
+
(c) => c.unit_amount > 0 && a[c.product_id].type != "DONATION"
|
|
33191
33195
|
);
|
|
33192
33196
|
return i && console.log("Taxable items", s), s.length === 0 ? { tax_amount: 0 } : await (await fetch(
|
|
33193
33197
|
`${e}/api/ecommerce/tax?tax_provider=${t ?? "dummy"}`,
|
|
33194
33198
|
{
|
|
33195
33199
|
method: "POST",
|
|
33196
33200
|
body: JSON.stringify({
|
|
33197
|
-
cart_data: s
|
|
33201
|
+
cart_data: s.map((c) => ({
|
|
33202
|
+
amount: c.unit_amount,
|
|
33203
|
+
reference: c.reference
|
|
33204
|
+
})),
|
|
33198
33205
|
address: {
|
|
33199
33206
|
country: r.country,
|
|
33200
33207
|
city: r.locality,
|
|
@@ -33233,14 +33240,15 @@ function DI({
|
|
|
33233
33240
|
N && console.log({ products: l, prices: s });
|
|
33234
33241
|
const [I, R] = qt(!0), [h, T] = qt(void 0), w = Yo(), V = Sy(w.breakpoints.down("lg")), [_, $] = a, [P, g] = n, [O, A] = u;
|
|
33235
33242
|
async function L(ee) {
|
|
33236
|
-
T(void 0), R(!0), Promise.all([
|
|
33243
|
+
T(void 0), R(!0), N && console.log("Cart items", i.items), Promise.all([
|
|
33237
33244
|
_I(i, c, N),
|
|
33238
33245
|
jI(
|
|
33239
33246
|
c,
|
|
33240
33247
|
f,
|
|
33241
33248
|
i.items.map((G) => ({
|
|
33242
|
-
|
|
33243
|
-
reference: G.name
|
|
33249
|
+
unit_amount: s[G.price_id].unit_amount,
|
|
33250
|
+
reference: G.name,
|
|
33251
|
+
product_id: G.product_id
|
|
33244
33252
|
})),
|
|
33245
33253
|
ee,
|
|
33246
33254
|
l,
|
|
@@ -33248,8 +33256,8 @@ function DI({
|
|
|
33248
33256
|
)
|
|
33249
33257
|
]).then(([G, q]) => {
|
|
33250
33258
|
g(q), A(G), $(1), R(!1);
|
|
33251
|
-
}).catch(() => {
|
|
33252
|
-
T(!0), R(!1);
|
|
33259
|
+
}).catch((G) => {
|
|
33260
|
+
N && console.log("Submit error", G), T(!0), R(!1);
|
|
33253
33261
|
});
|
|
33254
33262
|
}
|
|
33255
33263
|
async function B(ee) {
|