ingeniuscliq-core 0.4.10 → 0.4.12
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
|
@@ -2570,6 +2570,7 @@ class v4 {
|
|
|
2570
2570
|
productDetails: null,
|
|
2571
2571
|
products: null,
|
|
2572
2572
|
categories: null,
|
|
2573
|
+
bestSellers: null,
|
|
2573
2574
|
loading: !1,
|
|
2574
2575
|
error: null
|
|
2575
2576
|
});
|
|
@@ -2620,16 +2621,16 @@ class v4 {
|
|
|
2620
2621
|
throw t((a) => ({ ...a, error: o, loading: !1 })), o;
|
|
2621
2622
|
}
|
|
2622
2623
|
},
|
|
2623
|
-
|
|
2624
|
+
fetchBestSellers: async (r, { onSuccess: o = () => {
|
|
2624
2625
|
}, onError: a = () => {
|
|
2625
2626
|
}, onFinish: s = () => {
|
|
2626
2627
|
} } = {}) => {
|
|
2627
2628
|
try {
|
|
2628
2629
|
t({ loading: !0, error: null });
|
|
2629
2630
|
const i = await this.productService.bestSellers(r);
|
|
2630
|
-
return t({ loading: !1 }), o(i), i.data;
|
|
2631
|
+
return t({ loading: !1, bestSellers: i.data.data }), o(i), i.data;
|
|
2631
2632
|
} catch (i) {
|
|
2632
|
-
throw t((c) => ({ ...c, error: i, loading: !1 })), a(i), i;
|
|
2633
|
+
throw t((c) => ({ ...c, error: i, loading: !1, bestSellers: null })), a(i), i;
|
|
2633
2634
|
} finally {
|
|
2634
2635
|
s();
|
|
2635
2636
|
}
|
|
@@ -4,7 +4,7 @@ import { CoreProduct, CoreProductStore } from '../types/CoreProduct';
|
|
|
4
4
|
import { CoreProductCategory } from '../types';
|
|
5
5
|
export declare class CoreProductBuilder<T extends CoreProduct, K extends CoreProductCategory> implements CoreBuilder {
|
|
6
6
|
protected productService: CoreProductBaseService;
|
|
7
|
-
protected initialState: Pick<CoreProductStore<T, K>, "productDetails" | "products" | "categories" | "loading" | "error">;
|
|
7
|
+
protected initialState: Pick<CoreProductStore<T, K>, "productDetails" | "products" | "categories" | "bestSellers" | "loading" | "error">;
|
|
8
8
|
constructor(service?: CoreProductBaseService, initialState?: any);
|
|
9
9
|
build(): import('zustand').UseBoundStore<Omit<import('zustand').StoreApi<CoreProductStore<T, K>>, "persist"> & {
|
|
10
10
|
persist: {
|
|
@@ -26,6 +26,7 @@ export interface CoreProductStore<T extends CoreProduct, K extends CoreProductCa
|
|
|
26
26
|
productDetails: T | null;
|
|
27
27
|
products: BasePagination<T> | null;
|
|
28
28
|
categories: K[] | null;
|
|
29
|
+
bestSellers: T[] | null;
|
|
29
30
|
setProducts: (products: BasePagination<T> | null) => void;
|
|
30
31
|
setCategories: (categories: K[]) => void;
|
|
31
32
|
setProductDetails: (product: T | null) => void;
|
|
@@ -35,7 +36,7 @@ export interface CoreProductStore<T extends CoreProduct, K extends CoreProductCa
|
|
|
35
36
|
getProductDetails: () => T | null;
|
|
36
37
|
fetchCategories: (params?: Record<string, any>) => Promise<BaseApiResponse<K[]>>;
|
|
37
38
|
getCategories: () => K[] | null;
|
|
38
|
-
|
|
39
|
+
fetchBestSellers: (params?: Record<string, any>, actions?: CoreActions) => Promise<BaseApiResponse<T[]>>;
|
|
39
40
|
}
|
|
40
41
|
export interface CoreProductible extends BaseType {
|
|
41
42
|
order_id: number;
|