@tesouro/embedded-components-react 0.3.49 → 0.3.51

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 (144) hide show
  1. package/dist/index.css +8 -2
  2. package/dist/index.js +2 -2
  3. package/dist/lib/BillPayWidget.js +1 -1
  4. package/dist/lib/LinkedAccountsWidget.js +1 -1
  5. package/dist/libs/shared/util-validation/dist/{index22.js → index23.js} +1 -1
  6. package/dist/libs/shared/util-validation/dist/index7.js +6 -0
  7. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index.js +11 -10
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index10.js +39 -30
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index11.js +26 -311
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index12.js +325 -12
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index13.js +13 -26
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index14.js +20 -40
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index15.js +75 -24
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index16.js +36 -0
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index5.js +80 -68
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index6.js +86 -73
  17. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index7.js +77 -14
  18. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index8.js +18 -63
  19. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index9.js +50 -29
  20. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js +22 -18
  21. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index10.js +82 -30
  22. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index11.js +7 -42
  23. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index12.js +15 -159
  24. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index13.js +23 -33
  25. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index14.js +66 -1
  26. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index15.js +2 -50
  27. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index16.js +3 -4
  28. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index17.js +5 -14
  29. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index18.js +3 -14
  30. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index19.js +31 -63
  31. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index2.js +23 -18
  32. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index20.js +37 -24
  33. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index21.js +161 -61
  34. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index22.js +29 -130
  35. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index23.js +1 -25
  36. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index24.js +47 -4
  37. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index25.js +4 -41
  38. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index26.js +12 -55
  39. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index27.js +13 -4
  40. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index28.js +63 -72
  41. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index29.js +26 -49
  42. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index3.js +23 -23
  43. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index30.js +62 -93
  44. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index31.js +133 -34
  45. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index32.js +20 -163
  46. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index33.js +4 -77
  47. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index34.js +39 -21
  48. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index35.js +5 -210
  49. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index36.js +70 -211
  50. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index37.js +47 -103
  51. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index38.js +92 -12
  52. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index39.js +34 -47
  53. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index4.js +59 -62
  54. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index40.js +163 -29
  55. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index41.js +67 -181
  56. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index42.js +20 -32
  57. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index43.js +203 -94
  58. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index44.js +214 -15
  59. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index45.js +98 -312
  60. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index46.js +16 -4
  61. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index47.js +49 -31
  62. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index48.js +29 -80
  63. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index49.js +183 -156
  64. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index5.js +9 -2
  65. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index50.js +38 -3
  66. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index51.js +102 -2
  67. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index52.js +18 -44
  68. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index53.js +343 -1
  69. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index54.js +4 -8
  70. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index55.js +30 -8
  71. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index56.js +79 -88
  72. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index57.js +179 -3
  73. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index58.js +3 -9
  74. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index59.js +2 -20
  75. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index6.js +4 -2
  76. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index60.js +38 -51
  77. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index61.js +0 -2
  78. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index62.js +6 -126
  79. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index63.js +9 -9
  80. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index64.js +92 -44
  81. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index65.js +3 -23
  82. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index66.js +123 -26
  83. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index67.js +7 -82
  84. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index68.js +8 -48
  85. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index69.js +45 -250
  86. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index7.js +69 -5
  87. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index70.js +21 -113
  88. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index71.js +27 -208
  89. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index72.js +86 -4
  90. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index73.js +47 -5
  91. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index74.js +244 -106
  92. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index75.js +115 -1
  93. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index76.js +201 -16
  94. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index77.js +4 -0
  95. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index78.js +8 -0
  96. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index79.js +115 -0
  97. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index8.js +44 -5
  98. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index80.js +1 -0
  99. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index81.js +25 -0
  100. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index9.js +94 -3
  101. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index.js +19 -19
  102. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index18.js +1 -0
  103. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index50.js +28 -28
  104. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index59.js +1 -3
  105. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index60.js +6 -16
  106. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index73.js +119 -16
  107. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index74.js +24 -111
  108. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index75.js +89 -2
  109. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index76.js +2 -7
  110. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index77.js +5 -28
  111. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index78.js +30 -2
  112. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index79.js +2 -7
  113. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index80.js +5 -32
  114. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index81.js +34 -2
  115. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index82.js +2 -12
  116. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index83.js +10 -104
  117. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index84.js +105 -1
  118. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index85.js +2 -17
  119. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index86.js +15 -123
  120. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index87.js +125 -2
  121. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index88.js +2 -18
  122. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index89.js +14 -6
  123. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index90.js +7 -167
  124. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index91.js +170 -2
  125. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index92.js +2 -14
  126. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index93.js +11 -105
  127. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index94.js +108 -2
  128. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index95.js +2 -10
  129. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index96.js +8 -45
  130. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index97.js +47 -2
  131. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index98.js +2 -0
  132. package/dist/libs/tesouro-embedded-components-react/create-card-widget/feature/dist/index8.js +95 -94
  133. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/index.js +1 -1
  134. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/index10.js +45 -0
  135. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/index7.js +18 -55
  136. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/index8.js +46 -265
  137. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/index9.js +273 -34
  138. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/feature/dist/lib/useApproverOptions.js +1 -1
  139. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +23 -23
  140. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +87 -71
  141. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  142. package/dist/libs/tesouro-embedded-components-react/team-widget/feature/dist/index11.js +1 -1
  143. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index8.js +1 -1
  144. package/package.json +1 -1
@@ -2,321 +2,107 @@
2
2
  "use client";
3
3
  "use client";
4
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 { useAllLedgerAccountsQuery as ee } from "../../../shared/data-access/dist/lib/reference-data/useLedgerAccountsQuery.js";
8
- import { useAllOrganizationUsersQuery as te } from "../../../shared/data-access/dist/lib/user/useAllOrganizationUsersQuery.js";
9
- import "../../../shared/data-access/dist/index.js";
10
- import { formatCalendarDate as ne } from "../../../shared/util/dist/lib/formatCalendarDate.js";
11
- import { useWidgetConfig as re } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
12
- import "../../../shared/feature/dist/index.js";
13
- import { resolveAmountDueMinorUnits as ie } from "./index6.js";
14
- import { resolveVendor as ae } from "./index7.js";
15
- import { BillCreateScreen as oe } from "../../ui/dist/index44.js";
16
- import { BillDecisionDialog as n } from "../../ui/dist/index50.js";
17
- import { BillDuplicateNotice as se } from "../../ui/dist/index60.js";
18
- import { ExtractionNotice as ce } from "../../ui/dist/index77.js";
19
- import { MarkAsPaidDialog as le } from "../../ui/dist/index86.js";
20
- import { UnsavedBillDialog as ue } from "../../ui/dist/index96.js";
21
- import "../../ui/dist/index.js";
22
- import { usePayableHistoryQuery as de } from "../../data-access/dist/index7.js";
23
- import { useAllPayableLineItemsQuery as fe } from "../../data-access/dist/index8.js";
24
- import { usePayableQuery as pe } from "../../data-access/dist/index14.js";
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/index12.js";
25
8
  import "../../data-access/dist/index.js";
26
- import { PayBillFlow as me } from "./index13.js";
27
- import "./index14.js";
28
- import { useMarkAsPaidFlow as he } from "./index4.js";
29
- import "./index5.js";
30
- import { BILL_CREATE_MESSAGE_LABELS_EN as ge, mergeBillCreateScreenCopy as _e } from "./index32.js";
31
- import { useBillCreateController as ve } from "./index41.js";
32
- import { useBillForm as ye } from "./index43.js";
33
- import { useApprovalPolicyCardView as be } from "./index19.js";
34
- import { useCurrentApprovalRequestId as xe } from "./index20.js";
35
- import { usePayableDetailActions as Se } from "./index22.js";
36
- import { useScheduledPayment as Ce } from "./index23.js";
37
- import { isEditablePayableStatus as we } from "./index24.js";
38
- import { useDraftDelete as Te } from "./index25.js";
39
- import { buildBillDetailView as Ee } from "./index28.js";
40
- import { buildBillHistory as De } from "./index29.js";
41
- import { SourceDocumentContainer as Oe } from "./index33.js";
42
- import { useVendorSectionProps as ke } from "./index36.js";
43
- import { usePaymentInstructionsForm as Ae } from "./index37.js";
44
- import { billCreateTestIds as r } from "./index44.js";
45
- import { useCallback as i, useEffect as je, useMemo as a, useRef as Me, useState as o } from "react";
46
- import { Fragment as Ne, jsx as s, jsxs as Pe } from "react/jsx-runtime";
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";
47
13
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index45.js
48
- function Fe(e) {
49
- return !!(e?.bank_account?.account_holder_name && e.bank_account.routing_number && e.bank_account.account_number);
50
- }
51
- function c({ open: c, onOpenChange: l, payableId: u, readOnly: d = !1, copy: f, onCollapse: Ie, poweredByBankName: Le, isPossibleDuplicate: Re }) {
52
- let p = a(() => _e(f), [f]), [m, h] = o(), [g, _] = o(!1), [ze, Be] = o(!1), [Ve, v] = o(!1), [He, y] = o(!1), [Ue, b] = o(), x = u ?? Ue, S = pe(x, { pollWhileOcrProcessing: !0 }), C = fe(x), { initResponse: w } = re(), T = !!w, E = e(w?.scopes, [t.AccountingConfigReadOrg]), D = ee({ enabled: E }), O = S.data, k = !x || !!O, A = !d && k && !!x && O?.status !== "draft", We = !d && !!O && !we(O?.status), j = d || We, M = ye({
53
- payable: O,
54
- lineItems: C.lineItems
55
- }), N = O?.counterpart_id;
56
- je(() => {
57
- g || N && (h(N), _(!0));
58
- }, [g, N]);
59
- let Ge = i((e) => {
60
- _(!0), h(e);
61
- }, []), P = ke({
62
- payableId: d ? void 0 : x,
63
- counterpartId: d ? void 0 : m,
64
- payableCounterpartId: N,
65
- onCounterpartChange: Ge,
66
- requiredError: M.errors?.vendor,
67
- payableCounterpartBankAccountId: O?.counterpart_bank_account_id ?? void 0,
68
- extractedVendor: O?.counterpart_raw_data ?? void 0
69
- }), Ke = !!(x && g) && !m, qe = a(() => A ? { saveDraftButton: p.submittedSaveButton } : void 0, [p.submittedSaveButton, A]), Je = a(() => A ? { draftSaved: ge.submittedSaved } : void 0, [A]), F = S.refetch, Ye = i(async () => {
70
- let { data: e } = await F();
71
- return e?.status ?? void 0;
72
- }, [F]), I = ve({
73
- payableId: u,
74
- form: M,
75
- labels: Je,
76
- counterpartId: m,
77
- clearCounterpart: Ke,
78
- prepareVendorForSave: P.savePaymentInstructions,
79
- onPayableCreated: b,
80
- onSaved: b,
81
- onDraftSaved: () => l(!1),
82
- onFinalized: () => l(!1),
83
- readSavedStatus: A ? Ye : void 0
84
- }), L = !!(I.isSavingDraft || I.isFinalizing), R = d ? x : void 0, z = xe({
85
- payableId: R,
86
- status: O?.status
87
- }), B = Me(null), V = Ce({
88
- payableId: x,
89
- scheduledPaymentDate: O?.scheduled_payment_date,
90
- enabled: d || A
91
- }), Xe = ae(O), H = Ae({
92
- payableId: R,
93
- counterpartId: d ? N : void 0,
94
- saveErrorMessage: p.detail.paymentInstructionsSaveError,
95
- linkErrorMessage: p.detail.paymentInstructionsLinkError
96
- }), Ze = e(w?.scopes, [t.CounterpartWriteOrg]) && e(w?.scopes, [t.PayableWriteOrg]), U = he({
97
- payableId: R,
98
- amountDueMinorUnits: ie(O) ?? 0,
99
- amountToPayMinorUnits: O?.amount_to_pay ?? void 0,
100
- currencyCode: O?.currency ?? void 0,
101
- dueDate: O?.due_date,
102
- hasScheduledPayment: V.hasScheduledPayment,
103
- labels: p.markAsPaid
104
- }), W = be({
105
- payableId: R,
106
- approvalPolicyId: O?.approval_policy_id,
107
- enabled: d,
108
- copy: p.approvalPolicyCopy
109
- }), { actions: G, decisionDialog: Qe, isActionPending: $e } = Se({
110
- payableId: d || A ? x : void 0,
111
- status: O?.status,
112
- currentApprovalRequestId: z.id,
113
- isPolicyApprover: z.isPolicyApprover,
114
- hasWaitingRequest: z.hasWaitingRequest,
115
- arePendingApproversUnknown: W.isLoading,
116
- hasScheduledPayment: V.hasScheduledPayment,
117
- scheduledPaymentIntentId: V.scheduledPaymentIntentId,
118
- isScheduledPaymentUnknown: V.isResolving,
119
- pendingApprovers: W.pendingApprovers,
120
- labels: p.actions,
121
- isMarkAsPaidPending: U.isPending,
122
- onMarkAsPaidSelect: U.open,
123
- onPayBillSelect: () => Fe(Xe) || !Ze ? B.current?.open() : H.open(),
124
- onActionSucceeded: A ? () => l(!1) : void 0
125
- }), K = Te({
126
- payableId: x,
127
- status: O?.status,
128
- enabled: !d,
129
- labels: p.deleteDraft,
130
- onDeleted: () => l(!1)
131
- }), q = L || $e, et = a(() => [...K.menuItems, ...A ? G.menu.map((e) => ({
132
- id: e.id,
133
- label: e.label,
134
- onSelect: e.onSelect,
135
- disabled: e.disabled
136
- })) : []], [
137
- G.menu,
138
- K.menuItems,
139
- A
140
- ]), J = a(() => (D.data?.data ?? []).map((e) => ({
141
- value: e.id,
142
- label: [e.nominal_code, e.name].filter(Boolean).join(" — ")
143
- })), [D.data]), Y;
144
- T && (E ? D.isError ? Y = p.lineItemsGlCodeUnavailable.loadError : !D.isResolving && J.length === 0 && (Y = p.lineItemsGlCodeUnavailable.empty) : Y = p.lineItemsGlCodeUnavailable.noAccess);
145
- let tt = !T || !!Y || D.isResolving, nt = E && !D.isResolving && !D.isError, rt = de(R), it = e(w?.scopes, [t.UserReadOrg]), at = te({ enabled: d && it }), ot = a(() => De(rt.data?.data ?? [], at.data?.data ?? [], p.history), [
146
- rt.data,
147
- at.data,
148
- p.history
149
- ]), st = a(() => d && O ? Ee({
150
- payable: O,
151
- lineItems: C.lineItems,
152
- glCodeOptions: J,
153
- glCodeRosterAvailable: nt,
154
- history: ot,
155
- approvalPolicy: W.view,
156
- labels: p.detail,
157
- hasScheduledPayment: V.hasScheduledPayment
158
- }) : void 0, [
159
- V.hasScheduledPayment,
160
- W.view,
161
- p.detail,
162
- J,
163
- nt,
164
- ot,
165
- C.lineItems,
166
- O,
167
- d
168
- ]), ct = O?.source_of_payable_data === "ocr", X = Xe?.name, lt = d ? X ? p.viewTitle(X) : p.readOnlyTitle : X && (ct || A) ? p.extractedTitle(X) : p.newTitle, ut = d && O?.created_at ? p.addedOn(ne(O.created_at.slice(0, 10))) : void 0, Z = i(() => {
169
- let e = M.isDirty || P.hasUnsavedVendorChanges || !!I.stagedFile || I.isFileDeletionPending;
170
- if (!j && e) {
171
- y(!0);
172
- return;
173
- }
174
- l(!1);
175
- }, [
176
- I.isFileDeletionPending,
177
- I.stagedFile,
178
- M.isDirty,
179
- j,
180
- l,
181
- P.hasUnsavedVendorChanges
182
- ]), dt = i(() => {
183
- y(!1), l(!1);
184
- }, [l]), Q = C.isResolving || P.mode === "creating", ft = i(async () => {
185
- if (Q) return;
186
- let e = await I.saveDraft();
187
- y(!1), e && l(!1);
188
- }, [
189
- I,
190
- Q,
191
- l
192
- ]), pt = i((e) => {
193
- if (!q) return e ? l(!0) : Z();
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);
194
41
  }, [
195
- Z,
196
- q,
197
- l
198
- ]), mt = !!Re && !Ve, $ = !d && ct && !ze, ht = mt || $ ? /* @__PURE__ */ Pe(Ne, { children: [mt ? /* @__PURE__ */ s(se, {
199
- onNotADuplicate: d ? void 0 : () => v(!0),
200
- onRemoveBill: d ? void 0 : () => v(!0),
201
- testId: r.duplicateNotice
202
- }) : null, $ ? /* @__PURE__ */ s(ce, { onDismiss: () => Be(!0) }) : null] }) : void 0;
203
- return /* @__PURE__ */ Pe(Ne, { children: [
204
- /* @__PURE__ */ s(oe, {
205
- open: c,
206
- onOpenChange: pt,
207
- title: lt,
208
- subtitle: ut,
209
- notice: ht,
210
- vendor: {
211
- ...P,
212
- testId: r.vendorSection
213
- },
214
- values: M.values,
215
- errors: M.errors,
216
- onChange: M.onChange,
217
- lineItems: {
218
- items: M.lineItemRows,
219
- glCodeOptions: J,
220
- glCodeDisabled: tt,
221
- glCodeUnavailableMessage: Y,
222
- discount: M.discount,
223
- onDiscountChange: M.onDiscountChange,
224
- tax: M.tax,
225
- onTaxChange: M.onTaxChange,
226
- total: M.total,
227
- onTotalChange: M.onTotalChange,
228
- onAddLineItem: M.onAddLineItem,
229
- errors: M.lineItemErrors,
230
- testId: r.lineItems
231
- },
232
- documentPanel: /* @__PURE__ */ s(Oe, {
233
- payableId: x,
234
- readOnly: j,
235
- isDocumentPending: !!x && !O?.file && (S.isLoading || O?.ocr_status === "processing"),
236
- file: O?.file ? {
237
- id: O.file.id,
238
- name: O.file.name,
239
- url: O.file.url,
240
- mimetype: O.file.mimetype
241
- } : void 0,
242
- staging: {
243
- stagedFile: I.stagedFile,
244
- onFileStaged: I.stageFile,
245
- onClearStagedFile: I.clearStagedFile,
246
- isSaving: L
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
247
65
  },
248
- deletion: {
249
- isPending: I.isFileDeletionPending,
250
- onRequest: I.requestFileDeletion,
251
- onDetachNow: I.detachFileNow,
252
- isDeleting: I.isDeletingFile,
253
- hasFailed: I.hasFileDeletionFailed
254
- }
255
- }),
256
- menuItems: et,
257
- readOnly: j,
258
- detail: d ? {
259
- view: st,
260
- actions: G,
261
- scheduledSummary: V.hasScheduledPayment && V.scheduledDateLabel ? p.scheduledSummary(V.scheduledDateLabel) : void 0,
262
- paymentInstructionsForm: N && Ze ? {
263
- isOpen: H.isOpen,
264
- values: H.values,
265
- errors: H.errors,
266
- isSaving: H.isSaving,
267
- onOpen: H.open,
268
- onCancel: H.close,
269
- onChange: H.onChange,
270
- onSave: H.save
271
- } : void 0,
272
- isLoading: S.isLoading || C.isResolving || D.isResolving,
273
- isError: S.isError || C.isError || D.isError
274
- } : void 0,
275
- isLineItemsLoading: C.isResolving,
276
- isSaving: q,
277
- isSavingDraft: I.isSavingDraft,
278
- isFinalizing: I.isFinalizing,
279
- onCancel: Z,
280
- onCollapse: d ? Ie : void 0,
281
- onSaveDraft: I.saveDraft,
282
- onFinalize: I.finalize,
283
- showFinalize: !A && k,
284
- labels: qe,
285
- testId: r.dialog
286
- }),
287
- /* @__PURE__ */ s(ue, {
288
- open: He,
289
- onSaveDraft: ft,
290
- onDiscard: dt,
291
- onCancel: () => y(!1),
292
- isSaving: I.isSavingDraft,
293
- isSaveDraftDisabled: Q,
294
- labels: p.unsavedChanges,
295
- testId: r.unsavedDialog,
296
- saveDraftTestId: r.unsavedSaveDraft,
297
- discardTestId: r.unsavedDiscard
298
- }),
299
- /* @__PURE__ */ s(n, {
300
- ...Qe,
301
- labels: { cancelButton: p.actions.decisionDialog.cancelButton },
302
- testId: r.decisionDialog,
303
- confirmTestId: r.decisionConfirm,
304
- reasonTestId: r.decisionReason
305
- }),
306
- /* @__PURE__ */ s(n, {
307
- ...K.dialog,
308
- labels: { cancelButton: p.actions.decisionDialog.cancelButton },
309
- testId: r.deleteDraftDialog,
310
- confirmTestId: r.deleteDraftConfirm
311
- }),
312
- /* @__PURE__ */ s(le, { ...U.dialogProps }),
313
- d && O ? /* @__PURE__ */ s(me, {
314
- ref: B,
315
- payable: O,
316
- poweredByBankName: Le,
317
- labels: p.payBill
318
- }) : null
319
- ] });
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;
73
+ }
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;
81
+ }
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
+ };
320
106
  }
321
107
  //#endregion
322
- export { c as BillCreateDialog, c as default };
108
+ export { h as usePaymentInstructionsForm };
@@ -1,4 +1,16 @@
1
- import "./index32.js";
2
- import "./index41.js";
3
- import "./index43.js";
4
- import "./index45.js";
1
+ //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index46.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;
10
+ }
11
+ t(e.slice(e.indexOf(",") + 1));
12
+ }, r.readAsDataURL(e);
13
+ });
14
+ }
15
+ //#endregion
16
+ export { e as encodeFileToBase64 };
@@ -1,33 +1,51 @@
1
- import { BILL_DETAILS_SHEET_LABELS_EN as e } from "../../ui/dist/index55.js";
2
- import "../../ui/dist/index.js";
3
- import { MARK_AS_PAID_FLOW_LABELS_EN as t } from "./index2.js";
4
- import "./index5.js";
5
- import { APPROVAL_POLICY_RULE_COPY_EN as n } from "./index15.js";
6
- import { BILL_DETAIL_ACTIONS_LABELS_EN as r, SCHEDULED_SUMMARY_LABEL_EN as i } from "./index30.js";
1
+ import { parseDecimalAmountToMinorUnits as e } from "../../../shared/util/dist/lib/parseDecimalAmountToMinorUnits.js";
2
+ import "../../data-access/dist/index.js";
7
3
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index47.js
8
- var a = {
9
- subtitle: "Accounts payable",
10
- vendorRow: "Vendor",
11
- bankAccountRow: "ACH bank account",
12
- bankAccountValue: (e) => `Account ending in ${e}`,
13
- invoiceNumberRow: "Number",
14
- issueDateRow: "Issue date",
15
- dueDateRow: "Due date",
16
- poNumberRow: "PO number",
17
- notProvided: "Not provided",
18
- glCodeMissing: "GL code not specified",
19
- quantityValue: (e, t) => `${e} x ${t}`,
20
- subtotalRow: "Subtotal",
21
- discountsRow: "Discounts",
22
- taxRow: "Tax",
23
- totalRow: "Total",
24
- actionError: r.actionError,
25
- actionSuccess: r.actionSuccess,
26
- scheduledSummary: i,
27
- sheet: e,
28
- decisionDialog: r.decisionDialog,
29
- approvalPolicyCopy: n,
30
- markAsPaid: t
31
- };
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
+ };
42
+ });
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
+ }
32
50
  //#endregion
33
- export { a as BILL_DETAILS_LABELS_EN };
51
+ export { d as calculateTotal, u as displayLineAmount, i as isPersistableLineItem, c as mapBillFormToPayload, l as mapLineItemsToPayload, n as parseMoneyToMinorUnits, r as parseQuantity };
@@ -1,85 +1,34 @@
1
- import { formatCalendarDate as e } from "../../../shared/util/dist/lib/formatCalendarDate.js";
2
- import { resolveVendor as t, resolveVendorName as n } from "./index7.js";
3
- import { derivePayableStatus as r } from "./index26.js";
4
- import { formatBillMoney as i } from "./index27.js";
1
+ import { BILL_CREATE_MESSAGE_LABELS_EN as e } from "./index40.js";
2
+ import { isPersistableLineItem as t, parseMoneyToMinorUnits as n, parseQuantity as r } from "./index47.js";
5
3
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index48.js
6
- function a({ payable: a, lineItems: o, ledgerAccounts: s, labels: c, hasScheduledPayment: l, now: u }) {
7
- let d = a.currency, f = (e) => i(e, d), p = r({
8
- apiStatus: a.status,
9
- dueDate: a.due_date,
10
- scheduledPaymentDate: a.scheduled_payment_date,
11
- hasScheduledPayment: l,
12
- now: u
13
- }), m = t(a), h = n(a), g = e(a.issued_at) || c.notProvided, _ = e(a.due_date) || c.notProvided, v = [{
14
- label: c.vendorRow,
15
- value: h || c.notProvided,
16
- secondaryValue: m?.email ?? void 0
17
- }], y = m?.bank_account?.account_number;
18
- y && v.push({
19
- label: c.bankAccountRow,
20
- value: c.bankAccountValue(y.slice(-4))
21
- });
22
- let b = [
23
- {
24
- label: c.invoiceNumberRow,
25
- value: a.document_id || c.notProvided
26
- },
27
- {
28
- label: c.issueDateRow,
29
- value: g
30
- },
31
- {
32
- label: c.dueDateRow,
33
- value: _
34
- },
35
- {
36
- label: c.poNumberRow,
37
- value: c.notProvided
38
- }
39
- ], x = new Map(s.map((e) => [e.id, [e.nominal_code, e.name].filter(Boolean).join(" — ")])), S = o.map((e) => {
40
- let t = f(e.unit_price);
41
- return {
42
- id: e.id,
43
- description: e.name ?? e.description ?? "",
44
- glCodeLabel: (e.ledger_account_id ? x.get(e.ledger_account_id) : void 0) || c.glCodeMissing,
45
- quantityLabel: e.quantity != null && t ? c.quantityValue(String(e.quantity), t) : "",
46
- amountLabel: f(e.subtotal) ?? ""
47
- };
48
- }), C = [
49
- {
50
- label: c.subtotalRow,
51
- value: a.subtotal
52
- },
53
- {
54
- label: c.discountsRow,
55
- value: a.discount
56
- },
57
- {
58
- label: c.taxRow,
59
- value: a.tax_amount
60
- }
61
- ].map(({ label: e, value: t }) => ({
62
- label: e,
63
- value: f(t)
64
- })).filter((e) => !!e.value), w = f(a.total_amount);
65
- return w && C.push({
66
- label: c.totalRow,
67
- value: w,
68
- emphasis: !0
4
+ var i = /^(?:\d{1,3}(?:,\d{3})+(?:\.\d+)?|\d+(?:\.\d+)?|\.\d+)$/;
5
+ function a(e) {
6
+ let t = e.trim();
7
+ return !t || n(t) !== null ? !0 : i.test(t) ? Number(t.replaceAll(",", "")) === 0 : !1;
8
+ }
9
+ function o(t, i = e) {
10
+ let a = {};
11
+ for (let e of t) {
12
+ let t = n(e.price), o = n(e.amount), s = {};
13
+ e.price.trim() && t === null && (s.price = i.unreadableMoney), e.amount.trim() && o === null && (s.amount = i.unreadableMoney), (t !== null || o !== null) && r(e.quantity) === null && (s.quantity = i.unusableQuantity), Object.keys(s).length && (a[e.id] = s);
14
+ }
15
+ return Object.keys(a).length ? a : void 0;
16
+ }
17
+ function s(i, a, o, s = e) {
18
+ let c = {};
19
+ a || (c.vendor = s.requiredField), i.invoiceNumber.trim() || (c.invoiceNumber = s.requiredField), i.invoiceDate.trim() || (c.invoiceDate = s.requiredField), i.dueDate.trim() || (c.dueDate = s.requiredField);
20
+ let l = {};
21
+ return o.forEach((e, i) => {
22
+ if (i > 0 && !t(e)) return;
23
+ let a = {};
24
+ e.description.trim() || (a.description = s.requiredField), r(e.quantity) === null && (a.quantity = s.requiredField), n(e.price) === null && n(e.amount) === null && (a.price = s.requiredField, a.amount = s.requiredField), Object.keys(a).length && (l[e.id] = a);
69
25
  }), {
70
- title: h,
71
- subtitle: c.subtitle,
72
- status: p.status,
73
- statusTone: p.tone,
74
- amountDueLabel: f(a.amount_due) ?? f(a.total_amount) ?? "",
75
- invoiceDateLabel: g,
76
- dueDateLabel: _,
77
- dueDateTone: p.isOverdue ? "danger" : "default",
78
- payToItems: v,
79
- invoiceItems: b,
80
- lineItems: S,
81
- totals: C
26
+ formErrors: Object.keys(c).length ? c : void 0,
27
+ lineItemErrors: Object.keys(l).length ? l : void 0
82
28
  };
83
29
  }
30
+ function c(t, r, i, o = e) {
31
+ return !a(t) || !a(r) || i !== void 0 && n(i) === null ? { form: o.totalsNeedAttention } : void 0;
32
+ }
84
33
  //#endregion
85
- export { a as mapPayableToBillDetails };
34
+ export { s as validateBillCompleteness, c as validateBillTotals, o as validateLineItems };