washday-sdk 0.0.134 → 0.0.135

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.
@@ -242,3 +242,84 @@ export const exportStaffReport = function (storeId, params) {
242
242
  }
243
243
  });
244
244
  };
245
+ export const exportProductSalesReport = function (storeId, params) {
246
+ return __awaiter(this, void 0, void 0, function* () {
247
+ try {
248
+ const config = {
249
+ headers: {
250
+ Authorization: `Bearer ${this.apiToken}`,
251
+ 'Content-Type': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
252
+ 'Content-disposition': 'attachment; filename=[file.csv]'
253
+ },
254
+ params: {
255
+ responseType: 'blob'
256
+ }
257
+ };
258
+ const queryParams = generateQueryParamsStr([
259
+ 'fromDate',
260
+ 'toDate',
261
+ 'timezone'
262
+ ], params);
263
+ return yield axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/productSales/export?${queryParams}`, config);
264
+ }
265
+ catch (error) {
266
+ console.error('Error fetching exportOrdersList:', error);
267
+ throw error;
268
+ }
269
+ });
270
+ };
271
+ export const exportPaymentLinesReport = function (storeId, params) {
272
+ return __awaiter(this, void 0, void 0, function* () {
273
+ try {
274
+ const config = {
275
+ headers: {
276
+ Authorization: `Bearer ${this.apiToken}`,
277
+ 'Content-Type': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
278
+ 'Content-disposition': 'attachment; filename=[file.csv]'
279
+ },
280
+ params: {
281
+ responseType: 'blob'
282
+ }
283
+ };
284
+ const queryParams = generateQueryParamsStr([
285
+ 'fromDate',
286
+ 'toDate',
287
+ 'timezone'
288
+ ], params);
289
+ return yield axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/paymentLines/export?${queryParams}`, config);
290
+ }
291
+ catch (error) {
292
+ console.error('Error fetching exportOrdersList:', error);
293
+ throw error;
294
+ }
295
+ });
296
+ };
297
+ export const exportUnpaidOrdersReportCSV = function (storeId, params) {
298
+ return __awaiter(this, void 0, void 0, function* () {
299
+ try {
300
+ const config = {
301
+ headers: {
302
+ Authorization: `Bearer ${this.apiToken}`,
303
+ 'Content-Type': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
304
+ 'Content-disposition': 'attachment; filename=[file.csv]'
305
+ },
306
+ params: {
307
+ responseType: 'blob'
308
+ }
309
+ };
310
+ const queryParams = generateQueryParamsStr([
311
+ 'fromDate',
312
+ 'toDate',
313
+ 'pageNum',
314
+ 'limit',
315
+ 'timezone',
316
+ 'customerName'
317
+ ], params);
318
+ return yield axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/paymentLines/export?${queryParams}`, config);
319
+ }
320
+ catch (error) {
321
+ console.error('Error fetching exportOrdersList:', error);
322
+ throw error;
323
+ }
324
+ });
325
+ };
package/dist/api/index.js CHANGED
@@ -226,6 +226,9 @@ const WashdayClient = function WashdayClient(apiToken) {
226
226
  exportCustomersReport: csvExportEndpoints.getModule.exportCustomersReport,
227
227
  exportSuppliesReport: csvExportEndpoints.getModule.exportSuppliesReport,
228
228
  exportDiscountCodesReport: csvExportEndpoints.getModule.exportDiscountCodesReport,
229
+ exportProductSalesReport: csvExportEndpoints.getModule.exportProductSalesReport,
230
+ exportPaymentLinesReport: csvExportEndpoints.getModule.exportPaymentLinesReport,
231
+ exportUnpaidOrdersReportCSV: csvExportEndpoints.getModule.exportUnpaidOrdersReportCSV,
229
232
  });
230
233
  this.pdf = bindMethods(this, {
231
234
  exportUnpaidOrdersReportPDF: pdfExportEndpoints.getModule.exportUnpaidOrdersReportPDF,
@@ -238,6 +241,9 @@ const WashdayClient = function WashdayClient(apiToken) {
238
241
  getSuppliesReport: reportsExportEndpoints.getModule.getSuppliesReport,
239
242
  getDiscountCodesReport: reportsExportEndpoints.getModule.getDiscountCodesReport,
240
243
  getStaffReport: reportsExportEndpoints.getModule.getStaffReport,
244
+ getProductSalesReport: reportsExportEndpoints.getModule.getProductSalesReport,
245
+ getPaymentLinesReport: reportsExportEndpoints.getModule.getPaymentLinesReport,
246
+ getUnpaidOrdersReport: reportsExportEndpoints.getModule.getUnpaidOrdersReport,
241
247
  });
242
248
  };
243
249
  export default WashdayClient;
@@ -21,6 +21,7 @@ export const getCleanedOrdersReport = function (storeId, params) {
21
21
  'fromDate',
22
22
  'pageNum',
23
23
  'limit',
24
+ 'timezone',
24
25
  'includeGraph',
25
26
  ], params);
26
27
  return yield axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/cleaned-orders?${queryParams}`, config);
@@ -142,3 +143,66 @@ export const getStaffReport = function (storeId, params) {
142
143
  }
143
144
  });
144
145
  };
146
+ export const getProductSalesReport = function (storeId, params) {
147
+ return __awaiter(this, void 0, void 0, function* () {
148
+ try {
149
+ const config = {
150
+ headers: { Authorization: `Bearer ${this.apiToken}` }
151
+ };
152
+ const queryParams = generateQueryParamsStr([
153
+ 'toDate',
154
+ 'fromDate',
155
+ 'timezone',
156
+ 'type',
157
+ ], params);
158
+ return yield axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/productSales?${queryParams}`, config);
159
+ }
160
+ catch (error) {
161
+ console.error('Error fetching getProductSalesReport:', error);
162
+ throw error;
163
+ }
164
+ });
165
+ };
166
+ export const getPaymentLinesReport = function (storeId, params) {
167
+ return __awaiter(this, void 0, void 0, function* () {
168
+ try {
169
+ const config = {
170
+ headers: { Authorization: `Bearer ${this.apiToken}` }
171
+ };
172
+ const queryParams = generateQueryParamsStr([
173
+ 'fromDate',
174
+ 'toDate',
175
+ 'pageNum',
176
+ 'limit',
177
+ 'timezone',
178
+ ], params);
179
+ return yield axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/paymentLines?${queryParams}`, config);
180
+ }
181
+ catch (error) {
182
+ console.error('Error fetching getPaymentLinesReport:', error);
183
+ throw error;
184
+ }
185
+ });
186
+ };
187
+ export const getUnpaidOrdersReport = function (storeId, params) {
188
+ return __awaiter(this, void 0, void 0, function* () {
189
+ try {
190
+ const config = {
191
+ headers: { Authorization: `Bearer ${this.apiToken}` }
192
+ };
193
+ const queryParams = generateQueryParamsStr([
194
+ 'fromDate',
195
+ 'toDate',
196
+ 'pageNum',
197
+ 'limit',
198
+ 'timezone',
199
+ 'customerName'
200
+ ], params);
201
+ return yield axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/unpaidOrders?${queryParams}`, config);
202
+ }
203
+ catch (error) {
204
+ console.error('Error fetching getUnpaidOrdersReport:', error);
205
+ throw error;
206
+ }
207
+ });
208
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "washday-sdk",
3
- "version": "0.0.134",
3
+ "version": "0.0.135",
4
4
  "description": "Washday utilities functions and API",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -260,4 +260,95 @@ export const exportStaffReport = async function (this: WashdayClientInstance, st
260
260
  console.error('Error fetching exportCustomersReport:', error);
261
261
  throw error;
262
262
  }
263
+ };
264
+
265
+
266
+ export const exportProductSalesReport = async function (this: WashdayClientInstance, storeId: string, params: {
267
+ fromDate?: string
268
+ toDate?: string
269
+ timezone?: string
270
+ }): Promise<any> {
271
+ try {
272
+ const config = {
273
+ headers: {
274
+ Authorization: `Bearer ${this.apiToken}`,
275
+ 'Content-Type': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
276
+ 'Content-disposition': 'attachment; filename=[file.csv]'
277
+ },
278
+ params: {
279
+ responseType: 'blob'
280
+ }
281
+ };
282
+ const queryParams = generateQueryParamsStr([
283
+ 'fromDate',
284
+ 'toDate',
285
+ 'timezone'
286
+ ], params);
287
+ return await axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/productSales/export?${queryParams}`, config);
288
+ } catch (error) {
289
+ console.error('Error fetching exportOrdersList:', error);
290
+ throw error;
291
+ }
292
+ };
293
+
294
+ export const exportPaymentLinesReport = async function (this: WashdayClientInstance, storeId: string, params: {
295
+ fromDate?: string
296
+ toDate?: string
297
+ timezone?: string
298
+ }): Promise<any> {
299
+ try {
300
+ const config = {
301
+ headers: {
302
+ Authorization: `Bearer ${this.apiToken}`,
303
+ 'Content-Type': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
304
+ 'Content-disposition': 'attachment; filename=[file.csv]'
305
+ },
306
+ params: {
307
+ responseType: 'blob'
308
+ }
309
+ };
310
+ const queryParams = generateQueryParamsStr([
311
+ 'fromDate',
312
+ 'toDate',
313
+ 'timezone'
314
+ ], params);
315
+ return await axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/paymentLines/export?${queryParams}`, config);
316
+ } catch (error) {
317
+ console.error('Error fetching exportOrdersList:', error);
318
+ throw error;
319
+ }
320
+ };
321
+
322
+ export const exportUnpaidOrdersReportCSV = async function (this: WashdayClientInstance, storeId: string, params: {
323
+ fromDate?: string
324
+ toDate?: string
325
+ timezone?: string
326
+ pageNum?: string
327
+ limit?: string
328
+ customerName?: string
329
+ }): Promise<any> {
330
+ try {
331
+ const config = {
332
+ headers: {
333
+ Authorization: `Bearer ${this.apiToken}`,
334
+ 'Content-Type': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
335
+ 'Content-disposition': 'attachment; filename=[file.csv]'
336
+ },
337
+ params: {
338
+ responseType: 'blob'
339
+ }
340
+ };
341
+ const queryParams = generateQueryParamsStr([
342
+ 'fromDate',
343
+ 'toDate',
344
+ 'pageNum',
345
+ 'limit',
346
+ 'timezone',
347
+ 'customerName'
348
+ ], params);
349
+ return await axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/paymentLines/export?${queryParams}`, config);
350
+ } catch (error) {
351
+ console.error('Error fetching exportOrdersList:', error);
352
+ throw error;
353
+ }
263
354
  };
package/src/api/index.ts CHANGED
@@ -232,6 +232,9 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
232
232
  exportCustomersReport: csvExportEndpoints.getModule.exportCustomersReport,
233
233
  exportSuppliesReport: csvExportEndpoints.getModule.exportSuppliesReport,
234
234
  exportDiscountCodesReport: csvExportEndpoints.getModule.exportDiscountCodesReport,
235
+ exportProductSalesReport: csvExportEndpoints.getModule.exportProductSalesReport,
236
+ exportPaymentLinesReport: csvExportEndpoints.getModule.exportPaymentLinesReport,
237
+ exportUnpaidOrdersReportCSV: csvExportEndpoints.getModule.exportUnpaidOrdersReportCSV,
235
238
  });
236
239
  this.pdf = bindMethods(this, {
237
240
  exportUnpaidOrdersReportPDF: pdfExportEndpoints.getModule.exportUnpaidOrdersReportPDF,
@@ -244,6 +247,9 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
244
247
  getSuppliesReport: reportsExportEndpoints.getModule.getSuppliesReport,
245
248
  getDiscountCodesReport: reportsExportEndpoints.getModule.getDiscountCodesReport,
246
249
  getStaffReport: reportsExportEndpoints.getModule.getStaffReport,
250
+ getProductSalesReport: reportsExportEndpoints.getModule.getProductSalesReport,
251
+ getPaymentLinesReport: reportsExportEndpoints.getModule.getPaymentLinesReport,
252
+ getUnpaidOrdersReport: reportsExportEndpoints.getModule.getUnpaidOrdersReport,
247
253
  });
248
254
  } as any;
249
255
 
@@ -20,6 +20,7 @@ export const getCleanedOrdersReport = async function (this: WashdayClientInstanc
20
20
  'fromDate',
21
21
  'pageNum',
22
22
  'limit',
23
+ 'timezone',
23
24
  'includeGraph',
24
25
  ], params);
25
26
  return await axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/cleaned-orders?${queryParams}`, config);
@@ -146,4 +147,78 @@ export const getStaffReport = async function (this: WashdayClientInstance, store
146
147
  console.error('Error fetching getStaffReport:', error);
147
148
  throw error;
148
149
  }
149
- };
150
+ };
151
+
152
+ export const getProductSalesReport = async function (this: WashdayClientInstance, storeId: string, params: {
153
+ fromDate?: string
154
+ toDate?: string
155
+ timezone?: string
156
+ }): Promise<any> {
157
+ try {
158
+ const config = {
159
+ headers: { Authorization: `Bearer ${this.apiToken}` }
160
+ };
161
+ const queryParams = generateQueryParamsStr([
162
+ 'toDate',
163
+ 'fromDate',
164
+ 'timezone',
165
+ 'type',
166
+ ], params);
167
+ return await axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/productSales?${queryParams}`, config);
168
+ } catch (error) {
169
+ console.error('Error fetching getProductSalesReport:', error);
170
+ throw error;
171
+ }
172
+ };
173
+
174
+ export const getPaymentLinesReport = async function (this: WashdayClientInstance, storeId: string, params: {
175
+ fromDate?: string
176
+ toDate?: string
177
+ timezone?: string
178
+ pageNum?: string
179
+ limit?: string
180
+ }): Promise<any> {
181
+ try {
182
+ const config = {
183
+ headers: { Authorization: `Bearer ${this.apiToken}` }
184
+ };
185
+ const queryParams = generateQueryParamsStr([
186
+ 'fromDate',
187
+ 'toDate',
188
+ 'pageNum',
189
+ 'limit',
190
+ 'timezone',
191
+ ], params);
192
+ return await axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/paymentLines?${queryParams}`, config);
193
+ } catch (error) {
194
+ console.error('Error fetching getPaymentLinesReport:', error);
195
+ throw error;
196
+ }
197
+ };
198
+
199
+ export const getUnpaidOrdersReport = async function (this: WashdayClientInstance, storeId: string, params: {
200
+ fromDate?: string
201
+ toDate?: string
202
+ timezone?: string
203
+ pageNum?: string
204
+ limit?: string
205
+ customerName?: string
206
+ }): Promise<any> {
207
+ try {
208
+ const config = {
209
+ headers: { Authorization: `Bearer ${this.apiToken}` }
210
+ };
211
+ const queryParams = generateQueryParamsStr([
212
+ 'fromDate',
213
+ 'toDate',
214
+ 'pageNum',
215
+ 'limit',
216
+ 'timezone',
217
+ 'customerName'
218
+ ], params);
219
+ return await axiosInstance.get(`${GET_SET_REPORTS}/${storeId}/unpaidOrders?${queryParams}`, config);
220
+ } catch (error) {
221
+ console.error('Error fetching getUnpaidOrdersReport:', error);
222
+ throw error;
223
+ }
224
+ };
@@ -214,6 +214,9 @@ export interface WashdayClientInstance {
214
214
  exportCustomersReport: typeof csvExportEndpoints.getModule.exportCustomersReport;
215
215
  exportSuppliesReport: typeof csvExportEndpoints.getModule.exportSuppliesReport;
216
216
  exportDiscountCodesReport: typeof csvExportEndpoints.getModule.exportDiscountCodesReport;
217
+ exportProductSalesReport: typeof csvExportEndpoints.getModule.exportProductSalesReport;
218
+ exportPaymentLinesReport: typeof csvExportEndpoints.getModule.exportPaymentLinesReport;
219
+ exportUnpaidOrdersReportCSV: typeof csvExportEndpoints.getModule.exportUnpaidOrdersReportCSV;
217
220
  };
218
221
  pdf: {
219
222
  exportUnpaidOrdersReportPDF: typeof pdfExportEndpoints.getModule.exportUnpaidOrdersReportPDF;
@@ -226,5 +229,8 @@ export interface WashdayClientInstance {
226
229
  getSuppliesReport: typeof reportsExportEndpoints.getModule.getSuppliesReport;
227
230
  getDiscountCodesReport: typeof reportsExportEndpoints.getModule.getDiscountCodesReport;
228
231
  getStaffReport: typeof reportsExportEndpoints.getModule.getStaffReport;
232
+ getProductSalesReport: typeof reportsExportEndpoints.getModule.getProductSalesReport;
233
+ getPaymentLinesReport: typeof reportsExportEndpoints.getModule.getPaymentLinesReport;
234
+ getUnpaidOrdersReport: typeof reportsExportEndpoints.getModule.getUnpaidOrdersReport;
229
235
  };
230
236
  }