washday-sdk 0.0.129 → 0.0.130

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.
@@ -52,3 +52,17 @@ export const updateAutomaticDiscountById = function (storeId, discountId, data)
52
52
  }
53
53
  });
54
54
  };
55
+ export const updateDiscountCodeById = function (storeId, discountId, data) {
56
+ return __awaiter(this, void 0, void 0, function* () {
57
+ try {
58
+ const config = {
59
+ headers: { Authorization: `Bearer ${this.apiToken}` }
60
+ };
61
+ return yield axiosInstance.put(`${GET_SET_DISCOUNT_CODES}/${storeId}/${discountId}`, data, config);
62
+ }
63
+ catch (error) {
64
+ console.error('Error fetching updateDiscountCodeById:', error);
65
+ throw error;
66
+ }
67
+ });
68
+ };
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, updateAutomaticDiscountById } from "./discounts/put";
11
+ import { deleteAutomaticDiscountById, deleteDiscountCodeById, updateAutomaticDiscountById, updateDiscountCodeById } 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";
@@ -214,6 +214,7 @@ const WashdayClient = function WashdayClient(apiToken) {
214
214
  createAutomaticDiscount: createAutomaticDiscount,
215
215
  deleteAutomaticDiscountById: deleteAutomaticDiscountById,
216
216
  updateAutomaticDiscountById: updateAutomaticDiscountById,
217
+ updateDiscountCodeById: updateDiscountCodeById,
217
218
  });
218
219
  this.csv = bindMethods(this, {
219
220
  exportCustomersList: csvExportEndpoints.getModule.exportCustomersList,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "washday-sdk",
3
- "version": "0.0.129",
3
+ "version": "0.0.130",
4
4
  "description": "Washday utilities functions and API",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -43,3 +43,20 @@ export const updateAutomaticDiscountById = async function (this: WashdayClientIn
43
43
  throw error;
44
44
  }
45
45
  };
46
+
47
+ export const updateDiscountCodeById = async function (this: WashdayClientInstance, storeId: string, discountId: string, data: {
48
+ products?: string[];
49
+ buyAndGetConditions?: any;
50
+ freeProductSetting?: any;
51
+ }): Promise<any> {
52
+ try {
53
+ const config = {
54
+ headers: { Authorization: `Bearer ${this.apiToken}` }
55
+ };
56
+ return await axiosInstance.put(`${GET_SET_DISCOUNT_CODES}/${storeId}/${discountId}`, data, config);
57
+ } catch (error) {
58
+ console.error('Error fetching updateDiscountCodeById:', error);
59
+ throw error;
60
+ }
61
+ };
62
+
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, updateAutomaticDiscountById } from "./discounts/put";
12
+ import { deleteAutomaticDiscountById, deleteDiscountCodeById, updateAutomaticDiscountById, updateDiscountCodeById } 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";
@@ -220,6 +220,7 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
220
220
  createAutomaticDiscount: createAutomaticDiscount,
221
221
  deleteAutomaticDiscountById: deleteAutomaticDiscountById,
222
222
  updateAutomaticDiscountById: updateAutomaticDiscountById,
223
+ updateDiscountCodeById: updateDiscountCodeById,
223
224
  });
224
225
  this.csv = bindMethods(this, {
225
226
  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, updateAutomaticDiscountById } from "../api/discounts/put";
11
+ import { deleteAutomaticDiscountById, deleteDiscountCodeById, updateAutomaticDiscountById, updateDiscountCodeById } 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";
@@ -206,6 +206,7 @@ export interface WashdayClientInstance {
206
206
  createAutomaticDiscount: typeof createAutomaticDiscount;
207
207
  deleteAutomaticDiscountById: typeof deleteAutomaticDiscountById;
208
208
  updateAutomaticDiscountById: typeof updateAutomaticDiscountById;
209
+ updateDiscountCodeById: typeof updateDiscountCodeById;
209
210
  };
210
211
  csv: {
211
212
  exportCustomersList: typeof csvExportEndpoints.getModule.exportCustomersList;