washday-sdk 0.0.60 → 0.0.62

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,32 @@
1
1
  "use strict";
2
- // import { WashdayClientInstance } from "../../interfaces/Api";
3
- // import axiosInstance from "../axiosInstance";
4
- // export const deleteStoreStaffById = async function (this: WashdayClientInstance, storeId: string, staffId: string): Promise<any> {
5
- // try {
6
- // const config = {
7
- // headers: { Authorization: `Bearer ${this.apiToken}` }
8
- // };
9
- // const response = await axiosInstance.delete(`api/store/${storeId}/staff/${staffId}`, config);
10
- // return response;
11
- // } catch (error) {
12
- // console.error('Error fetching getStoreStaff:', error);
13
- // throw error;
14
- // }
15
- // };
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.deleteCashierBoxById = void 0;
16
+ const axiosInstance_1 = __importDefault(require("../axiosInstance"));
17
+ const GET_SET_CASHIER_BOX = (storeId) => `api/store/${storeId}/cashierbox`;
18
+ const deleteCashierBoxById = function (storeId, id) {
19
+ return __awaiter(this, void 0, void 0, function* () {
20
+ try {
21
+ const config = {
22
+ headers: { Authorization: `Bearer ${this.apiToken}` }
23
+ };
24
+ return yield axiosInstance_1.default.delete(`${GET_SET_CASHIER_BOX(storeId)}/${id}`, config);
25
+ }
26
+ catch (error) {
27
+ console.error('Error fetching getStoreStaff:', error);
28
+ throw error;
29
+ }
30
+ });
31
+ };
32
+ exports.deleteCashierBoxById = deleteCashierBoxById;
@@ -12,23 +12,38 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.getCashierboxesByStoreId = exports.GET_SET_CASHIER_BOX = void 0;
15
+ exports.getCashierboxesById = exports.getCashierboxesByStoreId = void 0;
16
16
  const axiosInstance_1 = __importDefault(require("../axiosInstance"));
17
17
  const GET_SET_CASHIER_BOX = (storeId) => `api/store/${storeId}/cashierbox`;
18
- exports.GET_SET_CASHIER_BOX = GET_SET_CASHIER_BOX;
19
18
  const getCashierboxesByStoreId = function (storeId, queryParams) {
20
19
  return __awaiter(this, void 0, void 0, function* () {
21
20
  try {
22
21
  const config = {
23
22
  headers: { Authorization: `Bearer ${this.apiToken}` }
24
23
  };
25
- const response = yield axiosInstance_1.default.get(`${(0, exports.GET_SET_CASHIER_BOX)(storeId)}?${queryParams}`, config);
24
+ const response = yield axiosInstance_1.default.get(`${GET_SET_CASHIER_BOX(storeId)}?${queryParams}`, config);
26
25
  return response;
27
26
  }
28
27
  catch (error) {
29
- console.error('Error fetching getStoreStaff:', error);
28
+ console.error('Error fetching getCashierboxesByStoreId:', error);
30
29
  throw error;
31
30
  }
32
31
  });
33
32
  };
34
33
  exports.getCashierboxesByStoreId = getCashierboxesByStoreId;
34
+ const getCashierboxesById = function (storeId, id, queryParams) {
35
+ return __awaiter(this, void 0, void 0, function* () {
36
+ try {
37
+ const config = {
38
+ headers: { Authorization: `Bearer ${this.apiToken}` }
39
+ };
40
+ const response = yield axiosInstance_1.default.get(`${GET_SET_CASHIER_BOX(storeId)}/${id}?${queryParams}`, config);
41
+ return response;
42
+ }
43
+ catch (error) {
44
+ console.error('Error fetching getCashierboxesById:', error);
45
+ throw error;
46
+ }
47
+ });
48
+ };
49
+ exports.getCashierboxesById = getCashierboxesById;
@@ -1,16 +1,49 @@
1
1
  "use strict";
2
- // import { WashdayClientInstance } from "../../interfaces/Api";
3
- // import axiosInstance from "../axiosInstance";
4
- // const GET_SET_STORES = 'api/store';
5
- // export const createStoreStaff = async function (this: WashdayClientInstance, storeId: string, data: any): Promise<any> {
6
- // try {
7
- // const config = {
8
- // headers: { Authorization: `Bearer ${this.apiToken}` }
9
- // };
10
- // const response = await axiosInstance.post(`api/store/${storeId}/staff`, data, config);
11
- // return response;
12
- // } catch (error) {
13
- // console.error('Error fetching createStoreImage:', error);
14
- // throw error;
15
- // }
16
- // };
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.addCashierBoxMovement = exports.createCashierBox = void 0;
16
+ const axiosInstance_1 = __importDefault(require("../axiosInstance"));
17
+ const GET_SET_CASHIER_BOX = (storeId) => `api/store/${storeId}/cashierbox`;
18
+ const createCashierBox = function (storeId, data) {
19
+ return __awaiter(this, void 0, void 0, function* () {
20
+ try {
21
+ const config = {
22
+ headers: { Authorization: `Bearer ${this.apiToken}` }
23
+ };
24
+ const response = yield axiosInstance_1.default.post(`${GET_SET_CASHIER_BOX(storeId)}`, data, config);
25
+ return response;
26
+ }
27
+ catch (error) {
28
+ console.error('Error fetching getStoreStaff:', error);
29
+ throw error;
30
+ }
31
+ });
32
+ };
33
+ exports.createCashierBox = createCashierBox;
34
+ const addCashierBoxMovement = function (storeId, id, data) {
35
+ return __awaiter(this, void 0, void 0, function* () {
36
+ try {
37
+ const config = {
38
+ headers: { Authorization: `Bearer ${this.apiToken}` }
39
+ };
40
+ const response = yield axiosInstance_1.default.post(`${GET_SET_CASHIER_BOX(storeId)}/${id}/add-movement`, data, config);
41
+ return response;
42
+ }
43
+ catch (error) {
44
+ console.error('Error fetching createStoreImage:', error);
45
+ throw error;
46
+ }
47
+ });
48
+ };
49
+ exports.addCashierBoxMovement = addCashierBoxMovement;
@@ -1,16 +1,33 @@
1
1
  "use strict";
2
- // import { WashdayClientInstance } from "../../interfaces/Api";
3
- // import { IStore } from "../../interfaces/Store";
4
- // import axiosInstance from "../axiosInstance";
5
- // export const updateStoreStaffById = async function (this: WashdayClientInstance, storeId: string, data: IStore): Promise<any> {
6
- // try {
7
- // const config = {
8
- // headers: { Authorization: `Bearer ${this.apiToken}` }
9
- // };
10
- // const response = await axiosInstance.put(`api/store/${storeId}/staff`, data, config);
11
- // return response;
12
- // } catch (error) {
13
- // console.error('Error fetching getStoreById:', error);
14
- // throw error;
15
- // }
16
- // };
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.updateCashierBoxById = void 0;
16
+ const axiosInstance_1 = __importDefault(require("../axiosInstance"));
17
+ const GET_SET_CASHIER_BOX = (storeId) => `api/store/${storeId}/cashierbox`;
18
+ const updateCashierBoxById = function (storeId, id, data) {
19
+ return __awaiter(this, void 0, void 0, function* () {
20
+ try {
21
+ const config = {
22
+ headers: { Authorization: `Bearer ${this.apiToken}` }
23
+ };
24
+ const response = yield axiosInstance_1.default.put(`${GET_SET_CASHIER_BOX(storeId)}/${id}`, data, config);
25
+ return response;
26
+ }
27
+ catch (error) {
28
+ console.error('Error fetching getStoreById:', error);
29
+ throw error;
30
+ }
31
+ });
32
+ };
33
+ exports.updateCashierBoxById = updateCashierBoxById;
package/dist/api/index.js CHANGED
@@ -1,24 +1,28 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const delete_1 = require("./cashierbox/delete");
3
4
  const get_1 = require("./cashierbox/get");
5
+ const post_1 = require("./cashierbox/post");
6
+ const put_1 = require("./cashierbox/put");
4
7
  const get_2 = require("./companies/get");
5
- const post_1 = require("./companies/post");
6
- const put_1 = require("./companies/put");
8
+ const post_2 = require("./companies/post");
9
+ const put_2 = require("./companies/put");
7
10
  const get_3 = require("./countries/get");
8
11
  const get_4 = require("./customers/get");
9
12
  const get_5 = require("./discounts/get");
10
- const post_2 = require("./discounts/post");
11
- const put_2 = require("./discounts/put");
12
- const put_3 = require("./products/put");
13
- const delete_1 = require("./staff/delete");
14
- const get_6 = require("./staff/get");
15
- const post_3 = require("./staff/post");
16
- const put_4 = require("./staff/put");
17
- const get_7 = require("./stores/get");
18
- const post_4 = require("./stores/post");
19
- const put_5 = require("./stores/put");
20
- const post_5 = require("./stripe/post");
21
- const put_6 = require("./users/put");
13
+ const post_3 = require("./discounts/post");
14
+ const put_3 = require("./discounts/put");
15
+ const put_4 = require("./products/put");
16
+ const get_6 = require("./sections/get");
17
+ const delete_2 = require("./staff/delete");
18
+ const get_7 = require("./staff/get");
19
+ const post_4 = require("./staff/post");
20
+ const put_5 = require("./staff/put");
21
+ const get_8 = require("./stores/get");
22
+ const post_5 = require("./stores/post");
23
+ const put_6 = require("./stores/put");
24
+ const post_6 = require("./stripe/post");
25
+ const put_7 = require("./users/put");
22
26
  const WashdayClient = function WashdayClient(apiToken) {
23
27
  this.apiToken = apiToken;
24
28
  WashdayClient.prototype.customers.apiToken = apiToken;
@@ -32,64 +36,73 @@ const WashdayClient = function WashdayClient(apiToken) {
32
36
  WashdayClient.prototype.cashierboxes.apiToken = apiToken;
33
37
  WashdayClient.prototype.discountCodes.apiToken = apiToken;
34
38
  WashdayClient.prototype.automaticDiscount.apiToken = apiToken;
39
+ WashdayClient.prototype.sections.apiToken = apiToken;
40
+ };
41
+ WashdayClient.prototype.sections = {
42
+ getSections: get_6.getSections,
35
43
  };
36
44
  WashdayClient.prototype.customers = {
37
45
  getCustomerById: get_4.getCustomerById,
38
46
  getCustomerHighlightsById: get_4.getCustomerHighlightsById
39
47
  };
40
48
  WashdayClient.prototype.stores = {
41
- getStores: get_7.getStores,
42
- getStoreById: get_7.getStoreById,
43
- createStore: post_4.createStore,
44
- copyStore: post_4.copyStore,
45
- updateStoreById: put_5.updateStoreById,
46
- createStoreImage: post_4.createStoreImage,
47
- getStoreReviewLink: get_7.getStoreReviewLink,
48
- deleteStoreById: put_5.deleteStoreById,
49
+ getStores: get_8.getStores,
50
+ getStoreById: get_8.getStoreById,
51
+ createStore: post_5.createStore,
52
+ copyStore: post_5.copyStore,
53
+ updateStoreById: put_6.updateStoreById,
54
+ createStoreImage: post_5.createStoreImage,
55
+ getStoreReviewLink: get_8.getStoreReviewLink,
56
+ deleteStoreById: put_6.deleteStoreById,
49
57
  };
50
58
  WashdayClient.prototype.products = {
51
- bulkUpdate: put_3.bulkUpdate,
59
+ bulkUpdate: put_4.bulkUpdate,
52
60
  };
53
61
  WashdayClient.prototype.users = {
54
- updateUserById: put_6.updateUserById,
62
+ updateUserById: put_7.updateUserById,
55
63
  };
56
64
  WashdayClient.prototype.countries = {
57
65
  getCountries: get_3.getCountries,
58
66
  };
59
67
  WashdayClient.prototype.cashierboxes = {
60
68
  getCashierboxesByStoreId: get_1.getCashierboxesByStoreId,
69
+ getCashierboxesById: get_1.getCashierboxesById,
70
+ createCashierBox: post_1.createCashierBox,
71
+ updateCashierBoxById: put_1.updateCashierBoxById,
72
+ deleteCashierBoxById: delete_1.deleteCashierBoxById,
73
+ addCashierBoxMovement: post_1.addCashierBoxMovement,
61
74
  };
62
75
  WashdayClient.prototype.companies = {
63
76
  getCompanyById: get_2.getCompanyById,
64
- updateCompanyById: put_1.updateCompanyById,
65
- updateCompanyLogoById: put_1.updateCompanyLogoById,
66
- updateCompanyTaxInfoById: put_1.updateCompanyTaxInfoById,
67
- updateCompanyTaxInfoCertificates: post_1.updateCompanyTaxInfoCertificates,
68
- updateCFDIOrgLogo: post_1.updateCFDIOrgLogo
77
+ updateCompanyById: put_2.updateCompanyById,
78
+ updateCompanyLogoById: put_2.updateCompanyLogoById,
79
+ updateCompanyTaxInfoById: put_2.updateCompanyTaxInfoById,
80
+ updateCompanyTaxInfoCertificates: post_2.updateCompanyTaxInfoCertificates,
81
+ updateCFDIOrgLogo: post_2.updateCFDIOrgLogo
69
82
  };
70
83
  WashdayClient.prototype.stripe = {
71
- createCreateSuscriptionCheckoutSession: post_5.createCreateSuscriptionCheckoutSession,
72
- createCFDISuscrptionCheckoutSession: post_5.createCFDISuscrptionCheckoutSession,
73
- createCustomerPortalSession: post_5.createCustomerPortalSession
84
+ createCreateSuscriptionCheckoutSession: post_6.createCreateSuscriptionCheckoutSession,
85
+ createCFDISuscrptionCheckoutSession: post_6.createCFDISuscrptionCheckoutSession,
86
+ createCustomerPortalSession: post_6.createCustomerPortalSession
74
87
  };
75
88
  WashdayClient.prototype.staff = {
76
- getStoreStaff: get_6.getStoreStaff,
77
- getStoreStaffById: get_6.getStoreStaffById,
78
- updateStoreStaffById: put_4.updateStoreStaffById,
79
- createStoreStaff: post_3.createStoreStaff,
80
- deleteStoreStaffById: delete_1.deleteStoreStaffById,
89
+ getStoreStaff: get_7.getStoreStaff,
90
+ getStoreStaffById: get_7.getStoreStaffById,
91
+ updateStoreStaffById: put_5.updateStoreStaffById,
92
+ createStoreStaff: post_4.createStoreStaff,
93
+ deleteStoreStaffById: delete_2.deleteStoreStaffById,
81
94
  };
82
95
  WashdayClient.prototype.discountCodes = {
83
96
  getDiscountCodes: get_5.getDiscountCodes,
84
97
  getDiscountCodeById: get_5.getDiscountCodeById,
85
98
  verifyDiscountCode: get_5.verifyDiscountCode,
86
- createDiscountCode: post_2.createDiscountCode,
87
- deleteDiscountCodeById: put_2.deleteDiscountCodeById,
99
+ createDiscountCode: post_3.createDiscountCode,
100
+ deleteDiscountCodeById: put_3.deleteDiscountCodeById,
88
101
  };
89
102
  WashdayClient.prototype.automaticDiscount = {
90
103
  getAutomaticDiscounts: get_5.getAutomaticDiscounts,
91
104
  getAutomaticDiscountById: get_5.getAutomaticDiscountById,
92
- createAutomaticDiscount: post_2.createAutomaticDiscount,
93
- deleteAutomaticDiscountById: put_2.deleteAutomaticDiscountById,
105
+ createAutomaticDiscount: post_3.createAutomaticDiscount,
106
+ deleteAutomaticDiscountById: put_3.deleteAutomaticDiscountById,
94
107
  };
95
108
  exports.default = WashdayClient;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ // import { WashdayClientInstance } from "../../interfaces/Api";
3
+ // import axiosInstance from "../axiosInstance";
4
+ // const GET_SET_STAFF = (storeId: string) => `api/store/${storeId}/staff`;
5
+ // export const deleteStoreStaffById = async function (this: WashdayClientInstance, storeId: string, staffId: string): Promise<any> {
6
+ // try {
7
+ // const config = {
8
+ // headers: { Authorization: `Bearer ${this.apiToken}` }
9
+ // };
10
+ // const response = await axiosInstance.delete(`${GET_SET_STAFF(storeId)}/${staffId}`, config);
11
+ // return response;
12
+ // } catch (error) {
13
+ // console.error('Error fetching getStoreStaff:', error);
14
+ // throw error;
15
+ // }
16
+ // };
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.getSections = void 0;
16
+ const axiosInstance_1 = __importDefault(require("../axiosInstance"));
17
+ const GET_SET_SECTIONS = 'api/section';
18
+ const getSections = function (params) {
19
+ return __awaiter(this, void 0, void 0, function* () {
20
+ try {
21
+ const config = {
22
+ headers: { Authorization: `Bearer ${this.apiToken}` }
23
+ };
24
+ let queryParams = '';
25
+ if (params === null || params === void 0 ? void 0 : params.hasOwnProperty('storeId')) {
26
+ queryParams += `store=${params === null || params === void 0 ? void 0 : params.storeId}`;
27
+ }
28
+ if (params === null || params === void 0 ? void 0 : params.hasOwnProperty('isActive')) {
29
+ queryParams += `&isActive=${params === null || params === void 0 ? void 0 : params.isActive}`;
30
+ }
31
+ else {
32
+ queryParams += `&isActive=true`;
33
+ }
34
+ if (params === null || params === void 0 ? void 0 : params.hasOwnProperty('products')) {
35
+ queryParams += `&products=${params === null || params === void 0 ? void 0 : params.products}`;
36
+ }
37
+ return yield axiosInstance_1.default.get(`${GET_SET_SECTIONS}?${queryParams}`, config);
38
+ }
39
+ catch (error) {
40
+ console.error('Error fetching getStoreStaff:', error);
41
+ throw error;
42
+ }
43
+ });
44
+ };
45
+ exports.getSections = getSections;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ // import { WashdayClientInstance } from "../../interfaces/Api";
3
+ // import axiosInstance from "../axiosInstance";
4
+ // const GET_SET_STAFF = (storeId: string) => `api/store/${storeId}/staff`;
5
+ // export const createStoreStaff = async function (this: WashdayClientInstance, storeId: string, data: any): Promise<any> {
6
+ // try {
7
+ // const config = {
8
+ // headers: { Authorization: `Bearer ${this.apiToken}` }
9
+ // };
10
+ // const response = await axiosInstance.post(`${GET_SET_STAFF(storeId)}`, data, config);
11
+ // return response;
12
+ // } catch (error) {
13
+ // console.error('Error fetching createStoreImage:', error);
14
+ // throw error;
15
+ // }
16
+ // };
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ // import { WashdayClientInstance } from "../../interfaces/Api";
3
+ // import { IStore } from "../../interfaces/Store";
4
+ // import axiosInstance from "../axiosInstance";
5
+ // export const updateStoreStaffById = async function (this: WashdayClientInstance, storeId: string, staffId: string, data: IStore): Promise<any> {
6
+ // try {
7
+ // const config = {
8
+ // headers: { Authorization: `Bearer ${this.apiToken}` }
9
+ // };
10
+ // const response = await axiosInstance.put(`api/store/${storeId}/staff/${staffId}`, data, config);
11
+ // return response;
12
+ // } catch (error) {
13
+ // console.error('Error fetching getStoreById:', error);
14
+ // throw error;
15
+ // }
16
+ // };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "washday-sdk",
3
- "version": "0.0.60",
3
+ "version": "0.0.62",
4
4
  "description": "Washday utilities functions and API",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -1,15 +1,15 @@
1
- // import { WashdayClientInstance } from "../../interfaces/Api";
2
- // import axiosInstance from "../axiosInstance";
1
+ import { WashdayClientInstance } from "../../interfaces/Api";
2
+ import axiosInstance from "../axiosInstance";
3
+ const GET_SET_CASHIER_BOX = (storeId: string) => `api/store/${storeId}/cashierbox`;
3
4
 
4
- // export const deleteStoreStaffById = async function (this: WashdayClientInstance, storeId: string, staffId: string): Promise<any> {
5
- // try {
6
- // const config = {
7
- // headers: { Authorization: `Bearer ${this.apiToken}` }
8
- // };
9
- // const response = await axiosInstance.delete(`api/store/${storeId}/staff/${staffId}`, config);
10
- // return response;
11
- // } catch (error) {
12
- // console.error('Error fetching getStoreStaff:', error);
13
- // throw error;
14
- // }
15
- // };
5
+ export const deleteCashierBoxById = 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_SET_CASHIER_BOX(storeId)}/${id}`, config);
11
+ } catch (error) {
12
+ console.error('Error fetching getStoreStaff:', error);
13
+ throw error;
14
+ }
15
+ };
@@ -1,8 +1,7 @@
1
1
  import { WashdayClientInstance } from "../../interfaces/Api";
2
2
  import axiosInstance from "../axiosInstance";
3
- import { IStore } from "../../interfaces/Store";
4
3
 
5
- export const GET_SET_CASHIER_BOX = (storeId: string) => `api/store/${storeId}/cashierbox`;
4
+ const GET_SET_CASHIER_BOX = (storeId: string) => `api/store/${storeId}/cashierbox`;
6
5
 
7
6
  export const getCashierboxesByStoreId = async function (this: WashdayClientInstance, storeId: string, queryParams?: string): Promise<any> {
8
7
  try {
@@ -12,7 +11,21 @@ export const getCashierboxesByStoreId = async function (this: WashdayClientInsta
12
11
  const response = await axiosInstance.get(`${GET_SET_CASHIER_BOX(storeId)}?${queryParams}`, config);
13
12
  return response;
14
13
  } catch (error) {
15
- console.error('Error fetching getStoreStaff:', error);
14
+ console.error('Error fetching getCashierboxesByStoreId:', error);
15
+ throw error;
16
+ }
17
+ };
18
+
19
+
20
+ export const getCashierboxesById = async function (this: WashdayClientInstance, storeId: string, id: string, queryParams?: string): Promise<any> {
21
+ try {
22
+ const config = {
23
+ headers: { Authorization: `Bearer ${this.apiToken}` }
24
+ };
25
+ const response = await axiosInstance.get(`${GET_SET_CASHIER_BOX(storeId)}/${id}?${queryParams}`, config);
26
+ return response;
27
+ } catch (error) {
28
+ console.error('Error fetching getCashierboxesById:', error);
16
29
  throw error;
17
30
  }
18
31
  };
@@ -1,17 +1,38 @@
1
- // import { WashdayClientInstance } from "../../interfaces/Api";
2
- // import axiosInstance from "../axiosInstance";
1
+ import { WashdayClientInstance } from "../../interfaces/Api";
2
+ import axiosInstance from "../axiosInstance";
3
3
 
4
- // const GET_SET_STORES = 'api/store';
4
+ const GET_SET_CASHIER_BOX = (storeId: string) => `api/store/${storeId}/cashierbox`;
5
5
 
6
- // export const createStoreStaff = async function (this: WashdayClientInstance, storeId: string, data: any): Promise<any> {
7
- // try {
8
- // const config = {
9
- // headers: { Authorization: `Bearer ${this.apiToken}` }
10
- // };
11
- // const response = await axiosInstance.post(`api/store/${storeId}/staff`, data, config);
12
- // return response;
13
- // } catch (error) {
14
- // console.error('Error fetching createStoreImage:', error);
15
- // throw error;
16
- // }
17
- // };
6
+ export const createCashierBox = async function (this: WashdayClientInstance, storeId: string, data: {
7
+ name: string
8
+ }): Promise<any> {
9
+ try {
10
+ const config = {
11
+ headers: { Authorization: `Bearer ${this.apiToken}` }
12
+ };
13
+ const response = await axiosInstance.post(`${GET_SET_CASHIER_BOX(storeId)}`, data, config);
14
+ return response;
15
+ } catch (error) {
16
+ console.error('Error fetching getStoreStaff:', error);
17
+ throw error;
18
+ }
19
+ };
20
+
21
+ export const addCashierBoxMovement = async function (this: WashdayClientInstance, storeId: string, id: string, data: {
22
+ type: string;
23
+ date: Date;
24
+ amount: number,
25
+ notes?: string;
26
+ paymentMethod: string;
27
+ }): Promise<any> {
28
+ try {
29
+ const config = {
30
+ headers: { Authorization: `Bearer ${this.apiToken}` }
31
+ };
32
+ const response = await axiosInstance.post(`${GET_SET_CASHIER_BOX(storeId)}/${id}/add-movement`, data, config);
33
+ return response;
34
+ } catch (error) {
35
+ console.error('Error fetching createStoreImage:', error);
36
+ throw error;
37
+ }
38
+ };
@@ -1,16 +1,17 @@
1
- // import { WashdayClientInstance } from "../../interfaces/Api";
2
- // import { IStore } from "../../interfaces/Store";
3
- // import axiosInstance from "../axiosInstance";
1
+ import { WashdayClientInstance } from "../../interfaces/Api";
2
+ import axiosInstance from "../axiosInstance";
4
3
 
5
- // export const updateStoreStaffById = async function (this: WashdayClientInstance, storeId: string, data: IStore): Promise<any> {
6
- // try {
7
- // const config = {
8
- // headers: { Authorization: `Bearer ${this.apiToken}` }
9
- // };
10
- // const response = await axiosInstance.put(`api/store/${storeId}/staff`, data, config);
11
- // return response;
12
- // } catch (error) {
13
- // console.error('Error fetching getStoreById:', error);
14
- // throw error;
15
- // }
16
- // };
4
+ const GET_SET_CASHIER_BOX = (storeId: string) => `api/store/${storeId}/cashierbox`;
5
+
6
+ export const updateCashierBoxById = async function (this: WashdayClientInstance, storeId: string, id: string, data: { name: string }): Promise<any> {
7
+ try {
8
+ const config = {
9
+ headers: { Authorization: `Bearer ${this.apiToken}` }
10
+ };
11
+ const response = await axiosInstance.put(`${GET_SET_CASHIER_BOX(storeId)}/${id}`, data, config);
12
+ return response;
13
+ } catch (error) {
14
+ console.error('Error fetching getStoreById:', error);
15
+ throw error;
16
+ }
17
+ };
package/src/api/index.ts CHANGED
@@ -1,5 +1,8 @@
1
1
  import { WashdayClientInstance } from "../interfaces/Api";
2
- import { getCashierboxesByStoreId } from "./cashierbox/get";
2
+ import { deleteCashierBoxById } from "./cashierbox/delete";
3
+ import { getCashierboxesById, getCashierboxesByStoreId } from "./cashierbox/get";
4
+ import { addCashierBoxMovement, createCashierBox } from "./cashierbox/post";
5
+ import { updateCashierBoxById } from "./cashierbox/put";
3
6
  import { getCompanyById } from "./companies/get";
4
7
  import { updateCFDIOrgLogo, updateCompanyTaxInfoCertificates } from "./companies/post";
5
8
  import { updateCompanyById, updateCompanyLogoById, updateCompanyTaxInfoById } from "./companies/put";
@@ -9,6 +12,7 @@ import { getAutomaticDiscountById, getAutomaticDiscounts, getDiscountCodeById, g
9
12
  import { createAutomaticDiscount, createDiscountCode } from "./discounts/post";
10
13
  import { deleteAutomaticDiscountById, deleteDiscountCodeById } from "./discounts/put";
11
14
  import { bulkUpdate } from "./products/put";
15
+ import { getSections } from "./sections/get";
12
16
  import { deleteStoreStaffById } from "./staff/delete";
13
17
  import { getStoreStaff, getStoreStaffById } from "./staff/get";
14
18
  import { createStoreStaff } from "./staff/post";
@@ -38,8 +42,13 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
38
42
  WashdayClient.prototype.cashierboxes.apiToken = apiToken;
39
43
  WashdayClient.prototype.discountCodes.apiToken = apiToken;
40
44
  WashdayClient.prototype.automaticDiscount.apiToken = apiToken;
45
+ WashdayClient.prototype.sections.apiToken = apiToken;
41
46
  } as any;
42
47
 
48
+ WashdayClient.prototype.sections = {
49
+ getSections: getSections,
50
+ };
51
+
43
52
  WashdayClient.prototype.customers = {
44
53
  getCustomerById: getCustomerById,
45
54
  getCustomerHighlightsById: getCustomerHighlightsById
@@ -71,6 +80,11 @@ WashdayClient.prototype.countries = {
71
80
 
72
81
  WashdayClient.prototype.cashierboxes = {
73
82
  getCashierboxesByStoreId: getCashierboxesByStoreId,
83
+ getCashierboxesById: getCashierboxesById,
84
+ createCashierBox: createCashierBox,
85
+ updateCashierBoxById: updateCashierBoxById,
86
+ deleteCashierBoxById: deleteCashierBoxById,
87
+ addCashierBoxMovement: addCashierBoxMovement,
74
88
  };
75
89
 
76
90
  WashdayClient.prototype.companies = {
@@ -0,0 +1,16 @@
1
+ // import { WashdayClientInstance } from "../../interfaces/Api";
2
+ // import axiosInstance from "../axiosInstance";
3
+ // const GET_SET_STAFF = (storeId: string) => `api/store/${storeId}/staff`;
4
+
5
+ // export const deleteStoreStaffById = async function (this: WashdayClientInstance, storeId: string, staffId: string): Promise<any> {
6
+ // try {
7
+ // const config = {
8
+ // headers: { Authorization: `Bearer ${this.apiToken}` }
9
+ // };
10
+ // const response = await axiosInstance.delete(`${GET_SET_STAFF(storeId)}/${staffId}`, config);
11
+ // return response;
12
+ // } catch (error) {
13
+ // console.error('Error fetching getStoreStaff:', error);
14
+ // throw error;
15
+ // }
16
+ // };
@@ -0,0 +1,33 @@
1
+ import { WashdayClientInstance } from "../../interfaces/Api";
2
+ import axiosInstance from "../axiosInstance";
3
+
4
+ const GET_SET_SECTIONS = 'api/section';
5
+
6
+ export const getSections = async function (this: WashdayClientInstance, params?: {
7
+ storeId?: string
8
+ isActive?: string
9
+ products?: boolean
10
+ }): Promise<any> {
11
+ try {
12
+ const config = {
13
+ headers: { Authorization: `Bearer ${this.apiToken}` }
14
+ };
15
+ let queryParams = '';
16
+ if (params?.hasOwnProperty('storeId')) {
17
+ queryParams += `store=${params?.storeId}`
18
+ }
19
+ if (params?.hasOwnProperty('isActive')) {
20
+ queryParams += `&isActive=${params?.isActive}`
21
+ } else {
22
+ queryParams += `&isActive=true`
23
+ }
24
+ if (params?.hasOwnProperty('products')) {
25
+ queryParams += `&products=${params?.products}`
26
+ }
27
+
28
+ return await axiosInstance.get(`${GET_SET_SECTIONS}?${queryParams}`, config);
29
+ } catch (error) {
30
+ console.error('Error fetching getStoreStaff:', error);
31
+ throw error;
32
+ }
33
+ };
@@ -0,0 +1,17 @@
1
+ // import { WashdayClientInstance } from "../../interfaces/Api";
2
+ // import axiosInstance from "../axiosInstance";
3
+
4
+ // const GET_SET_STAFF = (storeId: string) => `api/store/${storeId}/staff`;
5
+
6
+ // export const createStoreStaff = async function (this: WashdayClientInstance, storeId: string, data: any): Promise<any> {
7
+ // try {
8
+ // const config = {
9
+ // headers: { Authorization: `Bearer ${this.apiToken}` }
10
+ // };
11
+ // const response = await axiosInstance.post(`${GET_SET_STAFF(storeId)}`, data, config);
12
+ // return response;
13
+ // } catch (error) {
14
+ // console.error('Error fetching createStoreImage:', error);
15
+ // throw error;
16
+ // }
17
+ // };
@@ -0,0 +1,16 @@
1
+ // import { WashdayClientInstance } from "../../interfaces/Api";
2
+ // import { IStore } from "../../interfaces/Store";
3
+ // import axiosInstance from "../axiosInstance";
4
+
5
+ // export const updateStoreStaffById = async function (this: WashdayClientInstance, storeId: string, staffId: string, data: IStore): Promise<any> {
6
+ // try {
7
+ // const config = {
8
+ // headers: { Authorization: `Bearer ${this.apiToken}` }
9
+ // };
10
+ // const response = await axiosInstance.put(`api/store/${storeId}/staff/${staffId}`, data, config);
11
+ // return response;
12
+ // } catch (error) {
13
+ // console.error('Error fetching getStoreById:', error);
14
+ // throw error;
15
+ // }
16
+ // };