@tesouro/embedded-components-react 0.3.49 → 0.3.50

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 (133) hide show
  1. package/dist/index.css +8 -2
  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 -10
  5. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index10.js +39 -30
  6. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index11.js +26 -311
  7. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index12.js +325 -12
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index13.js +13 -26
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index14.js +20 -40
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index15.js +75 -24
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index16.js +36 -0
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index5.js +80 -68
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index6.js +86 -73
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index7.js +77 -14
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index8.js +18 -63
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index9.js +50 -29
  17. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js +22 -18
  18. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index10.js +82 -30
  19. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index11.js +7 -42
  20. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index12.js +15 -159
  21. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index13.js +23 -33
  22. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index14.js +66 -1
  23. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index15.js +2 -50
  24. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index16.js +3 -4
  25. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index17.js +5 -14
  26. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index18.js +3 -14
  27. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index19.js +31 -63
  28. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index2.js +23 -18
  29. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index20.js +37 -24
  30. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index21.js +161 -61
  31. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index22.js +29 -130
  32. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index23.js +1 -25
  33. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index24.js +47 -4
  34. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index25.js +4 -41
  35. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index26.js +12 -55
  36. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index27.js +13 -4
  37. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index28.js +63 -72
  38. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index29.js +26 -49
  39. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index3.js +23 -23
  40. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index30.js +62 -93
  41. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index31.js +133 -34
  42. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index32.js +20 -163
  43. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index33.js +4 -77
  44. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index34.js +39 -21
  45. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index35.js +5 -210
  46. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index36.js +70 -211
  47. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index37.js +47 -103
  48. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index38.js +92 -12
  49. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index39.js +34 -47
  50. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index4.js +59 -62
  51. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index40.js +163 -29
  52. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index41.js +67 -181
  53. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index42.js +20 -32
  54. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index43.js +203 -94
  55. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index44.js +214 -15
  56. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index45.js +98 -312
  57. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index46.js +16 -4
  58. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index47.js +49 -31
  59. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index48.js +29 -80
  60. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index49.js +183 -156
  61. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index5.js +9 -2
  62. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index50.js +38 -3
  63. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index51.js +102 -2
  64. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index52.js +18 -44
  65. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index53.js +343 -1
  66. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index54.js +4 -8
  67. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index55.js +30 -8
  68. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index56.js +79 -88
  69. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index57.js +179 -3
  70. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index58.js +3 -9
  71. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index59.js +2 -20
  72. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index6.js +4 -2
  73. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index60.js +38 -51
  74. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index61.js +0 -2
  75. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index62.js +6 -126
  76. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index63.js +9 -9
  77. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index64.js +92 -44
  78. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index65.js +3 -23
  79. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index66.js +123 -26
  80. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index67.js +7 -82
  81. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index68.js +8 -48
  82. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index69.js +45 -250
  83. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index7.js +69 -5
  84. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index70.js +21 -113
  85. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index71.js +27 -208
  86. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index72.js +86 -4
  87. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index73.js +47 -5
  88. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index74.js +244 -106
  89. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index75.js +115 -1
  90. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index76.js +201 -16
  91. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index77.js +4 -0
  92. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index78.js +8 -0
  93. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index79.js +115 -0
  94. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index8.js +44 -5
  95. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index80.js +1 -0
  96. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index81.js +25 -0
  97. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index9.js +94 -3
  98. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index.js +19 -19
  99. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index18.js +1 -0
  100. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index50.js +28 -28
  101. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index59.js +1 -3
  102. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index60.js +6 -16
  103. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index73.js +119 -16
  104. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index74.js +24 -111
  105. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index75.js +89 -2
  106. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index76.js +2 -7
  107. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index77.js +5 -28
  108. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index78.js +30 -2
  109. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index79.js +2 -7
  110. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index80.js +5 -32
  111. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index81.js +34 -2
  112. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index82.js +2 -12
  113. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index83.js +10 -104
  114. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index84.js +105 -1
  115. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index85.js +2 -17
  116. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index86.js +15 -123
  117. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index87.js +125 -2
  118. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index88.js +2 -18
  119. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index89.js +14 -6
  120. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index90.js +7 -167
  121. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index91.js +170 -2
  122. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index92.js +2 -14
  123. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index93.js +11 -105
  124. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index94.js +108 -2
  125. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index95.js +2 -10
  126. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index96.js +8 -45
  127. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index97.js +47 -2
  128. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index98.js +2 -0
  129. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +23 -23
  130. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +87 -71
  131. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  132. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index8.js +1 -1
  133. package/package.json +1 -1
@@ -1,26 +1,26 @@
1
+ import { suspectedPayableDuplicates as e } from "../../data-access/dist/index6.js";
2
+ import "../../data-access/dist/index.js";
1
3
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index3.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
- }
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);
4
+ function t(t) {
5
+ let n = new Map(t.map((e) => [e.id, e])), r = /* @__PURE__ */ new Map(), i = (e) => {
6
+ let t = r.get(e);
7
+ if (t === void 0 || t === e) return e;
8
+ let n = i(t);
9
+ return r.set(e, n), n;
10
+ }, a = (e, t) => {
11
+ let n = i(e), a = i(t);
12
+ n !== a && r.set(n, a);
13
+ };
14
+ t.forEach((t) => {
15
+ r.set(t.id, r.get(t.id) ?? t.id), e(t).forEach((e) => {
16
+ n.has(e.matched_payable_id) && a(t.id, e.matched_payable_id);
17
+ });
18
+ });
19
+ let o = /* @__PURE__ */ new Map();
20
+ return t.forEach((e) => {
21
+ let t = i(e.id);
22
+ o.set(t, [...o.get(t) ?? [], e]);
23
+ }), [...o.values()].map((e) => ({ members: [...e].sort((e, t) => (e.created_at ?? "").localeCompare(t.created_at ?? "")) }));
24
24
  }
25
25
  //#endregion
26
- export { n as dateToCalendarKey, i as getDefaultPaymentDate, t as getEasternDateKey, a as isPastEasternDate, r as isTodayInEastern };
26
+ export { t as groupSuspectedDuplicates };
@@ -1,96 +1,65 @@
1
+ import { hasAnyScope as e } from "../../../shared/data-access/dist/lib/hasAnyScope.js";
2
+ import { Scope as t } from "../../../shared/data-access/dist/lib/scopes.js";
3
+ import "../../../shared/data-access/dist/index.js";
4
+ import { BanIcon as n, CalendarXIcon as r, RotateCcwIcon as i, ThumbsDownIcon as a, ThumbsUpIcon as o } from "lucide-react";
1
5
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index30.js
2
- var e = {
3
- payBill: "Pay bill",
4
- markAsPaid: "Mark as paid",
5
- reject: "Reject",
6
- approve: "Approve",
7
- cancel: "Cancel bill",
8
- cancelScheduledPayment: "Cancel scheduled payment",
9
- reopen: "Reopen bill",
10
- forceApprove: "Approve",
11
- forceReject: "Reject",
12
- policyOverridesHeading: "Policy overrides",
13
- decisionDialog: {
14
- reject: {
15
- title: "Reject this bill?",
16
- description: "The bill goes back as rejected and nobody else is asked to approve it.",
17
- confirmButton: "Reject bill",
18
- reason: {
19
- label: "Reason",
20
- placeholder: "Tell the submitter what needs to change",
21
- optionalHint: "Optional"
22
- }
23
- },
24
- cancel: {
25
- title: "Cancel this bill?",
26
- description: "Cancelling is permanent. The bill can't be reopened, edited, or paid afterwards.",
27
- confirmButton: "Cancel bill"
28
- },
29
- cancelScheduledPayment: {
30
- title: "Cancel this scheduled payment?",
31
- description: "The payment will not be sent. The bill stays ready to pay, so you can schedule it again for another date.",
32
- confirmButton: "Cancel payment"
33
- },
34
- forceApprove: {
35
- title: "Override approval policy?",
36
- description: "The below people haven't approved this bill yet. Approving now will bypass their required review. This will be recorded in the audit history and can't be undone.",
37
- confirmButton: "Override and approve"
38
- },
39
- forceReject: {
40
- title: "Override approval policy?",
41
- description: "The below people haven't approved this bill yet. Rejecting now will bypass their required review. This will be recorded in the audit history and can't be undone.",
42
- confirmButton: "Override and reject"
43
- },
44
- cancelButton: "Cancel"
45
- },
46
- actionError: "Couldn't update this bill. Try again.",
47
- actionSuccess: {
48
- approve: "Bill approved.",
49
- reject: "Bill rejected.",
50
- markAsPaid: "Bill marked as paid.",
51
- cancel: "Bill canceled.",
52
- cancelScheduledPayment: "Scheduled payment canceled.",
53
- reopen: "Bill reopened.",
54
- forceApprove: "Bill approved, overriding the approval policy.",
55
- forceReject: "Bill rejected, overriding the approval policy."
56
- }
57
- }, t = (e) => `Payment scheduled for ${e}`, n = [
58
- "reject",
59
- "cancel",
60
- "cancelScheduledPayment",
61
- "forceApprove",
62
- "forceReject"
63
- ];
64
- function r(e, t) {
65
- let n = e.reason ? {
66
- ...e.reason,
67
- ...t?.reason
68
- } : void 0, r = {
69
- ...e,
70
- ...t,
71
- reason: n
72
- };
73
- return n || delete r.reason, r;
74
- }
75
- function i(e, t) {
76
- let i = {
77
- ...e,
78
- ...t
79
- };
80
- for (let a of n) i[a] = r(e[a], t?.[a]);
81
- return i;
82
- }
83
- function a(t) {
84
- let n = e;
85
- return {
86
- ...n,
87
- ...t,
88
- decisionDialog: i(n.decisionDialog, t?.decisionDialog),
89
- actionSuccess: {
90
- ...n.actionSuccess,
91
- ...t?.actionSuccess
92
- }
93
- };
6
+ function s({ status: s, scopes: c, canDecideApprovalRequest: l, hasScheduledPayment: u, scheduledPaymentIntentId: d, isPolicyApprover: f, hasWaitingRequest: p, arePendingApproversUnknown: m, labels: h }) {
7
+ let g = e(c, [t.PayablePayOrg]), _ = e(c, [t.BankAccountReadOrg]), v = e(c, [t.PaymentRailAch]), y = e(c, [t.PayableWriteOrg]), b = g, x = e(c, [t.PayableApproveOrg]), S = [];
8
+ s === "approve_in_progress" && l && (S.push({
9
+ id: "approve",
10
+ label: h.approve,
11
+ variant: "default",
12
+ surface: "row"
13
+ }), S.push({
14
+ id: "reject",
15
+ label: h.reject,
16
+ variant: "ghost",
17
+ surface: "row"
18
+ })), s === "approve_in_progress" && p && x && !f && !m && (S.push({
19
+ id: "forceApprove",
20
+ label: h.forceApprove,
21
+ variant: "ghost",
22
+ surface: "menu",
23
+ icon: o,
24
+ sectionHeading: h.policyOverridesHeading
25
+ }), S.push({
26
+ id: "forceReject",
27
+ label: h.forceReject,
28
+ variant: "ghost",
29
+ surface: "menu",
30
+ icon: a,
31
+ sectionHeading: h.policyOverridesHeading
32
+ }));
33
+ let C = s === "waiting_to_be_paid" && g && !u, w = s === "waiting_to_be_paid" && g && _ && v && !u;
34
+ return C && S.push({
35
+ id: "markAsPaid",
36
+ label: h.markAsPaid,
37
+ variant: "outline",
38
+ surface: "row"
39
+ }), w && S.push({
40
+ id: "payBill",
41
+ label: h.payBill,
42
+ variant: "default",
43
+ surface: "row"
44
+ }), s === "new" && y && S.push({
45
+ id: "cancel",
46
+ label: h.cancel,
47
+ variant: "ghost",
48
+ surface: "menu",
49
+ icon: n
50
+ }), (s === "rejected" || s === "waiting_to_be_paid" && !u) && y && S.push({
51
+ id: "reopen",
52
+ label: h.reopen,
53
+ variant: "ghost",
54
+ surface: "menu",
55
+ icon: i
56
+ }), s === "waiting_to_be_paid" && u && d && b && S.push({
57
+ id: "cancelScheduledPayment",
58
+ label: h.cancelScheduledPayment,
59
+ variant: "ghost",
60
+ surface: "menu",
61
+ icon: r
62
+ }), S;
94
63
  }
95
64
  //#endregion
96
- export { e as BILL_DETAIL_ACTIONS_LABELS_EN, t as SCHEDULED_SUMMARY_LABEL_EN, a as mergeBillDetailActionsLabels, i as mergeDecisionDialogCopy };
65
+ export { s as getBillDetailActions };
@@ -1,38 +1,137 @@
1
- import { jsx as e, jsxs as t } from "react/jsx-runtime";
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 { useWidgetConfig as t } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
8
+ import "../../../shared/feature/dist/index.js";
9
+ import { useApprovePayableApprovalRequestMutation as n, useRejectPayableApprovalRequestMutation as r } from "../../data-access/dist/index7.js";
10
+ import { useCancelPayableMutation as i, useCancelScheduledPaymentMutation as a, useForceApprovePayableMutation as o, useForceRejectPayableMutation as s, useReopenPayableMutation as c } from "../../data-access/dist/index12.js";
11
+ import "../../data-access/dist/index.js";
12
+ import { getBillDetailActions as l } from "./index30.js";
13
+ import { useState as u } from "react";
14
+ import { HandIcon as d } from "lucide-react";
2
15
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index31.js
3
- var n = {
4
- previewUnavailable: "Preview not available for this file type.",
5
- openFile: "Open file"
6
- };
7
- function r(r, i = {}) {
8
- if (r.mimetype === "application/pdf") return /* @__PURE__ */ e("iframe", {
9
- src: `${r.url}#toolbar=0&navpanes=0`,
10
- title: r.name,
11
- referrerPolicy: "no-referrer",
12
- className: "ttw:h-full ttw:w-full ttw:border-0"
13
- });
14
- if (r.mimetype.startsWith("image/")) return /* @__PURE__ */ e("img", {
15
- src: r.url,
16
- alt: r.name,
17
- className: "ttw:max-h-full ttw:max-w-full ttw:object-contain"
18
- });
19
- let a = {
20
- ...n,
21
- ...i
16
+ function f({ payableId: d, status: f, currentApprovalRequestId: m, isPolicyApprover: _, hasWaitingRequest: v, arePendingApproversUnknown: y, hasScheduledPayment: b, scheduledPaymentIntentId: x, isScheduledPaymentUnknown: S, labels: C, isMarkAsPaidPending: w, pendingApprovers: T, onPayBillSelect: E, onMarkAsPaidSelect: D, onActionSucceeded: O }) {
17
+ let { initResponse: k } = t(), A = r(), j = n(), M = i(), N = a(), P = c(), F = o(), I = s(), L = w || A.isPending || j.isPending || M.isPending || N.isPending || P.isPending || F.isPending || I.isPending, [R, z] = u(), B = R && (R.id !== "cancelScheduledPayment" || R.scheduledPaymentIntentId === x) ? R : void 0, V = d && f ? l({
18
+ status: f,
19
+ scopes: k?.scopes,
20
+ canDecideApprovalRequest: !!m,
21
+ isPolicyApprover: _,
22
+ hasWaitingRequest: v,
23
+ arePendingApproversUnknown: y,
24
+ hasScheduledPayment: b || S,
25
+ scheduledPaymentIntentId: x,
26
+ labels: C
27
+ }) : [], H = (t) => ({
28
+ onError: () => e.error(C.actionError),
29
+ onSuccess: () => {
30
+ e.success(C.actionSuccess[t]), O?.();
31
+ }
32
+ }), U = {
33
+ reject: {
34
+ isPending: A.isPending,
35
+ run: (e) => m && A.mutate({
36
+ path: { approval_request_id: m },
37
+ body: e ? { reject_reason: e } : void 0
38
+ }, H("reject"))
39
+ },
40
+ approve: {
41
+ isPending: j.isPending,
42
+ run: () => m && j.mutate({ path: { approval_request_id: m } }, H("approve"))
43
+ },
44
+ cancel: {
45
+ isPending: M.isPending,
46
+ run: () => d && M.mutate({ path: { payable_id: d } }, H("cancel"))
47
+ },
48
+ cancelScheduledPayment: {
49
+ isPending: N.isPending,
50
+ run: () => {
51
+ let e = B?.scheduledPaymentIntentId;
52
+ !d || !e || N.mutate({
53
+ path: { payment_intent_id: e },
54
+ payableId: d
55
+ }, H("cancelScheduledPayment"));
56
+ }
57
+ },
58
+ reopen: {
59
+ isPending: P.isPending,
60
+ run: () => d && P.mutate({ path: { payable_id: d } }, H("reopen"))
61
+ },
62
+ forceApprove: {
63
+ isPending: F.isPending,
64
+ run: () => d && F.mutate({ path: { payable_id: d } }, H("forceApprove"))
65
+ },
66
+ forceReject: {
67
+ isPending: I.isPending,
68
+ run: () => d && I.mutate({ path: { payable_id: d } }, H("forceReject"))
69
+ }
70
+ }, W = V.map((e) => ({
71
+ ...e,
72
+ disabled: L,
73
+ loading: e.id === "markAsPaid" ? w : U[e.id]?.isPending ?? !1,
74
+ onSelect: () => {
75
+ if (!(L || !d)) {
76
+ if (e.id === "payBill") {
77
+ E();
78
+ return;
79
+ }
80
+ if (e.id === "markAsPaid") {
81
+ D();
82
+ return;
83
+ }
84
+ if (h(e.id)) {
85
+ z({
86
+ id: e.id,
87
+ scheduledPaymentIntentId: x
88
+ });
89
+ return;
90
+ }
91
+ U[e.id]?.run();
92
+ }
93
+ }
94
+ }));
95
+ return {
96
+ isActionPending: L,
97
+ actions: {
98
+ row: W.filter((e) => e.surface === "row"),
99
+ menu: W.filter((e) => e.surface === "menu")
100
+ },
101
+ decisionDialog: {
102
+ open: !!B,
103
+ copy: B ? {
104
+ ...C.decisionDialog[B.id],
105
+ presentation: g(B.id) ? p : void 0,
106
+ pendingApprovers: g(B.id) ? T ?? [] : void 0
107
+ } : void 0,
108
+ isPending: B ? U[B.id]?.isPending ?? !1 : !1,
109
+ onCancel: () => {
110
+ L || z(void 0);
111
+ },
112
+ onConfirm: (e) => {
113
+ !B || L || (U[B.id]?.run(e), z(void 0));
114
+ }
115
+ }
22
116
  };
23
- return /* @__PURE__ */ t("div", {
24
- className: "ttw:flex ttw:h-full ttw:w-full ttw:flex-col ttw:items-center ttw:justify-center ttw:gap-2 ttw:p-4 ttw:text-center",
25
- children: [/* @__PURE__ */ e("p", {
26
- className: "ttw:text-sm ttw:text-muted-foreground",
27
- children: a.previewUnavailable
28
- }), /* @__PURE__ */ e("a", {
29
- href: r.url,
30
- target: "_blank",
31
- rel: "noreferrer",
32
- className: "ttw:text-sm ttw:font-medium ttw:text-primary ttw:underline ttw:underline-offset-2",
33
- children: a.openFile
34
- })]
35
- });
117
+ }
118
+ var p = {
119
+ alignment: "center",
120
+ icon: d,
121
+ tone: "destructive",
122
+ actionWidth: "equal"
123
+ }, m = [
124
+ "reject",
125
+ "cancel",
126
+ "cancelScheduledPayment",
127
+ "forceApprove",
128
+ "forceReject"
129
+ ];
130
+ function h(e) {
131
+ return m.includes(e);
132
+ }
133
+ function g(e) {
134
+ return e === "forceApprove" || e === "forceReject";
36
135
  }
37
136
  //#endregion
38
- export { n as SOURCE_DOCUMENT_PREVIEW_LABELS_EN, r as createSourceDocumentPreview };
137
+ export { f as usePayableDetailActions };
@@ -1,168 +1,25 @@
1
- import { UNSAVED_BILL_DIALOG_LABELS_EN as e } from "../../ui/dist/index95.js";
2
- import "../../ui/dist/index.js";
3
- import { PAY_BILL_FLOW_LABELS_EN as t, mergePayBillFlowLabels as n } from "./index11.js";
4
- import { MARK_AS_PAID_FLOW_LABELS_EN as r, mergeMarkAsPaidFlowLabels as i } from "./index2.js";
5
- import "./index5.js";
6
- import { APPROVAL_POLICY_RULE_COPY_EN as a } from "./index15.js";
7
- import { BILL_DETAIL_ACTIONS_LABELS_EN as o, SCHEDULED_SUMMARY_LABEL_EN as s, mergeBillDetailActionsLabels as c } from "./index30.js";
8
- import { SOURCE_DOCUMENT_PREVIEW_LABELS_EN as l } from "./index31.js";
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { hasAnyScope as e } from "../../../shared/data-access/dist/lib/hasAnyScope.js";
6
+ import { Scope as t } from "../../../shared/data-access/dist/lib/scopes.js";
7
+ import "../../../shared/data-access/dist/index.js";
8
+ import { formatCalendarDate as n } from "../../../shared/util/dist/lib/formatCalendarDate.js";
9
+ import { useWidgetConfig as r } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
10
+ import "../../../shared/feature/dist/index.js";
11
+ import { isLiveScheduledPaymentRecord as i } from "../../data-access/dist/index3.js";
12
+ import { usePayablePaymentRecordsQuery as a } from "../../data-access/dist/index10.js";
13
+ import "../../data-access/dist/index.js";
9
14
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index32.js
10
- var u = {
11
- unmappedValidationError: (e, t) => `${e}: ${t}`,
12
- unknownValidationField: "(unknown field)",
13
- requiredField: "This field is required.",
14
- saveFailed: "We could not save this bill. Try again.",
15
- finalizeFailed: "We could not submit this bill. Try again.",
16
- draftSaved: "Bill saved as a draft.",
17
- submittedSaved: "Bill updated.",
18
- submittedDemoted: "Bill updated. It moved back to Drafts because some required details are missing.",
19
- billFinalized: "Bill submitted for approval.",
20
- unreadableMoney: "Enter a valid amount.",
21
- unusableQuantity: "Enter a quantity greater than 0.",
22
- lineItemsNeedAttention: "Check the highlighted line items before saving.",
23
- totalsNeedAttention: "Enter valid amounts for discount, tax, and total."
24
- }, d = {
25
- achMethod: "via ACH bank transfer",
26
- noMethod: "No payment method on file",
27
- accountHolder: "Account holder",
28
- routingNumber: "Routing number",
29
- accountNumber: "Account number",
30
- paymentMethodLoading: "Loading payment method...",
31
- paymentMethodUnavailable: "We could not load payment methods. Try again.",
32
- searchFailed: "We could not load vendors. Try again.",
33
- vendorDetailsFailed: "We could not load this vendor. Try again."
34
- }, f = {
35
- attachFailed: "We could not attach that file. Try again.",
36
- deleteFailed: "We could not remove that document. Try again.",
37
- noDocument: "No document attached to this bill.",
38
- pendingDeletionNotice: "This document will be removed when you save this bill.",
39
- preview: l
40
- }, p = {
41
- notProvided: "Not provided",
42
- paymentInstructionsValue: (e) => `Account ending in ${e}`,
43
- invoiceDateRow: "Invoice date",
44
- dueDateRow: "Due date",
45
- invoiceNumberRow: "Invoice number",
46
- glCodeMissing: "GL code not specified",
47
- glCodeUnavailable: "GL code unavailable",
48
- qtyPriceValue: (e, t) => `${e} x ${t}`,
49
- subtotalRow: "Subtotal",
50
- taxRow: "Tax",
51
- discountRow: "Discounts",
52
- totalRow: "Total",
53
- paymentInstructionsSaveError: "Couldn't save payment instructions. Try again.",
54
- paymentInstructionsLinkError: "Payment instructions were saved to the vendor, but couldn't be added to this bill. Try again."
55
- }, m = {
56
- dateLabel: (e) => new Date(e).toLocaleString("en-US", {
57
- month: "short",
58
- day: "numeric",
59
- year: "numeric",
60
- hour: "numeric",
61
- minute: "2-digit"
62
- }),
63
- byActor: (e, t) => `${e} by ${t}`,
64
- billAdded: "Bill added",
65
- billUploaded: "Bill uploaded",
66
- billUpdated: "Bill updated",
67
- attachmentAdded: "Attachment added",
68
- submittedForApproval: "Submitted for approval",
69
- approvalRequested: "Approval requested",
70
- approved: "Approved",
71
- autoApproved: "Approved automatically",
72
- rejected: "Rejected",
73
- rejectedWithReason: (e) => `Rejected: ${e}`,
74
- reopened: "Reopened",
75
- markedAsPaid: "Marked as paid",
76
- markedAsPartiallyPaid: "Marked as partially paid",
77
- paymentReverted: "Payment reverted",
78
- statusChanged: (e) => `Status changed to ${e}`
79
- }, h = {
80
- newTitle: "New bill",
81
- extractedTitle: (e) => `Bill from ${e}`,
82
- viewTitle: (e) => `Bill from ${e}`,
83
- readOnlyTitle: "Bill details",
84
- addedOn: (e) => `Added on ${e}`,
85
- submittedSaveButton: "Save changes",
86
- unsavedChanges: e,
87
- scheduledSummary: s,
88
- actions: o,
89
- detail: p,
90
- history: m,
91
- payBill: t,
92
- markAsPaid: r,
93
- approvalPolicyCopy: a,
94
- deleteDraft: {
95
- menuItem: "Delete draft",
96
- dialog: {
97
- title: "Delete this draft?",
98
- description: "The draft and anything entered on it are removed. This can't be undone.",
99
- confirmButton: "Delete draft"
100
- },
101
- error: "Couldn't delete this draft. Try again."
102
- },
103
- lineItemsGlCodeUnavailable: {
104
- loadError: "Couldn't load GL codes",
105
- noAccess: "You don't have access to GL codes",
106
- empty: "No GL codes set up yet"
107
- }
108
- };
109
- function g(e) {
15
+ function o({ payableId: o, scheduledPaymentDate: s, enabled: c = !0 }) {
16
+ let { initResponse: l } = r(), u = e(l?.scopes, [t.PaymentRecordReadOrg]), d = a(c ? o : void 0, { enabled: c && u }), f = d.paymentRecords.find(i), p = !!f || !!s, m = f?.planned_payment_date ?? (p ? s : void 0);
110
17
  return {
111
- ...h,
112
- ...e,
113
- actions: c(e?.actions),
114
- detail: {
115
- ...h.detail,
116
- ...e?.detail
117
- },
118
- history: {
119
- ...h.history,
120
- ...e?.history
121
- },
122
- payBill: n(e?.payBill),
123
- markAsPaid: i(e?.markAsPaid),
124
- lineItemsGlCodeUnavailable: {
125
- ...h.lineItemsGlCodeUnavailable,
126
- ...e?.lineItemsGlCodeUnavailable
127
- },
128
- unsavedChanges: {
129
- ...h.unsavedChanges,
130
- ...e?.unsavedChanges
131
- },
132
- approvalPolicyCopy: {
133
- ...h.approvalPolicyCopy,
134
- ...e?.approvalPolicyCopy
135
- },
136
- deleteDraft: {
137
- ...h.deleteDraft,
138
- ...e?.deleteDraft,
139
- dialog: (() => {
140
- let t = {
141
- ...h.deleteDraft.dialog,
142
- ...e?.deleteDraft?.dialog
143
- };
144
- return delete t.reason, t;
145
- })()
146
- }
18
+ hasScheduledPayment: p,
19
+ isResolving: d.isResolving,
20
+ scheduledDateLabel: m ? n(m) : void 0,
21
+ scheduledPaymentIntentId: f?.payment_intent_id ?? void 0
147
22
  };
148
23
  }
149
- var _ = {
150
- createTitle: "New vendor",
151
- editTitle: "Edit vendor",
152
- close: "Close the vendor form",
153
- nameLabel: "Name",
154
- addAddress: "Add address (optional)",
155
- paymentMethodsHeading: "Accepted payment methods",
156
- paymentMethodsDescription: "How and where will the money be sent. Don't have these yet? No problem. You can save this vendor and add their payment details later — you just won't be able to send payments until you do.",
157
- achTitle: "ACH bank transfer",
158
- achDescription: "Fast, direct deposit to the vendor's bank. Arrives in 1–3 business days.",
159
- addBankAccount: "Add bank account",
160
- accountHolderNameLabel: "Account holder name",
161
- routingNumberLabel: "Routing number",
162
- accountNumberLabel: "Account number",
163
- achHelp: "Ask your vendor for this — it's usually on their invoice, W-9, or a payment instructions email they send you.",
164
- cancel: "Cancel",
165
- save: "Save vendor"
166
- };
167
24
  //#endregion
168
- export { u as BILL_CREATE_MESSAGE_LABELS_EN, h as BILL_CREATE_SCREEN_LABELS_EN, p as BILL_DETAIL_VIEW_LABELS_EN, m as BILL_HISTORY_LABELS_EN, f as SOURCE_DOCUMENT_CONTAINER_LABELS_EN, _ as VENDOR_INLINE_FORM_LABELS_EN, d as VENDOR_SECTION_PROPS_LABELS_EN, g as mergeBillCreateScreenCopy };
25
+ export { o as useScheduledPayment };
@@ -1,80 +1,7 @@
1
- "use client";
2
- "use client";
3
- "use client";
4
- "use client";
5
- import { SourceDocumentPanel as e } from "../../ui/dist/index93.js";
6
- import "../../ui/dist/index.js";
7
- import { useAttachPayableFileMutation as t } from "../../data-access/dist/index11.js";
8
- import "../../data-access/dist/index.js";
9
- import { createSourceDocumentPreview as n } from "./index31.js";
10
- import { SOURCE_DOCUMENT_CONTAINER_LABELS_EN as r } from "./index32.js";
11
- import { useEffect as i, useState as a } from "react";
12
- import { jsx as o } from "react/jsx-runtime";
13
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index33.js
14
- function s(e) {
15
- let [t, n] = a();
16
- return i(() => {
17
- if (!e) {
18
- n(void 0);
19
- return;
20
- }
21
- let t = URL.createObjectURL(e);
22
- return n(t), () => URL.revokeObjectURL(t);
23
- }, [e]), t;
24
- }
25
- function c({ payableId: i, file: a, isDocumentPending: c, pendingFileName: l, readOnly: u, staging: d, deletion: f, labels: p }) {
26
- let { stagedFile: m, onFileStaged: h, onClearStagedFile: g, isSaving: _ } = d ?? {}, { isPending: v, onRequest: y, onDetachNow: b, isDeleting: x, hasFailed: S } = f ?? {}, C = {
27
- ...r,
28
- ...p,
29
- preview: {
30
- ...r.preview,
31
- ...p?.preview
32
- }
33
- }, w = t(), T = s(m), E = !!(a && !v || m);
34
- if (!E && (c || w.isPending)) return /* @__PURE__ */ o(e, {
35
- mode: "loading",
36
- fileName: l
37
- });
38
- if (!E && u) return /* @__PURE__ */ o("div", {
39
- className: "ttw:rounded-lg ttw:border ttw:border-border ttw:bg-card ttw:p-4 ttw:text-sm ttw:text-muted-foreground",
40
- children: C.noDocument
41
- });
42
- if (!E) return /* @__PURE__ */ o(e, {
43
- mode: "upload",
44
- uploadStatus: w.isPending || x ? "uploading" : "idle",
45
- uploadErrorMessage: w.isError ? C.attachFailed : S ? C.deleteFailed : void 0,
46
- noticeMessage: v && !S ? C.pendingDeletionNotice : void 0,
47
- onFilesSelected: (e) => {
48
- let [t] = e;
49
- if (t) {
50
- if (i) {
51
- let e = () => w.mutate({
52
- path: { payable_id: i },
53
- file: t
54
- });
55
- if (v && b) {
56
- b().then(e, () => void 0);
57
- return;
58
- }
59
- e();
60
- } else h?.(t);
61
- }
62
- }
63
- });
64
- let D = a?.name ?? m?.name ?? "", O = n(a || {
65
- name: D,
66
- url: T ?? "",
67
- mimetype: m?.type ?? ""
68
- }, C.preview);
69
- return /* @__PURE__ */ o(e, {
70
- mode: "document",
71
- fileName: D,
72
- preview: O,
73
- isDeleting: x,
74
- deleteErrorMessage: S ? C.deleteFailed : void 0,
75
- onDownload: a ? () => window.open(a.url, "_blank", "noopener,noreferrer") : void 0,
76
- onDelete: u ? void 0 : a && i ? y : _ ? void 0 : g
77
- });
2
+ var e = /* @__PURE__ */ new Set(["draft", "new"]);
3
+ function t(t) {
4
+ return !!(t && e.has(t));
78
5
  }
79
6
  //#endregion
80
- export { c as SourceDocumentContainer, c as default };
7
+ export { t as isEditablePayableStatus };