washday-sdk 1.1.10 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (162) 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/cashierbox/get.js +3 -4
  8. package/dist/api/cashierbox/post.js +2 -3
  9. package/dist/api/cashierbox/put.js +2 -3
  10. package/dist/api/cashups/delete.js +1 -2
  11. package/dist/api/cashups/get.js +3 -4
  12. package/dist/api/cashups/post.js +1 -2
  13. package/dist/api/cashups/put.js +2 -2
  14. package/dist/api/cfdi/delete.js +1 -2
  15. package/dist/api/cfdi/get.js +6 -7
  16. package/dist/api/cfdi/post.js +2 -3
  17. package/dist/api/cfdi/put.js +2 -2
  18. package/dist/api/companies/get.js +1 -2
  19. package/dist/api/companies/post.js +2 -3
  20. package/dist/api/companies/put.js +3 -4
  21. package/dist/api/countries/get.js +1 -2
  22. package/dist/api/csv/get.js +13 -14
  23. package/dist/api/customers/delete.js +2 -3
  24. package/dist/api/customers/get.js +6 -7
  25. package/dist/api/customers/post.js +2 -3
  26. package/dist/api/customers/put.js +3 -4
  27. package/dist/api/discounts/get.js +7 -8
  28. package/dist/api/discounts/post.js +2 -3
  29. package/dist/api/discounts/put.js +4 -5
  30. package/dist/api/index.js +4 -1
  31. package/dist/api/inventory/delete.js +1 -2
  32. package/dist/api/inventory/get.js +3 -4
  33. package/dist/api/inventory/post.js +1 -2
  34. package/dist/api/inventory/put.js +2 -3
  35. package/dist/api/order/delete.js +2 -3
  36. package/dist/api/order/get.js +8 -9
  37. package/dist/api/order/post.js +7 -8
  38. package/dist/api/order/put.js +13 -14
  39. package/dist/api/outsourcedOrders/delete.js +1 -2
  40. package/dist/api/outsourcedOrders/get.js +3 -4
  41. package/dist/api/outsourcedOrders/post.js +1 -2
  42. package/dist/api/outsourcedOrders/put.js +1 -2
  43. package/dist/api/partners/delete.js +1 -2
  44. package/dist/api/partners/get.js +2 -3
  45. package/dist/api/partners/post.js +1 -2
  46. package/dist/api/partners/put.js +1 -2
  47. package/dist/api/pdf/get.js +1 -2
  48. package/dist/api/products/delete.js +3 -4
  49. package/dist/api/products/get.js +1 -2
  50. package/dist/api/products/post.js +4 -5
  51. package/dist/api/products/put.js +3 -4
  52. package/dist/api/publics/get.js +1 -2
  53. package/dist/api/reports/get.js +15 -16
  54. package/dist/api/reviews/delete.js +1 -1
  55. package/dist/api/reviews/get.js +2 -3
  56. package/dist/api/reviews/post.js +1 -1
  57. package/dist/api/reviews/put.js +2 -2
  58. package/dist/api/routes/delete.js +1 -2
  59. package/dist/api/routes/get.js +5 -6
  60. package/dist/api/routes/post.js +3 -4
  61. package/dist/api/routes/put.js +3 -4
  62. package/dist/api/sections/delete.js +1 -2
  63. package/dist/api/sections/get.js +3 -4
  64. package/dist/api/sections/post.js +1 -2
  65. package/dist/api/sections/put.js +1 -2
  66. package/dist/api/staff/delete.js +1 -2
  67. package/dist/api/staff/get.js +2 -3
  68. package/dist/api/staff/post.js +1 -2
  69. package/dist/api/staff/put.js +1 -2
  70. package/dist/api/stores/get.js +6 -7
  71. package/dist/api/stores/post.js +3 -4
  72. package/dist/api/stores/put.js +2 -3
  73. package/dist/api/stripe/post.js +4 -5
  74. package/dist/api/supplies/delete.js +1 -2
  75. package/dist/api/supplies/get.js +3 -4
  76. package/dist/api/supplies/post.js +1 -2
  77. package/dist/api/supplies/put.js +2 -3
  78. package/dist/api/users/delete.js +1 -2
  79. package/dist/api/users/post.js +1 -2
  80. package/dist/api/users/put.js +1 -2
  81. package/package.json +1 -1
  82. package/src/api/attendance/get.ts +4 -4
  83. package/src/api/attendance/post.ts +2 -2
  84. package/src/api/attendance/put.ts +1 -1
  85. package/src/api/auth/post.ts +13 -13
  86. package/src/api/axiosInstance.ts +51 -40
  87. package/src/api/cashierbox/delete.ts +2 -2
  88. package/src/api/cashierbox/get.ts +3 -3
  89. package/src/api/cashierbox/post.ts +2 -2
  90. package/src/api/cashierbox/put.ts +2 -2
  91. package/src/api/cashups/delete.ts +1 -1
  92. package/src/api/cashups/get.ts +3 -3
  93. package/src/api/cashups/post.ts +1 -1
  94. package/src/api/cashups/put.ts +2 -2
  95. package/src/api/cfdi/delete.ts +1 -1
  96. package/src/api/cfdi/get.ts +6 -6
  97. package/src/api/cfdi/post.ts +2 -2
  98. package/src/api/cfdi/put.ts +2 -2
  99. package/src/api/companies/get.ts +1 -1
  100. package/src/api/companies/post.ts +2 -2
  101. package/src/api/companies/put.ts +3 -3
  102. package/src/api/countries/get.ts +1 -1
  103. package/src/api/csv/get.ts +13 -13
  104. package/src/api/customers/delete.ts +2 -2
  105. package/src/api/customers/get.ts +6 -6
  106. package/src/api/customers/post.ts +2 -2
  107. package/src/api/customers/put.ts +3 -3
  108. package/src/api/discounts/get.ts +7 -7
  109. package/src/api/discounts/post.ts +2 -2
  110. package/src/api/discounts/put.ts +4 -4
  111. package/src/api/index.ts +4 -2
  112. package/src/api/inventory/delete.ts +1 -1
  113. package/src/api/inventory/get.ts +3 -3
  114. package/src/api/inventory/post.ts +1 -1
  115. package/src/api/inventory/put.ts +2 -2
  116. package/src/api/order/delete.ts +2 -2
  117. package/src/api/order/get.ts +8 -8
  118. package/src/api/order/post.ts +7 -7
  119. package/src/api/order/put.ts +13 -13
  120. package/src/api/outsourcedOrders/delete.ts +1 -1
  121. package/src/api/outsourcedOrders/get.ts +3 -3
  122. package/src/api/outsourcedOrders/post.ts +1 -1
  123. package/src/api/outsourcedOrders/put.ts +1 -1
  124. package/src/api/partners/delete.ts +1 -1
  125. package/src/api/partners/get.ts +2 -2
  126. package/src/api/partners/post.ts +1 -1
  127. package/src/api/partners/put.ts +1 -1
  128. package/src/api/pdf/get.ts +1 -1
  129. package/src/api/products/delete.ts +3 -3
  130. package/src/api/products/get.ts +1 -1
  131. package/src/api/products/post.ts +4 -4
  132. package/src/api/products/put.ts +3 -3
  133. package/src/api/publics/get.ts +1 -1
  134. package/src/api/reports/get.ts +15 -15
  135. package/src/api/reviews/delete.ts +1 -1
  136. package/src/api/reviews/get.ts +2 -2
  137. package/src/api/reviews/post.ts +1 -1
  138. package/src/api/reviews/put.ts +2 -2
  139. package/src/api/routes/delete.ts +1 -1
  140. package/src/api/routes/get.ts +5 -5
  141. package/src/api/routes/post.ts +3 -3
  142. package/src/api/routes/put.ts +3 -3
  143. package/src/api/sections/delete.ts +1 -1
  144. package/src/api/sections/get.ts +3 -3
  145. package/src/api/sections/post.ts +1 -1
  146. package/src/api/sections/put.ts +1 -1
  147. package/src/api/staff/delete.ts +1 -1
  148. package/src/api/staff/get.ts +2 -2
  149. package/src/api/staff/post.ts +1 -1
  150. package/src/api/staff/put.ts +1 -1
  151. package/src/api/stores/get.ts +6 -6
  152. package/src/api/stores/post.ts +3 -3
  153. package/src/api/stores/put.ts +2 -2
  154. package/src/api/stripe/post.ts +4 -4
  155. package/src/api/supplies/delete.ts +1 -1
  156. package/src/api/supplies/get.ts +3 -3
  157. package/src/api/supplies/post.ts +1 -1
  158. package/src/api/supplies/put.ts +2 -2
  159. package/src/api/users/delete.ts +1 -1
  160. package/src/api/users/post.ts +1 -1
  161. package/src/api/users/put.ts +1 -1
  162. package/src/interfaces/Api.ts +3 -0
@@ -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;
@@ -13,7 +13,7 @@ export const create = async function (this: WashdayClientInstance, data: {
13
13
  const config = {
14
14
  headers: { Authorization: `Bearer ${this.apiToken}` }
15
15
  };
16
- const response = await axiosInstance.post(`${GET_SET_SECTIONS}`, data, config);
16
+ const response = await this.axiosInstance.post(`${GET_SET_SECTIONS}`, data, config);
17
17
  return response;
18
18
  } catch (error) {
19
19
  console.error('Error fetching create:', 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;
@@ -7,7 +7,7 @@ export const deleteStoreStaffById = async function (this: WashdayClientInstance,
7
7
  const config = {
8
8
  headers: { Authorization: `Bearer ${this.apiToken}` }
9
9
  };
10
- const response = await axiosInstance.delete(`${GET_SET_STAFF(storeId)}/${staffId}`, config);
10
+ const response = await this.axiosInstance.delete(`${GET_SET_STAFF(storeId)}/${staffId}`, config);
11
11
  return response;
12
12
  } catch (error) {
13
13
  console.error('Error fetching getStoreStaff:', error);
@@ -8,7 +8,7 @@ export const getStoreStaff = async function (this: WashdayClientInstance, storeI
8
8
  const config = {
9
9
  headers: { Authorization: `Bearer ${this.apiToken}` }
10
10
  };
11
- const response = await axiosInstance.get(`${GET_SET_STAFF(storeId)}?${queryParams}`, config);
11
+ const response = await this.axiosInstance.get(`${GET_SET_STAFF(storeId)}?${queryParams}`, config);
12
12
  return response;
13
13
  } catch (error) {
14
14
  console.error('Error fetching getStoreStaff:', 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;
@@ -8,7 +8,7 @@ export const createStoreStaff = async function (this: WashdayClientInstance, sto
8
8
  const config = {
9
9
  headers: { Authorization: `Bearer ${this.apiToken}` }
10
10
  };
11
- const response = await axiosInstance.post(`${GET_SET_STAFF(storeId)}`, data, config);
11
+ const response = await this.axiosInstance.post(`${GET_SET_STAFF(storeId)}`, data, config);
12
12
  return response;
13
13
  } catch (error) {
14
14
  console.error('Error fetching createStoreImage:', error);
@@ -8,7 +8,7 @@ export const updateStoreStaffById = async function (this: WashdayClientInstance,
8
8
  const config = {
9
9
  headers: { Authorization: `Bearer ${this.apiToken}` }
10
10
  };
11
- const response = await axiosInstance.put(`${GET_SET_STAFF(storeId)}/${staffId}`, data, config);
11
+ const response = await this.axiosInstance.put(`${GET_SET_STAFF(storeId)}/${staffId}`, data, config);
12
12
  return response;
13
13
  } catch (error) {
14
14
  console.error('Error fetching getStoreById:', error);
@@ -19,7 +19,7 @@ export const getStores = async function (this: WashdayClientInstance, params: {
19
19
  if (params.isActive) {
20
20
  queryParams += `isActive=${params.isActive}`
21
21
  }
22
- const response = await axiosInstance.get(`${GET_SET_STORES}?${queryParams}`, { params: { ...REQUEST_PARAMS } });
22
+ const response = await this.axiosInstance.get(`${GET_SET_STORES}?${queryParams}`, { params: { ...REQUEST_PARAMS } });
23
23
  return response.data?.data?.stores || [];
24
24
  } catch (error) {
25
25
  console.error('Error fetching getStores:', error);
@@ -33,7 +33,7 @@ export const getStoreReviewLink = async function (this: WashdayClientInstance, s
33
33
  const config = {
34
34
  headers: { Authorization: `Bearer ${this.apiToken}` }
35
35
  };
36
- const response = await axiosInstance.get(`${GET_SET_STORES}/review-link/${storeId}`, config);
36
+ const response = await this.axiosInstance.get(`${GET_SET_STORES}/review-link/${storeId}`, config);
37
37
  return response;
38
38
  } catch (error) {
39
39
  console.error('Error fetching getStoreReviewLink:', error);
@@ -44,7 +44,7 @@ export const getStoreReviewLink = async function (this: WashdayClientInstance, s
44
44
  export const getStoreById = async function (this: WashdayClientInstance, storeId: string): Promise<{ store: IStore }> {
45
45
  try {
46
46
  REQUEST_PARAMS.token = this.apiToken;
47
- const response = await axiosInstance.get(`${GET_SET_STORES}/${storeId}`, { params: { ...REQUEST_PARAMS } });
47
+ const response = await this.axiosInstance.get(`${GET_SET_STORES}/${storeId}`, { params: { ...REQUEST_PARAMS } });
48
48
  return response.data?.data || {}
49
49
  } catch (error) {
50
50
  console.error('Error fetching getStoreById:', error);
@@ -57,7 +57,7 @@ export const getStoreImages = async function (this: WashdayClientInstance, store
57
57
  const config = {
58
58
  headers: { Authorization: `Bearer ${this.apiToken}` }
59
59
  };
60
- const response = await axiosInstance.get(`${GET_SET_STORE_IMAGE}?store=${storeId}`, config);
60
+ const response = await this.axiosInstance.get(`${GET_SET_STORE_IMAGE}?store=${storeId}`, config);
61
61
  return response;
62
62
  } catch (error) {
63
63
  console.error('Error fetching getStoreImages:', error);
@@ -71,7 +71,7 @@ export const getStoresByName = async function (this: WashdayClientInstance, quer
71
71
  try {
72
72
  const config = {};
73
73
  const queryParams = generateQueryParamsStr(['q'], query);
74
- const response = await axiosInstance.get(`${GET_STORES_WASHDAY_APP}?${queryParams}`, config);
74
+ const response = await this.axiosInstance.get(`${GET_STORES_WASHDAY_APP}?${queryParams}`, config);
75
75
  return response.data?.data?.stores || [];
76
76
  } catch (error) {
77
77
  console.error('Error fetching getStoresByName:', error);
@@ -84,7 +84,7 @@ export const getStoresByIdCustomersApp = async function (this: WashdayClientInst
84
84
  const config = {
85
85
  headers: { Authorization: `Bearer ${this.apiToken}` }
86
86
  };
87
- const response = await axiosInstance.get(`${GET_STORES_WASHDAY_APP}/${id}`, config);
87
+ const response = await this.axiosInstance.get(`${GET_STORES_WASHDAY_APP}/${id}`, config);
88
88
  return response.data?.data?.store || [];
89
89
  } catch (error) {
90
90
  console.error('Error fetching getStoresByIdCustomersApp:', error);
@@ -10,7 +10,7 @@ export const createStoreImage = async function (this: WashdayClientInstance, dat
10
10
  const config = {
11
11
  headers: { Authorization: `Bearer ${this.apiToken}`, 'Content-Type': false }
12
12
  };
13
- const response = await axiosInstance.post(`${GET_SET_STORE_IMAGE}`, data, config);
13
+ const response = await this.axiosInstance.post(`${GET_SET_STORE_IMAGE}`, data, config);
14
14
  return response;
15
15
  } catch (error) {
16
16
  console.error('Error fetching createStoreImage:', error);
@@ -23,7 +23,7 @@ export const createStore = async function (this: WashdayClientInstance, data: an
23
23
  const config = {
24
24
  headers: { Authorization: `Bearer ${this.apiToken}` }
25
25
  };
26
- const response = await axiosInstance.post(`${GET_SET_STORES}`, data, config);
26
+ const response = await this.axiosInstance.post(`${GET_SET_STORES}`, data, config);
27
27
  return response;
28
28
  } catch (error) {
29
29
  console.error('Error fetching createStore:', error);
@@ -37,7 +37,7 @@ export const copyStore = async function (this: WashdayClientInstance, copyStoreI
37
37
  const config = {
38
38
  headers: { Authorization: `Bearer ${this.apiToken}` }
39
39
  };
40
- const response = await axiosInstance.post(`${GET_SET_STORES}/copy`, {
40
+ const response = await this.axiosInstance.post(`${GET_SET_STORES}/copy`, {
41
41
  fromStoreId: copyStoreId
42
42
  }, config);
43
43
  return response;
@@ -12,7 +12,7 @@ export const updateStoreById = async function (this: WashdayClientInstance, stor
12
12
  const config = {
13
13
  headers: { Authorization: `Bearer ${this.apiToken}` }
14
14
  };
15
- const response = await axiosInstance.put(`${GET_SET_STORES}/${storeId}`, data, config);
15
+ const response = await this.axiosInstance.put(`${GET_SET_STORES}/${storeId}`, data, config);
16
16
  return response.data || {}
17
17
  } catch (error) {
18
18
  console.error('Error fetching getStoreById:', error);
@@ -26,7 +26,7 @@ export const deleteStoreById = async function (this: WashdayClientInstance, stor
26
26
  const config = {
27
27
  headers: { Authorization: `Bearer ${this.apiToken}` }
28
28
  };
29
- const response = await axiosInstance.delete(`${GET_SET_STORES}/${storeId}`, config);
29
+ const response = await this.axiosInstance.delete(`${GET_SET_STORES}/${storeId}`, config);
30
30
  return response;
31
31
  } catch (error) {
32
32
  console.error('Error fetching deleteStoreById:', error);
@@ -10,7 +10,7 @@ export const createCreateSuscriptionCheckoutSession = async function (this: Wash
10
10
  const config = {
11
11
  headers: { Authorization: `Bearer ${this.apiToken}` }
12
12
  };
13
- const response = await axiosInstance.post(`${GET_SET_STRIPE}/create-subscription-checkout-session`, data, config);
13
+ const response = await this.axiosInstance.post(`${GET_SET_STRIPE}/create-subscription-checkout-session`, data, config);
14
14
  return response;
15
15
  } catch (error) {
16
16
  console.error('Error fetching createCreateSuscriptionCheckoutSession:', error);
@@ -23,7 +23,7 @@ export const createCustomerPortalSession = async function (this: WashdayClientIn
23
23
  const config = {
24
24
  headers: { Authorization: `Bearer ${this.apiToken}` }
25
25
  };
26
- const response = await axiosInstance.post(`${GET_SET_STRIPE}/create-customer-portal-session`, data, config);
26
+ const response = await this.axiosInstance.post(`${GET_SET_STRIPE}/create-customer-portal-session`, data, config);
27
27
  return response;
28
28
  } catch (error) {
29
29
  console.error('Error fetching createCustomerPortalSession:', error);
@@ -36,7 +36,7 @@ export const createCFDISuscrptionCheckoutSession = async function (this: Washday
36
36
  const config = {
37
37
  headers: { Authorization: `Bearer ${this.apiToken}` }
38
38
  };
39
- const response = await axiosInstance.post(`${GET_SET_STRIPE}/create-cfdi-subscription-checkout-session`, data, config);
39
+ const response = await this.axiosInstance.post(`${GET_SET_STRIPE}/create-cfdi-subscription-checkout-session`, data, config);
40
40
  return response;
41
41
  } catch (error) {
42
42
  console.error('Error fetching createCFDISuscrptionCheckoutSession:', 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;
@@ -7,7 +7,7 @@ export const deleteSupplyById = async function (this: WashdayClientInstance, sto
7
7
  const config = {
8
8
  headers: { Authorization: `Bearer ${this.apiToken}` }
9
9
  };
10
- const response = await axiosInstance.delete(`${GET_SET_SUPPLY(storeId)}/${id}`, config);
10
+ const response = await this.axiosInstance.delete(`${GET_SET_SUPPLY(storeId)}/${id}`, config);
11
11
  return response;
12
12
  } catch (error) {
13
13
  console.error('Error fetching deleteSupplyById:', error);
@@ -8,7 +8,7 @@ export const getSupplies = async function (this: WashdayClientInstance, storeId:
8
8
  const config = {
9
9
  headers: { Authorization: `Bearer ${this.apiToken}` }
10
10
  };
11
- const response = await axiosInstance.get(`${GET_SET_SUPPLY(storeId)}?${queryParams}`, config);
11
+ const response = await this.axiosInstance.get(`${GET_SET_SUPPLY(storeId)}?${queryParams}`, config);
12
12
  return response;
13
13
  } catch (error) {
14
14
  console.error('Error fetching getSupplies:', 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;
@@ -43,7 +43,7 @@ export const getSupplyHistory = async function (this: WashdayClientInstance, sto
43
43
  if (params?.hasOwnProperty('limit')) {
44
44
  queryParams += `&limit=${params?.limit}`
45
45
  }
46
- const response = await axiosInstance.get(`${GET_SET_SUPPLY(storeId)}/${id}/history?${queryParams}`, config);
46
+ const response = await this.axiosInstance.get(`${GET_SET_SUPPLY(storeId)}/${id}/history?${queryParams}`, config);
47
47
  return response;
48
48
  } catch (error) {
49
49
  console.error('Error fetching getCashierBoxMovementsHistory:', error);
@@ -17,7 +17,7 @@ export const createSupply = async function (this: WashdayClientInstance, storeId
17
17
  const config = {
18
18
  headers: { Authorization: `Bearer ${this.apiToken}` }
19
19
  };
20
- const response = await axiosInstance.post(`${GET_SET_SUPPLY(storeId)}`, data, config);
20
+ const response = await this.axiosInstance.post(`${GET_SET_SUPPLY(storeId)}`, data, config);
21
21
  return response;
22
22
  } catch (error) {
23
23
  console.error('Error fetching createSupply:', error);
@@ -9,7 +9,7 @@ export const updateSupplyById = async function (this: WashdayClientInstance, sto
9
9
  const config = {
10
10
  headers: { Authorization: `Bearer ${this.apiToken}` }
11
11
  };
12
- const response = await axiosInstance.put(`${GET_SET_SUPPLY(storeId)}/${id}`, data, config);
12
+ const response = await this.axiosInstance.put(`${GET_SET_SUPPLY(storeId)}/${id}`, data, config);
13
13
  return response;
14
14
  } catch (error) {
15
15
  console.error('Error fetching getStoreById:', error);
@@ -24,7 +24,7 @@ export const addSupplyStock = async function (this: WashdayClientInstance, store
24
24
  const config = {
25
25
  headers: { Authorization: `Bearer ${this.apiToken}` }
26
26
  };
27
- const response = await axiosInstance.put(`${GET_SET_SUPPLY(storeId)}/${id}/addStock`, data, config);
27
+ const response = await this.axiosInstance.put(`${GET_SET_SUPPLY(storeId)}/${id}/addStock`, data, config);
28
28
  return response;
29
29
  } catch (error) {
30
30
  console.error('Error fetching addSupplyStock:', error);
@@ -7,7 +7,7 @@ export const deleteUserById = async function (this: WashdayClientInstance, id: s
7
7
  const config = {
8
8
  headers: { Authorization: `Bearer ${this.apiToken}` }
9
9
  };
10
- const response = await axiosInstance.delete(`${GET_SET_USER}/${id}`, config);
10
+ const response = await this.axiosInstance.delete(`${GET_SET_USER}/${id}`, config);
11
11
  return response;
12
12
  } catch (error) {
13
13
  console.error('Error fetching deleteUserById:', 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;
@@ -27,7 +27,7 @@ export const updateUserById = async function (this: WashdayClientInstance, userI
27
27
  const config = {
28
28
  headers: { Authorization: `Bearer ${this.apiToken}` }
29
29
  };
30
- const response = await axiosInstance.put(`${GET_SET_USER}/${userId}`, data, config);
30
+ const response = await this.axiosInstance.put(`${GET_SET_USER}/${userId}`, data, config);
31
31
  return response.data || {}
32
32
  } catch (error) {
33
33
  console.error('Error fetching updateUserById:', 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;