washday-sdk 0.0.122 → 0.0.124

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.
@@ -1,7 +1,7 @@
1
1
  import axios from 'axios';
2
2
  // Define the type for the Axios instance
3
3
  let axiosInstance = null;
4
- //const BASE_URL: string = 'http://localhost:5555/';
4
+ // const BASE_URL: string = 'http://localhost:5555/';
5
5
  const BASE_URL = 'https://washday-backend.herokuapp.com/';
6
6
  // Function to create or return the singleton instance
7
7
  const getAxiosInstance = () => {
@@ -10,6 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  import axiosInstance from "../axiosInstance";
11
11
  const GET_SET_DISCOUNT_CODES = 'api/v2/discountCodes';
12
12
  const GET_SET_AUTOMATIC_DISCOUNTS = 'api/discounts';
13
+ const GET_AVAILABLE_AUTOMATIC_DISCOUNTS = 'api/availableDiscounts';
13
14
  export const getDiscountCodes = function (storeId, params) {
14
15
  return __awaiter(this, void 0, void 0, function* () {
15
16
  try {
@@ -88,3 +89,17 @@ export const verifyDiscountCode = function (storeId, code) {
88
89
  }
89
90
  });
90
91
  };
92
+ export const getAvailableAutomaticDiscounts = function (storeId, date) {
93
+ return __awaiter(this, void 0, void 0, function* () {
94
+ try {
95
+ const config = {
96
+ headers: { Authorization: `Bearer ${this.apiToken}` }
97
+ };
98
+ return yield axiosInstance.get(`${GET_AVAILABLE_AUTOMATIC_DISCOUNTS}/${storeId}?currentDate=${date}`, config);
99
+ }
100
+ catch (error) {
101
+ console.error('Error fetching getAvailableAutomaticDiscounts:', error);
102
+ throw error;
103
+ }
104
+ });
105
+ };
package/dist/api/index.js CHANGED
@@ -6,7 +6,7 @@ import { getCompanyById } from "./companies/get";
6
6
  import { updateCFDIOrgLogo, updateCompanyTaxInfoCertificates } from "./companies/post";
7
7
  import { updateCompanyById, updateCompanyLogoById, updateCompanyTaxInfoById } from "./companies/put";
8
8
  import { getCountries } from "./countries/get";
9
- import { getAutomaticDiscountById, getAutomaticDiscounts, getDiscountCodeById, getDiscountCodes, verifyDiscountCode } from './discounts/get';
9
+ import { getAutomaticDiscountById, getAutomaticDiscounts, getAvailableAutomaticDiscounts, getDiscountCodeById, getDiscountCodes, verifyDiscountCode } from './discounts/get';
10
10
  import { createAutomaticDiscount, createDiscountCode } from "./discounts/post";
11
11
  import { deleteAutomaticDiscountById, deleteDiscountCodeById } from "./discounts/put";
12
12
  import { deleteStoreStaffById } from "./staff/delete";
@@ -99,6 +99,7 @@ const WashdayClient = function WashdayClient(apiToken) {
99
99
  getListCustomersApp: ordersEndpoints.getModule.getListCustomersApp,
100
100
  getByIdCustomersApp: ordersEndpoints.getModule.getByIdCustomersApp,
101
101
  setOrderAcceptedBySequence: ordersEndpoints.putModule.setOrderAcceptedBySequence,
102
+ getRequestedOrdersSummary: ordersEndpoints.getModule.getRequestedOrdersSummary,
102
103
  });
103
104
  this.customers = bindMethods(this, {
104
105
  getCustomers: customersEndpoints.getModule.getList,
@@ -204,6 +205,7 @@ const WashdayClient = function WashdayClient(apiToken) {
204
205
  });
205
206
  this.automaticDiscount = bindMethods(this, {
206
207
  getAutomaticDiscounts: getAutomaticDiscounts,
208
+ getAvailableAutomaticDiscounts: getAvailableAutomaticDiscounts,
207
209
  getAutomaticDiscountById: getAutomaticDiscountById,
208
210
  createAutomaticDiscount: createAutomaticDiscount,
209
211
  deleteAutomaticDiscountById: deleteAutomaticDiscountById,
@@ -154,3 +154,17 @@ export const getByIdCustomersApp = function (id) {
154
154
  }
155
155
  });
156
156
  };
157
+ export const getRequestedOrdersSummary = function (storeIds) {
158
+ return __awaiter(this, void 0, void 0, function* () {
159
+ try {
160
+ const config = {
161
+ headers: { Authorization: `Bearer ${this.apiToken}` }
162
+ };
163
+ return yield axiosInstance.get(`${GET_SET_ORDER}/requested-summary?storeIds=${storeIds}`, config);
164
+ }
165
+ catch (error) {
166
+ console.error('Error fetching:', error);
167
+ throw error;
168
+ }
169
+ });
170
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "washday-sdk",
3
- "version": "0.0.122",
3
+ "version": "0.0.124",
4
4
  "description": "Washday utilities functions and API",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -3,7 +3,7 @@ import axios, { AxiosInstance, AxiosRequestConfig } from 'axios';
3
3
  // Define the type for the Axios instance
4
4
  let axiosInstance: AxiosInstance | null = null;
5
5
 
6
- //const BASE_URL: string = 'http://localhost:5555/';
6
+ // const BASE_URL: string = 'http://localhost:5555/';
7
7
  const BASE_URL: string = 'https://washday-backend.herokuapp.com/';
8
8
 
9
9
  // Function to create or return the singleton instance
@@ -3,6 +3,7 @@ import axiosInstance from "../axiosInstance";
3
3
 
4
4
  const GET_SET_DISCOUNT_CODES = 'api/v2/discountCodes';
5
5
  const GET_SET_AUTOMATIC_DISCOUNTS = 'api/discounts';
6
+ const GET_AVAILABLE_AUTOMATIC_DISCOUNTS = 'api/availableDiscounts';
6
7
 
7
8
  export const getDiscountCodes = async function (this: WashdayClientInstance, storeId: string, params?: string): Promise<any> {
8
9
  try {
@@ -71,3 +72,15 @@ export const verifyDiscountCode = async function (this: WashdayClientInstance, s
71
72
  throw error;
72
73
  }
73
74
  };
75
+
76
+ export const getAvailableAutomaticDiscounts = async function (this: WashdayClientInstance, storeId: string, date: string): Promise<any> {
77
+ try {
78
+ const config = {
79
+ headers: { Authorization: `Bearer ${this.apiToken}` }
80
+ };
81
+ return await axiosInstance.get(`${GET_AVAILABLE_AUTOMATIC_DISCOUNTS}/${storeId}?currentDate=${date}`, config);
82
+ } catch (error) {
83
+ console.error('Error fetching getAvailableAutomaticDiscounts:', error);
84
+ throw error;
85
+ }
86
+ };
package/src/api/index.ts CHANGED
@@ -7,7 +7,7 @@ import { getCompanyById } from "./companies/get";
7
7
  import { updateCFDIOrgLogo, updateCompanyTaxInfoCertificates } from "./companies/post";
8
8
  import { updateCompanyById, updateCompanyLogoById, updateCompanyTaxInfoById } from "./companies/put";
9
9
  import { getCountries } from "./countries/get";
10
- import { getAutomaticDiscountById, getAutomaticDiscounts, getDiscountCodeById, getDiscountCodes, verifyDiscountCode } from './discounts/get';
10
+ import { getAutomaticDiscountById, getAutomaticDiscounts, getAvailableAutomaticDiscounts, getDiscountCodeById, getDiscountCodes, verifyDiscountCode } from './discounts/get';
11
11
  import { createAutomaticDiscount, createDiscountCode } from "./discounts/post";
12
12
  import { deleteAutomaticDiscountById, deleteDiscountCodeById } from "./discounts/put";
13
13
  import { deleteStoreStaffById } from "./staff/delete";
@@ -105,6 +105,7 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
105
105
  getListCustomersApp: ordersEndpoints.getModule.getListCustomersApp,
106
106
  getByIdCustomersApp: ordersEndpoints.getModule.getByIdCustomersApp,
107
107
  setOrderAcceptedBySequence: ordersEndpoints.putModule.setOrderAcceptedBySequence,
108
+ getRequestedOrdersSummary: ordersEndpoints.getModule.getRequestedOrdersSummary,
108
109
  });
109
110
  this.customers = bindMethods(this, {
110
111
  getCustomers: customersEndpoints.getModule.getList,
@@ -210,6 +211,7 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
210
211
  });
211
212
  this.automaticDiscount = bindMethods(this, {
212
213
  getAutomaticDiscounts: getAutomaticDiscounts,
214
+ getAvailableAutomaticDiscounts: getAvailableAutomaticDiscounts,
213
215
  getAutomaticDiscountById: getAutomaticDiscountById,
214
216
  createAutomaticDiscount: createAutomaticDiscount,
215
217
  deleteAutomaticDiscountById: deleteAutomaticDiscountById,
@@ -171,4 +171,16 @@ export const getByIdCustomersApp = async function (this: WashdayClientInstance,
171
171
  console.error('Error fetching:', error);
172
172
  throw error;
173
173
  }
174
+ }
175
+
176
+ export const getRequestedOrdersSummary = async function (this: WashdayClientInstance, storeIds: string): Promise<any> {
177
+ try {
178
+ const config = {
179
+ headers: { Authorization: `Bearer ${this.apiToken}` }
180
+ };
181
+ return await axiosInstance.get(`${GET_SET_ORDER}/requested-summary?storeIds=${storeIds}`, config);
182
+ } catch (error) {
183
+ console.error('Error fetching:', error);
184
+ throw error;
185
+ }
174
186
  }
@@ -6,7 +6,7 @@ import { getCompanyById } from "../api/companies/get";
6
6
  import { updateCFDIOrgLogo, updateCompanyTaxInfoCertificates } from "../api/companies/post";
7
7
  import { updateCompanyById, updateCompanyLogoById, updateCompanyTaxInfoById } from "../api/companies/put";
8
8
  import { getCountries } from "../api/countries/get";
9
- import { getAutomaticDiscountById, getAutomaticDiscounts, getDiscountCodeById, getDiscountCodes, verifyDiscountCode } from '../api/discounts/get';
9
+ import { getAutomaticDiscountById, getAutomaticDiscounts, getAvailableAutomaticDiscounts, getDiscountCodeById, getDiscountCodes, verifyDiscountCode } from '../api/discounts/get';
10
10
  import { createAutomaticDiscount, createDiscountCode } from "../api/discounts/post";
11
11
  import { deleteAutomaticDiscountById, deleteDiscountCodeById } from "../api/discounts/put";
12
12
  import { deleteStoreStaffById } from "../api/staff/delete";
@@ -91,6 +91,7 @@ export interface WashdayClientInstance {
91
91
  getListCustomersApp: typeof ordersEndpoints.getModule.getListCustomersApp;
92
92
  getByIdCustomersApp: typeof ordersEndpoints.getModule.getByIdCustomersApp;
93
93
  setOrderAcceptedBySequence: typeof ordersEndpoints.putModule.setOrderAcceptedBySequence,
94
+ getRequestedOrdersSummary: typeof ordersEndpoints.getModule.getRequestedOrdersSummary;
94
95
  };
95
96
  customers: {
96
97
  getCustomers: typeof customersEndpoints.getModule.getList;
@@ -196,6 +197,7 @@ export interface WashdayClientInstance {
196
197
  };
197
198
  automaticDiscount: {
198
199
  getAutomaticDiscounts: typeof getAutomaticDiscounts;
200
+ getAvailableAutomaticDiscounts: typeof getAvailableAutomaticDiscounts,
199
201
  getAutomaticDiscountById: typeof getAutomaticDiscountById;
200
202
  createAutomaticDiscount: typeof createAutomaticDiscount;
201
203
  deleteAutomaticDiscountById: typeof deleteAutomaticDiscountById;
@@ -203,6 +203,7 @@ export interface ITax {
203
203
 
204
204
  export interface INotificationConfig {
205
205
  notifyOrderCreated: boolean,
206
+ notifyOrderAccepted: boolean,
206
207
  notifyPickedUp: boolean,
207
208
  notifyCleaned: boolean,
208
209
  notifyCollected: boolean,