washday-sdk 1.6.4 → 1.6.6

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
@@ -13,9 +13,9 @@ import { deleteStoreStaffById } from "./staff/delete";
13
13
  import { getStoreStaff, getStoreStaffById } from "./staff/get";
14
14
  import { createStoreStaff } from "./staff/post";
15
15
  import { updateStoreStaffById } from "./staff/put";
16
- import { getStoreById, getStoreImages, getStoreReviewLink, getStores, getStoresByIdCustomersApp, getStoresByName } from "./stores/get";
16
+ import { getOrderSequence, getStoreById, getStoreImages, getStoreReviewLink, getStores, getStoresByIdCustomersApp, getStoresByName } from "./stores/get";
17
17
  import { copyStore, createStore, createStoreImage } from "./stores/post";
18
- import { deleteStoreById, updateStoreById } from "./stores/put";
18
+ import { deleteStoreById, setOrderSequence, updateStoreById } from "./stores/put";
19
19
  import { createCFDISuscrptionCheckoutSession, createCreateSuscriptionCheckoutSession, createCustomerPortalSession, createGetMoreCheckoutSession } from "./stripe/post";
20
20
  import { deleteSupplyById } from "./supplies/delete";
21
21
  import { getSupplies, getSupplyById, getSupplyHistory } from "./supplies/get";
@@ -171,6 +171,8 @@ const WashdayClient = function WashdayClient(apiToken, env = 'PROD', clientId, c
171
171
  createStoreImage: createStoreImage,
172
172
  getStoreReviewLink: getStoreReviewLink,
173
173
  deleteStoreById: deleteStoreById,
174
+ getOrderSequence: getOrderSequence,
175
+ setOrderSequence: setOrderSequence,
174
176
  });
175
177
  this.products = bindMethods(this, {
176
178
  getById: productsEndpoints.getModule.getById,
@@ -182,6 +184,7 @@ const WashdayClient = function WashdayClient(apiToken, env = 'PROD', clientId, c
182
184
  updateById: productsEndpoints.putModule.updateById,
183
185
  bulkUpdate: productsEndpoints.putModule.bulkUpdate,
184
186
  createPriceOption: productsEndpoints.postModule.createPriceOption,
187
+ bulkUpdateProductPrices: productsEndpoints.postModule.bulkUpdateProductPrices,
185
188
  updatePriceOption: productsEndpoints.putModule.updatePriceOption,
186
189
  deletePriceOption: productsEndpoints.deleteModule.deletePriceOption,
187
190
  });
@@ -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
+ };
@@ -9,6 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  };
10
10
  import { generateQueryParamsStr } from "../../utils/apiUtils";
11
11
  const GET_SET_STORES = 'api/store';
12
+ const GET_SET_STORES_V2 = 'api/v2/stores';
12
13
  const GET_SET_STORE_IMAGE = 'api/store-image';
13
14
  const REQUEST_PARAMS = {
14
15
  token: 'LOGGED_USER_TOKEN',
@@ -107,3 +108,17 @@ export const getStoresByIdCustomersApp = function (id) {
107
108
  }
108
109
  });
109
110
  };
111
+ export const getOrderSequence = function (storeId) {
112
+ return __awaiter(this, void 0, void 0, function* () {
113
+ try {
114
+ const config = {
115
+ headers: { Authorization: `Bearer ${this.apiToken}` }
116
+ };
117
+ return yield this.axiosInstance.get(`${GET_SET_STORES_V2}/${storeId}/settings/order-sequence`, config).then(response => { var _a; return ((_a = response.data) === null || _a === void 0 ? void 0 : _a.data) || {}; });
118
+ }
119
+ catch (error) {
120
+ console.error('Error fetching getOrderSequence:', error);
121
+ throw error;
122
+ }
123
+ });
124
+ };
@@ -8,6 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  const GET_SET_STORES = 'api/store';
11
+ const GET_SET_STORES_V2 = 'api/v2/stores';
11
12
  const REQUEST_PARAMS = {
12
13
  token: 'LOGGED_USER_TOKEN',
13
14
  };
@@ -41,3 +42,17 @@ export const deleteStoreById = function (storeId) {
41
42
  }
42
43
  });
43
44
  };
45
+ export const setOrderSequence = function (storeId, data) {
46
+ return __awaiter(this, void 0, void 0, function* () {
47
+ try {
48
+ const config = {
49
+ headers: { Authorization: `Bearer ${this.apiToken}` }
50
+ };
51
+ return yield this.axiosInstance.put(`${GET_SET_STORES_V2}/${storeId}/settings/order-sequence`, data, config);
52
+ }
53
+ catch (error) {
54
+ console.error('Error fetching setOrderSequence:', error);
55
+ throw error;
56
+ }
57
+ });
58
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "washday-sdk",
3
- "version": "1.6.4",
3
+ "version": "1.6.6",
4
4
  "description": "Washday utilities functions and API",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
package/src/api/index.ts CHANGED
@@ -14,9 +14,9 @@ import { deleteStoreStaffById } from "./staff/delete";
14
14
  import { getStoreStaff, getStoreStaffById } from "./staff/get";
15
15
  import { createStoreStaff } from "./staff/post";
16
16
  import { updateStoreStaffById } from "./staff/put";
17
- import { getStoreById, getStoreImages, getStoreReviewLink, getStores, getStoresByIdCustomersApp, getStoresByName } from "./stores/get";
17
+ import { getOrderSequence, getStoreById, getStoreImages, getStoreReviewLink, getStores, getStoresByIdCustomersApp, getStoresByName } from "./stores/get";
18
18
  import { copyStore, createStore, createStoreImage } from "./stores/post";
19
- import { deleteStoreById, updateStoreById } from "./stores/put";
19
+ import { deleteStoreById, setOrderSequence, updateStoreById } from "./stores/put";
20
20
  import { createCFDISuscrptionCheckoutSession, createCreateSuscriptionCheckoutSession, createCustomerPortalSession, createGetMoreCheckoutSession } from "./stripe/post";
21
21
  import { deleteSupplyById } from "./supplies/delete";
22
22
  import { getSupplies, getSupplyById, getSupplyHistory } from "./supplies/get";
@@ -178,6 +178,8 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
178
178
  createStoreImage: createStoreImage,
179
179
  getStoreReviewLink: getStoreReviewLink,
180
180
  deleteStoreById: deleteStoreById,
181
+ getOrderSequence: getOrderSequence,
182
+ setOrderSequence: setOrderSequence,
181
183
  });
182
184
  this.products = bindMethods(this, {
183
185
  getById: productsEndpoints.getModule.getById,
@@ -189,6 +191,7 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
189
191
  updateById: productsEndpoints.putModule.updateById,
190
192
  bulkUpdate: productsEndpoints.putModule.bulkUpdate,
191
193
  createPriceOption: productsEndpoints.postModule.createPriceOption,
194
+ bulkUpdateProductPrices: productsEndpoints.postModule.bulkUpdateProductPrices,
192
195
  updatePriceOption: productsEndpoints.putModule.updatePriceOption,
193
196
  deletePriceOption: productsEndpoints.deleteModule.deletePriceOption,
194
197
  });
@@ -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
  };
@@ -4,6 +4,7 @@ import { generateQueryParamsStr } from "../../utils/apiUtils";
4
4
  import axiosInstance from "../axiosInstance";
5
5
 
6
6
  const GET_SET_STORES = 'api/store';
7
+ const GET_SET_STORES_V2 = 'api/v2/stores';
7
8
  const GET_SET_STORE_IMAGE = 'api/store-image';
8
9
  const REQUEST_PARAMS = {
9
10
  token: 'LOGGED_USER_TOKEN',
@@ -91,3 +92,15 @@ export const getStoresByIdCustomersApp = async function (this: WashdayClientInst
91
92
  throw error;
92
93
  }
93
94
  };
95
+
96
+ export const getOrderSequence = async function (this: WashdayClientInstance, storeId: string): Promise<any> {
97
+ try {
98
+ const config = {
99
+ headers: { Authorization: `Bearer ${this.apiToken}` }
100
+ };
101
+ return await this.axiosInstance.get(`${GET_SET_STORES_V2}/${storeId}/settings/order-sequence`, config).then(response => response.data?.data || {});
102
+ } catch (error) {
103
+ console.error('Error fetching getOrderSequence:', error);
104
+ throw error;
105
+ }
106
+ };
@@ -2,6 +2,7 @@ import { WashdayClientInstance } from "../../interfaces/Api";
2
2
  import { IStore } from "../../interfaces/Store";
3
3
  import axiosInstance from "../axiosInstance";
4
4
  const GET_SET_STORES = 'api/store';
5
+ const GET_SET_STORES_V2 = 'api/v2/stores';
5
6
  const REQUEST_PARAMS = {
6
7
  token: 'LOGGED_USER_TOKEN',
7
8
  };
@@ -32,4 +33,16 @@ export const deleteStoreById = async function (this: WashdayClientInstance, stor
32
33
  console.error('Error fetching deleteStoreById:', error);
33
34
  throw error;
34
35
  }
36
+ };
37
+
38
+ export const setOrderSequence = async function (this: WashdayClientInstance, storeId: string, data: { currentSequence: number }): Promise<any> {
39
+ try {
40
+ const config = {
41
+ headers: { Authorization: `Bearer ${this.apiToken}` }
42
+ };
43
+ return await this.axiosInstance.put(`${GET_SET_STORES_V2}/${storeId}/settings/order-sequence`, data, config);
44
+ } catch (error) {
45
+ console.error('Error fetching setOrderSequence:', error);
46
+ throw error;
47
+ }
35
48
  };
@@ -13,9 +13,9 @@ import { deleteStoreStaffById } from "../api/staff/delete";
13
13
  import { getStoreStaff, getStoreStaffById } from "../api/staff/get";
14
14
  import { createStoreStaff } from "../api/staff/post";
15
15
  import { updateStoreStaffById } from "../api/staff/put";
16
- import { getStoreById, getStoreImages, getStoreReviewLink, getStores, getStoresByIdCustomersApp, getStoresByName } from "../api/stores/get";
16
+ import { getOrderSequence, getStoreById, getStoreImages, getStoreReviewLink, getStores, getStoresByIdCustomersApp, getStoresByName } from "../api/stores/get";
17
17
  import { copyStore, createStore, createStoreImage } from "../api/stores/post";
18
- import { deleteStoreById, updateStoreById } from "../api/stores/put";
18
+ import { deleteStoreById, setOrderSequence, updateStoreById } from "../api/stores/put";
19
19
  import { createCFDISuscrptionCheckoutSession, createCreateSuscriptionCheckoutSession, createCustomerPortalSession, createGetMoreCheckoutSession } from "../api/stripe/post";
20
20
  import { deleteSupplyById } from "../api/supplies/delete";
21
21
  import { getSupplies, getSupplyById, getSupplyHistory } from "../api/supplies/get";
@@ -163,6 +163,8 @@ export interface WashdayClientInstance {
163
163
  createStoreImage: typeof createStoreImage;
164
164
  getStoreReviewLink: typeof getStoreReviewLink;
165
165
  deleteStoreById: typeof deleteStoreById;
166
+ getOrderSequence: typeof getOrderSequence;
167
+ setOrderSequence: typeof setOrderSequence;
166
168
  };
167
169
  products: {
168
170
  getById: typeof productsEndpoints.getModule.getById;
@@ -174,6 +176,7 @@ export interface WashdayClientInstance {
174
176
  updateById: typeof productsEndpoints.putModule.updateById;
175
177
  bulkUpdate: typeof productsEndpoints.putModule.bulkUpdate;
176
178
  createPriceOption: typeof productsEndpoints.postModule.createPriceOption;
179
+ bulkUpdateProductPrices: typeof productsEndpoints.postModule.bulkUpdateProductPrices;
177
180
  updatePriceOption: typeof productsEndpoints.putModule.updatePriceOption;
178
181
  deletePriceOption: typeof productsEndpoints.deleteModule.deletePriceOption;
179
182
  };
@@ -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,