ingeniuscliq-core 0.3.9 → 0.3.11

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.
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -1,4 +1,4 @@
1
- import './index.css';var Bh = Object.defineProperty;
1
+ import '../index.css';var Bh = Object.defineProperty;
2
2
  var Wh = (e, t, n) => t in e ? Bh(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
3
  var Se = (e, t, n) => Wh(e, typeof t != "symbol" ? t + "" : t, n);
4
4
  import Hh from "i18next";
@@ -2479,33 +2479,20 @@ class X5 {
2479
2479
  throw console.error(a), t((s) => ({ ...s, error: a, loading: !1 })), a;
2480
2480
  }
2481
2481
  },
2482
- removeFromCart: (r) => {
2482
+ removeFromCart: async (r) => {
2483
2483
  try {
2484
- t({ loading: !0, error: null }), this.shopCartService.removeFromCart(r);
2485
- const o = n().cart.items.find((a) => a.productible_id === r);
2486
- o && t(
2487
- (a) => ({
2488
- cart: {
2489
- ...a.cart,
2490
- items: [
2491
- ...a.cart.items,
2492
- { ...o, quantity: o.quantity - 1 }
2493
- ]
2494
- },
2495
- cartItems: [
2496
- ...a.cartItems,
2497
- { ...o, quantity: o.quantity - 1 }
2498
- ],
2499
- loading: !1
2500
- })
2501
- );
2484
+ t({ loading: !0, error: null }), await this.shopCartService.removeFromCart(r);
2485
+ let o = await this.shopCartService.getCart();
2486
+ t(() => ({ cart: o.data.data, cartItems: o.data.data.items, loading: !1 }));
2502
2487
  } catch (o) {
2503
2488
  throw console.error(o), t((a) => ({ ...a, error: o, loading: !1 })), o;
2504
2489
  }
2505
2490
  },
2506
- removeItemFromCart: (r) => {
2491
+ removeItemFromCart: async (r) => {
2507
2492
  try {
2508
- t({ loading: !0, error: null }), this.shopCartService.removeItemFromCart(r), t((o) => ({ cart: { ...o.cart, items: o.cart.items.filter((a) => a.productible_id !== r) }, cartItems: o.cartItems.filter((a) => a.productible_id !== r), loading: !1 }));
2493
+ t({ loading: !0, error: null }), await this.shopCartService.removeItemFromCart(r);
2494
+ let o = await this.shopCartService.getCart();
2495
+ t(() => ({ cart: o.data.data, cartItems: o.data.data.items, loading: !1 }));
2509
2496
  } catch (o) {
2510
2497
  throw console.error(o), t((a) => ({ ...a, error: o, loading: !1 })), o;
2511
2498
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ingeniuscliq-core",
3
- "version": "0.3.9",
3
+ "version": "0.3.11",
4
4
  "description": "IngeniusCliq Core UI y lógica compartida",
5
5
  "license": "MIT",
6
6
  "type": "module",