ingeniuscliq-core 0.4.20 → 0.4.21
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/modules/CoreCustomization/classes/CoreCustomizationBuilder.d.ts.map +1 -1
- package/dist/modules/CoreCustomization/classes/CoreCustomizationBuilder.js +29 -15
- package/dist/modules/CoreOrder/classes/CoreOrderBuilder.d.ts.map +1 -1
- package/dist/modules/CoreOrder/classes/CoreOrderBuilder.js +14 -7
- package/dist/modules/CorePayForm/classes/CorePayFormBuilder.d.ts.map +1 -1
- package/dist/modules/CorePayForm/classes/CorePayFormBuilder.js +14 -7
- package/dist/modules/CoreProduct/classes/CoreProductBuilder.d.ts.map +1 -1
- package/dist/modules/CoreProduct/classes/CoreProductBuilder.js +33 -12
- package/dist/modules/CoreShipment/classes/CoreShipmentBuilder.d.ts.map +1 -1
- package/dist/modules/CoreShipment/classes/CoreShipmentBuilder.js +33 -12
- package/dist/modules/CoreShopCart/classes/CoreShopCartBuilder.d.ts.map +1 -1
- package/dist/modules/CoreShopCart/classes/CoreShopCartBuilder.js +11 -4
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoreCustomizationBuilder.d.ts","sourceRoot":"","sources":["../../../../src/modules/CoreCustomization/classes/CoreCustomizationBuilder.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,4BAA4B,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAE3D,qBAAa,wBAAyB,YAAW,WAAW;IAC1D,SAAS,CAAC,oBAAoB,EAAE,4BAA4B,CAAC;IAC7D,SAAS,CAAC,YAAY,EAOjB,IAAI,CAAC,sBAAsB,EAAE,UAAU,GAAG,YAAY,GAAG,QAAQ,GAAG,UAAU,GAAG,SAAS,GAAG,OAAO,CAAC,CAAC;gBAGzG,OAAO,GAAE,4BAAiE,EAC1E,YAAY,CAAC,EAAE,OAAO,CAAC,sBAAsB,CAAC;IAQzC,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"CoreCustomizationBuilder.d.ts","sourceRoot":"","sources":["../../../../src/modules/CoreCustomization/classes/CoreCustomizationBuilder.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,4BAA4B,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAE3D,qBAAa,wBAAyB,YAAW,WAAW;IAC1D,SAAS,CAAC,oBAAoB,EAAE,4BAA4B,CAAC;IAC7D,SAAS,CAAC,YAAY,EAOjB,IAAI,CAAC,sBAAsB,EAAE,UAAU,GAAG,YAAY,GAAG,QAAQ,GAAG,UAAU,GAAG,SAAS,GAAG,OAAO,CAAC,CAAC;gBAGzG,OAAO,GAAE,4BAAiE,EAC1E,YAAY,CAAC,EAAE,OAAO,CAAC,sBAAsB,CAAC;IAQzC,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwFb"}
|
|
@@ -31,34 +31,48 @@ class CoreCustomizationBuilder {
|
|
|
31
31
|
setStyles: (styles) => set({ styles }),
|
|
32
32
|
setSettings: (settings) => set({ settings }),
|
|
33
33
|
// Actions
|
|
34
|
-
fetchTemplate: async () => {
|
|
34
|
+
fetchTemplate: async (params) => {
|
|
35
|
+
const { onlyFetch } = params || {};
|
|
35
36
|
try {
|
|
36
|
-
|
|
37
|
+
if (!onlyFetch) {
|
|
38
|
+
set({ loading: true, error: null });
|
|
39
|
+
}
|
|
37
40
|
const response = await this.customizationService.fetchTemplate();
|
|
38
41
|
const template = response.data.data;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
if (!onlyFetch) {
|
|
43
|
+
set({
|
|
44
|
+
template: template.template || null,
|
|
45
|
+
styles: template.styles || null,
|
|
46
|
+
loading: false
|
|
47
|
+
});
|
|
48
|
+
}
|
|
44
49
|
return template;
|
|
45
50
|
} catch (error) {
|
|
46
|
-
|
|
51
|
+
if (!onlyFetch) {
|
|
52
|
+
set({ loading: false, error });
|
|
53
|
+
}
|
|
47
54
|
throw error;
|
|
48
55
|
}
|
|
49
56
|
},
|
|
50
|
-
fetchSettings: async () => {
|
|
57
|
+
fetchSettings: async (params) => {
|
|
58
|
+
const { onlyFetch } = params || {};
|
|
51
59
|
try {
|
|
52
|
-
|
|
60
|
+
if (!onlyFetch) {
|
|
61
|
+
set({ loading: true, error: null });
|
|
62
|
+
}
|
|
53
63
|
const response = await this.customizationService.fetchSettings();
|
|
54
64
|
const settings = response.data.data.configuration;
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
65
|
+
if (!onlyFetch) {
|
|
66
|
+
set({
|
|
67
|
+
settings,
|
|
68
|
+
loading: false
|
|
69
|
+
});
|
|
70
|
+
}
|
|
59
71
|
return settings;
|
|
60
72
|
} catch (error) {
|
|
61
|
-
|
|
73
|
+
if (!onlyFetch) {
|
|
74
|
+
set({ loading: false, error });
|
|
75
|
+
}
|
|
62
76
|
throw error;
|
|
63
77
|
}
|
|
64
78
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoreOrderBuilder.d.ts","sourceRoot":"","sources":["../../../../src/modules/CoreOrder/classes/CoreOrderBuilder.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,cAAc,EAAiB,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAG3D,qBAAa,gBAAgB,CAAC,CAAC,CAAE,YAAW,WAAW;IACrD,SAAS,CAAC,YAAY,EAAE,oBAAoB,CAAC;IAC7C,SAAS,CAAC,YAAY,EAKjB,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,SAAS,GAAG,OAAO,CAAC,CAAC;gBAGrE,YAAY,GAAE,oBAAiD,EAC/D,YAAY,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;IAQpC,KAAK;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"CoreOrderBuilder.d.ts","sourceRoot":"","sources":["../../../../src/modules/CoreOrder/classes/CoreOrderBuilder.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,cAAc,EAAiB,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAG3D,qBAAa,gBAAgB,CAAC,CAAC,CAAE,YAAW,WAAW;IACrD,SAAS,CAAC,YAAY,EAAE,oBAAoB,CAAC;IAC7C,SAAS,CAAC,YAAY,EAKjB,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,SAAS,GAAG,OAAO,CAAC,CAAC;gBAGrE,YAAY,GAAE,oBAAiD,EAC/D,YAAY,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;IAQpC,KAAK;;;;;;;;;;;;;;;CAmHb"}
|
|
@@ -78,18 +78,25 @@ class CoreOrderBuilder {
|
|
|
78
78
|
}, onError = () => {
|
|
79
79
|
}, onFinish = () => {
|
|
80
80
|
} } = actions || {};
|
|
81
|
+
const { onlyFetch, ...queryParams } = params || {};
|
|
81
82
|
try {
|
|
82
|
-
|
|
83
|
-
|
|
83
|
+
if (!onlyFetch) {
|
|
84
|
+
set({ loading: true, error: null });
|
|
85
|
+
}
|
|
86
|
+
const response = await this.orderService.fetchOrders(queryParams);
|
|
84
87
|
const orders = response.data.data;
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
88
|
+
if (!onlyFetch) {
|
|
89
|
+
set({
|
|
90
|
+
orders,
|
|
91
|
+
loading: false
|
|
92
|
+
});
|
|
93
|
+
}
|
|
89
94
|
onSuccess(response);
|
|
90
95
|
return response.data;
|
|
91
96
|
} catch (error) {
|
|
92
|
-
|
|
97
|
+
if (!onlyFetch) {
|
|
98
|
+
set({ loading: false, error });
|
|
99
|
+
}
|
|
93
100
|
onError(error);
|
|
94
101
|
throw error;
|
|
95
102
|
} finally {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CorePayFormBuilder.d.ts","sourceRoot":"","sources":["../../../../src/modules/CorePayForm/classes/CorePayFormBuilder.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAG3D,qBAAa,kBAAkB,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW,CAAE,YAAW,WAAW;IACzF,SAAS,CAAC,cAAc,EAAE,sBAAsB,CAAC;IACjD,SAAS,CAAC,YAAY,EAIjB,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,UAAU,GAAG,SAAS,GAAG,OAAO,CAAC,CAAC;gBAG/D,OAAO,GAAE,sBAAqD,EAC9D,YAAY,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC;IAQtC,KAAK;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"CorePayFormBuilder.d.ts","sourceRoot":"","sources":["../../../../src/modules/CorePayForm/classes/CorePayFormBuilder.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAG3D,qBAAa,kBAAkB,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW,CAAE,YAAW,WAAW;IACzF,SAAS,CAAC,cAAc,EAAE,sBAAsB,CAAC;IACjD,SAAS,CAAC,YAAY,EAIjB,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,UAAU,GAAG,SAAS,GAAG,OAAO,CAAC,CAAC;gBAG/D,OAAO,GAAE,sBAAqD,EAC9D,YAAY,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC;IAQtC,KAAK;;;;;;;;;;;;;;;CA+Db"}
|
|
@@ -32,18 +32,25 @@ class CorePayFormBuilder {
|
|
|
32
32
|
}, onError = () => {
|
|
33
33
|
}, onFinish = () => {
|
|
34
34
|
} } = actions || {};
|
|
35
|
+
const { onlyFetch, ...queryParams } = params || {};
|
|
35
36
|
try {
|
|
36
|
-
|
|
37
|
-
|
|
37
|
+
if (!onlyFetch) {
|
|
38
|
+
set({ loading: true, error: null });
|
|
39
|
+
}
|
|
40
|
+
const response = await this.payFormService.fetchPayForms(queryParams);
|
|
38
41
|
const payForms = response.data.data;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
if (!onlyFetch) {
|
|
43
|
+
set({
|
|
44
|
+
payForms,
|
|
45
|
+
loading: false
|
|
46
|
+
});
|
|
47
|
+
}
|
|
43
48
|
onSuccess(response);
|
|
44
49
|
return payForms;
|
|
45
50
|
} catch (error) {
|
|
46
|
-
|
|
51
|
+
if (!onlyFetch) {
|
|
52
|
+
set({ loading: false, error });
|
|
53
|
+
}
|
|
47
54
|
onError(error);
|
|
48
55
|
throw error;
|
|
49
56
|
} finally {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoreProductBuilder.d.ts","sourceRoot":"","sources":["../../../../src/modules/CoreProduct/classes/CoreProductBuilder.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC1E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAExE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAGhE,qBAAa,kBAAkB,CAC7B,CAAC,SAAS,WAAW,GAAG,WAAW,EACnC,CAAC,SAAS,mBAAmB,GAAG,mBAAmB,CACnD,YAAW,WAAW;IACtB,SAAS,CAAC,cAAc,EAAE,sBAAsB,CAAC;IACjD,SAAS,CAAC,YAAY,EAOjB,IAAI,CAAC,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,gBAAgB,GAAG,UAAU,GAAG,YAAY,GAAG,aAAa,GAAG,SAAS,GAAG,OAAO,CAAC,CAAC;gBAGpH,OAAO,GAAE,sBAAqD,EAC9D,YAAY,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAQzC,KAAK;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"CoreProductBuilder.d.ts","sourceRoot":"","sources":["../../../../src/modules/CoreProduct/classes/CoreProductBuilder.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC1E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAExE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAGhE,qBAAa,kBAAkB,CAC7B,CAAC,SAAS,WAAW,GAAG,WAAW,EACnC,CAAC,SAAS,mBAAmB,GAAG,mBAAmB,CACnD,YAAW,WAAW;IACtB,SAAS,CAAC,cAAc,EAAE,sBAAsB,CAAC;IACjD,SAAS,CAAC,YAAY,EAOjB,IAAI,CAAC,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,gBAAgB,GAAG,UAAU,GAAG,YAAY,GAAG,aAAa,GAAG,SAAS,GAAG,OAAO,CAAC,CAAC;gBAGpH,OAAO,GAAE,sBAAqD,EAC9D,YAAY,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAQzC,KAAK;;;;;;;;;;;;;;;;;;;;;CAyIb"}
|
|
@@ -39,14 +39,21 @@ class CoreProductBuilder {
|
|
|
39
39
|
}, onError = () => {
|
|
40
40
|
}, onFinish = () => {
|
|
41
41
|
} } = actions || {};
|
|
42
|
+
const { onlyFetch, ...queryParams } = params || {};
|
|
42
43
|
try {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
if (!onlyFetch) {
|
|
45
|
+
set({ loading: true, error: null });
|
|
46
|
+
}
|
|
47
|
+
const response = await this.productService.getAllProducts(queryParams);
|
|
48
|
+
if (!onlyFetch) {
|
|
49
|
+
set({ products: response.data.data, loading: false });
|
|
50
|
+
}
|
|
46
51
|
onSuccess(response);
|
|
47
52
|
return response.data;
|
|
48
53
|
} catch (error) {
|
|
49
|
-
|
|
54
|
+
if (!onlyFetch) {
|
|
55
|
+
set((state) => ({ ...state, error, loading: false }));
|
|
56
|
+
}
|
|
50
57
|
onError(error);
|
|
51
58
|
throw error;
|
|
52
59
|
} finally {
|
|
@@ -72,13 +79,20 @@ class CoreProductBuilder {
|
|
|
72
79
|
}
|
|
73
80
|
},
|
|
74
81
|
fetchCategories: async (params) => {
|
|
82
|
+
const { onlyFetch, ...queryParams } = params || {};
|
|
75
83
|
try {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
84
|
+
if (!onlyFetch) {
|
|
85
|
+
set({ loading: true, error: null });
|
|
86
|
+
}
|
|
87
|
+
const response = await this.productService.getAllCategories(queryParams);
|
|
88
|
+
if (!onlyFetch) {
|
|
89
|
+
set({ categories: response.data.data, loading: false });
|
|
90
|
+
}
|
|
79
91
|
return response.data;
|
|
80
92
|
} catch (error) {
|
|
81
|
-
|
|
93
|
+
if (!onlyFetch) {
|
|
94
|
+
set((state) => ({ ...state, error, loading: false }));
|
|
95
|
+
}
|
|
82
96
|
throw error;
|
|
83
97
|
}
|
|
84
98
|
},
|
|
@@ -87,14 +101,21 @@ class CoreProductBuilder {
|
|
|
87
101
|
}, onError = () => {
|
|
88
102
|
}, onFinish = () => {
|
|
89
103
|
} } = actions || {};
|
|
104
|
+
const { onlyFetch, ...queryParams } = params || {};
|
|
90
105
|
try {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
106
|
+
if (!onlyFetch) {
|
|
107
|
+
set({ loading: true, error: null });
|
|
108
|
+
}
|
|
109
|
+
const response = await this.productService.fetchBestSellers(queryParams);
|
|
110
|
+
if (!onlyFetch) {
|
|
111
|
+
set({ loading: false, bestSellers: response.data.data });
|
|
112
|
+
}
|
|
94
113
|
onSuccess(response);
|
|
95
114
|
return response.data;
|
|
96
115
|
} catch (error) {
|
|
97
|
-
|
|
116
|
+
if (!onlyFetch) {
|
|
117
|
+
set((state) => ({ ...state, error, loading: false, bestSellers: null }));
|
|
118
|
+
}
|
|
98
119
|
onError(error);
|
|
99
120
|
throw error;
|
|
100
121
|
} finally {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoreShipmentBuilder.d.ts","sourceRoot":"","sources":["../../../../src/modules/CoreShipment/classes/CoreShipmentBuilder.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,uBAAuB,EACvB,uBAAuB,EAGxB,MAAM,uBAAuB,CAAC;AAG/B,qBAAa,mBAAmB,CAC9B,CAAC,SAAS,kBAAkB,CAAC,CAAC,CAAC,EAC/B,CAAC,SAAS,mBAAmB,EAC7B,CAAC,SAAS,uBAAuB,EACjC,CAAC,SAAS,uBAAuB,CACjC,YAAW,WAAW;IACtB,SAAS,CAAC,eAAe,EAAE,uBAAuB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAC/D,SAAS,CAAC,YAAY,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,iBAAiB,GAAG,mBAAmB,GAAG,eAAe,GAAG,SAAS,GAAG,OAAO,CAAC,CAAC;gBAG3I,OAAO,CAAC,EAAE,uBAAuB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAC7C,YAAY,CAAC,EAAE,GAAG;IAYb,KAAK;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"CoreShipmentBuilder.d.ts","sourceRoot":"","sources":["../../../../src/modules/CoreShipment/classes/CoreShipmentBuilder.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,uBAAuB,EACvB,uBAAuB,EAGxB,MAAM,uBAAuB,CAAC;AAG/B,qBAAa,mBAAmB,CAC9B,CAAC,SAAS,kBAAkB,CAAC,CAAC,CAAC,EAC/B,CAAC,SAAS,mBAAmB,EAC7B,CAAC,SAAS,uBAAuB,EACjC,CAAC,SAAS,uBAAuB,CACjC,YAAW,WAAW;IACtB,SAAS,CAAC,eAAe,EAAE,uBAAuB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAC/D,SAAS,CAAC,YAAY,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,iBAAiB,GAAG,mBAAmB,GAAG,eAAe,GAAG,SAAS,GAAG,OAAO,CAAC,CAAC;gBAG3I,OAAO,CAAC,EAAE,uBAAuB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAC7C,YAAY,CAAC,EAAE,GAAG;IAYb,KAAK;;;;;;;;;;;;;;;;;;;CAsNb"}
|
|
@@ -23,14 +23,21 @@ class CoreShipmentBuilder {
|
|
|
23
23
|
// Shipping Methods
|
|
24
24
|
setShippingMethods: (shippingMethods) => set({ shippingMethods }),
|
|
25
25
|
getShippingMethods: () => get().shippingMethods,
|
|
26
|
-
fetchShippingMethods: async () => {
|
|
27
|
-
|
|
26
|
+
fetchShippingMethods: async (params) => {
|
|
27
|
+
const { onlyFetch } = params || {};
|
|
28
28
|
try {
|
|
29
|
+
if (!onlyFetch) {
|
|
30
|
+
set({ loading: true, error: null });
|
|
31
|
+
}
|
|
29
32
|
const response = await this.shipmentService.getShippingMethods();
|
|
30
|
-
|
|
33
|
+
if (!onlyFetch) {
|
|
34
|
+
set({ shippingMethods: response.data.data, loading: false });
|
|
35
|
+
}
|
|
31
36
|
return response.data;
|
|
32
37
|
} catch (error) {
|
|
33
|
-
|
|
38
|
+
if (!onlyFetch) {
|
|
39
|
+
set({ error: error || "Failed to fetch shipping methods", loading: false });
|
|
40
|
+
}
|
|
34
41
|
throw error;
|
|
35
42
|
}
|
|
36
43
|
},
|
|
@@ -38,14 +45,21 @@ class CoreShipmentBuilder {
|
|
|
38
45
|
setShippingAddresses: (shippingAddresses) => set({ shippingAddresses }),
|
|
39
46
|
getShippingAddresses: () => get().shippingAddresses,
|
|
40
47
|
fetchShippingAddresses: async (params, actions) => {
|
|
41
|
-
|
|
48
|
+
const { onlyFetch, ...queryParams } = params || {};
|
|
42
49
|
try {
|
|
43
|
-
|
|
44
|
-
|
|
50
|
+
if (!onlyFetch) {
|
|
51
|
+
set({ loading: true, error: null });
|
|
52
|
+
}
|
|
53
|
+
const response = await this.shipmentService.getShippingAddresses(queryParams);
|
|
54
|
+
if (!onlyFetch) {
|
|
55
|
+
set({ shippingAddresses: response.data.data, loading: false });
|
|
56
|
+
}
|
|
45
57
|
actions?.onSuccess?.(response.data);
|
|
46
58
|
return response.data;
|
|
47
59
|
} catch (error) {
|
|
48
|
-
|
|
60
|
+
if (!onlyFetch) {
|
|
61
|
+
set({ error: error || "Failed to fetch shipping addresses", loading: false });
|
|
62
|
+
}
|
|
49
63
|
actions?.onError?.(error);
|
|
50
64
|
throw error;
|
|
51
65
|
} finally {
|
|
@@ -96,14 +110,21 @@ class CoreShipmentBuilder {
|
|
|
96
110
|
},
|
|
97
111
|
// Beneficiaries
|
|
98
112
|
fetchBeneficiaries: async (params, actions) => {
|
|
99
|
-
|
|
113
|
+
const { onlyFetch, ...queryParams } = params || {};
|
|
100
114
|
try {
|
|
101
|
-
|
|
102
|
-
|
|
115
|
+
if (!onlyFetch) {
|
|
116
|
+
set({ loading: true, error: null });
|
|
117
|
+
}
|
|
118
|
+
const response = await this.shipmentService.getBeneficiaries(queryParams);
|
|
119
|
+
if (!onlyFetch) {
|
|
120
|
+
set({ beneficiaries: response.data.data, loading: false });
|
|
121
|
+
}
|
|
103
122
|
actions?.onSuccess?.(response.data);
|
|
104
123
|
return response.data;
|
|
105
124
|
} catch (error) {
|
|
106
|
-
|
|
125
|
+
if (!onlyFetch) {
|
|
126
|
+
set({ error: error || "Failed to fetch beneficiaries", loading: false });
|
|
127
|
+
}
|
|
107
128
|
actions?.onError?.(error);
|
|
108
129
|
throw error;
|
|
109
130
|
} finally {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoreShopCartBuilder.d.ts","sourceRoot":"","sources":["../../../../src/modules/CoreShopCart/classes/CoreShopCartBuilder.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAEhE,qBAAa,mBAAmB,CAAC,CAAC,CAAE,YAAW,WAAW;IACxD,SAAS,CAAC,eAAe,EAAE,uBAAuB,CAAC,CAAC,CAAC,CAAC;IACtD,SAAS,CAAC,YAAY,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,GAAG,OAAO,CAAC,CAAC;gBAG7F,OAAO,GAAE,uBAAuB,CAAC,CAAC,CAAoC,EACtE,YAAY;;;;;;;;;;KAUX;IAMI,KAAK;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"CoreShopCartBuilder.d.ts","sourceRoot":"","sources":["../../../../src/modules/CoreShopCart/classes/CoreShopCartBuilder.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAEhE,qBAAa,mBAAmB,CAAC,CAAC,CAAE,YAAW,WAAW;IACxD,SAAS,CAAC,eAAe,EAAE,uBAAuB,CAAC,CAAC,CAAC,CAAC;IACtD,SAAS,CAAC,YAAY,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,GAAG,OAAO,CAAC,CAAC;gBAG7F,OAAO,GAAE,uBAAuB,CAAC,CAAC,CAAoC,EACtE,YAAY;;;;;;;;;;KAUX;IAMI,KAAK;;;;;;;;;;;;;;;;;CA2Kb"}
|
|
@@ -133,15 +133,22 @@ class CoreShopCartBuilder {
|
|
|
133
133
|
}
|
|
134
134
|
},
|
|
135
135
|
// Fetch cart items only
|
|
136
|
-
fetchCartItems: async (actions) => {
|
|
137
|
-
|
|
136
|
+
fetchCartItems: async (params, actions) => {
|
|
137
|
+
const { onlyFetch } = params || {};
|
|
138
138
|
try {
|
|
139
|
+
if (!onlyFetch) {
|
|
140
|
+
set({ loading: true, error: null });
|
|
141
|
+
}
|
|
139
142
|
const response = await this.shopCartService.getCartItems();
|
|
140
|
-
|
|
143
|
+
if (!onlyFetch) {
|
|
144
|
+
set({ cartItems: response.data.data, loading: false });
|
|
145
|
+
}
|
|
141
146
|
actions?.onSuccess?.(response.data);
|
|
142
147
|
return response.data;
|
|
143
148
|
} catch (error) {
|
|
144
|
-
|
|
149
|
+
if (!onlyFetch) {
|
|
150
|
+
set({ error: error || "Failed to fetch cart items", loading: false });
|
|
151
|
+
}
|
|
145
152
|
actions?.onError?.(error);
|
|
146
153
|
throw error;
|
|
147
154
|
} finally {
|