@tesouro/embedded-components-react 0.11.134 → 0.11.135

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.
Files changed (17) hide show
  1. package/dist/index.css +0 -22
  2. package/dist/index.d.ts +12 -1
  3. package/dist/lib/ReceivablesWidget.d.ts +12 -1
  4. package/dist/lib/WidgetSuite.d.ts +12 -1
  5. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/labels.js +8 -0
  6. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/statusCards.js +62 -35
  7. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useInvoicesFilter.js +74 -66
  8. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableStatusCards.js +14 -14
  9. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivablesTable.js +2 -3
  10. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/mocks/invoicing.js +2 -2
  11. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/mocks/receivables.js +4 -4
  12. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index18.js +6 -2
  13. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index59.js +25 -55
  14. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index60.js +4 -1
  15. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  16. package/dist/packages/shared-ui-shadcn/dist/index.js +1055 -1011
  17. package/package.json +1 -1
package/dist/index.css CHANGED
@@ -643,9 +643,6 @@
643
643
  .ttw\:h-16 {
644
644
  height: calc(var(--ttw-spacing) * 16);
645
645
  }
646
- .ttw\:h-16\.5 {
647
- height: calc(var(--ttw-spacing) * 16.5);
648
- }
649
646
  .ttw\:h-20 {
650
647
  height: calc(var(--ttw-spacing) * 20);
651
648
  }
@@ -955,9 +952,6 @@
955
952
  .ttw\:w-40 {
956
953
  width: calc(var(--ttw-spacing) * 40);
957
954
  }
958
- .ttw\:w-42 {
959
- width: calc(var(--ttw-spacing) * 42);
960
- }
961
955
  .ttw\:w-44 {
962
956
  width: calc(var(--ttw-spacing) * 44);
963
957
  }
@@ -1493,9 +1487,6 @@
1493
1487
  .ttw\:scroll-py-1 {
1494
1488
  scroll-padding-block: var(--ttw-spacing);
1495
1489
  }
1496
- .ttw\:\[scrollbar-width\:none\] {
1497
- scrollbar-width: none;
1498
- }
1499
1490
  .ttw\:list-\[circle\] {
1500
1491
  list-style-type: circle;
1501
1492
  }
@@ -1937,9 +1928,6 @@
1937
1928
  .ttw\:border-border {
1938
1929
  border-color: var(--ttw-border);
1939
1930
  }
1940
- .ttw\:border-card {
1941
- border-color: var(--ttw-card);
1942
- }
1943
1931
  .ttw\:border-cyan-200 {
1944
1932
  border-color: var(--ttw-color-cyan-200);
1945
1933
  }
@@ -3933,10 +3921,6 @@
3933
3921
  --tw-leading: calc(var(--ttw-spacing) * 7);
3934
3922
  line-height: calc(var(--ttw-spacing) * 7);
3935
3923
  }
3936
- .ttw\:leading-8 {
3937
- --tw-leading: calc(var(--ttw-spacing) * 8);
3938
- line-height: calc(var(--ttw-spacing) * 8);
3939
- }
3940
3924
  .ttw\:leading-\[0\.83195rem\] {
3941
3925
  --tw-leading: 0.83195rem;
3942
3926
  line-height: 0.83195rem;
@@ -5041,9 +5025,6 @@
5041
5025
  .ttw\:hover\:border-border:hover {
5042
5026
  border-color: var(--ttw-border);
5043
5027
  }
5044
- .ttw\:hover\:border-primary:hover {
5045
- border-color: var(--ttw-primary);
5046
- }
5047
5028
  .ttw\:hover\:border-b-transparent:hover {
5048
5029
  border-bottom-color: transparent;
5049
5030
  }
@@ -6380,9 +6361,6 @@
6380
6361
  border-style: var(--tw-border-style);
6381
6362
  border-width: 0px;
6382
6363
  }
6383
- .ttw\:\[\&\:\:-webkit-scrollbar\]\:hidden::-webkit-scrollbar {
6384
- display: none;
6385
- }
6386
6364
  .ttw\:\[\&\:first-child\[data-selected\=true\]_button\]\:rounded-l-md:first-child[data-selected=true] button {
6387
6365
  border-top-left-radius: calc(var(--ttw-radius) - 2px);
6388
6366
  border-bottom-left-radius: calc(var(--ttw-radius) - 2px);
package/dist/index.d.ts CHANGED
@@ -4378,7 +4378,8 @@ interface ReceivableStatusBadgeLabels {
4378
4378
 
4379
4379
  interface ReceivablesScreenLabels {
4380
4380
  createInvoiceButton: string;
4381
- statusCardsAll: string;
4381
+ statusCardsGroup: string;
4382
+ statusCardsLoading: string;
4382
4383
  columnDueDate: string;
4383
4384
  columnStatus: string;
4384
4385
  columnNumber: string;
@@ -4708,6 +4709,16 @@ interface ReceivableMessageLabels {
4708
4709
  listDaysOverdue: string;
4709
4710
  unknownCustomer: string;
4710
4711
  notAvailable: string;
4712
+ summaryUnpaid: string;
4713
+ summaryOverdue: string;
4714
+ summaryPaid: string;
4715
+ summaryDrafts: string;
4716
+ summaryDraftsCaption: string;
4717
+ /** `{count}` is replaced. */
4718
+ summaryInvoice: string;
4719
+ summaryInvoices: string;
4720
+ /** The amount on a card whose value is not available. */
4721
+ summaryPlaceholder: string;
4711
4722
  invoiceType: string;
4712
4723
  quoteType: string;
4713
4724
  creditNoteType: string;
@@ -1125,7 +1125,8 @@ interface ReceivableStatusBadgeLabels {
1125
1125
 
1126
1126
  interface ReceivablesScreenLabels {
1127
1127
  createInvoiceButton: string;
1128
- statusCardsAll: string;
1128
+ statusCardsGroup: string;
1129
+ statusCardsLoading: string;
1129
1130
  columnDueDate: string;
1130
1131
  columnStatus: string;
1131
1132
  columnNumber: string;
@@ -1455,6 +1456,16 @@ interface ReceivableMessageLabels {
1455
1456
  listDaysOverdue: string;
1456
1457
  unknownCustomer: string;
1457
1458
  notAvailable: string;
1459
+ summaryUnpaid: string;
1460
+ summaryOverdue: string;
1461
+ summaryPaid: string;
1462
+ summaryDrafts: string;
1463
+ summaryDraftsCaption: string;
1464
+ /** `{count}` is replaced. */
1465
+ summaryInvoice: string;
1466
+ summaryInvoices: string;
1467
+ /** The amount on a card whose value is not available. */
1468
+ summaryPlaceholder: string;
1458
1469
  invoiceType: string;
1459
1470
  quoteType: string;
1460
1471
  creditNoteType: string;
@@ -3278,7 +3278,8 @@ interface ReceivableStatusBadgeLabels {
3278
3278
 
3279
3279
  interface ReceivablesScreenLabels {
3280
3280
  createInvoiceButton: string;
3281
- statusCardsAll: string;
3281
+ statusCardsGroup: string;
3282
+ statusCardsLoading: string;
3282
3283
  columnDueDate: string;
3283
3284
  columnStatus: string;
3284
3285
  columnNumber: string;
@@ -3606,6 +3607,16 @@ interface ReceivableMessageLabels {
3606
3607
  listDaysOverdue: string;
3607
3608
  unknownCustomer: string;
3608
3609
  notAvailable: string;
3610
+ summaryUnpaid: string;
3611
+ summaryOverdue: string;
3612
+ summaryPaid: string;
3613
+ summaryDrafts: string;
3614
+ summaryDraftsCaption: string;
3615
+ /** `{count}` is replaced. */
3616
+ summaryInvoice: string;
3617
+ summaryInvoices: string;
3618
+ /** The amount on a card whose value is not available. */
3619
+ summaryPlaceholder: string;
3609
3620
  invoiceType: string;
3610
3621
  quoteType: string;
3611
3622
  creditNoteType: string;
@@ -51,6 +51,14 @@ var e = {
51
51
  listDaysOverdue: "{days} days overdue",
52
52
  unknownCustomer: "-",
53
53
  notAvailable: "Not available",
54
+ summaryUnpaid: "Unpaid",
55
+ summaryOverdue: "Overdue",
56
+ summaryPaid: "Paid",
57
+ summaryDrafts: "Drafts",
58
+ summaryDraftsCaption: "Not sent yet",
59
+ summaryInvoice: "{count} invoice",
60
+ summaryInvoices: "{count} invoices",
61
+ summaryPlaceholder: "—",
54
62
  invoiceType: "Invoice",
55
63
  quoteType: "Quote",
56
64
  creditNoteType: "Credit note",
@@ -1,42 +1,69 @@
1
1
  import { formatMoney as e } from "./helpers.js";
2
2
  // ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/statusCards.js
3
- var t = [
4
- "draft",
5
- "issued",
6
- "overdue",
7
- "partially_paid",
8
- "paid",
9
- "recurring",
10
- "canceled",
11
- "uncollectible"
12
- ];
13
- function n(e) {
14
- let n = t.indexOf(e);
15
- return n === -1 ? t.length : n;
3
+ var t = {
4
+ Unpaid: "unpaid",
5
+ Overdue: "overdue",
6
+ Paid: "paid",
7
+ Drafts: "drafts"
8
+ }, n = {
9
+ [t.Unpaid]: [
10
+ "issued",
11
+ "partially_paid",
12
+ "overdue"
13
+ ],
14
+ [t.Overdue]: ["overdue"],
15
+ [t.Paid]: ["paid"],
16
+ [t.Drafts]: ["draft"]
17
+ };
18
+ function r(e) {
19
+ return Object.hasOwn(n, e);
16
20
  }
17
- function r({ counts: t, amounts: r, statusFilter: i, statusLabels: a, fallback: o }) {
18
- let s = new Map(Object.entries(a)), c = new Map(r.map((e) => [e.dimension_value, e.metric_value])), l = t.flatMap((e) => e.dimension_value ? [{
19
- status: e.dimension_value,
20
- count: e.metric_value
21
- }] : []), u = l.filter(({ status: e }) => e !== "recurring").reduce((e, { count: t }) => e + t, 0);
21
+ function i(e, t) {
22
+ return e.length === t.length && e.every((e) => t.includes(e));
23
+ }
24
+ function a({ counts: r, amountsDue: a, isError: o, selectedStatuses: s, messages: c }) {
25
+ let l = (e, t) => e.filter((e) => e.dimension_value && t.includes(e.dimension_value)).reduce((e, t) => e + t.metric_value, 0), u = (e) => i(s, n[e]), d = (e) => {
26
+ let t = l(r, n[e]);
27
+ return (t === 1 ? c.summaryInvoice : c.summaryInvoices).replace("{count}", String(t));
28
+ }, f = (t, r) => ({
29
+ value: t,
30
+ label: r,
31
+ amountLabel: o ? c.summaryPlaceholder : e({
32
+ amount: l(a, n[t]),
33
+ currency: "USD",
34
+ fallback: c.notAvailable
35
+ }),
36
+ captionLabel: o ? void 0 : d(t),
37
+ selected: u(t)
38
+ });
22
39
  return {
23
40
  kind: "ready",
24
- all: {
25
- value: "all",
26
- countLabel: String(u),
27
- selected: i === "all"
28
- },
29
- statuses: [...l].sort((e, t) => n(e.status) - n(t.status)).map(({ status: t, count: n }) => ({
30
- value: t,
31
- statusLabel: s.get(t) ?? a.unknown,
32
- countLabel: String(n),
33
- amountLabel: e({
34
- amount: c.get(t) ?? 0,
35
- currency: "USD",
36
- fallback: o
37
- }),
38
- selected: i === t
39
- }))
41
+ cards: [
42
+ f(t.Unpaid, c.summaryUnpaid),
43
+ {
44
+ ...f(t.Overdue, c.summaryOverdue),
45
+ labelTone: "destructive"
46
+ },
47
+ {
48
+ value: t.Paid,
49
+ label: c.summaryPaid,
50
+ amountLabel: e({
51
+ amount: 0,
52
+ currency: "USD",
53
+ fallback: c.notAvailable
54
+ }),
55
+ captionLabel: c.summaryInvoices.replace("{count}", "0"),
56
+ selected: !1,
57
+ disabled: !0
58
+ },
59
+ {
60
+ value: t.Drafts,
61
+ label: c.summaryDrafts,
62
+ amountLabel: o ? c.summaryPlaceholder : String(l(r, n[t.Drafts])),
63
+ captionLabel: c.summaryDraftsCaption,
64
+ selected: u(t.Drafts)
65
+ }
66
+ ]
40
67
  };
41
68
  }
42
- export { r as buildReceivableStatusCardsView };
69
+ export { t as ReceivableStatusCard, n as STATUSES_BY_CARD, a as buildReceivableStatusCardsView, r as isReceivableStatusCard, i as isSameStatusSet };
@@ -9,36 +9,44 @@ import "../../../../../shared/counterpart-management/feature/dist/index.js";
9
9
  import { isInvoicesDatePreset as r, resolveInvoicesDatePreset as i } from "./datePresets.js";
10
10
  import { INVOICES_FILTER_FIELDS as a, InvoicesFilterChipKey as o, buildInvoicesDatePresetOptions as s, buildInvoicesFilterChips as c, buildInvoicesFilterQuery as l, buildInvoicesStatusOptions as u, clearInvoicesFilter as d, countActiveInvoiceFilters as f, emptyInvoicesFilterState as p } from "./invoicesFilter.js";
11
11
  import { mergeInvoicesFilterLabels as m } from "./invoicesFilterLabels.js";
12
- import { useCallback as h, useMemo as g, useState as _ } from "react";
12
+ import { STATUSES_BY_CARD as h, isReceivableStatusCard as g, isSameStatusSet as _ } from "./statusCards.js";
13
+ import { useCallback as v, useMemo as y, useState as b } from "react";
13
14
  // ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useInvoicesFilter.js
14
- function v({ initialCounterpartId: v, search: y, onSearchChange: b, onFiltersChange: x, statusLabels: S, labels: C }) {
15
- let w = g(() => m(C), [C]), [T] = _(v), [E, D] = _(() => p(T)), O = e(), { data: k } = n(E.customerId), A = k ? t(k) : "", j = h((e) => {
16
- D((t) => ({
15
+ function x({ initialCounterpartId: x, search: S, onSearchChange: C, onFiltersChange: w, statusLabels: T, labels: E }) {
16
+ let D = y(() => m(E), [E]), [O] = b(x), [k, A] = b(() => p(O)), j = e(), { data: M } = n(k.customerId), N = M ? t(M) : "", P = v((e) => {
17
+ A((t) => ({
17
18
  ...t,
18
19
  ...e
19
- })), x();
20
- }, [x]), M = g(() => l(E), [E]), N = f(E, y), P = g(() => c({
21
- state: E,
22
- search: y,
23
- counterpartName: A,
24
- labels: w,
25
- statusLabels: S
20
+ })), w();
21
+ }, [w]), F = y(() => l(k), [k]), I = f(k, S), L = y(() => c({
22
+ state: k,
23
+ search: S,
24
+ counterpartName: N,
25
+ labels: D,
26
+ statusLabels: T
26
27
  }), [
27
- A,
28
- w,
29
- y,
30
- E,
31
- S
32
- ]), F = g(() => u(S, w), [w, S]), I = g(() => s(w), [w]), L = h((e) => {
33
- e === o.Search ? b("") : (D((t) => d(t, e)), x());
34
- }, [x, b]), R = h(() => {
35
- D(p()), b(""), x();
36
- }, [x, b]), z = h((e) => {
37
- D(p(e)), b(""), x();
38
- }, [x, b]), B = h(() => {
39
- D(p(T));
40
- }, [T]), V = h((e) => j({ statuses: e === "all" ? [] : [e] }), [j]), H = h((e, t) => {
41
- D((n) => ({
28
+ N,
29
+ D,
30
+ S,
31
+ k,
32
+ T
33
+ ]), R = y(() => u(T, D), [D, T]), z = y(() => s(D), [D]), B = v((e) => {
34
+ e === o.Search ? C("") : (A((t) => d(t, e)), w());
35
+ }, [w, C]), V = v(() => {
36
+ A(p()), C(""), w();
37
+ }, [w, C]), H = v((e) => {
38
+ A(p(e)), C(""), w();
39
+ }, [w, C]), U = v(() => {
40
+ A(p(O));
41
+ }, [O]), W = v((e) => {
42
+ if (!g(e)) return;
43
+ let t = h[e];
44
+ A((e) => ({
45
+ ...e,
46
+ statuses: _(e.statuses, t) ? [] : [...t]
47
+ })), w();
48
+ }, [w]), G = v((e, t) => {
49
+ A((n) => ({
42
50
  ...n,
43
51
  dateRanges: {
44
52
  ...n.dateRanges,
@@ -48,11 +56,11 @@ function v({ initialCounterpartId: v, search: y, onSearchChange: b, onFiltersCha
48
56
  to: t.to
49
57
  }
50
58
  }
51
- })), x();
52
- }, [x]), U = h((e, t) => {
59
+ })), w();
60
+ }, [w]), K = v((e, t) => {
53
61
  if (!r(t)) return;
54
62
  let { from: n, to: a } = i(t);
55
- D((r) => ({
63
+ A((r) => ({
56
64
  ...r,
57
65
  dateRanges: {
58
66
  ...r.dateRanges,
@@ -62,48 +70,48 @@ function v({ initialCounterpartId: v, search: y, onSearchChange: b, onFiltersCha
62
70
  to: a
63
71
  }
64
72
  }
65
- })), x();
66
- }, [x]);
73
+ })), w();
74
+ }, [w]);
67
75
  return {
68
76
  filterBar: {
69
77
  fields: a,
70
- searchValue: y,
71
- onSearchChange: b,
72
- isPopoverOpen: O.isMenuOpen || !!O.activePanelId,
73
- isMenuOpen: O.isMenuOpen,
74
- activePanel: O.activePanelId,
75
- onMenuToggle: O.toggleMenu,
78
+ searchValue: S,
79
+ onSearchChange: C,
80
+ isPopoverOpen: j.isMenuOpen || !!j.activePanelId,
81
+ isMenuOpen: j.isMenuOpen,
82
+ activePanel: j.activePanelId,
83
+ onMenuToggle: j.toggleMenu,
76
84
  onPopoverClose: () => {
77
- O.closeMenu(), O.closePanel();
85
+ j.closeMenu(), j.closePanel();
78
86
  },
79
- onFieldSelect: O.openPanel,
80
- activeFilterCount: N,
81
- chips: P,
82
- showClearAll: N > 0,
83
- onRemoveChip: L,
84
- onClearAll: R,
85
- dateRanges: E.dateRanges,
86
- datePresets: I,
87
- onDateRangeChange: H,
88
- onDatePresetChange: U,
89
- statusOptions: F,
90
- selectedStatuses: E.statuses,
91
- onStatusChange: (e) => j({ statuses: e }),
92
- amountMode: E.amountMode,
93
- onAmountModeChange: (e) => j({ amountMode: e }),
94
- amountMin: E.amountMin,
95
- amountMax: E.amountMax,
96
- onAmountMinChange: (e) => j({ amountMin: e }),
97
- onAmountMaxChange: (e) => j({ amountMax: e }),
98
- customerName: E.customerName,
99
- onCustomerNameChange: (e) => j({ customerName: e })
87
+ onFieldSelect: j.openPanel,
88
+ activeFilterCount: I,
89
+ chips: L,
90
+ showClearAll: I > 0,
91
+ onRemoveChip: B,
92
+ onClearAll: V,
93
+ dateRanges: k.dateRanges,
94
+ datePresets: z,
95
+ onDateRangeChange: G,
96
+ onDatePresetChange: K,
97
+ statusOptions: R,
98
+ selectedStatuses: k.statuses,
99
+ onStatusChange: (e) => P({ statuses: e }),
100
+ amountMode: k.amountMode,
101
+ onAmountModeChange: (e) => P({ amountMode: e }),
102
+ amountMin: k.amountMin,
103
+ amountMax: k.amountMax,
104
+ onAmountMinChange: (e) => P({ amountMin: e }),
105
+ onAmountMaxChange: (e) => P({ amountMax: e }),
106
+ customerName: k.customerName,
107
+ onCustomerNameChange: (e) => P({ customerName: e })
100
108
  },
101
- query: M,
102
- isFiltering: N > 0,
103
- cardStatus: E.statuses[0] ?? "all",
104
- selectStatusCard: V,
105
- showCustomer: z,
106
- reset: B
109
+ query: F,
110
+ isFiltering: I > 0,
111
+ selectedStatuses: k.statuses,
112
+ selectStatusCard: W,
113
+ showCustomer: H,
114
+ reset: U
107
115
  };
108
116
  }
109
- export { v as useInvoicesFilter };
117
+ export { x as useInvoicesFilter };
@@ -7,35 +7,35 @@ import "../../../../data-access/dist/index.js";
7
7
  import { buildReceivableStatusCardsView as t } from "./statusCards.js";
8
8
  import { useMemo as n } from "react";
9
9
  // ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableStatusCards.js
10
- function r({ enabled: r, visible: i = r, statusFilter: a, messages: o, statusLabels: s }) {
11
- let c = e({
10
+ function r({ enabled: r, visible: i = r, selectedStatuses: a, messages: o }) {
11
+ let s = e({
12
12
  enabled: r,
13
13
  dimension: "status",
14
14
  metric: "id",
15
15
  aggregation_function: "count",
16
16
  type: "invoice"
17
- }), l = e({
17
+ }), c = e({
18
18
  enabled: r,
19
19
  dimension: "status",
20
- metric: "total_amount",
20
+ metric: "amount_due",
21
21
  aggregation_function: "summary",
22
22
  type: "invoice"
23
- }), u = c.data?.data, d = l.data?.data, f = c.isPending || l.isPending;
23
+ }), l = s.data?.data, u = c.data?.data, d = s.isPending || c.isPending, f = s.isError || c.isError;
24
24
  return n(() => {
25
- if (i) return f ? { kind: "loading" } : t({
26
- counts: u ?? [],
27
- amounts: d ?? [],
28
- statusFilter: a,
29
- statusLabels: s,
30
- fallback: o.notAvailable
25
+ if (i) return d ? { kind: "loading" } : t({
26
+ counts: l ?? [],
27
+ amountsDue: u ?? [],
28
+ isError: f,
29
+ selectedStatuses: a,
30
+ messages: o
31
31
  });
32
32
  }, [
33
- d,
34
33
  u,
34
+ l,
35
35
  f,
36
- o.notAvailable,
36
+ d,
37
+ o,
37
38
  a,
38
- s,
39
39
  i
40
40
  ]);
41
41
  }
@@ -51,9 +51,8 @@ function m({ initialCounterpartId: m, messages: g, statusLabels: _, filterLabels
51
51
  }), R = o({
52
52
  enabled: b,
53
53
  visible: x,
54
- statusFilter: N.cardStatus,
55
- messages: g,
56
- statusLabels: _
54
+ selectedStatuses: N.selectedStatuses,
55
+ messages: g
57
56
  }), z = L.data?.data ?? f, B = u(() => new Map(z.map((e) => [e.id, e])), [z]), V = c((e) => B.get(e), [B]), H = a(z), U = u(() => [...new Set(z.flatMap((e) => e.type === "invoice" && e.status === "recurring" && e.recurrence_id ? [e.recurrence_id] : []))], [z]), W = t(U, { enabled: b }), G = u(() => new Map(U.map((e, t) => {
58
57
  let n = W[t], i = n?.data?.status;
59
58
  return [e, {
@@ -139,8 +139,8 @@ var g = (e) => `00000000-0000-4000-8010-0000000002${String(e).padStart(2, "0")}`
139
139
  [u.prev]: o > 0 ? s(Math.max(0, o - a)) : null
140
140
  };
141
141
  }, j = (e, t) => {
142
- let n = /* @__PURE__ */ new Map(), r = e.get("aggregation_function") === "count";
143
- for (let i of t.filter((t) => O(t, e))) n.set(i.status, (n.get(i.status) ?? 0) + (r ? 1 : i.total_amount ?? 0));
142
+ let n = /* @__PURE__ */ new Map(), r = e.get("aggregation_function") === "count", i = e.get("metric") === "amount_due" ? "amount_due" : "total_amount";
143
+ for (let a of t.filter((t) => O(t, e))) n.set(a.status, (n.get(a.status) ?? 0) + (r ? 1 : a[i] ?? 0));
144
144
  return { data: [...n].map(([e, t]) => ({
145
145
  dimension_value: e,
146
146
  metric_value: t
@@ -191,13 +191,13 @@ function de() {
191
191
  ];
192
192
  }
193
193
  function fe(e, t) {
194
- let n = t.get("type"), r = t.getAll("status__in"), i = t.get("aggregation_function") === "count", a = /* @__PURE__ */ new Map();
194
+ let n = t.get("type"), r = t.getAll("status__in"), i = t.get("aggregation_function") === "count", a = t.get("metric") === "amount_due" ? "amount_due" : "total_amount", o = /* @__PURE__ */ new Map();
195
195
  for (let t of e) {
196
196
  if (n && t.type !== n || r.length && !r.includes(t.status)) continue;
197
- let e = i ? 1 : t.total_amount ?? 0;
198
- a.set(t.status, (a.get(t.status) ?? 0) + e);
197
+ let e = i ? 1 : t[a] ?? 0;
198
+ o.set(t.status, (o.get(t.status) ?? 0) + e);
199
199
  }
200
- return { data: [...a].map(([e, t]) => ({
200
+ return { data: [...o].map(([e, t]) => ({
201
201
  dimension_value: e,
202
202
  metric_value: t
203
203
  })) };
@@ -4,9 +4,13 @@ import { RECEIVABLE_BILLING_SECTION_LABELS_EN as t } from "./index15.js";
4
4
  import { RECEIVABLE_CUSTOMER_SECTION_LABELS_EN as n } from "./index16.js";
5
5
  import { RECEIVABLE_RECURRENCE_EMAIL_DIALOG_LABELS_EN as r, RECEIVABLE_RECURRENCE_SECTION_LABELS_EN as i } from "./index17.js";
6
6
  // ../../libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index18.js
7
- var a = { all: "All invoices" }, o = {
7
+ var a = {
8
+ group: "Invoice summary",
9
+ loading: "Loading invoice summary"
10
+ }, o = {
8
11
  createInvoiceButton: "Create invoice",
9
- statusCardsAll: a.all,
12
+ statusCardsGroup: a.group,
13
+ statusCardsLoading: a.loading,
10
14
  columnDueDate: "Due date",
11
15
  columnStatus: "Status",
12
16
  columnNumber: "Number",
@@ -1,60 +1,30 @@
1
- import { Skeleton as e, cn as t } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
2
- import { ReceivableStatusBadge as n } from "../../../shared/document-status/ui/dist/index7.js";
3
- import "../../../shared/document-status/ui/dist/index.js";
4
- import { RECEIVABLE_STATUS_CARDS_LABELS_EN as r } from "./index18.js";
5
- import { jsx as i, jsxs as a } from "react/jsx-runtime";
1
+ import { Skeleton as e, SummaryCard as t, SummaryCardGroup as n } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
2
+ import { LoadingRegion as r } from "../../../shared/ui/dist/lib/LoadingRegion/LoadingRegion.js";
3
+ import "../../../shared/ui/dist/index.js";
4
+ import { RECEIVABLE_STATUS_CARDS_LABELS_EN as i } from "./index18.js";
5
+ import { jsx as a } from "react/jsx-runtime";
6
6
  // ../../libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index59.js
7
- var o = 6;
8
- function s({ selected: e, onClick: n, children: r }) {
9
- return /* @__PURE__ */ i("button", {
10
- type: "button",
11
- "aria-pressed": e,
12
- onClick: n,
13
- className: t("ttw:flex ttw:w-42 ttw:shrink-0 ttw:cursor-pointer ttw:flex-col ttw:gap-2 ttw:rounded-xl ttw:border ttw:bg-card ttw:px-4 ttw:py-2 ttw:text-left ttw:transition-colors", e ? "ttw:border-primary" : "ttw:border-card ttw:hover:border-primary"),
14
- children: r
15
- });
16
- }
17
- function c({ view: t, onSelect: c, labels: l }) {
7
+ var o = 4;
8
+ function s({ view: s, onSelect: c, labels: l }) {
18
9
  let u = {
19
- ...r,
10
+ ...i,
20
11
  ...l
21
- };
22
- return t.kind === "loading" ? /* @__PURE__ */ i("div", {
23
- className: "ttw:flex ttw:gap-2",
24
- children: Array.from({ length: o }).map((t, n) => /* @__PURE__ */ i(e, { className: "ttw:h-16.5 ttw:w-42 ttw:rounded-xl" }, n))
25
- }) : /* @__PURE__ */ a("div", {
26
- className: "ttw:mb-2 ttw:flex ttw:gap-2 ttw:overflow-x-auto ttw:[scrollbar-width:none] ttw:[&::-webkit-scrollbar]:hidden",
27
- children: [/* @__PURE__ */ a(s, {
28
- selected: t.all.selected,
29
- onClick: () => c(t.all.value),
30
- children: [/* @__PURE__ */ i("span", {
31
- className: "ttw:text-xs ttw:font-medium ttw:text-foreground",
32
- children: u.all
33
- }), /* @__PURE__ */ i("span", {
34
- className: "ttw:text-2xl ttw:font-medium ttw:leading-8 ttw:tabular-nums ttw:text-foreground",
35
- children: t.all.countLabel
36
- })]
37
- }), t.statuses.map((e) => /* @__PURE__ */ i(s, {
38
- selected: e.selected,
39
- onClick: () => c(e.value),
40
- children: /* @__PURE__ */ a("div", {
41
- className: "ttw:flex ttw:flex-col",
42
- children: [/* @__PURE__ */ a("div", {
43
- className: "ttw:flex ttw:items-center ttw:justify-between ttw:gap-2",
44
- children: [/* @__PURE__ */ i(n, {
45
- label: e.statusLabel,
46
- status: e.value,
47
- variant: "filled"
48
- }), /* @__PURE__ */ i("span", {
49
- className: "ttw:text-xs ttw:font-medium ttw:leading-4.5 ttw:tabular-nums ttw:text-foreground",
50
- children: e.countLabel
51
- })]
52
- }), /* @__PURE__ */ i("span", {
53
- className: "ttw:overflow-hidden ttw:text-ellipsis ttw:whitespace-nowrap ttw:text-2xl ttw:font-medium ttw:leading-8 ttw:tabular-nums ttw:text-foreground",
54
- children: e.amountLabel
55
- })]
56
- })
57
- }, e.value))]
12
+ }, d = s.kind === "loading";
13
+ return /* @__PURE__ */ a(r, {
14
+ isLoading: d,
15
+ loadingLabel: u.loading,
16
+ children: /* @__PURE__ */ a(n, {
17
+ "aria-label": u.group,
18
+ children: s.kind === "loading" ? Array.from({ length: o }).map((t, n) => /* @__PURE__ */ a(e, { className: "ttw:h-28 ttw:rounded-lg" }, n)) : s.cards.map((e) => /* @__PURE__ */ a(t, {
19
+ label: e.label,
20
+ labelTone: e.labelTone,
21
+ amount: e.amountLabel,
22
+ caption: e.captionLabel,
23
+ selected: e.selected,
24
+ disabled: e.disabled,
25
+ onClick: () => c(e.value)
26
+ }, e.value))
27
+ })
58
28
  });
59
29
  }
60
- export { c as ReceivableStatusCards, c as default };
30
+ export { s as ReceivableStatusCards, s as default };
@@ -153,7 +153,10 @@ function C({ rows: e, isLoading: n, isError: a, isAccessRestricted: c, sorting:
153
153
  !c && k && A && /* @__PURE__ */ u(l, {
154
154
  view: k,
155
155
  onSelect: A,
156
- labels: { all: R.statusCardsAll }
156
+ labels: {
157
+ group: R.statusCardsGroup,
158
+ loading: R.statusCardsLoading
159
+ }
157
160
  }),
158
161
  c ? /* @__PURE__ */ u(i, {
159
162
  icon: /* @__PURE__ */ u(h, { className: "ttw:size-8 ttw:text-primary" }),