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
@@ -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 ATTENDANCE_API = 'api/attendance';
12
11
  export const getHistory = function (params) {
13
12
  return __awaiter(this, void 0, void 0, function* () {
@@ -31,7 +30,7 @@ export const getHistory = function (params) {
31
30
  // Remove trailing '&'
32
31
  queryParams = queryParams.slice(0, -1);
33
32
  const url = queryParams ? `${ATTENDANCE_API}/history?${queryParams}` : `${ATTENDANCE_API}/history`;
34
- return yield axiosInstance.get(url, config);
33
+ return yield this.axiosInstance.get(url, config);
35
34
  }
36
35
  catch (error) {
37
36
  console.error('Error fetching attendance history:', error);
@@ -53,7 +52,7 @@ export const getStatus = function (params) {
53
52
  // Remove trailing '&'
54
53
  queryParams = queryParams.slice(0, -1);
55
54
  const url = queryParams ? `${ATTENDANCE_API}/status?${queryParams}` : `${ATTENDANCE_API}/status`;
56
- return yield axiosInstance.get(url, config);
55
+ return yield this.axiosInstance.get(url, config);
57
56
  }
58
57
  catch (error) {
59
58
  console.error('Error fetching attendance status:', error);
@@ -81,7 +80,7 @@ export const getStoreReport = function (storeId, params) {
81
80
  // Remove trailing '&'
82
81
  queryParams = queryParams.slice(0, -1);
83
82
  const url = queryParams ? `${ATTENDANCE_API}/store/${storeId}/report?${queryParams}` : `${ATTENDANCE_API}/store/${storeId}/report`;
84
- return yield axiosInstance.get(url, config);
83
+ return yield this.axiosInstance.get(url, config);
85
84
  }
86
85
  catch (error) {
87
86
  console.error('Error fetching store attendance report:', error);
@@ -112,7 +111,7 @@ export const exportStoreReport = function (storeId, params) {
112
111
  // Remove trailing '&'
113
112
  queryParams = queryParams.slice(0, -1);
114
113
  const url = queryParams ? `${ATTENDANCE_API}/store/${storeId}/report/export?${queryParams}` : `${ATTENDANCE_API}/store/${storeId}/report/export`;
115
- return yield axiosInstance.get(url, config);
114
+ return yield this.axiosInstance.get(url, config);
116
115
  }
117
116
  catch (error) {
118
117
  console.error('Error exporting store attendance report:', 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 ATTENDANCE_API = 'api/attendance';
12
11
  export const clockIn = function (data) {
13
12
  return __awaiter(this, void 0, void 0, function* () {
@@ -15,7 +14,7 @@ export const clockIn = function (data) {
15
14
  const config = {
16
15
  headers: { Authorization: `Bearer ${this.apiToken}` }
17
16
  };
18
- return yield axiosInstance.post(`${ATTENDANCE_API}/clock-in`, data, config);
17
+ return yield this.axiosInstance.post(`${ATTENDANCE_API}/clock-in`, data, config);
19
18
  }
20
19
  catch (error) {
21
20
  console.error('Error clock-in:', error);
@@ -29,7 +28,7 @@ export const clockOut = function (data) {
29
28
  const config = {
30
29
  headers: { Authorization: `Bearer ${this.apiToken}` }
31
30
  };
32
- return yield axiosInstance.post(`${ATTENDANCE_API}/clock-out`, data, config);
31
+ return yield this.axiosInstance.post(`${ATTENDANCE_API}/clock-out`, data, config);
33
32
  }
34
33
  catch (error) {
35
34
  console.error('Error clock-out:', 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 ATTENDANCE_API = 'api/attendance';
12
11
  export const updateById = function (id, data) {
13
12
  return __awaiter(this, void 0, void 0, function* () {
@@ -15,7 +14,7 @@ export const updateById = function (id, data) {
15
14
  const config = {
16
15
  headers: { Authorization: `Bearer ${this.apiToken}` }
17
16
  };
18
- return yield axiosInstance.put(`${ATTENDANCE_API}/${id}`, data, config);
17
+ return yield this.axiosInstance.put(`${ATTENDANCE_API}/${id}`, data, config);
19
18
  }
20
19
  catch (error) {
21
20
  console.error('Error updating attendance entry:', error);
@@ -7,14 +7,13 @@ 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 CUSTOMERSAPP_GET_AUTH = "api/v2/washdayapp/auth";
12
11
  const REGULAR_USER_AUTH = "api/auth";
13
12
  export const customerLoginToken = function (params) {
14
13
  return __awaiter(this, void 0, void 0, function* () {
15
14
  try {
16
15
  const config = {};
17
- return yield axiosInstance.post(`${CUSTOMERSAPP_GET_AUTH}/tokenLogin`, params, config);
16
+ return yield this.axiosInstance.post(`${CUSTOMERSAPP_GET_AUTH}/tokenLogin`, params, config);
18
17
  }
19
18
  catch (error) {
20
19
  console.error('Error fetching customerLoginToken:', error);
@@ -26,7 +25,7 @@ export const appleLogin = function (params) {
26
25
  return __awaiter(this, void 0, void 0, function* () {
27
26
  try {
28
27
  const config = {};
29
- return yield axiosInstance.post(`${CUSTOMERSAPP_GET_AUTH}/apple`, params, config);
28
+ return yield this.axiosInstance.post(`${CUSTOMERSAPP_GET_AUTH}/apple`, params, config);
30
29
  }
31
30
  catch (error) {
32
31
  console.error('Error fetching appleLogin:', error);
@@ -38,7 +37,7 @@ export const facebookLogin = function (params) {
38
37
  return __awaiter(this, void 0, void 0, function* () {
39
38
  try {
40
39
  const config = {};
41
- return yield axiosInstance.post(`${CUSTOMERSAPP_GET_AUTH}/facebook`, params, config);
40
+ return yield this.axiosInstance.post(`${CUSTOMERSAPP_GET_AUTH}/facebook`, params, config);
42
41
  }
43
42
  catch (error) {
44
43
  console.error('Error fetching facebookLogin:', error);
@@ -50,7 +49,7 @@ export const customerRegularLogin = function (params) {
50
49
  return __awaiter(this, void 0, void 0, function* () {
51
50
  try {
52
51
  const config = {};
53
- return yield axiosInstance.post(`${CUSTOMERSAPP_GET_AUTH}/login`, params, config);
52
+ return yield this.axiosInstance.post(`${CUSTOMERSAPP_GET_AUTH}/login`, params, config);
54
53
  }
55
54
  catch (error) {
56
55
  console.error('Error fetching customerRegularLogin:', error);
@@ -62,7 +61,7 @@ export const customerSignUp = function (params) {
62
61
  return __awaiter(this, void 0, void 0, function* () {
63
62
  try {
64
63
  const config = {};
65
- return yield axiosInstance.post(`${CUSTOMERSAPP_GET_AUTH}/signUp`, params, config);
64
+ return yield this.axiosInstance.post(`${CUSTOMERSAPP_GET_AUTH}/signUp`, params, config);
66
65
  }
67
66
  catch (error) {
68
67
  console.error('Error fetching customerSignUp:', error);
@@ -74,7 +73,7 @@ export const googleLogin = function (params) {
74
73
  return __awaiter(this, void 0, void 0, function* () {
75
74
  try {
76
75
  const config = {};
77
- return yield axiosInstance.post(`${CUSTOMERSAPP_GET_AUTH}/google`, params, config);
76
+ return yield this.axiosInstance.post(`${CUSTOMERSAPP_GET_AUTH}/google`, params, config);
78
77
  }
79
78
  catch (error) {
80
79
  console.error('Error fetching googleLogin:', error);
@@ -86,7 +85,7 @@ export const regularUserLogin = function (params) {
86
85
  return __awaiter(this, void 0, void 0, function* () {
87
86
  try {
88
87
  const config = {};
89
- return yield axiosInstance.post(`${REGULAR_USER_AUTH}/login`, params, config);
88
+ return yield this.axiosInstance.post(`${REGULAR_USER_AUTH}/login`, params, config);
90
89
  }
91
90
  catch (error) {
92
91
  console.error('Error fetching regularUserLogin:', error);
@@ -98,7 +97,7 @@ export const companySignUp = function (params) {
98
97
  return __awaiter(this, void 0, void 0, function* () {
99
98
  try {
100
99
  const config = {};
101
- return yield axiosInstance.post(`${REGULAR_USER_AUTH}/register`, params, config);
100
+ return yield this.axiosInstance.post(`${REGULAR_USER_AUTH}/register`, params, config);
102
101
  }
103
102
  catch (error) {
104
103
  console.error('Error fetching companySignUp:', error);
@@ -110,7 +109,7 @@ export const regularUserTokenLogin = function (params) {
110
109
  return __awaiter(this, void 0, void 0, function* () {
111
110
  try {
112
111
  const config = {};
113
- return yield axiosInstance.post(`${REGULAR_USER_AUTH}/tokenLogin`, params, config);
112
+ return yield this.axiosInstance.post(`${REGULAR_USER_AUTH}/tokenLogin`, params, config);
114
113
  }
115
114
  catch (error) {
116
115
  console.error('Error fetching regularUserTokenLogin:', error);
@@ -122,7 +121,7 @@ export const forgotPassword = function (params) {
122
121
  return __awaiter(this, void 0, void 0, function* () {
123
122
  try {
124
123
  const config = {};
125
- return yield axiosInstance.post(`${REGULAR_USER_AUTH}/forget-password`, params, config);
124
+ return yield this.axiosInstance.post(`${REGULAR_USER_AUTH}/forget-password`, params, config);
126
125
  }
127
126
  catch (error) {
128
127
  console.error('Error fetching forgotPassword:', error);
@@ -134,7 +133,7 @@ export const customersAppForgotPassword = function (companyId, params) {
134
133
  return __awaiter(this, void 0, void 0, function* () {
135
134
  try {
136
135
  const config = {};
137
- return yield axiosInstance.post(`${CUSTOMERSAPP_GET_AUTH}/${companyId}/forget-password`, params, config);
136
+ return yield this.axiosInstance.post(`${CUSTOMERSAPP_GET_AUTH}/${companyId}/forget-password`, params, config);
138
137
  }
139
138
  catch (error) {
140
139
  console.error('Error fetching customersAppForgotPassword:', error);
@@ -146,7 +145,7 @@ export const customersAppChangePassword = function (params) {
146
145
  return __awaiter(this, void 0, void 0, function* () {
147
146
  try {
148
147
  const config = {};
149
- return yield axiosInstance.post(`${CUSTOMERSAPP_GET_AUTH}/change-password`, params, config);
148
+ return yield this.axiosInstance.post(`${CUSTOMERSAPP_GET_AUTH}/change-password`, params, config);
150
149
  }
151
150
  catch (error) {
152
151
  console.error('Error fetching customerSignUp:', error);
@@ -160,7 +159,7 @@ export const pinLogin = function (data) {
160
159
  const config = {
161
160
  headers: { Authorization: `Bearer ${this.apiToken}` }
162
161
  };
163
- return yield axiosInstance.post(`${REGULAR_USER_AUTH}/pin-login`, data, config);
162
+ return yield this.axiosInstance.post(`${REGULAR_USER_AUTH}/pin-login`, data, config);
164
163
  }
165
164
  catch (error) {
166
165
  console.error('Error fetching pinLogin:', error);
@@ -2,45 +2,56 @@ import axios from 'axios';
2
2
  import { v4 } from 'uuid';
3
3
  // Define the type for the Axios instance
4
4
  let axiosInstance = null;
5
- // const BASE_URL: string = 'http://localhost:5555/';
6
- // const BASE_URL: string = 'https://washday-backend-development.herokuapp.com/';
5
+ const DEV_BASE_URL = 'http://localhost:5555/';
6
+ const STAGE_BASE_URL = 'https://washday-backend-development.herokuapp.com/';
7
+ const PROD_BASE_URL = 'https://washday-backend.herokuapp.com/';
7
8
  const BASE_URL = 'https://washday-backend.herokuapp.com/';
8
9
  // Function to create or return the singleton instance
9
- const getAxiosInstance = () => {
10
- if (!axiosInstance) {
11
- axiosInstance = axios.create({
12
- baseURL: BASE_URL,
13
- headers: {
14
- 'Content-Type': 'application/json',
15
- // Add any default headers here
16
- },
17
- });
18
- // Add interceptor to set token and other options for every request
19
- axiosInstance.interceptors.request.use((config) => {
20
- const { token, responseType = 'json', contentDisposition } = config.params || {};
21
- const { Authorization } = config.headers || {};
22
- let contentType = config.headers['Content-Type'];
23
- if (contentType === null || contentType === undefined) {
24
- contentType = 'application/json';
25
- }
26
- if (Authorization || token) {
27
- config.headers.Authorization = Authorization || `Bearer ${token}`;
28
- }
29
- if (contentType) {
30
- config.headers['Content-Type'] = contentType;
31
- }
32
- if (responseType) {
33
- config.responseType = responseType;
34
- }
35
- if (contentDisposition) {
36
- config.headers['Content-Disposition'] = contentDisposition;
37
- }
38
- config.headers['x-request-id'] = v4(); // used to track requests in the backend
39
- return config;
40
- }, (error) => {
41
- return Promise.reject(error);
42
- });
10
+ export const getAxiosInstance = (env = 'PROD') => {
11
+ let baseURL = BASE_URL;
12
+ switch (env) {
13
+ case 'DEV':
14
+ baseURL = DEV_BASE_URL;
15
+ break;
16
+ case 'STAGE':
17
+ baseURL = STAGE_BASE_URL;
18
+ break;
19
+ case 'PROD':
20
+ baseURL = PROD_BASE_URL;
21
+ break;
43
22
  }
23
+ axiosInstance = axios.create({
24
+ baseURL: baseURL,
25
+ headers: {
26
+ 'Content-Type': 'application/json',
27
+ // Add any default headers here
28
+ },
29
+ });
30
+ // Add interceptor to set token and other options for every request
31
+ axiosInstance.interceptors.request.use((config) => {
32
+ const { token, responseType = 'json', contentDisposition } = config.params || {};
33
+ const { Authorization } = config.headers || {};
34
+ let contentType = config.headers['Content-Type'];
35
+ if (contentType === null || contentType === undefined) {
36
+ contentType = 'application/json';
37
+ }
38
+ if (Authorization || token) {
39
+ config.headers.Authorization = Authorization || `Bearer ${token}`;
40
+ }
41
+ if (contentType) {
42
+ config.headers['Content-Type'] = contentType;
43
+ }
44
+ if (responseType) {
45
+ config.responseType = responseType;
46
+ }
47
+ if (contentDisposition) {
48
+ config.headers['Content-Disposition'] = contentDisposition;
49
+ }
50
+ config.headers['x-request-id'] = v4(); // used to track requests in the backend
51
+ return config;
52
+ }, (error) => {
53
+ return Promise.reject(error);
54
+ });
44
55
  return axiosInstance;
45
56
  };
46
57
  export default getAxiosInstance();
@@ -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_CASHIER_BOX = (storeId) => `api/store/${storeId}/cashierbox`;
12
11
  const GET_SET_CASHIER_BOX_MOVEMENT = (storeId, cashierBoxId) => `/api/store/cashierbox/movement/${storeId}/${cashierBoxId}`;
13
12
  export const deleteCashierBoxById = function (storeId, id) {
@@ -16,7 +15,7 @@ export const deleteCashierBoxById = function (storeId, id) {
16
15
  const config = {
17
16
  headers: { Authorization: `Bearer ${this.apiToken}` }
18
17
  };
19
- return yield axiosInstance.delete(`${GET_SET_CASHIER_BOX(storeId)}/${id}`, config);
18
+ return yield this.axiosInstance.delete(`${GET_SET_CASHIER_BOX(storeId)}/${id}`, config);
20
19
  }
21
20
  catch (error) {
22
21
  console.error('Error fetching getStoreStaff:', error);
@@ -30,7 +29,7 @@ export const deleteCashierBoxMovementById = function (_a) {
30
29
  const config = {
31
30
  headers: { Authorization: `Bearer ${this.apiToken}` }
32
31
  };
33
- return yield axiosInstance.delete(`${GET_SET_CASHIER_BOX_MOVEMENT(storeId, cashierBoxId)}/${movementId}`, config);
32
+ return yield this.axiosInstance.delete(`${GET_SET_CASHIER_BOX_MOVEMENT(storeId, cashierBoxId)}/${movementId}`, config);
34
33
  }
35
34
  catch (error) {
36
35
  console.error('Error fetching getStoreStaff:', 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_CASHIER_BOX = (storeId) => `api/store/${storeId}/cashierbox`;
12
11
  export const getCashierboxesByStoreId = function (storeId, queryParams) {
13
12
  return __awaiter(this, void 0, void 0, function* () {
@@ -15,7 +14,7 @@ export const getCashierboxesByStoreId = function (storeId, queryParams) {
15
14
  const config = {
16
15
  headers: { Authorization: `Bearer ${this.apiToken}` }
17
16
  };
18
- const response = yield axiosInstance.get(`${GET_SET_CASHIER_BOX(storeId)}?${queryParams || ''}`, config);
17
+ const response = yield this.axiosInstance.get(`${GET_SET_CASHIER_BOX(storeId)}?${queryParams || ''}`, config);
19
18
  return response;
20
19
  }
21
20
  catch (error) {
@@ -30,7 +29,7 @@ export const getCashierboxesById = function (storeId, id, queryParams) {
30
29
  const config = {
31
30
  headers: { Authorization: `Bearer ${this.apiToken}` }
32
31
  };
33
- const response = yield axiosInstance.get(`${GET_SET_CASHIER_BOX(storeId)}/${id}?${queryParams}`, config);
32
+ const response = yield this.axiosInstance.get(`${GET_SET_CASHIER_BOX(storeId)}/${id}?${queryParams}`, config);
34
33
  return response;
35
34
  }
36
35
  catch (error) {
@@ -52,7 +51,7 @@ export const getCashierBoxMovementsHistory = function (storeId, id, params) {
52
51
  if (params === null || params === void 0 ? void 0 : params.hasOwnProperty('limit')) {
53
52
  queryParams += `&limit=${params === null || params === void 0 ? void 0 : params.limit}`;
54
53
  }
55
- const response = yield axiosInstance.get(`${GET_SET_CASHIER_BOX(storeId)}/${id}/history?${queryParams}`, config);
54
+ const response = yield this.axiosInstance.get(`${GET_SET_CASHIER_BOX(storeId)}/${id}/history?${queryParams}`, config);
56
55
  return response;
57
56
  }
58
57
  catch (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_CASHIER_BOX = (storeId) => `api/store/${storeId}/cashierbox`;
12
11
  const GET_SET_CASHIER_BOX_MOVEMENT = (storeId, cashierBoxId) => `/api/store/cashierbox/movement/${storeId}/${cashierBoxId}`;
13
12
  export const createCashierBox = function (storeId, data) {
@@ -16,7 +15,7 @@ export const createCashierBox = function (storeId, data) {
16
15
  const config = {
17
16
  headers: { Authorization: `Bearer ${this.apiToken}` }
18
17
  };
19
- const response = yield axiosInstance.post(`${GET_SET_CASHIER_BOX(storeId)}`, data, config);
18
+ const response = yield this.axiosInstance.post(`${GET_SET_CASHIER_BOX(storeId)}`, data, config);
20
19
  return response;
21
20
  }
22
21
  catch (error) {
@@ -31,7 +30,7 @@ export const addCashierBoxMovement = function (storeId, id, data) {
31
30
  const config = {
32
31
  headers: { Authorization: `Bearer ${this.apiToken}` }
33
32
  };
34
- const response = yield axiosInstance.post(`${GET_SET_CASHIER_BOX(storeId)}/${id}/add-movement`, data, config);
33
+ const response = yield this.axiosInstance.post(`${GET_SET_CASHIER_BOX(storeId)}/${id}/add-movement`, data, config);
35
34
  return response;
36
35
  }
37
36
  catch (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_CASHIER_BOX = (storeId) => `api/store/${storeId}/cashierbox`;
12
11
  const GET_SET_CASHIER_BOX_MOVEMENT = (storeId, cashierBoxId) => `/api/store/cashierbox/movement/${storeId}/${cashierBoxId}`;
13
12
  export const updateCashierBoxById = function (storeId, id, data) {
@@ -16,7 +15,7 @@ export const updateCashierBoxById = function (storeId, id, data) {
16
15
  const config = {
17
16
  headers: { Authorization: `Bearer ${this.apiToken}` }
18
17
  };
19
- const response = yield axiosInstance.put(`${GET_SET_CASHIER_BOX(storeId)}/${id}`, data, config);
18
+ const response = yield this.axiosInstance.put(`${GET_SET_CASHIER_BOX(storeId)}/${id}`, data, config);
20
19
  return response;
21
20
  }
22
21
  catch (error) {
@@ -31,7 +30,7 @@ export const updateCashierBoxMovementById = function (_a, data_1) {
31
30
  const config = {
32
31
  headers: { Authorization: `Bearer ${this.apiToken}` }
33
32
  };
34
- const response = yield axiosInstance.put(`${GET_SET_CASHIER_BOX_MOVEMENT(storeId, cashierBoxId)}/${id}`, data, config);
33
+ const response = yield this.axiosInstance.put(`${GET_SET_CASHIER_BOX_MOVEMENT(storeId, cashierBoxId)}/${id}`, data, config);
35
34
  return response;
36
35
  }
37
36
  catch (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_CASH_UP_REPORTS = 'api/cashupreports';
12
11
  export const deleteCashUpReport = function (storeId, id) {
13
12
  return __awaiter(this, void 0, void 0, function* () {
@@ -15,7 +14,7 @@ export const deleteCashUpReport = function (storeId, id) {
15
14
  const config = {
16
15
  headers: { Authorization: `Bearer ${this.apiToken}` }
17
16
  };
18
- return yield axiosInstance.delete(`${GET_CASH_UP_REPORTS}/${storeId}/${id}`, config);
17
+ return yield this.axiosInstance.delete(`${GET_CASH_UP_REPORTS}/${storeId}/${id}`, config);
19
18
  }
20
19
  catch (error) {
21
20
  console.error('Error fetching:', 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_CASH_UP = 'api/cashup';
13
12
  const GET_CASH_UP_REPORTS = 'api/cashupreports';
14
13
  export const getList = function (storeId, params) {
@@ -22,7 +21,7 @@ export const getList = function (storeId, params) {
22
21
  'limit',
23
22
  'cashierBoxId'
24
23
  ], params);
25
- return yield axiosInstance.get(`${GET_CASH_UP_REPORTS}/${storeId}?${queryParams}`, config);
24
+ return yield this.axiosInstance.get(`${GET_CASH_UP_REPORTS}/${storeId}?${queryParams}`, config);
26
25
  }
27
26
  catch (error) {
28
27
  console.error('Error fetching getList orders:', error);
@@ -36,7 +35,7 @@ export const getById = function (storeId, id) {
36
35
  const config = {
37
36
  headers: { Authorization: `Bearer ${this.apiToken}` }
38
37
  };
39
- return yield axiosInstance.get(`${GET_CASH_UP_REPORTS}/${storeId}/${id}`, config);
38
+ return yield this.axiosInstance.get(`${GET_CASH_UP_REPORTS}/${storeId}/${id}`, config);
40
39
  }
41
40
  catch (error) {
42
41
  console.error('Error fetching:', error);
@@ -50,7 +49,7 @@ export const getPreviewDataForCashClose = function (storeId, id) {
50
49
  const config = {
51
50
  headers: { Authorization: `Bearer ${this.apiToken}` }
52
51
  };
53
- return yield axiosInstance.get(`${GET_CASH_UP}/${storeId}/${id}`, config);
52
+ return yield this.axiosInstance.get(`${GET_CASH_UP}/${storeId}/${id}`, config);
54
53
  }
55
54
  catch (error) {
56
55
  console.error('Error fetching:', 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_CASH_UP = 'api/cashup';
12
11
  export const create = function (storeId, id, data) {
13
12
  return __awaiter(this, void 0, void 0, function* () {
@@ -15,7 +14,7 @@ export const create = function (storeId, id, data) {
15
14
  const config = {
16
15
  headers: { Authorization: `Bearer ${this.apiToken}` }
17
16
  };
18
- return yield axiosInstance.post(`${GET_CASH_UP}/${storeId}/${id}`, data, config);
17
+ return yield this.axiosInstance.post(`${GET_CASH_UP}/${storeId}/${id}`, data, config);
19
18
  }
20
19
  catch (error) {
21
20
  console.error('Error fetching create:', 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;
@@ -44,7 +44,7 @@
44
44
  // const config = {
45
45
  // headers: { Authorization: `Bearer ${this.apiToken}` }
46
46
  // };
47
- // return await axiosInstance.put(`${GET_SET_ORDER_PAYMENTLINES(orderId)}/${id}`, data, config);
47
+ // return await this.axiosInstance.put(`${GET_SET_ORDER_PAYMENTLINES(orderId)}/${id}`, data, config);
48
48
  // } catch (error) {
49
49
  // console.error('Error fetching updateById:', error);
50
50
  // throw 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_CFDI = 'api/cfdi';
12
11
  export const cancelCFDI = function (id, data) {
13
12
  return __awaiter(this, void 0, void 0, function* () {
@@ -15,7 +14,7 @@ export const cancelCFDI = function (id, data) {
15
14
  const config = {
16
15
  headers: { Authorization: `Bearer ${this.apiToken}` }
17
16
  };
18
- return yield axiosInstance.delete(`${GET_SET_CFDI}/${id}`, Object.assign(Object.assign({}, config), { data }));
17
+ return yield this.axiosInstance.delete(`${GET_SET_CFDI}/${id}`, Object.assign(Object.assign({}, config), { data }));
19
18
  }
20
19
  catch (error) {
21
20
  console.error('Error fetching deleteById:', 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_ORDERS_CFDI_PREVIEW = (orderID) => `api/order/${orderID}/preview/cfdi`;
13
12
  const GET_SET_CFDI = 'api/cfdi';
14
13
  export const getList = function (params) {
@@ -25,7 +24,7 @@ export const getList = function (params) {
25
24
  'limit',
26
25
  'pageNum'
27
26
  ], params);
28
- return yield axiosInstance.get(`${GET_SET_CFDI}?${queryParams}`, config);
27
+ return yield this.axiosInstance.get(`${GET_SET_CFDI}?${queryParams}`, config);
29
28
  }
30
29
  catch (error) {
31
30
  console.error('Error fetching getList CFDI:', error);
@@ -41,7 +40,7 @@ export const getCFDIPreviewByOrderId = function (id) {
41
40
  const config = {
42
41
  headers: { Authorization: `Bearer ${this.apiToken}` }
43
42
  };
44
- return yield axiosInstance.get(`${GET_ORDERS_CFDI_PREVIEW(id)}`, config);
43
+ return yield this.axiosInstance.get(`${GET_ORDERS_CFDI_PREVIEW(id)}`, config);
45
44
  }
46
45
  catch (error) {
47
46
  console.error('Error fetching:', error);
@@ -62,7 +61,7 @@ export const downloadCFDIPDF = function (id) {
62
61
  responseType: 'arraybuffer'
63
62
  }
64
63
  };
65
- return yield axiosInstance.get(`${GET_SET_CFDI}/${id}/download/pdf`, config);
64
+ return yield this.axiosInstance.get(`${GET_SET_CFDI}/${id}/download/pdf`, config);
66
65
  }
67
66
  catch (error) {
68
67
  console.error('Error fetching downloadCFDIPDF:', error);
@@ -83,7 +82,7 @@ export const downloadCFDIZIP = function (id) {
83
82
  responseType: 'arraybuffer'
84
83
  }
85
84
  };
86
- return yield axiosInstance.get(`${GET_SET_CFDI}/${id}/download/zip`, config);
85
+ return yield this.axiosInstance.get(`${GET_SET_CFDI}/${id}/download/zip`, config);
87
86
  }
88
87
  catch (error) {
89
88
  console.error('Error fetching downloadCFDIZIP:', error);
@@ -97,7 +96,7 @@ export const sendCFDIByEmail = function (id) {
97
96
  const config = {
98
97
  headers: { Authorization: `Bearer ${this.apiToken}` }
99
98
  };
100
- return yield axiosInstance.get(`${GET_SET_CFDI}/${id}/email`, config);
99
+ return yield this.axiosInstance.get(`${GET_SET_CFDI}/${id}/email`, config);
101
100
  }
102
101
  catch (error) {
103
102
  console.error('Error fetching:', error);
@@ -116,7 +115,7 @@ export const getCFDIPreview = function (params) {
116
115
  'ordersID',
117
116
  'customer',
118
117
  ], params);
119
- return yield axiosInstance.get(`${GET_SET_CFDI}/preview?${queryParams}`, config);
118
+ return yield this.axiosInstance.get(`${GET_SET_CFDI}/preview?${queryParams}`, config);
120
119
  }
121
120
  catch (error) {
122
121
  console.error('Error fetching:', 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_CFDI = 'api/cfdi';
12
11
  const GET_SET_ORDERS_CFDI = (orderID) => `api/order/${orderID}/cfdi`;
13
12
  export const createCFDI = function (data) {
@@ -16,7 +15,7 @@ export const createCFDI = function (data) {
16
15
  const config = {
17
16
  headers: { Authorization: `Bearer ${this.apiToken}` }
18
17
  };
19
- return yield axiosInstance.post(GET_SET_CFDI, data, config);
18
+ return yield this.axiosInstance.post(GET_SET_CFDI, data, config);
20
19
  }
21
20
  catch (error) {
22
21
  console.error('Error createCFDI:', error);
@@ -31,7 +30,7 @@ export const createGlobalCFDI = function (data) {
31
30
  const config = {
32
31
  headers: { Authorization: `Bearer ${this.apiToken}` }
33
32
  };
34
- return yield axiosInstance.post(`${GET_SET_CFDI}/global`, Object.assign(Object.assign({}, data), { ordersID: (_a = data.ordersID) === null || _a === void 0 ? void 0 : _a.join(',') }), config);
33
+ return yield this.axiosInstance.post(`${GET_SET_CFDI}/global`, Object.assign(Object.assign({}, data), { ordersID: (_a = data.ordersID) === null || _a === void 0 ? void 0 : _a.join(',') }), config);
35
34
  }
36
35
  catch (error) {
37
36
  console.error('Error fetching create:', 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;
@@ -44,7 +44,7 @@
44
44
  // const config = {
45
45
  // headers: { Authorization: `Bearer ${this.apiToken}` }
46
46
  // };
47
- // return await axiosInstance.put(`${GET_SET_ORDER_PAYMENTLINES(orderId)}/${id}`, data, config);
47
+ // return await this.axiosInstance.put(`${GET_SET_ORDER_PAYMENTLINES(orderId)}/${id}`, data, config);
48
48
  // } catch (error) {
49
49
  // console.error('Error fetching updateById:', error);
50
50
  // throw 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_COMPANIES = 'api/company';
12
11
  const REQUEST_PARAMS = {
13
12
  token: 'LOGGED_USER_TOKEN',
@@ -18,7 +17,7 @@ export const getCompanyById = function (companyId) {
18
17
  const config = {
19
18
  headers: { Authorization: `Bearer ${this.apiToken}` }
20
19
  };
21
- const response = yield axiosInstance.get(`${GET_SET_COMPANIES}/${companyId}`, config);
20
+ const response = yield this.axiosInstance.get(`${GET_SET_COMPANIES}/${companyId}`, config);
22
21
  return response;
23
22
  }
24
23
  catch (error) {