ingeniuscliq-core 0.3.48 → 0.4.1
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/components/common/form/FormCheckbox.d.ts +2 -1
- package/dist/components/common/form/FormInput.d.ts +5 -1
- package/dist/components/common/form/FormSelect.d.ts +5 -3
- package/dist/components/common/form/FormTextArea.d.ts +2 -1
- package/dist/components/common/logo/Logo.d.ts +2 -1
- package/dist/hooks/useLanguage.d.ts +2 -1
- package/dist/i18n/config.d.ts +64 -0
- package/dist/index.js +14381 -14096
- package/dist/modules/CoreAuth/classes/CoreAuthBuilder.d.ts +3 -7
- package/dist/modules/CoreAuth/hooks/useAuth.d.ts +3 -5
- package/dist/modules/CoreAuth/services/base.d.ts +12 -9
- package/dist/modules/CoreAuth/stores/authStore.d.ts +0 -4
- package/dist/modules/CoreAuth/types/CoreAuth.d.ts +7 -7
- package/dist/modules/CoreOrder/classes/CoreOrderBuilder.d.ts +1 -1
- package/dist/modules/CoreOrder/types/CoreOrder.d.ts +2 -1
- package/dist/modules/CoreOrder/types/interfaces/OrderActions.d.ts +2 -1
- package/dist/modules/CoreProduct/classes/CoreProductBuilder.d.ts +2 -2
- package/dist/modules/CoreProduct/types/CoreProduct.d.ts +8 -1
- package/dist/modules/CoreShipment/classes/CoreShipmentBuilder.d.ts +14 -12
- package/dist/modules/CoreShipment/services/base.d.ts +7 -2
- package/dist/modules/CoreShipment/types/CoreShipment.d.ts +24 -5
- package/dist/types/ui/template.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import { CoreAuthStore, CoreUser } from '../types';
|
|
2
2
|
import { CoreAuthBaseService } from '../services';
|
|
3
3
|
export declare class CoreAuthBuilder<T extends CoreUser> {
|
|
4
|
-
protected authService: CoreAuthBaseService
|
|
5
|
-
protected initialState: Pick<CoreAuthStore<T>, "user" | "
|
|
6
|
-
constructor(authService?: CoreAuthBaseService
|
|
4
|
+
protected authService: CoreAuthBaseService<T>;
|
|
5
|
+
protected initialState: Pick<CoreAuthStore<T>, "user" | "isAuthenticated" | "loading" | "error">;
|
|
6
|
+
constructor(authService?: CoreAuthBaseService<T>, initialState?: Partial<CoreAuthStore<T>>);
|
|
7
7
|
build(): import('zustand').UseBoundStore<Omit<import('zustand').StoreApi<CoreAuthStore<T>>, "persist"> & {
|
|
8
8
|
persist: {
|
|
9
9
|
setOptions: (options: Partial<import('zustand/middleware').PersistOptions<CoreAuthStore<T>, {
|
|
10
10
|
user: T | null;
|
|
11
|
-
token: string | null;
|
|
12
|
-
refreshToken: string | null;
|
|
13
11
|
isAuthenticated: boolean;
|
|
14
12
|
}>>) => void;
|
|
15
13
|
clearStorage: () => void;
|
|
@@ -19,8 +17,6 @@ export declare class CoreAuthBuilder<T extends CoreUser> {
|
|
|
19
17
|
onFinishHydration: (fn: (state: CoreAuthStore<T>) => void) => () => void;
|
|
20
18
|
getOptions: () => Partial<import('zustand/middleware').PersistOptions<CoreAuthStore<T>, {
|
|
21
19
|
user: T | null;
|
|
22
|
-
token: string | null;
|
|
23
|
-
refreshToken: string | null;
|
|
24
20
|
isAuthenticated: boolean;
|
|
25
21
|
}>>;
|
|
26
22
|
};
|
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
export declare function useAuth(): {
|
|
2
2
|
user: import('../types').CoreUser | null;
|
|
3
|
-
token: string | null;
|
|
4
|
-
refreshToken: string | null;
|
|
5
3
|
isAuthenticated: boolean;
|
|
6
4
|
loading: boolean;
|
|
7
5
|
error: string | null;
|
|
8
|
-
getUser: () => Promise<import('../types').CoreUser
|
|
6
|
+
getUser: () => Promise<import('../../..').BaseApiResponse<import('../types').CoreGetUserResponse<import('../types').CoreUser>>>;
|
|
9
7
|
login: <K extends import('../types').CoreLoginCredentials>(credentials: K) => Promise<import('../../..').BaseApiResponse<import('../types').CoreAuthLoginResponse<import('../types').CoreUser>>>;
|
|
10
8
|
register: <K extends import('../types').CoreRegisterCredentials>(credentials: K) => Promise<import('../../..').BaseApiResponse<import('../types').CoreAuthRegisterResponse<import('../types').CoreUser>>>;
|
|
11
9
|
logout: () => void;
|
|
12
10
|
refreshUserToken: () => Promise<any>;
|
|
11
|
+
updateUser: (userId: Pick<import('../types').CoreUser, "id">, updateUserData: Partial<import('../types').CoreUser>, actions?: import('../../..').CoreActions) => void;
|
|
12
|
+
deleteUser: (userId: Pick<import('../types').CoreUser, "id">, actions?: import('../../..').CoreActions) => void;
|
|
13
13
|
setUser: (user: import('../types').CoreUser | null) => void;
|
|
14
|
-
setToken: (token: string | null) => void;
|
|
15
|
-
setRefreshToken: (token: string | null) => void;
|
|
16
14
|
setLoading: (loading: boolean) => void;
|
|
17
15
|
setError: (error: string | null) => void;
|
|
18
16
|
reset: () => void;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { AxiosInstance, AxiosRequestConfig } from 'axios';
|
|
2
|
-
import { CoreLoginCredentials, CoreRegisterCredentials } from '../types/CoreAuth';
|
|
1
|
+
import { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios';
|
|
2
|
+
import { CoreGetUserResponse, CoreLoginCredentials, CoreRegisterCredentials, CoreUser } from '../types/CoreAuth';
|
|
3
|
+
import { BaseApiResponse } from '../../../types';
|
|
4
|
+
import { BaseService } from '../../../services';
|
|
3
5
|
interface CoreAuthRoutes {
|
|
4
6
|
login: string;
|
|
5
7
|
register: string;
|
|
@@ -10,14 +12,15 @@ interface CoreAuthRoutes {
|
|
|
10
12
|
/**
|
|
11
13
|
* Base class that can be extended by concrete services
|
|
12
14
|
*/
|
|
13
|
-
export declare class CoreAuthBaseService {
|
|
14
|
-
private readonly api;
|
|
15
|
+
export declare class CoreAuthBaseService<T extends CoreUser> extends BaseService {
|
|
15
16
|
private readonly routes;
|
|
16
17
|
constructor(routes?: CoreAuthRoutes, api?: AxiosInstance);
|
|
17
|
-
getUser(): Promise<
|
|
18
|
-
login<T extends CoreLoginCredentials>(credentials: T): Promise<
|
|
19
|
-
register<T extends CoreRegisterCredentials>(credentials: T): Promise<
|
|
20
|
-
logout(config?: AxiosRequestConfig): Promise<
|
|
21
|
-
refreshToken(config?: AxiosRequestConfig): Promise<
|
|
18
|
+
getUser(): Promise<AxiosResponse<BaseApiResponse<CoreGetUserResponse<T>>, any>>;
|
|
19
|
+
login<T extends CoreLoginCredentials>(credentials: T): Promise<AxiosResponse<any, any>>;
|
|
20
|
+
register<T extends CoreRegisterCredentials>(credentials: T): Promise<AxiosResponse<any, any>>;
|
|
21
|
+
logout(config?: AxiosRequestConfig): Promise<AxiosResponse<any, any>>;
|
|
22
|
+
refreshToken(config?: AxiosRequestConfig): Promise<AxiosResponse<any, any>>;
|
|
23
|
+
updateUser(userId: Pick<T, "id">, updateUserData: Partial<T>): Promise<AxiosResponse<BaseApiResponse<T>, any>>;
|
|
24
|
+
deleteUser: (userId: Pick<T, "id">) => Promise<AxiosResponse<BaseApiResponse<null>, any>>;
|
|
22
25
|
}
|
|
23
26
|
export {};
|
|
@@ -3,8 +3,6 @@ export declare const useAuthStore: import('zustand').UseBoundStore<Omit<import('
|
|
|
3
3
|
persist: {
|
|
4
4
|
setOptions: (options: Partial<import('zustand/middleware').PersistOptions<import('../types').CoreAuthStore<CoreUser>, {
|
|
5
5
|
user: CoreUser | null;
|
|
6
|
-
token: string | null;
|
|
7
|
-
refreshToken: string | null;
|
|
8
6
|
isAuthenticated: boolean;
|
|
9
7
|
}>>) => void;
|
|
10
8
|
clearStorage: () => void;
|
|
@@ -14,8 +12,6 @@ export declare const useAuthStore: import('zustand').UseBoundStore<Omit<import('
|
|
|
14
12
|
onFinishHydration: (fn: (state: import('../types').CoreAuthStore<CoreUser>) => void) => () => void;
|
|
15
13
|
getOptions: () => Partial<import('zustand/middleware').PersistOptions<import('../types').CoreAuthStore<CoreUser>, {
|
|
16
14
|
user: CoreUser | null;
|
|
17
|
-
token: string | null;
|
|
18
|
-
refreshToken: string | null;
|
|
19
15
|
isAuthenticated: boolean;
|
|
20
16
|
}>>;
|
|
21
17
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseApiResponse } from '../../../types';
|
|
1
|
+
import { BaseApiResponse, CoreActions } from '../../../types';
|
|
2
2
|
import { BaseStore } from '../../../types/BaseStore';
|
|
3
3
|
import { BaseType } from '../../../types/BaseType';
|
|
4
4
|
export interface CoreUser extends BaseType {
|
|
@@ -17,21 +17,21 @@ export interface CoreRegisterCredentials extends CoreLoginCredentials {
|
|
|
17
17
|
}
|
|
18
18
|
export interface CoreAuthStore<T extends CoreUser> extends BaseStore {
|
|
19
19
|
user: T | null;
|
|
20
|
-
token: string | null;
|
|
21
|
-
refreshToken: string | null;
|
|
22
20
|
isAuthenticated: boolean;
|
|
23
|
-
getUser: () => Promise<T
|
|
21
|
+
getUser: () => Promise<BaseApiResponse<CoreGetUserResponse<T>>>;
|
|
24
22
|
login: <K extends CoreLoginCredentials>(credentials: K) => Promise<BaseApiResponse<CoreAuthLoginResponse<T>>>;
|
|
25
23
|
register: <K extends CoreRegisterCredentials>(credentials: K) => Promise<BaseApiResponse<CoreAuthRegisterResponse<T>>>;
|
|
26
24
|
logout: () => void;
|
|
27
25
|
refreshUserToken: () => Promise<any>;
|
|
28
26
|
setUser: (user: T | null) => void;
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
updateUser: (userId: Pick<T, "id">, updateUserData: Partial<T>, actions?: CoreActions) => void;
|
|
28
|
+
deleteUser: (userId: Pick<T, "id">, actions?: CoreActions) => void;
|
|
31
29
|
}
|
|
32
30
|
export interface CoreAuthLoginResponse<T extends CoreUser> {
|
|
33
31
|
user: T;
|
|
34
|
-
token: string;
|
|
35
32
|
}
|
|
36
33
|
export interface CoreAuthRegisterResponse<T extends CoreUser> extends CoreAuthLoginResponse<T> {
|
|
37
34
|
}
|
|
35
|
+
export interface CoreGetUserResponse<T extends CoreUser> {
|
|
36
|
+
user: T;
|
|
37
|
+
}
|
|
@@ -3,7 +3,7 @@ import { CoreOrderBaseService } from '../services/base';
|
|
|
3
3
|
import { CoreOrder, CoreOrderStore } from '../types/CoreOrder';
|
|
4
4
|
export declare class CoreOrderBuilder<T> implements CoreBuilder {
|
|
5
5
|
protected orderService: CoreOrderBaseService;
|
|
6
|
-
protected initialState: Pick<CoreOrderStore<T>, 'order' | 'loading' | 'error'>;
|
|
6
|
+
protected initialState: Pick<CoreOrderStore<T>, 'order' | 'orders' | 'loading' | 'error'>;
|
|
7
7
|
constructor(orderService?: CoreOrderBaseService, initialState?: any);
|
|
8
8
|
build(): import('zustand').UseBoundStore<Omit<import('zustand').StoreApi<CoreOrderStore<T>>, "persist"> & {
|
|
9
9
|
persist: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseType } from '../../../types/BaseType';
|
|
2
2
|
import { IOrderActions } from './interfaces/OrderActions';
|
|
3
|
-
import { BaseStore } from '../../../types';
|
|
3
|
+
import { BasePagination, BaseStore } from '../../../types';
|
|
4
4
|
/**
|
|
5
5
|
* CoreOrder base type
|
|
6
6
|
*/
|
|
@@ -31,6 +31,7 @@ export interface CoreOrder<T> extends BaseType {
|
|
|
31
31
|
}
|
|
32
32
|
export interface CoreOrderStore<T> extends BaseStore, IOrderActions<T> {
|
|
33
33
|
order: CoreOrder<T>;
|
|
34
|
+
orders: BasePagination<CoreOrder<T>> | null;
|
|
34
35
|
}
|
|
35
36
|
export interface CoreOrderForm extends BaseType {
|
|
36
37
|
customer_name: string;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { AxiosResponse } from 'axios';
|
|
2
|
-
import { BaseApiResponse } from '../../../../types/contracts/BaseApiResponse';
|
|
2
|
+
import { BaseApiResponse, BaseApiResponsePagination } from '../../../../types/contracts/BaseApiResponse';
|
|
3
3
|
import { CoreOrderForm, CoreOrder } from '../CoreOrder';
|
|
4
4
|
export interface IOrderActions<T> {
|
|
5
5
|
createOrder: (order: CoreOrderForm) => Promise<BaseApiResponse<CreateOrderResponse<CoreOrder<T>>>>;
|
|
6
6
|
fetchOrder: (order_id: string | number) => Promise<BaseApiResponse<CoreOrder<T>>>;
|
|
7
7
|
getOrder: () => CoreOrder<T>;
|
|
8
|
+
fetchOrders: (params?: any) => Promise<BaseApiResponsePagination<CoreOrder<T>>>;
|
|
8
9
|
}
|
|
9
10
|
export interface IOrderActionsService<T> {
|
|
10
11
|
createOrder: (order: CoreOrderForm) => Promise<AxiosResponse<BaseApiResponse<CreateOrderResponse<CoreOrder<T>>>>>;
|
|
@@ -10,7 +10,7 @@ export declare class CoreProductBuilder implements CoreBuilder {
|
|
|
10
10
|
persist: {
|
|
11
11
|
setOptions: (options: Partial<import('zustand/middleware').PersistOptions<CoreProductStore<CoreProduct, CoreProductCategory>, {
|
|
12
12
|
productDetails: CoreProduct | null;
|
|
13
|
-
products: import('
|
|
13
|
+
products: import('../../../types').BasePagination<CoreProduct> | null;
|
|
14
14
|
categories: CoreProductCategory[] | null;
|
|
15
15
|
}>>) => void;
|
|
16
16
|
clearStorage: () => void;
|
|
@@ -20,7 +20,7 @@ export declare class CoreProductBuilder implements CoreBuilder {
|
|
|
20
20
|
onFinishHydration: (fn: (state: CoreProductStore<CoreProduct, CoreProductCategory>) => void) => () => void;
|
|
21
21
|
getOptions: () => Partial<import('zustand/middleware').PersistOptions<CoreProductStore<CoreProduct, CoreProductCategory>, {
|
|
22
22
|
productDetails: CoreProduct | null;
|
|
23
|
-
products: import('
|
|
23
|
+
products: import('../../../types').BasePagination<CoreProduct> | null;
|
|
24
24
|
categories: CoreProductCategory[] | null;
|
|
25
25
|
}>>;
|
|
26
26
|
};
|
|
@@ -6,6 +6,7 @@ import { BaseSlugType } from '../../../types/interfaces/BaseSlugType';
|
|
|
6
6
|
import { BaseVisibleType } from '../../../types/interfaces/BaseVisibleType';
|
|
7
7
|
import { CoreProductCategory, HasProductCategories } from './CoreProductCategory';
|
|
8
8
|
import { BaseApiResponse, BaseApiResponsePagination } from '../../../types/contracts/BaseApiResponse';
|
|
9
|
+
import { CoreActions } from '../../../types';
|
|
9
10
|
/**
|
|
10
11
|
* CoreProduct base type
|
|
11
12
|
*/
|
|
@@ -28,7 +29,7 @@ export interface CoreProductStore<T extends CoreProduct, K extends CoreProductCa
|
|
|
28
29
|
setProducts: (products: BasePagination<T> | null) => void;
|
|
29
30
|
setCategories: (categories: K[]) => void;
|
|
30
31
|
setProductDetails: (product: T | null) => void;
|
|
31
|
-
fetchProducts: (params?: Record<string, any
|
|
32
|
+
fetchProducts: (params?: Record<string, any>, actions?: CoreActions) => Promise<BaseApiResponsePagination<T>>;
|
|
32
33
|
getProducts: () => BasePagination<T> | null;
|
|
33
34
|
fetchProductDetails: (id: string | number) => Promise<BaseApiResponse<T>>;
|
|
34
35
|
getProductDetails: () => T | null;
|
|
@@ -44,3 +45,9 @@ export interface CoreProductible extends BaseType {
|
|
|
44
45
|
base_price_per_unit_in_cents: number;
|
|
45
46
|
base_total_in_cents: number;
|
|
46
47
|
}
|
|
48
|
+
export interface GetProductsResponse<T extends CoreProduct> extends BaseApiResponsePagination<T> {
|
|
49
|
+
metadata: {
|
|
50
|
+
min_price: number;
|
|
51
|
+
max_price: number;
|
|
52
|
+
};
|
|
53
|
+
}
|
|
@@ -1,24 +1,26 @@
|
|
|
1
1
|
import { CoreBuilder } from '../../../classes/CoreBuilder';
|
|
2
2
|
import { CoreShipmentBaseService } from '../services/base';
|
|
3
|
-
import { CoreShippingAddress, CoreShipmentStore, CoreShippingMethod, CoreShippingMethodTypes } from '../types/CoreShipment';
|
|
4
|
-
export declare class CoreShipmentBuilder<T extends CoreShippingMethod<Z>, K extends CoreShippingAddress, Z extends CoreShippingMethodTypes> implements CoreBuilder {
|
|
5
|
-
protected shipmentService: CoreShipmentBaseService<T, K, Z>;
|
|
6
|
-
protected initialState: Pick<CoreShipmentStore<T, K, Z>, "shippingMethods" | "shippingAddresses" | "loading" | "error">;
|
|
7
|
-
constructor(service?: CoreShipmentBaseService<T, K, Z>, initialState?: any);
|
|
8
|
-
build(): import('zustand').UseBoundStore<Omit<import('zustand').StoreApi<CoreShipmentStore<T, K, Z>>, "persist"> & {
|
|
3
|
+
import { CoreShippingAddress, CoreShipmentStore, CoreShippingMethod, CoreShippingMethodTypes, CoreShipmentBeneficiary } from '../types/CoreShipment';
|
|
4
|
+
export declare class CoreShipmentBuilder<T extends CoreShippingMethod<Z>, K extends CoreShippingAddress, Z extends CoreShippingMethodTypes, Y extends CoreShipmentBeneficiary> implements CoreBuilder {
|
|
5
|
+
protected shipmentService: CoreShipmentBaseService<T, K, Z, Y>;
|
|
6
|
+
protected initialState: Pick<CoreShipmentStore<T, K, Z, Y>, "shippingMethods" | "shippingAddresses" | "beneficiaries" | "loading" | "error">;
|
|
7
|
+
constructor(service?: CoreShipmentBaseService<T, K, Z, Y>, initialState?: any);
|
|
8
|
+
build(): import('zustand').UseBoundStore<Omit<import('zustand').StoreApi<CoreShipmentStore<T, K, Z, Y>>, "persist"> & {
|
|
9
9
|
persist: {
|
|
10
|
-
setOptions: (options: Partial<import('zustand/middleware').PersistOptions<CoreShipmentStore<T, K, Z>, {
|
|
10
|
+
setOptions: (options: Partial<import('zustand/middleware').PersistOptions<CoreShipmentStore<T, K, Z, Y>, {
|
|
11
11
|
shippingMethods: T[] | null;
|
|
12
|
-
shippingAddresses: import('
|
|
12
|
+
shippingAddresses: import('../../../types').BasePagination<K> | null;
|
|
13
|
+
beneficiaries: import('../../../types').BasePagination<Y> | null;
|
|
13
14
|
}>>) => void;
|
|
14
15
|
clearStorage: () => void;
|
|
15
16
|
rehydrate: () => Promise<void> | void;
|
|
16
17
|
hasHydrated: () => boolean;
|
|
17
|
-
onHydrate: (fn: (state: CoreShipmentStore<T, K, Z>) => void) => () => void;
|
|
18
|
-
onFinishHydration: (fn: (state: CoreShipmentStore<T, K, Z>) => void) => () => void;
|
|
19
|
-
getOptions: () => Partial<import('zustand/middleware').PersistOptions<CoreShipmentStore<T, K, Z>, {
|
|
18
|
+
onHydrate: (fn: (state: CoreShipmentStore<T, K, Z, Y>) => void) => () => void;
|
|
19
|
+
onFinishHydration: (fn: (state: CoreShipmentStore<T, K, Z, Y>) => void) => () => void;
|
|
20
|
+
getOptions: () => Partial<import('zustand/middleware').PersistOptions<CoreShipmentStore<T, K, Z, Y>, {
|
|
20
21
|
shippingMethods: T[] | null;
|
|
21
|
-
shippingAddresses: import('
|
|
22
|
+
shippingAddresses: import('../../../types').BasePagination<K> | null;
|
|
23
|
+
beneficiaries: import('../../../types').BasePagination<Y> | null;
|
|
22
24
|
}>>;
|
|
23
25
|
};
|
|
24
26
|
}>;
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import { BaseService } from '../../../services/base';
|
|
2
|
-
import { CoreShippingAddress, CoreShippingAddressForm, CoreShippingMethod, CoreShippingMethodTypes } from '../types/CoreShipment';
|
|
2
|
+
import { CoreShipmentBeneficiary, CoreShipmentBeneficiaryForm, CoreShippingAddress, CoreShippingAddressForm, CoreShippingMethod, CoreShippingMethodTypes } from '../types/CoreShipment';
|
|
3
3
|
import { BaseApiResponse, BaseApiResponsePagination } from '../../../types';
|
|
4
4
|
/**
|
|
5
5
|
* Base class that can be extended by concrete services
|
|
6
6
|
*/
|
|
7
|
-
export declare class CoreShipmentBaseService<T extends CoreShippingMethod<Z>, K extends CoreShippingAddress, Z extends CoreShippingMethodTypes> extends BaseService {
|
|
7
|
+
export declare class CoreShipmentBaseService<T extends CoreShippingMethod<Z>, K extends CoreShippingAddress, Z extends CoreShippingMethodTypes, Y extends CoreShipmentBeneficiary> extends BaseService {
|
|
8
8
|
constructor();
|
|
9
9
|
getShippingMethods(): Promise<import('axios').AxiosResponse<BaseApiResponse<T[]>, any>>;
|
|
10
10
|
getShippingAddresses(params?: Record<string, any>): Promise<import('axios').AxiosResponse<BaseApiResponsePagination<K>, any>>;
|
|
11
11
|
addShippingAddress<T extends CoreShippingAddressForm>(newAddress: T): Promise<import('axios').AxiosResponse<BaseApiResponse<K>, any>>;
|
|
12
12
|
updateShippingAddress(addressId: Pick<K, 'id'>, updateAddress: Partial<K>): Promise<import('axios').AxiosResponse<BaseApiResponse<K>, any>>;
|
|
13
|
+
deleteShippingAddress: (addressId: Pick<K, "id">) => Promise<import('axios').AxiosResponse<BaseApiResponse<null>, any>>;
|
|
14
|
+
getBeneficiaries: (params?: Record<string, any>) => Promise<import('axios').AxiosResponse<BaseApiResponsePagination<Y>, any>>;
|
|
15
|
+
addBeneficiary<X extends CoreShipmentBeneficiaryForm>(newBeneficiary: X): Promise<import('axios').AxiosResponse<BaseApiResponse<Y>, any>>;
|
|
16
|
+
updateBeneficiary<X extends CoreShipmentBeneficiaryForm>(beneficiaryId: Pick<Y, 'id'>, updateBeneficiary: X): Promise<import('axios').AxiosResponse<BaseApiResponse<Y>, any>>;
|
|
17
|
+
deleteBeneficiary(beneficiaryId: Pick<Y, 'id'>): Promise<import('axios').AxiosResponse<BaseApiResponse<null>, any>>;
|
|
13
18
|
}
|
|
@@ -1,15 +1,22 @@
|
|
|
1
|
-
import { BaseApiResponse, BaseApiResponsePagination, BasePagination, BaseStore } from '../../../types';
|
|
1
|
+
import { BaseApiResponse, BaseApiResponsePagination, BasePagination, BaseStore, CoreActions } from '../../../types';
|
|
2
2
|
import { BaseType } from '../../../types/BaseType';
|
|
3
|
-
export interface CoreShipmentStore<T extends CoreShippingMethod<Z>, K extends CoreShippingAddress, Z extends CoreShippingMethodTypes> extends BaseStore {
|
|
3
|
+
export interface CoreShipmentStore<T extends CoreShippingMethod<Z>, K extends CoreShippingAddress, Z extends CoreShippingMethodTypes, Y extends CoreShipmentBeneficiary> extends BaseStore {
|
|
4
4
|
shippingMethods: T[] | null;
|
|
5
5
|
shippingAddresses: BasePagination<K> | null;
|
|
6
|
+
beneficiaries: BasePagination<Y> | null;
|
|
6
7
|
setShippingMethods: (shippingMethods: T[] | null) => void;
|
|
7
8
|
getShippingMethods: () => T[] | null;
|
|
8
9
|
fetchShippingMethods: () => Promise<BaseApiResponse<T[]>>;
|
|
9
10
|
setShippingAddresses: (shippingAddresses: BasePagination<K> | null) => void;
|
|
10
11
|
getShippingAddresses: () => BasePagination<K> | null;
|
|
11
|
-
fetchShippingAddresses: (params?: Record<string, any
|
|
12
|
-
addShippingAddress: (newAddress:
|
|
12
|
+
fetchShippingAddresses: (params?: Record<string, any>, actions?: CoreActions) => Promise<BaseApiResponsePagination<K>>;
|
|
13
|
+
addShippingAddress: <X extends CoreShippingAddressForm>(newAddress: X, params?: Record<string, any>, actions?: CoreActions) => void;
|
|
14
|
+
updateShippingAddress: (addressId: Pick<K, 'id'>, updateAddress: Partial<K>, params?: Record<string, any>, actions?: CoreActions) => void;
|
|
15
|
+
deleteShippingAddress: (addressId: Pick<K, 'id'>, params?: Record<string, any>, actions?: CoreActions) => void;
|
|
16
|
+
fetchBeneficiaries: (params?: Record<string, any>, actions?: CoreActions) => Promise<BaseApiResponsePagination<Y>>;
|
|
17
|
+
addBeneficiary: <X extends CoreShipmentBeneficiaryForm>(newBeneficiary: X, params?: Record<string, any>, actions?: CoreActions) => void;
|
|
18
|
+
updateBeneficiary: (beneficiaryId: Pick<Y, 'id'>, updateBeneficiary: CoreShipmentBeneficiaryForm, params?: Record<string, any>, actions?: CoreActions) => void;
|
|
19
|
+
deleteBeneficiary: (beneficiaryId: Pick<Y, 'id'>, params?: Record<string, any>, actions?: CoreActions) => void;
|
|
13
20
|
}
|
|
14
21
|
export interface CoreShippingMethod<T extends CoreShippingMethodTypes> extends BaseType {
|
|
15
22
|
name: string;
|
|
@@ -39,7 +46,7 @@ export interface CoreShippingAddress extends BaseType {
|
|
|
39
46
|
export interface CoreShippingAddressLocalPickup extends CoreShippingAddress {
|
|
40
47
|
}
|
|
41
48
|
export interface CoreShippingAddressHomeDelivery extends CoreShippingAddress {
|
|
42
|
-
label
|
|
49
|
+
label?: string;
|
|
43
50
|
is_default: boolean;
|
|
44
51
|
}
|
|
45
52
|
export interface CoreShippingAddressProvinceMunicipality extends CoreShippingAddressHomeDelivery {
|
|
@@ -57,3 +64,15 @@ export interface CoreShippingAddressProvinceMunicipalityForm extends CoreShippin
|
|
|
57
64
|
province: string;
|
|
58
65
|
municipality: string;
|
|
59
66
|
}
|
|
67
|
+
export interface CoreShipmentBeneficiary extends BaseType {
|
|
68
|
+
name: string;
|
|
69
|
+
email: string;
|
|
70
|
+
phone: string;
|
|
71
|
+
is_default: boolean;
|
|
72
|
+
}
|
|
73
|
+
export interface CoreShipmentBeneficiaryForm {
|
|
74
|
+
name: string;
|
|
75
|
+
email: string;
|
|
76
|
+
phone: string;
|
|
77
|
+
is_default: boolean;
|
|
78
|
+
}
|