washday-sdk 1.2.0 → 1.3.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 (78) hide show
  1. package/dist/api/cashierbox/get.js +3 -4
  2. package/dist/api/cashierbox/post.js +2 -3
  3. package/dist/api/cashierbox/put.js +2 -3
  4. package/dist/api/companies/get.js +1 -2
  5. package/dist/api/companies/post.js +2 -3
  6. package/dist/api/companies/put.js +3 -4
  7. package/dist/api/countries/get.js +1 -2
  8. package/dist/api/customers/get.js +2 -3
  9. package/dist/api/customers/post.js +2 -3
  10. package/dist/api/customers/put.js +1 -1
  11. package/dist/api/index.js +6 -0
  12. package/dist/api/integrations/delete.js +1 -0
  13. package/dist/api/integrations/get.js +23 -0
  14. package/dist/api/integrations/index.js +3 -0
  15. package/dist/api/integrations/post.js +36 -0
  16. package/dist/api/integrations/put.js +1 -0
  17. package/dist/api/inventory/delete.js +1 -2
  18. package/dist/api/inventory/get.js +2 -3
  19. package/dist/api/inventory/post.js +1 -2
  20. package/dist/api/inventory/put.js +2 -3
  21. package/dist/api/products/delete.js +1 -2
  22. package/dist/api/products/post.js +4 -5
  23. package/dist/api/products/put.js +2 -3
  24. package/dist/api/sections/post.js +1 -2
  25. package/dist/api/staff/delete.js +1 -2
  26. package/dist/api/staff/get.js +1 -2
  27. package/dist/api/staff/post.js +1 -2
  28. package/dist/api/staff/put.js +1 -2
  29. package/dist/api/stores/get.js +6 -7
  30. package/dist/api/stores/post.js +3 -4
  31. package/dist/api/stores/put.js +2 -3
  32. package/dist/api/stripe/post.js +3 -4
  33. package/dist/api/supplies/delete.js +1 -2
  34. package/dist/api/supplies/get.js +2 -3
  35. package/dist/api/supplies/post.js +1 -2
  36. package/dist/api/supplies/put.js +2 -3
  37. package/dist/api/users/delete.js +1 -2
  38. package/dist/api/users/put.js +1 -2
  39. package/package.json +1 -1
  40. package/src/api/cashierbox/get.ts +3 -3
  41. package/src/api/cashierbox/post.ts +2 -2
  42. package/src/api/cashierbox/put.ts +2 -2
  43. package/src/api/companies/get.ts +1 -1
  44. package/src/api/companies/post.ts +2 -2
  45. package/src/api/companies/put.ts +3 -3
  46. package/src/api/countries/get.ts +1 -1
  47. package/src/api/customers/get.ts +2 -2
  48. package/src/api/customers/post.ts +2 -2
  49. package/src/api/customers/put.ts +1 -1
  50. package/src/api/index.ts +8 -1
  51. package/src/api/integrations/delete.ts +0 -0
  52. package/src/api/integrations/get.ts +15 -0
  53. package/src/api/integrations/index.ts +3 -0
  54. package/src/api/integrations/post.ts +30 -0
  55. package/src/api/integrations/put.ts +0 -0
  56. package/src/api/inventory/delete.ts +1 -1
  57. package/src/api/inventory/get.ts +2 -2
  58. package/src/api/inventory/post.ts +1 -1
  59. package/src/api/inventory/put.ts +2 -2
  60. package/src/api/products/delete.ts +1 -1
  61. package/src/api/products/post.ts +4 -4
  62. package/src/api/products/put.ts +2 -2
  63. package/src/api/sections/post.ts +1 -1
  64. package/src/api/staff/delete.ts +1 -1
  65. package/src/api/staff/get.ts +1 -1
  66. package/src/api/staff/post.ts +1 -1
  67. package/src/api/staff/put.ts +1 -1
  68. package/src/api/stores/get.ts +6 -6
  69. package/src/api/stores/post.ts +3 -3
  70. package/src/api/stores/put.ts +2 -2
  71. package/src/api/stripe/post.ts +3 -3
  72. package/src/api/supplies/delete.ts +1 -1
  73. package/src/api/supplies/get.ts +2 -2
  74. package/src/api/supplies/post.ts +1 -1
  75. package/src/api/supplies/put.ts +2 -2
  76. package/src/api/users/delete.ts +1 -1
  77. package/src/api/users/put.ts +1 -1
  78. package/src/interfaces/Api.ts +6 -0
@@ -32,7 +32,7 @@ export const create = async function (this: WashdayClientInstance, data: {
32
32
  const config = {
33
33
  headers: { Authorization: `Bearer ${this.apiToken}` }
34
34
  };
35
- const response = await axiosInstance.post(`${GET_SET_PRODUCTS}`, data, config);
35
+ const response = await this.axiosInstance.post(`${GET_SET_PRODUCTS}`, data, config);
36
36
  return response;
37
37
  } catch (error) {
38
38
  console.error('Error fetching create:', error);
@@ -48,7 +48,7 @@ export const createProductSupply = async function (this: WashdayClientInstance,
48
48
  const config = {
49
49
  headers: { Authorization: `Bearer ${this.apiToken}` }
50
50
  };
51
- const response = await axiosInstance.post(`${GET_SET_PRODUCTS_SUPPLY}/${id}`, data, config);
51
+ const response = await this.axiosInstance.post(`${GET_SET_PRODUCTS_SUPPLY}/${id}`, data, config);
52
52
  return response;
53
53
  } catch (error) {
54
54
  console.error('Error fetching createProductSupply:', error);
@@ -64,7 +64,7 @@ export const bulkCreate = async function (this: WashdayClientInstance, storeId:
64
64
  'Content-Type': 'multipart/form-data' // Let axios handle the boundary
65
65
  }
66
66
  };
67
- const response = await axiosInstance.post(`${GET_SET_PRODUCTS}/${storeId}/bulk`, data, config);
67
+ const response = await this.axiosInstance.post(`${GET_SET_PRODUCTS}/${storeId}/bulk`, data, config);
68
68
  return response.data || {};
69
69
  } catch (error) {
70
70
  console.error('Error fetching products bulkCreate:', error);
@@ -84,7 +84,7 @@ export const createPriceOption = async function (this: WashdayClientInstance, pr
84
84
  const config = {
85
85
  headers: { Authorization: `Bearer ${this.apiToken}` }
86
86
  };
87
- const response = await axiosInstance.post(`${GET_SET_PRODUCTS}/${productId}/price-options`, data, config);
87
+ const response = await this.axiosInstance.post(`${GET_SET_PRODUCTS}/${productId}/price-options`, data, config);
88
88
  return response.data || {};
89
89
  } catch (error) {
90
90
  console.error('Error creating price option:', error);
@@ -7,7 +7,7 @@ export const bulkUpdate = async function (this: WashdayClientInstance, storeId:
7
7
  const config = {
8
8
  headers: { Authorization: `Bearer ${this.apiToken}`, 'Content-Type': false }
9
9
  };
10
- const response = await axiosInstance.put(`${GET_SET_PRODUCTS}/${storeId}/bulk`, data, config);
10
+ const response = await this.axiosInstance.put(`${GET_SET_PRODUCTS}/${storeId}/bulk`, data, config);
11
11
  return response.data || {}
12
12
  } catch (error) {
13
13
  console.error('Error fetching getStoreById:', error);
@@ -60,7 +60,7 @@ export const updatePriceOption = async function (this: WashdayClientInstance, pr
60
60
  const config = {
61
61
  headers: { Authorization: `Bearer ${this.apiToken}` }
62
62
  };
63
- const response = await axiosInstance.put(`${GET_SET_PRODUCTS}/${productId}/price-options/${optionId}`, data, config);
63
+ const response = await this.axiosInstance.put(`${GET_SET_PRODUCTS}/${productId}/price-options/${optionId}`, data, config);
64
64
  return response.data || {};
65
65
  } catch (error) {
66
66
  console.error('Error updating price option:', 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);
@@ -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);
@@ -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);
@@ -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);
@@ -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);
@@ -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);
@@ -40,6 +40,7 @@ import { deleteUserById } from "../api/users/delete";
40
40
  import * as partnersEndpoints from '../api/partners';
41
41
  import * as outsourcedOrdersEndpoints from '../api/outsourcedOrders';
42
42
  import * as publicsEndpoints from '../api/publics';
43
+ import * as integrationsEndpoints from '../api/integrations';
43
44
  import { validateUserPin } from "../api/users/post";
44
45
  import { AxiosInstance } from "axios";
45
46
 
@@ -313,4 +314,9 @@ export interface WashdayClientInstance {
313
314
  clockOut: typeof attendanceEndpoints.postModule.clockOut;
314
315
  updateById: typeof attendanceEndpoints.putModule.updateById;
315
316
  };
317
+ integrations: {
318
+ getMPConnectionStatus: typeof integrationsEndpoints.getModule.getMPConnectionStatus;
319
+ startMPOAuthFlow: typeof integrationsEndpoints.postModule.startMPOAuthFlow;
320
+ disconnectMP: typeof integrationsEndpoints.postModule.disconnectMP;
321
+ };
316
322
  }