washday-sdk 1.6.17 → 1.6.19
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 +1 -0
- package/dist/api/reports/get.js +26 -0
- package/package.json +1 -1
- package/src/api/index.ts +1 -0
- package/src/api/reports/get.ts +30 -0
- package/src/interfaces/Api.ts +1 -0
package/dist/api/index.js
CHANGED
|
@@ -321,6 +321,7 @@ const WashdayClient = function WashdayClient(apiToken, env = 'PROD', clientId, c
|
|
|
321
321
|
getMonthSalesStatistics: reportsExportEndpoints.getModule.getMonthSalesStatistics,
|
|
322
322
|
getPopularDaysStatistics: reportsExportEndpoints.getModule.getPopularDaysStatistics,
|
|
323
323
|
getSupplyCostReport: reportsExportEndpoints.getModule.getSupplyCostReport,
|
|
324
|
+
exportSupplyCostReport: reportsExportEndpoints.getModule.exportSupplyCostReport,
|
|
324
325
|
});
|
|
325
326
|
this.partners = bindMethods(this, {
|
|
326
327
|
getPartners: partnersEndpoints.getModule.getPartners,
|
package/dist/api/reports/get.js
CHANGED
|
@@ -204,6 +204,32 @@ export const getSupplyCostReport = function (params) {
|
|
|
204
204
|
}
|
|
205
205
|
});
|
|
206
206
|
};
|
|
207
|
+
export const exportSupplyCostReport = function (params) {
|
|
208
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
209
|
+
try {
|
|
210
|
+
const config = {
|
|
211
|
+
headers: {
|
|
212
|
+
Authorization: `Bearer ${this.apiToken}`,
|
|
213
|
+
'Content-Type': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
214
|
+
'Content-disposition': 'attachment; filename="supply-cost.xlsx"'
|
|
215
|
+
},
|
|
216
|
+
responseType: 'blob'
|
|
217
|
+
};
|
|
218
|
+
const queryParams = generateQueryParamsStr([
|
|
219
|
+
'store',
|
|
220
|
+
'fromDate',
|
|
221
|
+
'toDate',
|
|
222
|
+
'supplyId',
|
|
223
|
+
'productId',
|
|
224
|
+
], params);
|
|
225
|
+
return yield this.axiosInstance.get(`${GET_SET_REPORTS}/supply-cost/export?${queryParams}`, config);
|
|
226
|
+
}
|
|
227
|
+
catch (error) {
|
|
228
|
+
console.error('Error fetching exportSupplyCostReport:', error);
|
|
229
|
+
throw error;
|
|
230
|
+
}
|
|
231
|
+
});
|
|
232
|
+
};
|
|
207
233
|
export const getUnpaidOrdersReport = function (storeId, params) {
|
|
208
234
|
return __awaiter(this, void 0, void 0, function* () {
|
|
209
235
|
try {
|
package/package.json
CHANGED
package/src/api/index.ts
CHANGED
|
@@ -328,6 +328,7 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
|
|
|
328
328
|
getMonthSalesStatistics: reportsExportEndpoints.getModule.getMonthSalesStatistics,
|
|
329
329
|
getPopularDaysStatistics: reportsExportEndpoints.getModule.getPopularDaysStatistics,
|
|
330
330
|
getSupplyCostReport: reportsExportEndpoints.getModule.getSupplyCostReport,
|
|
331
|
+
exportSupplyCostReport: reportsExportEndpoints.getModule.exportSupplyCostReport,
|
|
331
332
|
});
|
|
332
333
|
this.partners = bindMethods(this, {
|
|
333
334
|
getPartners: partnersEndpoints.getModule.getPartners,
|
package/src/api/reports/get.ts
CHANGED
|
@@ -221,6 +221,36 @@ export const getSupplyCostReport = async function (this: WashdayClientInstance,
|
|
|
221
221
|
}
|
|
222
222
|
};
|
|
223
223
|
|
|
224
|
+
export const exportSupplyCostReport = async function (this: WashdayClientInstance, params: {
|
|
225
|
+
store?: string; // store id or "all"
|
|
226
|
+
fromDate?: string;
|
|
227
|
+
toDate?: string;
|
|
228
|
+
supplyId?: string;
|
|
229
|
+
productId?: string;
|
|
230
|
+
}): Promise<any> {
|
|
231
|
+
try {
|
|
232
|
+
const config = {
|
|
233
|
+
headers: {
|
|
234
|
+
Authorization: `Bearer ${this.apiToken}`,
|
|
235
|
+
'Content-Type': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
236
|
+
'Content-disposition': 'attachment; filename="supply-cost.xlsx"'
|
|
237
|
+
},
|
|
238
|
+
responseType: 'blob' as const
|
|
239
|
+
};
|
|
240
|
+
const queryParams = generateQueryParamsStr([
|
|
241
|
+
'store',
|
|
242
|
+
'fromDate',
|
|
243
|
+
'toDate',
|
|
244
|
+
'supplyId',
|
|
245
|
+
'productId',
|
|
246
|
+
], params);
|
|
247
|
+
return await this.axiosInstance.get(`${GET_SET_REPORTS}/supply-cost/export?${queryParams}`, config);
|
|
248
|
+
} catch (error) {
|
|
249
|
+
console.error('Error fetching exportSupplyCostReport:', error);
|
|
250
|
+
throw error;
|
|
251
|
+
}
|
|
252
|
+
};
|
|
253
|
+
|
|
224
254
|
export const getUnpaidOrdersReport = async function (this: WashdayClientInstance, storeId: string, params: {
|
|
225
255
|
fromDate?: string
|
|
226
256
|
toDate?: string
|
package/src/interfaces/Api.ts
CHANGED
|
@@ -313,6 +313,7 @@ export interface WashdayClientInstance {
|
|
|
313
313
|
getMonthSalesStatistics: typeof reportsExportEndpoints.getModule.getMonthSalesStatistics;
|
|
314
314
|
getPopularDaysStatistics: typeof reportsExportEndpoints.getModule.getPopularDaysStatistics;
|
|
315
315
|
getSupplyCostReport: typeof reportsExportEndpoints.getModule.getSupplyCostReport;
|
|
316
|
+
exportSupplyCostReport: typeof reportsExportEndpoints.getModule.exportSupplyCostReport;
|
|
316
317
|
};
|
|
317
318
|
partners: {
|
|
318
319
|
getPartners: typeof partnersEndpoints.getModule.getPartners;
|