@credithub/harlan-components 1.100.0 → 1.100.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,3 +1,14 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
1
12
  var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
2
13
  if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
3
14
  if (ar || !(i in from)) {
@@ -11,30 +22,25 @@ import { useEffect, useRef } from 'react';
11
22
  import { useFetch } from '../webservice';
12
23
  export function useLiminarHistory(_a) {
13
24
  var documento = _a.documento, indicioDeLiminar = _a.indicioDeLiminar, types = _a.types, _b = _a.protestKeys, protestKeys = _b === void 0 ? [] : _b, _c = _a.processIds, processIds = _c === void 0 ? [] : _c, _d = _a.enabled, enabled = _d === void 0 ? true : _d;
25
+ // Usamos any aqui para permitir booleanos e arrays nativos no payload
14
26
  var insertHistory = useFetch("INSERT INTO 'LIMINAR'.'INTERFACE'").fetch;
15
27
  var lastFingerprint = useRef();
16
28
  useEffect(function () {
17
29
  if (!enabled || !documento)
18
30
  return;
19
- var effectiveTypes = indicioDeLiminar ? types : [];
31
+ // Deriva o boolean do conteúdo de types para evitar falsos positivos
32
+ var effectiveTypes = Array.isArray(types) && indicioDeLiminar ? types : [];
33
+ var safeIndicio = effectiveTypes.length > 0;
20
34
  var fingerprint = JSON.stringify({
21
35
  documento: documento,
22
- indicioDeLiminar: indicioDeLiminar,
36
+ indicioDeLiminar: safeIndicio,
23
37
  types: __spreadArray([], effectiveTypes, true).sort(),
24
38
  protestKeys: protestKeys,
25
39
  processIds: processIds
26
40
  });
27
41
  if (fingerprint === lastFingerprint.current)
28
42
  return;
29
- var payload = {
30
- documento: documento,
31
- indicioDeLiminar: indicioDeLiminar ? 'true' : 'false',
32
- types: JSON.stringify(effectiveTypes)
33
- };
34
- if (protestKeys.length)
35
- payload.protestKeys = JSON.stringify(protestKeys);
36
- if (processIds.length)
37
- payload.processIds = JSON.stringify(processIds);
43
+ var payload = __assign(__assign({ documento: documento, indicioDeLiminar: safeIndicio, types: effectiveTypes }, (protestKeys.length ? { protestKeys: protestKeys } : {})), (processIds.length ? { processIds: processIds } : {}));
38
44
  insertHistory(payload);
39
45
  lastFingerprint.current = fingerprint;
40
46
  // eslint-disable-next-line react-hooks/exhaustive-deps