washday-sdk 0.0.179 → 0.0.181

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.
@@ -13,11 +13,12 @@ const GET_SET_ORDER = 'api/v2/order';
13
13
  const GET_SET_ORDER_CFDI = 'api/v2/orders';
14
14
  const GET_HEADER_SUMMARY = 'api/orderHeaderSummary';
15
15
  const GET_SET_ORDER_CUSTOMERS_APP = 'api/v2/washdayapp/orders';
16
- export const getList = function (params) {
16
+ export const getList = function (params, options) {
17
17
  return __awaiter(this, void 0, void 0, function* () {
18
18
  try {
19
19
  const config = {
20
- headers: { Authorization: `Bearer ${this.apiToken}` }
20
+ headers: { Authorization: `Bearer ${this.apiToken}` },
21
+ signal: (options === null || options === void 0 ? void 0 : options.signal) || params.signal || undefined
21
22
  };
22
23
  const queryParams = generateQueryParamsStr([
23
24
  'store',
@@ -40,6 +41,7 @@ export const getList = function (params) {
40
41
  'pickupToDate',
41
42
  'deliveryFromDate',
42
43
  'deliveryToDate',
44
+ 'fetchSection',
43
45
  ], params);
44
46
  // ], { ...params, q: params.q ? encodeURIComponent(params.q) : undefined });
45
47
  return yield axiosInstance.get(`${GET_SET_ORDER}?${queryParams}`, config);
@@ -68,13 +70,17 @@ export const getOrdersHeaderSummary = function (params) {
68
70
  }
69
71
  });
70
72
  };
71
- export const getById = function (id) {
73
+ export const getById = function (id, params, options) {
72
74
  return __awaiter(this, void 0, void 0, function* () {
73
75
  try {
74
76
  const config = {
75
- headers: { Authorization: `Bearer ${this.apiToken}` }
77
+ headers: { Authorization: `Bearer ${this.apiToken}` },
78
+ signal: (options === null || options === void 0 ? void 0 : options.signal) || undefined
76
79
  };
77
- return yield axiosInstance.get(`${GET_SET_ORDER}/${id}`, config);
80
+ const queryParams = generateQueryParamsStr([
81
+ 'fetchSection',
82
+ ], params);
83
+ return yield axiosInstance.get(`${GET_SET_ORDER}/${id}?${queryParams}`, config);
78
84
  }
79
85
  catch (error) {
80
86
  console.error('Error fetching:', error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "washday-sdk",
3
- "version": "0.0.179",
3
+ "version": "0.0.181",
4
4
  "description": "Washday utilities functions and API",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -17,7 +17,7 @@ export const getList = async function (this: WashdayClientInstance, params: {
17
17
  limit: string
18
18
  pageNum: string
19
19
  signal?: GenericAbortSignal
20
- }, options?: { signal?: AbortSignal }): Promise<any> {
20
+ }, options?: { signal?: GenericAbortSignal }): Promise<any> {
21
21
  try {
22
22
  const config = {
23
23
  headers: { Authorization: `Bearer ${this.apiToken}` },
@@ -1,3 +1,4 @@
1
+ import { GenericAbortSignal } from "axios";
1
2
  import { WashdayClientInstance } from "../../interfaces/Api";
2
3
  import { IOrder } from "../../interfaces/Order";
3
4
  import { generateQueryParamsStr } from "../../utils/apiUtils";
@@ -28,11 +29,13 @@ export const getList = async function (this: WashdayClientInstance, params: {
28
29
  pickupToDate: string | undefined,
29
30
  deliveryFromDate: string | undefined,
30
31
  deliveryToDate: string | undefined,
31
-
32
- }): Promise<any> {
32
+ signal?: GenericAbortSignal,
33
+ fetchSection?: string,
34
+ }, options?: { signal?: GenericAbortSignal }): Promise<any> {
33
35
  try {
34
36
  const config = {
35
- headers: { Authorization: `Bearer ${this.apiToken}` }
37
+ headers: { Authorization: `Bearer ${this.apiToken}` },
38
+ signal: options?.signal || params.signal || undefined
36
39
  };
37
40
  const queryParams = generateQueryParamsStr([
38
41
  'store',
@@ -55,6 +58,7 @@ export const getList = async function (this: WashdayClientInstance, params: {
55
58
  'pickupToDate',
56
59
  'deliveryFromDate',
57
60
  'deliveryToDate',
61
+ 'fetchSection',
58
62
  ], params);
59
63
  // ], { ...params, q: params.q ? encodeURIComponent(params.q) : undefined });
60
64
  return await axiosInstance.get(`${GET_SET_ORDER}?${queryParams}`, config);
@@ -84,12 +88,18 @@ export const getOrdersHeaderSummary = async function (this: WashdayClientInstanc
84
88
  }
85
89
  };
86
90
 
87
- export const getById = async function (this: WashdayClientInstance, id: string): Promise<IOrder> {
91
+ export const getById = async function (this: WashdayClientInstance, id: string, params?: {
92
+ fetchSection?: string,
93
+ }, options?: { signal?: GenericAbortSignal }): Promise<IOrder> {
88
94
  try {
89
95
  const config = {
90
- headers: { Authorization: `Bearer ${this.apiToken}` }
96
+ headers: { Authorization: `Bearer ${this.apiToken}` },
97
+ signal: options?.signal || undefined
91
98
  };
92
- return await axiosInstance.get(`${GET_SET_ORDER}/${id}`, config);
99
+ const queryParams = generateQueryParamsStr([
100
+ 'fetchSection',
101
+ ], params);
102
+ return await axiosInstance.get(`${GET_SET_ORDER}/${id}?${queryParams}`, config);
93
103
  } catch (error) {
94
104
  console.error('Error fetching:', error);
95
105
  throw error;