@zauru-sdk/hooks 2.0.70 → 2.0.72

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.
@@ -10,7 +10,7 @@ const useGetAutomaticNumber = (AUTOMATIC_NUMBER_NAME) => {
10
10
  const dispatch = (0, redux_1.useAppDispatch)();
11
11
  const objectData = (0, redux_1.useAppSelector)((state) => state.automaticNumbers[AUTOMATIC_NUMBER_NAME]);
12
12
  const [data, setData] = (0, react_2.useState)({
13
- data: Object.keys(objectData?.data).length
13
+ data: objectData?.data && Object.keys(objectData?.data).length
14
14
  ? objectData?.data
15
15
  : {},
16
16
  loading: objectData.loading,
@@ -37,7 +37,7 @@ const useGetAutomaticNumber = (AUTOMATIC_NUMBER_NAME) => {
37
37
  }
38
38
  }, [fetcher, dispatch, AUTOMATIC_NUMBER_NAME]);
39
39
  (0, react_2.useEffect)(() => {
40
- if (Object.keys(objectData?.data).length <= 0) {
40
+ if (objectData?.data && Object.keys(objectData?.data).length <= 0) {
41
41
  try {
42
42
  setData({ ...data, loading: true });
43
43
  dispatch((0, redux_1.automaticNumberFetchStart)(AUTOMATIC_NUMBER_NAME));
@@ -42,9 +42,10 @@ const useGetReceptionObject = (RECEPTION_NAME, { online = false, wheres = [] } =
42
42
  }
43
43
  }, [fetcher, dispatch, RECEPTION_NAME]);
44
44
  (0, react_2.useEffect)(() => {
45
- const isEmptyData = Array.isArray(objectData?.data)
46
- ? objectData?.data.length <= 0
47
- : Object.keys(objectData?.data || {}).length <= 0;
45
+ const isEmptyData = (objectData?.data &&
46
+ Array.isArray(objectData?.data) &&
47
+ objectData?.data.length <= 0) ||
48
+ (objectData?.data && Object.keys(objectData?.data).length <= 0);
48
49
  if (isEmptyData || objectData.reFetch || online) {
49
50
  try {
50
51
  setData({ ...data, loading: true });
@@ -114,8 +115,8 @@ const useGetPesadas = (purchaseOrder, stocks_only_integer = false) => {
114
115
  discount,
115
116
  netWeight: (0, common_1.toFixedIfNeeded)(netWeight)?.toString(),
116
117
  weightByBasket: (0, common_1.toFixedIfNeeded)(weightByBasket)?.toString(),
117
- probableUtilization,
118
- lbDiscounted,
118
+ probableUtilization: (0, common_1.toFixedIfNeeded)(probableUtilization)?.toString(),
119
+ lbDiscounted: (0, common_1.toFixedIfNeeded)(lbDiscounted)?.toString(),
119
120
  };
120
121
  }),
121
122
  ];
@@ -236,8 +237,8 @@ const getPesadasByForm = (formInput, stocks_only_integer = false) => {
236
237
  discount,
237
238
  netWeight: (0, common_1.toFixedIfNeeded)(netWeight)?.toString(),
238
239
  weightByBasket: (0, common_1.toFixedIfNeeded)(weightByBasket)?.toString(),
239
- probableUtilization,
240
- lbDiscounted,
240
+ probableUtilization: (0, common_1.toFixedIfNeeded)(probableUtilization)?.toString(),
241
+ lbDiscounted: (0, common_1.toFixedIfNeeded)(lbDiscounted)?.toString(),
241
242
  });
242
243
  index++;
243
244
  }
@@ -10,7 +10,7 @@ const useGetTemplateObject = (TEMPLATE_NAME, config = { online: false }) => {
10
10
  const dispatch = (0, redux_1.useAppDispatch)();
11
11
  const objectData = (0, redux_1.useAppSelector)((state) => state.templates[TEMPLATE_NAME]);
12
12
  const [data, setData] = (0, react_2.useState)({
13
- data: Object.keys(objectData?.data).length
13
+ data: objectData?.data && Object.keys(objectData?.data).length
14
14
  ? objectData?.data
15
15
  : {},
16
16
  loading: objectData.loading,
@@ -37,7 +37,8 @@ const useGetTemplateObject = (TEMPLATE_NAME, config = { online: false }) => {
37
37
  }
38
38
  }, [fetcher, dispatch, TEMPLATE_NAME]);
39
39
  (0, react_2.useEffect)(() => {
40
- if (Object.keys(objectData?.data).length <= 0 || config?.online) {
40
+ if ((objectData?.data && Object.keys(objectData?.data).length <= 0) ||
41
+ config?.online) {
41
42
  try {
42
43
  setData({ ...data, loading: true });
43
44
  dispatch((0, redux_1.templateFetchStart)(TEMPLATE_NAME));
@@ -44,8 +44,8 @@ type PesadaBody = {
44
44
  discount: number;
45
45
  netWeight: string;
46
46
  weightByBasket: string;
47
- probableUtilization: number;
48
- lbDiscounted: number;
47
+ probableUtilization: string;
48
+ lbDiscounted: string;
49
49
  };
50
50
  export type FooterColumnConfig = {
51
51
  content: React.ReactNode;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zauru-sdk/hooks",
3
- "version": "2.0.70",
3
+ "version": "2.0.72",
4
4
  "description": "Hooks reutilizables dentro de las webapps de Zauru.",
5
5
  "main": "./dist/esm/index.js",
6
6
  "module": "./dist/esm/index.js",
@@ -33,5 +33,5 @@
33
33
  "react": "^18.2.0",
34
34
  "react-dom": "^18.2.0"
35
35
  },
36
- "gitHead": "2e2f60fe8b92286258d82bf004316d9816d30b63"
36
+ "gitHead": "f96d6fbf2ec81f8971e3d32d31fd75f8c057e160"
37
37
  }