@springmicro/cart 0.5.2 → 0.5.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 +12 -12
- package/dist/index.umd.cjs +1 -1
- package/package.json +3 -3
- package/src/ProductCard.tsx +8 -6
package/dist/index.js
CHANGED
|
@@ -29386,32 +29386,32 @@ function UI({
|
|
|
29386
29386
|
priceTierName: n
|
|
29387
29387
|
}) {
|
|
29388
29388
|
const r = JSON.parse(kl(xt)), a = r.items.findIndex(
|
|
29389
|
-
(
|
|
29390
|
-
), i = !!~a, s = JSON.parse(e.pricing), l = s.findIndex((
|
|
29391
|
-
|
|
29392
|
-
|
|
29393
|
-
|
|
29389
|
+
(p) => p.product_id === e.id
|
|
29390
|
+
), i = !!~a, s = JSON.parse(e.pricing), l = s.findIndex((p) => p.tier_label === n), c = l != -1 ? r.items.findIndex((p) => p.price_id === s[l].id) : -1;
|
|
29391
|
+
function u(p = l) {
|
|
29392
|
+
if (p === -1)
|
|
29393
|
+
throw "Price index not found. Provide price index to addToCart OR provide priceTierName to ProductCard.";
|
|
29394
29394
|
Df({
|
|
29395
29395
|
product_id: e.id,
|
|
29396
29396
|
name: e.name,
|
|
29397
|
-
price_id: s[
|
|
29397
|
+
price_id: s[p].id,
|
|
29398
29398
|
image: void 0,
|
|
29399
29399
|
quantity: void 0
|
|
29400
29400
|
});
|
|
29401
29401
|
}
|
|
29402
|
-
const
|
|
29402
|
+
const d = {
|
|
29403
29403
|
product: e,
|
|
29404
29404
|
foundInCart: {
|
|
29405
29405
|
product: i,
|
|
29406
|
-
price:
|
|
29406
|
+
price: l != -1 ? !!~c : null
|
|
29407
29407
|
},
|
|
29408
29408
|
pricing: s,
|
|
29409
|
-
addToCart:
|
|
29410
|
-
removeFromCart: (
|
|
29411
|
-
Fl(
|
|
29409
|
+
addToCart: u,
|
|
29410
|
+
removeFromCart: (p) => {
|
|
29411
|
+
Fl(p ? c : a);
|
|
29412
29412
|
}
|
|
29413
29413
|
};
|
|
29414
|
-
return t !== void 0 ? t(
|
|
29414
|
+
return t !== void 0 ? t(d) : /* @__PURE__ */ h.jsx(iC, { ...d });
|
|
29415
29415
|
}
|
|
29416
29416
|
function iC({
|
|
29417
29417
|
product: e,
|