@tesouro/embedded-components-react 0.5.255 → 0.5.257

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.
@@ -14,83 +14,83 @@ import { useReceivableStatusCards as c } from "./useReceivableStatusCards.js";
14
14
  import { useCallback as l, useEffect as u, useMemo as d, useState as f } from "react";
15
15
  //#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivablesTable.js
16
16
  var p = [];
17
- function m({ activeTab: m, initialCounterpartId: g, messages: _, statusLabels: v, filterLabels: y, enabled: b = !0, visible: x = b }) {
18
- let [S, C] = f([]), [w, T] = f(10), [E, D] = f(), [O, k] = f(""), [A, j] = f(""), [M, N] = f("all"), P = m === "invoices", F = l(() => D(void 0), []), I = o({
17
+ function m({ activeTab: m, initialCounterpartId: g, messages: _, statusLabels: y, filterLabels: b, enabled: x = !0, visible: S = x }) {
18
+ let [C, w] = f(() => v(m)), [T, E] = f(10), [D, O] = f(), [k, A] = f(""), [j, M] = f(""), [N, P] = f("all"), F = m === "invoices", I = l(() => O(void 0), []), L = o({
19
19
  initialCounterpartId: g,
20
- search: O,
21
- onSearchChange: k,
22
- onFiltersChange: F,
23
- statusLabels: v,
24
- labels: y
25
- }), L = I.reset;
20
+ search: k,
21
+ onSearchChange: A,
22
+ onFiltersChange: I,
23
+ statusLabels: y,
24
+ labels: b
25
+ }), R = L.reset;
26
26
  u(() => {
27
- D(void 0), N("all"), k(""), j(""), L();
28
- }, [m, L]), u(() => {
27
+ w(v(m)), O(void 0), P("all"), A(""), M(""), R();
28
+ }, [m, R]), u(() => {
29
29
  let e = setTimeout(() => {
30
- j(O), D(void 0);
30
+ M(k), O(void 0);
31
31
  }, 300);
32
32
  return () => clearTimeout(e);
33
- }, [O]);
34
- let R = S[0]?.id, z = R ? h[R] : void 0, B = S[0] ? S[0].desc ? "desc" : "asc" : void 0, V = i({
35
- enabled: b,
33
+ }, [k]);
34
+ let z = C[0]?.id, B = z ? h[z] : void 0, V = C[0] ? C[0].desc ? "desc" : "asc" : void 0, H = i({
35
+ enabled: x,
36
36
  type: r(m),
37
- limit: w,
38
- pagination_token: E,
39
- search_text: A || void 0,
40
- ...P ? I.query : { status: M === "all" ? void 0 : M },
41
- ...z ? {
42
- sort: z,
43
- order: B
37
+ limit: T,
38
+ pagination_token: D,
39
+ search_text: j || void 0,
40
+ ...F ? L.query : { status: N === "all" ? void 0 : N },
41
+ ...B ? {
42
+ sort: B,
43
+ order: V
44
44
  } : {}
45
- }), H = c({
46
- enabled: b && P,
47
- visible: x && P,
48
- statusFilter: I.cardStatus,
45
+ }), U = c({
46
+ enabled: x && F,
47
+ visible: S && F,
48
+ statusFilter: L.cardStatus,
49
49
  messages: _,
50
- statusLabels: v
51
- }), U = V.data?.data ?? p, W = d(() => new Map(U.map((e) => [e.id, e])), [U]), G = l((e) => W.get(e), [W]), { initResponse: K } = e(), q = a(K?.scopes), J = s(U), Y = d(() => t({
52
- receivables: U,
50
+ statusLabels: y
51
+ }), W = H.data?.data ?? p, G = d(() => new Map(W.map((e) => [e.id, e])), [W]), K = l((e) => G.get(e), [G]), { initResponse: q } = e(), J = a(q?.scopes), Y = s(W), X = d(() => t({
52
+ receivables: W,
53
53
  messages: _,
54
- canRecordPayment: q,
55
- customerNames: J
54
+ canRecordPayment: J,
55
+ customerNames: Y
56
56
  }), [
57
- q,
58
57
  J,
58
+ Y,
59
59
  _,
60
- U
61
- ]), X = P ? I.isFiltering : !!A || M !== "all", Z = l((e) => {
62
- let t = typeof e == "function" ? e(S) : e;
63
- C(t), D(void 0);
64
- }, [S]), Q = l((e) => {
65
- T(e), D(void 0);
66
- }, []), $ = l((e) => {
67
- N(e), D(void 0);
68
- }, []), ee = l(() => D(V.data?.next_pagination_token ?? void 0), [V.data?.next_pagination_token]), te = l(() => D(V.data?.prev_pagination_token ?? void 0), [V.data?.prev_pagination_token]), ne = l(() => {
69
- V.refetch();
70
- }, [V]);
60
+ W
61
+ ]), Z = F ? L.isFiltering : !!j || N !== "all", Q = l((e) => {
62
+ let t = typeof e == "function" ? e(C) : e;
63
+ w(t[0] && Object.hasOwn(h, t[0].id) ? t : v(m)), O(void 0);
64
+ }, [m, C]), $ = l((e) => {
65
+ E(e), O(void 0);
66
+ }, []), ee = l((e) => {
67
+ P(e), O(void 0);
68
+ }, []), te = l(() => O(H.data?.next_pagination_token ?? void 0), [H.data?.next_pagination_token]), ne = l(() => O(H.data?.prev_pagination_token ?? void 0), [H.data?.prev_pagination_token]), re = l(() => {
69
+ H.refetch();
70
+ }, [H]);
71
71
  return {
72
- rows: Y,
73
- isLoading: V.isLoading,
74
- isError: V.isError,
75
- sorting: S,
76
- onSortingChange: Z,
77
- pageSize: w,
78
- onPageSizeChange: Q,
79
- hasNextPage: !!V.data?.next_pagination_token,
80
- hasPrevPage: !!V.data?.prev_pagination_token,
81
- onNextPage: ee,
82
- onPrevPage: te,
83
- searchValue: O,
84
- onSearchChange: k,
85
- statusFilter: M,
86
- statusOptions: n(M),
87
- onStatusFilterChange: $,
88
- statusCards: H,
89
- onStatusCardSelect: I.selectStatusCard,
90
- invoicesFilterBar: P ? I.filterBar : void 0,
91
- isFiltering: X,
92
- onRetry: ne,
93
- getReceivableById: G
72
+ rows: X,
73
+ isLoading: H.isLoading,
74
+ isError: H.isError,
75
+ sorting: C,
76
+ onSortingChange: Q,
77
+ pageSize: T,
78
+ onPageSizeChange: $,
79
+ hasNextPage: !!H.data?.next_pagination_token,
80
+ hasPrevPage: !!H.data?.prev_pagination_token,
81
+ onNextPage: te,
82
+ onPrevPage: ne,
83
+ searchValue: k,
84
+ onSearchChange: A,
85
+ statusFilter: N,
86
+ statusOptions: n(N),
87
+ onStatusFilterChange: ee,
88
+ statusCards: U,
89
+ onStatusCardSelect: L.selectStatusCard,
90
+ invoicesFilterBar: F ? L.filterBar : void 0,
91
+ isFiltering: Z,
92
+ onRetry: re,
93
+ getReceivableById: K
94
94
  };
95
95
  }
96
96
  var h = {
@@ -99,6 +99,12 @@ var h = {
99
99
  issueDateLabel: "issue_date",
100
100
  dueDateLabel: "due_date",
101
101
  totalLabel: "total_amount"
102
- };
102
+ }, g = [{
103
+ id: "dueDateLabel",
104
+ desc: !0
105
+ }], _ = [];
106
+ function v(e) {
107
+ return e === "invoices" ? g : _;
108
+ }
103
109
  //#endregion
104
110
  export { m as useReceivablesTable };
@@ -110,6 +110,7 @@ function P({ rows: i, activeTab: o, enabledTabs: s, onTabChange: c, isLoading: l
110
110
  },
111
111
  {
112
112
  accessorKey: "status",
113
+ enableSorting: !0,
113
114
  header: ({ column: e }) => /* @__PURE__ */ y(j, {
114
115
  column: e,
115
116
  label: Q.columnStatus,
@@ -1,5 +1,5 @@
1
1
  //#region ../../libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js
2
- var e = "@tesouro/embedded-components-react", t = "0.5.255", n = "ace9c7b149695d81634438833df5c9878d53aae1", r = Object.freeze({
2
+ var e = "@tesouro/embedded-components-react", t = "0.5.257", n = "4fb4a587e4354567fdfb9440678a653d35260237", r = Object.freeze({
3
3
  library_name: e,
4
4
  library_version: t,
5
5
  library_sha: n
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tesouro/embedded-components-react",
3
- "version": "0.5.255",
3
+ "version": "0.5.257",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "packageDepSync": {