washday-sdk 1.6.75 → 1.6.77

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.
@@ -297,6 +297,38 @@ export const exportPaymentLinesReport = function (storeId, params) {
297
297
  }
298
298
  });
299
299
  };
300
+ export const exportOutsourcingReport = function (storeId, params) {
301
+ return __awaiter(this, void 0, void 0, function* () {
302
+ try {
303
+ const config = {
304
+ headers: {
305
+ Authorization: `Bearer ${this.apiToken}`,
306
+ 'Content-Type': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
307
+ 'Content-disposition': 'attachment; filename=[file.xlsx]'
308
+ },
309
+ params: {
310
+ responseType: 'blob'
311
+ }
312
+ };
313
+ const queryParams = generateQueryParamsStr([
314
+ 'statuses',
315
+ 'sequence',
316
+ 'partnerId',
317
+ 'dateFrom',
318
+ 'dateTo',
319
+ 'dateField',
320
+ 'sortBy',
321
+ 'sortDirection',
322
+ 'timezone'
323
+ ], params);
324
+ return yield this.axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/outsourcing/export?${queryParams}`, config);
325
+ }
326
+ catch (error) {
327
+ console.error('Error fetching exportOutsourcingReport:', error);
328
+ throw error;
329
+ }
330
+ });
331
+ };
300
332
  export const exportCashierBoxMovementsReport = function (storeId, params) {
301
333
  return __awaiter(this, void 0, void 0, function* () {
302
334
  try {
package/dist/api/index.js CHANGED
@@ -338,6 +338,7 @@ const WashdayClient = function WashdayClient(apiToken, env = 'PROD', clientId, c
338
338
  exportStaffReport: csvExportEndpoints.getModule.exportStaffReport,
339
339
  exportProductSalesReport: csvExportEndpoints.getModule.exportProductSalesReport,
340
340
  exportPaymentLinesReport: csvExportEndpoints.getModule.exportPaymentLinesReport,
341
+ exportOutsourcingReport: csvExportEndpoints.getModule.exportOutsourcingReport,
341
342
  exportCashierBoxMovementsReport: csvExportEndpoints.getModule.exportCashierBoxMovementsReport,
342
343
  exportUnpaidOrdersReportCSV: csvExportEndpoints.getModule.exportUnpaidOrdersReportCSV,
343
344
  exportAttendanceReport: csvExportEndpoints.getModule.exportAttendanceReport,
@@ -35,7 +35,14 @@ export const getOutsourcedOrdersByStore = function (params) {
35
35
  'statuses',
36
36
  'page',
37
37
  'limit',
38
- 'sequence'
38
+ 'sequence',
39
+ 'partnerId',
40
+ 'dateFrom',
41
+ 'dateTo',
42
+ 'dateField',
43
+ 'includeSummary',
44
+ 'sortBy',
45
+ 'sortDirection'
39
46
  ], params);
40
47
  return yield this.axiosInstance.get(`${GET_OUTSOURCED_ORDERS_BY_STORE.replace(':storeId', params.storeId)}?${queryParams}`, config);
41
48
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "washday-sdk",
3
- "version": "1.6.75",
3
+ "version": "1.6.77",
4
4
  "description": "Washday utilities functions and API",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -327,6 +327,46 @@ export const exportPaymentLinesReport = async function (this: WashdayClientInsta
327
327
  }
328
328
  };
329
329
 
330
+ export const exportOutsourcingReport = async function (this: WashdayClientInstance, storeId: string, params: {
331
+ statuses?: string | string[]
332
+ sequence?: string
333
+ partnerId?: string
334
+ dateFrom?: string
335
+ dateTo?: string
336
+ dateField?: 'sentDate' | 'receivedDate' | 'createdAt' | 'updatedAt'
337
+ sortBy?: 'sentDate' | 'receivedDate' | 'createdAt' | 'updatedAt' | 'outsourcedOrderSequence'
338
+ sortDirection?: 'asc' | 'desc'
339
+ timezone?: string
340
+ }): Promise<any> {
341
+ try {
342
+ const config = {
343
+ headers: {
344
+ Authorization: `Bearer ${this.apiToken}`,
345
+ 'Content-Type': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
346
+ 'Content-disposition': 'attachment; filename=[file.xlsx]'
347
+ },
348
+ params: {
349
+ responseType: 'blob'
350
+ }
351
+ };
352
+ const queryParams = generateQueryParamsStr([
353
+ 'statuses',
354
+ 'sequence',
355
+ 'partnerId',
356
+ 'dateFrom',
357
+ 'dateTo',
358
+ 'dateField',
359
+ 'sortBy',
360
+ 'sortDirection',
361
+ 'timezone'
362
+ ], params);
363
+ return await this.axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/outsourcing/export?${queryParams}`, config);
364
+ } catch (error) {
365
+ console.error('Error fetching exportOutsourcingReport:', error);
366
+ throw error;
367
+ }
368
+ };
369
+
330
370
  export const exportCashierBoxMovementsReport = async function (this: WashdayClientInstance, storeId: string, params: {
331
371
  cashierBoxId?: string
332
372
  fromDate?: string
package/src/api/index.ts CHANGED
@@ -345,6 +345,7 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
345
345
  exportStaffReport: csvExportEndpoints.getModule.exportStaffReport,
346
346
  exportProductSalesReport: csvExportEndpoints.getModule.exportProductSalesReport,
347
347
  exportPaymentLinesReport: csvExportEndpoints.getModule.exportPaymentLinesReport,
348
+ exportOutsourcingReport: csvExportEndpoints.getModule.exportOutsourcingReport,
348
349
  exportCashierBoxMovementsReport: csvExportEndpoints.getModule.exportCashierBoxMovementsReport,
349
350
  exportUnpaidOrdersReportCSV: csvExportEndpoints.getModule.exportUnpaidOrdersReportCSV,
350
351
  exportAttendanceReport: csvExportEndpoints.getModule.exportAttendanceReport,
@@ -23,6 +23,13 @@ export const getOutsourcedOrdersByStore = async function (this: WashdayClientIns
23
23
  sequence?: string,
24
24
  page?: number,
25
25
  limit?: number,
26
+ partnerId?: string,
27
+ dateFrom?: string,
28
+ dateTo?: string,
29
+ dateField?: 'sentDate' | 'receivedDate' | 'createdAt' | 'updatedAt',
30
+ includeSummary?: boolean,
31
+ sortBy?: 'sentDate' | 'receivedDate' | 'createdAt' | 'updatedAt' | 'outsourcedOrderSequence',
32
+ sortDirection?: 'asc' | 'desc',
26
33
  }): Promise<any> {
27
34
  try {
28
35
  const config = {
@@ -32,7 +39,14 @@ export const getOutsourcedOrdersByStore = async function (this: WashdayClientIns
32
39
  'statuses',
33
40
  'page',
34
41
  'limit',
35
- 'sequence'
42
+ 'sequence',
43
+ 'partnerId',
44
+ 'dateFrom',
45
+ 'dateTo',
46
+ 'dateField',
47
+ 'includeSummary',
48
+ 'sortBy',
49
+ 'sortDirection'
36
50
  ], params);
37
51
  return await this.axiosInstance.get(`${GET_OUTSOURCED_ORDERS_BY_STORE.replace(':storeId', params.storeId)}?${queryParams}`, config);
38
52
  } catch (error) {
@@ -325,6 +325,7 @@ export interface WashdayClientInstance {
325
325
  exportDiscountCodesReport: typeof csvExportEndpoints.getModule.exportDiscountCodesReport;
326
326
  exportProductSalesReport: typeof csvExportEndpoints.getModule.exportProductSalesReport;
327
327
  exportPaymentLinesReport: typeof csvExportEndpoints.getModule.exportPaymentLinesReport;
328
+ exportOutsourcingReport: typeof csvExportEndpoints.getModule.exportOutsourcingReport;
328
329
  exportCashierBoxMovementsReport: typeof csvExportEndpoints.getModule.exportCashierBoxMovementsReport;
329
330
  exportUnpaidOrdersReportCSV: typeof csvExportEndpoints.getModule.exportUnpaidOrdersReportCSV;
330
331
  exportCashUpReportsByDateRange: typeof csvExportEndpoints.getModule.exportCashUpReportsByDateRange;
@@ -0,0 +1,37 @@
1
+ import { exportOutsourcingReport } from "../src/api/csv/get";
2
+
3
+ describe("csv.exportOutsourcingReport", () => {
4
+ it("serializes outsourcing report export filters and requests a blob response", async () => {
5
+ const get = jest.fn().mockResolvedValue({ data: "blob-data" });
6
+ const client = {
7
+ apiToken: "token-123",
8
+ axiosInstance: { get },
9
+ } as any;
10
+
11
+ await exportOutsourcingReport.call(client, "store-1", {
12
+ statuses: ["returned", "in_process"],
13
+ sequence: "100",
14
+ partnerId: "partner-1",
15
+ dateFrom: "2026-06-01T05:00:00.000Z",
16
+ dateTo: "2026-06-02T04:59:59.999Z",
17
+ dateField: "receivedDate",
18
+ sortBy: "receivedDate",
19
+ sortDirection: "desc",
20
+ timezone: "America/Mexico_City",
21
+ });
22
+
23
+ expect(get).toHaveBeenCalledWith(
24
+ "api/reports/store-1/outsourcing/export?statuses=returned,in_process&sequence=100&partnerId=partner-1&dateFrom=2026-06-01T05:00:00.000Z&dateTo=2026-06-02T04:59:59.999Z&dateField=receivedDate&sortBy=receivedDate&sortDirection=desc&timezone=America/Mexico_City",
25
+ {
26
+ headers: {
27
+ Authorization: "Bearer token-123",
28
+ "Content-Type": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
29
+ "Content-disposition": "attachment; filename=[file.xlsx]",
30
+ },
31
+ params: {
32
+ responseType: "blob",
33
+ },
34
+ }
35
+ );
36
+ });
37
+ });
@@ -0,0 +1,40 @@
1
+ import { getOutsourcedOrdersByStore } from "../src/api/outsourcedOrders/get";
2
+
3
+ describe("outsourcedOrders.getOutsourcedOrdersByStore report params", () => {
4
+ it("passes optional report filters through the query string", async () => {
5
+ const get = jest.fn().mockResolvedValue({
6
+ data: {
7
+ data: {
8
+ data: [],
9
+ pagination: { totalDocs: 0, limit: 25, page: 1, totalPages: 0 },
10
+ },
11
+ },
12
+ });
13
+ const client = {
14
+ apiToken: "token-123",
15
+ axiosInstance: { get },
16
+ } as any;
17
+
18
+ await getOutsourcedOrdersByStore.call(client, {
19
+ storeId: "store-1",
20
+ statuses: ["returned"],
21
+ page: 1,
22
+ limit: 25,
23
+ sequence: "100",
24
+ partnerId: "partner-1",
25
+ dateFrom: "2026-06-01",
26
+ dateTo: "2026-06-30",
27
+ dateField: "receivedDate",
28
+ includeSummary: true,
29
+ sortBy: "receivedDate",
30
+ sortDirection: "desc",
31
+ });
32
+
33
+ expect(get).toHaveBeenCalledWith(
34
+ "api/store/store-1/outsourced-orders?statuses=returned&page=1&limit=25&sequence=100&partnerId=partner-1&dateFrom=2026-06-01&dateTo=2026-06-30&dateField=receivedDate&includeSummary=true&sortBy=receivedDate&sortDirection=desc",
35
+ {
36
+ headers: { Authorization: "Bearer token-123" },
37
+ }
38
+ );
39
+ });
40
+ });