washday-sdk 0.0.128 → 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.
@@ -38,3 +38,31 @@ 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
+ };
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 } 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";
@@ -213,6 +213,8 @@ const WashdayClient = function WashdayClient(apiToken) {
213
213
  getAutomaticDiscountById: getAutomaticDiscountById,
214
214
  createAutomaticDiscount: createAutomaticDiscount,
215
215
  deleteAutomaticDiscountById: deleteAutomaticDiscountById,
216
+ updateAutomaticDiscountById: updateAutomaticDiscountById,
217
+ updateDiscountCodeById: updateDiscountCodeById,
216
218
  });
217
219
  this.csv = bindMethods(this, {
218
220
  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.130",
4
4
  "description": "Washday utilities functions and API",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -27,4 +27,36 @@ 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
+ };
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 } 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";
@@ -219,6 +219,8 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
219
219
  getAutomaticDiscountById: getAutomaticDiscountById,
220
220
  createAutomaticDiscount: createAutomaticDiscount,
221
221
  deleteAutomaticDiscountById: deleteAutomaticDiscountById,
222
+ updateAutomaticDiscountById: updateAutomaticDiscountById,
223
+ updateDiscountCodeById: updateDiscountCodeById,
222
224
  });
223
225
  this.csv = bindMethods(this, {
224
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 } 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";
@@ -205,6 +205,8 @@ export interface WashdayClientInstance {
205
205
  getAutomaticDiscountById: typeof getAutomaticDiscountById;
206
206
  createAutomaticDiscount: typeof createAutomaticDiscount;
207
207
  deleteAutomaticDiscountById: typeof deleteAutomaticDiscountById;
208
+ updateAutomaticDiscountById: typeof updateAutomaticDiscountById;
209
+ updateDiscountCodeById: typeof updateDiscountCodeById;
208
210
  };
209
211
  csv: {
210
212
  exportCustomersList: typeof csvExportEndpoints.getModule.exportCustomersList;