washday-sdk 0.0.127 → 0.0.128

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.
package/dist/api/index.js CHANGED
@@ -100,6 +100,9 @@ const WashdayClient = function WashdayClient(apiToken) {
100
100
  getByIdCustomersApp: ordersEndpoints.getModule.getByIdCustomersApp,
101
101
  setOrderAcceptedBySequence: ordersEndpoints.putModule.setOrderAcceptedBySequence,
102
102
  getRequestedOrdersSummary: ordersEndpoints.getModule.getRequestedOrdersSummary,
103
+ bulkCancel: ordersEndpoints.putModule.bulkCancel,
104
+ bulkClean: ordersEndpoints.putModule.bulkClean,
105
+ bulkCollect: ordersEndpoints.putModule.bulkCollect
103
106
  });
104
107
  this.customers = bindMethods(this, {
105
108
  getCustomers: customersEndpoints.getModule.getList,
@@ -151,3 +151,45 @@ export const setOrderAcceptedBySequence = function (sequence, storeId) {
151
151
  }
152
152
  });
153
153
  };
154
+ export const bulkCancel = function (storeId, body) {
155
+ return __awaiter(this, void 0, void 0, function* () {
156
+ try {
157
+ const config = {
158
+ headers: { Authorization: `Bearer ${this.apiToken}` }
159
+ };
160
+ return yield axiosInstance.put(`${GET_SET_ORDER}/${storeId}/bulkCancel`, body, config);
161
+ }
162
+ catch (error) {
163
+ console.error('Error fetching bulkCancel:', error);
164
+ throw error;
165
+ }
166
+ });
167
+ };
168
+ export const bulkClean = function (storeId, body) {
169
+ return __awaiter(this, void 0, void 0, function* () {
170
+ try {
171
+ const config = {
172
+ headers: { Authorization: `Bearer ${this.apiToken}` }
173
+ };
174
+ return yield axiosInstance.put(`${GET_SET_ORDER}/${storeId}/bulkClean`, body, config);
175
+ }
176
+ catch (error) {
177
+ console.error('Error fetching bulkClean:', error);
178
+ throw error;
179
+ }
180
+ });
181
+ };
182
+ export const bulkCollect = function (storeId, body) {
183
+ return __awaiter(this, void 0, void 0, function* () {
184
+ try {
185
+ const config = {
186
+ headers: { Authorization: `Bearer ${this.apiToken}` }
187
+ };
188
+ return yield axiosInstance.put(`${GET_SET_ORDER}/${storeId}/bulkCollect`, body, config);
189
+ }
190
+ catch (error) {
191
+ console.error('Error fetching bulkCollect:', error);
192
+ throw error;
193
+ }
194
+ });
195
+ };
@@ -1 +1 @@
1
- export * from './orders';
1
+ export { applyDiscountToProducts, calculateOrderTotal } from './orders';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "washday-sdk",
3
- "version": "0.0.127",
3
+ "version": "0.0.128",
4
4
  "description": "Washday utilities functions and API",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
package/src/api/index.ts CHANGED
@@ -106,6 +106,9 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
106
106
  getByIdCustomersApp: ordersEndpoints.getModule.getByIdCustomersApp,
107
107
  setOrderAcceptedBySequence: ordersEndpoints.putModule.setOrderAcceptedBySequence,
108
108
  getRequestedOrdersSummary: ordersEndpoints.getModule.getRequestedOrdersSummary,
109
+ bulkCancel: ordersEndpoints.putModule.bulkCancel,
110
+ bulkClean: ordersEndpoints.putModule.bulkClean,
111
+ bulkCollect: ordersEndpoints.putModule.bulkCollect
109
112
  });
110
113
  this.customers = bindMethods(this, {
111
114
  getCustomers: customersEndpoints.getModule.getList,
@@ -1,3 +1,4 @@
1
+ import { AxiosResponse } from "axios";
1
2
  import { WashdayClientInstance } from "../../interfaces/Api";
2
3
  import axiosInstance from "../axiosInstance";
3
4
  const GET_SET_ORDER = 'api/v2/order';
@@ -161,4 +162,50 @@ export const setOrderAcceptedBySequence = async function (this: WashdayClientIns
161
162
  console.error('Error fetching setOrderAcceptedBySequence:', error);
162
163
  throw error;
163
164
  }
165
+ };
166
+
167
+ export const bulkCancel = async function (this: WashdayClientInstance, storeId: string, body: {
168
+ ordersIds: string[]
169
+ cancelledDateTime: string
170
+ }): Promise<AxiosResponse<any, any>> {
171
+ try {
172
+ const config = {
173
+ headers: { Authorization: `Bearer ${this.apiToken}` }
174
+ };
175
+ return await axiosInstance.put(`${GET_SET_ORDER}/${storeId}/bulkCancel`, body, config);
176
+ } catch (error) {
177
+ console.error('Error fetching bulkCancel:', error);
178
+ throw error;
179
+ }
180
+ };
181
+
182
+ export const bulkClean = async function (this: WashdayClientInstance, storeId: string, body: {
183
+ ordersIds: string[]
184
+ cleanedDateTime: string
185
+ readyDateTime: string
186
+ }): Promise<AxiosResponse<any, any>> {
187
+ try {
188
+ const config = {
189
+ headers: { Authorization: `Bearer ${this.apiToken}` }
190
+ };
191
+ return await axiosInstance.put(`${GET_SET_ORDER}/${storeId}/bulkClean`, body, config);
192
+ } catch (error) {
193
+ console.error('Error fetching bulkClean:', error);
194
+ throw error;
195
+ }
196
+ };
197
+
198
+ export const bulkCollect = async function (this: WashdayClientInstance, storeId: string, body: {
199
+ ordersIds: string[]
200
+ collectedDateTime: string
201
+ }): Promise<AxiosResponse<any, any>> {
202
+ try {
203
+ const config = {
204
+ headers: { Authorization: `Bearer ${this.apiToken}` }
205
+ };
206
+ return await axiosInstance.put(`${GET_SET_ORDER}/${storeId}/bulkCollect`, body, config);
207
+ } catch (error) {
208
+ console.error('Error fetching bulkCollect:', error);
209
+ throw error;
210
+ }
164
211
  };
@@ -92,6 +92,9 @@ export interface WashdayClientInstance {
92
92
  getByIdCustomersApp: typeof ordersEndpoints.getModule.getByIdCustomersApp;
93
93
  setOrderAcceptedBySequence: typeof ordersEndpoints.putModule.setOrderAcceptedBySequence,
94
94
  getRequestedOrdersSummary: typeof ordersEndpoints.getModule.getRequestedOrdersSummary;
95
+ bulkCancel: typeof ordersEndpoints.putModule.bulkCancel,
96
+ bulkClean: typeof ordersEndpoints.putModule.bulkClean,
97
+ bulkCollect: typeof ordersEndpoints.putModule.bulkCollect
95
98
  };
96
99
  customers: {
97
100
  getCustomers: typeof customersEndpoints.getModule.getList;
@@ -1 +1,4 @@
1
- export * from './orders';
1
+ export {
2
+ applyDiscountToProducts,
3
+ calculateOrderTotal
4
+ } from './orders';