@springmicro/cart 0.5.2 → 0.5.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
@@ -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
- (f) => f.product_id === e.id
29390
- ), i = !!~a, s = JSON.parse(e.pricing), l = s.findIndex((f) => f.tier_label === n), c = r.items.findIndex(
29391
- (f) => f.price_id === s[l].id
29392
- ), u = !!~c;
29393
- function d(f = l) {
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[f].id,
29397
+ price_id: s[p].id,
29398
29398
  image: void 0,
29399
29399
  quantity: void 0
29400
29400
  });
29401
29401
  }
29402
- const p = {
29402
+ const d = {
29403
29403
  product: e,
29404
29404
  foundInCart: {
29405
29405
  product: i,
29406
- price: u
29406
+ price: l != -1 ? !!~c : null
29407
29407
  },
29408
29408
  pricing: s,
29409
- addToCart: d,
29410
- removeFromCart: (f) => {
29411
- Fl(f ? c : a);
29409
+ addToCart: u,
29410
+ removeFromCart: (p) => {
29411
+ Fl(p ? c : a);
29412
29412
  }
29413
29413
  };
29414
- return t !== void 0 ? t(p) : /* @__PURE__ */ h.jsx(iC, { ...p });
29414
+ return t !== void 0 ? t(d) : /* @__PURE__ */ h.jsx(iC, { ...d });
29415
29415
  }
29416
29416
  function iC({
29417
29417
  product: e,