@tesouro/embedded-components-react 0.3.48 → 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 (134) 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/cards-widget/feature/dist/index8.js +144 -130
  130. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +23 -23
  131. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +87 -71
  132. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  133. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index8.js +1 -1
  134. package/package.json +1 -1
@@ -2,166 +2,193 @@
2
2
  "use client";
3
3
  "use client";
4
4
  "use client";
5
- import { useAllLedgerAccountsQuery as e } from "../../../shared/data-access/dist/lib/reference-data/useLedgerAccountsQuery.js";
6
- import "../../../shared/data-access/dist/index.js";
7
- import { resolveAmountDueMinorUnits as t } from "./index6.js";
8
- import { resolveVendor as n } from "./index7.js";
9
- import { BillDecisionDialog as r } from "../../ui/dist/index50.js";
10
- import { BillDetailsSheet as i } from "../../ui/dist/index56.js";
11
- import { BillDuplicateNotice as a } from "../../ui/dist/index60.js";
12
- import { MarkAsPaidDialog as o } from "../../ui/dist/index86.js";
13
- import "../../ui/dist/index.js";
14
- import { useAllPayableLineItemsQuery as s } from "../../data-access/dist/index8.js";
15
- import { usePayableQuery as c } 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 { useReplacePayableLineItemsMutation as t } from "../../data-access/dist/index9.js";
8
+ import { useCreatePayableMutation as n, useDeletePayableFileMutation as r, useSubmitPayableForApprovalMutation as i, useUpdatePayableMutation as a, useValidatePayableMutation as o } from "../../data-access/dist/index12.js";
16
9
  import "../../data-access/dist/index.js";
17
- import { PayBillFlow as l } from "./index13.js";
18
- import "./index14.js";
19
- import { mergeMarkAsPaidFlowLabels as u } from "./index2.js";
20
- import { useMarkAsPaidFlow as d } from "./index4.js";
21
- import "./index5.js";
22
- import { mergeDecisionDialogCopy as f } from "./index30.js";
23
- import { useApprovalPolicyCardView as p } from "./index19.js";
24
- import { useCurrentApprovalRequestId as m } from "./index20.js";
25
- import { usePayableDetailActions as h } from "./index22.js";
26
- import { useScheduledPayment as g } from "./index23.js";
27
- import { BILL_DETAILS_LABELS_EN as _ } from "./index47.js";
28
- import { mapPayableToBillDetails as v } from "./index48.js";
29
- import { useMemo as y, useRef as b } from "react";
30
- import { Fragment as x, jsx as S, jsxs as C } from "react/jsx-runtime";
10
+ import { BILL_CREATE_MESSAGE_LABELS_EN as s } from "./index40.js";
11
+ import { encodeFileToBase64 as c } from "./index46.js";
12
+ import { mapBillFormToPayload as l, mapLineItemsToPayload as u } from "./index47.js";
13
+ import { validateBillCompleteness as d, validateBillTotals as f, validateLineItems as p } from "./index48.js";
14
+ import { useCallback as m, useRef as h, useState as g } from "react";
31
15
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index49.js
32
- function w(e) {
33
- return !!(e?.bank_account?.account_holder_name && e.bank_account.routing_number && e.bank_account.account_number);
16
+ var _ = {
17
+ document_id: "invoiceNumber",
18
+ issued_at: "invoiceDate",
19
+ due_date: "dueDate",
20
+ counterpart_id: "vendor"
21
+ };
22
+ function v(e) {
23
+ return e.type === "type_error.none.not_allowed" || e.msg === "none is not an allowed value";
34
24
  }
35
- function T({ open: T, onOpenChange: E, payableId: D, onClose: O, onExpand: k, testId: A, labels: j, poweredByBankName: M, isPossibleDuplicate: N }) {
36
- let P = y(() => ({
37
- ..._,
38
- ...j,
39
- sheet: {
40
- ..._.sheet,
41
- ...j?.sheet,
42
- statusBadge: {
43
- ..._.sheet.statusBadge,
44
- ...j?.sheet?.statusBadge
45
- },
46
- approvalPolicy: {
47
- ..._.sheet.approvalPolicy,
48
- ...j?.sheet?.approvalPolicy
49
- },
50
- dueDate: {
51
- ..._.sheet.dueDate,
52
- ...j?.sheet?.dueDate
53
- }
54
- },
55
- decisionDialog: f(_.decisionDialog, j?.decisionDialog),
56
- approvalPolicyCopy: {
57
- ..._.approvalPolicyCopy,
58
- ...j?.approvalPolicyCopy
59
- },
60
- markAsPaid: u(j?.markAsPaid),
61
- actionSuccess: {
62
- ..._.actionSuccess,
63
- ...j?.actionSuccess
64
- }
65
- }), [j]), F = c(D), I = s(D), L = e(), R = F.data, z = b(null), B = m({
66
- payableId: D,
67
- status: R?.status
68
- }), V = p({
69
- payableId: D,
70
- approvalPolicyId: R?.approval_policy_id,
71
- copy: P.approvalPolicyCopy
72
- }), H = g({
73
- payableId: D,
74
- scheduledPaymentDate: R?.scheduled_payment_date
75
- }), U = d({
76
- payableId: D,
77
- amountDueMinorUnits: t(R) ?? 0,
78
- amountToPayMinorUnits: R?.amount_to_pay ?? void 0,
79
- currencyCode: R?.currency ?? void 0,
80
- dueDate: R?.due_date,
81
- hasScheduledPayment: H.hasScheduledPayment,
82
- testId: A,
83
- labels: P.markAsPaid
84
- }), { actions: W, decisionDialog: G } = h({
85
- payableId: R ? D : void 0,
86
- status: R?.status,
87
- currentApprovalRequestId: B.id,
88
- isPolicyApprover: B.isPolicyApprover,
89
- hasWaitingRequest: B.hasWaitingRequest,
90
- hasScheduledPayment: H.hasScheduledPayment,
91
- scheduledPaymentIntentId: H.scheduledPaymentIntentId,
92
- isScheduledPaymentUnknown: H.isResolving,
93
- pendingApprovers: V.pendingApprovers,
94
- arePendingApproversUnknown: V.isLoading,
95
- labels: {
96
- payBill: P.sheet.payButton,
97
- markAsPaid: P.sheet.markAsPaidButton,
98
- reject: P.sheet.rejectButton,
99
- approve: P.sheet.approveButton,
100
- cancel: P.sheet.cancelButton,
101
- cancelScheduledPayment: P.sheet.cancelScheduledPaymentButton,
102
- reopen: P.sheet.reopenButton,
103
- forceApprove: P.sheet.forceApproveButton,
104
- forceReject: P.sheet.forceRejectButton,
105
- policyOverridesHeading: P.sheet.policyOverridesGroup,
106
- decisionDialog: P.decisionDialog,
107
- actionError: P.actionError,
108
- actionSuccess: P.actionSuccess
109
- },
110
- isMarkAsPaidPending: U.isPending,
111
- onMarkAsPaidSelect: U.open,
112
- onPayBillSelect: () => {
113
- if (!w(n(R)) && k) {
114
- k();
115
- return;
116
- }
117
- z.current?.open();
25
+ function y(e, t = s) {
26
+ let n = {}, r = [];
27
+ for (let i of e) {
28
+ let e = i.loc[0] ?? t.unknownValidationField, a = _[e], o = v(i) ? t.requiredField : i.msg;
29
+ a ? n[a] = o : r.push(t.unmappedValidationError(e, o));
30
+ }
31
+ return r.length && (n.form = r.join(" ")), n;
32
+ }
33
+ function b(e, t) {
34
+ if (!e && !t) return;
35
+ let n = {}, r = /* @__PURE__ */ new Set([...Object.keys(e ?? {}), ...Object.keys(t ?? {})]);
36
+ for (let i of r) n[i] = {
37
+ ...e?.[i],
38
+ ...t?.[i]
39
+ };
40
+ return n;
41
+ }
42
+ function x({ payableId: _, form: v, counterpartId: x, clearCounterpart: S, prepareVendorForSave: C, onSaved: w, onPayableCreated: T, readSavedStatus: E, onDraftSaved: D, onFinalized: O, labels: k }) {
43
+ let A = {
44
+ ...s,
45
+ ...k
46
+ }, [j, M] = g(), N = _ ?? j, [P, F] = g(), I = m(() => F(void 0), []), [L, R] = g(!1), z = m(() => R(!0), []), [B, V] = g(), H = h(!1), U = n(), W = r(), G = a(), K = t(), q = o(), J = i(), Y = m(() => v.isTotalsDirty ? f(v.discount, v.tax, v.totalOverride, A) : void 0, [v, A]), X = m(() => {
47
+ let t = p(v.lineItems, A), n = Y();
48
+ return v.setLineItemErrors(t), !t && !n || (t ? (v.setErrors(void 0), e.error(A.lineItemsNeedAttention)) : v.setErrors(n), !1);
49
+ }, [
50
+ v,
51
+ A,
52
+ Y
53
+ ]), Z = m(async (e) => {
54
+ let t = !N && P ? {
55
+ base64EncodedFile: await c(P),
56
+ fileName: P.name
57
+ } : void 0, n = l({
58
+ values: v.values,
59
+ counterpartId: x,
60
+ clearCounterpart: S,
61
+ counterpartBankAccountId: e,
62
+ editedTotals: v.isTotalsDirty ? {
63
+ discount: v.discount,
64
+ tax: v.tax,
65
+ total: v.totalOverride
66
+ } : void 0,
67
+ document: t
68
+ }), r = N;
69
+ if (r ? await G.mutateAsync({
70
+ path: { payable_id: r },
71
+ body: n
72
+ }) : (r = (await U.mutateAsync({ body: n }))?.id, r && (M(r), T?.(r), t && F(void 0))), !r) throw Error("Payable was created without an id");
73
+ if (L) {
74
+ try {
75
+ await W.mutateAsync({ path: { payable_id: r } });
76
+ } catch {}
77
+ R(!1);
118
78
  }
119
- }), K = H.hasScheduledPayment && H.scheduledDateLabel ? /* @__PURE__ */ S("p", {
120
- className: "ttw:text-sm ttw:text-muted-foreground",
121
- children: P.scheduledSummary(H.scheduledDateLabel)
122
- }) : void 0, q = N ? /* @__PURE__ */ S(a, {}) : void 0, J = q || K ? /* @__PURE__ */ C(x, { children: [q, K] }) : void 0, Y = y(() => R ? v({
123
- payable: R,
124
- lineItems: I.lineItems,
125
- ledgerAccounts: L.data?.data ?? [],
126
- labels: P,
127
- hasScheduledPayment: H.hasScheduledPayment
128
- }) : void 0, [
129
- R,
130
- I.lineItems,
131
- L.data,
79
+ return await K.mutateAsync({
80
+ path: { payable_id: r },
81
+ body: { data: u(v.lineItems) }
82
+ }), r;
83
+ }, [
84
+ x,
85
+ S,
86
+ U,
87
+ W,
88
+ L,
89
+ v.discount,
90
+ v.isTotalsDirty,
91
+ v.lineItems,
92
+ v.tax,
93
+ v.totalOverride,
94
+ v.values,
95
+ T,
96
+ N,
97
+ K,
132
98
  P,
133
- H.hasScheduledPayment
134
- ]), X = F.isLoading || I.isResolving || L.isResolving, Z = F.isError || I.isError || L.isError;
135
- return /* @__PURE__ */ C(x, { children: [
136
- /* @__PURE__ */ S(i, {
137
- open: T,
138
- onOpenChange: E,
139
- details: Y,
140
- actions: W,
141
- approvalPolicy: V.view,
142
- isLoading: X,
143
- isError: Z,
144
- notice: J,
145
- onClose: O,
146
- onExpand: k,
147
- testId: A,
148
- labels: P.sheet
149
- }),
150
- /* @__PURE__ */ S(r, {
151
- ...G,
152
- labels: { cancelButton: P.decisionDialog.cancelButton },
153
- testId: A ? `${A}-decision-dialog` : void 0,
154
- confirmTestId: A ? `${A}-decision-confirm` : void 0,
155
- reasonTestId: A ? `${A}-decision-reason` : void 0,
156
- reasonFieldId: A ? `${A}-decision-reason-field` : void 0
157
- }),
158
- /* @__PURE__ */ S(o, { ...U.dialogProps }),
159
- R ? /* @__PURE__ */ S(l, {
160
- ref: z,
161
- payable: R,
162
- poweredByBankName: M
163
- }) : null
164
- ] });
99
+ G
100
+ ]), Q = m(async () => {
101
+ N && (await W.mutateAsync({ path: { payable_id: N } }), R(!1));
102
+ }, [W, N]);
103
+ return {
104
+ saveDraft: m(async () => {
105
+ if (!H.current && X()) {
106
+ H.current = !0, V("draft");
107
+ try {
108
+ let t = await C?.();
109
+ if (t && !t.ok) return;
110
+ let n = await Z(t?.counterpartBankAccountId);
111
+ v.setErrors(void 0), w?.(n), D?.(n);
112
+ let r = await E?.();
113
+ return e.success(r === "draft" ? A.submittedDemoted : A.draftSaved), n;
114
+ } catch {
115
+ v.setErrors({ form: A.saveFailed });
116
+ return;
117
+ } finally {
118
+ V(void 0), H.current = !1;
119
+ }
120
+ }
121
+ }, [
122
+ v,
123
+ X,
124
+ A.draftSaved,
125
+ A.saveFailed,
126
+ A.submittedDemoted,
127
+ D,
128
+ w,
129
+ E,
130
+ C,
131
+ Z
132
+ ]),
133
+ finalize: m(async () => {
134
+ if (H.current) return;
135
+ let t = p(v.lineItems, A), n = Y(), { formErrors: r, lineItemErrors: i } = d(v.values, x, v.lineItems, A), a = b(i, t);
136
+ v.setLineItemErrors(a);
137
+ let o = {
138
+ ...r,
139
+ ...n
140
+ };
141
+ if (v.setErrors(Object.keys(o).length ? o : void 0), t && e.error(A.lineItemsNeedAttention), !(a || Object.keys(o).length)) {
142
+ H.current = !0, V("finalize");
143
+ try {
144
+ let t;
145
+ try {
146
+ let e = await C?.();
147
+ if (e && !e.ok) return;
148
+ t = await Z(e?.counterpartBankAccountId);
149
+ } catch {
150
+ v.setErrors({ form: A.saveFailed });
151
+ return;
152
+ }
153
+ w?.(t);
154
+ try {
155
+ let n = await q.mutateAsync({ path: { payable_id: t } });
156
+ if (n.validation_errors.length) {
157
+ v.setErrors(y(n.validation_errors, A));
158
+ return;
159
+ }
160
+ await J.mutateAsync({ path: { payable_id: t } }), v.setErrors(void 0), O?.(t), e.success(A.billFinalized);
161
+ } catch {
162
+ v.setErrors({ form: A.finalizeFailed });
163
+ }
164
+ } finally {
165
+ V(void 0), H.current = !1;
166
+ }
167
+ }
168
+ }, [
169
+ x,
170
+ v,
171
+ A,
172
+ O,
173
+ w,
174
+ C,
175
+ Z,
176
+ J,
177
+ Y,
178
+ q
179
+ ]),
180
+ payableId: N,
181
+ isSavingDraft: B === "draft",
182
+ isFinalizing: B === "finalize",
183
+ stagedFile: P,
184
+ stageFile: F,
185
+ clearStagedFile: I,
186
+ isFileDeletionPending: L,
187
+ requestFileDeletion: z,
188
+ detachFileNow: Q,
189
+ isDeletingFile: W.isPending,
190
+ hasFileDeletionFailed: W.isError
191
+ };
165
192
  }
166
193
  //#endregion
167
- export { T as BillDetailsContainer, T as default };
194
+ export { y as mapValidationErrorsToForm, x as useBillCreateController };
@@ -1,2 +1,9 @@
1
- import "./index2.js";
2
- import "./index4.js";
1
+ //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index5.js
2
+ function e(e) {
3
+ return e?.counterpart ?? e?.counterpart_raw_data ?? void 0;
4
+ }
5
+ function t(e) {
6
+ return e?.counterpart?.name ?? e?.counterpart_raw_data?.name ?? "";
7
+ }
8
+ //#endregion
9
+ export { e as resolveVendor, t as resolveVendorName };
@@ -1,3 +1,38 @@
1
- import "./index47.js";
2
- import "./index48.js";
3
- import "./index49.js";
1
+ //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index50.js
2
+ function e() {
3
+ return {
4
+ id: crypto.randomUUID(),
5
+ description: "",
6
+ glCode: "",
7
+ quantity: "1",
8
+ price: "",
9
+ amount: ""
10
+ };
11
+ }
12
+ function t(e) {
13
+ return typeof e == "number" ? (e / 100).toFixed(2) : "";
14
+ }
15
+ function n({ payable: n, lineItems: r }) {
16
+ let i = {
17
+ invoiceNumber: n.document_id ?? "",
18
+ invoiceDate: n.issued_at ?? "",
19
+ dueDate: n.due_date ?? "",
20
+ poNumber: ""
21
+ }, a = r.map((e) => ({
22
+ id: e.id,
23
+ description: e.name ?? "",
24
+ glCode: e.ledger_account_id ?? "",
25
+ quantity: e.quantity == null ? "" : String(e.quantity),
26
+ price: t(e.unit_price),
27
+ amount: t(e.subtotal)
28
+ }));
29
+ return {
30
+ values: i,
31
+ lineItems: a.length ? a : [e()],
32
+ discount: t(n.discount),
33
+ tax: t(n.tax_amount),
34
+ total: n.total_amount ? t(n.total_amount) : ""
35
+ };
36
+ }
37
+ //#endregion
38
+ export { e as emptyLineItem, n as mapPayableToBillForm };
@@ -1,4 +1,104 @@
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { calculateTotal as e, displayLineAmount as t, parseMoneyToMinorUnits as n } from "./index47.js";
6
+ import { emptyLineItem as r, mapPayableToBillForm as i } from "./index50.js";
7
+ import { useCallback as a, useEffect as o, useMemo as s, useState as c } from "react";
1
8
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index51.js
2
- var e = { Mounted: "bill_pay_widget.mounted" }, t = "bill_pay_widget";
9
+ function l(e, r, i) {
10
+ return n(r) === null ? i : t(e, r);
11
+ }
12
+ function u({ payable: t, lineItems: n } = {}) {
13
+ let u = s(() => i({
14
+ payable: t ?? {},
15
+ lineItems: n ?? []
16
+ }), [t, n]), [d, f] = c(u.values), [p, m] = c(u.lineItems), [h, g] = c(u.discount), [_, v] = c(u.tax), [y, b] = c(u.total || void 0), [x, S] = c(), [C, w] = c(), [T, E] = c(!1), [D, O] = c(!1), [k, A] = c(!1);
17
+ o(() => {
18
+ T || f(u.values);
19
+ }, [u]), o(() => {
20
+ D || m(u.lineItems);
21
+ }, [u]), o(() => {
22
+ k || (g(u.discount), v(u.tax), b(u.total || void 0));
23
+ }, [u]);
24
+ let j = a((e) => {
25
+ f((t) => ({
26
+ ...t,
27
+ ...e
28
+ })), E(!0);
29
+ }, []), M = a((e) => {
30
+ w((t) => {
31
+ if (!t?.[e]) return t;
32
+ let n = { ...t };
33
+ return delete n[e], Object.keys(n).length ? n : void 0;
34
+ });
35
+ }, []), N = a((e, t) => {
36
+ M(e), m((n) => n.map((n) => {
37
+ if (n.id !== e) return n;
38
+ let r = {
39
+ ...n,
40
+ ...t
41
+ };
42
+ return "amount" in t ? r : {
43
+ ...r,
44
+ amount: l(r.quantity, r.price, r.amount)
45
+ };
46
+ })), O(!0), b(void 0);
47
+ }, [M]), P = a((e, t) => {
48
+ M(e), m((n) => n.map((n) => {
49
+ if (n.id !== e) return n;
50
+ let r = Number.parseFloat(n.quantity), i = String(Math.max(1, (Number.isFinite(r) ? r : 1) + t));
51
+ return {
52
+ ...n,
53
+ quantity: i,
54
+ amount: l(i, n.price, n.amount)
55
+ };
56
+ })), O(!0), b(void 0);
57
+ }, [M]), F = a((e) => {
58
+ M(e), m((t) => t.length <= 1 ? t : t.filter((t) => t.id !== e)), O(!0), b(void 0);
59
+ }, [M]), I = a(() => {
60
+ m((e) => [...e, r()]), O(!0), b(void 0);
61
+ }, []), L = a((e) => {
62
+ g(e), A(!0), b(void 0);
63
+ }, []), R = a((e) => {
64
+ v(e), A(!0), b(void 0);
65
+ }, []), z = a((e) => {
66
+ b(e), A(!0);
67
+ }, []), B = s(() => p.map((e) => ({
68
+ ...e,
69
+ onChange: (t) => N(e.id, t),
70
+ onQuantityStep: (t) => P(e.id, t),
71
+ onRemove: () => F(e.id)
72
+ })), [
73
+ p,
74
+ N,
75
+ F,
76
+ P
77
+ ]), V = s(() => e(p, _, h), [
78
+ p,
79
+ _,
80
+ h
81
+ ]);
82
+ return {
83
+ values: d,
84
+ errors: x,
85
+ setErrors: S,
86
+ lineItemErrors: C,
87
+ setLineItemErrors: w,
88
+ onChange: j,
89
+ lineItems: p,
90
+ lineItemRows: B,
91
+ discount: h,
92
+ onDiscountChange: L,
93
+ tax: _,
94
+ onTaxChange: R,
95
+ total: y ?? V,
96
+ totalOverride: y,
97
+ onTotalChange: z,
98
+ onAddLineItem: I,
99
+ isTotalsDirty: k,
100
+ isDirty: T || D || k
101
+ };
102
+ }
3
103
  //#endregion
4
- export { e as BillPayWidgetAnalyticsEvent, t as WIDGET_NAME };
104
+ export { u as useBillForm };
@@ -1,46 +1,20 @@
1
- "use client";
2
- "use client";
3
- "use client";
4
- "use client";
5
- import { useAnalyticsTrack as e } from "../../../shared/feature/dist/lib/analytics/hooks.js";
6
- import "../../../shared/feature/dist/index.js";
7
- import { BillPayWidgetAnalyticsEvent as t, WIDGET_NAME as n } from "./index51.js";
8
- import { Payables as r } from "../../../monite-sdk/dist/index443.js";
9
- import "../../../monite-sdk/dist/index.js";
10
- import { MoniteRegionProvider as i } from "../../../shared/monite-wrapper/feature/dist/lib/MoniteRegionProvider.js";
11
- import "../../../shared/monite-wrapper/feature/dist/index.js";
12
- import { useEffect as a } from "react";
13
- import { jsx as o } from "react/jsx-runtime";
14
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index52.js
15
- var s = (e) => e;
16
- function c(n) {
17
- let i = e();
18
- return a(() => {
19
- i(t.Mounted);
20
- }, [i]), /* @__PURE__ */ o(r, { ...n });
21
- }
22
- function l({ baseUrl: e, widgetToken: t, organizationId: r, configClient: a, gatewayRouting: l, linkComponent: u, implementation: d, uiFramework: f, errorFallback: p, onError: m, finopsThemeColors: h, analytics: g, disclosuresAcceptance: _, providerLabels: v, pageTitleComponent: y = s, ...b }) {
23
- return /* @__PURE__ */ o(i, {
24
- widgetName: n,
25
- baseUrl: e,
26
- widgetToken: t,
27
- organizationId: r,
28
- configClient: a,
29
- gatewayRouting: l,
30
- linkComponent: u,
31
- implementation: d,
32
- uiFramework: f,
33
- errorFallback: p,
34
- onError: m,
35
- finopsThemeColors: h,
36
- analytics: g,
37
- disclosuresAcceptance: _,
38
- providerLabels: v,
39
- children: /* @__PURE__ */ o(c, {
40
- ...b,
41
- pageTitleComponent: y
42
- })
43
- });
44
- }
2
+ var e = {
3
+ dialog: "bill-pay-bill-create-dialog",
4
+ vendorSection: "bill-pay-bill-create-vendor",
5
+ lineItems: "bill-pay-bill-create-line-items",
6
+ documentPanel: "bill-pay-bill-create-document",
7
+ duplicateNotice: "bill-pay-bill-create-duplicate-notice",
8
+ duplicateRemoveDialog: "bill-pay-bill-create-duplicate-remove-dialog",
9
+ duplicateRemoveConfirm: "bill-pay-bill-create-duplicate-remove-confirm",
10
+ decisionDialog: "bill-pay-bill-decision-dialog",
11
+ decisionConfirm: "bill-pay-bill-decision-confirm",
12
+ decisionReason: "bill-pay-bill-decision-reason",
13
+ deleteDraftDialog: "bill-pay-bill-delete-draft-dialog",
14
+ deleteDraftConfirm: "bill-pay-bill-delete-draft-confirm",
15
+ unsavedDialog: "bill-pay-bill-unsaved-dialog",
16
+ unsavedSaveDraft: "bill-pay-bill-unsaved-save-draft",
17
+ unsavedDiscard: "bill-pay-bill-unsaved-discard"
18
+ };
45
19
  //#endregion
46
- export { l as BillPayWidgetMonite, l as default };
20
+ export { e as billCreateTestIds };