@credithub/harlan-components 1.16.1 → 1.16.2

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.
@@ -1,11 +1,12 @@
1
1
  /* eslint-disable react-hooks/exhaustive-deps */
2
2
  import { useMemo, useContext } from "react";
3
- import { encontrarDataMaisRecente, somarQuantidades, somarValoresTotais, } from "../../../utils/calculation";
3
+ import { encontrarDataMaisRecente, } from "../../../utils/calculation";
4
4
  import { Queries, RequestStatus } from "../../../components/webservice";
5
5
  import XPathUtils from "../../../utils/xpath";
6
+ import { last } from "lodash";
6
7
  export var useCalculation = function (itens) {
7
- var quantidade = useMemo(function () { return somarQuantidades(itens); }, [itens]);
8
- var valorTotal = useMemo(function () { return somarValoresTotais(itens); }, [itens]);
8
+ var quantidade = useMemo(function () { var _a; return ((_a = last(itens)) === null || _a === void 0 ? void 0 : _a.quantidade) || 0; }, [itens]);
9
+ var valorTotal = useMemo(function () { var _a; return ((_a = last(itens)) === null || _a === void 0 ? void 0 : _a.valorTotal) || 0; }, [itens]);
9
10
  var dataMaisRecente = useMemo(function () { return encontrarDataMaisRecente(itens); }, [itens]);
10
11
  return { quantidade: quantidade, valorTotal: valorTotal, dataMaisRecente: dataMaisRecente };
11
12
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@credithub/harlan-components",
3
- "version": "1.16.1",
3
+ "version": "1.16.2",
4
4
  "description": "Provide a set of web components to be used in Harlan and other projects",
5
5
  "keywords": [
6
6
  "harlan",