@tesouro/embedded-components-react 0.4.28 → 0.4.29

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 (92) hide show
  1. package/dist/index.js +1 -1
  2. package/dist/lib/BillPayWidget.js +1 -1
  3. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index.js +2 -2
  4. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index16.js +15 -82
  5. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index17.js +87 -25
  6. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index18.js +36 -0
  7. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js +12 -12
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index10.js +5 -70
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index11.js +64 -37
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index12.js +38 -110
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index13.js +104 -73
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index14.js +87 -7
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index15.js +7 -21
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index16.js +17 -22
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index17.js +23 -63
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index18.js +66 -2
  17. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index19.js +2 -77
  18. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index20.js +78 -3
  19. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index21.js +4 -5
  20. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index22.js +5 -4
  21. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index23.js +3 -32
  22. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index24.js +30 -39
  23. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index25.js +37 -166
  24. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index26.js +164 -39
  25. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index27.js +48 -1
  26. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index28.js +1 -50
  27. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index29.js +45 -11
  28. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index30.js +13 -8
  29. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index31.js +8 -14
  30. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index32.js +7 -59
  31. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index33.js +64 -8
  32. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index34.js +8 -24
  33. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index35.js +18 -136
  34. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index36.js +139 -16
  35. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index37.js +24 -4
  36. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index38.js +4 -41
  37. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index39.js +39 -88
  38. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index40.js +79 -85
  39. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index41.js +96 -3
  40. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index42.js +3 -49
  41. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index43.js +47 -119
  42. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index44.js +135 -33
  43. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index45.js +33 -186
  44. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index46.js +186 -75
  45. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index47.js +75 -21
  46. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index48.js +22 -232
  47. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index49.js +223 -210
  48. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index5.js +14 -25
  49. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index50.js +202 -103
  50. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index51.js +121 -13
  51. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index52.js +12 -47
  52. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index53.js +47 -31
  53. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index54.js +27 -198
  54. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index55.js +198 -30
  55. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index56.js +30 -234
  56. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index57.js +240 -19
  57. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index58.js +19 -425
  58. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index59.js +433 -4
  59. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index6.js +25 -24
  60. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index60.js +4 -38
  61. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index61.js +35 -218
  62. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index62.js +224 -3
  63. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index63.js +3 -4
  64. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index64.js +2 -44
  65. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index65.js +46 -1
  66. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index66.js +1 -8
  67. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index67.js +6 -10
  68. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index68.js +10 -110
  69. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index69.js +112 -3
  70. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index7.js +21 -57
  71. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index70.js +3 -127
  72. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index71.js +124 -8
  73. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index72.js +8 -7
  74. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index73.js +8 -46
  75. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index74.js +43 -18
  76. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index75.js +20 -28
  77. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index76.js +27 -82
  78. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index77.js +83 -47
  79. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index78.js +47 -250
  80. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index79.js +239 -101
  81. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index8.js +58 -5
  82. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index80.js +107 -202
  83. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index81.js +209 -3
  84. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index82.js +4 -8
  85. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index83.js +6 -113
  86. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index84.js +115 -1
  87. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index85.js +0 -24
  88. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index86.js +25 -0
  89. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index9.js +5 -4
  90. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  91. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index8.js +1 -1
  92. package/package.json +1 -1
@@ -2,117 +2,45 @@
2
2
  "use client";
3
3
  "use client";
4
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/index84.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";
5
+ import { useCallback as e, useEffect as t, useState as n } from "react";
16
6
  //#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
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;
56
14
  });
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
- });
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
+ };
116
44
  }
117
45
  //#endregion
118
- export { f as DuplicateBillsContainer, f as default };
46
+ export { r as useDuplicateBillsSelection };
@@ -4,84 +4,115 @@
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 { DUPLICATE_BILLS_LABELS_EN as t } from "./index6.js";
8
+ import { DuplicateVerdict as n, useApplyDuplicateVerdictsMutation as r } from "../../data-access/dist/index7.js";
9
9
  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";
10
+ import { useDuplicateBills as i } from "./index11.js";
11
+ import { useDuplicateBillsSelection as a } from "./index12.js";
12
+ import { DuplicateBillsDialog as o } from "../../ui/dist/index84.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";
12
16
  //#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(() => ({
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(() => ({
15
20
  ...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,
23
- duplicateId: e.id,
24
- matchedPayableId: e.matched_payable_id,
25
- removeBy: b
26
- }))
27
- }), e.success(n), r?.();
28
- } catch {
29
- e.error(p.verdictFailedToast);
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;
30
33
  }
34
+ !D || x.isLoading || x.isError || x.groups.length > 0 || (e.success(b), p(!1));
31
35
  }, [
32
- _,
36
+ b,
37
+ D,
33
38
  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
51
- } : {
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
- }, [
61
- x,
62
- d,
63
- S.toast
64
- ]), w = u && !!(h && g), T = w && !!b;
65
- 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,
70
- removeConfirmation: {
71
- open: v,
72
- copy: {
73
- title: S.title,
74
- description: S.description,
75
- confirmButton: S.confirmButton,
76
- presentation: { tone: "destructive" }
77
- },
78
- onConfirm: () => void C(),
79
- onCancel: () => y(!1),
80
- isPending: _.isPending,
81
- cancelButtonLabel: S.backButton
82
- },
83
- isBusy: _.isPending
84
- };
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
+ });
85
116
  }
86
117
  //#endregion
87
- export { l as usePayableDuplicateReview };
118
+ export { f as DuplicateBillsContainer, f as default };
@@ -1,7 +1,87 @@
1
- import "./index5.js";
2
- import "./index6.js";
3
- import "./index9.js";
4
- import "./index10.js";
5
- import "./index11.js";
6
- import "./index12.js";
7
- import "./index13.js";
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 "./index6.js";
8
+ import { DuplicateVerdict as n, suspectedPayableDuplicates as r, useApplyDuplicateVerdictsMutation as i } from "../../data-access/dist/index7.js";
9
+ import "../../data-access/dist/index.js";
10
+ import { payableRemoval as a } from "./index10.js";
11
+ import { useCallback as o, useMemo as s, useState as c } from "react";
12
+ //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index14.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,
23
+ duplicateId: e.id,
24
+ matchedPayableId: e.matched_payable_id,
25
+ removeBy: b
26
+ }))
27
+ }), e.success(n), r?.();
28
+ } catch {
29
+ e.error(p.verdictFailedToast);
30
+ }
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
51
+ } : {
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
+ }, [
61
+ x,
62
+ d,
63
+ S.toast
64
+ ]), w = u && !!(h && g), T = w && !!b;
65
+ 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,
70
+ removeConfirmation: {
71
+ open: v,
72
+ copy: {
73
+ title: S.title,
74
+ description: S.description,
75
+ confirmButton: S.confirmButton,
76
+ presentation: { tone: "destructive" }
77
+ },
78
+ onConfirm: () => void C(),
79
+ onCancel: () => y(!1),
80
+ isPending: _.isPending,
81
+ cancelButtonLabel: S.backButton
82
+ },
83
+ isBusy: _.isPending
84
+ };
85
+ }
86
+ //#endregion
87
+ export { l as usePayableDuplicateReview };
@@ -1,21 +1,7 @@
1
- import { MARK_AS_PAID_DIALOG_LABELS_EN as e } from "../../ui/dist/index95.js";
2
- import "../../ui/dist/index.js";
3
- //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index15.js
4
- var t = {
5
- dueDateSuffix: (e) => `by ${e}`,
6
- paidToast: "Bill marked as paid",
7
- submitError: "Couldn't mark this bill as paid. Try again.",
8
- dialog: e
9
- };
10
- function n(e) {
11
- return {
12
- ...t,
13
- ...e,
14
- dialog: {
15
- ...t.dialog,
16
- ...e?.dialog
17
- }
18
- };
19
- }
20
- //#endregion
21
- export { t as MARK_AS_PAID_FLOW_LABELS_EN, n as mergeMarkAsPaidFlowLabels };
1
+ import "./index6.js";
2
+ import "./index7.js";
3
+ import "./index10.js";
4
+ import "./index11.js";
5
+ import "./index12.js";
6
+ import "./index13.js";
7
+ import "./index14.js";
@@ -1,26 +1,21 @@
1
+ import { MARK_AS_PAID_DIALOG_LABELS_EN as e } from "../../ui/dist/index95.js";
2
+ import "../../ui/dist/index.js";
1
3
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index16.js
2
- var e = new Intl.DateTimeFormat("en-CA", {
3
- timeZone: "America/New_York",
4
- year: "numeric",
5
- month: "2-digit",
6
- day: "2-digit"
7
- });
8
- function t(t = /* @__PURE__ */ new Date()) {
9
- let n = e.formatToParts(t), r = Object.fromEntries(n.map((e) => [e.type, e.value]));
10
- return `${r.year}-${r.month}-${r.day}`;
11
- }
4
+ var t = {
5
+ dueDateSuffix: (e) => `by ${e}`,
6
+ paidToast: "Bill marked as paid",
7
+ submitError: "Couldn't mark this bill as paid. Try again.",
8
+ dialog: e
9
+ };
12
10
  function n(e) {
13
- return `${e.getFullYear()}-${String(e.getMonth() + 1).padStart(2, "0")}-${String(e.getDate()).padStart(2, "0")}`;
14
- }
15
- function r(e, r = /* @__PURE__ */ new Date()) {
16
- return n(e) === t(r);
17
- }
18
- function i(e = /* @__PURE__ */ new Date()) {
19
- let [n, r, i] = t(e).split("-").map(Number);
20
- return new Date(n, r - 1, i);
21
- }
22
- function a(e, r = /* @__PURE__ */ new Date()) {
23
- return n(e) < t(r);
11
+ return {
12
+ ...t,
13
+ ...e,
14
+ dialog: {
15
+ ...t.dialog,
16
+ ...e?.dialog
17
+ }
18
+ };
24
19
  }
25
20
  //#endregion
26
- export { n as dateToCalendarKey, i as getDefaultPaymentDate, t as getEasternDateKey, a as isPastEasternDate, r as isTodayInEastern };
21
+ export { t as MARK_AS_PAID_FLOW_LABELS_EN, n as mergeMarkAsPaidFlowLabels };
@@ -1,66 +1,26 @@
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 { formatCalendarDate as t } from "../../../shared/util/dist/lib/formatCalendarDate.js";
8
- import { formatMoneyExact as n } from "../../../shared/util/dist/lib/formatMoneyExact.js";
9
- import { extractApiErrorMessage as r } from "../../../shared/util/dist/lib/apiErrors.js";
10
- import { useMarkPayableAsPaidMutation as i } from "../../data-access/dist/index13.js";
11
- import "../../data-access/dist/index.js";
12
- import { dateToCalendarKey as a, getDefaultPaymentDate as o, isTodayInEastern as s } from "./index16.js";
13
- import { mergeMarkAsPaidFlowLabels as c } from "./index15.js";
14
- import { useEffect as l, useState as u } from "react";
15
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index17.js
16
- function d({ payableId: d, amountDueMinorUnits: f, amountToPayMinorUnits: p, currencyCode: m, dueDate: h, hasScheduledPayment: g, testId: _, labels: v }) {
17
- let y = c(v), b = i(), [x, S] = u(!1), [C, w] = u(void 0), [T, E] = u(""), D = x && !g, O = n(f / 100, { currencyCode: m }), k = n((p ?? f) / 100, { currencyCode: m }), A = C ? t(a(C)) : void 0, j = h ? y.dueDateSuffix(t(h)) : void 0, M = () => {
18
- S(!1), w(void 0), E("");
19
- };
20
- return l(() => {
21
- g && (S(!1), w(void 0), E(""));
22
- }, [g]), {
23
- open: () => {
24
- w(o()), E(""), S(!0);
25
- },
26
- isPending: b.isPending,
27
- dialogProps: {
28
- open: D,
29
- amountDue: O,
30
- dueDateSuffix: j,
31
- paymentAmount: k,
32
- selectedDate: C,
33
- selectedDateLabel: A,
34
- isToday: C ? s(C) : !1,
35
- comment: T,
36
- isSubmitting: b.isPending,
37
- onDateChange: w,
38
- onCommentChange: E,
39
- onConfirm: () => {
40
- !d || !C || b.isPending || g || b.mutate({
41
- path: { payable_id: d },
42
- body: {
43
- paid_at: `${a(C)}T12:00:00.000Z`,
44
- is_external: !0,
45
- ...T.trim() ? { comment: T.trim() } : {}
46
- }
47
- }, {
48
- onSuccess: () => {
49
- e.success(y.paidToast), M();
50
- },
51
- onError: (t) => {
52
- e.error(r(t) ?? y.submitError);
53
- }
54
- });
55
- },
56
- onCancel: () => {
57
- b.isPending || M();
58
- },
59
- testId: _ ? `${_}-mark-as-paid-dialog` : void 0,
60
- confirmTestId: _ ? `${_}-mark-as-paid-confirm` : void 0,
61
- labels: y.dialog
62
- }
63
- };
2
+ var e = new Intl.DateTimeFormat("en-CA", {
3
+ timeZone: "America/New_York",
4
+ year: "numeric",
5
+ month: "2-digit",
6
+ day: "2-digit"
7
+ });
8
+ function t(t = /* @__PURE__ */ new Date()) {
9
+ let n = e.formatToParts(t), r = Object.fromEntries(n.map((e) => [e.type, e.value]));
10
+ return `${r.year}-${r.month}-${r.day}`;
11
+ }
12
+ function n(e) {
13
+ return `${e.getFullYear()}-${String(e.getMonth() + 1).padStart(2, "0")}-${String(e.getDate()).padStart(2, "0")}`;
14
+ }
15
+ function r(e, r = /* @__PURE__ */ new Date()) {
16
+ return n(e) === t(r);
17
+ }
18
+ function i(e = /* @__PURE__ */ new Date()) {
19
+ let [n, r, i] = t(e).split("-").map(Number);
20
+ return new Date(n, r - 1, i);
21
+ }
22
+ function a(e, r = /* @__PURE__ */ new Date()) {
23
+ return n(e) < t(r);
64
24
  }
65
25
  //#endregion
66
- export { d as useMarkAsPaidFlow };
26
+ export { n as dateToCalendarKey, i as getDefaultPaymentDate, t as getEasternDateKey, a as isPastEasternDate, r as isTodayInEastern };