washday-sdk 0.0.119 → 0.0.120

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.
@@ -63,7 +63,7 @@ export const downloadCFDIPDF = function (id) {
63
63
  return yield axiosInstance.get(`${GET_SET_CFDI}/${id}/download/pdf`, config);
64
64
  }
65
65
  catch (error) {
66
- console.error('Error fetching exportCustomersList:', error);
66
+ console.error('Error fetching downloadCFDIPDF:', error);
67
67
  throw error;
68
68
  }
69
69
  });
package/dist/api/index.js CHANGED
@@ -27,6 +27,7 @@ import * as sectionsEndpoints from './sections';
27
27
  import * as productsEndpoints from './products';
28
28
  import * as customersEndpoints from './customers';
29
29
  import * as csvExportEndpoints from './csv';
30
+ import * as pdfExportEndpoints from './pdf';
30
31
  import * as ordersEndpoints from './order';
31
32
  import * as authEndpoints from './auth';
32
33
  import * as routesEndpoints from './routes';
@@ -210,5 +211,8 @@ const WashdayClient = function WashdayClient(apiToken) {
210
211
  exportOrdersList: csvExportEndpoints.getModule.exportOrdersList,
211
212
  exportProductsList: csvExportEndpoints.getModule.exportProductsList
212
213
  });
214
+ this.pdf = bindMethods(this, {
215
+ exportUnpaidOrdersReportPDF: pdfExportEndpoints.getModule.exportUnpaidOrdersReportPDF,
216
+ });
213
217
  };
214
218
  export default WashdayClient;
@@ -0,0 +1,42 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { generateQueryParamsStr } from "../../utils/apiUtils";
11
+ import axiosInstance from "../axiosInstance";
12
+ const GENERATE_EXPORT = 'api/export';
13
+ export const exportUnpaidOrdersReportPDF = function (storeId, params) {
14
+ return __awaiter(this, void 0, void 0, function* () {
15
+ try {
16
+ const config = {
17
+ headers: {
18
+ Authorization: `Bearer ${this.apiToken}`,
19
+ },
20
+ params: {
21
+ responseType: 'blob'
22
+ },
23
+ // responseType: 'blob', // Important for handling the PDF blob response
24
+ };
25
+ const queryParams = generateQueryParamsStr(['store', 'fromDate', 'toDate', 'timezone', 'customerName'], params);
26
+ return yield axiosInstance.get(`${GENERATE_EXPORT}/${storeId}/export-unpaid-orders-report/pdf?${queryParams}`, config);
27
+ // // Create a link element, trigger a download
28
+ // const url = window.URL.createObjectURL(new Blob([response.data]));
29
+ // const link = document.createElement('a');
30
+ // link.href = url;
31
+ // link.setAttribute('download', 'Reporte_Pedidos_Pago_Pendiente.pdf'); // Change the filename here if needed
32
+ // document.body.appendChild(link);
33
+ // link.click();
34
+ // link.remove();
35
+ // return response.data;
36
+ }
37
+ catch (error) {
38
+ console.error('Error fetching exportUnpaidOrdersReportPDF:', error);
39
+ throw error;
40
+ }
41
+ });
42
+ };
@@ -0,0 +1 @@
1
+ export * as getModule from './get';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "washday-sdk",
3
- "version": "0.0.119",
3
+ "version": "0.0.120",
4
4
  "description": "Washday utilities functions and API",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -59,7 +59,7 @@ export const downloadCFDIPDF = async function (this: WashdayClientInstance, id:
59
59
  };
60
60
  return await axiosInstance.get(`${GET_SET_CFDI}/${id}/download/pdf`, config);
61
61
  } catch (error) {
62
- console.error('Error fetching exportCustomersList:', error);
62
+ console.error('Error fetching downloadCFDIPDF:', error);
63
63
  throw error;
64
64
  }
65
65
  };
package/src/api/index.ts CHANGED
@@ -28,6 +28,7 @@ import * as sectionsEndpoints from './sections';
28
28
  import * as productsEndpoints from './products';
29
29
  import * as customersEndpoints from './customers';
30
30
  import * as csvExportEndpoints from './csv';
31
+ import * as pdfExportEndpoints from './pdf';
31
32
  import * as ordersEndpoints from './order';
32
33
  import * as authEndpoints from './auth';
33
34
  import * as routesEndpoints from './routes';
@@ -216,6 +217,9 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
216
217
  exportOrdersList: csvExportEndpoints.getModule.exportOrdersList,
217
218
  exportProductsList: csvExportEndpoints.getModule.exportProductsList
218
219
  });
220
+ this.pdf = bindMethods(this, {
221
+ exportUnpaidOrdersReportPDF: pdfExportEndpoints.getModule.exportUnpaidOrdersReportPDF,
222
+ });
219
223
  } as any;
220
224
 
221
225
  export default WashdayClient;
@@ -0,0 +1,42 @@
1
+ import { WashdayClientInstance } from "../../interfaces/Api";
2
+ import { generateQueryParamsStr } from "../../utils/apiUtils";
3
+ import axiosInstance from "../axiosInstance";
4
+
5
+ const GENERATE_EXPORT = 'api/export';
6
+
7
+ export const exportUnpaidOrdersReportPDF = async function (this: WashdayClientInstance, storeId: string, params: {
8
+ store: string | undefined,
9
+ fromDate: string | undefined,
10
+ toDate: string | undefined,
11
+ timezone: string | undefined,
12
+ customerName: string | undefined,
13
+ }): Promise<any> {
14
+ try {
15
+ const config = {
16
+ headers: {
17
+ Authorization: `Bearer ${this.apiToken}`,
18
+ },
19
+ params: {
20
+ responseType: 'blob'
21
+ },
22
+ // responseType: 'blob', // Important for handling the PDF blob response
23
+ };
24
+
25
+ const queryParams = generateQueryParamsStr(['store', 'fromDate', 'toDate', 'timezone', 'customerName'], params);
26
+ return await axiosInstance.get(`${GENERATE_EXPORT}/${storeId}/export-unpaid-orders-report/pdf?${queryParams}`, config);
27
+
28
+ // // Create a link element, trigger a download
29
+ // const url = window.URL.createObjectURL(new Blob([response.data]));
30
+ // const link = document.createElement('a');
31
+ // link.href = url;
32
+ // link.setAttribute('download', 'Reporte_Pedidos_Pago_Pendiente.pdf'); // Change the filename here if needed
33
+ // document.body.appendChild(link);
34
+ // link.click();
35
+ // link.remove();
36
+
37
+ // return response.data;
38
+ } catch (error) {
39
+ console.error('Error fetching exportUnpaidOrdersReportPDF:', error);
40
+ throw error;
41
+ }
42
+ };
@@ -0,0 +1 @@
1
+ export * as getModule from './get';
@@ -27,6 +27,7 @@ import * as sectionsEndpoints from '../api/sections';
27
27
  import * as productsEndpoints from '../api/products';
28
28
  import * as customersEndpoints from '../api/customers';
29
29
  import * as csvExportEndpoints from '../api/csv';
30
+ import * as pdfExportEndpoints from '../api/pdf';
30
31
  import * as ordersEndpoints from '../api/order';
31
32
  import * as routesEndpoints from '../api/routes';
32
33
  import * as reviewsEndpoints from '../api/reviews';
@@ -200,4 +201,7 @@ export interface WashdayClientInstance {
200
201
  csv: {
201
202
  exportCustomersList: typeof csvExportEndpoints.getModule.exportCustomersList;
202
203
  };
204
+ pdf: {
205
+ exportUnpaidOrdersReportPDF: typeof pdfExportEndpoints.getModule.exportUnpaidOrdersReportPDF;
206
+ };
203
207
  }