washday-sdk 0.0.128 → 0.0.129

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.
@@ -38,3 +38,17 @@ export const deleteAutomaticDiscountById = function (storeId, discountId) {
38
38
  }
39
39
  });
40
40
  };
41
+ export const updateAutomaticDiscountById = function (storeId, discountId, data) {
42
+ return __awaiter(this, void 0, void 0, function* () {
43
+ try {
44
+ const config = {
45
+ headers: { Authorization: `Bearer ${this.apiToken}` }
46
+ };
47
+ return yield axiosInstance.put(`${GET_SET_AUTOMATIC_DISCOUNTS}/${storeId}/${discountId}`, data, config);
48
+ }
49
+ catch (error) {
50
+ console.error('Error fetching updateById:', error);
51
+ throw error;
52
+ }
53
+ });
54
+ };
package/dist/api/index.js CHANGED
@@ -8,7 +8,7 @@ import { updateCompanyById, updateCompanyLogoById, updateCompanyTaxInfoById } fr
8
8
  import { getCountries } from "./countries/get";
9
9
  import { getAutomaticDiscountById, getAutomaticDiscounts, getAvailableAutomaticDiscounts, getDiscountCodeById, getDiscountCodes, verifyDiscountCode, verifyDiscountCodeCustomersApp } from './discounts/get';
10
10
  import { createAutomaticDiscount, createDiscountCode } from "./discounts/post";
11
- import { deleteAutomaticDiscountById, deleteDiscountCodeById } from "./discounts/put";
11
+ import { deleteAutomaticDiscountById, deleteDiscountCodeById, updateAutomaticDiscountById } from "./discounts/put";
12
12
  import { deleteStoreStaffById } from "./staff/delete";
13
13
  import { getStoreStaff, getStoreStaffById } from "./staff/get";
14
14
  import { createStoreStaff } from "./staff/post";
@@ -213,6 +213,7 @@ const WashdayClient = function WashdayClient(apiToken) {
213
213
  getAutomaticDiscountById: getAutomaticDiscountById,
214
214
  createAutomaticDiscount: createAutomaticDiscount,
215
215
  deleteAutomaticDiscountById: deleteAutomaticDiscountById,
216
+ updateAutomaticDiscountById: updateAutomaticDiscountById,
216
217
  });
217
218
  this.csv = bindMethods(this, {
218
219
  exportCustomersList: csvExportEndpoints.getModule.exportCustomersList,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "washday-sdk",
3
- "version": "0.0.128",
3
+ "version": "0.0.129",
4
4
  "description": "Washday utilities functions and API",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -27,4 +27,19 @@ export const deleteAutomaticDiscountById = async function (this: WashdayClientIn
27
27
  console.error('Error fetching deleteAutomaticDiscountById:', error);
28
28
  throw error;
29
29
  }
30
- };
30
+ };
31
+
32
+
33
+ export const updateAutomaticDiscountById = async function (this: WashdayClientInstance, storeId: string, discountId: string, data: {
34
+ products: string[];
35
+ }): Promise<any> {
36
+ try {
37
+ const config = {
38
+ headers: { Authorization: `Bearer ${this.apiToken}` }
39
+ };
40
+ return await axiosInstance.put(`${GET_SET_AUTOMATIC_DISCOUNTS}/${storeId}/${discountId}`, data, config);
41
+ } catch (error) {
42
+ console.error('Error fetching updateById:', error);
43
+ throw error;
44
+ }
45
+ };
package/src/api/index.ts CHANGED
@@ -9,7 +9,7 @@ import { updateCompanyById, updateCompanyLogoById, updateCompanyTaxInfoById } fr
9
9
  import { getCountries } from "./countries/get";
10
10
  import { getAutomaticDiscountById, getAutomaticDiscounts, getAvailableAutomaticDiscounts, getDiscountCodeById, getDiscountCodes, verifyDiscountCode, verifyDiscountCodeCustomersApp } from './discounts/get';
11
11
  import { createAutomaticDiscount, createDiscountCode } from "./discounts/post";
12
- import { deleteAutomaticDiscountById, deleteDiscountCodeById } from "./discounts/put";
12
+ import { deleteAutomaticDiscountById, deleteDiscountCodeById, updateAutomaticDiscountById } from "./discounts/put";
13
13
  import { deleteStoreStaffById } from "./staff/delete";
14
14
  import { getStoreStaff, getStoreStaffById } from "./staff/get";
15
15
  import { createStoreStaff } from "./staff/post";
@@ -219,6 +219,7 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
219
219
  getAutomaticDiscountById: getAutomaticDiscountById,
220
220
  createAutomaticDiscount: createAutomaticDiscount,
221
221
  deleteAutomaticDiscountById: deleteAutomaticDiscountById,
222
+ updateAutomaticDiscountById: updateAutomaticDiscountById,
222
223
  });
223
224
  this.csv = bindMethods(this, {
224
225
  exportCustomersList: csvExportEndpoints.getModule.exportCustomersList,
@@ -8,7 +8,7 @@ import { updateCompanyById, updateCompanyLogoById, updateCompanyTaxInfoById } fr
8
8
  import { getCountries } from "../api/countries/get";
9
9
  import { getAutomaticDiscountById, getAutomaticDiscounts, getAvailableAutomaticDiscounts, getDiscountCodeById, getDiscountCodes, verifyDiscountCode, verifyDiscountCodeCustomersApp } from '../api/discounts/get';
10
10
  import { createAutomaticDiscount, createDiscountCode } from "../api/discounts/post";
11
- import { deleteAutomaticDiscountById, deleteDiscountCodeById } from "../api/discounts/put";
11
+ import { deleteAutomaticDiscountById, deleteDiscountCodeById, updateAutomaticDiscountById } from "../api/discounts/put";
12
12
  import { deleteStoreStaffById } from "../api/staff/delete";
13
13
  import { getStoreStaff, getStoreStaffById } from "../api/staff/get";
14
14
  import { createStoreStaff } from "../api/staff/post";
@@ -205,6 +205,7 @@ export interface WashdayClientInstance {
205
205
  getAutomaticDiscountById: typeof getAutomaticDiscountById;
206
206
  createAutomaticDiscount: typeof createAutomaticDiscount;
207
207
  deleteAutomaticDiscountById: typeof deleteAutomaticDiscountById;
208
+ updateAutomaticDiscountById: typeof updateAutomaticDiscountById;
208
209
  };
209
210
  csv: {
210
211
  exportCustomersList: typeof csvExportEndpoints.getModule.exportCustomersList;