washday-sdk 0.0.135 → 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/csv/get.js +1 -1
- package/dist/api/index.js +5 -0
- package/dist/api/pdf/get.js +2 -1
- package/dist/api/reports/get.js +96 -1
- package/package.json +1 -1
- package/src/api/csv/get.ts +1 -1
- package/src/api/index.ts +5 -0
- package/src/api/pdf/get.ts +2 -1
- package/src/api/reports/get.ts +106 -1
- package/src/interfaces/Api.ts +5 -0
package/dist/api/csv/get.js
CHANGED
|
@@ -315,7 +315,7 @@ export const exportUnpaidOrdersReportCSV = function (storeId, params) {
|
|
|
315
315
|
'timezone',
|
|
316
316
|
'customerName'
|
|
317
317
|
], params);
|
|
318
|
-
return yield axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/
|
|
318
|
+
return yield axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/unpaidOrders/export/csv?${queryParams}`, config);
|
|
319
319
|
}
|
|
320
320
|
catch (error) {
|
|
321
321
|
console.error('Error fetching exportOrdersList:', error);
|
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/pdf/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 GENERATE_EXPORT = 'api/export';
|
|
13
|
+
const GET_SET_REPORTS = 'api/reports';
|
|
13
14
|
export const exportUnpaidOrdersReportPDF = function (storeId, params) {
|
|
14
15
|
return __awaiter(this, void 0, void 0, function* () {
|
|
15
16
|
try {
|
|
@@ -23,7 +24,7 @@ export const exportUnpaidOrdersReportPDF = function (storeId, params) {
|
|
|
23
24
|
// responseType: 'blob', // Important for handling the PDF blob response
|
|
24
25
|
};
|
|
25
26
|
const queryParams = generateQueryParamsStr(['store', 'fromDate', 'toDate', 'timezone', 'customerName'], params);
|
|
26
|
-
return yield axiosInstance.get(`${
|
|
27
|
+
return yield axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/unpaidOrders/export/pdf?${queryParams}`, config);
|
|
27
28
|
// // Create a link element, trigger a download
|
|
28
29
|
// const url = window.URL.createObjectURL(new Blob([response.data]));
|
|
29
30
|
// const link = document.createElement('a');
|
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 {
|
|
@@ -153,7 +154,6 @@ export const getProductSalesReport = function (storeId, params) {
|
|
|
153
154
|
'toDate',
|
|
154
155
|
'fromDate',
|
|
155
156
|
'timezone',
|
|
156
|
-
'type',
|
|
157
157
|
], params);
|
|
158
158
|
return yield axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/productSales?${queryParams}`, config);
|
|
159
159
|
}
|
|
@@ -206,3 +206,98 @@ export const getUnpaidOrdersReport = function (storeId, params) {
|
|
|
206
206
|
}
|
|
207
207
|
});
|
|
208
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/csv/get.ts
CHANGED
|
@@ -346,7 +346,7 @@ export const exportUnpaidOrdersReportCSV = async function (this: WashdayClientIn
|
|
|
346
346
|
'timezone',
|
|
347
347
|
'customerName'
|
|
348
348
|
], params);
|
|
349
|
-
return await axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/
|
|
349
|
+
return await axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/unpaidOrders/export/csv?${queryParams}`, config);
|
|
350
350
|
} catch (error) {
|
|
351
351
|
console.error('Error fetching exportOrdersList:', error);
|
|
352
352
|
throw error;
|
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/pdf/get.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { generateQueryParamsStr } from "../../utils/apiUtils";
|
|
|
3
3
|
import axiosInstance from "../axiosInstance";
|
|
4
4
|
|
|
5
5
|
const GENERATE_EXPORT = 'api/export';
|
|
6
|
+
const GET_SET_REPORTS = 'api/reports';
|
|
6
7
|
|
|
7
8
|
export const exportUnpaidOrdersReportPDF = async function (this: WashdayClientInstance, storeId: string, params: {
|
|
8
9
|
store: string | undefined,
|
|
@@ -23,7 +24,7 @@ export const exportUnpaidOrdersReportPDF = async function (this: WashdayClientIn
|
|
|
23
24
|
};
|
|
24
25
|
|
|
25
26
|
const queryParams = generateQueryParamsStr(['store', 'fromDate', 'toDate', 'timezone', 'customerName'], params);
|
|
26
|
-
return await axiosInstance.get(`${
|
|
27
|
+
return await axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/unpaidOrders/export/pdf?${queryParams}`, config);
|
|
27
28
|
|
|
28
29
|
// // Create a link element, trigger a download
|
|
29
30
|
// const url = window.URL.createObjectURL(new Blob([response.data]));
|
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
|
|
@@ -162,7 +163,6 @@ export const getProductSalesReport = async function (this: WashdayClientInstance
|
|
|
162
163
|
'toDate',
|
|
163
164
|
'fromDate',
|
|
164
165
|
'timezone',
|
|
165
|
-
'type',
|
|
166
166
|
], params);
|
|
167
167
|
return await axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/productSales?${queryParams}`, config);
|
|
168
168
|
} catch (error) {
|
|
@@ -222,3 +222,108 @@ export const getUnpaidOrdersReport = async function (this: WashdayClientInstance
|
|
|
222
222
|
throw error;
|
|
223
223
|
}
|
|
224
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
|
}
|