@tesouro/embedded-components-react 0.2.327 → 0.2.329
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.
- package/dist/index.css +3 -0
- package/dist/index.d.ts +59 -59
- package/dist/index.js +1 -1
- package/dist/lib/BillPayWidget.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index.js +10 -10
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index10.js +119 -33
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index4.js +50 -21
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index5.js +39 -17
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index8.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index9.js +17 -12
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js +10 -10
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index10.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index12.js +45 -17
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index13.js +4 -21
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index14.js +9 -24
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index15.js +42 -9
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index16.js +25 -50
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index17.js +49 -5
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index18.js +91 -63
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index19.js +20 -49
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index20.js +52 -7
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index21.js +5 -35
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index22.js +67 -113
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index23.js +46 -53
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index24.js +80 -205
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index25.js +32 -192
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index26.js +117 -62
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index27.js +54 -45
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index28.js +205 -31
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index29.js +184 -143
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index30.js +63 -33
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index31.js +46 -100
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index32.js +32 -7
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index33.js +146 -182
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index34.js +38 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index35.js +102 -24
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index36.js +10 -80
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index37.js +200 -78
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index38.js +2 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index39.js +27 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index40.js +78 -41
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index41.js +132 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index42.js +3 -53
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index43.js +2 -9
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index44.js +43 -16
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index45.js +1 -8
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index46.js +50 -77
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index47.js +8 -145
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index48.js +18 -5
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index49.js +6 -6
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index50.js +78 -7
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index51.js +138 -75
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index52.js +2 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index53.js +6 -6
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index54.js +7 -113
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index55.js +85 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index56.js +2 -24
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index57.js +8 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index58.js +115 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index59.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index60.js +25 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index7.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index.js +33 -25
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index12.js +13 -12
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index13.js +58 -13
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index14.js +2 -24
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index15.js +22 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index16.js +23 -31
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index17.js +1 -262
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index18.js +15 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index19.js +23 -6
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index20.js +2 -49
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index21.js +41 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index22.js +271 -20
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index23.js +2 -286
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index24.js +9 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index25.js +47 -14
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index26.js +2 -120
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index27.js +22 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index28.js +284 -8
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index29.js +2 -96
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index30.js +16 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index31.js +118 -11
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index32.js +1 -57
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index33.js +10 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index34.js +93 -51
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index35.js +1 -138
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index36.js +12 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index37.js +56 -5
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index38.js +2 -44
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index39.js +53 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index40.js +137 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index41.js +2 -16
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index42.js +7 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index43.js +42 -59
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index44.js +2 -238
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index45.js +2 -202
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index46.js +61 -8
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index47.js +2 -8
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index48.js +2 -91
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index49.js +16 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index50.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index51.js +67 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index52.js +248 -25
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index53.js +204 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index54.js +6 -3
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index55.js +6 -32
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index56.js +93 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index58.js +1 -105
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index59.js +7 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index60.js +28 -16
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index61.js +2 -10
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index62.js +4 -167
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index63.js +34 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index64.js +2 -14
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index65.js +10 -87
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index66.js +105 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index67.js +2 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index68.js +18 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index69.js +10 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index70.js +170 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index71.js +2 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index72.js +14 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index73.js +89 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index74.js +2 -0
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/data-access/dist/lib/approvalPoliciesApi.js +20 -20
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/feature/dist/index.js +4 -4
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +21 -21
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +142 -102
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index7.js +1 -1
- package/package.json +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index57.js +0 -12
|
@@ -2,192 +2,156 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
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 { resolveVendor as ie } from "./index3.js";
|
|
14
|
-
import { BillCreateScreen as ae } from "../../ui/dist/index35.js";
|
|
15
|
-
import { ExtractionNotice as oe } from "../../ui/dist/index52.js";
|
|
16
|
-
import "../../ui/dist/index.js";
|
|
17
|
-
import { usePayableHistoryQuery as se } from "../../data-access/dist/index6.js";
|
|
18
|
-
import { useAllPayableLineItemsQuery as ce } from "../../data-access/dist/index7.js";
|
|
19
|
-
import { usePayableQuery as le } from "../../data-access/dist/index13.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/index7.js";
|
|
8
|
+
import { useCreatePayableMutation as n, useSubmitPayableForApprovalMutation as r, useUpdatePayableMutation as i, useValidatePayableMutation as a } from "../../data-access/dist/index10.js";
|
|
20
9
|
import "../../data-access/dist/index.js";
|
|
21
|
-
import {
|
|
22
|
-
import "./
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import { useBillForm as pe } from "./index31.js";
|
|
26
|
-
import { useCurrentApprovalRequestId as n } from "./index12.js";
|
|
27
|
-
import { usePayableDetailActions as r } from "./index14.js";
|
|
28
|
-
import { useScheduledPayment as i } from "./index15.js";
|
|
29
|
-
import { buildBillDetailView as a } from "./index18.js";
|
|
30
|
-
import { buildBillHistory as o } from "./index19.js";
|
|
31
|
-
import { SourceDocumentContainer as s } from "./index23.js";
|
|
32
|
-
import { useVendorSectionProps as c } from "./index25.js";
|
|
33
|
-
import { usePaymentInstructionsForm as l } from "./index26.js";
|
|
34
|
-
import { billCreateTestIds as u } from "./index32.js";
|
|
35
|
-
import { useCallback as d, useEffect as me, useMemo as f, useRef as he, useState as p } from "react";
|
|
36
|
-
import { Fragment as ge, jsx as m, jsxs as _e } from "react/jsx-runtime";
|
|
10
|
+
import { BILL_CREATE_MESSAGE_LABELS_EN as o } from "./index26.js";
|
|
11
|
+
import { mapBillFormToPayload as s, mapLineItemsToPayload as c } from "./index31.js";
|
|
12
|
+
import { validateBillCompleteness as l, validateBillTotals as u, validateLineItems as d } from "./index32.js";
|
|
13
|
+
import { useCallback as f, useRef as p, useState as m } from "react";
|
|
37
14
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index33.js
|
|
38
|
-
|
|
39
|
-
|
|
15
|
+
var h = {
|
|
16
|
+
document_id: "invoiceNumber",
|
|
17
|
+
issued_at: "invoiceDate",
|
|
18
|
+
due_date: "dueDate",
|
|
19
|
+
counterpart_id: "vendor"
|
|
20
|
+
};
|
|
21
|
+
function g(e) {
|
|
22
|
+
return e.type === "type_error.none.not_allowed" || e.msg === "none is not an allowed value";
|
|
40
23
|
}
|
|
41
|
-
function
|
|
42
|
-
let
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}, [
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
labels: b.actions,
|
|
85
|
-
onPayBillSelect: () => ve(H) || !G ? B.current?.open() : U.open()
|
|
86
|
-
}), K = f(() => (M.data?.data ?? []).map((e) => ({
|
|
87
|
-
value: e.id,
|
|
88
|
-
label: [e.nominal_code, e.name].filter(Boolean).join(" — ")
|
|
89
|
-
})), [M.data]), q = se(z), Ce = e(W?.scopes, [t.UserReadOrg]), J = te({ enabled: v && Ce }), Y = f(() => o(q.data?.data ?? [], J.data?.data ?? [], b.history), [
|
|
90
|
-
q.data,
|
|
91
|
-
J.data,
|
|
92
|
-
b.history
|
|
93
|
-
]), we = f(() => v && N ? a({
|
|
94
|
-
payable: N,
|
|
95
|
-
lineItems: j.lineItems,
|
|
96
|
-
glCodeOptions: K,
|
|
97
|
-
history: Y,
|
|
98
|
-
labels: b.detail
|
|
99
|
-
}) : void 0, [
|
|
100
|
-
b.detail,
|
|
101
|
-
K,
|
|
102
|
-
Y,
|
|
103
|
-
j.lineItems,
|
|
104
|
-
N,
|
|
105
|
-
v
|
|
106
|
-
]), X = N?.source_of_payable_data === "ocr", Z = H?.name, Q = v ? Z ? b.viewTitle(Z) : b.readOnlyTitle : X && Z ? b.extractedTitle(Z) : b.newTitle, Te = v && N?.created_at ? b.addedOn(ne(N.created_at.slice(0, 10))) : void 0, $ = d(() => {
|
|
107
|
-
let e = P.isDirty || I.hasUnsavedVendorChanges;
|
|
108
|
-
!v && e && !window.confirm(b.discardConfirm) || g(!1);
|
|
109
|
-
}, [
|
|
110
|
-
b.discardConfirm,
|
|
111
|
-
P.isDirty,
|
|
112
|
-
g,
|
|
113
|
-
v,
|
|
114
|
-
I.hasUnsavedVendorChanges
|
|
115
|
-
]), Ee = d((e) => {
|
|
116
|
-
if (!R) return e ? g(!0) : $();
|
|
24
|
+
function _(e, t = o) {
|
|
25
|
+
let n = {}, r = [];
|
|
26
|
+
for (let i of e) {
|
|
27
|
+
let e = i.loc[0] ?? t.unknownValidationField, a = h[e], o = g(i) ? t.requiredField : i.msg;
|
|
28
|
+
a ? n[a] = o : r.push(t.unmappedValidationError(e, o));
|
|
29
|
+
}
|
|
30
|
+
return r.length && (n.form = r.join(" ")), n;
|
|
31
|
+
}
|
|
32
|
+
function v(e, t) {
|
|
33
|
+
if (!e && !t) return;
|
|
34
|
+
let n = {}, r = /* @__PURE__ */ new Set([...Object.keys(e ?? {}), ...Object.keys(t ?? {})]);
|
|
35
|
+
for (let i of r) n[i] = {
|
|
36
|
+
...e?.[i],
|
|
37
|
+
...t?.[i]
|
|
38
|
+
};
|
|
39
|
+
return n;
|
|
40
|
+
}
|
|
41
|
+
function y({ payableId: h, form: g, counterpartId: y, clearCounterpart: b, prepareVendorForSave: x, onSaved: S, onPayableCreated: C, onDraftSaved: w, onFinalized: T, labels: E }) {
|
|
42
|
+
let D = {
|
|
43
|
+
...o,
|
|
44
|
+
...E
|
|
45
|
+
}, [O, k] = m(), A = h ?? O, [j, M] = m(), N = p(!1), P = n(), F = i(), I = t(), L = a(), R = r(), z = f(() => {
|
|
46
|
+
let t = d(g.lineItems, D), n = u(g.discount, g.tax, g.totalOverride, D);
|
|
47
|
+
return g.setLineItemErrors(t), !t && !n || (t ? (g.setErrors(void 0), e.error(D.lineItemsNeedAttention)) : g.setErrors(n), !1);
|
|
48
|
+
}, [g, D]), B = f(async () => {
|
|
49
|
+
let e = s({
|
|
50
|
+
values: g.values,
|
|
51
|
+
counterpartId: y,
|
|
52
|
+
clearCounterpart: b,
|
|
53
|
+
editedTotals: g.isTotalsDirty ? {
|
|
54
|
+
discount: g.discount,
|
|
55
|
+
tax: g.tax,
|
|
56
|
+
total: g.totalOverride
|
|
57
|
+
} : void 0
|
|
58
|
+
}), t = A;
|
|
59
|
+
if (t ? await F.mutateAsync({
|
|
60
|
+
path: { payable_id: t },
|
|
61
|
+
body: e
|
|
62
|
+
}) : (t = (await P.mutateAsync({ body: e }))?.id, t && (k(t), C?.(t))), !t) throw Error("Payable was created without an id");
|
|
63
|
+
return await I.mutateAsync({
|
|
64
|
+
path: { payable_id: t },
|
|
65
|
+
body: { data: c(g.lineItems) }
|
|
66
|
+
}), t;
|
|
117
67
|
}, [
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
68
|
+
y,
|
|
69
|
+
b,
|
|
70
|
+
P,
|
|
71
|
+
g.discount,
|
|
72
|
+
g.isTotalsDirty,
|
|
73
|
+
g.lineItems,
|
|
74
|
+
g.tax,
|
|
75
|
+
g.totalOverride,
|
|
76
|
+
g.values,
|
|
77
|
+
C,
|
|
78
|
+
A,
|
|
79
|
+
I,
|
|
80
|
+
F
|
|
121
81
|
]);
|
|
122
|
-
return
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
82
|
+
return {
|
|
83
|
+
saveDraft: f(async () => {
|
|
84
|
+
if (!N.current && z()) {
|
|
85
|
+
N.current = !0, M("draft");
|
|
86
|
+
try {
|
|
87
|
+
if (await x?.() === !1) return;
|
|
88
|
+
let t = await B();
|
|
89
|
+
g.setErrors(void 0), S?.(t), w?.(t), e.success(D.draftSaved);
|
|
90
|
+
} catch {
|
|
91
|
+
g.setErrors({ form: D.saveFailed });
|
|
92
|
+
} finally {
|
|
93
|
+
M(void 0), N.current = !1;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}, [
|
|
97
|
+
g,
|
|
98
|
+
z,
|
|
99
|
+
D.draftSaved,
|
|
100
|
+
D.saveFailed,
|
|
101
|
+
w,
|
|
102
|
+
S,
|
|
103
|
+
x,
|
|
104
|
+
B
|
|
105
|
+
]),
|
|
106
|
+
finalize: f(async () => {
|
|
107
|
+
if (N.current) return;
|
|
108
|
+
let t = d(g.lineItems, D), n = u(g.discount, g.tax, g.totalOverride, D), { formErrors: r, lineItemErrors: i } = l(g.values, y, g.lineItems, D), a = v(i, t);
|
|
109
|
+
g.setLineItemErrors(a);
|
|
110
|
+
let o = {
|
|
111
|
+
...r,
|
|
112
|
+
...n
|
|
113
|
+
};
|
|
114
|
+
if (g.setErrors(Object.keys(o).length ? o : void 0), t && e.error(D.lineItemsNeedAttention), !(a || Object.keys(o).length)) {
|
|
115
|
+
N.current = !0, M("finalize");
|
|
116
|
+
try {
|
|
117
|
+
let t;
|
|
118
|
+
try {
|
|
119
|
+
if (await x?.() === !1) return;
|
|
120
|
+
t = await B();
|
|
121
|
+
} catch {
|
|
122
|
+
g.setErrors({ form: D.saveFailed });
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
S?.(t);
|
|
126
|
+
try {
|
|
127
|
+
let n = await L.mutateAsync({ path: { payable_id: t } });
|
|
128
|
+
if (n.validation_errors.length) {
|
|
129
|
+
g.setErrors(_(n.validation_errors, D));
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
await R.mutateAsync({ path: { payable_id: t } }), g.setErrors(void 0), T?.(t), e.success(D.billFinalized);
|
|
133
|
+
} catch {
|
|
134
|
+
g.setErrors({ form: D.finalizeFailed });
|
|
135
|
+
}
|
|
136
|
+
} finally {
|
|
137
|
+
M(void 0), N.current = !1;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}, [
|
|
141
|
+
y,
|
|
142
|
+
g,
|
|
143
|
+
D,
|
|
144
|
+
T,
|
|
145
|
+
S,
|
|
146
|
+
x,
|
|
147
|
+
B,
|
|
148
|
+
R,
|
|
149
|
+
L
|
|
150
|
+
]),
|
|
151
|
+
payableId: A,
|
|
152
|
+
isSavingDraft: j === "draft",
|
|
153
|
+
isFinalizing: j === "finalize"
|
|
154
|
+
};
|
|
191
155
|
}
|
|
192
156
|
//#endregion
|
|
193
|
-
export {
|
|
157
|
+
export { _ as mapValidationErrorsToForm, y as useBillCreateController };
|
|
@@ -1,4 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index34.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: t(n.total_amount)
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
//#endregion
|
|
38
|
+
export { e as emptyLineItem, n as mapPayableToBillForm };
|
|
@@ -1,26 +1,104 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
"use client";
|
|
4
|
+
"use client";
|
|
5
|
+
import { calculateTotal as e, displayLineAmount as t, parseMoneyToMinorUnits as n } from "./index31.js";
|
|
6
|
+
import { emptyLineItem as r, mapPayableToBillForm as i } from "./index34.js";
|
|
7
|
+
import { useCallback as a, useEffect as o, useMemo as s, useState as c } from "react";
|
|
4
8
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index35.js
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
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
|
+
}
|
|
25
103
|
//#endregion
|
|
26
|
-
export {
|
|
104
|
+
export { u as useBillForm };
|
|
@@ -1,82 +1,12 @@
|
|
|
1
|
-
import { formatCalendarDate as e } from "../../../shared/util/dist/lib/formatCalendarDate.js";
|
|
2
|
-
import { resolveVendor as t, resolveVendorName as n } from "./index3.js";
|
|
3
|
-
import { derivePayableStatus as r } from "./index16.js";
|
|
4
|
-
import { formatBillMoney as i } from "./index17.js";
|
|
5
1
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index36.js
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}], _ = f?.bank_account?.account_number;
|
|
16
|
-
_ && g.push({
|
|
17
|
-
label: c.bankAccountRow,
|
|
18
|
-
value: c.bankAccountValue(_.slice(-4))
|
|
19
|
-
});
|
|
20
|
-
let v = [
|
|
21
|
-
{
|
|
22
|
-
label: c.invoiceNumberRow,
|
|
23
|
-
value: a.document_id || c.notProvided
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
label: c.issueDateRow,
|
|
27
|
-
value: m
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
label: c.dueDateRow,
|
|
31
|
-
value: h
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
label: c.poNumberRow,
|
|
35
|
-
value: c.notProvided
|
|
36
|
-
}
|
|
37
|
-
], y = new Map(s.map((e) => [e.id, [e.nominal_code, e.name].filter(Boolean).join(" — ")])), b = o.map((e) => {
|
|
38
|
-
let t = u(e.unit_price);
|
|
39
|
-
return {
|
|
40
|
-
id: e.id,
|
|
41
|
-
description: e.name ?? e.description ?? "",
|
|
42
|
-
glCodeLabel: (e.ledger_account_id ? y.get(e.ledger_account_id) : void 0) || c.glCodeMissing,
|
|
43
|
-
quantityLabel: e.quantity != null && t ? c.quantityValue(String(e.quantity), t) : "",
|
|
44
|
-
amountLabel: u(e.subtotal) ?? ""
|
|
45
|
-
};
|
|
46
|
-
}), x = [
|
|
47
|
-
{
|
|
48
|
-
label: c.subtotalRow,
|
|
49
|
-
value: a.subtotal
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
label: c.discountsRow,
|
|
53
|
-
value: a.discount
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
label: c.taxRow,
|
|
57
|
-
value: a.tax_amount
|
|
58
|
-
}
|
|
59
|
-
].map(({ label: e, value: t }) => ({
|
|
60
|
-
label: e,
|
|
61
|
-
value: u(t)
|
|
62
|
-
})).filter((e) => !!e.value), S = u(a.total_amount);
|
|
63
|
-
return S && x.push({
|
|
64
|
-
label: c.totalRow,
|
|
65
|
-
value: S,
|
|
66
|
-
emphasis: !0
|
|
67
|
-
}), {
|
|
68
|
-
title: p,
|
|
69
|
-
subtitle: c.subtitle,
|
|
70
|
-
status: d.status,
|
|
71
|
-
statusTone: d.tone,
|
|
72
|
-
amountDueLabel: u(a.amount_due) ?? u(a.total_amount) ?? "",
|
|
73
|
-
invoiceDateLabel: m,
|
|
74
|
-
dueDateLabel: h,
|
|
75
|
-
payToItems: g,
|
|
76
|
-
invoiceItems: v,
|
|
77
|
-
lineItems: b,
|
|
78
|
-
totals: x
|
|
79
|
-
};
|
|
80
|
-
}
|
|
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
|
+
decisionDialog: "bill-pay-bill-decision-dialog",
|
|
8
|
+
decisionConfirm: "bill-pay-bill-decision-confirm",
|
|
9
|
+
decisionReason: "bill-pay-bill-decision-reason"
|
|
10
|
+
};
|
|
81
11
|
//#endregion
|
|
82
|
-
export {
|
|
12
|
+
export { e as billCreateTestIds };
|