@tesouro/embedded-components-react 0.5.169 → 0.5.170
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 +39 -17
- 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 +11 -11
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index17.js +95 -80
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index7.js +37 -11
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js +13 -15
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index10.js +56 -67
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index11.js +4 -43
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index12.js +6 -115
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index13.js +202 -63
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index14.js +2 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index15.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index19.js +84 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index20.js +3 -84
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index21.js +5 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index22.js +4 -5
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index23.js +32 -3
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index24.js +36 -30
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index25.js +167 -35
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index26.js +40 -164
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index27.js +1 -49
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index28.js +50 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index29.js +11 -45
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index30.js +8 -13
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index31.js +14 -8
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index32.js +59 -7
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index33.js +8 -64
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index34.js +24 -8
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index35.js +150 -18
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index36.js +9 -152
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index37.js +25 -9
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index38.js +19 -21
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index39.js +32 -14
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index40.js +14 -39
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index41.js +8 -16
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index42.js +4 -8
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index43.js +98 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index44.js +68 -83
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index45.js +3 -83
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index46.js +143 -3
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index47.js +44 -143
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index48.js +114 -45
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index49.js +189 -111
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index5.js +13 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index50.js +72 -186
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index51.js +31 -76
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index52.js +89 -32
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index53.js +406 -83
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index54.js +12 -411
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index55.js +84 -12
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index56.js +67 -72
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index57.js +222 -73
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index58.js +37 -223
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index59.js +245 -37
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index6.js +5 -23
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index60.js +23 -252
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index61.js +626 -21
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index62.js +4 -586
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index63.js +45 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index64.js +256 -41
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index65.js +3 -263
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index66.js +4 -3
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index67.js +44 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index68.js +1 -46
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index69.js +8 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index7.js +22 -57
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index70.js +11 -6
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index71.js +130 -11
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index72.js +3 -132
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index73.js +6 -3
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index74.js +129 -3
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index75.js +8 -124
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index76.js +7 -8
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index77.js +82 -8
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index78.js +19 -48
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index79.js +20 -21
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index8.js +14 -6
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index80.js +28 -19
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index81.js +82 -27
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index82.js +47 -83
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index83.js +260 -47
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index84.js +24 -251
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index85.js +382 -25
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index86.js +294 -144
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index87.js +4 -223
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index88.js +7 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index89.js +112 -5
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index9.js +37 -5
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index90.js +1 -114
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index91.js +26 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index.js +18 -21
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index100.js +126 -10
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index101.js +1 -105
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index102.js +33 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index103.js +7 -28
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index104.js +126 -73
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index105.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index106.js +11 -30
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index107.js +106 -8
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index108.js +2 -181
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index109.js +10 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index110.js +50 -12
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index111.js +2 -108
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index38.js +6 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index46.js +8 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index73.js +8 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index74.js +154 -23
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index83.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index84.js +343 -250
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index90.js +5 -123
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index91.js +28 -26
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index92.js +2 -94
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index93.js +7 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index94.js +32 -5
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index95.js +2 -30
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index96.js +12 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index97.js +104 -5
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index98.js +2 -34
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index99.js +31 -2
- 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/index8.js +1 -1
- package/dist/packages/shared-ui-shadcn/dist/index.js +2458 -2284
- package/package.json +2 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index92.js +0 -27
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index112.js +0 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index113.js +0 -10
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index114.js +0 -52
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index115.js +0 -2
|
@@ -2,91 +2,414 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import "../../../shared/
|
|
10
|
-
import {
|
|
11
|
-
import "
|
|
5
|
+
import { toast as e } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
6
|
+
import { hasAnyScope as t } from "../../../shared/data-access/dist/lib/hasAnyScope.js";
|
|
7
|
+
import { Scope as n } from "../../../shared/data-access/dist/lib/scopes.js";
|
|
8
|
+
import "../../../shared/data-access/dist/index.js";
|
|
9
|
+
import "../../../shared/ui/dist/index.js";
|
|
10
|
+
import { useWidgetConfig as r } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
|
|
11
|
+
import "../../../shared/feature/dist/index.js";
|
|
12
|
+
import { useCounterpartsQuery as i } from "../../../shared/counterpart-management/data-access/dist/index3.js";
|
|
13
|
+
import { useCreateCounterpartBankAccountMutation as ee, useUpdateCounterpartBankAccountMutation as a } from "../../../shared/counterpart-management/data-access/dist/index5.js";
|
|
14
|
+
import { usePayableSuggestionsQuery as o } from "../../data-access/dist/index18.js";
|
|
15
|
+
import "../../data-access/dist/index.js";
|
|
16
|
+
import { COUNTERPART_MESSAGE_LABELS_EN as te } from "../../../shared/counterpart-management/feature/dist/lib/labels.js";
|
|
17
|
+
import { counterpartFormBankAccountToCreatePayload as ne, counterpartFormBankAccountToUpdatePayload as re, getAchInstructions as ie, getCounterpartEmail as s, getCounterpartName as c, getPayableAchInstructions as ae, isAchCompatibleBankAccount as l, resolveCounterpartBankAccountWrite as oe, validateAchFormValues as se } from "../../../shared/counterpart-management/feature/dist/lib/helpers.js";
|
|
18
|
+
import { useCounterpartDetails as ce } from "../../../shared/counterpart-management/feature/dist/lib/useCounterpartDetails.js";
|
|
19
|
+
import { useCounterpartForm as le } from "../../../shared/counterpart-management/feature/dist/lib/useCounterpartForm.js";
|
|
12
20
|
import "../../../shared/counterpart-management/feature/dist/index.js";
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
21
|
+
import { VENDOR_SECTION_PROPS_LABELS_EN as ue } from "./index49.js";
|
|
22
|
+
import { buildVendorPrefill as de } from "./index51.js";
|
|
23
|
+
import { VendorInlineForm as fe } from "./index52.js";
|
|
24
|
+
import { useCallback as u, useEffect as d, useMemo as f, useRef as p, useState as m } from "react";
|
|
25
|
+
import { jsx as pe } from "react/jsx-runtime";
|
|
16
26
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index53.js
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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
|
-
/* @__PURE__ */ l("div", {
|
|
71
|
-
className: "ttw:flex ttw:justify-end ttw:gap-2",
|
|
72
|
-
children: [/* @__PURE__ */ c(e, {
|
|
73
|
-
type: "button",
|
|
74
|
-
variant: "outline",
|
|
75
|
-
onClick: _,
|
|
76
|
-
"aria-label": C.cancelAriaLabel,
|
|
77
|
-
disabled: y,
|
|
78
|
-
children: C.cancel
|
|
79
|
-
}), v ? /* @__PURE__ */ c(e, {
|
|
80
|
-
type: "button",
|
|
81
|
-
onClick: v,
|
|
82
|
-
"aria-label": C.saveAriaLabel,
|
|
83
|
-
loading: y,
|
|
84
|
-
disabled: y,
|
|
85
|
-
children: C.save
|
|
86
|
-
}) : null]
|
|
87
|
-
})
|
|
88
|
-
]
|
|
27
|
+
var me = 10, he = 300, h = {
|
|
28
|
+
accountHolderName: "",
|
|
29
|
+
routingNumber: "",
|
|
30
|
+
accountNumber: ""
|
|
31
|
+
};
|
|
32
|
+
function ge(e) {
|
|
33
|
+
return {
|
|
34
|
+
accountHolderName: e.account_holder_name ?? "",
|
|
35
|
+
routingNumber: e.routing_number ?? "",
|
|
36
|
+
accountNumber: e.account_number ?? ""
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
function g(e, t) {
|
|
40
|
+
return e.accountHolderName.trim() === t.accountHolderName.trim() && e.routingNumber.trim() === t.routingNumber.trim() && e.accountNumber.trim() === t.accountNumber.trim();
|
|
41
|
+
}
|
|
42
|
+
function _e(e, t) {
|
|
43
|
+
return e?.find((e) => e.id === t && l(e)) ?? ie(e);
|
|
44
|
+
}
|
|
45
|
+
function _({ payableId: ie, counterpartId: l, payableCounterpartId: _, payableCounterpartBankAccountId: ve, isVendorKnown: ye = !0, onCounterpartChange: be, requiredError: xe, extractedVendor: v, readOnly: y = !1, canEditVendor: b = !0, canEditPaymentInstructions: Se = !0, canAddPaymentInstructions: Ce = !0, confirmDiscard: x = (e) => e(), labels: we }) {
|
|
46
|
+
let S = {
|
|
47
|
+
...ue,
|
|
48
|
+
...we
|
|
49
|
+
}, { initResponse: Te } = r(), Ee = t(Te?.scopes, [n.CounterpartReadOrg]), [C, De] = m(""), [w, Oe] = m(""), ke = p(w), [T, Ae] = m(), [je, Me] = m("none"), [Ne, Pe] = m(), [Fe, E] = m(!1), [D, O] = m(!1), [k, A] = m(h), Ie = p(k);
|
|
50
|
+
Ie.current = k;
|
|
51
|
+
let j = p(h), [Le, M] = m(), [Re, ze] = m(), Be = Re?.bankAccountId, N = p(void 0), Ve = p(l), [He, Ue] = m(!1), [We, Ge] = m(!1), P = p(void 0), Ke = (D || T === "create") && !g(k, j.current), F = u(() => {
|
|
52
|
+
O(!1), A(h), j.current = h, M(void 0);
|
|
53
|
+
}, []), I = u((e) => {
|
|
54
|
+
Ue(!0), be(e);
|
|
55
|
+
}, [be]), L = o(ie, { enabled: !y && !!ie && !l && !_ }).data?.suggested_counterpart?.id, qe = v?.name;
|
|
56
|
+
d(() => {
|
|
57
|
+
!y && !He && !l && !_ && L && I(L);
|
|
58
|
+
}, [
|
|
59
|
+
l,
|
|
60
|
+
_,
|
|
61
|
+
y,
|
|
62
|
+
He,
|
|
63
|
+
L,
|
|
64
|
+
I
|
|
65
|
+
]), d(() => {
|
|
66
|
+
Ve.current !== l && (Ve.current = l, F(), ze((e) => e?.counterpartId === l ? e : void 0));
|
|
67
|
+
}, [l, F]), d(() => {
|
|
68
|
+
let e = setTimeout(() => {
|
|
69
|
+
Oe(C.trim());
|
|
70
|
+
}, he);
|
|
71
|
+
return () => clearTimeout(e);
|
|
72
|
+
}, [C]);
|
|
73
|
+
let R = i({
|
|
74
|
+
sort: "counterpart_name",
|
|
75
|
+
order: "asc",
|
|
76
|
+
limit: me,
|
|
77
|
+
counterpart_name__icontains: w || void 0,
|
|
78
|
+
is_vendor: !0,
|
|
79
|
+
enabled: !y && (T === "edit" || !T && !l) && ye && Ee
|
|
89
80
|
});
|
|
81
|
+
d(() => {
|
|
82
|
+
R.isPlaceholderData || (ke.current = w);
|
|
83
|
+
}, [w, R.isPlaceholderData]);
|
|
84
|
+
let Je = R.isPlaceholderData && ke.current !== w, z = ce({
|
|
85
|
+
selectedId: l,
|
|
86
|
+
enabled: Ee
|
|
87
|
+
}), Ye = ee(), Xe = a(), B = le({
|
|
88
|
+
view: je,
|
|
89
|
+
setView: Me,
|
|
90
|
+
selectedId: Ne,
|
|
91
|
+
setSelectedId: Pe,
|
|
92
|
+
messages: te,
|
|
93
|
+
counterpartType: "vendor",
|
|
94
|
+
counterpart: z.counterpart,
|
|
95
|
+
primaryAddress: z.primaryAddress,
|
|
96
|
+
includeBankAccount: !1
|
|
97
|
+
}), { openCreate: Ze, openEdit: Qe, close: $e, setValues: V, submit: et } = B, H = f(() => de(v), [v]), U = H?.bankAccount, W = f(() => {
|
|
98
|
+
let e = z.counterpart;
|
|
99
|
+
if (!e) return;
|
|
100
|
+
if (z.isBankAccountsLoading) return {
|
|
101
|
+
name: c(e),
|
|
102
|
+
email: s(e),
|
|
103
|
+
methodLabel: S.paymentMethodLoading,
|
|
104
|
+
hasPaymentInstructions: !1
|
|
105
|
+
};
|
|
106
|
+
if (z.isBankAccountsError) return {
|
|
107
|
+
name: c(e),
|
|
108
|
+
email: s(e),
|
|
109
|
+
methodLabel: S.paymentMethodUnavailable,
|
|
110
|
+
hasPaymentInstructions: !1
|
|
111
|
+
};
|
|
112
|
+
let t = ae(z.bankAccounts);
|
|
113
|
+
return {
|
|
114
|
+
name: c(e),
|
|
115
|
+
email: s(e),
|
|
116
|
+
methodLabel: t ? S.paymentInstructionsValue(t.account_number?.slice(-4) ?? "") : S.noMethod,
|
|
117
|
+
hasPaymentInstructions: !!t
|
|
118
|
+
};
|
|
119
|
+
}, [
|
|
120
|
+
z.bankAccounts,
|
|
121
|
+
z.counterpart,
|
|
122
|
+
z.isBankAccountsError,
|
|
123
|
+
z.isBankAccountsLoading,
|
|
124
|
+
S
|
|
125
|
+
]), G = f(() => {
|
|
126
|
+
let e = qe?.trim();
|
|
127
|
+
if (!e || l || T) return;
|
|
128
|
+
let t = U?.accountNumber;
|
|
129
|
+
return {
|
|
130
|
+
name: e,
|
|
131
|
+
email: v?.email ?? "",
|
|
132
|
+
description: S.pendingVendorDescription,
|
|
133
|
+
methodLabel: t ? S.paymentInstructionsValue(t.slice(-4)) : "",
|
|
134
|
+
hasPaymentInstructions: !!t
|
|
135
|
+
};
|
|
136
|
+
}, [
|
|
137
|
+
l,
|
|
138
|
+
U?.accountNumber,
|
|
139
|
+
v?.email,
|
|
140
|
+
qe,
|
|
141
|
+
T,
|
|
142
|
+
S.paymentInstructionsValue,
|
|
143
|
+
S.pendingVendorDescription
|
|
144
|
+
]), K = l === _ ? ve : void 0, q = f(() => _e(z.bankAccounts, K), [z.bankAccounts, K]), tt = f(() => ae(z.bankAccounts)?.id, [z.bankAccounts]), nt = !z.counterpart || z.isLoading || z.isFetching || z.isError || z.isBankAccountsLoading || z.isBankAccountsFetching || z.isBankAccountsError, rt = nt || z.isAddressesLoading || z.isAddressesFetching || z.isAddressesError, it = b && !nt && z.isAddressesError ? { onRetry: z.refetchAddresses } : void 0, J = u(() => {
|
|
145
|
+
$e(), Ae(void 0), E(!1), N.current = void 0;
|
|
146
|
+
}, [$e]), at = u((e) => {
|
|
147
|
+
if (E(!1), N.current = void 0, e === "edit") Pe(l), Qe();
|
|
148
|
+
else {
|
|
149
|
+
Ze();
|
|
150
|
+
let e = C.trim();
|
|
151
|
+
V((t) => ({
|
|
152
|
+
...t,
|
|
153
|
+
entityType: "organization",
|
|
154
|
+
legalName: e || H?.legalName || t.legalName,
|
|
155
|
+
email: H?.email || t.email,
|
|
156
|
+
phone: H?.phone || t.phone,
|
|
157
|
+
address: H?.address ?? t.address
|
|
158
|
+
})), A(U ?? h), M(void 0), j.current = h;
|
|
159
|
+
}
|
|
160
|
+
Ae(e);
|
|
161
|
+
}, [
|
|
162
|
+
l,
|
|
163
|
+
U,
|
|
164
|
+
Ze,
|
|
165
|
+
Qe,
|
|
166
|
+
C,
|
|
167
|
+
V,
|
|
168
|
+
H
|
|
169
|
+
]), Y = u(() => {
|
|
170
|
+
let e = q ? ge(q) : h;
|
|
171
|
+
j.current = e, A(e), M(void 0), O(!0);
|
|
172
|
+
}, [q]), ot = u((e) => {
|
|
173
|
+
A((t) => ({
|
|
174
|
+
...t,
|
|
175
|
+
...e
|
|
176
|
+
})), M(void 0);
|
|
177
|
+
}, []), st = u(() => {
|
|
178
|
+
Ke ? x(F) : F();
|
|
179
|
+
}, [
|
|
180
|
+
F,
|
|
181
|
+
x,
|
|
182
|
+
Ke
|
|
183
|
+
]), X = u(() => {
|
|
184
|
+
J(), F();
|
|
185
|
+
}, [F, J]), Z = Fe || Ke, Q = u((e) => {
|
|
186
|
+
let t = () => {
|
|
187
|
+
X(), e();
|
|
188
|
+
};
|
|
189
|
+
Z ? x(t) : t();
|
|
190
|
+
}, [
|
|
191
|
+
x,
|
|
192
|
+
X,
|
|
193
|
+
Z
|
|
194
|
+
]), ct = u(() => {
|
|
195
|
+
Z ? x(X) : X();
|
|
196
|
+
}, [
|
|
197
|
+
x,
|
|
198
|
+
X,
|
|
199
|
+
Z
|
|
200
|
+
]), lt = u(async (t) => {
|
|
201
|
+
let n = l, r = !1, i = Ie.current;
|
|
202
|
+
if (!g(i, j.current)) {
|
|
203
|
+
let e = se(i);
|
|
204
|
+
if (Object.keys(e).length > 0) return M(e), T !== "create" && O(!0), { ok: !1 };
|
|
205
|
+
}
|
|
206
|
+
if (T === "edit" && rt) return { ok: !1 };
|
|
207
|
+
if (T) {
|
|
208
|
+
if (T === "create" && N.current) n = N.current;
|
|
209
|
+
else {
|
|
210
|
+
let e = await et();
|
|
211
|
+
if (!e.ok) return { ok: !1 };
|
|
212
|
+
T === "create" ? (n = e.counterpartId, N.current = n) : n = e.counterpartId ?? n;
|
|
213
|
+
}
|
|
214
|
+
T === "create" && (r = !0);
|
|
215
|
+
}
|
|
216
|
+
if (!n) return { ok: !0 };
|
|
217
|
+
let ee = z.isBankAccountsLoading || z.isBankAccountsFetching || z.isBankAccountsError;
|
|
218
|
+
if (g(i, j.current)) {
|
|
219
|
+
let e = Be ?? K;
|
|
220
|
+
return e ? (t && (O(!1), T && J()), r && I(n), {
|
|
221
|
+
ok: !0,
|
|
222
|
+
counterpartId: n,
|
|
223
|
+
counterpartBankAccountId: e
|
|
224
|
+
}) : r ? (t && J(), I(n), {
|
|
225
|
+
ok: !0,
|
|
226
|
+
counterpartId: n
|
|
227
|
+
}) : ee ? { ok: !1 } : (t && (O(!1), T && J()), {
|
|
228
|
+
ok: !0,
|
|
229
|
+
counterpartId: n,
|
|
230
|
+
counterpartBankAccountId: tt
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
if (ee) return { ok: !1 };
|
|
234
|
+
M(void 0);
|
|
235
|
+
let a = oe(z.bankAccounts, Be ?? q?.id), o;
|
|
236
|
+
try {
|
|
237
|
+
a.kind === "update" ? (await Xe.mutateAsync({
|
|
238
|
+
path: {
|
|
239
|
+
counterpart_id: n,
|
|
240
|
+
bank_account_id: a.bankAccountId
|
|
241
|
+
},
|
|
242
|
+
body: re(i, { includeAchDefaults: a.includeAchDefaults })
|
|
243
|
+
}), o = a.bankAccountId) : o = (await Ye.mutateAsync({
|
|
244
|
+
path: { counterpart_id: n },
|
|
245
|
+
body: ne(i, { isDefaultForCurrency: a.isDefaultForCurrency })
|
|
246
|
+
}))?.id;
|
|
247
|
+
} catch {
|
|
248
|
+
return e.error(S.bankAccountSaveFailed), {
|
|
249
|
+
ok: !1,
|
|
250
|
+
counterpartId: n
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
return j.current = i, ze(o ? {
|
|
254
|
+
counterpartId: n,
|
|
255
|
+
bankAccountId: o
|
|
256
|
+
} : void 0), t && (O(!1), T && J()), r && I(n), {
|
|
257
|
+
ok: !0,
|
|
258
|
+
counterpartId: n,
|
|
259
|
+
counterpartBankAccountId: o
|
|
260
|
+
};
|
|
261
|
+
}, [
|
|
262
|
+
J,
|
|
263
|
+
l,
|
|
264
|
+
Ye,
|
|
265
|
+
z.bankAccounts,
|
|
266
|
+
z.isBankAccountsError,
|
|
267
|
+
z.isBankAccountsFetching,
|
|
268
|
+
z.isBankAccountsLoading,
|
|
269
|
+
T,
|
|
270
|
+
rt,
|
|
271
|
+
K,
|
|
272
|
+
tt,
|
|
273
|
+
I,
|
|
274
|
+
q,
|
|
275
|
+
et,
|
|
276
|
+
Xe,
|
|
277
|
+
Be
|
|
278
|
+
]), ut = u((e) => {
|
|
279
|
+
if (P.current) return P.current;
|
|
280
|
+
let t = e?.closeOnSuccess ?? !0, n = (async () => {
|
|
281
|
+
Ge(!0);
|
|
282
|
+
try {
|
|
283
|
+
return await lt(t);
|
|
284
|
+
} finally {
|
|
285
|
+
P.current = void 0, Ge(!1);
|
|
286
|
+
}
|
|
287
|
+
})();
|
|
288
|
+
return P.current = n, n;
|
|
289
|
+
}, [lt]), dt = u(() => {
|
|
290
|
+
O(!1), T && J();
|
|
291
|
+
}, [T, J]), ft = f(() => (R.data?.data ?? []).map((e) => ({
|
|
292
|
+
name: c(e),
|
|
293
|
+
email: s(e),
|
|
294
|
+
onSelect: () => {
|
|
295
|
+
Q(() => I(e.id));
|
|
296
|
+
}
|
|
297
|
+
})), [
|
|
298
|
+
R.data,
|
|
299
|
+
Q,
|
|
300
|
+
I
|
|
301
|
+
]), pt = u((e) => {
|
|
302
|
+
E(!0), V((t) => e.entityType === "individual" && t.entityType !== "individual" ? {
|
|
303
|
+
...t,
|
|
304
|
+
...e,
|
|
305
|
+
firstName: t.firstName || t.legalName,
|
|
306
|
+
legalName: t.legalName
|
|
307
|
+
} : e.entityType === "organization" && t.entityType !== "organization" ? {
|
|
308
|
+
...t,
|
|
309
|
+
...e,
|
|
310
|
+
legalName: t.legalName || [t.firstName, t.lastName].filter(Boolean).join(" ")
|
|
311
|
+
} : {
|
|
312
|
+
...t,
|
|
313
|
+
...e
|
|
314
|
+
});
|
|
315
|
+
}, [V]), mt = u((e) => {
|
|
316
|
+
E(!0), V((t) => ({
|
|
317
|
+
...t,
|
|
318
|
+
address: {
|
|
319
|
+
...t.address,
|
|
320
|
+
...e
|
|
321
|
+
}
|
|
322
|
+
}));
|
|
323
|
+
}, [V]), ht = {
|
|
324
|
+
query: C,
|
|
325
|
+
onQueryChange: De,
|
|
326
|
+
isLoading: !ye || !Te || !!l && z.isLoading || R.isLoading || R.isFetching && Je,
|
|
327
|
+
onAddVendor: () => {
|
|
328
|
+
Q(() => at("create"));
|
|
329
|
+
},
|
|
330
|
+
results: ft
|
|
331
|
+
}, gt = Ce && (T === "create" || !nt) ? {
|
|
332
|
+
isOpen: D,
|
|
333
|
+
values: k,
|
|
334
|
+
errors: Le,
|
|
335
|
+
onOpen: Y,
|
|
336
|
+
onCancel: st,
|
|
337
|
+
onChange: ot
|
|
338
|
+
} : void 0, _t = T !== "create" && gt ? {
|
|
339
|
+
...gt,
|
|
340
|
+
onOpen: T === "edit" ? () => Q(Y) : gt.onOpen,
|
|
341
|
+
canEditExisting: Se
|
|
342
|
+
} : void 0, vt = B.isSubmitting || Ye.isPending || Xe.isPending, $ = {
|
|
343
|
+
prepareVendorForSave: ut,
|
|
344
|
+
isVendorSavePending: We || vt,
|
|
345
|
+
hasUnsavedVendorChanges: Z,
|
|
346
|
+
isPendingVendor: !!G,
|
|
347
|
+
isEditingPayTo: !!T || D,
|
|
348
|
+
activePayToOperation: T ? "vendor" : D ? W?.hasPaymentInstructions ? "existingInstructions" : "missingInstructions" : void 0,
|
|
349
|
+
discardPayToEdits: X,
|
|
350
|
+
finalizePayToSave: dt,
|
|
351
|
+
openPaymentInstructions: Y,
|
|
352
|
+
paymentInstructions: _t,
|
|
353
|
+
detailsWarning: it
|
|
354
|
+
}, yt = T === "create" && Ce ? {
|
|
355
|
+
values: k,
|
|
356
|
+
errors: Le,
|
|
357
|
+
onChange: ot,
|
|
358
|
+
isExtracted: !!(U && g(k, U))
|
|
359
|
+
} : void 0;
|
|
360
|
+
if (T) return {
|
|
361
|
+
mode: "creating",
|
|
362
|
+
summary: W,
|
|
363
|
+
newVendorForm: /* @__PURE__ */ pe(fe, {
|
|
364
|
+
mode: T,
|
|
365
|
+
values: B.values,
|
|
366
|
+
errors: B.errors,
|
|
367
|
+
onChange: pt,
|
|
368
|
+
onAddressChange: mt,
|
|
369
|
+
sectionsToExpand: B.sectionsToExpand,
|
|
370
|
+
onAddressExpand: B.expandAddress,
|
|
371
|
+
onCancel: ct,
|
|
372
|
+
onSave: ut,
|
|
373
|
+
isSaving: vt,
|
|
374
|
+
search: T === "edit" && !y ? ht : void 0,
|
|
375
|
+
paymentInstructions: yt
|
|
376
|
+
}),
|
|
377
|
+
...$
|
|
378
|
+
};
|
|
379
|
+
if (W) return {
|
|
380
|
+
mode: "resolved",
|
|
381
|
+
summary: W,
|
|
382
|
+
onEdit: b && !rt ? () => Q(() => at("edit")) : void 0,
|
|
383
|
+
...$
|
|
384
|
+
};
|
|
385
|
+
if (G) {
|
|
386
|
+
let e = () => Q(() => {
|
|
387
|
+
Ue(!0), at("create");
|
|
388
|
+
});
|
|
389
|
+
return {
|
|
390
|
+
mode: "resolved",
|
|
391
|
+
summary: G,
|
|
392
|
+
onEdit: b ? e : void 0,
|
|
393
|
+
error: xe,
|
|
394
|
+
...$,
|
|
395
|
+
showPaymentInstructions: !0,
|
|
396
|
+
paymentInstructions: b && Ce ? {
|
|
397
|
+
isOpen: !1,
|
|
398
|
+
values: k,
|
|
399
|
+
errors: Le,
|
|
400
|
+
onOpen: e,
|
|
401
|
+
onChange: ot,
|
|
402
|
+
onCancel: st,
|
|
403
|
+
canEditExisting: !0
|
|
404
|
+
} : void 0
|
|
405
|
+
};
|
|
406
|
+
}
|
|
407
|
+
return {
|
|
408
|
+
mode: "selecting",
|
|
409
|
+
error: R.isError ? S.searchFailed : z.isError ? S.vendorDetailsFailed : xe,
|
|
410
|
+
search: ht,
|
|
411
|
+
...$
|
|
412
|
+
};
|
|
90
413
|
}
|
|
91
414
|
//#endregion
|
|
92
|
-
export {
|
|
415
|
+
export { _ as useVendorSectionProps };
|