washday-sdk 1.1.9 → 1.2.0
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/api/attendance/get.js +4 -5
- package/dist/api/attendance/post.js +2 -3
- package/dist/api/attendance/put.js +1 -2
- package/dist/api/auth/post.js +13 -14
- package/dist/api/axiosInstance.js +47 -36
- package/dist/api/cashierbox/delete.js +2 -3
- package/dist/api/cashups/delete.js +1 -2
- package/dist/api/cashups/get.js +3 -4
- package/dist/api/cashups/post.js +1 -2
- package/dist/api/cashups/put.js +2 -2
- package/dist/api/cfdi/delete.js +1 -2
- package/dist/api/cfdi/get.js +6 -7
- package/dist/api/cfdi/post.js +2 -3
- package/dist/api/cfdi/put.js +2 -2
- package/dist/api/csv/get.js +13 -14
- package/dist/api/customers/delete.js +2 -3
- package/dist/api/customers/get.js +6 -6
- package/dist/api/customers/put.js +2 -3
- package/dist/api/discounts/get.js +7 -8
- package/dist/api/discounts/post.js +2 -3
- package/dist/api/discounts/put.js +4 -5
- package/dist/api/index.js +4 -1
- package/dist/api/inventory/get.js +1 -1
- package/dist/api/order/delete.js +2 -3
- package/dist/api/order/get.js +8 -9
- package/dist/api/order/post.js +7 -8
- package/dist/api/order/put.js +13 -14
- package/dist/api/outsourcedOrders/delete.js +1 -2
- package/dist/api/outsourcedOrders/get.js +3 -4
- package/dist/api/outsourcedOrders/post.js +1 -2
- package/dist/api/outsourcedOrders/put.js +1 -2
- package/dist/api/partners/delete.js +1 -2
- package/dist/api/partners/get.js +2 -3
- package/dist/api/partners/post.js +1 -2
- package/dist/api/partners/put.js +1 -2
- package/dist/api/pdf/get.js +1 -2
- package/dist/api/products/delete.js +2 -2
- package/dist/api/products/get.js +1 -2
- package/dist/api/products/put.js +1 -1
- package/dist/api/publics/get.js +1 -2
- package/dist/api/reports/get.js +15 -16
- package/dist/api/reviews/delete.js +1 -1
- package/dist/api/reviews/get.js +2 -3
- package/dist/api/reviews/post.js +1 -1
- package/dist/api/reviews/put.js +2 -2
- package/dist/api/routes/delete.js +1 -2
- package/dist/api/routes/get.js +5 -6
- package/dist/api/routes/post.js +3 -4
- package/dist/api/routes/put.js +3 -4
- package/dist/api/sections/delete.js +1 -2
- package/dist/api/sections/get.js +3 -4
- package/dist/api/sections/put.js +1 -2
- package/dist/api/staff/get.js +1 -1
- package/dist/api/stripe/post.js +1 -1
- package/dist/api/supplies/get.js +1 -1
- package/dist/api/users/post.js +1 -2
- package/package.json +1 -1
- package/src/api/attendance/get.ts +4 -4
- package/src/api/attendance/post.ts +2 -2
- package/src/api/attendance/put.ts +1 -1
- package/src/api/auth/post.ts +13 -13
- package/src/api/axiosInstance.ts +51 -40
- package/src/api/cashierbox/delete.ts +2 -2
- package/src/api/cashups/delete.ts +1 -1
- package/src/api/cashups/get.ts +3 -3
- package/src/api/cashups/post.ts +1 -1
- package/src/api/cashups/put.ts +2 -2
- package/src/api/cfdi/delete.ts +1 -1
- package/src/api/cfdi/get.ts +6 -6
- package/src/api/cfdi/post.ts +2 -2
- package/src/api/cfdi/put.ts +2 -2
- package/src/api/csv/get.ts +13 -13
- package/src/api/customers/delete.ts +2 -2
- package/src/api/customers/get.ts +6 -6
- package/src/api/customers/put.ts +2 -2
- package/src/api/discounts/get.ts +7 -7
- package/src/api/discounts/post.ts +2 -2
- package/src/api/discounts/put.ts +4 -4
- package/src/api/index.ts +4 -2
- package/src/api/inventory/get.ts +1 -1
- package/src/api/order/delete.ts +2 -2
- package/src/api/order/get.ts +8 -8
- package/src/api/order/post.ts +7 -7
- package/src/api/order/put.ts +13 -13
- package/src/api/outsourcedOrders/delete.ts +1 -1
- package/src/api/outsourcedOrders/get.ts +3 -3
- package/src/api/outsourcedOrders/post.ts +1 -1
- package/src/api/outsourcedOrders/put.ts +1 -1
- package/src/api/partners/delete.ts +1 -1
- package/src/api/partners/get.ts +2 -2
- package/src/api/partners/post.ts +1 -1
- package/src/api/partners/put.ts +1 -1
- package/src/api/pdf/get.ts +1 -1
- package/src/api/products/delete.ts +2 -2
- package/src/api/products/get.ts +1 -1
- package/src/api/products/put.ts +1 -1
- package/src/api/publics/get.ts +1 -1
- package/src/api/reports/get.ts +15 -15
- package/src/api/reviews/delete.ts +1 -1
- package/src/api/reviews/get.ts +2 -2
- package/src/api/reviews/post.ts +1 -1
- package/src/api/reviews/put.ts +2 -2
- package/src/api/routes/delete.ts +1 -1
- package/src/api/routes/get.ts +5 -5
- package/src/api/routes/post.ts +3 -3
- package/src/api/routes/put.ts +3 -3
- package/src/api/sections/delete.ts +1 -1
- package/src/api/sections/get.ts +3 -3
- package/src/api/sections/put.ts +1 -1
- package/src/api/staff/get.ts +1 -1
- package/src/api/stripe/post.ts +1 -1
- package/src/api/supplies/get.ts +1 -1
- package/src/api/users/post.ts +1 -1
- package/src/interfaces/Api.ts +3 -0
package/dist/api/csv/get.js
CHANGED
|
@@ -8,7 +8,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { generateQueryParamsStr } from "../../utils/apiUtils";
|
|
11
|
-
import axiosInstance from "../axiosInstance";
|
|
12
11
|
const GENERATE_EXPORT = 'api/export';
|
|
13
12
|
const GET_SET_REPORTS = 'api/reports';
|
|
14
13
|
const ATTENDANCE_API = 'api/attendance';
|
|
@@ -26,7 +25,7 @@ export const exportCustomersList = function (params) {
|
|
|
26
25
|
}
|
|
27
26
|
};
|
|
28
27
|
const queryParams = generateQueryParamsStr(['searchTerm', 'name', 'phone', 'email', 'fromDate', 'toDate', 'limit', 'pageNum', 'createdIn'], params);
|
|
29
|
-
return yield axiosInstance.get(`${GENERATE_EXPORT}/export-all-customers?${queryParams}`, config);
|
|
28
|
+
return yield this.axiosInstance.get(`${GENERATE_EXPORT}/export-all-customers?${queryParams}`, config);
|
|
30
29
|
}
|
|
31
30
|
catch (error) {
|
|
32
31
|
console.error('Error fetching exportCustomersList:', error);
|
|
@@ -64,7 +63,7 @@ export const exportOrdersList = function (params) {
|
|
|
64
63
|
'collectedDateTime',
|
|
65
64
|
'q'
|
|
66
65
|
], params);
|
|
67
|
-
return yield axiosInstance.get(`${GENERATE_EXPORT}/export-all-orders?${queryParams}`, config);
|
|
66
|
+
return yield this.axiosInstance.get(`${GENERATE_EXPORT}/export-all-orders?${queryParams}`, config);
|
|
68
67
|
}
|
|
69
68
|
catch (error) {
|
|
70
69
|
console.error('Error fetching exportOrdersList:', error);
|
|
@@ -85,7 +84,7 @@ export const exportProductsList = function (storeId) {
|
|
|
85
84
|
responseType: 'blob'
|
|
86
85
|
}
|
|
87
86
|
};
|
|
88
|
-
return yield axiosInstance.get(`api/product/${storeId}/export`, config);
|
|
87
|
+
return yield this.axiosInstance.get(`api/product/${storeId}/export`, config);
|
|
89
88
|
}
|
|
90
89
|
catch (error) {
|
|
91
90
|
console.error('Error fetching exportProductsList:', error);
|
|
@@ -111,7 +110,7 @@ export const exportCleanedOrdersReport = function (storeId, params) {
|
|
|
111
110
|
'toDate',
|
|
112
111
|
'timezone'
|
|
113
112
|
], params);
|
|
114
|
-
return yield axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/cleaned-orders/export?${queryParams}`, config);
|
|
113
|
+
return yield this.axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/cleaned-orders/export?${queryParams}`, config);
|
|
115
114
|
}
|
|
116
115
|
catch (error) {
|
|
117
116
|
console.error('Error fetching exportOrdersList:', error);
|
|
@@ -138,7 +137,7 @@ export const exportSalesReport = function (storeId, params) {
|
|
|
138
137
|
'timezone',
|
|
139
138
|
'type'
|
|
140
139
|
], params);
|
|
141
|
-
return yield axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/sales/export?${queryParams}`, config);
|
|
140
|
+
return yield this.axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/sales/export?${queryParams}`, config);
|
|
142
141
|
}
|
|
143
142
|
catch (error) {
|
|
144
143
|
console.error('Error fetching exportOrdersList:', error);
|
|
@@ -163,7 +162,7 @@ export const exportCustomersReport = function (storeId, params) {
|
|
|
163
162
|
'fromDate',
|
|
164
163
|
'toDate',
|
|
165
164
|
], params);
|
|
166
|
-
return yield axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/customers/export?${queryParams}`, config);
|
|
165
|
+
return yield this.axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/customers/export?${queryParams}`, config);
|
|
167
166
|
}
|
|
168
167
|
catch (error) {
|
|
169
168
|
console.error('Error fetching exportCustomersReport:', error);
|
|
@@ -188,7 +187,7 @@ export const exportSuppliesReport = function (storeId, params) {
|
|
|
188
187
|
'fromDate',
|
|
189
188
|
'toDate',
|
|
190
189
|
], params);
|
|
191
|
-
return yield axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/supplies/export?${queryParams}`, config);
|
|
190
|
+
return yield this.axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/supplies/export?${queryParams}`, config);
|
|
192
191
|
}
|
|
193
192
|
catch (error) {
|
|
194
193
|
console.error('Error fetching exportCustomersReport:', error);
|
|
@@ -210,7 +209,7 @@ export const exportDiscountCodesReport = function (storeId, params) {
|
|
|
210
209
|
}
|
|
211
210
|
};
|
|
212
211
|
const queryParams = generateQueryParamsStr([], params);
|
|
213
|
-
return yield axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/discountCodes/export?${queryParams}`, config);
|
|
212
|
+
return yield this.axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/discountCodes/export?${queryParams}`, config);
|
|
214
213
|
}
|
|
215
214
|
catch (error) {
|
|
216
215
|
console.error('Error fetching exportCustomersReport:', error);
|
|
@@ -235,7 +234,7 @@ export const exportStaffReport = function (storeId, params) {
|
|
|
235
234
|
'fromDate',
|
|
236
235
|
'toDate',
|
|
237
236
|
], params);
|
|
238
|
-
return yield axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/staff/export?${queryParams}`, config);
|
|
237
|
+
return yield this.axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/staff/export?${queryParams}`, config);
|
|
239
238
|
}
|
|
240
239
|
catch (error) {
|
|
241
240
|
console.error('Error fetching exportCustomersReport:', error);
|
|
@@ -261,7 +260,7 @@ export const exportProductSalesReport = function (storeId, params) {
|
|
|
261
260
|
'toDate',
|
|
262
261
|
'timezone'
|
|
263
262
|
], params);
|
|
264
|
-
return yield axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/productSales/export?${queryParams}`, config);
|
|
263
|
+
return yield this.axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/productSales/export?${queryParams}`, config);
|
|
265
264
|
}
|
|
266
265
|
catch (error) {
|
|
267
266
|
console.error('Error fetching exportOrdersList:', error);
|
|
@@ -287,7 +286,7 @@ export const exportPaymentLinesReport = function (storeId, params) {
|
|
|
287
286
|
'toDate',
|
|
288
287
|
'timezone'
|
|
289
288
|
], params);
|
|
290
|
-
return yield axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/paymentLines/export?${queryParams}`, config);
|
|
289
|
+
return yield this.axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/paymentLines/export?${queryParams}`, config);
|
|
291
290
|
}
|
|
292
291
|
catch (error) {
|
|
293
292
|
console.error('Error fetching exportOrdersList:', error);
|
|
@@ -314,7 +313,7 @@ export const exportUnpaidOrdersReportCSV = function (storeId, params) {
|
|
|
314
313
|
'timezone',
|
|
315
314
|
'customerName'
|
|
316
315
|
], params);
|
|
317
|
-
return yield axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/unpaidOrders/export?${queryParams}`, config);
|
|
316
|
+
return yield this.axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/unpaidOrders/export?${queryParams}`, config);
|
|
318
317
|
}
|
|
319
318
|
catch (error) {
|
|
320
319
|
console.error('Error fetching exportUnpaidOrdersReportCSV:', error);
|
|
@@ -340,7 +339,7 @@ export const exportAttendanceReport = function (storeId, params) {
|
|
|
340
339
|
'toDate',
|
|
341
340
|
'employeeId'
|
|
342
341
|
], params);
|
|
343
|
-
return yield axiosInstance.get(`${ATTENDANCE_API}/store/${storeId}/report/export?${queryParams}`, config);
|
|
342
|
+
return yield this.axiosInstance.get(`${ATTENDANCE_API}/store/${storeId}/report/export?${queryParams}`, config);
|
|
344
343
|
}
|
|
345
344
|
catch (error) {
|
|
346
345
|
console.error('Error fetching exportAttendanceReport:', error);
|
|
@@ -7,7 +7,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import axiosInstance from "../axiosInstance";
|
|
11
10
|
const GET_SET_CUSTOMERS = 'api/customer';
|
|
12
11
|
const GET_SET_CUSTOMERS_APP = 'api/v2/washdayapp/customers';
|
|
13
12
|
export const deleteByIdCustomersApp = function (id) {
|
|
@@ -16,7 +15,7 @@ export const deleteByIdCustomersApp = function (id) {
|
|
|
16
15
|
const config = {
|
|
17
16
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
18
17
|
};
|
|
19
|
-
return yield axiosInstance.delete(`${GET_SET_CUSTOMERS_APP}/${id}`, config);
|
|
18
|
+
return yield this.axiosInstance.delete(`${GET_SET_CUSTOMERS_APP}/${id}`, config);
|
|
20
19
|
}
|
|
21
20
|
catch (error) {
|
|
22
21
|
console.error('Error fetching deleteByIdCustomersApp:', error);
|
|
@@ -30,7 +29,7 @@ export const deleteById = function (id) {
|
|
|
30
29
|
const config = {
|
|
31
30
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
32
31
|
};
|
|
33
|
-
return yield axiosInstance.delete(`${GET_SET_CUSTOMERS}/${id}`, config);
|
|
32
|
+
return yield this.axiosInstance.delete(`${GET_SET_CUSTOMERS}/${id}`, config);
|
|
34
33
|
}
|
|
35
34
|
catch (error) {
|
|
36
35
|
console.error('Error fetching deleteById:', error);
|
|
@@ -19,14 +19,14 @@ export const getList = function (params, options) {
|
|
|
19
19
|
signal: (options === null || options === void 0 ? void 0 : options.signal) || params.signal || undefined
|
|
20
20
|
};
|
|
21
21
|
const queryParams = generateQueryParamsStr(['searchTerm', 'name', 'phone', 'email', 'fromDate', 'toDate', 'limit', 'pageNum', 'createdIn'], params);
|
|
22
|
-
return yield axiosInstance.get(`${GET_SET_CUSTOMERS}?${queryParams}`, config);
|
|
22
|
+
return yield this.axiosInstance.get(`${GET_SET_CUSTOMERS}?${queryParams}`, config);
|
|
23
23
|
}
|
|
24
24
|
catch (error) {
|
|
25
25
|
if (error instanceof Error && (error.name === 'AbortError' || error.name === 'CanceledError')) {
|
|
26
26
|
console.log('Request was cancelled');
|
|
27
|
-
throw
|
|
27
|
+
throw error;
|
|
28
28
|
}
|
|
29
|
-
console.error('Error fetching customers:', error);
|
|
29
|
+
console.error('Washday SDK - Error fetching customers:', error);
|
|
30
30
|
throw error;
|
|
31
31
|
}
|
|
32
32
|
});
|
|
@@ -68,7 +68,7 @@ export const getCustomerOrders = function (customerId, params) {
|
|
|
68
68
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
69
69
|
};
|
|
70
70
|
const queryParams = generateQueryParamsStr(['limit', 'pageNum'], params);
|
|
71
|
-
return yield axiosInstance.get(`${GET_SET_CUSTOMERS}/${customerId}/orders?${queryParams}`, config);
|
|
71
|
+
return yield this.axiosInstance.get(`${GET_SET_CUSTOMERS}/${customerId}/orders?${queryParams}`, config);
|
|
72
72
|
}
|
|
73
73
|
catch (error) {
|
|
74
74
|
console.error('Error fetching getCustomerHighlightsById:', error);
|
|
@@ -82,7 +82,7 @@ export const getCustomerByIdCustomersApp = function (customerId) {
|
|
|
82
82
|
const config = {
|
|
83
83
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
84
84
|
};
|
|
85
|
-
return yield axiosInstance.get(`${GET_SET_CUSTOMERS_APP}/${customerId}`, config);
|
|
85
|
+
return yield this.axiosInstance.get(`${GET_SET_CUSTOMERS_APP}/${customerId}`, config);
|
|
86
86
|
}
|
|
87
87
|
catch (error) {
|
|
88
88
|
console.error('Error fetching customer:', error);
|
|
@@ -96,7 +96,7 @@ export const getCustomerLoyaltyHistory = function (customerId) {
|
|
|
96
96
|
const config = {
|
|
97
97
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
98
98
|
};
|
|
99
|
-
return yield axiosInstance.get(`${GET_SET_CUSTOMERS}/${customerId}/loyalty-history`, config);
|
|
99
|
+
return yield this.axiosInstance.get(`${GET_SET_CUSTOMERS}/${customerId}/loyalty-history`, config);
|
|
100
100
|
}
|
|
101
101
|
catch (error) {
|
|
102
102
|
console.error('Error fetching getCustomerLoyaltyHistory:', error);
|
|
@@ -7,7 +7,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import axiosInstance from "../axiosInstance";
|
|
11
10
|
const GET_SET_CUSTOMERS = 'api/customer';
|
|
12
11
|
const GET_SET_CUSTOMERS_APP = 'api/v2/washdayapp/customers';
|
|
13
12
|
// export const bulkUpdate = async function (this: WashdayClientInstance, storeId: string, data: any): Promise<any> {
|
|
@@ -28,7 +27,7 @@ export const updateById = function (id, data) {
|
|
|
28
27
|
const config = {
|
|
29
28
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
30
29
|
};
|
|
31
|
-
return yield axiosInstance.put(`${GET_SET_CUSTOMERS}/${id}`, data, config);
|
|
30
|
+
return yield this.axiosInstance.put(`${GET_SET_CUSTOMERS}/${id}`, data, config);
|
|
32
31
|
}
|
|
33
32
|
catch (error) {
|
|
34
33
|
console.error('Error fetching updateById:', error);
|
|
@@ -42,7 +41,7 @@ export const updateByIdCustomersApp = function (id, data) {
|
|
|
42
41
|
const config = {
|
|
43
42
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
44
43
|
};
|
|
45
|
-
return yield axiosInstance.put(`${GET_SET_CUSTOMERS_APP}/${id}`, data, config);
|
|
44
|
+
return yield this.axiosInstance.put(`${GET_SET_CUSTOMERS_APP}/${id}`, data, config);
|
|
46
45
|
}
|
|
47
46
|
catch (error) {
|
|
48
47
|
console.error('Error fetching updateByIdCustomersApp:', error);
|
|
@@ -8,7 +8,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { generateQueryParamsStr } from "../../utils/apiUtils";
|
|
11
|
-
import axiosInstance from "../axiosInstance";
|
|
12
11
|
const GET_SET_DISCOUNT_CODES = 'api/v2/discountCodes';
|
|
13
12
|
const GET_SET_AUTOMATIC_DISCOUNTS = 'api/discounts';
|
|
14
13
|
const GET_AVAILABLE_AUTOMATIC_DISCOUNTS = 'api/availableDiscounts';
|
|
@@ -23,7 +22,7 @@ export const getDiscountCodes = function (storeId, params) {
|
|
|
23
22
|
const config = {
|
|
24
23
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
25
24
|
};
|
|
26
|
-
return yield axiosInstance.get(`${GET_SET_DISCOUNT_CODES}/${storeId}?${queryParams}`, config);
|
|
25
|
+
return yield this.axiosInstance.get(`${GET_SET_DISCOUNT_CODES}/${storeId}?${queryParams}`, config);
|
|
27
26
|
}
|
|
28
27
|
catch (error) {
|
|
29
28
|
console.error('Error fetching getStores:', error);
|
|
@@ -40,7 +39,7 @@ export const getAutomaticDiscounts = function (storeId, params) {
|
|
|
40
39
|
const config = {
|
|
41
40
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
42
41
|
};
|
|
43
|
-
return yield axiosInstance.get(`${GET_SET_AUTOMATIC_DISCOUNTS}/${storeId}?${queryParams}`, config);
|
|
42
|
+
return yield this.axiosInstance.get(`${GET_SET_AUTOMATIC_DISCOUNTS}/${storeId}?${queryParams}`, config);
|
|
44
43
|
}
|
|
45
44
|
catch (error) {
|
|
46
45
|
console.error('Error fetching getStores:', error);
|
|
@@ -54,7 +53,7 @@ export const getDiscountCodeById = function (storeId, discountId) {
|
|
|
54
53
|
const config = {
|
|
55
54
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
56
55
|
};
|
|
57
|
-
return yield axiosInstance.get(`${GET_SET_DISCOUNT_CODES}/${storeId}/${discountId}`, config);
|
|
56
|
+
return yield this.axiosInstance.get(`${GET_SET_DISCOUNT_CODES}/${storeId}/${discountId}`, config);
|
|
58
57
|
}
|
|
59
58
|
catch (error) {
|
|
60
59
|
console.error('Error fetching getDiscountCodeById:', error);
|
|
@@ -68,7 +67,7 @@ export const getAutomaticDiscountById = function (storeId, discountId) {
|
|
|
68
67
|
const config = {
|
|
69
68
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
70
69
|
};
|
|
71
|
-
return yield axiosInstance.get(`${GET_SET_AUTOMATIC_DISCOUNTS}/${storeId}/${discountId}`, config);
|
|
70
|
+
return yield this.axiosInstance.get(`${GET_SET_AUTOMATIC_DISCOUNTS}/${storeId}/${discountId}`, config);
|
|
72
71
|
}
|
|
73
72
|
catch (error) {
|
|
74
73
|
console.error('Error fetching getDiscountCodeById:', error);
|
|
@@ -82,7 +81,7 @@ export const verifyDiscountCode = function (storeId, code) {
|
|
|
82
81
|
const config = {
|
|
83
82
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
84
83
|
};
|
|
85
|
-
return yield axiosInstance.get(`${GET_SET_DISCOUNT_CODES}/${storeId}/${code}/verify`, config);
|
|
84
|
+
return yield this.axiosInstance.get(`${GET_SET_DISCOUNT_CODES}/${storeId}/${code}/verify`, config);
|
|
86
85
|
}
|
|
87
86
|
catch (error) {
|
|
88
87
|
console.error('Error fetching verifyDiscountCode:', error);
|
|
@@ -96,7 +95,7 @@ export const verifyDiscountCodeCustomersApp = function (storeId, code) {
|
|
|
96
95
|
const config = {
|
|
97
96
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
98
97
|
};
|
|
99
|
-
return yield axiosInstance.get(`${GET_DISCOUNT_CODES_CUSTOMER_APP}/${storeId}/${code}/verify`, config);
|
|
98
|
+
return yield this.axiosInstance.get(`${GET_DISCOUNT_CODES_CUSTOMER_APP}/${storeId}/${code}/verify`, config);
|
|
100
99
|
}
|
|
101
100
|
catch (error) {
|
|
102
101
|
console.error('Error fetching verifyDiscountCodeCustomersApp:', error);
|
|
@@ -110,7 +109,7 @@ export const getAvailableAutomaticDiscounts = function (storeId, date) {
|
|
|
110
109
|
const config = {
|
|
111
110
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
112
111
|
};
|
|
113
|
-
return yield axiosInstance.get(`${GET_AVAILABLE_AUTOMATIC_DISCOUNTS}/${storeId}?currentDate=${date}`, config);
|
|
112
|
+
return yield this.axiosInstance.get(`${GET_AVAILABLE_AUTOMATIC_DISCOUNTS}/${storeId}?currentDate=${date}`, config);
|
|
114
113
|
}
|
|
115
114
|
catch (error) {
|
|
116
115
|
console.error('Error fetching getAvailableAutomaticDiscounts:', error);
|
|
@@ -7,7 +7,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import axiosInstance from "../axiosInstance";
|
|
11
10
|
const GET_SET_DISCOUNT_CODES = 'api/v2/discountCodes';
|
|
12
11
|
const GET_SET_AUTOMATIC_DISCOUNTS = 'api/discounts';
|
|
13
12
|
export const createAutomaticDiscount = function (storeId, data) {
|
|
@@ -16,7 +15,7 @@ export const createAutomaticDiscount = function (storeId, data) {
|
|
|
16
15
|
const config = {
|
|
17
16
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
18
17
|
};
|
|
19
|
-
return yield axiosInstance.post(`${GET_SET_AUTOMATIC_DISCOUNTS}/${storeId}`, data, config);
|
|
18
|
+
return yield this.axiosInstance.post(`${GET_SET_AUTOMATIC_DISCOUNTS}/${storeId}`, data, config);
|
|
20
19
|
}
|
|
21
20
|
catch (error) {
|
|
22
21
|
console.error('Error fetching createAutomaticDiscount:', error);
|
|
@@ -30,7 +29,7 @@ export const createDiscountCode = function (storeId, data) {
|
|
|
30
29
|
const config = {
|
|
31
30
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
32
31
|
};
|
|
33
|
-
return yield axiosInstance.post(`${GET_SET_DISCOUNT_CODES}/${storeId}`, data, config);
|
|
32
|
+
return yield this.axiosInstance.post(`${GET_SET_DISCOUNT_CODES}/${storeId}`, data, config);
|
|
34
33
|
}
|
|
35
34
|
catch (error) {
|
|
36
35
|
console.error('Error fetching createAutomaticDiscount:', error);
|
|
@@ -7,7 +7,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import axiosInstance from "../axiosInstance";
|
|
11
10
|
const GET_SET_DISCOUNT_CODES = 'api/v2/discountCodes';
|
|
12
11
|
const GET_SET_AUTOMATIC_DISCOUNTS = 'api/discounts';
|
|
13
12
|
export const deleteDiscountCodeById = function (storeId, discountId) {
|
|
@@ -16,7 +15,7 @@ export const deleteDiscountCodeById = function (storeId, discountId) {
|
|
|
16
15
|
const config = {
|
|
17
16
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
18
17
|
};
|
|
19
|
-
return yield axiosInstance.delete(`${GET_SET_DISCOUNT_CODES}/${storeId}/${discountId}`, config);
|
|
18
|
+
return yield this.axiosInstance.delete(`${GET_SET_DISCOUNT_CODES}/${storeId}/${discountId}`, config);
|
|
20
19
|
}
|
|
21
20
|
catch (error) {
|
|
22
21
|
console.error('Error fetching deleteDiscountCodeById:', error);
|
|
@@ -30,7 +29,7 @@ export const deleteAutomaticDiscountById = function (storeId, discountId) {
|
|
|
30
29
|
const config = {
|
|
31
30
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
32
31
|
};
|
|
33
|
-
return yield axiosInstance.delete(`${GET_SET_AUTOMATIC_DISCOUNTS}/${storeId}/${discountId}`, config);
|
|
32
|
+
return yield this.axiosInstance.delete(`${GET_SET_AUTOMATIC_DISCOUNTS}/${storeId}/${discountId}`, config);
|
|
34
33
|
}
|
|
35
34
|
catch (error) {
|
|
36
35
|
console.error('Error fetching deleteAutomaticDiscountById:', error);
|
|
@@ -44,7 +43,7 @@ export const updateAutomaticDiscountById = function (storeId, discountId, data)
|
|
|
44
43
|
const config = {
|
|
45
44
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
46
45
|
};
|
|
47
|
-
return yield axiosInstance.put(`${GET_SET_AUTOMATIC_DISCOUNTS}/${storeId}/${discountId}`, data, config);
|
|
46
|
+
return yield this.axiosInstance.put(`${GET_SET_AUTOMATIC_DISCOUNTS}/${storeId}/${discountId}`, data, config);
|
|
48
47
|
}
|
|
49
48
|
catch (error) {
|
|
50
49
|
console.error('Error fetching updateById:', error);
|
|
@@ -58,7 +57,7 @@ export const updateDiscountCodeById = function (storeId, discountId, data) {
|
|
|
58
57
|
const config = {
|
|
59
58
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
60
59
|
};
|
|
61
|
-
return yield axiosInstance.put(`${GET_SET_DISCOUNT_CODES}/${storeId}/${discountId}`, data, config);
|
|
60
|
+
return yield this.axiosInstance.put(`${GET_SET_DISCOUNT_CODES}/${storeId}/${discountId}`, data, config);
|
|
62
61
|
}
|
|
63
62
|
catch (error) {
|
|
64
63
|
console.error('Error fetching updateDiscountCodeById:', error);
|
package/dist/api/index.js
CHANGED
|
@@ -41,6 +41,7 @@ import * as partnersEndpoints from './partners';
|
|
|
41
41
|
import * as outsourcedOrdersEndpoints from './outsourcedOrders';
|
|
42
42
|
import * as publicsEndpoints from './publics';
|
|
43
43
|
import { validateUserPin } from "./users/post";
|
|
44
|
+
import { getAxiosInstance } from "./axiosInstance";
|
|
44
45
|
function bindMethods(instance, methods) {
|
|
45
46
|
const boundMethods = {};
|
|
46
47
|
for (const key in methods) {
|
|
@@ -50,8 +51,10 @@ function bindMethods(instance, methods) {
|
|
|
50
51
|
}
|
|
51
52
|
return boundMethods;
|
|
52
53
|
}
|
|
53
|
-
const WashdayClient = function WashdayClient(apiToken) {
|
|
54
|
+
const WashdayClient = function WashdayClient(apiToken, env = 'PROD') {
|
|
54
55
|
this.apiToken = apiToken;
|
|
56
|
+
this.env = env;
|
|
57
|
+
this.axiosInstance = this.axiosInstance ? this.axiosInstance : getAxiosInstance(env);
|
|
55
58
|
this.cashup = bindMethods(this, {
|
|
56
59
|
getList: cashupsEndpoints.getModule.getList,
|
|
57
60
|
getById: cashupsEndpoints.getModule.getById,
|
|
@@ -30,7 +30,7 @@ export const getInventoryById = function (storeId, id) {
|
|
|
30
30
|
const config = {
|
|
31
31
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
32
32
|
};
|
|
33
|
-
return yield axiosInstance.get(`${GET_SET_INVENTORY(storeId)}/${id}`, config);
|
|
33
|
+
return yield this.axiosInstance.get(`${GET_SET_INVENTORY(storeId)}/${id}`, config);
|
|
34
34
|
}
|
|
35
35
|
catch (error) {
|
|
36
36
|
console.error('Error fetching getInventoryById:', error);
|
package/dist/api/order/delete.js
CHANGED
|
@@ -7,7 +7,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import axiosInstance from "../axiosInstance";
|
|
11
10
|
const GET_SET_ORDER_PAYMENTLINES = (orderId) => `/api/v2/order/${orderId}/paymentLines`;
|
|
12
11
|
const GET_SET_ORDER_CUSTOMERS_APP = 'api/v2/washdayapp/orders';
|
|
13
12
|
export const deletePaymentLineById = function (orderId, id) {
|
|
@@ -16,7 +15,7 @@ export const deletePaymentLineById = function (orderId, id) {
|
|
|
16
15
|
const config = {
|
|
17
16
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
18
17
|
};
|
|
19
|
-
return yield axiosInstance.delete(`${GET_SET_ORDER_PAYMENTLINES(orderId)}/${id}`, config);
|
|
18
|
+
return yield this.axiosInstance.delete(`${GET_SET_ORDER_PAYMENTLINES(orderId)}/${id}`, config);
|
|
20
19
|
}
|
|
21
20
|
catch (error) {
|
|
22
21
|
console.error('Error fetching deleteById:', error);
|
|
@@ -30,7 +29,7 @@ export const cancelOrderByIdCustomersApp = function (id) {
|
|
|
30
29
|
const config = {
|
|
31
30
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
32
31
|
};
|
|
33
|
-
return yield axiosInstance.delete(`${GET_SET_ORDER_CUSTOMERS_APP}/${id}`, config);
|
|
32
|
+
return yield this.axiosInstance.delete(`${GET_SET_ORDER_CUSTOMERS_APP}/${id}`, config);
|
|
34
33
|
}
|
|
35
34
|
catch (error) {
|
|
36
35
|
console.error('Error fetching cancelOrderByIdCustomersApp:', error);
|
package/dist/api/order/get.js
CHANGED
|
@@ -8,7 +8,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { generateQueryParamsStr } from "../../utils/apiUtils";
|
|
11
|
-
import axiosInstance from "../axiosInstance";
|
|
12
11
|
const GET_SET_ORDER = 'api/v2/order';
|
|
13
12
|
const GET_SET_ORDER_CFDI = 'api/v2/orders';
|
|
14
13
|
const GET_HEADER_SUMMARY = 'api/orderHeaderSummary';
|
|
@@ -45,7 +44,7 @@ export const getList = function (params, options) {
|
|
|
45
44
|
'cfdiId',
|
|
46
45
|
], params);
|
|
47
46
|
// ], { ...params, q: params.q ? encodeURIComponent(params.q) : undefined });
|
|
48
|
-
return yield axiosInstance.get(`${GET_SET_ORDER}?${queryParams}`, config);
|
|
47
|
+
return yield this.axiosInstance.get(`${GET_SET_ORDER}?${queryParams}`, config);
|
|
49
48
|
}
|
|
50
49
|
catch (error) {
|
|
51
50
|
console.error('Error fetching getList orders:', error);
|
|
@@ -63,7 +62,7 @@ export const getOrdersHeaderSummary = function (params) {
|
|
|
63
62
|
'store',
|
|
64
63
|
'status',
|
|
65
64
|
], params);
|
|
66
|
-
return yield axiosInstance.get(`${GET_HEADER_SUMMARY}?${queryParams}`, config);
|
|
65
|
+
return yield this.axiosInstance.get(`${GET_HEADER_SUMMARY}?${queryParams}`, config);
|
|
67
66
|
}
|
|
68
67
|
catch (error) {
|
|
69
68
|
console.error('Error fetching getOrdersHeaderSummary :', error);
|
|
@@ -81,7 +80,7 @@ export const getById = function (id, params, options) {
|
|
|
81
80
|
const queryParams = generateQueryParamsStr([
|
|
82
81
|
'fetchSection',
|
|
83
82
|
], params);
|
|
84
|
-
return yield axiosInstance.get(`${GET_SET_ORDER}/${id}?${queryParams}`, config);
|
|
83
|
+
return yield this.axiosInstance.get(`${GET_SET_ORDER}/${id}?${queryParams}`, config);
|
|
85
84
|
}
|
|
86
85
|
catch (error) {
|
|
87
86
|
console.error('Error fetching:', error);
|
|
@@ -95,7 +94,7 @@ export const getCFDIOrdersByDateAndStore = function (id) {
|
|
|
95
94
|
const config = {
|
|
96
95
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
97
96
|
};
|
|
98
|
-
return yield axiosInstance.get(`${GET_SET_ORDER}/${id}`, config);
|
|
97
|
+
return yield this.axiosInstance.get(`${GET_SET_ORDER}/${id}`, config);
|
|
99
98
|
}
|
|
100
99
|
catch (error) {
|
|
101
100
|
console.error('Error fetching:', error);
|
|
@@ -115,7 +114,7 @@ export const fetchOrdersForCFDI = function (params) {
|
|
|
115
114
|
"storeID",
|
|
116
115
|
"customerID"
|
|
117
116
|
], params);
|
|
118
|
-
return yield axiosInstance.get(`${GET_SET_ORDER_CFDI}/cfdiPreview?${queryParams}`, config);
|
|
117
|
+
return yield this.axiosInstance.get(`${GET_SET_ORDER_CFDI}/cfdiPreview?${queryParams}`, config);
|
|
119
118
|
}
|
|
120
119
|
catch (error) {
|
|
121
120
|
console.error('Error fetching:', error);
|
|
@@ -143,7 +142,7 @@ export const getListCustomersApp = function (params) {
|
|
|
143
142
|
'readyDateTime',
|
|
144
143
|
'collectedDateTime',
|
|
145
144
|
], params);
|
|
146
|
-
return yield axiosInstance.get(`${GET_SET_ORDER_CUSTOMERS_APP}?${queryParams}`, config);
|
|
145
|
+
return yield this.axiosInstance.get(`${GET_SET_ORDER_CUSTOMERS_APP}?${queryParams}`, config);
|
|
147
146
|
}
|
|
148
147
|
catch (error) {
|
|
149
148
|
console.error('Error fetching getListCustomersApp orders:', error);
|
|
@@ -157,7 +156,7 @@ export const getByIdCustomersApp = function (id) {
|
|
|
157
156
|
const config = {
|
|
158
157
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
159
158
|
};
|
|
160
|
-
return yield axiosInstance.get(`${GET_SET_ORDER_CUSTOMERS_APP}/${id}`, config);
|
|
159
|
+
return yield this.axiosInstance.get(`${GET_SET_ORDER_CUSTOMERS_APP}/${id}`, config);
|
|
161
160
|
}
|
|
162
161
|
catch (error) {
|
|
163
162
|
console.error('Error fetching:', error);
|
|
@@ -171,7 +170,7 @@ export const getRequestedOrdersSummary = function (storeIds) {
|
|
|
171
170
|
const config = {
|
|
172
171
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
173
172
|
};
|
|
174
|
-
return yield axiosInstance.get(`${GET_SET_ORDER}/requested-summary?storeIds=${storeIds}`, config);
|
|
173
|
+
return yield this.axiosInstance.get(`${GET_SET_ORDER}/requested-summary?storeIds=${storeIds}`, config);
|
|
175
174
|
}
|
|
176
175
|
catch (error) {
|
|
177
176
|
console.error('Error fetching:', error);
|
package/dist/api/order/post.js
CHANGED
|
@@ -7,7 +7,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import axiosInstance from "../axiosInstance";
|
|
11
10
|
const GET_SET_ORDER_PAYMENTLINES = (orderId) => `/api/v2/order/${orderId}/paymentLines`;
|
|
12
11
|
const GET_SET_ORDER = 'api/v2/order';
|
|
13
12
|
const GET_SET_ORDER_CUSTOMERS_APP = 'api/v2/washdayapp/orders';
|
|
@@ -17,7 +16,7 @@ export const createPaymentLine = function (id, data) {
|
|
|
17
16
|
const config = {
|
|
18
17
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
19
18
|
};
|
|
20
|
-
return yield axiosInstance.post(`${GET_SET_ORDER_PAYMENTLINES(id)}`, data, config);
|
|
19
|
+
return yield this.axiosInstance.post(`${GET_SET_ORDER_PAYMENTLINES(id)}`, data, config);
|
|
21
20
|
}
|
|
22
21
|
catch (error) {
|
|
23
22
|
console.error('Error fetching create:', error);
|
|
@@ -31,7 +30,7 @@ export const sendEmailReceipt = function (id) {
|
|
|
31
30
|
const config = {
|
|
32
31
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
33
32
|
};
|
|
34
|
-
return yield axiosInstance.post(`${GET_SET_ORDER}/${id}/sendEmailReceipt`, {}, config);
|
|
33
|
+
return yield this.axiosInstance.post(`${GET_SET_ORDER}/${id}/sendEmailReceipt`, {}, config);
|
|
35
34
|
}
|
|
36
35
|
catch (error) {
|
|
37
36
|
console.error('Error fetching create:', error);
|
|
@@ -45,7 +44,7 @@ export const createOrderCustomersApp = function (data) {
|
|
|
45
44
|
const config = {
|
|
46
45
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
47
46
|
};
|
|
48
|
-
return yield axiosInstance.post(`${GET_SET_ORDER_CUSTOMERS_APP}`, data, config);
|
|
47
|
+
return yield this.axiosInstance.post(`${GET_SET_ORDER_CUSTOMERS_APP}`, data, config);
|
|
49
48
|
}
|
|
50
49
|
catch (error) {
|
|
51
50
|
console.error('Error fetching createOrderCustomersApp:', error);
|
|
@@ -59,7 +58,7 @@ export const createOrderUsersApp = function (data) {
|
|
|
59
58
|
const config = {
|
|
60
59
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
61
60
|
};
|
|
62
|
-
return yield axiosInstance.post(`${GET_SET_ORDER}`, data, config);
|
|
61
|
+
return yield this.axiosInstance.post(`${GET_SET_ORDER}`, data, config);
|
|
63
62
|
}
|
|
64
63
|
catch (error) {
|
|
65
64
|
console.error('Error fetching createOrderUsersApp:', error);
|
|
@@ -73,7 +72,7 @@ export const bulkCreatePaymentLines = function (storeId, body) {
|
|
|
73
72
|
const config = {
|
|
74
73
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
75
74
|
};
|
|
76
|
-
return yield axiosInstance.post(`${GET_SET_ORDER}/${storeId}/bulkPaymentLines`, body, config);
|
|
75
|
+
return yield this.axiosInstance.post(`${GET_SET_ORDER}/${storeId}/bulkPaymentLines`, body, config);
|
|
77
76
|
}
|
|
78
77
|
catch (error) {
|
|
79
78
|
console.error('Error fetching bulkCreatePaymentLines:', error);
|
|
@@ -91,7 +90,7 @@ export const createOrderEvidence = function (orderId, data) {
|
|
|
91
90
|
'Content-Type': false
|
|
92
91
|
}
|
|
93
92
|
};
|
|
94
|
-
return yield axiosInstance.post(`${GET_SET_ORDER}/${orderId}/evidence`, data, config);
|
|
93
|
+
return yield this.axiosInstance.post(`${GET_SET_ORDER}/${orderId}/evidence`, data, config);
|
|
95
94
|
}
|
|
96
95
|
catch (error) {
|
|
97
96
|
console.error('Error fetching createOrderEvidence:', error);
|
|
@@ -105,7 +104,7 @@ export const getRedeemPointsPreview = function (data) {
|
|
|
105
104
|
const config = {
|
|
106
105
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
107
106
|
};
|
|
108
|
-
return yield axiosInstance.post(`${GET_SET_ORDER}/redeemPointsPreview`, data, config);
|
|
107
|
+
return yield this.axiosInstance.post(`${GET_SET_ORDER}/redeemPointsPreview`, data, config);
|
|
109
108
|
}
|
|
110
109
|
catch (error) {
|
|
111
110
|
console.error('Error fetching getRedeemPointsPreview:', error);
|