washday-sdk 1.6.17 → 1.6.18

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 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,
@@ -204,6 +204,28 @@ 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: { Authorization: `Bearer ${this.apiToken}` },
212
+ responseType: 'blob'
213
+ };
214
+ const queryParams = generateQueryParamsStr([
215
+ 'store',
216
+ 'fromDate',
217
+ 'toDate',
218
+ 'supplyId',
219
+ 'productId',
220
+ ], params);
221
+ return yield this.axiosInstance.get(`${GET_SET_REPORTS}/supply-cost/export?${queryParams}`, config);
222
+ }
223
+ catch (error) {
224
+ console.error('Error fetching exportSupplyCostReport:', error);
225
+ throw error;
226
+ }
227
+ });
228
+ };
207
229
  export const getUnpaidOrdersReport = function (storeId, params) {
208
230
  return __awaiter(this, void 0, void 0, function* () {
209
231
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "washday-sdk",
3
- "version": "1.6.17",
3
+ "version": "1.6.18",
4
4
  "description": "Washday utilities functions and API",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
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,
@@ -221,6 +221,32 @@ 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: { Authorization: `Bearer ${this.apiToken}` },
234
+ responseType: 'blob' as const
235
+ };
236
+ const queryParams = generateQueryParamsStr([
237
+ 'store',
238
+ 'fromDate',
239
+ 'toDate',
240
+ 'supplyId',
241
+ 'productId',
242
+ ], params);
243
+ return await this.axiosInstance.get(`${GET_SET_REPORTS}/supply-cost/export?${queryParams}`, config);
244
+ } catch (error) {
245
+ console.error('Error fetching exportSupplyCostReport:', error);
246
+ throw error;
247
+ }
248
+ };
249
+
224
250
  export const getUnpaidOrdersReport = async function (this: WashdayClientInstance, storeId: string, params: {
225
251
  fromDate?: string
226
252
  toDate?: string
@@ -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;