@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,108 +1,52 @@
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 { useUpdatePayableMutation as t } from "../../data-access/dist/index11.js";
8
- import "../../data-access/dist/index.js";
9
- import { counterpartFormBankAccountToCreatePayload as n, counterpartFormBankAccountToUpdatePayload as r, getAchInstructions as i, resolveCounterpartBankAccountWrite as a, validateAchFormValues as o } from "../../../shared/counterpart-management/feature/dist/lib/helpers.js";
10
- import { useCounterpartBankAccountsQuery as s, useCreateCounterpartBankAccountMutation as c, useUpdateCounterpartBankAccountMutation as l } from "../../../shared/counterpart-management/data-access/dist/index5.js";
11
- import "../../../shared/counterpart-management/feature/dist/index.js";
12
- import { useCallback as u, useEffect as d, useRef as f, useState as p } from "react";
1
+ import { derivePayableStatus as e } from "./index4.js";
2
+ import { BILL_STATUS_BADGE_LABELS_EN as t } from "../../ui/dist/index18.js";
3
+ import "../../ui/dist/index.js";
13
4
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index37.js
14
- var m = {
15
- accountHolderName: "",
16
- routingNumber: "",
17
- accountNumber: ""
18
- };
19
- function h({ payableId: h, counterpartId: g, saveErrorMessage: _, linkErrorMessage: v }) {
20
- let [y, b] = p(!1), [x, S] = p(m), [C, w] = p(), T = s(g), E = T.data?.data, D = c(), O = l(), k = t(), A = f(void 0), j = f(!1);
21
- d(() => {
22
- A.current = void 0;
23
- }, [g]);
24
- let M = u(() => {
25
- let e = T.isFetching ? void 0 : i(E);
26
- S(e ? {
27
- accountHolderName: e.account_holder_name ?? "",
28
- routingNumber: e.routing_number ?? "",
29
- accountNumber: e.account_number ?? ""
30
- } : m), A.current = e?.id ?? A.current, j.current = !T.isFetching, w(void 0), b(!0);
31
- }, [E, T.isFetching]);
32
- d(() => {
33
- if (!y || j.current || T.isFetching) return;
34
- j.current = !0;
35
- let e = i(E);
36
- e && (S((t) => t.accountHolderName === "" && t.routingNumber === "" && t.accountNumber === "" ? {
37
- accountHolderName: e.account_holder_name ?? "",
38
- routingNumber: e.routing_number ?? "",
39
- accountNumber: e.account_number ?? ""
40
- } : t), A.current = e.id);
41
- }, [
42
- y,
43
- T.isFetching,
44
- E
45
- ]);
46
- let N = u(() => {
47
- b(!1);
48
- }, []), P = u((e) => {
49
- S((t) => ({
50
- ...t,
51
- ...e
52
- }));
53
- }, []), F = u(async () => {
54
- if (!h || !g) return !1;
55
- let t = o(x);
56
- if (Object.keys(t).length > 0) return w(t), !1;
57
- if (w(void 0), T.isFetching || T.isError) return e.error(_), !1;
58
- let s = A.current;
59
- try {
60
- let e = a(E, s ?? i(E)?.id);
61
- e.kind === "update" ? (await O.mutateAsync({
62
- path: {
63
- counterpart_id: g,
64
- bank_account_id: e.bankAccountId
65
- },
66
- body: r(x, { includeAchDefaults: e.includeAchDefaults })
67
- }), s = e.bankAccountId) : s = (await D.mutateAsync({
68
- path: { counterpart_id: g },
69
- body: n(x, { isDefaultForCurrency: e.isDefaultForCurrency })
70
- }))?.id, A.current = s;
71
- } catch {
72
- return e.error(_), !1;
5
+ var n = /* @__PURE__ */ new Set([
6
+ "credit_note_linked",
7
+ "credit_note_unlinked",
8
+ "line_item_added",
9
+ "line_item_updated",
10
+ "line_item_removed",
11
+ "deleted"
12
+ ]);
13
+ function r(n, r, i) {
14
+ switch (n) {
15
+ case "payable_created": return r?.source_of_payable_data === "ocr" ? i.billUploaded : i.billAdded;
16
+ case "payable_updated": return i.billUpdated;
17
+ case "file_attached": return i.attachmentAdded;
18
+ case "submitted_for_approval": return i.submittedForApproval;
19
+ case "approval_requested": return i.approvalRequested;
20
+ case "approval_action": {
21
+ let e = r?.action, t = r?.reject_reason;
22
+ return e === "approve" ? i.approved : e === "reject" ? typeof t == "string" && t ? i.rejectedWithReason(t) : i.rejected : void 0;
73
23
  }
74
- try {
75
- await k.mutateAsync({
76
- path: { payable_id: h },
77
- body: { counterpart_bank_account_id: s }
78
- });
79
- } catch {
80
- return e.error(v), !1;
24
+ case "auto_approved": return i.autoApproved;
25
+ case "reopened": return i.reopened;
26
+ case "marked_as_paid": return i.markedAsPaid;
27
+ case "marked_as_partially_paid": return i.markedAsPartiallyPaid;
28
+ case "payment_reverted": return i.paymentReverted;
29
+ case "status_changed": {
30
+ let n = r?.new_status;
31
+ if (typeof n != "string") return;
32
+ let a = e({ apiStatus: n }).status;
33
+ return i.statusChanged(t[a] ?? t.unknown);
81
34
  }
82
- return b(!1), !0;
83
- }, [
84
- E,
85
- T.isError,
86
- T.isFetching,
87
- g,
88
- D,
89
- v,
90
- h,
91
- _,
92
- O,
93
- k,
94
- x
95
- ]);
96
- return {
97
- isOpen: y,
98
- values: x,
99
- errors: C,
100
- isSaving: D.isPending || O.isPending || k.isPending,
101
- open: M,
102
- close: N,
103
- onChange: P,
104
- save: F
105
- };
35
+ default: return;
36
+ }
37
+ }
38
+ function i(e, t, i) {
39
+ let a = new Map(t.map((e) => [e.id, e.name]));
40
+ return e.filter((e) => !n.has(e.event_type)).map((e) => {
41
+ let t = r(e.event_type, e.event_data, i);
42
+ if (!t) return;
43
+ let n = e.entity_user_id ? a.get(e.entity_user_id) : void 0;
44
+ return {
45
+ id: e.id,
46
+ dateLabel: i.dateLabel(e.timestamp),
47
+ description: n ? i.byActor(t, n) : t
48
+ };
49
+ }).filter((e) => !!e);
106
50
  }
107
51
  //#endregion
108
- export { h as usePaymentInstructionsForm };
52
+ export { i as buildBillHistory };
@@ -1,16 +1,96 @@
1
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index38.js
2
- function e(e) {
3
- return new Promise((t, n) => {
4
- let r = new FileReader();
5
- r.onerror = () => n(r.error ?? /* @__PURE__ */ Error("Failed to read file")), r.onload = () => {
6
- let e = r.result;
7
- if (typeof e != "string") {
8
- n(/* @__PURE__ */ Error("Failed to read file as a data URL"));
9
- return;
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"
10
22
  }
11
- t(e.slice(e.indexOf(",") + 1));
12
- }, r.readAsDataURL(e);
13
- });
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
+ };
14
94
  }
15
95
  //#endregion
16
- export { e as encodeFileToBase64 };
96
+ export { e as BILL_DETAIL_ACTIONS_LABELS_EN, t as SCHEDULED_SUMMARY_LABEL_EN, a as mergeBillDetailActionsLabels, i as mergeDecisionDialogCopy };
@@ -1,51 +1,38 @@
1
- import { parseDecimalAmountToMinorUnits as e } from "../../../shared/util/dist/lib/parseDecimalAmountToMinorUnits.js";
2
- import "../../data-access/dist/index.js";
1
+ import { jsx as e, jsxs as t } from "react/jsx-runtime";
3
2
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index39.js
4
- var t = "USD";
5
- function n(n) {
6
- return e(n, t);
7
- }
8
- function r(e) {
9
- let t = e.trim();
10
- if (!t) return null;
11
- let n = Number(t);
12
- return Number.isFinite(n) && n > 0 ? n : null;
13
- }
14
- function i(e) {
15
- return !!(e.description.trim() || e.glCode.trim() || n(e.price) !== null || n(e.amount) !== null);
16
- }
17
- function a(e) {
18
- return n(e) ?? 0;
19
- }
20
- function o(e) {
21
- let t = Number.parseFloat(e);
22
- return Number.isFinite(t) ? t : 0;
23
- }
24
- function s(e) {
25
- return (e / 100).toFixed(2);
26
- }
27
- function c({ values: e, counterpartId: r, clearCounterpart: i, counterpartBankAccountId: a, editedTotals: o, document: s }) {
28
- let c = { currency: t };
29
- return r ? c.counterpart_id = r : i && (c.counterpart_id = null), r ? c.counterpart_bank_account_id = a ?? null : i && (c.counterpart_bank_account_id = null), e.invoiceNumber && (c.document_id = e.invoiceNumber), e.invoiceDate && (c.issued_at = e.invoiceDate), e.dueDate && (c.due_date = e.dueDate), s && (c.base64_encoded_file = s.base64EncodedFile, c.file_name = s.fileName), o && (c.discount = n(o.discount) ?? 0, c.tax_amount = n(o.tax) ?? 0, o.total !== void 0 && (c.total_amount = n(o.total) ?? 0)), c;
30
- }
31
- function l(e) {
32
- return e.filter(i).map((e) => {
33
- let t = n(e.amount), i = r(e.quantity) ?? 1, a = n(e.price) ?? (t === null ? 0 : Math.round(t / i)), o = Math.round(i * a);
34
- return {
35
- name: e.description,
36
- quantity: i,
37
- unit_price: a,
38
- tax: 0,
39
- ...t !== null && t !== o ? { subtotal: t } : {},
40
- ...e.glCode ? { ledger_account_id: e.glCode } : {}
41
- };
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
22
+ };
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
+ })]
42
35
  });
43
- }
44
- function u(e, t) {
45
- return s(Math.round(o(e) * a(t)));
46
- }
47
- function d(e, t, n) {
48
- return s(e.reduce((e, t) => e + a(t.amount), 0) + a(t) - a(n));
49
36
  }
50
37
  //#endregion
51
- export { d as calculateTotal, u as displayLineAmount, i as isPersistableLineItem, c as mapBillFormToPayload, l as mapLineItemsToPayload, n as parseMoneyToMinorUnits, r as parseQuantity };
38
+ export { n as SOURCE_DOCUMENT_PREVIEW_LABELS_EN, r as createSourceDocumentPreview };
@@ -1,66 +1,63 @@
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 { dateToCalendarKey as i, getDefaultPaymentDate as a, isTodayInEastern as o } from "./index3.js";
11
- import { useMarkPayableAsPaidMutation as s } from "../../data-access/dist/index11.js";
12
- import "../../data-access/dist/index.js";
13
- import { mergeMarkAsPaidFlowLabels as c } from "./index2.js";
14
- import { useEffect as l, useState as u } from "react";
15
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index4.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 = s(), [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(i(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(a()), 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 ? o(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: `${i(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
- }
2
+ var e = /* @__PURE__ */ new Set([
3
+ "new",
4
+ "approve_in_progress",
5
+ "waiting_to_be_paid",
6
+ "partially_paid"
7
+ ]);
8
+ function t(e, t) {
9
+ let n = /* @__PURE__ */ new Date(`${e.slice(0, 10)}T00:00:00Z`), r = Date.UTC(t.getUTCFullYear(), t.getUTCMonth(), t.getUTCDate());
10
+ return n.getTime() < r;
11
+ }
12
+ function n({ apiStatus: n, dueDate: r, scheduledPaymentDate: i, hasScheduledPayment: a = !!i, now: o = /* @__PURE__ */ new Date() }) {
13
+ if (e.has(n) && a) return {
14
+ status: "scheduled",
15
+ tone: "accent",
16
+ isOverdue: !1
63
17
  };
18
+ let s = !!(e.has(n) && r && t(r, o));
19
+ switch (n) {
20
+ case "draft": return {
21
+ status: "draft",
22
+ tone: "neutral",
23
+ isOverdue: s
24
+ };
25
+ case "new": return {
26
+ status: "finalized",
27
+ tone: "warning",
28
+ isOverdue: s
29
+ };
30
+ case "approve_in_progress": return {
31
+ status: "pending_approval",
32
+ tone: "warning",
33
+ isOverdue: s
34
+ };
35
+ case "waiting_to_be_paid": return {
36
+ status: "ready_to_pay",
37
+ tone: "info",
38
+ isOverdue: s
39
+ };
40
+ case "partially_paid": return {
41
+ status: "partially_paid",
42
+ tone: "success",
43
+ isOverdue: s
44
+ };
45
+ case "paid": return {
46
+ status: "paid",
47
+ tone: "success",
48
+ isOverdue: s
49
+ };
50
+ case "canceled": return {
51
+ status: "canceled",
52
+ tone: "muted",
53
+ isOverdue: s
54
+ };
55
+ case "rejected": return {
56
+ status: "rejected",
57
+ tone: "danger",
58
+ isOverdue: s
59
+ };
60
+ }
64
61
  }
65
62
  //#endregion
66
- export { d as useMarkAsPaidFlow };
63
+ export { n as derivePayableStatus };