washday-sdk 0.0.111 → 0.0.113

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,15 +1,25 @@
1
- "use strict";
2
- // import { WashdayClientInstance } from "../../interfaces/Api";
3
- // import axiosInstance from "../axiosInstance";
4
- // const GET_SET_ORDER_PAYMENTLINES = (orderId: string) => `/api/v2/order/${orderId}/paymentLines`;
5
- // export const deletePaymentLineById = async function (this: WashdayClientInstance, orderId: string, id: string): Promise<any> {
6
- // try {
7
- // const config = {
8
- // headers: { Authorization: `Bearer ${this.apiToken}` }
9
- // };
10
- // return await axiosInstance.delete(`${GET_SET_ORDER_PAYMENTLINES(orderId)}/${id}`, config);
11
- // } catch (error) {
12
- // console.error('Error fetching deleteById:', error);
13
- // throw error;
14
- // }
15
- // };
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import axiosInstance from "../axiosInstance";
11
+ const GET_CASH_UP_REPORTS = 'api/cashupreports';
12
+ export const deleteCashUpReport = function (storeId, id) {
13
+ return __awaiter(this, void 0, void 0, function* () {
14
+ try {
15
+ const config = {
16
+ headers: { Authorization: `Bearer ${this.apiToken}` }
17
+ };
18
+ return yield axiosInstance.delete(`${GET_CASH_UP_REPORTS}/${id}?storeId=${storeId}`, config);
19
+ }
20
+ catch (error) {
21
+ console.error('Error fetching:', error);
22
+ throw error;
23
+ }
24
+ });
25
+ };
@@ -1,4 +1,4 @@
1
- // export * as deleteModule from './delete';
1
+ export * as deleteModule from './delete';
2
2
  export * as getModule from './get';
3
3
  export * as postModule from './post';
4
4
  // export * as putModule from './put';
package/dist/api/index.js CHANGED
@@ -13,7 +13,7 @@ import { deleteStoreStaffById } from "./staff/delete";
13
13
  import { getStoreStaff, getStoreStaffById } from "./staff/get";
14
14
  import { createStoreStaff } from "./staff/post";
15
15
  import { updateStoreStaffById } from "./staff/put";
16
- import { getStoreById, getStoreImages, getStoreReviewLink, getStores, getStoresByName } from "./stores/get";
16
+ import { getStoreById, getStoreImages, getStoreReviewLink, getStores, getStoresByIdCustomersApp, getStoresByName } from "./stores/get";
17
17
  import { copyStore, createStore, createStoreImage } from "./stores/post";
18
18
  import { deleteStoreById, updateStoreById } from "./stores/put";
19
19
  import { createCFDISuscrptionCheckoutSession, createCreateSuscriptionCheckoutSession, createCustomerPortalSession, createGetMoreCheckoutSession } from "./stripe/post";
@@ -48,7 +48,8 @@ const WashdayClient = function WashdayClient(apiToken) {
48
48
  getList: cashupsEndpoints.getModule.getList,
49
49
  getById: cashupsEndpoints.getModule.getById,
50
50
  getPreviewDataForCashClose: cashupsEndpoints.getModule.getPreviewDataForCashClose,
51
- create: cashupsEndpoints.postModule.create
51
+ create: cashupsEndpoints.postModule.create,
52
+ deleteCashUpReport: cashupsEndpoints.deleteModule.deleteCashUpReport
52
53
  });
53
54
  this.cfdi = bindMethods(this, {
54
55
  getList: cfdiEndpoints.getModule.getList,
@@ -108,6 +109,7 @@ const WashdayClient = function WashdayClient(apiToken) {
108
109
  getStoreById: getStoreById,
109
110
  getStoreImages: getStoreImages,
110
111
  getStoresByName: getStoresByName,
112
+ getStoresByIdCustomersApp: getStoresByIdCustomersApp,
111
113
  createStore: createStore,
112
114
  copyStore: copyStore,
113
115
  updateStoreById: updateStoreById,
@@ -142,6 +144,7 @@ const WashdayClient = function WashdayClient(apiToken) {
142
144
  this.sections = bindMethods(this, {
143
145
  getSections: sectionsEndpoints.getModule.getList,
144
146
  getById: sectionsEndpoints.getModule.getById,
147
+ getSectionsByStoreCustomersApp: sectionsEndpoints.getModule.getSectionsByStoreCustomersApp,
145
148
  create: sectionsEndpoints.postModule.create,
146
149
  deleteById: sectionsEndpoints.deleteModule.deleteById,
147
150
  updateById: sectionsEndpoints.putModule.updateById,
@@ -7,8 +7,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
+ import { generateQueryParamsStr } from "../../utils/apiUtils";
10
11
  import axiosInstance from "../axiosInstance";
11
12
  const GET_SET_SECTIONS = 'api/section';
13
+ const GET_SET_SECTIONS_WASHDAY_APP = 'api/v2/washdayapp/sections';
12
14
  export const getList = function (params) {
13
15
  return __awaiter(this, void 0, void 0, function* () {
14
16
  try {
@@ -50,3 +52,20 @@ export const getById = function (id) {
50
52
  }
51
53
  });
52
54
  };
55
+ export const getSectionsByStoreCustomersApp = function (params) {
56
+ return __awaiter(this, void 0, void 0, function* () {
57
+ try {
58
+ const config = {
59
+ headers: { Authorization: `Bearer ${this.apiToken}` }
60
+ };
61
+ const queryParams = generateQueryParamsStr([
62
+ 'storeId',
63
+ ], params);
64
+ return yield axiosInstance.get(`${GET_SET_SECTIONS_WASHDAY_APP}?${queryParams}`, config);
65
+ }
66
+ catch (error) {
67
+ console.error('Error fetching getSectionsByStoreCustomersApp:', error);
68
+ throw error;
69
+ }
70
+ });
71
+ };
@@ -92,3 +92,19 @@ export const getStoresByName = function (query) {
92
92
  }
93
93
  });
94
94
  };
95
+ export const getStoresByIdCustomersApp = function (id) {
96
+ return __awaiter(this, void 0, void 0, function* () {
97
+ var _a, _b;
98
+ try {
99
+ const config = {
100
+ headers: { Authorization: `Bearer ${this.apiToken}` }
101
+ };
102
+ const response = yield axiosInstance.get(`${GET_STORES_WASHDAY_APP}/${id}`, config);
103
+ return ((_b = (_a = response.data) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.store) || [];
104
+ }
105
+ catch (error) {
106
+ console.error('Error fetching getStoresByIdCustomersApp:', error);
107
+ throw error;
108
+ }
109
+ });
110
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "washday-sdk",
3
- "version": "0.0.111",
3
+ "version": "0.0.113",
4
4
  "description": "Washday utilities functions and API",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -1,15 +1,15 @@
1
- // import { WashdayClientInstance } from "../../interfaces/Api";
2
- // import axiosInstance from "../axiosInstance";
3
- // const GET_SET_ORDER_PAYMENTLINES = (orderId: string) => `/api/v2/order/${orderId}/paymentLines`;
1
+ import { WashdayClientInstance } from "../../interfaces/Api";
2
+ import axiosInstance from "../axiosInstance";
3
+ const GET_CASH_UP_REPORTS = 'api/cashupreports';
4
4
 
5
- // export const deletePaymentLineById = async function (this: WashdayClientInstance, orderId: string, id: string): Promise<any> {
6
- // try {
7
- // const config = {
8
- // headers: { Authorization: `Bearer ${this.apiToken}` }
9
- // };
10
- // return await axiosInstance.delete(`${GET_SET_ORDER_PAYMENTLINES(orderId)}/${id}`, config);
11
- // } catch (error) {
12
- // console.error('Error fetching deleteById:', error);
13
- // throw error;
14
- // }
15
- // };
5
+ export const deleteCashUpReport = async function (this: WashdayClientInstance, storeId: string, id: string): Promise<any> {
6
+ try {
7
+ const config = {
8
+ headers: { Authorization: `Bearer ${this.apiToken}` }
9
+ };
10
+ return await axiosInstance.delete(`${GET_CASH_UP_REPORTS}/${id}?storeId=${storeId}`, config);
11
+ } catch (error) {
12
+ console.error('Error fetching:', error);
13
+ throw error;
14
+ }
15
+ }
@@ -1,4 +1,4 @@
1
- // export * as deleteModule from './delete';
1
+ export * as deleteModule from './delete';
2
2
  export * as getModule from './get';
3
3
  export * as postModule from './post';
4
4
  // export * as putModule from './put';
package/src/api/index.ts CHANGED
@@ -14,7 +14,7 @@ import { deleteStoreStaffById } from "./staff/delete";
14
14
  import { getStoreStaff, getStoreStaffById } from "./staff/get";
15
15
  import { createStoreStaff } from "./staff/post";
16
16
  import { updateStoreStaffById } from "./staff/put";
17
- import { getStoreById, getStoreImages, getStoreReviewLink, getStores, getStoresByName } from "./stores/get";
17
+ import { getStoreById, getStoreImages, getStoreReviewLink, getStores, getStoresByIdCustomersApp, getStoresByName } from "./stores/get";
18
18
  import { copyStore, createStore, createStoreImage } from "./stores/post";
19
19
  import { deleteStoreById, updateStoreById } from "./stores/put";
20
20
  import { createCFDISuscrptionCheckoutSession, createCreateSuscriptionCheckoutSession, createCustomerPortalSession, createGetMoreCheckoutSession } from "./stripe/post";
@@ -54,7 +54,8 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
54
54
  getList: cashupsEndpoints.getModule.getList,
55
55
  getById: cashupsEndpoints.getModule.getById,
56
56
  getPreviewDataForCashClose: cashupsEndpoints.getModule.getPreviewDataForCashClose,
57
- create: cashupsEndpoints.postModule.create
57
+ create: cashupsEndpoints.postModule.create,
58
+ deleteCashUpReport: cashupsEndpoints.deleteModule.deleteCashUpReport
58
59
  });
59
60
  this.cfdi = bindMethods(this, {
60
61
  getList: cfdiEndpoints.getModule.getList,
@@ -114,6 +115,7 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
114
115
  getStoreById: getStoreById,
115
116
  getStoreImages: getStoreImages,
116
117
  getStoresByName: getStoresByName,
118
+ getStoresByIdCustomersApp: getStoresByIdCustomersApp,
117
119
  createStore: createStore,
118
120
  copyStore: copyStore,
119
121
  updateStoreById: updateStoreById,
@@ -148,6 +150,7 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
148
150
  this.sections = bindMethods(this, {
149
151
  getSections: sectionsEndpoints.getModule.getList,
150
152
  getById: sectionsEndpoints.getModule.getById,
153
+ getSectionsByStoreCustomersApp: sectionsEndpoints.getModule.getSectionsByStoreCustomersApp,
151
154
  create: sectionsEndpoints.postModule.create,
152
155
  deleteById: sectionsEndpoints.deleteModule.deleteById,
153
156
  updateById: sectionsEndpoints.putModule.updateById,
@@ -1,8 +1,10 @@
1
1
  import { WashdayClientInstance } from "../../interfaces/Api";
2
2
  import { ISection } from "../../interfaces/Section";
3
+ import { IStore } from "../../interfaces/Store";
4
+ import { generateQueryParamsStr } from "../../utils/apiUtils";
3
5
  import axiosInstance from "../axiosInstance";
4
-
5
6
  const GET_SET_SECTIONS = 'api/section';
7
+ const GET_SET_SECTIONS_WASHDAY_APP = 'api/v2/washdayapp/sections';
6
8
 
7
9
  export const getList = async function (this: WashdayClientInstance, params?: {
8
10
  storeId?: string
@@ -43,4 +45,23 @@ export const getById = async function (this: WashdayClientInstance, id: string):
43
45
  console.error('Error fetching getSectionById:', error);
44
46
  throw error;
45
47
  }
46
- };
48
+ };
49
+
50
+ export const getSectionsByStoreCustomersApp = async function (this: WashdayClientInstance,
51
+ params: {
52
+ storeId: string
53
+ }
54
+ ): Promise<{ store: IStore }> {
55
+ try {
56
+ const config = {
57
+ headers: { Authorization: `Bearer ${this.apiToken}` }
58
+ };
59
+ const queryParams = generateQueryParamsStr([
60
+ 'storeId',
61
+ ], params);
62
+ return await axiosInstance.get(`${GET_SET_SECTIONS_WASHDAY_APP}?${queryParams}`, config);
63
+ } catch (error) {
64
+ console.error('Error fetching getSectionsByStoreCustomersApp:', error);
65
+ throw error;
66
+ }
67
+ };
@@ -78,3 +78,16 @@ export const getStoresByName = async function (this: WashdayClientInstance, quer
78
78
  throw error;
79
79
  }
80
80
  };
81
+
82
+ export const getStoresByIdCustomersApp = async function (this: WashdayClientInstance, id: string): Promise<{ store: IStore }> {
83
+ try {
84
+ const config = {
85
+ headers: { Authorization: `Bearer ${this.apiToken}` }
86
+ };
87
+ const response = await axiosInstance.get(`${GET_STORES_WASHDAY_APP}/${id}`, config);
88
+ return response.data?.data?.store || [];
89
+ } catch (error) {
90
+ console.error('Error fetching getStoresByIdCustomersApp:', error);
91
+ throw error;
92
+ }
93
+ };
@@ -13,7 +13,7 @@ import { deleteStoreStaffById } from "../api/staff/delete";
13
13
  import { getStoreStaff, getStoreStaffById } from "../api/staff/get";
14
14
  import { createStoreStaff } from "../api/staff/post";
15
15
  import { updateStoreStaffById } from "../api/staff/put";
16
- import { getStoreById, getStoreImages, getStoreReviewLink, getStores, getStoresByName } from "../api/stores/get";
16
+ import { getStoreById, getStoreImages, getStoreReviewLink, getStores, getStoresByIdCustomersApp, getStoresByName } from "../api/stores/get";
17
17
  import { copyStore, createStore, createStoreImage } from "../api/stores/post";
18
18
  import { deleteStoreById, updateStoreById } from "../api/stores/put";
19
19
  import { createCFDISuscrptionCheckoutSession, createCreateSuscriptionCheckoutSession, createCustomerPortalSession, createGetMoreCheckoutSession } from "../api/stripe/post";
@@ -40,7 +40,8 @@ export interface WashdayClientInstance {
40
40
  getList: typeof cashupsEndpoints.getModule.getList;
41
41
  getById: typeof cashupsEndpoints.getModule.getById;
42
42
  getPreviewDataForCashClose: typeof cashupsEndpoints.getModule.getPreviewDataForCashClose;
43
- create: typeof cashupsEndpoints.postModule.create
43
+ create: typeof cashupsEndpoints.postModule.create,
44
+ deleteCashUpReport: typeof cashupsEndpoints.deleteModule.deleteCashUpReport,
44
45
  }
45
46
  cfdi: {
46
47
  getList: typeof cfdiEndpoints.getModule.getList,
@@ -100,6 +101,7 @@ export interface WashdayClientInstance {
100
101
  getStoreById: typeof getStoreById;
101
102
  getStoreImages: typeof getStoreImages;
102
103
  getStoresByName: typeof getStoresByName;
104
+ getStoresByIdCustomersApp: typeof getStoresByIdCustomersApp;
103
105
  createStore: typeof createStore;
104
106
  copyStore: typeof copyStore;
105
107
  updateStoreById: typeof updateStoreById;
@@ -134,6 +136,7 @@ export interface WashdayClientInstance {
134
136
  sections: {
135
137
  getSections: typeof sectionsEndpoints.getModule.getList;
136
138
  getById: typeof sectionsEndpoints.getModule.getById;
139
+ getSectionsByStoreCustomersApp: typeof sectionsEndpoints.getModule.getSectionsByStoreCustomersApp;
137
140
  create: typeof sectionsEndpoints.postModule.create;
138
141
  deleteById: typeof sectionsEndpoints.deleteModule.deleteById;
139
142
  updateById: typeof sectionsEndpoints.putModule.updateById;