@tesouro/embedded-components-react 0.5.3 → 0.5.5
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.js +1 -1
- package/dist/lib/BillPayWidget.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js +13 -13
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index10.js +70 -5
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index11.js +37 -64
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index12.js +110 -38
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index13.js +73 -104
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index14.js +7 -87
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index15.js +21 -7
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index16.js +22 -17
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index17.js +63 -23
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index18.js +2 -66
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index19.js +81 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index20.js +3 -78
- 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 +39 -30
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index25.js +166 -37
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index26.js +39 -164
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index27.js +1 -48
- 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 +139 -18
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index36.js +16 -139
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index37.js +4 -24
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index38.js +41 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index39.js +14 -39
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index40.js +8 -16
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index41.js +91 -8
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index42.js +86 -80
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index43.js +3 -97
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index44.js +49 -3
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index45.js +135 -47
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index46.js +33 -135
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index47.js +186 -33
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index48.js +75 -186
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index49.js +21 -75
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index5.js +25 -14
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index50.js +232 -22
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index51.js +210 -223
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index52.js +103 -202
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index53.js +13 -121
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index54.js +47 -12
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index55.js +31 -47
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index56.js +198 -27
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index57.js +31 -198
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index58.js +234 -31
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index59.js +19 -240
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index6.js +24 -25
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index60.js +427 -19
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index61.js +4 -433
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index62.js +38 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index63.js +220 -35
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index64.js +3 -224
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index65.js +4 -3
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index66.js +44 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index67.js +1 -46
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index68.js +8 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index69.js +10 -6
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index7.js +57 -21
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index70.js +110 -10
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index71.js +3 -112
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index72.js +127 -3
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index73.js +8 -124
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index74.js +7 -8
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index75.js +46 -8
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index76.js +18 -43
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index77.js +28 -20
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index78.js +82 -27
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index79.js +47 -83
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index8.js +5 -58
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index80.js +250 -47
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index81.js +101 -239
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index82.js +202 -107
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index83.js +3 -209
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index84.js +8 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index85.js +113 -6
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index86.js +1 -115
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index87.js +24 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index9.js +4 -5
- package/dist/libs/tesouro-embedded-components-react/remote-check-capture/data-access/dist/index5.js +1 -0
- 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/package.json +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index88.js +0 -25
|
@@ -2,235 +2,222 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
5
|
+
import { hasAnyScope as e } from "../../../shared/data-access/dist/lib/hasAnyScope.js";
|
|
6
|
+
import { Scope as t } from "../../../shared/data-access/dist/lib/scopes.js";
|
|
7
|
+
import "../../../shared/data-access/dist/index.js";
|
|
8
|
+
import { useWidgetConfig as n } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
|
|
9
|
+
import "../../../shared/feature/dist/index.js";
|
|
10
|
+
import { useCounterpartsQuery as r } from "../../../shared/counterpart-management/data-access/dist/index3.js";
|
|
11
|
+
import { useCreateCounterpartBankAccountMutation as ee, useUpdateCounterpartBankAccountMutation as te } from "../../../shared/counterpart-management/data-access/dist/index5.js";
|
|
12
|
+
import { usePayableSuggestionsQuery as i } from "../../data-access/dist/index18.js";
|
|
13
|
+
import "../../data-access/dist/index.js";
|
|
14
|
+
import { maskAccountNumber as a } from "./index22.js";
|
|
15
|
+
import { counterpartFormBankAccountToCreatePayload as ne, counterpartFormBankAccountToUpdatePayload as re, getAchInstructions as ie, getCounterpartEmail as o, getCounterpartName as s, getPayableAchInstructions as c, hasAchFormValues as l, resolveCounterpartBankAccountWrite as ae, validateAchFormValues as oe } from "../../../shared/counterpart-management/feature/dist/lib/helpers.js";
|
|
16
|
+
import { useCounterpartDetails as se } from "../../../shared/counterpart-management/feature/dist/lib/useCounterpartDetails.js";
|
|
11
17
|
import "../../../shared/counterpart-management/feature/dist/index.js";
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
18
|
+
import { VENDOR_SECTION_PROPS_LABELS_EN as ce } from "./index47.js";
|
|
19
|
+
import { buildVendorPrefill as le } from "./index49.js";
|
|
20
|
+
import { VendorInlineForm as ue } from "./index50.js";
|
|
21
|
+
import { useCallback as u, useEffect as d, useMemo as f, useRef as p, useState as m } from "react";
|
|
22
|
+
import { jsx as de } from "react/jsx-runtime";
|
|
16
23
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index51.js
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
isBankAccountsLoading: E,
|
|
36
|
-
isBankAccountsError: D
|
|
37
|
-
}), { openCreate: Y, openEdit: X, setValues: Z, expandAddress: Q } = J, re = l(J.errors);
|
|
38
|
-
m(() => {
|
|
39
|
-
S === "edit" ? X() : Y();
|
|
24
|
+
var fe = 10, h = 300, g = {
|
|
25
|
+
accountHolderName: "",
|
|
26
|
+
routingNumber: "",
|
|
27
|
+
accountNumber: ""
|
|
28
|
+
};
|
|
29
|
+
function _({ payableId: _, counterpartId: v, payableCounterpartId: y, payableCounterpartBankAccountId: b, isVendorKnown: x = !0, onCounterpartChange: S, requiredError: pe, extractedVendor: C, labels: me }) {
|
|
30
|
+
let w = {
|
|
31
|
+
...ce,
|
|
32
|
+
...me
|
|
33
|
+
}, { initResponse: T } = n(), he = e(T?.scopes, [t.CounterpartReadOrg]), [E, D] = m(""), [ge, _e] = m(""), [O, k] = m(), [ve, A] = m(!1), [j, M] = m(g), N = p(j);
|
|
34
|
+
N.current = j;
|
|
35
|
+
let [P, F] = m(!1), I = l(j) || P, [ye, L] = m(), [R, z] = m(), B = p(v), [V, be] = m(!1), H = u(() => {
|
|
36
|
+
A(!1), M(g), L(void 0), z(void 0);
|
|
37
|
+
}, []), U = u((e) => {
|
|
38
|
+
be(!0), S(e);
|
|
39
|
+
}, [S]), W = i(_, { enabled: !!_ && !v && !y }).data?.suggested_counterpart?.id;
|
|
40
|
+
d(() => {
|
|
41
|
+
!V && !v && !y && W && U(W);
|
|
40
42
|
}, [
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
v,
|
|
44
|
+
y,
|
|
45
|
+
V,
|
|
46
|
+
W,
|
|
47
|
+
U
|
|
48
|
+
]), d(() => {
|
|
49
|
+
B.current !== v && (B.current = v, H());
|
|
50
|
+
}, [v, H]), d(() => {
|
|
51
|
+
let e = setTimeout(() => {
|
|
52
|
+
_e(E.trim());
|
|
53
|
+
}, h);
|
|
54
|
+
return () => clearTimeout(e);
|
|
55
|
+
}, [E]);
|
|
56
|
+
let G = r({
|
|
57
|
+
sort: "counterpart_name",
|
|
58
|
+
order: "asc",
|
|
59
|
+
limit: fe,
|
|
60
|
+
counterpart_name__icontains: ge || void 0,
|
|
61
|
+
is_vendor: !0,
|
|
62
|
+
enabled: !O && !v && x && he
|
|
63
|
+
}), K = se({ selectedId: v }), q = ee(), J = te(), Y = f(() => {
|
|
64
|
+
let e = K.counterpart;
|
|
65
|
+
if (!e) return;
|
|
66
|
+
if (K.isBankAccountsLoading) return {
|
|
67
|
+
name: s(e),
|
|
68
|
+
email: o(e),
|
|
69
|
+
methodLabel: w.paymentMethodLoading,
|
|
70
|
+
fields: []
|
|
71
|
+
};
|
|
72
|
+
if (K.isBankAccountsError) return {
|
|
73
|
+
name: s(e),
|
|
74
|
+
email: o(e),
|
|
75
|
+
methodLabel: w.paymentMethodUnavailable,
|
|
76
|
+
fields: []
|
|
77
|
+
};
|
|
78
|
+
let t = c(K.bankAccounts);
|
|
79
|
+
return {
|
|
80
|
+
name: s(e),
|
|
81
|
+
email: o(e),
|
|
82
|
+
methodLabel: t ? w.achMethod : w.noMethod,
|
|
83
|
+
fields: t ? [
|
|
84
|
+
{
|
|
85
|
+
label: w.accountHolder,
|
|
86
|
+
value: t.account_holder_name ?? ""
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
label: w.routingNumber,
|
|
90
|
+
value: t.routing_number ?? ""
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
label: w.accountNumber,
|
|
94
|
+
value: t.account_number ?? "",
|
|
95
|
+
maskedValue: t.account_number ? a(t.account_number) : ""
|
|
96
|
+
}
|
|
97
|
+
] : []
|
|
98
|
+
};
|
|
46
99
|
}, [
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
100
|
+
K.bankAccounts,
|
|
101
|
+
K.counterpart,
|
|
102
|
+
K.isBankAccountsError,
|
|
103
|
+
K.isBankAccountsLoading,
|
|
104
|
+
w
|
|
105
|
+
]), X = f(() => ie(K.bankAccounts), [K.bankAccounts]), Z = f(() => c(K.bankAccounts)?.id, [K.bankAccounts]), Q = u(async () => {
|
|
106
|
+
let e = N.current;
|
|
107
|
+
if (!v) return { ok: !0 };
|
|
108
|
+
if (!l(e)) return b && v === y ? {
|
|
109
|
+
ok: !0,
|
|
110
|
+
counterpartBankAccountId: b
|
|
111
|
+
} : K.isBankAccountsLoading || K.isBankAccountsFetching || K.isBankAccountsError ? { ok: !1 } : {
|
|
112
|
+
ok: !0,
|
|
113
|
+
counterpartBankAccountId: Z
|
|
114
|
+
};
|
|
115
|
+
if (K.isBankAccountsLoading || K.isBankAccountsFetching || K.isBankAccountsError) return { ok: !1 };
|
|
116
|
+
let t = oe(e);
|
|
117
|
+
if (Object.keys(t).length > 0) return L(t), A(!0), { ok: !1 };
|
|
118
|
+
L(void 0);
|
|
119
|
+
let n = ae(K.bankAccounts, R ?? X?.id);
|
|
120
|
+
if (n.kind === "update") return await J.mutateAsync({
|
|
121
|
+
path: {
|
|
122
|
+
counterpart_id: v,
|
|
123
|
+
bank_account_id: n.bankAccountId
|
|
124
|
+
},
|
|
125
|
+
body: re(e, { includeAchDefaults: n.includeAchDefaults })
|
|
126
|
+
}), z(n.bankAccountId), {
|
|
127
|
+
ok: !0,
|
|
128
|
+
counterpartBankAccountId: n.bankAccountId
|
|
129
|
+
};
|
|
130
|
+
let r = await q.mutateAsync({
|
|
131
|
+
path: { counterpart_id: v },
|
|
132
|
+
body: ne(e, { isDefaultForCurrency: n.isDefaultForCurrency })
|
|
133
|
+
});
|
|
134
|
+
return z(r?.id), {
|
|
135
|
+
ok: !0,
|
|
136
|
+
counterpartBankAccountId: r?.id
|
|
137
|
+
};
|
|
59
138
|
}, [
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
139
|
+
X,
|
|
140
|
+
v,
|
|
141
|
+
q,
|
|
142
|
+
K.bankAccounts,
|
|
143
|
+
K.isBankAccountsError,
|
|
144
|
+
K.isBankAccountsFetching,
|
|
145
|
+
K.isBankAccountsLoading,
|
|
146
|
+
R,
|
|
63
147
|
Z,
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
]),
|
|
72
|
-
|
|
73
|
-
}, [
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
})]
|
|
112
|
-
}),
|
|
113
|
-
/* @__PURE__ */ v(c, {
|
|
114
|
-
mode: S,
|
|
115
|
-
counterpartMode: "vendor",
|
|
116
|
-
values: J.values,
|
|
117
|
-
errors: J.errors,
|
|
118
|
-
stateOptions: G,
|
|
119
|
-
onChange: ie,
|
|
120
|
-
onAddressChange: (e) => {
|
|
121
|
-
H(!0), Z((t) => ({
|
|
122
|
-
...t,
|
|
123
|
-
address: {
|
|
124
|
-
...t.address,
|
|
125
|
-
...e
|
|
126
|
-
}
|
|
127
|
-
}));
|
|
148
|
+
b,
|
|
149
|
+
y,
|
|
150
|
+
J
|
|
151
|
+
]), xe = f(() => (G.data?.data ?? []).map((e) => ({
|
|
152
|
+
name: s(e),
|
|
153
|
+
email: o(e),
|
|
154
|
+
onSelect: () => U(e.id)
|
|
155
|
+
})), [G.data, U]), Se = f(() => le(C), [C]), $ = u(() => {
|
|
156
|
+
k(void 0), F(!1);
|
|
157
|
+
}, []), Ce = u((e) => {
|
|
158
|
+
k(void 0), F(!1), U(e);
|
|
159
|
+
}, [U]);
|
|
160
|
+
if (O) return {
|
|
161
|
+
mode: "creating",
|
|
162
|
+
newVendorForm: /* @__PURE__ */ de(ue, {
|
|
163
|
+
mode: O,
|
|
164
|
+
counterpart: O === "edit" ? K.counterpart : void 0,
|
|
165
|
+
primaryAddress: O === "edit" ? K.primaryAddress : void 0,
|
|
166
|
+
bankAccounts: O === "edit" ? K.bankAccounts : void 0,
|
|
167
|
+
isBankAccountsLoading: O === "edit" ? K.isBankAccountsLoading : void 0,
|
|
168
|
+
isBankAccountsError: O === "edit" ? K.isBankAccountsError : void 0,
|
|
169
|
+
initialName: O === "create" ? E : void 0,
|
|
170
|
+
initialValues: O === "create" ? Se : void 0,
|
|
171
|
+
onSaved: Ce,
|
|
172
|
+
onCancel: $,
|
|
173
|
+
onDirtyChange: F
|
|
174
|
+
}),
|
|
175
|
+
onClear: $,
|
|
176
|
+
hasUnsavedVendorChanges: I
|
|
177
|
+
};
|
|
178
|
+
if (Y) {
|
|
179
|
+
let e = K.isBankAccountsLoading || K.isBankAccountsFetching || K.isBankAccountsError;
|
|
180
|
+
return {
|
|
181
|
+
mode: "resolved",
|
|
182
|
+
summary: Y,
|
|
183
|
+
onEdit: e ? void 0 : () => k("edit"),
|
|
184
|
+
onClear: () => U(void 0),
|
|
185
|
+
paymentInstructions: e ? void 0 : {
|
|
186
|
+
isOpen: ve,
|
|
187
|
+
values: j,
|
|
188
|
+
errors: ye,
|
|
189
|
+
onOpen: () => {
|
|
190
|
+
A(!0), X && (M({
|
|
191
|
+
accountHolderName: X.account_holder_name ?? "",
|
|
192
|
+
routingNumber: X.routing_number ?? "",
|
|
193
|
+
accountNumber: X.account_number ?? ""
|
|
194
|
+
}), z(X.id));
|
|
128
195
|
},
|
|
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
|
-
className: "ttw:flex ttw:size-8 ttw:shrink-0 ttw:items-center ttw:justify-center ttw:rounded-md ttw:bg-primary",
|
|
155
|
-
children: /* @__PURE__ */ v(b, {
|
|
156
|
-
"aria-hidden": !0,
|
|
157
|
-
className: "ttw:size-4 ttw:text-white"
|
|
158
|
-
})
|
|
159
|
-
}), /* @__PURE__ */ y("div", {
|
|
160
|
-
className: "ttw:flex ttw:flex-1 ttw:flex-col ttw:gap-3",
|
|
161
|
-
children: [/* @__PURE__ */ y("div", {
|
|
162
|
-
className: "ttw:flex ttw:flex-col ttw:gap-0.5",
|
|
163
|
-
children: [/* @__PURE__ */ v("p", {
|
|
164
|
-
className: "ttw:text-sm ttw:font-medium ttw:text-foreground",
|
|
165
|
-
children: P.achTitle
|
|
166
|
-
}), /* @__PURE__ */ v("p", {
|
|
167
|
-
className: "ttw:text-sm ttw:text-muted-foreground",
|
|
168
|
-
children: P.achDescription
|
|
169
|
-
})]
|
|
170
|
-
}), z ? /* @__PURE__ */ y(te, { children: [/* @__PURE__ */ v(ee, {
|
|
171
|
-
idPrefix: "vendor-inline-ach",
|
|
172
|
-
values: J.values.bankAccount,
|
|
173
|
-
errors: J.errors?.bankAccount,
|
|
174
|
-
onChange: (e) => {
|
|
175
|
-
H(!0), Z((t) => ({
|
|
176
|
-
...t,
|
|
177
|
-
bankAccount: {
|
|
178
|
-
...t.bankAccount,
|
|
179
|
-
...e
|
|
180
|
-
}
|
|
181
|
-
}));
|
|
182
|
-
},
|
|
183
|
-
labels: {
|
|
184
|
-
accountHolderName: P.accountHolderNameLabel,
|
|
185
|
-
routingNumber: P.routingNumberLabel,
|
|
186
|
-
accountNumber: P.accountNumberLabel
|
|
187
|
-
}
|
|
188
|
-
}), /* @__PURE__ */ v("p", {
|
|
189
|
-
className: "ttw:text-sm ttw:text-muted-foreground",
|
|
190
|
-
children: P.achHelp
|
|
191
|
-
})] }) : /* @__PURE__ */ y(o, {
|
|
192
|
-
type: "button",
|
|
193
|
-
variant: "link",
|
|
194
|
-
className: "ttw:w-fit ttw:px-0",
|
|
195
|
-
onClick: () => B(!0),
|
|
196
|
-
children: [/* @__PURE__ */ v(ne, { className: "ttw:size-4" }), P.addBankAccount]
|
|
197
|
-
})]
|
|
198
|
-
})]
|
|
199
|
-
}),
|
|
200
|
-
/* @__PURE__ */ y("div", {
|
|
201
|
-
className: "ttw:flex ttw:justify-end ttw:gap-2",
|
|
202
|
-
children: [/* @__PURE__ */ v(o, {
|
|
203
|
-
type: "button",
|
|
204
|
-
variant: "outline",
|
|
205
|
-
onClick: $,
|
|
206
|
-
children: P.cancel
|
|
207
|
-
}), /* @__PURE__ */ v(o, {
|
|
208
|
-
type: "button",
|
|
209
|
-
onClick: J.submit,
|
|
210
|
-
loading: J.isSubmitting,
|
|
211
|
-
disabled: J.isSubmitting,
|
|
212
|
-
children: P.save
|
|
213
|
-
})]
|
|
214
|
-
}),
|
|
215
|
-
/* @__PURE__ */ v(e, {
|
|
216
|
-
open: U,
|
|
217
|
-
onOpenChange: W,
|
|
218
|
-
children: /* @__PURE__ */ y(t, { children: [/* @__PURE__ */ y(i, { children: [/* @__PURE__ */ v(a, { children: P.discardConfirmTitle }), /* @__PURE__ */ v(n, { children: P.discardConfirmDescription })] }), /* @__PURE__ */ y(r, { children: [/* @__PURE__ */ v(o, {
|
|
219
|
-
type: "button",
|
|
220
|
-
variant: "outline",
|
|
221
|
-
onClick: () => W(!1),
|
|
222
|
-
children: P.keepEditingAction
|
|
223
|
-
}), /* @__PURE__ */ v(o, {
|
|
224
|
-
type: "button",
|
|
225
|
-
variant: "destructive",
|
|
226
|
-
onClick: () => {
|
|
227
|
-
W(!1), j();
|
|
228
|
-
},
|
|
229
|
-
children: P.discardChangesAction
|
|
230
|
-
})] })] })
|
|
231
|
-
})
|
|
232
|
-
]
|
|
233
|
-
});
|
|
196
|
+
onChange: (e) => {
|
|
197
|
+
M((t) => ({
|
|
198
|
+
...t,
|
|
199
|
+
...e
|
|
200
|
+
})), L(void 0);
|
|
201
|
+
}
|
|
202
|
+
},
|
|
203
|
+
savePaymentInstructions: Q,
|
|
204
|
+
hasUnsavedVendorChanges: I
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
let we = !x || !T || !!v && K.isLoading;
|
|
208
|
+
return {
|
|
209
|
+
mode: "selecting",
|
|
210
|
+
error: G.isError ? w.searchFailed : K.isError ? w.vendorDetailsFailed : pe,
|
|
211
|
+
search: {
|
|
212
|
+
query: E,
|
|
213
|
+
onQueryChange: D,
|
|
214
|
+
isLoading: we || G.isFetching,
|
|
215
|
+
onAddVendor: () => k("create"),
|
|
216
|
+
results: xe
|
|
217
|
+
},
|
|
218
|
+
savePaymentInstructions: Q,
|
|
219
|
+
hasUnsavedVendorChanges: I
|
|
220
|
+
};
|
|
234
221
|
}
|
|
235
222
|
//#endregion
|
|
236
|
-
export {
|
|
223
|
+
export { _ as useVendorSectionProps };
|