washday-sdk 0.0.41 → 0.0.43
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 +2 -1
- package/dist/api/stores/get.js +17 -1
- package/dist/api/users/put.js +1 -1
- package/package.json +1 -1
- package/src/api/index.ts +3 -2
- package/src/api/products/put.ts +1 -1
- package/src/api/stores/get.ts +13 -0
- package/src/api/users/put.ts +20 -12
package/dist/api/index.js
CHANGED
|
@@ -21,7 +21,8 @@ WashdayClient.prototype.stores = {
|
|
|
21
21
|
getStores: get_2.getStores,
|
|
22
22
|
getStoreById: get_2.getStoreById,
|
|
23
23
|
updateStoreById: put_2.updateStoreById,
|
|
24
|
-
createStoreImage: post_1.createStoreImage
|
|
24
|
+
createStoreImage: post_1.createStoreImage,
|
|
25
|
+
getStoreReviewLink: get_2.getStoreReviewLink
|
|
25
26
|
};
|
|
26
27
|
WashdayClient.prototype.products = {
|
|
27
28
|
bulkUpdate: put_1.bulkUpdate,
|
package/dist/api/stores/get.js
CHANGED
|
@@ -12,7 +12,7 @@ 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.getStoreById = exports.getStores = void 0;
|
|
15
|
+
exports.getStoreById = exports.getStoreReviewLink = exports.getStores = void 0;
|
|
16
16
|
const axiosInstance_1 = __importDefault(require("../axiosInstance"));
|
|
17
17
|
const GET_SET_STORES = 'api/store';
|
|
18
18
|
const REQUEST_PARAMS = {
|
|
@@ -37,6 +37,22 @@ const getStores = function (params) {
|
|
|
37
37
|
});
|
|
38
38
|
};
|
|
39
39
|
exports.getStores = getStores;
|
|
40
|
+
const getStoreReviewLink = function (storeId) {
|
|
41
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
42
|
+
try {
|
|
43
|
+
const config = {
|
|
44
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
45
|
+
};
|
|
46
|
+
const response = yield axiosInstance_1.default.get(`${GET_SET_STORES}/review-link/${storeId}`, config);
|
|
47
|
+
return response;
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
console.error('Error fetching getStoreReviewLink:', error);
|
|
51
|
+
throw error;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
exports.getStoreReviewLink = getStoreReviewLink;
|
|
40
56
|
const getStoreById = function (storeId) {
|
|
41
57
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42
58
|
var _a;
|
package/dist/api/users/put.js
CHANGED
|
@@ -22,7 +22,7 @@ const updateUserById = function (userId, data) {
|
|
|
22
22
|
return __awaiter(this, void 0, void 0, function* () {
|
|
23
23
|
try {
|
|
24
24
|
const config = {
|
|
25
|
-
headers: { Authorization: `Bearer ${this.apiToken}
|
|
25
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
26
26
|
};
|
|
27
27
|
const response = yield axiosInstance_1.default.put(`${GET_SET_USER}/${userId}`, data, config);
|
|
28
28
|
return response.data || {};
|
package/package.json
CHANGED
package/src/api/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { WashdayClientInstance } from "../interfaces/Api";
|
|
2
2
|
import { getCustomerById, getCustomerHighlightsById } from "./customers/get";
|
|
3
3
|
import { bulkUpdate } from "./products/put";
|
|
4
|
-
import { getStoreById, getStores } from "./stores/get";
|
|
4
|
+
import { getStoreById, getStoreReviewLink, getStores } from "./stores/get";
|
|
5
5
|
import { createStoreImage } from "./stores/post";
|
|
6
6
|
import { updateStoreById } from "./stores/put";
|
|
7
7
|
import { updateUserById } from "./users/put";
|
|
@@ -29,7 +29,8 @@ WashdayClient.prototype.stores = {
|
|
|
29
29
|
getStores: getStores,
|
|
30
30
|
getStoreById: getStoreById,
|
|
31
31
|
updateStoreById: updateStoreById,
|
|
32
|
-
createStoreImage: createStoreImage
|
|
32
|
+
createStoreImage: createStoreImage,
|
|
33
|
+
getStoreReviewLink: getStoreReviewLink
|
|
33
34
|
};
|
|
34
35
|
|
|
35
36
|
|
package/src/api/products/put.ts
CHANGED
|
@@ -7,7 +7,7 @@ const REQUEST_PARAMS = {
|
|
|
7
7
|
};
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
export const bulkUpdate = async function (this: WashdayClientInstance, storeId: string, data:
|
|
10
|
+
export const bulkUpdate = async function (this: WashdayClientInstance, storeId: string, data: any): Promise<any> {
|
|
11
11
|
try {
|
|
12
12
|
const config = {
|
|
13
13
|
headers: { Authorization: `Bearer ${this.apiToken}`, 'Content-Type': false }
|
package/src/api/stores/get.ts
CHANGED
|
@@ -25,6 +25,19 @@ export const getStores = async function (this: WashdayClientInstance, params: {
|
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
|
|
28
|
+
export const getStoreReviewLink = async function (this: WashdayClientInstance, storeId: string): Promise<any> {
|
|
29
|
+
try {
|
|
30
|
+
const config = {
|
|
31
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
32
|
+
};
|
|
33
|
+
const response = await axiosInstance.get(`${GET_SET_STORES}/review-link/${storeId}`, config);
|
|
34
|
+
return response;
|
|
35
|
+
} catch (error) {
|
|
36
|
+
console.error('Error fetching getStoreReviewLink:', error);
|
|
37
|
+
throw error;
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
|
|
28
41
|
export const getStoreById = async function (this: WashdayClientInstance, storeId: string): Promise<{ store: IStore }> {
|
|
29
42
|
try {
|
|
30
43
|
REQUEST_PARAMS.token = this.apiToken;
|
package/src/api/users/put.ts
CHANGED
|
@@ -1,21 +1,29 @@
|
|
|
1
1
|
import { WashdayClientInstance } from "../../interfaces/Api";
|
|
2
2
|
import { IStore } from "../../interfaces/Store";
|
|
3
|
+
import { IUser } from "../../interfaces/User";
|
|
3
4
|
import axiosInstance from "../axiosInstance";
|
|
4
5
|
const GET_SET_USER = 'api/user';
|
|
5
6
|
const REQUEST_PARAMS = {
|
|
6
|
-
|
|
7
|
+
token: 'LOGGED_USER_TOKEN',
|
|
7
8
|
};
|
|
8
9
|
|
|
10
|
+
interface userDTO {
|
|
11
|
+
printer?: {
|
|
12
|
+
name: string,
|
|
13
|
+
paperSize: string
|
|
14
|
+
}
|
|
15
|
+
freshChatRestoreID?: string
|
|
16
|
+
}
|
|
9
17
|
|
|
10
|
-
export const updateUserById = async function (this: WashdayClientInstance, userId: string, data:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
export const updateUserById = async function (this: WashdayClientInstance, userId: string, data: userDTO): Promise<any> {
|
|
19
|
+
try {
|
|
20
|
+
const config = {
|
|
21
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
22
|
+
};
|
|
23
|
+
const response = await axiosInstance.put(`${GET_SET_USER}/${userId}`, data, config);
|
|
24
|
+
return response.data || {}
|
|
25
|
+
} catch (error) {
|
|
26
|
+
console.error('Error fetching updateUserById:', error);
|
|
27
|
+
throw error;
|
|
28
|
+
}
|
|
21
29
|
};
|