washday-sdk 0.0.103 → 0.0.105
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/csv/get.js +21 -0
- package/dist/api/index.js +4 -2
- package/dist/api/stores/get.js +17 -0
- package/package.json +1 -1
- package/src/api/csv/get.ts +19 -0
- package/src/api/index.ts +4 -2
- package/src/api/stores/get.ts +16 -0
- package/src/interfaces/Api.ts +2 -1
package/dist/api/csv/get.js
CHANGED
|
@@ -70,3 +70,24 @@ export const exportOrdersList = function (params) {
|
|
|
70
70
|
}
|
|
71
71
|
});
|
|
72
72
|
};
|
|
73
|
+
export const exportProductsList = function (storeId) {
|
|
74
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
75
|
+
try {
|
|
76
|
+
const config = {
|
|
77
|
+
headers: {
|
|
78
|
+
Authorization: `Bearer ${this.apiToken}`,
|
|
79
|
+
'Content-Type': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
80
|
+
'Content-disposition': 'attachment; filename=[file.csv]'
|
|
81
|
+
},
|
|
82
|
+
params: {
|
|
83
|
+
responseType: 'blob'
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
return yield axiosInstance.get(`api/product/${storeId}/export`, config);
|
|
87
|
+
}
|
|
88
|
+
catch (error) {
|
|
89
|
+
console.error('Error fetching exportProductsList:', error);
|
|
90
|
+
throw error;
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
};
|
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 } from "./stores/get";
|
|
16
|
+
import { getStoreById, getStoreImages, getStoreReviewLink, getStores, 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";
|
|
@@ -100,6 +100,7 @@ const WashdayClient = function WashdayClient(apiToken) {
|
|
|
100
100
|
getStores: getStores,
|
|
101
101
|
getStoreById: getStoreById,
|
|
102
102
|
getStoreImages: getStoreImages,
|
|
103
|
+
getStoresByName: getStoresByName,
|
|
103
104
|
createStore: createStore,
|
|
104
105
|
copyStore: copyStore,
|
|
105
106
|
updateStoreById: updateStoreById,
|
|
@@ -192,7 +193,8 @@ const WashdayClient = function WashdayClient(apiToken) {
|
|
|
192
193
|
});
|
|
193
194
|
this.csv = bindMethods(this, {
|
|
194
195
|
exportCustomersList: csvExportEndpoints.getModule.exportCustomersList,
|
|
195
|
-
exportOrdersList: csvExportEndpoints.getModule.exportOrdersList
|
|
196
|
+
exportOrdersList: csvExportEndpoints.getModule.exportOrdersList,
|
|
197
|
+
exportProductsList: csvExportEndpoints.getModule.exportProductsList
|
|
196
198
|
});
|
|
197
199
|
};
|
|
198
200
|
export default WashdayClient;
|
package/dist/api/stores/get.js
CHANGED
|
@@ -7,12 +7,14 @@ 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_STORES = 'api/store';
|
|
12
13
|
const GET_SET_STORE_IMAGE = 'api/store-image';
|
|
13
14
|
const REQUEST_PARAMS = {
|
|
14
15
|
token: 'LOGGED_USER_TOKEN',
|
|
15
16
|
};
|
|
17
|
+
const GET_STORES_WASHDAY_APP = 'api/v2/washdayapp/store';
|
|
16
18
|
export const getStores = function (params) {
|
|
17
19
|
return __awaiter(this, void 0, void 0, function* () {
|
|
18
20
|
var _a, _b;
|
|
@@ -75,3 +77,18 @@ export const getStoreImages = function (storeId) {
|
|
|
75
77
|
}
|
|
76
78
|
});
|
|
77
79
|
};
|
|
80
|
+
export const getStoresByName = function (query) {
|
|
81
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
82
|
+
var _a, _b;
|
|
83
|
+
try {
|
|
84
|
+
const config = {};
|
|
85
|
+
const queryParams = generateQueryParamsStr(['q'], query);
|
|
86
|
+
const response = yield axiosInstance.get(`${GET_STORES_WASHDAY_APP}?${queryParams}`, config);
|
|
87
|
+
return ((_b = (_a = response.data) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.stores) || [];
|
|
88
|
+
}
|
|
89
|
+
catch (error) {
|
|
90
|
+
console.error('Error fetching getStoresByName:', error);
|
|
91
|
+
throw error;
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
};
|
package/package.json
CHANGED
package/src/api/csv/get.ts
CHANGED
|
@@ -83,4 +83,23 @@ export const exportOrdersList = async function (this: WashdayClientInstance, par
|
|
|
83
83
|
console.error('Error fetching exportOrdersList:', error);
|
|
84
84
|
throw error;
|
|
85
85
|
}
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export const exportProductsList = async function (this: WashdayClientInstance, storeId: string): Promise<any> {
|
|
89
|
+
try {
|
|
90
|
+
const config = {
|
|
91
|
+
headers: {
|
|
92
|
+
Authorization: `Bearer ${this.apiToken}`,
|
|
93
|
+
'Content-Type': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
94
|
+
'Content-disposition': 'attachment; filename=[file.csv]'
|
|
95
|
+
},
|
|
96
|
+
params: {
|
|
97
|
+
responseType: 'blob'
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
return await axiosInstance.get(`api/product/${storeId}/export`, config);
|
|
101
|
+
} catch (error) {
|
|
102
|
+
console.error('Error fetching exportProductsList:', error);
|
|
103
|
+
throw error;
|
|
104
|
+
}
|
|
86
105
|
};
|
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 } from "./stores/get";
|
|
17
|
+
import { getStoreById, getStoreImages, getStoreReviewLink, getStores, 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";
|
|
@@ -106,6 +106,7 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
|
|
|
106
106
|
getStores: getStores,
|
|
107
107
|
getStoreById: getStoreById,
|
|
108
108
|
getStoreImages: getStoreImages,
|
|
109
|
+
getStoresByName: getStoresByName,
|
|
109
110
|
createStore: createStore,
|
|
110
111
|
copyStore: copyStore,
|
|
111
112
|
updateStoreById: updateStoreById,
|
|
@@ -198,7 +199,8 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
|
|
|
198
199
|
});
|
|
199
200
|
this.csv = bindMethods(this, {
|
|
200
201
|
exportCustomersList: csvExportEndpoints.getModule.exportCustomersList,
|
|
201
|
-
exportOrdersList: csvExportEndpoints.getModule.exportOrdersList
|
|
202
|
+
exportOrdersList: csvExportEndpoints.getModule.exportOrdersList,
|
|
203
|
+
exportProductsList: csvExportEndpoints.getModule.exportProductsList
|
|
202
204
|
});
|
|
203
205
|
} as any;
|
|
204
206
|
|
package/src/api/stores/get.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { WashdayClientInstance } from "../../interfaces/Api";
|
|
2
2
|
import { IStore } from "../../interfaces/Store";
|
|
3
|
+
import { generateQueryParamsStr } from "../../utils/apiUtils";
|
|
3
4
|
import axiosInstance from "../axiosInstance";
|
|
4
5
|
|
|
5
6
|
const GET_SET_STORES = 'api/store';
|
|
@@ -7,6 +8,7 @@ const GET_SET_STORE_IMAGE = 'api/store-image';
|
|
|
7
8
|
const REQUEST_PARAMS = {
|
|
8
9
|
token: 'LOGGED_USER_TOKEN',
|
|
9
10
|
};
|
|
11
|
+
const GET_STORES_WASHDAY_APP = 'api/v2/washdayapp/store';
|
|
10
12
|
|
|
11
13
|
export const getStores = async function (this: WashdayClientInstance, params: {
|
|
12
14
|
isActive?: string
|
|
@@ -62,3 +64,17 @@ export const getStoreImages = async function (this: WashdayClientInstance, store
|
|
|
62
64
|
throw error;
|
|
63
65
|
}
|
|
64
66
|
};
|
|
67
|
+
|
|
68
|
+
export const getStoresByName = async function (this: WashdayClientInstance, query: {
|
|
69
|
+
q?: string
|
|
70
|
+
}): Promise<{ stores: IStore[] }> {
|
|
71
|
+
try {
|
|
72
|
+
const config = {};
|
|
73
|
+
const queryParams = generateQueryParamsStr(['q'], query);
|
|
74
|
+
const response = await axiosInstance.get(`${GET_STORES_WASHDAY_APP}?${queryParams}`, config);
|
|
75
|
+
return response.data?.data?.stores || [];
|
|
76
|
+
} catch (error) {
|
|
77
|
+
console.error('Error fetching getStoresByName:', error);
|
|
78
|
+
throw error;
|
|
79
|
+
}
|
|
80
|
+
};
|
package/src/interfaces/Api.ts
CHANGED
|
@@ -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 } from "../api/stores/get";
|
|
16
|
+
import { getStoreById, getStoreImages, getStoreReviewLink, getStores, 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";
|
|
@@ -92,6 +92,7 @@ export interface WashdayClientInstance {
|
|
|
92
92
|
getStores: typeof getStores;
|
|
93
93
|
getStoreById: typeof getStoreById;
|
|
94
94
|
getStoreImages: typeof getStoreImages;
|
|
95
|
+
getStoresByName: typeof getStoresByName;
|
|
95
96
|
createStore: typeof createStore;
|
|
96
97
|
copyStore: typeof copyStore;
|
|
97
98
|
updateStoreById: typeof updateStoreById;
|