washday-sdk 1.6.4 → 1.6.5

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
@@ -182,6 +182,7 @@ const WashdayClient = function WashdayClient(apiToken, env = 'PROD', clientId, c
182
182
  updateById: productsEndpoints.putModule.updateById,
183
183
  bulkUpdate: productsEndpoints.putModule.bulkUpdate,
184
184
  createPriceOption: productsEndpoints.postModule.createPriceOption,
185
+ bulkUpdateProductPrices: productsEndpoints.postModule.bulkUpdateProductPrices,
185
186
  updatePriceOption: productsEndpoints.putModule.updatePriceOption,
186
187
  deletePriceOption: productsEndpoints.deleteModule.deletePriceOption,
187
188
  });
@@ -9,6 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  };
10
10
  const GET_SET_PRODUCTS_SUPPLY = 'api/product-supply';
11
11
  const GET_SET_PRODUCTS = 'api/product';
12
+ const GET_SET_PRODUCTS_STORES = 'api/stores';
12
13
  export const create = function (data) {
13
14
  return __awaiter(this, void 0, void 0, function* () {
14
15
  try {
@@ -73,3 +74,18 @@ export const createPriceOption = function (productId, data) {
73
74
  }
74
75
  });
75
76
  };
77
+ export const bulkUpdateProductPrices = function (data) {
78
+ return __awaiter(this, void 0, void 0, function* () {
79
+ try {
80
+ const config = {
81
+ headers: { Authorization: `Bearer ${this.apiToken}` }
82
+ };
83
+ const response = yield this.axiosInstance.post(`${GET_SET_PRODUCTS_STORES}/${data === null || data === void 0 ? void 0 : data.storeId}/products/bulk-update-prices`, data, config);
84
+ return response.data || {};
85
+ }
86
+ catch (error) {
87
+ console.error('Error bulk updating product prices:', error);
88
+ throw error;
89
+ }
90
+ });
91
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "washday-sdk",
3
- "version": "1.6.4",
3
+ "version": "1.6.5",
4
4
  "description": "Washday utilities functions and API",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
package/src/api/index.ts CHANGED
@@ -189,6 +189,7 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
189
189
  updateById: productsEndpoints.putModule.updateById,
190
190
  bulkUpdate: productsEndpoints.putModule.bulkUpdate,
191
191
  createPriceOption: productsEndpoints.postModule.createPriceOption,
192
+ bulkUpdateProductPrices: productsEndpoints.postModule.bulkUpdateProductPrices,
192
193
  updatePriceOption: productsEndpoints.putModule.updatePriceOption,
193
194
  deletePriceOption: productsEndpoints.deleteModule.deletePriceOption,
194
195
  });
@@ -2,6 +2,7 @@ import { WashdayClientInstance } from "../../interfaces/Api";
2
2
  import axiosInstance from "../axiosInstance";
3
3
  const GET_SET_PRODUCTS_SUPPLY = 'api/product-supply';
4
4
  const GET_SET_PRODUCTS = 'api/product';
5
+ const GET_SET_PRODUCTS_STORES = 'api/stores';
5
6
 
6
7
  export const create = async function (this: WashdayClientInstance, data: {
7
8
  name: string;
@@ -74,20 +75,37 @@ export const bulkCreate = async function (this: WashdayClientInstance, storeId:
74
75
 
75
76
  // New: create price option for a product
76
77
  export const createPriceOption = async function (this: WashdayClientInstance, productId: string, data: {
77
- label: string;
78
- price: number;
79
- expressPrice: number;
80
- isDefault?: boolean;
81
- isActive?: boolean;
78
+ label: string;
79
+ price: number;
80
+ expressPrice: number;
81
+ isDefault?: boolean;
82
+ isActive?: boolean;
82
83
  }): Promise<any> {
83
- try {
84
- const config = {
85
- headers: { Authorization: `Bearer ${this.apiToken}` }
86
- };
87
- const response = await this.axiosInstance.post(`${GET_SET_PRODUCTS}/${productId}/price-options`, data, config);
88
- return response.data || {};
89
- } catch (error) {
90
- console.error('Error creating price option:', error);
91
- throw error;
92
- }
84
+ try {
85
+ const config = {
86
+ headers: { Authorization: `Bearer ${this.apiToken}` }
87
+ };
88
+ const response = await this.axiosInstance.post(`${GET_SET_PRODUCTS}/${productId}/price-options`, data, config);
89
+ return response.data || {};
90
+ } catch (error) {
91
+ console.error('Error creating price option:', error);
92
+ throw error;
93
+ }
94
+ };
95
+
96
+ export const bulkUpdateProductPrices = async function (this: WashdayClientInstance, data: {
97
+ storeId: string,
98
+ section: 'all' | string;
99
+ value: number;
100
+ }): Promise<any> {
101
+ try {
102
+ const config = {
103
+ headers: { Authorization: `Bearer ${this.apiToken}` }
104
+ };
105
+ const response = await this.axiosInstance.post(`${GET_SET_PRODUCTS_STORES}/${data?.storeId}/products/bulk-update-prices`, data, config);
106
+ return response.data || {};
107
+ } catch (error) {
108
+ console.error('Error bulk updating product prices:', error);
109
+ throw error;
110
+ }
93
111
  };
@@ -174,6 +174,7 @@ export interface WashdayClientInstance {
174
174
  updateById: typeof productsEndpoints.putModule.updateById;
175
175
  bulkUpdate: typeof productsEndpoints.putModule.bulkUpdate;
176
176
  createPriceOption: typeof productsEndpoints.postModule.createPriceOption;
177
+ bulkUpdateProductPrices: typeof productsEndpoints.postModule.bulkUpdateProductPrices;
177
178
  updatePriceOption: typeof productsEndpoints.putModule.updatePriceOption;
178
179
  deletePriceOption: typeof productsEndpoints.deleteModule.deletePriceOption;
179
180
  };
@@ -288,6 +288,7 @@ export interface ITicketStructure {
288
288
  showLegend: Boolean,
289
289
  showPaymentMethod: Boolean,
290
290
  showStorePhone: Boolean,
291
+ showCustomerPoints: Boolean,
291
292
  showDeliveryDate: Boolean,
292
293
  showDeliveryTime: Boolean,
293
294
  ticketLegendText: String,
@@ -307,6 +308,7 @@ export interface ITicketForLaundryStructure {
307
308
  showLegend: Boolean,
308
309
  showPaymentMethod: Boolean,
309
310
  showStorePhone: Boolean,
311
+ showCustomerPoints: Boolean,
310
312
  showDeliveryDate: Boolean,
311
313
  showDeliveryTime: Boolean,
312
314
  ticketLegendText: String,