washday-sdk 0.0.42 → 0.0.44
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/countries/get.js +36 -0
- package/dist/api/countries/post.js +1 -0
- package/dist/api/countries/put.js +1 -0
- package/dist/api/index.js +13 -7
- package/dist/api/stores/get.js +17 -1
- package/package.json +1 -1
- package/src/api/countries/get.ts +23 -0
- package/src/api/countries/post.ts +0 -0
- package/src/api/countries/put.ts +0 -0
- package/src/api/index.ts +9 -2
- package/src/api/stores/get.ts +13 -0
- package/src/api/users/put.ts +19 -12
|
@@ -0,0 +1,36 @@
|
|
|
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.getCountries = void 0;
|
|
16
|
+
const axiosInstance_1 = __importDefault(require("../axiosInstance"));
|
|
17
|
+
const GET_SET_COUNTRIES = 'api/country';
|
|
18
|
+
const REQUEST_PARAMS = {
|
|
19
|
+
token: 'LOGGED_USER_TOKEN',
|
|
20
|
+
};
|
|
21
|
+
const getCountries = function () {
|
|
22
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
+
try {
|
|
24
|
+
const config = {
|
|
25
|
+
headers: { Authorization: '' }
|
|
26
|
+
};
|
|
27
|
+
const response = yield axiosInstance_1.default.get(`${GET_SET_COUNTRIES}`, config);
|
|
28
|
+
return response;
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
console.error('Error fetching getCountries:', error);
|
|
32
|
+
throw error;
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
exports.getCountries = getCountries;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
package/dist/api/index.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const get_1 = require("./
|
|
3
|
+
const get_1 = require("./countries/get");
|
|
4
|
+
const get_2 = require("./customers/get");
|
|
4
5
|
const put_1 = require("./products/put");
|
|
5
|
-
const
|
|
6
|
+
const get_3 = require("./stores/get");
|
|
6
7
|
const post_1 = require("./stores/post");
|
|
7
8
|
const put_2 = require("./stores/put");
|
|
8
9
|
const put_3 = require("./users/put");
|
|
@@ -12,16 +13,18 @@ const WashdayClient = function WashdayClient(apiToken) {
|
|
|
12
13
|
WashdayClient.prototype.stores.apiToken = apiToken;
|
|
13
14
|
WashdayClient.prototype.products.apiToken = apiToken;
|
|
14
15
|
WashdayClient.prototype.users.apiToken = apiToken;
|
|
16
|
+
WashdayClient.prototype.countries.apiToken = apiToken;
|
|
15
17
|
};
|
|
16
18
|
WashdayClient.prototype.customers = {
|
|
17
|
-
getCustomerById:
|
|
18
|
-
getCustomerHighlightsById:
|
|
19
|
+
getCustomerById: get_2.getCustomerById,
|
|
20
|
+
getCustomerHighlightsById: get_2.getCustomerHighlightsById
|
|
19
21
|
};
|
|
20
22
|
WashdayClient.prototype.stores = {
|
|
21
|
-
getStores:
|
|
22
|
-
getStoreById:
|
|
23
|
+
getStores: get_3.getStores,
|
|
24
|
+
getStoreById: get_3.getStoreById,
|
|
23
25
|
updateStoreById: put_2.updateStoreById,
|
|
24
|
-
createStoreImage: post_1.createStoreImage
|
|
26
|
+
createStoreImage: post_1.createStoreImage,
|
|
27
|
+
getStoreReviewLink: get_3.getStoreReviewLink
|
|
25
28
|
};
|
|
26
29
|
WashdayClient.prototype.products = {
|
|
27
30
|
bulkUpdate: put_1.bulkUpdate,
|
|
@@ -29,4 +32,7 @@ WashdayClient.prototype.products = {
|
|
|
29
32
|
WashdayClient.prototype.users = {
|
|
30
33
|
updateUserById: put_3.updateUserById,
|
|
31
34
|
};
|
|
35
|
+
WashdayClient.prototype.countries = {
|
|
36
|
+
getCountries: get_1.getCountries,
|
|
37
|
+
};
|
|
32
38
|
exports.default = WashdayClient;
|
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/package.json
CHANGED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { WashdayClientInstance } from "../../interfaces/Api";
|
|
2
|
+
import { ICustomer } from "../../interfaces/Customer";
|
|
3
|
+
import { IOrderInfo } from "../../interfaces/Order";
|
|
4
|
+
import axiosInstance from "../axiosInstance";
|
|
5
|
+
|
|
6
|
+
const GET_SET_COUNTRIES = 'api/country';
|
|
7
|
+
const REQUEST_PARAMS = {
|
|
8
|
+
token: 'LOGGED_USER_TOKEN',
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
export const getCountries = async function (this: WashdayClientInstance): Promise<any> {
|
|
13
|
+
try {
|
|
14
|
+
const config = {
|
|
15
|
+
headers: { Authorization: '' }
|
|
16
|
+
};
|
|
17
|
+
const response = await axiosInstance.get(`${GET_SET_COUNTRIES}`, config);
|
|
18
|
+
return response;
|
|
19
|
+
} catch (error) {
|
|
20
|
+
console.error('Error fetching getCountries:', error);
|
|
21
|
+
throw error;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
File without changes
|
|
File without changes
|
package/src/api/index.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { WashdayClientInstance } from "../interfaces/Api";
|
|
2
|
+
import { getCountries } from "./countries/get";
|
|
2
3
|
import { getCustomerById, getCustomerHighlightsById } from "./customers/get";
|
|
3
4
|
import { bulkUpdate } from "./products/put";
|
|
4
|
-
import { getStoreById, getStores } from "./stores/get";
|
|
5
|
+
import { getStoreById, getStoreReviewLink, getStores } from "./stores/get";
|
|
5
6
|
import { createStoreImage } from "./stores/post";
|
|
6
7
|
import { updateStoreById } from "./stores/put";
|
|
7
8
|
import { updateUserById } from "./users/put";
|
|
@@ -18,6 +19,7 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
|
|
|
18
19
|
WashdayClient.prototype.stores.apiToken = apiToken;
|
|
19
20
|
WashdayClient.prototype.products.apiToken = apiToken;
|
|
20
21
|
WashdayClient.prototype.users.apiToken = apiToken;
|
|
22
|
+
WashdayClient.prototype.countries.apiToken = apiToken;
|
|
21
23
|
} as any;
|
|
22
24
|
|
|
23
25
|
WashdayClient.prototype.customers = {
|
|
@@ -29,7 +31,8 @@ WashdayClient.prototype.stores = {
|
|
|
29
31
|
getStores: getStores,
|
|
30
32
|
getStoreById: getStoreById,
|
|
31
33
|
updateStoreById: updateStoreById,
|
|
32
|
-
createStoreImage: createStoreImage
|
|
34
|
+
createStoreImage: createStoreImage,
|
|
35
|
+
getStoreReviewLink: getStoreReviewLink
|
|
33
36
|
};
|
|
34
37
|
|
|
35
38
|
|
|
@@ -41,4 +44,8 @@ WashdayClient.prototype.users = {
|
|
|
41
44
|
updateUserById: updateUserById,
|
|
42
45
|
};
|
|
43
46
|
|
|
47
|
+
WashdayClient.prototype.countries = {
|
|
48
|
+
getCountries: getCountries,
|
|
49
|
+
};
|
|
50
|
+
|
|
44
51
|
export default WashdayClient;
|
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
|
@@ -4,19 +4,26 @@ import { IUser } from "../../interfaces/User";
|
|
|
4
4
|
import axiosInstance from "../axiosInstance";
|
|
5
5
|
const GET_SET_USER = 'api/user';
|
|
6
6
|
const REQUEST_PARAMS = {
|
|
7
|
-
|
|
7
|
+
token: 'LOGGED_USER_TOKEN',
|
|
8
8
|
};
|
|
9
9
|
|
|
10
|
+
interface userDTO {
|
|
11
|
+
printer?: {
|
|
12
|
+
name: string,
|
|
13
|
+
paperSize: string
|
|
14
|
+
}
|
|
15
|
+
freshChatRestoreID?: string
|
|
16
|
+
}
|
|
10
17
|
|
|
11
|
-
export const updateUserById = async function (this: WashdayClientInstance, userId: string, data:
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
+
}
|
|
22
29
|
};
|