washday-sdk 0.0.60 → 0.0.61
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.
- package/dist/api/index.js +12 -7
- package/dist/api/sections/delete.js +16 -0
- package/dist/api/sections/get.js +45 -0
- package/dist/api/sections/post.js +16 -0
- package/dist/api/sections/put.js +16 -0
- package/package.json +1 -1
- package/src/api/index.ts +6 -0
- package/src/api/sections/delete.ts +16 -0
- package/src/api/sections/get.ts +33 -0
- package/src/api/sections/post.ts +17 -0
- package/src/api/sections/put.ts +16 -0
package/dist/api/index.js
CHANGED
|
@@ -10,11 +10,12 @@ const get_5 = require("./discounts/get");
|
|
|
10
10
|
const post_2 = require("./discounts/post");
|
|
11
11
|
const put_2 = require("./discounts/put");
|
|
12
12
|
const put_3 = require("./products/put");
|
|
13
|
+
const get_6 = require("./sections/get");
|
|
13
14
|
const delete_1 = require("./staff/delete");
|
|
14
|
-
const
|
|
15
|
+
const get_7 = require("./staff/get");
|
|
15
16
|
const post_3 = require("./staff/post");
|
|
16
17
|
const put_4 = require("./staff/put");
|
|
17
|
-
const
|
|
18
|
+
const get_8 = require("./stores/get");
|
|
18
19
|
const post_4 = require("./stores/post");
|
|
19
20
|
const put_5 = require("./stores/put");
|
|
20
21
|
const post_5 = require("./stripe/post");
|
|
@@ -32,19 +33,23 @@ const WashdayClient = function WashdayClient(apiToken) {
|
|
|
32
33
|
WashdayClient.prototype.cashierboxes.apiToken = apiToken;
|
|
33
34
|
WashdayClient.prototype.discountCodes.apiToken = apiToken;
|
|
34
35
|
WashdayClient.prototype.automaticDiscount.apiToken = apiToken;
|
|
36
|
+
WashdayClient.prototype.sections.apiToken = apiToken;
|
|
37
|
+
};
|
|
38
|
+
WashdayClient.prototype.sections = {
|
|
39
|
+
getSections: get_6.getSections,
|
|
35
40
|
};
|
|
36
41
|
WashdayClient.prototype.customers = {
|
|
37
42
|
getCustomerById: get_4.getCustomerById,
|
|
38
43
|
getCustomerHighlightsById: get_4.getCustomerHighlightsById
|
|
39
44
|
};
|
|
40
45
|
WashdayClient.prototype.stores = {
|
|
41
|
-
getStores:
|
|
42
|
-
getStoreById:
|
|
46
|
+
getStores: get_8.getStores,
|
|
47
|
+
getStoreById: get_8.getStoreById,
|
|
43
48
|
createStore: post_4.createStore,
|
|
44
49
|
copyStore: post_4.copyStore,
|
|
45
50
|
updateStoreById: put_5.updateStoreById,
|
|
46
51
|
createStoreImage: post_4.createStoreImage,
|
|
47
|
-
getStoreReviewLink:
|
|
52
|
+
getStoreReviewLink: get_8.getStoreReviewLink,
|
|
48
53
|
deleteStoreById: put_5.deleteStoreById,
|
|
49
54
|
};
|
|
50
55
|
WashdayClient.prototype.products = {
|
|
@@ -73,8 +78,8 @@ WashdayClient.prototype.stripe = {
|
|
|
73
78
|
createCustomerPortalSession: post_5.createCustomerPortalSession
|
|
74
79
|
};
|
|
75
80
|
WashdayClient.prototype.staff = {
|
|
76
|
-
getStoreStaff:
|
|
77
|
-
getStoreStaffById:
|
|
81
|
+
getStoreStaff: get_7.getStoreStaff,
|
|
82
|
+
getStoreStaffById: get_7.getStoreStaffById,
|
|
78
83
|
updateStoreStaffById: put_4.updateStoreStaffById,
|
|
79
84
|
createStoreStaff: post_3.createStoreStaff,
|
|
80
85
|
deleteStoreStaffById: delete_1.deleteStoreStaffById,
|
|
@@ -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
package/src/api/index.ts
CHANGED
|
@@ -9,6 +9,7 @@ import { getAutomaticDiscountById, getAutomaticDiscounts, getDiscountCodeById, g
|
|
|
9
9
|
import { createAutomaticDiscount, createDiscountCode } from "./discounts/post";
|
|
10
10
|
import { deleteAutomaticDiscountById, deleteDiscountCodeById } from "./discounts/put";
|
|
11
11
|
import { bulkUpdate } from "./products/put";
|
|
12
|
+
import { getSections } from "./sections/get";
|
|
12
13
|
import { deleteStoreStaffById } from "./staff/delete";
|
|
13
14
|
import { getStoreStaff, getStoreStaffById } from "./staff/get";
|
|
14
15
|
import { createStoreStaff } from "./staff/post";
|
|
@@ -38,8 +39,13 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
|
|
|
38
39
|
WashdayClient.prototype.cashierboxes.apiToken = apiToken;
|
|
39
40
|
WashdayClient.prototype.discountCodes.apiToken = apiToken;
|
|
40
41
|
WashdayClient.prototype.automaticDiscount.apiToken = apiToken;
|
|
42
|
+
WashdayClient.prototype.sections.apiToken = apiToken;
|
|
41
43
|
} as any;
|
|
42
44
|
|
|
45
|
+
WashdayClient.prototype.sections = {
|
|
46
|
+
getSections: getSections,
|
|
47
|
+
};
|
|
48
|
+
|
|
43
49
|
WashdayClient.prototype.customers = {
|
|
44
50
|
getCustomerById: getCustomerById,
|
|
45
51
|
getCustomerHighlightsById: getCustomerHighlightsById
|
|
@@ -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
|
+
// };
|