@tesouro/embedded-components-react 0.5.2 → 0.5.4
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/README.md +15 -2
- package/dist/index.d.ts +120 -100
- package/dist/index.js +7 -4
- package/dist/lib/BankAccountOnboardingWidget.d.ts +214 -246
- package/dist/lib/BillPayWidget.js +1 -1
- package/dist/lib/MarketingWidget.d.ts +684 -0
- package/dist/lib/MarketingWidget.js +4 -0
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/data-access/dist/index.js +9 -8
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index16.js +0 -2
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index18.js +183 -205
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index.js +1 -4
- 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/marketing-widget/feature/dist/index.js +3 -0
- package/dist/libs/tesouro-embedded-components-react/marketing-widget/feature/dist/index2.js +8 -0
- package/dist/libs/tesouro-embedded-components-react/{bank-account-onboarding-widget/ui/dist/index26.js → marketing-widget/feature/dist/index3.js} +1 -1
- package/dist/libs/tesouro-embedded-components-react/marketing-widget/feature/dist/index4.js +81 -0
- package/dist/libs/tesouro-embedded-components-react/marketing-widget/ui/dist/index.js +4 -0
- package/dist/libs/tesouro-embedded-components-react/{bank-account-onboarding-widget/ui/dist/index24.js → marketing-widget/ui/dist/index2.js} +1 -1
- package/dist/libs/tesouro-embedded-components-react/{bank-account-onboarding-widget/ui/dist/index25.js → marketing-widget/ui/dist/index3.js} +1 -1
- package/dist/libs/tesouro-embedded-components-react/{bank-account-onboarding-widget/ui/dist/index27.js → marketing-widget/ui/dist/index4.js} +36 -37
- package/dist/libs/tesouro-embedded-components-react/marketing-widget/ui/dist/index5.js +75 -0
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +24 -22
- package/dist/libs/tesouro-embedded-components-react/{bank-account-onboarding-widget/data-access/dist/index9.js → shared/data-access/dist/lib/onboardingSuppressionReason.js} +1 -1
- package/dist/libs/tesouro-embedded-components-react/{bank-account-onboarding-widget/data-access/dist/index10.js → shared/data-access/dist/lib/useOrganizationOnboardingSuppression.js} +5 -6
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/WidgetProvider/isDisclosuresAcceptanceRequired.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/bank-account-onboarding-widget/ui/dist/index28.js +0 -75
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index88.js +0 -25
|
@@ -2,222 +2,123 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import "
|
|
8
|
-
import {
|
|
9
|
-
import "
|
|
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";
|
|
5
|
+
import { toast as e } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
6
|
+
import "../../../shared/ui/dist/index.js";
|
|
7
|
+
import { useUpdatePayableMutation as t } from "../../data-access/dist/index13.js";
|
|
8
|
+
import { useCounterpartBankAccountsQuery as n, useCreateCounterpartBankAccountMutation as r } from "../../../shared/counterpart-management/data-access/dist/index5.js";
|
|
9
|
+
import { useUpdatePayableCounterpartBankAccountMutation as i } from "../../data-access/dist/index14.js";
|
|
13
10
|
import "../../data-access/dist/index.js";
|
|
14
|
-
import {
|
|
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
|
+
import { counterpartFormBankAccountToCreatePayload as a, counterpartFormBankAccountToUpdatePayload as o, getAchInstructions as s, isAchCompatibleBankAccount as c, resolveCounterpartBankAccountWrite as l, validateAchFormValues as u } from "../../../shared/counterpart-management/feature/dist/lib/helpers.js";
|
|
17
12
|
import "../../../shared/counterpart-management/feature/dist/index.js";
|
|
18
|
-
import {
|
|
19
|
-
import { buildVendorPrefill as le } from "./index50.js";
|
|
20
|
-
import { VendorInlineForm as ue } from "./index51.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";
|
|
13
|
+
import { useCallback as d, useEffect as f, useRef as p, useState as m } from "react";
|
|
23
14
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index52.js
|
|
24
|
-
var
|
|
15
|
+
var h = {
|
|
25
16
|
accountHolderName: "",
|
|
26
17
|
routingNumber: "",
|
|
27
18
|
accountNumber: ""
|
|
28
19
|
};
|
|
29
|
-
function
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
20
|
+
function g(e, t) {
|
|
21
|
+
return e?.find((e) => e.id === t && c(e)) ?? s(e);
|
|
22
|
+
}
|
|
23
|
+
function _({ payableId: c, counterpartId: _, currentBankAccountId: v, canReadCounterpartBankAccounts: y = !0, saveErrorMessage: b, linkErrorMessage: x }) {
|
|
24
|
+
let [S, C] = m(!1), [w, T] = m(h), [E, D] = m(), O = n(_, { enabled: y }), k = O.data?.data, A = r(), j = i(), M = t(), N = p(void 0), P = p(!1);
|
|
25
|
+
f(() => {
|
|
26
|
+
N.current = void 0;
|
|
27
|
+
}, [_, c]);
|
|
28
|
+
let F = d(() => {
|
|
29
|
+
if (S) return;
|
|
30
|
+
let e = O.isFetching ? void 0 : g(k, v);
|
|
31
|
+
T(e ? {
|
|
32
|
+
accountHolderName: e.account_holder_name ?? "",
|
|
33
|
+
routingNumber: e.routing_number ?? "",
|
|
34
|
+
accountNumber: e.account_number ?? ""
|
|
35
|
+
} : h), N.current = e?.id ?? N.current, P.current = !O.isFetching, D(void 0), C(!0);
|
|
42
36
|
}, [
|
|
37
|
+
k,
|
|
38
|
+
O.isFetching,
|
|
43
39
|
v,
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
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
|
-
};
|
|
40
|
+
S
|
|
41
|
+
]);
|
|
42
|
+
f(() => {
|
|
43
|
+
if (!S || P.current || O.isFetching) return;
|
|
44
|
+
P.current = !0;
|
|
45
|
+
let e = g(k, v);
|
|
46
|
+
e && (T((t) => t.accountHolderName === "" && t.routingNumber === "" && t.accountNumber === "" ? {
|
|
47
|
+
accountHolderName: e.account_holder_name ?? "",
|
|
48
|
+
routingNumber: e.routing_number ?? "",
|
|
49
|
+
accountNumber: e.account_number ?? ""
|
|
50
|
+
} : t), N.current = e.id);
|
|
99
51
|
}, [
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
])
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
if (
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
52
|
+
S,
|
|
53
|
+
O.isFetching,
|
|
54
|
+
k,
|
|
55
|
+
v,
|
|
56
|
+
y
|
|
57
|
+
]);
|
|
58
|
+
let I = d(() => {
|
|
59
|
+
C(!1);
|
|
60
|
+
}, []), L = d((e) => {
|
|
61
|
+
T((t) => ({
|
|
62
|
+
...t,
|
|
63
|
+
...e
|
|
64
|
+
}));
|
|
65
|
+
}, []), R = d(async () => {
|
|
66
|
+
if (!c || !_) return !1;
|
|
67
|
+
let t = u(w);
|
|
68
|
+
if (Object.keys(t).length > 0) return D(t), !1;
|
|
69
|
+
if (D(void 0), !y || O.isFetching || O.isError) return e.error(b), !1;
|
|
70
|
+
let n = N.current;
|
|
71
|
+
try {
|
|
72
|
+
let e = l(k, n ?? s(k)?.id);
|
|
73
|
+
e.kind === "update" ? (await j.mutateAsync({
|
|
74
|
+
path: {
|
|
75
|
+
counterpart_id: _,
|
|
76
|
+
bank_account_id: e.bankAccountId
|
|
77
|
+
},
|
|
78
|
+
body: o(w, { includeAchDefaults: e.includeAchDefaults }),
|
|
79
|
+
payableId: c,
|
|
80
|
+
makeDefault: e.includeAchDefaults || !k?.find((t) => t.id === e.bankAccountId)?.is_default_for_currency
|
|
81
|
+
}), n = e.bankAccountId) : n = (await A.mutateAsync({
|
|
82
|
+
path: { counterpart_id: _ },
|
|
83
|
+
body: a(w, { isDefaultForCurrency: e.isDefaultForCurrency })
|
|
84
|
+
}))?.id, N.current = n;
|
|
85
|
+
} catch {
|
|
86
|
+
return e.error(b), !1;
|
|
87
|
+
}
|
|
88
|
+
if (n !== v) try {
|
|
89
|
+
await M.mutateAsync({
|
|
90
|
+
path: { payable_id: c },
|
|
91
|
+
body: { counterpart_bank_account_id: n }
|
|
92
|
+
});
|
|
93
|
+
} catch {
|
|
94
|
+
return e.error(x), !1;
|
|
95
|
+
}
|
|
96
|
+
return C(!1), !0;
|
|
138
97
|
}, [
|
|
139
|
-
|
|
98
|
+
k,
|
|
99
|
+
O.isError,
|
|
100
|
+
O.isFetching,
|
|
101
|
+
y,
|
|
102
|
+
_,
|
|
103
|
+
A,
|
|
140
104
|
v,
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
K.isBankAccountsError,
|
|
144
|
-
K.isBankAccountsFetching,
|
|
145
|
-
K.isBankAccountsLoading,
|
|
146
|
-
R,
|
|
147
|
-
Z,
|
|
105
|
+
x,
|
|
106
|
+
c,
|
|
148
107
|
b,
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
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));
|
|
195
|
-
},
|
|
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;
|
|
108
|
+
j,
|
|
109
|
+
M,
|
|
110
|
+
w
|
|
111
|
+
]);
|
|
208
112
|
return {
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
},
|
|
218
|
-
savePaymentInstructions: Q,
|
|
219
|
-
hasUnsavedVendorChanges: I
|
|
113
|
+
isOpen: S,
|
|
114
|
+
values: w,
|
|
115
|
+
errors: E,
|
|
116
|
+
isSaving: A.isPending || j.isPending || M.isPending,
|
|
117
|
+
open: F,
|
|
118
|
+
close: I,
|
|
119
|
+
onChange: L,
|
|
120
|
+
save: R
|
|
220
121
|
};
|
|
221
122
|
}
|
|
222
123
|
//#endregion
|
|
223
|
-
export { _ as
|
|
124
|
+
export { _ as usePaymentInstructionsForm };
|
|
@@ -1,124 +1,16 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use client";
|
|
3
|
-
"use client";
|
|
4
|
-
"use client";
|
|
5
|
-
import { toast as e } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
6
|
-
import "../../../shared/ui/dist/index.js";
|
|
7
|
-
import { useUpdatePayableMutation as t } from "../../data-access/dist/index13.js";
|
|
8
|
-
import { useCounterpartBankAccountsQuery as n, useCreateCounterpartBankAccountMutation as r } from "../../../shared/counterpart-management/data-access/dist/index5.js";
|
|
9
|
-
import { useUpdatePayableCounterpartBankAccountMutation as i } from "../../data-access/dist/index14.js";
|
|
10
|
-
import "../../data-access/dist/index.js";
|
|
11
|
-
import { counterpartFormBankAccountToCreatePayload as a, counterpartFormBankAccountToUpdatePayload as o, getAchInstructions as s, isAchCompatibleBankAccount as c, resolveCounterpartBankAccountWrite as l, validateAchFormValues as u } from "../../../shared/counterpart-management/feature/dist/lib/helpers.js";
|
|
12
|
-
import "../../../shared/counterpart-management/feature/dist/index.js";
|
|
13
|
-
import { useCallback as d, useEffect as f, useRef as p, useState as m } from "react";
|
|
14
1
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index53.js
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}, [_, c]);
|
|
28
|
-
let F = d(() => {
|
|
29
|
-
if (S) return;
|
|
30
|
-
let e = O.isFetching ? void 0 : g(k, v);
|
|
31
|
-
T(e ? {
|
|
32
|
-
accountHolderName: e.account_holder_name ?? "",
|
|
33
|
-
routingNumber: e.routing_number ?? "",
|
|
34
|
-
accountNumber: e.account_number ?? ""
|
|
35
|
-
} : h), N.current = e?.id ?? N.current, P.current = !O.isFetching, D(void 0), C(!0);
|
|
36
|
-
}, [
|
|
37
|
-
k,
|
|
38
|
-
O.isFetching,
|
|
39
|
-
v,
|
|
40
|
-
S
|
|
41
|
-
]);
|
|
42
|
-
f(() => {
|
|
43
|
-
if (!S || P.current || O.isFetching) return;
|
|
44
|
-
P.current = !0;
|
|
45
|
-
let e = g(k, v);
|
|
46
|
-
e && (T((t) => t.accountHolderName === "" && t.routingNumber === "" && t.accountNumber === "" ? {
|
|
47
|
-
accountHolderName: e.account_holder_name ?? "",
|
|
48
|
-
routingNumber: e.routing_number ?? "",
|
|
49
|
-
accountNumber: e.account_number ?? ""
|
|
50
|
-
} : t), N.current = e.id);
|
|
51
|
-
}, [
|
|
52
|
-
S,
|
|
53
|
-
O.isFetching,
|
|
54
|
-
k,
|
|
55
|
-
v,
|
|
56
|
-
y
|
|
57
|
-
]);
|
|
58
|
-
let I = d(() => {
|
|
59
|
-
C(!1);
|
|
60
|
-
}, []), L = d((e) => {
|
|
61
|
-
T((t) => ({
|
|
62
|
-
...t,
|
|
63
|
-
...e
|
|
64
|
-
}));
|
|
65
|
-
}, []), R = d(async () => {
|
|
66
|
-
if (!c || !_) return !1;
|
|
67
|
-
let t = u(w);
|
|
68
|
-
if (Object.keys(t).length > 0) return D(t), !1;
|
|
69
|
-
if (D(void 0), !y || O.isFetching || O.isError) return e.error(b), !1;
|
|
70
|
-
let n = N.current;
|
|
71
|
-
try {
|
|
72
|
-
let e = l(k, n ?? s(k)?.id);
|
|
73
|
-
e.kind === "update" ? (await j.mutateAsync({
|
|
74
|
-
path: {
|
|
75
|
-
counterpart_id: _,
|
|
76
|
-
bank_account_id: e.bankAccountId
|
|
77
|
-
},
|
|
78
|
-
body: o(w, { includeAchDefaults: e.includeAchDefaults }),
|
|
79
|
-
payableId: c,
|
|
80
|
-
makeDefault: e.includeAchDefaults || !k?.find((t) => t.id === e.bankAccountId)?.is_default_for_currency
|
|
81
|
-
}), n = e.bankAccountId) : n = (await A.mutateAsync({
|
|
82
|
-
path: { counterpart_id: _ },
|
|
83
|
-
body: a(w, { isDefaultForCurrency: e.isDefaultForCurrency })
|
|
84
|
-
}))?.id, N.current = n;
|
|
85
|
-
} catch {
|
|
86
|
-
return e.error(b), !1;
|
|
87
|
-
}
|
|
88
|
-
if (n !== v) try {
|
|
89
|
-
await M.mutateAsync({
|
|
90
|
-
path: { payable_id: c },
|
|
91
|
-
body: { counterpart_bank_account_id: n }
|
|
92
|
-
});
|
|
93
|
-
} catch {
|
|
94
|
-
return e.error(x), !1;
|
|
95
|
-
}
|
|
96
|
-
return C(!1), !0;
|
|
97
|
-
}, [
|
|
98
|
-
k,
|
|
99
|
-
O.isError,
|
|
100
|
-
O.isFetching,
|
|
101
|
-
y,
|
|
102
|
-
_,
|
|
103
|
-
A,
|
|
104
|
-
v,
|
|
105
|
-
x,
|
|
106
|
-
c,
|
|
107
|
-
b,
|
|
108
|
-
j,
|
|
109
|
-
M,
|
|
110
|
-
w
|
|
111
|
-
]);
|
|
112
|
-
return {
|
|
113
|
-
isOpen: S,
|
|
114
|
-
values: w,
|
|
115
|
-
errors: E,
|
|
116
|
-
isSaving: A.isPending || j.isPending || M.isPending,
|
|
117
|
-
open: F,
|
|
118
|
-
close: I,
|
|
119
|
-
onChange: L,
|
|
120
|
-
save: R
|
|
121
|
-
};
|
|
2
|
+
function e(e) {
|
|
3
|
+
return new Promise((t, n) => {
|
|
4
|
+
let r = new FileReader();
|
|
5
|
+
r.onerror = () => n(r.error ?? /* @__PURE__ */ Error("Failed to read file")), r.onload = () => {
|
|
6
|
+
let e = r.result;
|
|
7
|
+
if (typeof e != "string") {
|
|
8
|
+
n(/* @__PURE__ */ Error("Failed to read file as a data URL"));
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
t(e.slice(e.indexOf(",") + 1));
|
|
12
|
+
}, r.readAsDataURL(e);
|
|
13
|
+
});
|
|
122
14
|
}
|
|
123
15
|
//#endregion
|
|
124
|
-
export {
|
|
16
|
+
export { e as encodeFileToBase64 };
|
|
@@ -1,16 +1,51 @@
|
|
|
1
|
+
import { parseDecimalAmountToMinorUnits as e } from "../../../shared/util/dist/lib/parseDecimalAmountToMinorUnits.js";
|
|
2
|
+
import "../../data-access/dist/index.js";
|
|
1
3
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index54.js
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
4
|
+
var t = "USD";
|
|
5
|
+
function n(n) {
|
|
6
|
+
return e(n, t);
|
|
7
|
+
}
|
|
8
|
+
function r(e) {
|
|
9
|
+
let t = e.trim();
|
|
10
|
+
if (!t) return null;
|
|
11
|
+
let n = Number(t);
|
|
12
|
+
return Number.isFinite(n) && n > 0 ? n : null;
|
|
13
|
+
}
|
|
14
|
+
function i(e) {
|
|
15
|
+
return !!(e.description.trim() || e.glCode.trim() || n(e.price) !== null || n(e.amount) !== null);
|
|
16
|
+
}
|
|
17
|
+
function a(e) {
|
|
18
|
+
return n(e) ?? 0;
|
|
19
|
+
}
|
|
20
|
+
function o(e) {
|
|
21
|
+
let t = Number.parseFloat(e);
|
|
22
|
+
return Number.isFinite(t) ? t : 0;
|
|
23
|
+
}
|
|
24
|
+
function s(e) {
|
|
25
|
+
return (e / 100).toFixed(2);
|
|
26
|
+
}
|
|
27
|
+
function c({ values: e, counterpartId: r, clearCounterpart: i, counterpartBankAccountId: a, editedTotals: o, document: s }) {
|
|
28
|
+
let c = { currency: t };
|
|
29
|
+
return r ? c.counterpart_id = r : i && (c.counterpart_id = null), r ? c.counterpart_bank_account_id = a ?? null : i && (c.counterpart_bank_account_id = null), e.invoiceNumber && (c.document_id = e.invoiceNumber), e.invoiceDate && (c.issued_at = e.invoiceDate), e.dueDate && (c.due_date = e.dueDate), s && (c.base64_encoded_file = s.base64EncodedFile, c.file_name = s.fileName), o && (c.discount = n(o.discount) ?? 0, c.tax_amount = n(o.tax) ?? 0, o.total !== void 0 && (c.total_amount = n(o.total) ?? 0)), c;
|
|
30
|
+
}
|
|
31
|
+
function l(e) {
|
|
32
|
+
return e.filter(i).map((e) => {
|
|
33
|
+
let t = n(e.amount), i = r(e.quantity) ?? 1, a = n(e.price) ?? (t === null ? 0 : Math.round(t / i)), o = Math.round(i * a);
|
|
34
|
+
return {
|
|
35
|
+
name: e.description,
|
|
36
|
+
quantity: i,
|
|
37
|
+
unit_price: a,
|
|
38
|
+
tax: 0,
|
|
39
|
+
...t !== null && t !== o ? { subtotal: t } : {},
|
|
40
|
+
...e.glCode ? { ledger_account_id: e.glCode } : {}
|
|
41
|
+
};
|
|
13
42
|
});
|
|
14
43
|
}
|
|
44
|
+
function u(e, t) {
|
|
45
|
+
return s(Math.round(o(e) * a(t)));
|
|
46
|
+
}
|
|
47
|
+
function d(e, t, n) {
|
|
48
|
+
return s(e.reduce((e, t) => e + a(t.amount), 0) + a(t) - a(n));
|
|
49
|
+
}
|
|
15
50
|
//#endregion
|
|
16
|
-
export {
|
|
51
|
+
export { d as calculateTotal, u as displayLineAmount, i as isPersistableLineItem, c as mapBillFormToPayload, l as mapLineItemsToPayload, n as parseMoneyToMinorUnits, r as parseQuantity };
|
|
@@ -1,51 +1,35 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "
|
|
1
|
+
import { BILL_CREATE_MESSAGE_LABELS_EN as e } from "./index47.js";
|
|
2
|
+
import { isPersistableLineItem as t, parseMoneyToMinorUnits as n, parseQuantity as r } from "./index54.js";
|
|
3
3
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index55.js
|
|
4
|
-
var
|
|
5
|
-
function n(n) {
|
|
6
|
-
return e(n, t);
|
|
7
|
-
}
|
|
8
|
-
function r(e) {
|
|
9
|
-
let t = e.trim();
|
|
10
|
-
if (!t) return null;
|
|
11
|
-
let n = Number(t);
|
|
12
|
-
return Number.isFinite(n) && n > 0 ? n : null;
|
|
13
|
-
}
|
|
14
|
-
function i(e) {
|
|
15
|
-
return !!(e.description.trim() || e.glCode.trim() || n(e.price) !== null || n(e.amount) !== null);
|
|
16
|
-
}
|
|
4
|
+
var i = /^(?:\d{1,3}(?:,\d{3})+(?:\.\d+)?|\d+(?:\.\d+)?|\.\d+)$/;
|
|
17
5
|
function a(e) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
return
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
return s(Math.round(o(e) * a(t)));
|
|
46
|
-
}
|
|
47
|
-
function d(e, t, n) {
|
|
48
|
-
return s(e.reduce((e, t) => e + a(t.amount), 0) + a(t) - a(n));
|
|
6
|
+
let t = e.trim();
|
|
7
|
+
return !t || n(t) !== null ? !0 : i.test(t) ? Number(t.replaceAll(",", "")) === 0 : !1;
|
|
8
|
+
}
|
|
9
|
+
function o(t, i = e) {
|
|
10
|
+
let a = {};
|
|
11
|
+
for (let e of t) {
|
|
12
|
+
let t = n(e.price), o = n(e.amount), s = {};
|
|
13
|
+
e.price.trim() && t === null && (s.price = i.unreadableMoney), e.amount.trim() && o === null && (s.amount = i.unreadableMoney), r(e.quantity) === null && (e.quantity.trim() || t !== null || o !== null) && (s.quantity = i.unusableQuantity), Object.keys(s).length && (a[e.id] = s);
|
|
14
|
+
}
|
|
15
|
+
return Object.keys(a).length ? a : void 0;
|
|
16
|
+
}
|
|
17
|
+
function s(i, a, o, s = e) {
|
|
18
|
+
let c = {};
|
|
19
|
+
a || (c.vendor = s.requiredField), i.invoiceNumber.trim() || (c.invoiceNumber = s.requiredField), i.invoiceDate.trim() || (c.invoiceDate = s.requiredField), i.dueDate.trim() || (c.dueDate = s.requiredField);
|
|
20
|
+
let l = {};
|
|
21
|
+
return o.forEach((e, i) => {
|
|
22
|
+
if (i > 0 && !t(e)) return;
|
|
23
|
+
let a = {};
|
|
24
|
+
e.description.trim() || (a.description = s.requiredField), r(e.quantity) === null && (a.quantity = s.requiredField), n(e.price) === null && n(e.amount) === null && (a.price = s.requiredField, a.amount = s.requiredField), Object.keys(a).length && (l[e.id] = a);
|
|
25
|
+
}), {
|
|
26
|
+
formErrors: Object.keys(c).length ? c : void 0,
|
|
27
|
+
lineItemErrors: Object.keys(l).length ? l : void 0
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function c(t, r, i, o = e) {
|
|
31
|
+
let s = {};
|
|
32
|
+
return a(t) || (s.discount = o.unreadableDiscount), a(r) || (s.tax = o.unreadableTax), i !== void 0 && n(i) === null && (s.total = o.unreadableTotal), Object.keys(s).length ? s : void 0;
|
|
49
33
|
}
|
|
50
34
|
//#endregion
|
|
51
|
-
export {
|
|
35
|
+
export { a as isReadableMoneyOrZero, s as validateBillCompleteness, c as validateBillTotals, o as validateLineItems };
|