@springmicro/cart 0.6.1 → 0.6.3
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
|
@@ -29644,7 +29644,6 @@ function uC({
|
|
|
29644
29644
|
formDisabled: p,
|
|
29645
29645
|
formErrorState: f
|
|
29646
29646
|
}) {
|
|
29647
|
-
console.log("DISABLED", p);
|
|
29648
29647
|
const [b, x] = e, [y, v] = f;
|
|
29649
29648
|
return /* @__PURE__ */ m.jsx(
|
|
29650
29649
|
"form",
|
|
@@ -33186,16 +33185,23 @@ async function _I(e, t, n) {
|
|
|
33186
33185
|
return i.searchParams.set("orderId", a.id), i.searchParams.set("orderRef", a.reference), window.history.pushState({}, "", i), a;
|
|
33187
33186
|
}
|
|
33188
33187
|
async function jI(e, t, n, r, a, i) {
|
|
33189
|
-
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
|
+
);
|
|
33190
33193
|
const s = n.filter(
|
|
33191
|
-
(c) => c.unit_amount > 0 && a[c.product_id].type
|
|
33194
|
+
(c) => c.unit_amount > 0 && a[c.product_id].type != "DONATION"
|
|
33192
33195
|
);
|
|
33193
|
-
return s.length === 0 ? { tax_amount: 0 } : await (await fetch(
|
|
33196
|
+
return i && console.log("Taxable items", s), s.length === 0 ? { tax_amount: 0 } : await (await fetch(
|
|
33194
33197
|
`${e}/api/ecommerce/tax?tax_provider=${t ?? "dummy"}`,
|
|
33195
33198
|
{
|
|
33196
33199
|
method: "POST",
|
|
33197
33200
|
body: JSON.stringify({
|
|
33198
|
-
cart_data: s
|
|
33201
|
+
cart_data: s.map((c) => ({
|
|
33202
|
+
amount: c.unit_amount,
|
|
33203
|
+
reference: c.reference
|
|
33204
|
+
})),
|
|
33199
33205
|
address: {
|
|
33200
33206
|
country: r.country,
|
|
33201
33207
|
city: r.locality,
|
|
@@ -33231,17 +33237,18 @@ function DI({
|
|
|
33231
33237
|
defaultValues: C = {},
|
|
33232
33238
|
dev: N
|
|
33233
33239
|
}) {
|
|
33234
|
-
console.log({ products: l, prices: s });
|
|
33240
|
+
N && console.log({ products: l, prices: s });
|
|
33235
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;
|
|
33236
33242
|
async function L(ee) {
|
|
33237
|
-
T(void 0), R(!0), Promise.all([
|
|
33243
|
+
T(void 0), R(!0), N && console.log("Cart items", i.items), Promise.all([
|
|
33238
33244
|
_I(i, c, N),
|
|
33239
33245
|
jI(
|
|
33240
33246
|
c,
|
|
33241
33247
|
f,
|
|
33242
33248
|
i.items.map((G) => ({
|
|
33243
|
-
|
|
33244
|
-
reference: G.name
|
|
33249
|
+
unit_amount: s[G.price_id].unit_amount,
|
|
33250
|
+
reference: G.name,
|
|
33251
|
+
product_id: G.product_id
|
|
33245
33252
|
})),
|
|
33246
33253
|
ee,
|
|
33247
33254
|
l,
|
|
@@ -33249,8 +33256,8 @@ function DI({
|
|
|
33249
33256
|
)
|
|
33250
33257
|
]).then(([G, q]) => {
|
|
33251
33258
|
g(q), A(G), $(1), R(!1);
|
|
33252
|
-
}).catch(() => {
|
|
33253
|
-
T(!0), R(!1);
|
|
33259
|
+
}).catch((G) => {
|
|
33260
|
+
N && console.log("Submit error", G), T(!0), R(!1);
|
|
33254
33261
|
});
|
|
33255
33262
|
}
|
|
33256
33263
|
async function B(ee) {
|
|
@@ -33420,9 +33427,7 @@ function kI({ formik: e, products: t, prices: n }) {
|
|
|
33420
33427
|
)
|
|
33421
33428
|
)
|
|
33422
33429
|
// Overwrites the checkout field to use the last one provided. This allows prices to overwrite product checkout fields if necessary.
|
|
33423
|
-
].reduce((s, l) => ({ ...s, [l.name]: l }), {})
|
|
33424
|
-
console.log("Checkout fields", r);
|
|
33425
|
-
const a = (s) => {
|
|
33430
|
+
].reduce((s, l) => ({ ...s, [l.name]: l }), {}), a = (s) => {
|
|
33426
33431
|
const l = s.target.getAttribute("name");
|
|
33427
33432
|
l && e.setValues({
|
|
33428
33433
|
...e.values,
|