ingeniuscliq-core 0.2.51 → 0.2.53

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
@@ -2526,6 +2526,7 @@ class X5 {
2526
2526
  Fe(this, "shipmentService");
2527
2527
  Fe(this, "initialState", {
2528
2528
  shipment: null,
2529
+ shippingMethods: null,
2529
2530
  loading: !1,
2530
2531
  error: null
2531
2532
  });
@@ -2538,10 +2539,12 @@ class X5 {
2538
2539
  ...this.initialState,
2539
2540
  getShipment: () => n().shipment,
2540
2541
  setShipment: (r) => t({ shipment: r }),
2541
- fetchShipment: async () => {
2542
+ getShippingMethods: () => n().shippingMethods,
2543
+ setShippingMethods: (r) => t({ shippingMethods: r }),
2544
+ fetchShippingMethods: async () => {
2542
2545
  try {
2543
2546
  const r = await this.shipmentService.getShippingMethods();
2544
- return t({ shipment: r.data.data }), r.data;
2547
+ return t({ shippingMethods: r.data.data }), r.data;
2545
2548
  } catch (r) {
2546
2549
  throw t({ error: r }), r;
2547
2550
  }
@@ -2553,7 +2556,8 @@ class X5 {
2553
2556
  {
2554
2557
  name: "shipment-storage",
2555
2558
  partialize: (t) => ({
2556
- shipment: t.shipment
2559
+ shipment: t.shipment,
2560
+ shippingMethods: t.shippingMethods
2557
2561
  })
2558
2562
  }
2559
2563
  )
@@ -37,5 +37,9 @@ export interface CoreOrderForm extends BaseType {
37
37
  customer_phone: string;
38
38
  customer_address: string;
39
39
  note?: string;
40
- payform_id?: string;
40
+ payform_id: string;
41
+ shipping_type: string;
42
+ beneficiary_name: string;
43
+ beneficiary_email: string;
44
+ beneficiary_phone: string;
41
45
  }
@@ -1,22 +1,24 @@
1
1
  import { CoreBuilder } from '../../../classes/CoreBuilder';
2
2
  import { CoreShipmentBaseService } from '../services/base';
3
- import { CoreShipment, CoreShipmentStore } from '../types/CoreShipment';
3
+ import { CoreShipment, CoreShipmentStore, CoreShippingMethod } from '../types/CoreShipment';
4
4
  export declare class CoreShipmentBuilder implements CoreBuilder {
5
5
  protected shipmentService: CoreShipmentBaseService;
6
- protected initialState: Pick<CoreShipmentStore<CoreShipment>, "shipment" | "loading" | "error">;
6
+ protected initialState: Pick<CoreShipmentStore<CoreShipment, CoreShippingMethod>, "shipment" | "shippingMethods" | "loading" | "error">;
7
7
  constructor(service?: CoreShipmentBaseService, initialState?: any);
8
- build(): import('zustand').UseBoundStore<Omit<import('zustand').StoreApi<CoreShipmentStore<CoreShipment>>, "persist"> & {
8
+ build(): import('zustand').UseBoundStore<Omit<import('zustand').StoreApi<CoreShipmentStore<CoreShipment, CoreShippingMethod>>, "persist"> & {
9
9
  persist: {
10
- setOptions: (options: Partial<import('zustand/middleware').PersistOptions<CoreShipmentStore<CoreShipment>, {
10
+ setOptions: (options: Partial<import('zustand/middleware').PersistOptions<CoreShipmentStore<CoreShipment, CoreShippingMethod>, {
11
11
  shipment: CoreShipment | null;
12
+ shippingMethods: CoreShippingMethod[] | null;
12
13
  }>>) => void;
13
14
  clearStorage: () => void;
14
15
  rehydrate: () => Promise<void> | void;
15
16
  hasHydrated: () => boolean;
16
- onHydrate: (fn: (state: CoreShipmentStore<CoreShipment>) => void) => () => void;
17
- onFinishHydration: (fn: (state: CoreShipmentStore<CoreShipment>) => void) => () => void;
18
- getOptions: () => Partial<import('zustand/middleware').PersistOptions<CoreShipmentStore<CoreShipment>, {
17
+ onHydrate: (fn: (state: CoreShipmentStore<CoreShipment, CoreShippingMethod>) => void) => () => void;
18
+ onFinishHydration: (fn: (state: CoreShipmentStore<CoreShipment, CoreShippingMethod>) => void) => () => void;
19
+ getOptions: () => Partial<import('zustand/middleware').PersistOptions<CoreShipmentStore<CoreShipment, CoreShippingMethod>, {
19
20
  shipment: CoreShipment | null;
21
+ shippingMethods: CoreShippingMethod[] | null;
20
22
  }>>;
21
23
  };
22
24
  }>;
@@ -1,10 +1,10 @@
1
1
  import { BaseService } from '../../../services/base';
2
- import { CoreShipment } from '../types/CoreShipment';
2
+ import { CoreShippingMethod } from '../types/CoreShipment';
3
3
  import { BaseApiResponse } from '../../../types';
4
4
  /**
5
5
  * Base class that can be extended by concrete services
6
6
  */
7
7
  export declare class CoreShipmentBaseService extends BaseService {
8
8
  constructor();
9
- getShippingMethods(): Promise<import('axios').AxiosResponse<BaseApiResponse<CoreShipment>, any>>;
9
+ getShippingMethods(): Promise<import('axios').AxiosResponse<BaseApiResponse<CoreShippingMethod[]>, any>>;
10
10
  }
@@ -4,13 +4,15 @@ import { BaseType } from '../../../types/BaseType';
4
4
  * CoreShipment base type
5
5
  */
6
6
  export interface CoreShipment extends BaseType {
7
- shippingMethods: CoreShippingMethod[];
8
7
  }
9
- export interface CoreShipmentStore<T extends CoreShipment> extends BaseStore {
8
+ export interface CoreShipmentStore<T extends CoreShipment, K extends CoreShippingMethod> extends BaseStore {
10
9
  shipment: T | null;
10
+ shippingMethods: K[] | null;
11
11
  setShipment: (shipment: T | null) => void;
12
12
  getShipment: () => T | null;
13
- fetchShipment: () => Promise<BaseApiResponse<T>>;
13
+ setShippingMethods: (shippingMethods: K[] | null) => void;
14
+ getShippingMethods: () => K[] | null;
15
+ fetchShippingMethods: () => Promise<BaseApiResponse<K[]>>;
14
16
  }
15
17
  export interface CoreShippingMethod extends BaseType {
16
18
  name: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ingeniuscliq-core",
3
- "version": "0.2.51",
3
+ "version": "0.2.53",
4
4
  "description": "IngeniusCliq Core UI y lógica compartida",
5
5
  "license": "MIT",
6
6
  "type": "module",