washday-sdk 0.0.136 → 0.0.137
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 +5 -0
- package/dist/api/reports/get.js +96 -0
- package/package.json +1 -1
- package/src/api/index.ts +5 -0
- package/src/api/reports/get.ts +106 -0
- package/src/interfaces/Api.ts +5 -0
package/dist/api/index.js
CHANGED
|
@@ -244,6 +244,11 @@ const WashdayClient = function WashdayClient(apiToken) {
|
|
|
244
244
|
getProductSalesReport: reportsExportEndpoints.getModule.getProductSalesReport,
|
|
245
245
|
getPaymentLinesReport: reportsExportEndpoints.getModule.getPaymentLinesReport,
|
|
246
246
|
getUnpaidOrdersReport: reportsExportEndpoints.getModule.getUnpaidOrdersReport,
|
|
247
|
+
getAnnualSalesStatistics: reportsExportEndpoints.getModule.getAnnualSalesStatistics,
|
|
248
|
+
getPaymentMethodStatistics: reportsExportEndpoints.getModule.getPaymentMethodStatistics,
|
|
249
|
+
getProductsStatistics: reportsExportEndpoints.getModule.getProductsStatistics,
|
|
250
|
+
getMonthSalesStatistics: reportsExportEndpoints.getModule.getMonthSalesStatistics,
|
|
251
|
+
getPopularDaysStatistics: reportsExportEndpoints.getModule.getPopularDaysStatistics,
|
|
247
252
|
});
|
|
248
253
|
};
|
|
249
254
|
export default WashdayClient;
|
package/dist/api/reports/get.js
CHANGED
|
@@ -10,6 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
import { generateQueryParamsStr } from "../../utils/apiUtils";
|
|
11
11
|
import axiosInstance from "../axiosInstance";
|
|
12
12
|
const GET_SET_REPORTS = 'api/reports';
|
|
13
|
+
const GET_SET_STATISTICS = 'api/statistics';
|
|
13
14
|
export const getCleanedOrdersReport = function (storeId, params) {
|
|
14
15
|
return __awaiter(this, void 0, void 0, function* () {
|
|
15
16
|
try {
|
|
@@ -205,3 +206,98 @@ export const getUnpaidOrdersReport = function (storeId, params) {
|
|
|
205
206
|
}
|
|
206
207
|
});
|
|
207
208
|
};
|
|
209
|
+
export const getAnnualSalesStatistics = function (storeId, params) {
|
|
210
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
211
|
+
try {
|
|
212
|
+
const config = {
|
|
213
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
214
|
+
};
|
|
215
|
+
const queryParams = generateQueryParamsStr([
|
|
216
|
+
'toDate',
|
|
217
|
+
'fromDate',
|
|
218
|
+
'timezone',
|
|
219
|
+
], params);
|
|
220
|
+
return yield axiosInstance.get(`${GET_SET_STATISTICS}/${storeId}/annual?${queryParams}`, config);
|
|
221
|
+
}
|
|
222
|
+
catch (error) {
|
|
223
|
+
console.error('Error fetching getAnnualSalesStatistics :', error);
|
|
224
|
+
throw error;
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
};
|
|
228
|
+
export const getPaymentMethodStatistics = function (storeId, params) {
|
|
229
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
230
|
+
try {
|
|
231
|
+
const config = {
|
|
232
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
233
|
+
};
|
|
234
|
+
const queryParams = generateQueryParamsStr([
|
|
235
|
+
'toDate',
|
|
236
|
+
'fromDate',
|
|
237
|
+
'timezone',
|
|
238
|
+
], params);
|
|
239
|
+
return yield axiosInstance.get(`${GET_SET_STATISTICS}/${storeId}/ordersPaymentMethod?${queryParams}`, config);
|
|
240
|
+
}
|
|
241
|
+
catch (error) {
|
|
242
|
+
console.error('Error fetching getPaymentMethodStatistics :', error);
|
|
243
|
+
throw error;
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
};
|
|
247
|
+
export const getProductsStatistics = function (storeId, params) {
|
|
248
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
249
|
+
try {
|
|
250
|
+
const config = {
|
|
251
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
252
|
+
};
|
|
253
|
+
const queryParams = generateQueryParamsStr([
|
|
254
|
+
'toDate',
|
|
255
|
+
'fromDate',
|
|
256
|
+
'timezone',
|
|
257
|
+
], params);
|
|
258
|
+
return yield axiosInstance.get(`${GET_SET_STATISTICS}/${storeId}/ordersProduct?${queryParams}`, config);
|
|
259
|
+
}
|
|
260
|
+
catch (error) {
|
|
261
|
+
console.error('Error fetching getProductsStatistics :', error);
|
|
262
|
+
throw error;
|
|
263
|
+
}
|
|
264
|
+
});
|
|
265
|
+
};
|
|
266
|
+
export const getMonthSalesStatistics = function (storeId, params) {
|
|
267
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
268
|
+
try {
|
|
269
|
+
const config = {
|
|
270
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
271
|
+
};
|
|
272
|
+
const queryParams = generateQueryParamsStr([
|
|
273
|
+
'toDate',
|
|
274
|
+
'fromDate',
|
|
275
|
+
'timezone',
|
|
276
|
+
], params);
|
|
277
|
+
return yield axiosInstance.get(`${GET_SET_STATISTICS}/${storeId}/month?${queryParams}`, config);
|
|
278
|
+
}
|
|
279
|
+
catch (error) {
|
|
280
|
+
console.error('Error fetching getMonthSalesStatistics :', error);
|
|
281
|
+
throw error;
|
|
282
|
+
}
|
|
283
|
+
});
|
|
284
|
+
};
|
|
285
|
+
export const getPopularDaysStatistics = function (storeId, params) {
|
|
286
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
287
|
+
try {
|
|
288
|
+
const config = {
|
|
289
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
290
|
+
};
|
|
291
|
+
const queryParams = generateQueryParamsStr([
|
|
292
|
+
'toDate',
|
|
293
|
+
'fromDate',
|
|
294
|
+
'timezone',
|
|
295
|
+
], params);
|
|
296
|
+
return yield axiosInstance.get(`${GET_SET_STATISTICS}/${storeId}/popularDays?${queryParams}`, config);
|
|
297
|
+
}
|
|
298
|
+
catch (error) {
|
|
299
|
+
console.error('Error fetching getPopularDaysStatistics :', error);
|
|
300
|
+
throw error;
|
|
301
|
+
}
|
|
302
|
+
});
|
|
303
|
+
};
|
package/package.json
CHANGED
package/src/api/index.ts
CHANGED
|
@@ -250,6 +250,11 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
|
|
|
250
250
|
getProductSalesReport: reportsExportEndpoints.getModule.getProductSalesReport,
|
|
251
251
|
getPaymentLinesReport: reportsExportEndpoints.getModule.getPaymentLinesReport,
|
|
252
252
|
getUnpaidOrdersReport: reportsExportEndpoints.getModule.getUnpaidOrdersReport,
|
|
253
|
+
getAnnualSalesStatistics: reportsExportEndpoints.getModule.getAnnualSalesStatistics,
|
|
254
|
+
getPaymentMethodStatistics: reportsExportEndpoints.getModule.getPaymentMethodStatistics,
|
|
255
|
+
getProductsStatistics: reportsExportEndpoints.getModule.getProductsStatistics,
|
|
256
|
+
getMonthSalesStatistics: reportsExportEndpoints.getModule.getMonthSalesStatistics,
|
|
257
|
+
getPopularDaysStatistics: reportsExportEndpoints.getModule.getPopularDaysStatistics,
|
|
253
258
|
});
|
|
254
259
|
} as any;
|
|
255
260
|
|
package/src/api/reports/get.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { IOrder } from "../../interfaces/Order";
|
|
|
3
3
|
import { generateQueryParamsStr } from "../../utils/apiUtils";
|
|
4
4
|
import axiosInstance from "../axiosInstance";
|
|
5
5
|
const GET_SET_REPORTS = 'api/reports';
|
|
6
|
+
const GET_SET_STATISTICS = 'api/statistics';
|
|
6
7
|
|
|
7
8
|
export const getCleanedOrdersReport = async function (this: WashdayClientInstance, storeId: string, params: {
|
|
8
9
|
fromDate?: string
|
|
@@ -221,3 +222,108 @@ export const getUnpaidOrdersReport = async function (this: WashdayClientInstance
|
|
|
221
222
|
throw error;
|
|
222
223
|
}
|
|
223
224
|
};
|
|
225
|
+
|
|
226
|
+
export const getAnnualSalesStatistics = async function (this: WashdayClientInstance, storeId: string, params: {
|
|
227
|
+
fromDate?: string
|
|
228
|
+
toDate?: string
|
|
229
|
+
timezone?: string
|
|
230
|
+
}): Promise<any> {
|
|
231
|
+
try {
|
|
232
|
+
const config = {
|
|
233
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
234
|
+
};
|
|
235
|
+
const queryParams = generateQueryParamsStr([
|
|
236
|
+
'toDate',
|
|
237
|
+
'fromDate',
|
|
238
|
+
'timezone',
|
|
239
|
+
], params);
|
|
240
|
+
return await axiosInstance.get(`${GET_SET_STATISTICS}/${storeId}/annual?${queryParams}`, config);
|
|
241
|
+
} catch (error) {
|
|
242
|
+
console.error('Error fetching getAnnualSalesStatistics :', error);
|
|
243
|
+
throw error;
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
export const getPaymentMethodStatistics = async function (this: WashdayClientInstance, storeId: string, params: {
|
|
248
|
+
fromDate?: string
|
|
249
|
+
toDate?: string
|
|
250
|
+
timezone?: string
|
|
251
|
+
}): Promise<any> {
|
|
252
|
+
try {
|
|
253
|
+
const config = {
|
|
254
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
255
|
+
};
|
|
256
|
+
const queryParams = generateQueryParamsStr([
|
|
257
|
+
'toDate',
|
|
258
|
+
'fromDate',
|
|
259
|
+
'timezone',
|
|
260
|
+
], params);
|
|
261
|
+
return await axiosInstance.get(`${GET_SET_STATISTICS}/${storeId}/ordersPaymentMethod?${queryParams}`, config);
|
|
262
|
+
} catch (error) {
|
|
263
|
+
console.error('Error fetching getPaymentMethodStatistics :', error);
|
|
264
|
+
throw error;
|
|
265
|
+
}
|
|
266
|
+
};
|
|
267
|
+
|
|
268
|
+
export const getProductsStatistics = async function (this: WashdayClientInstance, storeId: string, params: {
|
|
269
|
+
fromDate?: string
|
|
270
|
+
toDate?: string
|
|
271
|
+
timezone?: string
|
|
272
|
+
}): Promise<any> {
|
|
273
|
+
try {
|
|
274
|
+
const config = {
|
|
275
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
276
|
+
};
|
|
277
|
+
const queryParams = generateQueryParamsStr([
|
|
278
|
+
'toDate',
|
|
279
|
+
'fromDate',
|
|
280
|
+
'timezone',
|
|
281
|
+
], params);
|
|
282
|
+
return await axiosInstance.get(`${GET_SET_STATISTICS}/${storeId}/ordersProduct?${queryParams}`, config);
|
|
283
|
+
} catch (error) {
|
|
284
|
+
console.error('Error fetching getProductsStatistics :', error);
|
|
285
|
+
throw error;
|
|
286
|
+
}
|
|
287
|
+
};
|
|
288
|
+
|
|
289
|
+
export const getMonthSalesStatistics = async function (this: WashdayClientInstance, storeId: string, params: {
|
|
290
|
+
fromDate?: string
|
|
291
|
+
toDate?: string
|
|
292
|
+
timezone?: string
|
|
293
|
+
}): Promise<any> {
|
|
294
|
+
try {
|
|
295
|
+
const config = {
|
|
296
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
297
|
+
};
|
|
298
|
+
const queryParams = generateQueryParamsStr([
|
|
299
|
+
'toDate',
|
|
300
|
+
'fromDate',
|
|
301
|
+
'timezone',
|
|
302
|
+
], params);
|
|
303
|
+
return await axiosInstance.get(`${GET_SET_STATISTICS}/${storeId}/month?${queryParams}`, config);
|
|
304
|
+
} catch (error) {
|
|
305
|
+
console.error('Error fetching getMonthSalesStatistics :', error);
|
|
306
|
+
throw error;
|
|
307
|
+
}
|
|
308
|
+
};
|
|
309
|
+
|
|
310
|
+
export const getPopularDaysStatistics = async function (this: WashdayClientInstance, storeId: string, params: {
|
|
311
|
+
fromDate?: string
|
|
312
|
+
toDate?: string
|
|
313
|
+
timezone?: string
|
|
314
|
+
}): Promise<any> {
|
|
315
|
+
try {
|
|
316
|
+
const config = {
|
|
317
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
318
|
+
};
|
|
319
|
+
const queryParams = generateQueryParamsStr([
|
|
320
|
+
'toDate',
|
|
321
|
+
'fromDate',
|
|
322
|
+
'timezone',
|
|
323
|
+
], params);
|
|
324
|
+
return await axiosInstance.get(`${GET_SET_STATISTICS}/${storeId}/popularDays?${queryParams}`, config);
|
|
325
|
+
} catch (error) {
|
|
326
|
+
console.error('Error fetching getPopularDaysStatistics :', error);
|
|
327
|
+
throw error;
|
|
328
|
+
}
|
|
329
|
+
};
|
package/src/interfaces/Api.ts
CHANGED
|
@@ -232,5 +232,10 @@ export interface WashdayClientInstance {
|
|
|
232
232
|
getProductSalesReport: typeof reportsExportEndpoints.getModule.getProductSalesReport;
|
|
233
233
|
getPaymentLinesReport: typeof reportsExportEndpoints.getModule.getPaymentLinesReport;
|
|
234
234
|
getUnpaidOrdersReport: typeof reportsExportEndpoints.getModule.getUnpaidOrdersReport;
|
|
235
|
+
getAnnualSalesStatistics: typeof reportsExportEndpoints.getModule.getAnnualSalesStatistics;
|
|
236
|
+
getPaymentMethodStatistics: typeof reportsExportEndpoints.getModule.getPaymentMethodStatistics;
|
|
237
|
+
getProductsStatistics: typeof reportsExportEndpoints.getModule.getProductsStatistics;
|
|
238
|
+
getMonthSalesStatistics: typeof reportsExportEndpoints.getModule.getMonthSalesStatistics;
|
|
239
|
+
getPopularDaysStatistics: typeof reportsExportEndpoints.getModule.getPopularDaysStatistics;
|
|
235
240
|
};
|
|
236
241
|
}
|