washday-sdk 0.0.175 → 0.0.177

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.
@@ -2,6 +2,7 @@ import axios from 'axios';
2
2
  // Define the type for the Axios instance
3
3
  let axiosInstance = null;
4
4
  // const BASE_URL: string = 'http://localhost:5555/';
5
+ // const BASE_URL: string = 'https://washday-backend-development.herokuapp.com/';
5
6
  const BASE_URL = 'https://washday-backend.herokuapp.com/';
6
7
  // Function to create or return the singleton instance
7
8
  const getAxiosInstance = () => {
@@ -8,6 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import axiosInstance from "../axiosInstance";
11
+ import { generateQueryParamsStr } from "../../utils/apiUtils";
11
12
  const GET_SET_ORDER = 'api/v2/order';
12
13
  const GET_SET_ORDER_OLD = 'api/order';
13
14
  const GET_SET_ORDER_PAYMENTLINES = (orderId) => `/api/v2/order/${orderId}/paymentLines`;
@@ -67,13 +68,16 @@ export const setOrderCleaningBySequence = function (sequence, storeId) {
67
68
  }
68
69
  });
69
70
  };
70
- export const setOrderCleanedBySequence = function (sequence, storeId, data) {
71
+ export const setOrderCleanedBySequence = function (sequence, storeId, data, params) {
71
72
  return __awaiter(this, void 0, void 0, function* () {
72
73
  try {
73
74
  const config = {
74
75
  headers: { Authorization: `Bearer ${this.apiToken}` }
75
76
  };
76
- return yield axiosInstance.put(`${GET_SET_ORDER_OLD}/${sequence}/${storeId}/cleaned`, data, config);
77
+ const queryParams = generateQueryParamsStr([
78
+ 'markOutsourcedAsReturned',
79
+ ], params);
80
+ return yield axiosInstance.put(`${GET_SET_ORDER_OLD}/${sequence}/${storeId}/cleaned?${queryParams}`, data, config);
77
81
  }
78
82
  catch (error) {
79
83
  console.error('Error fetching setOrderCleanedBySequence:', error);
@@ -165,13 +169,16 @@ export const bulkCancel = function (storeId, body) {
165
169
  }
166
170
  });
167
171
  };
168
- export const bulkClean = function (storeId, body) {
172
+ export const bulkClean = function (storeId, body, params) {
169
173
  return __awaiter(this, void 0, void 0, function* () {
170
174
  try {
171
175
  const config = {
172
176
  headers: { Authorization: `Bearer ${this.apiToken}` }
173
177
  };
174
- return yield axiosInstance.put(`${GET_SET_ORDER}/${storeId}/bulkClean`, body, config);
178
+ const queryParams = generateQueryParamsStr([
179
+ 'markOutsourcedAsReturned',
180
+ ], params);
181
+ return yield axiosInstance.put(`${GET_SET_ORDER}/${storeId}/bulkClean?${queryParams}`, body, config);
175
182
  }
176
183
  catch (error) {
177
184
  console.error('Error fetching bulkClean:', error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "washday-sdk",
3
- "version": "0.0.175",
3
+ "version": "0.0.177",
4
4
  "description": "Washday utilities functions and API",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -4,6 +4,7 @@ import axios, { AxiosInstance, AxiosRequestConfig } from 'axios';
4
4
  let axiosInstance: AxiosInstance | null = null;
5
5
 
6
6
  // const BASE_URL: string = 'http://localhost:5555/';
7
+ // const BASE_URL: string = 'https://washday-backend-development.herokuapp.com/';
7
8
  const BASE_URL: string = 'https://washday-backend.herokuapp.com/';
8
9
 
9
10
  // Function to create or return the singleton instance
@@ -1,6 +1,7 @@
1
1
  import { AxiosResponse } from "axios";
2
2
  import { WashdayClientInstance } from "../../interfaces/Api";
3
3
  import axiosInstance from "../axiosInstance";
4
+ import { generateQueryParamsStr } from "../../utils/apiUtils";
4
5
  const GET_SET_ORDER = 'api/v2/order';
5
6
  const GET_SET_ORDER_OLD = 'api/order';
6
7
  const GET_SET_ORDER_PAYMENTLINES = (orderId: string) => `/api/v2/order/${orderId}/paymentLines`;
@@ -83,12 +84,17 @@ export const setOrderCleaningBySequence = async function (this: WashdayClientIns
83
84
  export const setOrderCleanedBySequence = async function (this: WashdayClientInstance, sequence: string, storeId: string, data: {
84
85
  cleanedDateTime: string,
85
86
  readyDateTime: string
87
+ }, params?: {
88
+ 'markOutsourcedAsReturned': boolean,
86
89
  }): Promise<any> {
87
90
  try {
88
91
  const config = {
89
92
  headers: { Authorization: `Bearer ${this.apiToken}` }
90
93
  };
91
- return await axiosInstance.put(`${GET_SET_ORDER_OLD}/${sequence}/${storeId}/cleaned`, data, config);
94
+ const queryParams = generateQueryParamsStr([
95
+ 'markOutsourcedAsReturned',
96
+ ], params);
97
+ return await axiosInstance.put(`${GET_SET_ORDER_OLD}/${sequence}/${storeId}/cleaned?${queryParams}`, data, config);
92
98
  } catch (error) {
93
99
  console.error('Error fetching setOrderCleanedBySequence:', error);
94
100
  throw error;
@@ -183,12 +189,17 @@ export const bulkClean = async function (this: WashdayClientInstance, storeId: s
183
189
  ordersIds: string[]
184
190
  cleanedDateTime: string
185
191
  readyDateTime: string
192
+ }, params?: {
193
+ 'markOutsourcedAsReturned': boolean,
186
194
  }): Promise<AxiosResponse<any, any>> {
187
195
  try {
188
196
  const config = {
189
197
  headers: { Authorization: `Bearer ${this.apiToken}` }
190
198
  };
191
- return await axiosInstance.put(`${GET_SET_ORDER}/${storeId}/bulkClean`, body, config);
199
+ const queryParams = generateQueryParamsStr([
200
+ 'markOutsourcedAsReturned',
201
+ ], params);
202
+ return await axiosInstance.put(`${GET_SET_ORDER}/${storeId}/bulkClean?${queryParams}`, body, config);
192
203
  } catch (error) {
193
204
  console.error('Error fetching bulkClean:', error);
194
205
  throw error;
@@ -24,6 +24,8 @@ export const create = async function (this: WashdayClientInstance, data: {
24
24
  invoice_product_unit_key: string;
25
25
  invoice_product_unit_name: string;
26
26
  productSupplies: Array<any>
27
+ isOutsourced?: boolean
28
+ outsourcingPartner?: string
27
29
  }): Promise<any> {
28
30
  try {
29
31
  const config = {
@@ -33,6 +33,8 @@ export const updateById = async function (this: WashdayClientInstance, id: strin
33
33
  invoice_description?: string,
34
34
  invoice_product_unit_key?: string
35
35
  invoice_product_unit_name?: string
36
+ isOutsourced?: boolean
37
+ outsourcingPartner?: string
36
38
  }): Promise<any> {
37
39
  try {
38
40
  const config = {