ingeniuscliq-core 0.3.46 → 0.3.48

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
@@ -2384,13 +2384,18 @@ class X5 {
2384
2384
  setLoading: (r) => t({ loading: r }),
2385
2385
  setError: (r) => t({ error: r }),
2386
2386
  getPayForms: () => n().payForms,
2387
- fetchPayForms: async (r) => {
2387
+ fetchPayForms: async (r, { onSuccess: o = () => {
2388
+ }, onError: a = () => {
2389
+ }, onFinish: s = () => {
2390
+ } } = {}) => {
2388
2391
  try {
2389
2392
  t({ loading: !0, error: null });
2390
- const o = await this.payFormService.getAll(r);
2391
- return t({ payForms: o.data.data, loading: !1 }), o.data.data;
2392
- } catch (o) {
2393
- throw t((a) => ({ ...a, error: o, loading: !1 })), o;
2393
+ const i = await this.payFormService.getAll(r);
2394
+ return t({ payForms: i.data.data, loading: !1 }), o(i.data.data), i.data.data;
2395
+ } catch (i) {
2396
+ throw t((c) => ({ ...c, error: i, loading: !1 })), a(i), i;
2397
+ } finally {
2398
+ s();
2394
2399
  }
2395
2400
  },
2396
2401
  reset: () => t(this.initialState)
@@ -2528,7 +2533,7 @@ class J5 {
2528
2533
  addToCart: async (r, o, { onSuccess: a = () => {
2529
2534
  }, onError: s = () => {
2530
2535
  }, onFinish: i = () => {
2531
- } }) => {
2536
+ } } = {}) => {
2532
2537
  try {
2533
2538
  t({ loading: !0, error: null }), await this.shopCartService.addToCart(r, o);
2534
2539
  let c = await this.shopCartService.getCart();
@@ -2542,7 +2547,7 @@ class J5 {
2542
2547
  removeFromCart: async (r, { onSuccess: o = () => {
2543
2548
  }, onError: a = () => {
2544
2549
  }, onFinish: s = () => {
2545
- } }) => {
2550
+ } } = {}) => {
2546
2551
  try {
2547
2552
  t({ loading: !0, error: null }), await this.shopCartService.removeFromCart(r);
2548
2553
  let i = await this.shopCartService.getCart();
@@ -2556,7 +2561,7 @@ class J5 {
2556
2561
  removeItemFromCart: async (r, { onSuccess: o = () => {
2557
2562
  }, onError: a = () => {
2558
2563
  }, onFinish: s = () => {
2559
- } }) => {
2564
+ } } = {}) => {
2560
2565
  try {
2561
2566
  t({ loading: !0, error: null }), await this.shopCartService.removeItemFromCart(r);
2562
2567
  let i = await this.shopCartService.getCart();
@@ -2570,7 +2575,7 @@ class J5 {
2570
2575
  clearCart: async ({ onSuccess: r = () => {
2571
2576
  }, onError: o = () => {
2572
2577
  }, onFinish: a = () => {
2573
- } }) => {
2578
+ } } = {}) => {
2574
2579
  try {
2575
2580
  t({ loading: !0, error: null }), await this.shopCartService.clearCart();
2576
2581
  let s = await this.shopCartService.getCart();
@@ -2592,7 +2597,7 @@ class J5 {
2592
2597
  fetchCart: async ({ onSuccess: r = () => {
2593
2598
  }, onError: o = () => {
2594
2599
  }, onFinish: a = () => {
2595
- } }) => {
2600
+ } } = {}) => {
2596
2601
  try {
2597
2602
  t({ loading: !0, error: null });
2598
2603
  let s = await this.shopCartService.getCart();
@@ -2606,7 +2611,7 @@ class J5 {
2606
2611
  fetchCartItems: async ({ onSuccess: r = () => {
2607
2612
  }, onError: o = () => {
2608
2613
  }, onFinish: a = () => {
2609
- } }) => {
2614
+ } } = {}) => {
2610
2615
  try {
2611
2616
  t({ loading: !0, error: null });
2612
2617
  let s = await this.shopCartService.getCartItems();
@@ -1,3 +1,4 @@
1
+ import { CoreActions } from '../../../types';
1
2
  import { BaseStore } from '../../../types/BaseStore';
2
3
  import { BaseType } from '../../../types/BaseType';
3
4
  /**
@@ -13,5 +14,5 @@ export interface CorePayFormStore<T extends CorePayForm> extends BaseStore {
13
14
  payForms: T[] | null;
14
15
  setPayForms: (payForms: T[] | null) => void;
15
16
  getPayForms: () => T[] | null;
16
- fetchPayForms: (params?: Record<string, any>) => Promise<T[]>;
17
+ fetchPayForms: (params?: Record<string, any>, actions?: CoreActions) => Promise<T[]>;
17
18
  }
@@ -3,16 +3,16 @@ import { CoreShopCart, CoreCartItem } from '../CoreShopCart';
3
3
  import { BaseApiResponse } from '../../../../types/contracts/BaseApiResponse';
4
4
  import { CoreActions } from '../../../../types';
5
5
  export interface ICartActions<T> {
6
- addToCart: (product_id: string | number, quantity: number, actions: CoreActions) => void;
7
- removeFromCart: (product_id: string | number, actions: CoreActions) => void;
8
- removeItemFromCart: (product_id: string | number, actions: CoreActions) => void;
9
- clearCart: (actions: CoreActions) => void;
6
+ addToCart: (product_id: string | number, quantity: number, actions?: CoreActions) => void;
7
+ removeFromCart: (product_id: string | number, actions?: CoreActions) => void;
8
+ removeItemFromCart: (product_id: string | number, actions?: CoreActions) => void;
9
+ clearCart: (actions?: CoreActions) => void;
10
10
  getCart: () => CoreShopCart<T>;
11
11
  setCart: (cart: CoreShopCart<T>) => void;
12
12
  getCartItems: () => CoreCartItem<T>[];
13
13
  setCartItems: (cartItems: CoreCartItem<T>[]) => void;
14
- fetchCart: (actions: CoreActions) => Promise<BaseApiResponse<CoreShopCart<T>>>;
15
- fetchCartItems: (actions: CoreActions) => Promise<BaseApiResponse<CoreCartItem<T>[]>>;
14
+ fetchCart: (actions?: CoreActions) => Promise<BaseApiResponse<CoreShopCart<T>>>;
15
+ fetchCartItems: (actions?: CoreActions) => Promise<BaseApiResponse<CoreCartItem<T>[]>>;
16
16
  }
17
17
  export interface ICartActionsService<T> {
18
18
  addToCart: (product_id: string | number, quantity: number) => Promise<AxiosResponse<BaseApiResponse<CoreCartItem<T>>>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ingeniuscliq-core",
3
- "version": "0.3.46",
3
+ "version": "0.3.48",
4
4
  "description": "IngeniusCliq Core UI y lógica compartida",
5
5
  "license": "MIT",
6
6
  "type": "module",