washday-sdk 0.0.136 → 0.0.138

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.
@@ -9,6 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  };
10
10
  import axiosInstance from "../axiosInstance";
11
11
  const GET_AUTH = "api/v2/washdayapp/auth";
12
+ const REGULAR_USER_AUTH = "api/auth";
12
13
  export const appleLogin = function (params) {
13
14
  return __awaiter(this, void 0, void 0, function* () {
14
15
  try {
@@ -57,3 +58,15 @@ export const googleLogin = function (params) {
57
58
  }
58
59
  });
59
60
  };
61
+ export const regularUserLogin = function (params) {
62
+ return __awaiter(this, void 0, void 0, function* () {
63
+ try {
64
+ const config = {};
65
+ return yield axiosInstance.post(`${REGULAR_USER_AUTH}/login`, params, config);
66
+ }
67
+ catch (error) {
68
+ console.error('Error fetching regularUserLogin:', error);
69
+ throw error;
70
+ }
71
+ });
72
+ };
package/dist/api/index.js CHANGED
@@ -78,6 +78,7 @@ const WashdayClient = function WashdayClient(apiToken) {
78
78
  appleLogin: authEndpoints.postModule.appleLogin,
79
79
  customerRegularLogin: authEndpoints.postModule.customerRegularLogin,
80
80
  customerSignUp: authEndpoints.postModule.customerSignUp,
81
+ regularUserLogin: authEndpoints.postModule.regularUserLogin,
81
82
  });
82
83
  this.orders = bindMethods(this, {
83
84
  getList: ordersEndpoints.getModule.getList,
@@ -244,6 +245,11 @@ const WashdayClient = function WashdayClient(apiToken) {
244
245
  getProductSalesReport: reportsExportEndpoints.getModule.getProductSalesReport,
245
246
  getPaymentLinesReport: reportsExportEndpoints.getModule.getPaymentLinesReport,
246
247
  getUnpaidOrdersReport: reportsExportEndpoints.getModule.getUnpaidOrdersReport,
248
+ getAnnualSalesStatistics: reportsExportEndpoints.getModule.getAnnualSalesStatistics,
249
+ getPaymentMethodStatistics: reportsExportEndpoints.getModule.getPaymentMethodStatistics,
250
+ getProductsStatistics: reportsExportEndpoints.getModule.getProductsStatistics,
251
+ getMonthSalesStatistics: reportsExportEndpoints.getModule.getMonthSalesStatistics,
252
+ getPopularDaysStatistics: reportsExportEndpoints.getModule.getPopularDaysStatistics,
247
253
  });
248
254
  };
249
255
  export default WashdayClient;
@@ -10,6 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  import { generateQueryParamsStr } from "../../utils/apiUtils";
11
11
  import axiosInstance from "../axiosInstance";
12
12
  const GET_SET_REPORTS = 'api/reports';
13
+ const GET_SET_STATISTICS = 'api/statistics';
13
14
  export const getCleanedOrdersReport = function (storeId, params) {
14
15
  return __awaiter(this, void 0, void 0, function* () {
15
16
  try {
@@ -205,3 +206,98 @@ export const getUnpaidOrdersReport = function (storeId, params) {
205
206
  }
206
207
  });
207
208
  };
209
+ export const getAnnualSalesStatistics = function (storeId, params) {
210
+ return __awaiter(this, void 0, void 0, function* () {
211
+ try {
212
+ const config = {
213
+ headers: { Authorization: `Bearer ${this.apiToken}` }
214
+ };
215
+ const queryParams = generateQueryParamsStr([
216
+ 'toDate',
217
+ 'fromDate',
218
+ 'timezone',
219
+ ], params);
220
+ return yield axiosInstance.get(`${GET_SET_STATISTICS}/${storeId}/annual?${queryParams}`, config);
221
+ }
222
+ catch (error) {
223
+ console.error('Error fetching getAnnualSalesStatistics :', error);
224
+ throw error;
225
+ }
226
+ });
227
+ };
228
+ export const getPaymentMethodStatistics = function (storeId, params) {
229
+ return __awaiter(this, void 0, void 0, function* () {
230
+ try {
231
+ const config = {
232
+ headers: { Authorization: `Bearer ${this.apiToken}` }
233
+ };
234
+ const queryParams = generateQueryParamsStr([
235
+ 'toDate',
236
+ 'fromDate',
237
+ 'timezone',
238
+ ], params);
239
+ return yield axiosInstance.get(`${GET_SET_STATISTICS}/${storeId}/ordersPaymentMethod?${queryParams}`, config);
240
+ }
241
+ catch (error) {
242
+ console.error('Error fetching getPaymentMethodStatistics :', error);
243
+ throw error;
244
+ }
245
+ });
246
+ };
247
+ export const getProductsStatistics = function (storeId, params) {
248
+ return __awaiter(this, void 0, void 0, function* () {
249
+ try {
250
+ const config = {
251
+ headers: { Authorization: `Bearer ${this.apiToken}` }
252
+ };
253
+ const queryParams = generateQueryParamsStr([
254
+ 'toDate',
255
+ 'fromDate',
256
+ 'timezone',
257
+ ], params);
258
+ return yield axiosInstance.get(`${GET_SET_STATISTICS}/${storeId}/ordersProduct?${queryParams}`, config);
259
+ }
260
+ catch (error) {
261
+ console.error('Error fetching getProductsStatistics :', error);
262
+ throw error;
263
+ }
264
+ });
265
+ };
266
+ export const getMonthSalesStatistics = function (storeId, params) {
267
+ return __awaiter(this, void 0, void 0, function* () {
268
+ try {
269
+ const config = {
270
+ headers: { Authorization: `Bearer ${this.apiToken}` }
271
+ };
272
+ const queryParams = generateQueryParamsStr([
273
+ 'toDate',
274
+ 'fromDate',
275
+ 'timezone',
276
+ ], params);
277
+ return yield axiosInstance.get(`${GET_SET_STATISTICS}/${storeId}/month?${queryParams}`, config);
278
+ }
279
+ catch (error) {
280
+ console.error('Error fetching getMonthSalesStatistics :', error);
281
+ throw error;
282
+ }
283
+ });
284
+ };
285
+ export const getPopularDaysStatistics = function (storeId, params) {
286
+ return __awaiter(this, void 0, void 0, function* () {
287
+ try {
288
+ const config = {
289
+ headers: { Authorization: `Bearer ${this.apiToken}` }
290
+ };
291
+ const queryParams = generateQueryParamsStr([
292
+ 'toDate',
293
+ 'fromDate',
294
+ 'timezone',
295
+ ], params);
296
+ return yield axiosInstance.get(`${GET_SET_STATISTICS}/${storeId}/popularDays?${queryParams}`, config);
297
+ }
298
+ catch (error) {
299
+ console.error('Error fetching getPopularDaysStatistics :', error);
300
+ throw error;
301
+ }
302
+ });
303
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "washday-sdk",
3
- "version": "0.0.136",
3
+ "version": "0.0.138",
4
4
  "description": "Washday utilities functions and API",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -3,6 +3,7 @@ import { WashdayClientInstance } from "../../interfaces/Api";
3
3
  import { AppleAuthenticationCredential } from "../../interfaces/Apple";
4
4
  import axiosInstance from "../axiosInstance";
5
5
  const GET_AUTH = "api/v2/washdayapp/auth"
6
+ const REGULAR_USER_AUTH = "api/auth"
6
7
 
7
8
  export const appleLogin = async function (this: WashdayClientInstance, params: {
8
9
  companyId: string;
@@ -68,4 +69,17 @@ export const googleLogin = async function (this: WashdayClientInstance, params:
68
69
  console.error('Error fetching googleLogin:', error);
69
70
  throw error;
70
71
  }
71
- };
72
+ };
73
+
74
+ export const regularUserLogin = async function (this: WashdayClientInstance, params: {
75
+ email: string
76
+ password: string
77
+ }): Promise<any> {
78
+ try {
79
+ const config = {};
80
+ return await axiosInstance.post(`${REGULAR_USER_AUTH}/login`, params, config);
81
+ } catch (error) {
82
+ console.error('Error fetching regularUserLogin:', error);
83
+ throw error;
84
+ }
85
+ };
package/src/api/index.ts CHANGED
@@ -84,6 +84,7 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
84
84
  appleLogin: authEndpoints.postModule.appleLogin,
85
85
  customerRegularLogin: authEndpoints.postModule.customerRegularLogin,
86
86
  customerSignUp: authEndpoints.postModule.customerSignUp,
87
+ regularUserLogin: authEndpoints.postModule.regularUserLogin,
87
88
  });
88
89
  this.orders = bindMethods(this, {
89
90
  getList: ordersEndpoints.getModule.getList,
@@ -250,6 +251,11 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
250
251
  getProductSalesReport: reportsExportEndpoints.getModule.getProductSalesReport,
251
252
  getPaymentLinesReport: reportsExportEndpoints.getModule.getPaymentLinesReport,
252
253
  getUnpaidOrdersReport: reportsExportEndpoints.getModule.getUnpaidOrdersReport,
254
+ getAnnualSalesStatistics: reportsExportEndpoints.getModule.getAnnualSalesStatistics,
255
+ getPaymentMethodStatistics: reportsExportEndpoints.getModule.getPaymentMethodStatistics,
256
+ getProductsStatistics: reportsExportEndpoints.getModule.getProductsStatistics,
257
+ getMonthSalesStatistics: reportsExportEndpoints.getModule.getMonthSalesStatistics,
258
+ getPopularDaysStatistics: reportsExportEndpoints.getModule.getPopularDaysStatistics,
253
259
  });
254
260
  } as any;
255
261
 
@@ -3,6 +3,7 @@ import { IOrder } from "../../interfaces/Order";
3
3
  import { generateQueryParamsStr } from "../../utils/apiUtils";
4
4
  import axiosInstance from "../axiosInstance";
5
5
  const GET_SET_REPORTS = 'api/reports';
6
+ const GET_SET_STATISTICS = 'api/statistics';
6
7
 
7
8
  export const getCleanedOrdersReport = async function (this: WashdayClientInstance, storeId: string, params: {
8
9
  fromDate?: string
@@ -221,3 +222,108 @@ export const getUnpaidOrdersReport = async function (this: WashdayClientInstance
221
222
  throw error;
222
223
  }
223
224
  };
225
+
226
+ export const getAnnualSalesStatistics = async function (this: WashdayClientInstance, storeId: string, params: {
227
+ fromDate?: string
228
+ toDate?: string
229
+ timezone?: string
230
+ }): Promise<any> {
231
+ try {
232
+ const config = {
233
+ headers: { Authorization: `Bearer ${this.apiToken}` }
234
+ };
235
+ const queryParams = generateQueryParamsStr([
236
+ 'toDate',
237
+ 'fromDate',
238
+ 'timezone',
239
+ ], params);
240
+ return await axiosInstance.get(`${GET_SET_STATISTICS}/${storeId}/annual?${queryParams}`, config);
241
+ } catch (error) {
242
+ console.error('Error fetching getAnnualSalesStatistics :', error);
243
+ throw error;
244
+ }
245
+ };
246
+
247
+ export const getPaymentMethodStatistics = async function (this: WashdayClientInstance, storeId: string, params: {
248
+ fromDate?: string
249
+ toDate?: string
250
+ timezone?: string
251
+ }): Promise<any> {
252
+ try {
253
+ const config = {
254
+ headers: { Authorization: `Bearer ${this.apiToken}` }
255
+ };
256
+ const queryParams = generateQueryParamsStr([
257
+ 'toDate',
258
+ 'fromDate',
259
+ 'timezone',
260
+ ], params);
261
+ return await axiosInstance.get(`${GET_SET_STATISTICS}/${storeId}/ordersPaymentMethod?${queryParams}`, config);
262
+ } catch (error) {
263
+ console.error('Error fetching getPaymentMethodStatistics :', error);
264
+ throw error;
265
+ }
266
+ };
267
+
268
+ export const getProductsStatistics = async function (this: WashdayClientInstance, storeId: string, params: {
269
+ fromDate?: string
270
+ toDate?: string
271
+ timezone?: string
272
+ }): Promise<any> {
273
+ try {
274
+ const config = {
275
+ headers: { Authorization: `Bearer ${this.apiToken}` }
276
+ };
277
+ const queryParams = generateQueryParamsStr([
278
+ 'toDate',
279
+ 'fromDate',
280
+ 'timezone',
281
+ ], params);
282
+ return await axiosInstance.get(`${GET_SET_STATISTICS}/${storeId}/ordersProduct?${queryParams}`, config);
283
+ } catch (error) {
284
+ console.error('Error fetching getProductsStatistics :', error);
285
+ throw error;
286
+ }
287
+ };
288
+
289
+ export const getMonthSalesStatistics = async function (this: WashdayClientInstance, storeId: string, params: {
290
+ fromDate?: string
291
+ toDate?: string
292
+ timezone?: string
293
+ }): Promise<any> {
294
+ try {
295
+ const config = {
296
+ headers: { Authorization: `Bearer ${this.apiToken}` }
297
+ };
298
+ const queryParams = generateQueryParamsStr([
299
+ 'toDate',
300
+ 'fromDate',
301
+ 'timezone',
302
+ ], params);
303
+ return await axiosInstance.get(`${GET_SET_STATISTICS}/${storeId}/month?${queryParams}`, config);
304
+ } catch (error) {
305
+ console.error('Error fetching getMonthSalesStatistics :', error);
306
+ throw error;
307
+ }
308
+ };
309
+
310
+ export const getPopularDaysStatistics = async function (this: WashdayClientInstance, storeId: string, params: {
311
+ fromDate?: string
312
+ toDate?: string
313
+ timezone?: string
314
+ }): Promise<any> {
315
+ try {
316
+ const config = {
317
+ headers: { Authorization: `Bearer ${this.apiToken}` }
318
+ };
319
+ const queryParams = generateQueryParamsStr([
320
+ 'toDate',
321
+ 'fromDate',
322
+ 'timezone',
323
+ ], params);
324
+ return await axiosInstance.get(`${GET_SET_STATISTICS}/${storeId}/popularDays?${queryParams}`, config);
325
+ } catch (error) {
326
+ console.error('Error fetching getPopularDaysStatistics :', error);
327
+ throw error;
328
+ }
329
+ };
@@ -60,6 +60,7 @@ export interface WashdayClientInstance {
60
60
  appleLogin: typeof authEndpoints.postModule.appleLogin;
61
61
  customerRegularLogin: typeof authEndpoints.postModule.customerRegularLogin;
62
62
  customerSignUp: typeof authEndpoints.postModule.customerSignUp;
63
+ regularUserLogin: typeof authEndpoints.postModule.regularUserLogin;
63
64
  }
64
65
  review: {
65
66
  getList: typeof reviewsEndpoints.getModule.getList;
@@ -232,5 +233,10 @@ export interface WashdayClientInstance {
232
233
  getProductSalesReport: typeof reportsExportEndpoints.getModule.getProductSalesReport;
233
234
  getPaymentLinesReport: typeof reportsExportEndpoints.getModule.getPaymentLinesReport;
234
235
  getUnpaidOrdersReport: typeof reportsExportEndpoints.getModule.getUnpaidOrdersReport;
236
+ getAnnualSalesStatistics: typeof reportsExportEndpoints.getModule.getAnnualSalesStatistics;
237
+ getPaymentMethodStatistics: typeof reportsExportEndpoints.getModule.getPaymentMethodStatistics;
238
+ getProductsStatistics: typeof reportsExportEndpoints.getModule.getProductsStatistics;
239
+ getMonthSalesStatistics: typeof reportsExportEndpoints.getModule.getMonthSalesStatistics;
240
+ getPopularDaysStatistics: typeof reportsExportEndpoints.getModule.getPopularDaysStatistics;
235
241
  };
236
242
  }