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.
Files changed (114) hide show
  1. package/dist/api/attendance/get.js +4 -5
  2. package/dist/api/attendance/post.js +2 -3
  3. package/dist/api/attendance/put.js +1 -2
  4. package/dist/api/auth/post.js +13 -14
  5. package/dist/api/axiosInstance.js +47 -36
  6. package/dist/api/cashierbox/delete.js +2 -3
  7. package/dist/api/cashups/delete.js +1 -2
  8. package/dist/api/cashups/get.js +3 -4
  9. package/dist/api/cashups/post.js +1 -2
  10. package/dist/api/cashups/put.js +2 -2
  11. package/dist/api/cfdi/delete.js +1 -2
  12. package/dist/api/cfdi/get.js +6 -7
  13. package/dist/api/cfdi/post.js +2 -3
  14. package/dist/api/cfdi/put.js +2 -2
  15. package/dist/api/csv/get.js +13 -14
  16. package/dist/api/customers/delete.js +2 -3
  17. package/dist/api/customers/get.js +6 -6
  18. package/dist/api/customers/put.js +2 -3
  19. package/dist/api/discounts/get.js +7 -8
  20. package/dist/api/discounts/post.js +2 -3
  21. package/dist/api/discounts/put.js +4 -5
  22. package/dist/api/index.js +4 -1
  23. package/dist/api/inventory/get.js +1 -1
  24. package/dist/api/order/delete.js +2 -3
  25. package/dist/api/order/get.js +8 -9
  26. package/dist/api/order/post.js +7 -8
  27. package/dist/api/order/put.js +13 -14
  28. package/dist/api/outsourcedOrders/delete.js +1 -2
  29. package/dist/api/outsourcedOrders/get.js +3 -4
  30. package/dist/api/outsourcedOrders/post.js +1 -2
  31. package/dist/api/outsourcedOrders/put.js +1 -2
  32. package/dist/api/partners/delete.js +1 -2
  33. package/dist/api/partners/get.js +2 -3
  34. package/dist/api/partners/post.js +1 -2
  35. package/dist/api/partners/put.js +1 -2
  36. package/dist/api/pdf/get.js +1 -2
  37. package/dist/api/products/delete.js +2 -2
  38. package/dist/api/products/get.js +1 -2
  39. package/dist/api/products/put.js +1 -1
  40. package/dist/api/publics/get.js +1 -2
  41. package/dist/api/reports/get.js +15 -16
  42. package/dist/api/reviews/delete.js +1 -1
  43. package/dist/api/reviews/get.js +2 -3
  44. package/dist/api/reviews/post.js +1 -1
  45. package/dist/api/reviews/put.js +2 -2
  46. package/dist/api/routes/delete.js +1 -2
  47. package/dist/api/routes/get.js +5 -6
  48. package/dist/api/routes/post.js +3 -4
  49. package/dist/api/routes/put.js +3 -4
  50. package/dist/api/sections/delete.js +1 -2
  51. package/dist/api/sections/get.js +3 -4
  52. package/dist/api/sections/put.js +1 -2
  53. package/dist/api/staff/get.js +1 -1
  54. package/dist/api/stripe/post.js +1 -1
  55. package/dist/api/supplies/get.js +1 -1
  56. package/dist/api/users/post.js +1 -2
  57. package/package.json +1 -1
  58. package/src/api/attendance/get.ts +4 -4
  59. package/src/api/attendance/post.ts +2 -2
  60. package/src/api/attendance/put.ts +1 -1
  61. package/src/api/auth/post.ts +13 -13
  62. package/src/api/axiosInstance.ts +51 -40
  63. package/src/api/cashierbox/delete.ts +2 -2
  64. package/src/api/cashups/delete.ts +1 -1
  65. package/src/api/cashups/get.ts +3 -3
  66. package/src/api/cashups/post.ts +1 -1
  67. package/src/api/cashups/put.ts +2 -2
  68. package/src/api/cfdi/delete.ts +1 -1
  69. package/src/api/cfdi/get.ts +6 -6
  70. package/src/api/cfdi/post.ts +2 -2
  71. package/src/api/cfdi/put.ts +2 -2
  72. package/src/api/csv/get.ts +13 -13
  73. package/src/api/customers/delete.ts +2 -2
  74. package/src/api/customers/get.ts +6 -6
  75. package/src/api/customers/put.ts +2 -2
  76. package/src/api/discounts/get.ts +7 -7
  77. package/src/api/discounts/post.ts +2 -2
  78. package/src/api/discounts/put.ts +4 -4
  79. package/src/api/index.ts +4 -2
  80. package/src/api/inventory/get.ts +1 -1
  81. package/src/api/order/delete.ts +2 -2
  82. package/src/api/order/get.ts +8 -8
  83. package/src/api/order/post.ts +7 -7
  84. package/src/api/order/put.ts +13 -13
  85. package/src/api/outsourcedOrders/delete.ts +1 -1
  86. package/src/api/outsourcedOrders/get.ts +3 -3
  87. package/src/api/outsourcedOrders/post.ts +1 -1
  88. package/src/api/outsourcedOrders/put.ts +1 -1
  89. package/src/api/partners/delete.ts +1 -1
  90. package/src/api/partners/get.ts +2 -2
  91. package/src/api/partners/post.ts +1 -1
  92. package/src/api/partners/put.ts +1 -1
  93. package/src/api/pdf/get.ts +1 -1
  94. package/src/api/products/delete.ts +2 -2
  95. package/src/api/products/get.ts +1 -1
  96. package/src/api/products/put.ts +1 -1
  97. package/src/api/publics/get.ts +1 -1
  98. package/src/api/reports/get.ts +15 -15
  99. package/src/api/reviews/delete.ts +1 -1
  100. package/src/api/reviews/get.ts +2 -2
  101. package/src/api/reviews/post.ts +1 -1
  102. package/src/api/reviews/put.ts +2 -2
  103. package/src/api/routes/delete.ts +1 -1
  104. package/src/api/routes/get.ts +5 -5
  105. package/src/api/routes/post.ts +3 -3
  106. package/src/api/routes/put.ts +3 -3
  107. package/src/api/sections/delete.ts +1 -1
  108. package/src/api/sections/get.ts +3 -3
  109. package/src/api/sections/put.ts +1 -1
  110. package/src/api/staff/get.ts +1 -1
  111. package/src/api/stripe/post.ts +1 -1
  112. package/src/api/supplies/get.ts +1 -1
  113. package/src/api/users/post.ts +1 -1
  114. package/src/interfaces/Api.ts +3 -0
@@ -10,7 +10,7 @@ export const getOutsourcedOrdersByOrder = async function (this: WashdayClientIns
10
10
  const config = {
11
11
  headers: { Authorization: `Bearer ${this.apiToken}` }
12
12
  };
13
- return await axiosInstance.get(`${GET_OUTSOURCED_ORDERS_BY_ORDER.replace(':orderId', orderId)}`, config);
13
+ return await this.axiosInstance.get(`${GET_OUTSOURCED_ORDERS_BY_ORDER.replace(':orderId', orderId)}`, config);
14
14
  } catch (error) {
15
15
  console.error('Error fetching getOutsourcedOrdersByOrder:', error);
16
16
  throw error;
@@ -34,7 +34,7 @@ export const getOutsourcedOrdersByStore = async function (this: WashdayClientIns
34
34
  'limit',
35
35
  'sequence'
36
36
  ], params);
37
- return await axiosInstance.get(`${GET_OUTSOURCED_ORDERS_BY_STORE.replace(':storeId', params.storeId)}?${queryParams}`, config);
37
+ return await this.axiosInstance.get(`${GET_OUTSOURCED_ORDERS_BY_STORE.replace(':storeId', params.storeId)}?${queryParams}`, config);
38
38
  } catch (error) {
39
39
  console.error('Error fetching getOutsourcedOrdersByStore:', error);
40
40
  throw error;
@@ -46,7 +46,7 @@ export const getOutsourcedOrderById = async function (this: WashdayClientInstanc
46
46
  const config = {
47
47
  headers: { Authorization: `Bearer ${this.apiToken}` }
48
48
  };
49
- return await axiosInstance.get(`${GET_SET_OUTSOURCED_ORDERS}/${id}`, config);
49
+ return await this.axiosInstance.get(`${GET_SET_OUTSOURCED_ORDERS}/${id}`, config);
50
50
  } catch (error) {
51
51
  console.error('Error fetching getOutsourcedOrderById:', error);
52
52
  throw error;
@@ -16,7 +16,7 @@ export const createOutsourcedOrder = async function (this: WashdayClientInstance
16
16
  const config = {
17
17
  headers: { Authorization: `Bearer ${this.apiToken}` }
18
18
  };
19
- return await axiosInstance.post(GET_SET_OUTSOURCED_ORDERS, data, config);
19
+ return await this.axiosInstance.post(GET_SET_OUTSOURCED_ORDERS, data, config);
20
20
  } catch (error) {
21
21
  console.error('Error fetching createOutsourcedOrder:', error);
22
22
  throw error;
@@ -13,7 +13,7 @@ export const updateOutsourcedOrderById = async function (this: WashdayClientInst
13
13
  const config = {
14
14
  headers: { Authorization: `Bearer ${this.apiToken}` }
15
15
  };
16
- return await axiosInstance.put(`${GET_SET_OUTSOURCED_ORDERS}/${id}`, data, config);
16
+ return await this.axiosInstance.put(`${GET_SET_OUTSOURCED_ORDERS}/${id}`, data, config);
17
17
  } catch (error) {
18
18
  console.error('Error fetching updateOutsourcedOrderById:', error);
19
19
  throw error;
@@ -7,7 +7,7 @@ export const deletePartnerById = async function (this: WashdayClientInstance, id
7
7
  const config = {
8
8
  headers: { Authorization: `Bearer ${this.apiToken}` }
9
9
  };
10
- return await axiosInstance.delete(`${GET_SET_PARTNERS}/${id}`, config);
10
+ return await this.axiosInstance.delete(`${GET_SET_PARTNERS}/${id}`, config);
11
11
  } catch (error) {
12
12
  console.error('Error fetching deletePartnerById:', error);
13
13
  throw error;
@@ -8,7 +8,7 @@ export const getPartners = async function (this: WashdayClientInstance): Promise
8
8
  const config = {
9
9
  headers: { Authorization: `Bearer ${this.apiToken}` }
10
10
  };
11
- return await axiosInstance.get(`${GET_SET_PARTNERS}`, config);
11
+ return await this.axiosInstance.get(`${GET_SET_PARTNERS}`, config);
12
12
  } catch (error) {
13
13
  console.error('Error fetching getPartners:', error);
14
14
  throw error;
@@ -20,7 +20,7 @@ export const getPartnerById = async function (this: WashdayClientInstance, id: s
20
20
  const config = {
21
21
  headers: { Authorization: `Bearer ${this.apiToken}` }
22
22
  };
23
- return await axiosInstance.get(`${GET_SET_PARTNERS}/${id}`, config);
23
+ return await this.axiosInstance.get(`${GET_SET_PARTNERS}/${id}`, config);
24
24
  } catch (error) {
25
25
  console.error('Error fetching getPartnerById:', error);
26
26
  throw error;
@@ -13,7 +13,7 @@ export const createPartner = async function (this: WashdayClientInstance, data:
13
13
  const config = {
14
14
  headers: { Authorization: `Bearer ${this.apiToken}` }
15
15
  };
16
- return await axiosInstance.post(GET_SET_PARTNERS, data, config);
16
+ return await this.axiosInstance.post(GET_SET_PARTNERS, data, config);
17
17
  } catch (error) {
18
18
  console.error('Error fetching createPartner:', error);
19
19
  throw error;
@@ -13,7 +13,7 @@ export const updatePartnerById = async function (this: WashdayClientInstance, id
13
13
  const config = {
14
14
  headers: { Authorization: `Bearer ${this.apiToken}` }
15
15
  };
16
- return await axiosInstance.put(`${GET_SET_PARTNERS}/${id}`, data, config);
16
+ return await this.axiosInstance.put(`${GET_SET_PARTNERS}/${id}`, data, config);
17
17
  } catch (error) {
18
18
  console.error('Error fetching updatePartnerById:', error);
19
19
  throw error;
@@ -24,7 +24,7 @@ export const exportUnpaidOrdersReportPDF = async function (this: WashdayClientIn
24
24
  };
25
25
 
26
26
  const queryParams = generateQueryParamsStr(['store', 'fromDate', 'toDate', 'timezone', 'customerName'], params);
27
- return await axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/unpaidOrders/export/pdf?${queryParams}`, config);
27
+ return await this.axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/unpaidOrders/export/pdf?${queryParams}`, config);
28
28
 
29
29
  // // Create a link element, trigger a download
30
30
  // const url = window.URL.createObjectURL(new Blob([response.data]));
@@ -8,7 +8,7 @@ export const deleteById = async function (this: WashdayClientInstance, id: strin
8
8
  const config = {
9
9
  headers: { Authorization: `Bearer ${this.apiToken}` }
10
10
  };
11
- return await axiosInstance.delete(`${GET_SET_PRODUCTS}/${id}`, config);
11
+ return await this.axiosInstance.delete(`${GET_SET_PRODUCTS}/${id}`, config);
12
12
  } catch (error) {
13
13
  console.error('Error fetching deleteById:', error);
14
14
  throw error;
@@ -20,7 +20,7 @@ export const deleteProductSupplyById = async function (this: WashdayClientInstan
20
20
  const config = {
21
21
  headers: { Authorization: `Bearer ${this.apiToken}` }
22
22
  };
23
- return await axiosInstance.delete(`${GET_SET_PRODUCTS_SUPPLY}/${id}/${productSupplyId}`, config);
23
+ return await this.axiosInstance.delete(`${GET_SET_PRODUCTS_SUPPLY}/${id}/${productSupplyId}`, config);
24
24
  } catch (error) {
25
25
  console.error('Error fetching deleteProductSupplyById:', error);
26
26
  throw error;
@@ -8,7 +8,7 @@ export const getById = async function (this: WashdayClientInstance, id: string):
8
8
  const config = {
9
9
  headers: { Authorization: `Bearer ${this.apiToken}` }
10
10
  };
11
- return await axiosInstance.get(`${GET_SET_PRODUCTS}/${id}`, config);
11
+ return await this.axiosInstance.get(`${GET_SET_PRODUCTS}/${id}`, config);
12
12
  } catch (error) {
13
13
  console.error('Error fetching getById:', error);
14
14
  throw error;
@@ -41,7 +41,7 @@ export const updateById = async function (this: WashdayClientInstance, id: strin
41
41
  const config = {
42
42
  headers: { Authorization: `Bearer ${this.apiToken}` }
43
43
  };
44
- return await axiosInstance.put(`${GET_SET_PRODUCTS}/${id}`, data, config);
44
+ return await this.axiosInstance.put(`${GET_SET_PRODUCTS}/${id}`, data, config);
45
45
  } catch (error) {
46
46
  console.error('Error fetching updateById:', error);
47
47
  throw error;
@@ -8,7 +8,7 @@ export const getOrderPublicReceipt = async function (this: WashdayClientInstance
8
8
  const config = {
9
9
  headers: { Authorization: `Bearer ${this.apiToken}` }
10
10
  };
11
- return await axiosInstance.get(`${GET_PUBLIC_ORDERS_ROUTES}/${orderPublicToken}/receipt`, config);
11
+ return await this.axiosInstance.get(`${GET_PUBLIC_ORDERS_ROUTES}/${orderPublicToken}/receipt`, config);
12
12
  } catch (error) {
13
13
  console.error('Error fetching getOrderPublicReceipt:', error);
14
14
  throw error;
@@ -24,7 +24,7 @@ export const getCleanedOrdersReport = async function (this: WashdayClientInstanc
24
24
  'timezone',
25
25
  'includeGraph',
26
26
  ], params);
27
- return await axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/cleaned-orders?${queryParams}`, config);
27
+ return await this.axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/cleaned-orders?${queryParams}`, config);
28
28
  } catch (error) {
29
29
  console.error('Error fetching getCleanedOrdersReport:', error);
30
30
  throw error;
@@ -45,7 +45,7 @@ export const getCleanedOrdersGraphDataReport = async function (this: WashdayClie
45
45
  'fromDate',
46
46
  'timezone',
47
47
  ], params);
48
- return await axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/cleaned-orders-graph?${queryParams}`, config);
48
+ return await this.axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/cleaned-orders-graph?${queryParams}`, config);
49
49
  } catch (error) {
50
50
  console.error('Error fetching getCleanedOrdersGraphDataReport :', error);
51
51
  throw error;
@@ -68,7 +68,7 @@ export const getSalesReport = async function (this: WashdayClientInstance, store
68
68
  'timezone',
69
69
  'type',
70
70
  ], params);
71
- return await axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/sales?${queryParams}`, config);
71
+ return await this.axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/sales?${queryParams}`, config);
72
72
  } catch (error) {
73
73
  console.error('Error fetching getSalesReport:', error);
74
74
  throw error;
@@ -88,7 +88,7 @@ export const getCustomersReport = async function (this: WashdayClientInstance, s
88
88
  'fromDate',
89
89
  'toDate',
90
90
  ], params);
91
- return await axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/customers?${queryParams}`, config);
91
+ return await this.axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/customers?${queryParams}`, config);
92
92
  } catch (error) {
93
93
  console.error('Error fetching getCustomersReport:', error);
94
94
  throw error;
@@ -108,7 +108,7 @@ export const getSuppliesReport = async function (this: WashdayClientInstance, st
108
108
  'fromDate',
109
109
  'toDate',
110
110
  ], params);
111
- return await axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/supplies?${queryParams}`, config);
111
+ return await this.axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/supplies?${queryParams}`, config);
112
112
  } catch (error) {
113
113
  console.error('Error fetching getSuppliesReport:', error);
114
114
  throw error;
@@ -123,7 +123,7 @@ export const getDiscountCodesReport = async function (this: WashdayClientInstanc
123
123
  };
124
124
  const queryParams = generateQueryParamsStr([
125
125
  ], params);
126
- return await axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/discountCodes?${queryParams}`, config);
126
+ return await this.axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/discountCodes?${queryParams}`, config);
127
127
  } catch (error) {
128
128
  console.error('Error fetching getDiscountCodesReport:', error);
129
129
  throw error;
@@ -143,7 +143,7 @@ export const getStaffReport = async function (this: WashdayClientInstance, store
143
143
  'fromDate',
144
144
  'toDate',
145
145
  ], params);
146
- return await axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/staff?${queryParams}`, config);
146
+ return await this.axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/staff?${queryParams}`, config);
147
147
  } catch (error) {
148
148
  console.error('Error fetching getStaffReport:', error);
149
149
  throw error;
@@ -164,7 +164,7 @@ export const getProductSalesReport = async function (this: WashdayClientInstance
164
164
  'fromDate',
165
165
  'timezone',
166
166
  ], params);
167
- return await axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/productSales?${queryParams}`, config);
167
+ return await this.axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/productSales?${queryParams}`, config);
168
168
  } catch (error) {
169
169
  console.error('Error fetching getProductSalesReport:', error);
170
170
  throw error;
@@ -189,7 +189,7 @@ export const getPaymentLinesReport = async function (this: WashdayClientInstance
189
189
  'limit',
190
190
  'timezone',
191
191
  ], params);
192
- return await axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/paymentLines?${queryParams}`, config);
192
+ return await this.axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/paymentLines?${queryParams}`, config);
193
193
  } catch (error) {
194
194
  console.error('Error fetching getPaymentLinesReport:', error);
195
195
  throw error;
@@ -216,7 +216,7 @@ export const getUnpaidOrdersReport = async function (this: WashdayClientInstance
216
216
  'timezone',
217
217
  'customerName'
218
218
  ], params);
219
- return await axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/unpaidOrders?${queryParams}`, config);
219
+ return await this.axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/unpaidOrders?${queryParams}`, config);
220
220
  } catch (error) {
221
221
  console.error('Error fetching getUnpaidOrdersReport:', error);
222
222
  throw error;
@@ -237,7 +237,7 @@ export const getAnnualSalesStatistics = async function (this: WashdayClientInsta
237
237
  'fromDate',
238
238
  'timezone',
239
239
  ], params);
240
- return await axiosInstance.get(`${GET_SET_STATISTICS}/${storeId}/annual?${queryParams}`, config);
240
+ return await this.axiosInstance.get(`${GET_SET_STATISTICS}/${storeId}/annual?${queryParams}`, config);
241
241
  } catch (error) {
242
242
  console.error('Error fetching getAnnualSalesStatistics :', error);
243
243
  throw error;
@@ -258,7 +258,7 @@ export const getPaymentMethodStatistics = async function (this: WashdayClientIns
258
258
  'fromDate',
259
259
  'timezone',
260
260
  ], params);
261
- return await axiosInstance.get(`${GET_SET_STATISTICS}/${storeId}/ordersPaymentMethod?${queryParams}`, config);
261
+ return await this.axiosInstance.get(`${GET_SET_STATISTICS}/${storeId}/ordersPaymentMethod?${queryParams}`, config);
262
262
  } catch (error) {
263
263
  console.error('Error fetching getPaymentMethodStatistics :', error);
264
264
  throw error;
@@ -279,7 +279,7 @@ export const getProductsStatistics = async function (this: WashdayClientInstance
279
279
  'fromDate',
280
280
  'timezone',
281
281
  ], params);
282
- return await axiosInstance.get(`${GET_SET_STATISTICS}/${storeId}/ordersProduct?${queryParams}`, config);
282
+ return await this.axiosInstance.get(`${GET_SET_STATISTICS}/${storeId}/ordersProduct?${queryParams}`, config);
283
283
  } catch (error) {
284
284
  console.error('Error fetching getProductsStatistics :', error);
285
285
  throw error;
@@ -300,7 +300,7 @@ export const getMonthSalesStatistics = async function (this: WashdayClientInstan
300
300
  'fromDate',
301
301
  'timezone',
302
302
  ], params);
303
- return await axiosInstance.get(`${GET_SET_STATISTICS}/${storeId}/month?${queryParams}`, config);
303
+ return await this.axiosInstance.get(`${GET_SET_STATISTICS}/${storeId}/month?${queryParams}`, config);
304
304
  } catch (error) {
305
305
  console.error('Error fetching getMonthSalesStatistics :', error);
306
306
  throw error;
@@ -321,7 +321,7 @@ export const getPopularDaysStatistics = async function (this: WashdayClientInsta
321
321
  'fromDate',
322
322
  'timezone',
323
323
  ], params);
324
- return await axiosInstance.get(`${GET_SET_STATISTICS}/${storeId}/popularDays?${queryParams}`, config);
324
+ return await this.axiosInstance.get(`${GET_SET_STATISTICS}/${storeId}/popularDays?${queryParams}`, config);
325
325
  } catch (error) {
326
326
  console.error('Error fetching getPopularDaysStatistics :', error);
327
327
  throw error;
@@ -7,7 +7,7 @@
7
7
  // const config = {
8
8
  // headers: { Authorization: `Bearer ${this.apiToken}` }
9
9
  // };
10
- // return await axiosInstance.delete(`${GET_SET_ORDER_PAYMENTLINES(orderId)}/${id}`, config);
10
+ // return await this.axiosInstance.delete(`${GET_SET_ORDER_PAYMENTLINES(orderId)}/${id}`, config);
11
11
  // } catch (error) {
12
12
  // console.error('Error fetching deleteById:', error);
13
13
  // throw error;
@@ -11,7 +11,7 @@ export const getList = async function (this: WashdayClientInstance, storeId: str
11
11
  };
12
12
  const queryParams = generateQueryParamsStr(['sortBy'], params);
13
13
 
14
- return await axiosInstance.get(`${GET_SET_REVIEWS}/${storeId}?${queryParams}`, config);
14
+ return await this.axiosInstance.get(`${GET_SET_REVIEWS}/${storeId}?${queryParams}`, config);
15
15
  } catch (error) {
16
16
  console.error('Error fetching:', error);
17
17
  throw error;
@@ -23,7 +23,7 @@ export const requestStoreReviewByCustomerId = async function (this: WashdayClien
23
23
  const config = {
24
24
  headers: { Authorization: `Bearer ${this.apiToken}` }
25
25
  };
26
- return await axiosInstance.get(`${GET_SET_REVIEWS}/request/${storeId}/${customerId}`, config);
26
+ return await this.axiosInstance.get(`${GET_SET_REVIEWS}/request/${storeId}/${customerId}`, config);
27
27
  } catch (error) {
28
28
  console.error('Error fetching:', error);
29
29
  throw error;
@@ -12,7 +12,7 @@
12
12
  // const config = {
13
13
  // headers: { Authorization: `Bearer ${this.apiToken}` }
14
14
  // };
15
- // return await axiosInstance.post(`${GET_SET_ORDER_PAYMENTLINES(id)}`, data, config);
15
+ // return await this.axiosInstance.post(`${GET_SET_ORDER_PAYMENTLINES(id)}`, data, config);
16
16
  // } catch (error) {
17
17
  // console.error('Error fetching create:', error);
18
18
  // throw error;
@@ -30,7 +30,7 @@
30
30
  // const config = {
31
31
  // headers: { Authorization: `Bearer ${this.apiToken}` }
32
32
  // };
33
- // return await axiosInstance.put(`${GET_SET_ORDER}/${id}`, data, config);
33
+ // return await this.axiosInstance.put(`${GET_SET_ORDER}/${id}`, data, config);
34
34
  // } catch (error) {
35
35
  // console.error('Error fetching updateById:', error);
36
36
  // throw error;
@@ -45,7 +45,7 @@
45
45
  // const config = {
46
46
  // headers: { Authorization: `Bearer ${this.apiToken}` }
47
47
  // };
48
- // return await axiosInstance.put(`${GET_SET_ORDER_PAYMENTLINES(orderId)}/${id}`, data, config);
48
+ // return await this.axiosInstance.put(`${GET_SET_ORDER_PAYMENTLINES(orderId)}/${id}`, data, config);
49
49
  // } catch (error) {
50
50
  // console.error('Error fetching updateById:', error);
51
51
  // throw error;
@@ -7,7 +7,7 @@ export const deleteRouteById = async function (this: WashdayClientInstance, id:
7
7
  const config = {
8
8
  headers: { Authorization: `Bearer ${this.apiToken}` }
9
9
  };
10
- return await axiosInstance.delete(`${GET_SET_ROUTES}/${id}`, config);
10
+ return await this.axiosInstance.delete(`${GET_SET_ROUTES}/${id}`, config);
11
11
  } catch (error) {
12
12
  console.error('Error fetching deleteRouteById:', error);
13
13
  throw error;
@@ -20,7 +20,7 @@ export const getOrdersForRoute = async function (this: WashdayClientInstance, pa
20
20
  'store',
21
21
  'routeDate'
22
22
  ], params);
23
- return await axiosInstance.get(`${GET_SET_ROUTES_ORDERS}?${queryParams}`, config);
23
+ return await this.axiosInstance.get(`${GET_SET_ROUTES_ORDERS}?${queryParams}`, config);
24
24
  } catch (error) {
25
25
  console.error('Error fetching getOrdersForRoute:', error);
26
26
  throw error;
@@ -33,7 +33,7 @@ export const getStoreRoutesList = async function (this: WashdayClientInstance, s
33
33
  const config = {
34
34
  headers: { Authorization: `Bearer ${this.apiToken}` }
35
35
  };
36
- return await axiosInstance.get(`${GET_STORE_ROUTES}/${storeId}`, config);
36
+ return await this.axiosInstance.get(`${GET_STORE_ROUTES}/${storeId}`, config);
37
37
  } catch (error) {
38
38
  console.error('Error fetching getStoreRoutesList:', error);
39
39
  throw error;
@@ -47,7 +47,7 @@ export const getRoutesByStore = async function (this: WashdayClientInstance, sto
47
47
  const config = {
48
48
  headers: { Authorization: `Bearer ${this.apiToken}` }
49
49
  };
50
- return await axiosInstance.get(`${GET_STORE_ROUTES_BY_ID.replace(':id', storeId)}`, config);
50
+ return await this.axiosInstance.get(`${GET_STORE_ROUTES_BY_ID.replace(':id', storeId)}`, config);
51
51
  } catch (error) {
52
52
  console.error('Error fetching getRoutesByStore:', error);
53
53
  throw error;
@@ -59,7 +59,7 @@ export const getRouteByIdV2 = async function (this: WashdayClientInstance, route
59
59
  const config = {
60
60
  headers: { Authorization: `Bearer ${this.apiToken}` }
61
61
  };
62
- return await axiosInstance.get(`${GET_ROUTE}/${routeId}`, config);
62
+ return await this.axiosInstance.get(`${GET_ROUTE}/${routeId}`, config);
63
63
  } catch (error) {
64
64
  console.error('Error fetching getRouteByIdV2:', error);
65
65
  throw error;
@@ -76,7 +76,7 @@ export const getRoutesByDriver = async function (this: WashdayClientInstance, qu
76
76
  const queryParams = generateQueryParamsStr([
77
77
  'status',
78
78
  ], query);
79
- return await axiosInstance.get(`${GET_ROUTE}?${queryParams}`, config);
79
+ return await this.axiosInstance.get(`${GET_ROUTE}?${queryParams}`, config);
80
80
  } catch (error) {
81
81
  console.error('Error fetching getRoutesByDriver:', error);
82
82
  throw error;
@@ -21,7 +21,7 @@ export const createRoute = async function (this: WashdayClientInstance, data: {
21
21
  const config = {
22
22
  headers: { Authorization: `Bearer ${this.apiToken}` }
23
23
  };
24
- return await axiosInstance.post(GET_SET_ROUTES, data, config);
24
+ return await this.axiosInstance.post(GET_SET_ROUTES, data, config);
25
25
  } catch (error) {
26
26
  console.error('Error fetching createRoute:', error);
27
27
  throw error;
@@ -39,7 +39,7 @@ export const createRouteV2 = async function (this: WashdayClientInstance, data:
39
39
  headers: { Authorization: `Bearer ${this.apiToken}` }
40
40
  };
41
41
  const { storeId, ...rest } = data;
42
- return await axiosInstance.post(GET_STORE_ROUTES_BY_ID.replace(':id', storeId), rest, config);
42
+ return await this.axiosInstance.post(GET_STORE_ROUTES_BY_ID.replace(':id', storeId), rest, config);
43
43
  } catch (error) {
44
44
  console.error('Error fetching createRouteV2:', error);
45
45
  throw error;
@@ -52,7 +52,7 @@ export const startRoute = async function (this: WashdayClientInstance, routeId:
52
52
  const config = {
53
53
  headers: { Authorization: `Bearer ${this.apiToken}` }
54
54
  };
55
- return await axiosInstance.post(`${GET_SET_ROUTES}/${routeId}/start`, {}, config);
55
+ return await this.axiosInstance.post(`${GET_SET_ROUTES}/${routeId}/start`, {}, config);
56
56
  } catch (error) {
57
57
  console.error('Error fetching startRoute:', error);
58
58
  throw error;
@@ -10,7 +10,7 @@ export const closeStoreRoutes = async function (this: WashdayClientInstance, sto
10
10
  const config = {
11
11
  headers: { Authorization: `Bearer ${this.apiToken}` }
12
12
  };
13
- return await axiosInstance.put(`${GET_STORE_ROUTES}/${storeId}/close`, data, config);
13
+ return await this.axiosInstance.put(`${GET_STORE_ROUTES}/${storeId}/close`, data, config);
14
14
  } catch (error) {
15
15
  console.error('Error fetching closeStoreRoutes:', error);
16
16
  throw error;
@@ -22,7 +22,7 @@ export const closeRouteById = async function (this: WashdayClientInstance, route
22
22
  const config = {
23
23
  headers: { Authorization: `Bearer ${this.apiToken}` }
24
24
  };
25
- return await axiosInstance.put(`${GET_ROUTE}/${routeId}/close`, {}, config);
25
+ return await this.axiosInstance.put(`${GET_ROUTE}/${routeId}/close`, {}, config);
26
26
  } catch (error) {
27
27
  console.error('Error fetching closeRouteById:', error);
28
28
  throw error;
@@ -36,7 +36,7 @@ export const updateRouteById = async function (this: WashdayClientInstance, rout
36
36
  const config = {
37
37
  headers: { Authorization: `Bearer ${this.apiToken}` }
38
38
  };
39
- return await axiosInstance.put(`${GET_ROUTE}/${routeId}`, data, config);
39
+ return await this.axiosInstance.put(`${GET_ROUTE}/${routeId}`, data, config);
40
40
  } catch (error) {
41
41
  console.error('Error fetching updateRouteById:', error);
42
42
  throw error;
@@ -7,7 +7,7 @@ export const deleteById = async function (this: WashdayClientInstance, id: strin
7
7
  const config = {
8
8
  headers: { Authorization: `Bearer ${this.apiToken}` }
9
9
  };
10
- return await axiosInstance.delete(`${GET_SET_SECTIONS}/${id}`, config);
10
+ return await this.axiosInstance.delete(`${GET_SET_SECTIONS}/${id}`, config);
11
11
  } catch (error) {
12
12
  console.error('Error fetching deleteById:', error);
13
13
  throw error;
@@ -28,7 +28,7 @@ export const getList = async function (this: WashdayClientInstance, params?: {
28
28
  queryParams += `&products=${params?.products}`
29
29
  }
30
30
 
31
- return await axiosInstance.get(`${GET_SET_SECTIONS}?${queryParams}`, config);
31
+ return await this.axiosInstance.get(`${GET_SET_SECTIONS}?${queryParams}`, config);
32
32
  } catch (error) {
33
33
  console.error('Error fetching getStoreStaff:', error);
34
34
  throw error;
@@ -40,7 +40,7 @@ export const getById = async function (this: WashdayClientInstance, id: string):
40
40
  const config = {
41
41
  headers: { Authorization: `Bearer ${this.apiToken}` }
42
42
  };
43
- return await axiosInstance.get(`${GET_SET_SECTIONS}/${id}`, config);
43
+ return await this.axiosInstance.get(`${GET_SET_SECTIONS}/${id}`, config);
44
44
  } catch (error) {
45
45
  console.error('Error fetching getSectionById:', error);
46
46
  throw error;
@@ -59,7 +59,7 @@ export const getSectionsByStoreCustomersApp = async function (this: WashdayClien
59
59
  const queryParams = generateQueryParamsStr([
60
60
  'storeId',
61
61
  ], params);
62
- return await axiosInstance.get(`${GET_SET_SECTIONS_WASHDAY_APP}?${queryParams}`, config);
62
+ return await this.axiosInstance.get(`${GET_SET_SECTIONS_WASHDAY_APP}?${queryParams}`, config);
63
63
  } catch (error) {
64
64
  console.error('Error fetching getSectionsByStoreCustomersApp:', error);
65
65
  throw error;
@@ -14,7 +14,7 @@ export const updateById = async function (this: WashdayClientInstance, id: strin
14
14
  const config = {
15
15
  headers: { Authorization: `Bearer ${this.apiToken}` }
16
16
  };
17
- return await axiosInstance.put(`${GET_SET_SECTIONS}/${id}`, data, config);
17
+ return await this.axiosInstance.put(`${GET_SET_SECTIONS}/${id}`, data, config);
18
18
  } catch (error) {
19
19
  console.error('Error fetching updateById:', error);
20
20
  throw error;
@@ -21,7 +21,7 @@ export const getStoreStaffById = async function (this: WashdayClientInstance, st
21
21
  const config = {
22
22
  headers: { Authorization: `Bearer ${this.apiToken}` }
23
23
  };
24
- return await axiosInstance.get(`${GET_SET_STAFF(storeId)}/${staffId}`, config);
24
+ return await this.axiosInstance.get(`${GET_SET_STAFF(storeId)}/${staffId}`, config);
25
25
  } catch (error) {
26
26
  console.error('Error fetching getStoreStaffById:', error);
27
27
  throw error;
@@ -51,7 +51,7 @@ export const createGetMoreCheckoutSession = async function (this: WashdayClientI
51
51
  const config = {
52
52
  headers: { Authorization: `Bearer ${this.apiToken}` }
53
53
  };
54
- return await axiosInstance.post(`${GENERATE_CHECKOUT_SESSION}`, data, config);
54
+ return await this.axiosInstance.post(`${GENERATE_CHECKOUT_SESSION}`, data, config);
55
55
  } catch (error) {
56
56
  console.error('Error fetching createGetMoreCheckoutSession:', error);
57
57
  throw error;
@@ -21,7 +21,7 @@ export const getSupplyById = async function (this: WashdayClientInstance, storeI
21
21
  const config = {
22
22
  headers: { Authorization: `Bearer ${this.apiToken}` }
23
23
  };
24
- return await axiosInstance.get(`${GET_SET_SUPPLY(storeId)}/${id}`, config);
24
+ return await this.axiosInstance.get(`${GET_SET_SUPPLY(storeId)}/${id}`, config);
25
25
  } catch (error) {
26
26
  console.error('Error fetching getStoreSupplyById:', error);
27
27
  throw error;
@@ -10,7 +10,7 @@ export const validateUserPin = async function (this: WashdayClientInstance, data
10
10
  const config = {
11
11
  headers: { Authorization: `Bearer ${this.apiToken}` }
12
12
  };
13
- return await axiosInstance.post(`${GET_SET_USER}/validate-pin`, data, config);
13
+ return await this.axiosInstance.post(`${GET_SET_USER}/validate-pin`, data, config);
14
14
  } catch (error) {
15
15
  console.error('Error fetching validateUserPin:', error);
16
16
  throw error;
@@ -41,9 +41,12 @@ import * as partnersEndpoints from '../api/partners';
41
41
  import * as outsourcedOrdersEndpoints from '../api/outsourcedOrders';
42
42
  import * as publicsEndpoints from '../api/publics';
43
43
  import { validateUserPin } from "../api/users/post";
44
+ import { AxiosInstance } from "axios";
44
45
 
45
46
  export interface WashdayClientInstance {
46
47
  apiToken: string;
48
+ env: string;
49
+ axiosInstance: AxiosInstance;
47
50
  cashup: {
48
51
  getList: typeof cashupsEndpoints.getModule.getList;
49
52
  getById: typeof cashupsEndpoints.getModule.getById;