washday-sdk 1.6.81 → 1.6.82

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.
@@ -79,7 +79,7 @@ export const exportProductsList = function (storeId) {
79
79
  headers: {
80
80
  Authorization: `Bearer ${this.apiToken}`,
81
81
  'Content-Type': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
82
- 'Content-disposition': 'attachment; filename=[file.csv]'
82
+ 'Content-disposition': 'attachment; filename=[file.xlsx]'
83
83
  },
84
84
  params: {
85
85
  responseType: 'blob'
@@ -261,7 +261,8 @@ export const exportProductSalesReport = function (storeId, params) {
261
261
  const queryParams = generateQueryParamsStr([
262
262
  'fromDate',
263
263
  'toDate',
264
- 'timezone'
264
+ 'timezone',
265
+ 'groupBySection'
265
266
  ], params);
266
267
  return yield this.axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/productSales/export?${queryParams}`, config);
267
268
  }
@@ -174,6 +174,7 @@ export const getProductSalesReport = function (storeId, params) {
174
174
  'toDate',
175
175
  'fromDate',
176
176
  'timezone',
177
+ 'groupBySection',
177
178
  ], params);
178
179
  return yield this.axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/productSales?${queryParams}`, config);
179
180
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "washday-sdk",
3
- "version": "1.6.81",
3
+ "version": "1.6.82",
4
4
  "description": "Washday utilities functions and API",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -96,7 +96,7 @@ export const exportProductsList = async function (this: WashdayClientInstance, s
96
96
  headers: {
97
97
  Authorization: `Bearer ${this.apiToken}`,
98
98
  'Content-Type': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
99
- 'Content-disposition': 'attachment; filename=[file.csv]'
99
+ 'Content-disposition': 'attachment; filename=[file.xlsx]'
100
100
  },
101
101
  params: {
102
102
  responseType: 'blob'
@@ -275,6 +275,7 @@ export const exportProductSalesReport = async function (this: WashdayClientInsta
275
275
  fromDate?: string
276
276
  toDate?: string
277
277
  timezone?: string
278
+ groupBySection?: boolean
278
279
  }): Promise<any> {
279
280
  try {
280
281
  const config = {
@@ -290,7 +291,8 @@ export const exportProductSalesReport = async function (this: WashdayClientInsta
290
291
  const queryParams = generateQueryParamsStr([
291
292
  'fromDate',
292
293
  'toDate',
293
- 'timezone'
294
+ 'timezone',
295
+ 'groupBySection'
294
296
  ], params);
295
297
  return await this.axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/productSales/export?${queryParams}`, config);
296
298
  } catch (error) {
@@ -179,6 +179,7 @@ export const getProductSalesReport = async function (this: WashdayClientInstance
179
179
  fromDate?: string
180
180
  toDate?: string
181
181
  timezone?: string
182
+ groupBySection?: boolean
182
183
  }): Promise<any> {
183
184
  try {
184
185
  const config = {
@@ -188,6 +189,7 @@ export const getProductSalesReport = async function (this: WashdayClientInstance
188
189
  'toDate',
189
190
  'fromDate',
190
191
  'timezone',
192
+ 'groupBySection',
191
193
  ], params);
192
194
  return await this.axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/productSales?${queryParams}`, config);
193
195
  } catch (error) {
@@ -0,0 +1,50 @@
1
+ import { exportProductSalesReport } from "../src/api/csv/get";
2
+ import { getProductSalesReport } from "../src/api/reports/get";
3
+
4
+ describe("product sales report section grouping params", () => {
5
+ it("serializes groupBySection for the product sales report endpoint", async () => {
6
+ const get = jest.fn().mockResolvedValue({ data: { data: {} } });
7
+ const client = {
8
+ apiToken: "token-1",
9
+ axiosInstance: { get },
10
+ } as any;
11
+
12
+ await getProductSalesReport.call(client, "store-1", {
13
+ fromDate: "2026-06-01",
14
+ toDate: "2026-06-30",
15
+ timezone: "America/Mexico_City",
16
+ groupBySection: true,
17
+ });
18
+
19
+ expect(get).toHaveBeenCalledWith(
20
+ "api/reports/store-1/productSales?toDate=2026-06-30&fromDate=2026-06-01&timezone=America/Mexico_City&groupBySection=true",
21
+ {
22
+ headers: { Authorization: "Bearer token-1" },
23
+ }
24
+ );
25
+ });
26
+
27
+ it("serializes groupBySection for the product sales export endpoint", async () => {
28
+ const get = jest.fn().mockResolvedValue({ data: "blob-data" });
29
+ const client = {
30
+ apiToken: "token-2",
31
+ axiosInstance: { get },
32
+ } as any;
33
+
34
+ await exportProductSalesReport.call(client, "store-2", {
35
+ fromDate: "2026-06-01",
36
+ toDate: "2026-06-30",
37
+ timezone: "America/Mexico_City",
38
+ groupBySection: true,
39
+ });
40
+
41
+ expect(get).toHaveBeenCalledWith(
42
+ "api/reports/store-2/productSales/export?fromDate=2026-06-01&toDate=2026-06-30&timezone=America/Mexico_City&groupBySection=true",
43
+ expect.objectContaining({
44
+ headers: expect.objectContaining({
45
+ Authorization: "Bearer token-2",
46
+ }),
47
+ })
48
+ );
49
+ });
50
+ });