@tesouro/embedded-components-react 0.5.169 → 0.5.170

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 (129) hide show
  1. package/dist/index.css +39 -17
  2. package/dist/index.js +1 -1
  3. package/dist/lib/BillPayWidget.js +1 -1
  4. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index.js +11 -11
  5. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index17.js +95 -80
  6. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index7.js +37 -11
  7. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js +13 -15
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index10.js +56 -67
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index11.js +4 -43
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index12.js +6 -115
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index13.js +202 -63
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index14.js +2 -4
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index15.js +1 -1
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index19.js +84 -4
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index20.js +3 -84
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index21.js +5 -4
  17. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index22.js +4 -5
  18. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index23.js +32 -3
  19. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index24.js +36 -30
  20. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index25.js +167 -35
  21. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index26.js +40 -164
  22. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index27.js +1 -49
  23. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index28.js +50 -1
  24. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index29.js +11 -45
  25. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index30.js +8 -13
  26. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index31.js +14 -8
  27. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index32.js +59 -7
  28. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index33.js +8 -64
  29. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index34.js +24 -8
  30. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index35.js +150 -18
  31. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index36.js +9 -152
  32. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index37.js +25 -9
  33. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index38.js +19 -21
  34. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index39.js +32 -14
  35. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index40.js +14 -39
  36. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index41.js +8 -16
  37. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index42.js +4 -8
  38. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index43.js +98 -4
  39. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index44.js +68 -83
  40. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index45.js +3 -83
  41. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index46.js +143 -3
  42. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index47.js +44 -143
  43. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index48.js +114 -45
  44. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index49.js +189 -111
  45. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index5.js +13 -0
  46. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index50.js +72 -186
  47. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index51.js +31 -76
  48. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index52.js +89 -32
  49. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index53.js +406 -83
  50. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index54.js +12 -411
  51. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index55.js +84 -12
  52. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index56.js +67 -72
  53. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index57.js +222 -73
  54. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index58.js +37 -223
  55. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index59.js +245 -37
  56. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index6.js +5 -23
  57. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index60.js +23 -252
  58. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index61.js +626 -21
  59. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index62.js +4 -586
  60. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index63.js +45 -4
  61. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index64.js +256 -41
  62. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index65.js +3 -263
  63. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index66.js +4 -3
  64. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index67.js +44 -2
  65. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index68.js +1 -46
  66. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index69.js +8 -1
  67. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index7.js +22 -57
  68. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index70.js +11 -6
  69. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index71.js +130 -11
  70. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index72.js +3 -132
  71. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index73.js +6 -3
  72. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index74.js +129 -3
  73. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index75.js +8 -124
  74. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index76.js +7 -8
  75. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index77.js +82 -8
  76. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index78.js +19 -48
  77. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index79.js +20 -21
  78. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index8.js +14 -6
  79. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index80.js +28 -19
  80. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index81.js +82 -27
  81. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index82.js +47 -83
  82. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index83.js +260 -47
  83. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index84.js +24 -251
  84. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index85.js +382 -25
  85. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index86.js +294 -144
  86. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index87.js +4 -223
  87. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index88.js +7 -4
  88. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index89.js +112 -5
  89. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index9.js +37 -5
  90. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index90.js +1 -114
  91. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index91.js +26 -0
  92. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index.js +18 -21
  93. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index100.js +126 -10
  94. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index101.js +1 -105
  95. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index102.js +33 -2
  96. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index103.js +7 -28
  97. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index104.js +126 -73
  98. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index105.js +1 -1
  99. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index106.js +11 -30
  100. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index107.js +106 -8
  101. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index108.js +2 -181
  102. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index109.js +10 -2
  103. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index110.js +50 -12
  104. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index111.js +2 -108
  105. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index38.js +6 -0
  106. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index46.js +8 -4
  107. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index73.js +8 -1
  108. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index74.js +154 -23
  109. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index83.js +1 -0
  110. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index84.js +343 -250
  111. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index90.js +5 -123
  112. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index91.js +28 -26
  113. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index92.js +2 -94
  114. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index93.js +7 -2
  115. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index94.js +32 -5
  116. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index95.js +2 -30
  117. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index96.js +12 -2
  118. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index97.js +104 -5
  119. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index98.js +2 -34
  120. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index99.js +31 -2
  121. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  122. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index8.js +1 -1
  123. package/dist/packages/shared-ui-shadcn/dist/index.js +2458 -2284
  124. package/package.json +2 -1
  125. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index92.js +0 -27
  126. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index112.js +0 -2
  127. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index113.js +0 -10
  128. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index114.js +0 -52
  129. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index115.js +0 -2
@@ -1,73 +1,62 @@
1
- "use client";
2
- "use client";
3
- "use client";
4
- "use client";
5
- import { formatCalendarDate as e } from "../../../shared/util/dist/lib/formatCalendarDate.js";
6
- import { formatMoneyExact as t } from "../../../shared/util/dist/lib/formatMoneyExact.js";
7
- import { suspectedPayableDuplicates as n } from "../../data-access/dist/index7.js";
8
- import { useAllSuspectedDuplicatePayablesQuery as r, usePayablesQuery as i } from "../../data-access/dist/index17.js";
9
- import "../../data-access/dist/index.js";
10
- import { groupSuspectedDuplicates as a } from "./index6.js";
11
- import { derivePayableStatus as o } from "./index7.js";
12
- import { payableRemoval as s } from "./index9.js";
13
- import { resolveVendorName as c } from "./index8.js";
14
- import { useMemo as l } from "react";
15
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index10.js
16
- function u(e) {
17
- return e.isError && e.data === void 0;
2
+ var e = /* @__PURE__ */ new Set([
3
+ "new",
4
+ "approve_in_progress",
5
+ "waiting_to_be_paid",
6
+ "partially_paid"
7
+ ]);
8
+ function t(t) {
9
+ return !!(t && e.has(t));
18
10
  }
19
- function d(e, n) {
20
- return e == null ? "" : t(e / 100, { currencyCode: n ?? "USD" });
11
+ function n(e, t) {
12
+ let n = /* @__PURE__ */ new Date(`${e.slice(0, 10)}T00:00:00Z`), r = Date.UTC(t.getUTCFullYear(), t.getUTCMonth(), t.getUTCDate());
13
+ return n.getTime() < r;
21
14
  }
22
- function f(t) {
23
- let r = t.status ? o({
24
- apiStatus: t.status,
25
- dueDate: t.due_date,
26
- scheduledPaymentDate: t.scheduled_payment_date
27
- }) : void 0;
28
- return {
29
- id: t.id,
30
- status: r?.status,
31
- statusTone: r?.tone,
32
- matches: n(t).map((e) => ({
33
- matchId: e.id,
34
- matchedPayableId: e.matched_payable_id
35
- })),
36
- removeBy: s(t.status),
37
- vendorLabel: c(t),
38
- invoiceNumberLabel: t.document_id ?? "",
39
- amountLabel: d(t.total_amount ?? t.amount_due, t.currency),
40
- dueDateLabel: e(t.due_date),
41
- addedOnLabel: e(t.created_at?.slice(0, 10))
42
- };
43
- }
44
- function p(e) {
45
- return a(e).map(({ members: e }) => e).filter((e) => e.length > 1).map((e) => ({
46
- id: e[0].id,
47
- vendorLabel: e.map(c).find(Boolean) ?? "",
48
- bills: e.map(f)
49
- }));
50
- }
51
- function m({ enabled: e = !0 } = {}) {
52
- let t = r({ enabled: e }), n = t.data?.data;
53
- return {
54
- groups: l(() => p(n ?? []), [n]),
55
- isLoading: t.isLoading,
56
- isError: u(t)
57
- };
58
- }
59
- function h({ enabled: e = !0 } = {}) {
60
- let t = i({
61
- duplicate_match_status: "suspected",
62
- limit: 100,
63
- enabled: e
64
- });
65
- return {
66
- count: t.data?.data?.length ?? 0,
67
- isCapped: !!t.data?.next_pagination_token,
68
- isError: u(t),
69
- isLoading: t.isLoading
15
+ function r({ apiStatus: t, dueDate: r, scheduledPaymentDate: i, hasScheduledPayment: a = !!i, now: o = /* @__PURE__ */ new Date() }) {
16
+ if (e.has(t) && a) return {
17
+ status: "scheduled",
18
+ tone: "committed",
19
+ isOverdue: !1
70
20
  };
21
+ let s = !!(e.has(t) && r && n(r, o));
22
+ switch (t) {
23
+ case "draft": return {
24
+ status: "draft",
25
+ tone: "neutral",
26
+ isOverdue: s
27
+ };
28
+ case "new": return {
29
+ status: "ready_to_submit",
30
+ tone: "accent",
31
+ isOverdue: s
32
+ };
33
+ case "approve_in_progress": return {
34
+ status: "pending_approval",
35
+ tone: "info",
36
+ isOverdue: s
37
+ };
38
+ case "waiting_to_be_paid":
39
+ case "partially_paid": return {
40
+ status: "ready_to_pay",
41
+ tone: "success",
42
+ isOverdue: s
43
+ };
44
+ case "paid": return {
45
+ status: "paid",
46
+ tone: "settled",
47
+ isOverdue: s
48
+ };
49
+ case "canceled": return {
50
+ status: "canceled",
51
+ tone: "neutral",
52
+ isOverdue: s
53
+ };
54
+ case "rejected": return {
55
+ status: "rejected",
56
+ tone: "danger",
57
+ isOverdue: s
58
+ };
59
+ }
71
60
  }
72
61
  //#endregion
73
- export { m as useDuplicateBills, h as useDuplicateBillsCount };
62
+ export { r as derivePayableStatus, t as hasUnpaidBalance };
@@ -1,46 +1,7 @@
1
- "use client";
2
- "use client";
3
- "use client";
4
- "use client";
5
- import { useCallback as e, useEffect as t, useState as n } from "react";
6
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index11.js
7
- function r({ reviewIds: r }) {
8
- let [i, a] = n(/* @__PURE__ */ new Set());
9
- t(() => {
10
- let e = new Set(r);
11
- a((t) => {
12
- let n = new Set([...t].filter((t) => e.has(t)));
13
- return n.size === t.size ? t : n;
14
- });
15
- }, [r]);
16
- let o = e((e) => {
17
- a((t) => {
18
- let n = new Set(t);
19
- return n.delete(e) || n.add(e), n;
20
- });
21
- }, []), s = e((e) => {
22
- a((t) => {
23
- let n = new Set(t), r = e.every((e) => n.has(e));
24
- return e.forEach((e) => {
25
- r ? n.delete(e) : n.add(e);
26
- }), n;
27
- });
28
- }, []), c = e((e) => {
29
- a((t) => {
30
- let n = new Set(t);
31
- return e.forEach((e) => n.delete(e)), n;
32
- });
33
- }, []);
34
- return {
35
- isSelected: e((e) => i.has(e), [i]),
36
- toggle: o,
37
- toggleAll: s,
38
- checkedState: e((e) => {
39
- let t = e.filter((e) => i.has(e)).length;
40
- return t === 0 ? !1 : t === e.length || "indeterminate";
41
- }, [i]),
42
- deselect: c
43
- };
2
+ var e = /* @__PURE__ */ new Set(["draft", "new"]);
3
+ function t(t) {
4
+ return !!(t && e.has(t));
44
5
  }
45
6
  //#endregion
46
- export { r as useDuplicateBillsSelection };
7
+ export { t as isEditablePayableStatus };
@@ -1,118 +1,9 @@
1
- "use client";
2
- "use client";
3
- "use client";
4
- "use client";
5
- import { toast as e } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
6
- import "../../../shared/ui/dist/index.js";
7
- import { DUPLICATE_BILLS_LABELS_EN as t } from "./index5.js";
8
- import { DuplicateVerdict as n, useApplyDuplicateVerdictsMutation as r } from "../../data-access/dist/index7.js";
9
- import "../../data-access/dist/index.js";
10
- import { useDuplicateBills as i } from "./index10.js";
11
- import { useDuplicateBillsSelection as a } from "./index11.js";
12
- import { DuplicateBillsDialog as o } from "../../ui/dist/index92.js";
13
- import "../../ui/dist/index.js";
14
- import { useEffect as s, useMemo as c, useState as l } from "react";
15
- import { jsx as u } from "react/jsx-runtime";
16
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index12.js
17
- var d = "";
18
- function f({ open: f, onOpenChange: p, enabled: m = !0, canManageDuplicates: h = !0, onOpenBill: g, labels: _, dialogLabels: v }) {
19
- let y = c(() => ({
20
- ...t,
21
- ..._
22
- }), [_]), b = _?.allResolvedToast ?? t.allResolvedToast, x = i({ enabled: m }), S = c(() => x.groups.flatMap((e) => e.bills.map((e) => e.id)), [x.groups]), C = a({ reviewIds: S }), w = r(), [T, E] = l(), [D, O] = l(!1), [k, A] = l(), j = c(() => {
23
- let [e] = x.groups;
24
- if (e) {
25
- if (!k) return e.id;
26
- if (k.id !== d) return x.groups.some((e) => e.id === k.id) ? k.id : (x.groups[k.index] ?? x.groups[x.groups.length - 1]).id;
27
- }
28
- }, [k, x.groups]);
29
- s(() => {
30
- if (!f) {
31
- O(!1);
32
- return;
33
- }
34
- !D || x.isLoading || x.isError || x.groups.length > 0 || (e.success(b), p(!1));
35
- }, [
36
- b,
37
- D,
38
- p,
39
- f,
40
- x.groups.length,
41
- x.isError,
42
- x.isLoading
43
- ]);
44
- let M = (e) => e.bills.filter((e) => C.isSelected(e.id)), N = async (t, n, r, i) => {
45
- let a = M(t);
46
- if (a.length === 0) throw Error("Duplicate review action taken with no bills selected — keeping and removing both need a subject.");
47
- let o = a.flatMap((e) => e.matches.map((t) => ({
48
- payableId: e.id,
49
- duplicateId: t.matchId,
50
- matchedPayableId: t.matchedPayableId,
51
- removeBy: e.removeBy
52
- })));
53
- E({
54
- groupId: t.id,
55
- action: r
56
- });
57
- try {
58
- await w.mutateAsync({
59
- verdict: n,
60
- targets: o
61
- }), e.success(i), O(!0), C.deselect(a.map((e) => e.id));
62
- } catch {
63
- e.error(y.verdictFailedToast);
64
- } finally {
65
- E(void 0);
66
- }
67
- }, P = x.groups.map((e) => {
68
- let t = e.bills.map((e) => e.id), r = M(e), i = {
69
- vendorLabel: e.vendorLabel,
70
- count: e.bills.length
71
- };
72
- return {
73
- id: e.id,
74
- titleLabel: e.vendorLabel,
75
- countLabel: String(e.bills.length),
76
- accessibleLabel: y.reviewGroup(i),
77
- selectAllLabel: y.selectGroup(i),
78
- selectAllChecked: C.checkedState(t),
79
- onToggleAllRows: () => C.toggleAll(t),
80
- rows: e.bills.map((e) => ({
81
- id: e.id,
82
- status: e.status,
83
- statusTone: e.statusTone,
84
- removalOutcome: e.removeBy === "delete" || e.removeBy === "cancel" ? e.removeBy : void 0,
85
- invoiceNumberLabel: e.invoiceNumberLabel,
86
- amountLabel: e.amountLabel,
87
- dueDateLabel: e.dueDateLabel,
88
- addedOnLabel: e.addedOnLabel,
89
- selectLabel: y.selectRow(e),
90
- openLabel: y.openRow(e),
91
- isSelected: C.isSelected(e.id),
92
- onToggleSelected: () => C.toggle(e.id),
93
- onOpen: () => g?.(e.id)
94
- })),
95
- onKeepSelected: h ? () => void N(e, n.Keep, "keep", y.dismissedToast) : void 0,
96
- onRemoveDuplicates: h ? () => void N(e, n.Remove, "remove", y.removedToast) : void 0,
97
- isActionDisabled: r.length === 0,
98
- isRemoveUnavailable: r.some((e) => !e.removeBy),
99
- pendingAction: T?.groupId === e.id ? T.action : void 0
100
- };
101
- });
102
- return /* @__PURE__ */ u(o, {
103
- open: f,
104
- onOpenChange: p,
105
- groups: P,
106
- isLoading: x.isLoading,
107
- isError: x.isError,
108
- expandedGroupId: j,
109
- onExpandedGroupChange: (e) => A({
110
- id: e,
111
- index: x.groups.findIndex((t) => t.id === e)
112
- }),
113
- isBusy: !!T,
114
- labels: v
115
- });
2
+ function e(e) {
3
+ return e?.counterpart ?? e?.counterpart_raw_data ?? void 0;
4
+ }
5
+ function t(e) {
6
+ return e?.counterpart?.name ?? e?.counterpart_raw_data?.name ?? "";
116
7
  }
117
8
  //#endregion
118
- export { f as DuplicateBillsContainer, f as default };
9
+ export { e as resolveVendor, t as resolveVendorName };
@@ -4,84 +4,223 @@
4
4
  "use client";
5
5
  import { toast as e } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
6
6
  import "../../../shared/ui/dist/index.js";
7
- import { DUPLICATE_BILLS_LABELS_EN as t } from "./index5.js";
8
- import { DuplicateVerdict as n, suspectedPayableDuplicates as r, useApplyDuplicateVerdictsMutation as i } from "../../data-access/dist/index7.js";
7
+ import { formatCalendarDate as t } from "../../../shared/util/dist/lib/formatCalendarDate.js";
8
+ import { formatMoneyExact as n } from "../../../shared/util/dist/lib/formatMoneyExact.js";
9
+ import { DUPLICATE_BILLS_LABELS_EN as r } from "./index5.js";
10
+ import { payableRemoval as i } from "./index6.js";
11
+ import { DuplicateVerdict as a, suspectedPayableDuplicates as o, useApplyDuplicateVerdictsMutation as s } from "../../data-access/dist/index7.js";
12
+ import { usePayablesByIdsQueries as c } from "../../data-access/dist/index17.js";
9
13
  import "../../data-access/dist/index.js";
10
- import { payableRemoval as a } from "./index9.js";
11
- import { useCallback as o, useMemo as s, useState as c } from "react";
14
+ import { duplicateRemovalPrompt as l } from "./index8.js";
15
+ import { derivePayableStatus as u } from "./index10.js";
16
+ import { duplicateVerdictMatches as d, groupSuspectedDuplicates as f, resolveDuplicateOriginalId as p } from "./index9.js";
17
+ import { isEditablePayableStatus as m } from "./index11.js";
18
+ import { resolveVendorName as h } from "./index12.js";
19
+ import { useCallback as g, useMemo as _, useState as v } from "react";
20
+ import { BanIcon as y, FileCheckIcon as b, Trash2Icon as x } from "lucide-react";
12
21
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index13.js
13
- function l({ payable: l, canManage: u = !0, onRemoved: d, labels: f }) {
14
- let p = s(() => ({
15
- ...t,
16
- ...f
17
- }), [f]), m = r(l), [h] = m, g = l?.id, _ = i(), [v, y] = c(!1), b = a(l?.status), x = o(async (t, n, r) => {
18
- if (m.length && g) try {
19
- await _.mutateAsync({
20
- verdict: t,
21
- targets: m.map((e) => ({
22
- payableId: g,
22
+ var S = 5;
23
+ function C(e, t) {
24
+ return t ? f(e).map(({ members: e }) => e).find((e) => e.some((e) => e.id === t)) ?? [] : [];
25
+ }
26
+ function w({ payable: f, canManage: w = !0, onRemoved: T, onOpenPayable: E, labels: D }) {
27
+ let O = _(() => ({
28
+ ...r,
29
+ ...D
30
+ }), [D]), k = o(f), [A] = k, j = f?.id, M = _(() => [...new Set(k.map((e) => e.matched_payable_id))], [k]), N = c(M, { enabled: !!(A && j) }), P = s(), [F, I] = v(!1), [L, R] = v(), [z, B] = v(), V = i(f?.status), H = g(async (t, n, r, a, o) => {
31
+ let s = d(t, n, o);
32
+ if (s.length && t?.id) try {
33
+ await P.mutateAsync({
34
+ verdict: n,
35
+ targets: s.map((e) => ({
36
+ payableId: t.id,
23
37
  duplicateId: e.id,
24
38
  matchedPayableId: e.matched_payable_id,
25
- removeBy: b
39
+ removeBy: i(t.status)
26
40
  }))
27
- }), e.success(n), r?.();
41
+ }), e.success(r), a?.();
28
42
  } catch {
29
- e.error(p.verdictFailedToast);
43
+ e.error(O.verdictFailedToast);
30
44
  }
31
- }, [
32
- _,
33
- p,
34
- m,
35
- g,
36
- b
37
- ]), S = b === "delete" ? {
38
- button: p.deleteBillButton,
39
- title: p.deleteConfirmTitle,
40
- description: p.deleteConfirmDescription,
41
- confirmButton: p.deleteConfirmButton,
42
- backButton: p.deleteConfirmBackButton,
43
- toast: p.deletedToast
44
- } : b === "confirm" ? {
45
- button: p.confirmBillButton,
46
- title: p.cancelConfirmTitle,
47
- description: p.cancelConfirmDescription,
48
- confirmButton: p.confirmBillButton,
49
- backButton: p.cancelConfirmBackButton,
50
- toast: p.confirmedToast
45
+ }, [P, O]), U = g((e, t, n) => H(f, e, t, n), [H, f]), W = V === "delete" ? {
46
+ button: O.deleteBillButton,
47
+ title: O.deleteConfirmTitle,
48
+ description: O.deleteConfirmDescription,
49
+ confirmButton: O.deleteConfirmButton,
50
+ backButton: O.deleteConfirmBackButton,
51
+ toast: O.deletedToast
52
+ } : V === "confirm" ? {
53
+ button: O.confirmBillButton,
54
+ title: O.confirmDuplicateTitle,
55
+ description: O.confirmDuplicateDescription,
56
+ confirmButton: O.confirmBillButton,
57
+ backButton: O.cancelConfirmBackButton,
58
+ toast: O.confirmedToast
51
59
  } : {
52
- button: p.cancelBillButton,
53
- title: p.cancelConfirmTitle,
54
- description: p.cancelConfirmDescription,
55
- confirmButton: p.cancelConfirmButton,
56
- backButton: p.cancelConfirmBackButton,
57
- toast: p.cancelledToast
58
- }, C = o(async () => {
59
- await x(n.Remove, S.toast, d), y(!1);
60
+ button: O.cancelBillButton,
61
+ title: O.cancelConfirmTitle,
62
+ description: O.cancelConfirmDescription,
63
+ confirmButton: O.cancelConfirmButton,
64
+ backButton: O.cancelConfirmBackButton,
65
+ toast: O.cancelledToast
66
+ }, G = g(async () => {
67
+ await U(a.Remove, W.toast, T), I(!1);
68
+ }, [
69
+ U,
70
+ T,
71
+ W.toast
72
+ ]), K = _(() => ({
73
+ delete: {
74
+ action: O.deleteAction,
75
+ title: O.deleteConfirmTitle,
76
+ description: O.deleteConfirmDescription,
77
+ confirmButton: O.deleteConfirmButton,
78
+ backButton: O.deleteConfirmBackButton,
79
+ toast: O.deletedToast
80
+ },
81
+ cancel: {
82
+ action: O.cancelAction,
83
+ title: O.cancelConfirmTitle,
84
+ description: O.cancelConfirmDescription,
85
+ confirmButton: O.cancelConfirmButton,
86
+ backButton: O.cancelConfirmBackButton,
87
+ toast: O.cancelledToast
88
+ },
89
+ confirm: {
90
+ action: O.confirmAction,
91
+ title: O.confirmDuplicateTitle,
92
+ description: O.confirmDuplicateDescription,
93
+ confirmButton: O.confirmBillButton,
94
+ backButton: O.cancelConfirmBackButton,
95
+ toast: O.confirmedToast
96
+ }
97
+ }), [O]), q = K[L?.removeBy ?? "cancel"], J = g(async () => {
98
+ L && (await H(L.payable, a.Remove, K[L.removeBy].toast, L.payable.id === j ? T : void 0), R(void 0));
60
99
  }, [
61
- x,
62
- d,
63
- S.toast
64
- ]), w = u && !!(h && g), T = w && !!b;
100
+ H,
101
+ T,
102
+ j,
103
+ L,
104
+ K
105
+ ]), Y = g(async () => {
106
+ z && (await H(z.payable, a.Keep, O.dismissedToast, void 0, z.originalPayableId), B(void 0));
107
+ }, [
108
+ H,
109
+ O.dismissedToast,
110
+ z
111
+ ]), X = w && !!(A && j), Z = X && !!V, Q = _(() => {
112
+ let e = new Map(N.flatMap((e) => e.data ? [[e.data.id, e.data]] : []));
113
+ f?.id && e.set(f.id, f);
114
+ let r = C([...e.values()], j);
115
+ if (r.length < 2) return [];
116
+ let a = p(r), s = (e) => {
117
+ let t = e.total_amount ?? e.amount_due;
118
+ return t == null ? "" : n(t / 100, { currencyCode: e.currency ?? "USD" });
119
+ };
120
+ return r.map((e) => {
121
+ let n = e.status ? u({
122
+ apiStatus: e.status,
123
+ dueDate: e.due_date,
124
+ scheduledPaymentDate: e.scheduled_payment_date
125
+ }) : void 0, r = e.id === a, c = e.id === j, l = w && o(e).length > 0, d = h(e), f = i(e.status);
126
+ return {
127
+ id: e.id,
128
+ roleLabel: d,
129
+ badges: [...r ? [O.originalBillBadge] : [], ...c ? [O.currentBillBadge] : []],
130
+ invoiceNumberLabel: e.document_id ?? "",
131
+ roleTone: r ? void 0 : "warning",
132
+ amountLabel: s(e),
133
+ addedOnLabel: t(e.created_at?.slice(0, 10)),
134
+ dueDateLabel: t(e.due_date),
135
+ status: n?.status,
136
+ statusTone: n?.tone,
137
+ onOpen: !c && E ? () => E(e.id, m(e.status ?? void 0)) : void 0,
138
+ menu: l ? {
139
+ triggerLabel: O.openRow({
140
+ vendorLabel: d,
141
+ invoiceNumberLabel: "",
142
+ addedOnLabel: t(e.created_at?.slice(0, 10))
143
+ }),
144
+ items: [{
145
+ id: "not-duplicate",
146
+ label: O.notDuplicateAction,
147
+ icon: b,
148
+ disabled: P.isPending,
149
+ onSelect: () => B({
150
+ payable: e,
151
+ originalPayableId: r ? void 0 : a
152
+ })
153
+ }, ...f ? [{
154
+ id: "cancel-duplicate",
155
+ label: K[f].action,
156
+ icon: f === "delete" ? x : y,
157
+ disabled: P.isPending,
158
+ onSelect: () => R({
159
+ payable: e,
160
+ removeBy: f
161
+ })
162
+ }] : []]
163
+ } : void 0
164
+ };
165
+ });
166
+ }, [
167
+ P.isPending,
168
+ w,
169
+ N,
170
+ O,
171
+ E,
172
+ f,
173
+ j,
174
+ K
175
+ ]);
65
176
  return {
66
- isPossibleDuplicate: !!h,
67
- onNotADuplicate: w ? () => void x(n.Keep, p.dismissedToast) : void 0,
68
- onRemoveBill: T ? b === "delete" ? () => y(!0) : () => void C() : void 0,
69
- removeBillLabel: T ? S.button : void 0,
177
+ isPossibleDuplicate: !!A,
178
+ onNotADuplicate: X ? () => B({ payable: f }) : void 0,
179
+ onRemoveBill: Z ? () => I(!0) : void 0,
180
+ removeBillLabel: Z ? W.button : void 0,
70
181
  removeConfirmation: {
71
- open: v,
182
+ open: F,
72
183
  copy: {
73
- title: S.title,
74
- description: S.description,
75
- confirmButton: S.confirmButton,
184
+ title: W.title,
185
+ description: W.description,
186
+ confirmButton: W.confirmButton,
76
187
  presentation: { tone: "destructive" }
77
188
  },
78
- onConfirm: () => void C(),
79
- onCancel: () => y(!1),
80
- isPending: _.isPending,
81
- cancelButtonLabel: S.backButton
189
+ onConfirm: () => void G(),
190
+ onCancel: () => I(!1),
191
+ isPending: P.isPending,
192
+ cancelButtonLabel: W.backButton
193
+ },
194
+ cancelRowConfirmation: {
195
+ open: !!L,
196
+ copy: l(q, L?.removeBy ?? "cancel"),
197
+ onConfirm: () => void J(),
198
+ onCancel: () => R(void 0),
199
+ isPending: P.isPending,
200
+ cancelButtonLabel: q.backButton
201
+ },
202
+ keepRowConfirmation: {
203
+ open: !!z,
204
+ copy: {
205
+ title: O.notDuplicateConfirmTitle,
206
+ description: O.notDuplicateConfirmDescription,
207
+ confirmButton: O.notDuplicateConfirmButton,
208
+ presentation: {
209
+ alignment: "center",
210
+ icon: b,
211
+ actionWidth: "equal"
212
+ }
213
+ },
214
+ onConfirm: () => void Y(),
215
+ onCancel: () => B(void 0),
216
+ isPending: P.isPending,
217
+ cancelButtonLabel: O.notDuplicateConfirmBackButton
82
218
  },
83
- isBusy: _.isPending
219
+ isBusy: P.isPending,
220
+ rows: Q,
221
+ collapsedRowCount: S,
222
+ showMoreLabel: Q.length > S ? O.showMoreRows(Q.length - S) : void 0
84
223
  };
85
224
  }
86
225
  //#endregion
87
- export { l as usePayableDuplicateReview };
226
+ export { w as usePayableDuplicateReview };
@@ -1,7 +1,5 @@
1
1
  import "./index5.js";
2
2
  import "./index6.js";
3
- import "./index9.js";
4
- import "./index10.js";
5
- import "./index11.js";
6
- import "./index12.js";
3
+ import "./index7.js";
4
+ import "./index8.js";
7
5
  import "./index13.js";
@@ -1,4 +1,4 @@
1
- import { MARK_AS_PAID_DIALOG_LABELS_EN as e, mergeMarkAsPaidDialogLabels as t } from "../../ui/dist/index103.js";
1
+ import { MARK_AS_PAID_DIALOG_LABELS_EN as e, mergeMarkAsPaidDialogLabels as t } from "../../ui/dist/index99.js";
2
2
  import "../../ui/dist/index.js";
3
3
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index15.js
4
4
  var n = {