@tesouro/embedded-components-react 0.11.60 → 0.11.62
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 +21 -21
- package/dist/index.css +37 -160
- package/dist/index.d.ts +50 -17
- package/dist/lib/BankAccountsWidget.d.ts +20 -7
- package/dist/lib/LinkedAccountsWidget.d.ts +30 -10
- package/dist/lib/WidgetSuite.d.ts +50 -17
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/data-access/dist/index.js +5 -5
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/data-access/dist/index3.js +21 -26
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/data-access/dist/index4.js +18 -16
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/data-access/dist/index5.js +22 -35
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/data-access/dist/index6.js +29 -14
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/data-access/dist/index7.js +20 -24
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/data-access/dist/index8.js +31 -0
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/feature/dist/index.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/feature/dist/index10.js +296 -0
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/feature/dist/index12.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/feature/dist/index5.js +5 -10
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/feature/dist/index9.js +42 -281
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/ui/dist/index.js +5 -3
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/ui/dist/index10.js +180 -0
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/ui/dist/index2.js +16 -184
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/ui/dist/index3.js +9 -93
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/ui/dist/index4.js +136 -81
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/ui/dist/index5.js +64 -101
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/ui/dist/index6.js +54 -81
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/ui/dist/index7.js +90 -65
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/ui/dist/index8.js +108 -183
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/ui/dist/index9.js +76 -0
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/feature/dist/lib/BankAccountsWidget/BankAccountsWidget.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/feature/dist/lib/labels.js +6 -8
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/feature/dist/lib/useBankAccountsWidget.js +137 -120
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/feature/dist/mocks/labels.js +5 -5
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/ui/dist/lib/AccountCard.js +47 -60
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/ui/dist/lib/BankAccountsWidgetUi.js +71 -72
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/ui/dist/lib/BankingHeader.js +22 -37
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/ui/dist/lib/CreateAccountDialog.js +119 -133
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/ui/dist/lib/labels.js +12 -8
- package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/lib/LinkedAccountsWidget.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/lib/labels.js +9 -7
- package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/lib/rows.js +46 -27
- package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/lib/useAdminEligibleUserIds.js +3 -2
- package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/lib/useLinkedAccountsWidget.js +248 -224
- package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/mocks/labels.js +5 -5
- package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index10.js +22 -36
- package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index11.js +23 -70
- package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index12.js +91 -27
- package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index13.js +80 -63
- package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index14.js +145 -125
- package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index2.js +61 -9
- package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index3.js +77 -50
- package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index4.js +180 -65
- package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index5.js +22 -178
- package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index6.js +6 -75
- package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index7.js +48 -11
- package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index8.js +45 -7
- package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index9.js +8 -82
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/index.js +15 -14
- package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/AddTile/AddTile.js +17 -0
- package/dist/packages/shared-ui-shadcn/dist/index.js +3603 -3518
- package/package.json +1 -1
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/feature/dist/index11.js +0 -1
- package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index15.js +0 -67
- package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index16.js +0 -138
|
@@ -4,224 +4,241 @@
|
|
|
4
4
|
"use client";
|
|
5
5
|
import { toast as e } from "../../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
6
6
|
import { TESOURO_NEW_EXTERNAL_BANK_ACCOUNT_LINKED_SUCCESS_EVENT as t, emitWidgetDomEvent as n } from "../../../../shared/util/dist/lib/widgetDomEvents.js";
|
|
7
|
-
import { extractApiErrorMessage as
|
|
7
|
+
import { extractApiErrorMessage as r } from "../../../../shared/util/dist/lib/apiErrors.js";
|
|
8
8
|
import "../../../../shared/util/dist/index.js";
|
|
9
|
-
import { OrganizationStatus as
|
|
10
|
-
import { useEmbedApi as
|
|
11
|
-
import { Scope as
|
|
9
|
+
import { OrganizationStatus as ee, isOrganizationOnItsWay as te } from "../../../../shared/data-access/dist/lib/organizationStatus.js";
|
|
10
|
+
import { useEmbedApi as ne } from "../../../../shared/data-access/dist/lib/EmbedApiContext.js";
|
|
11
|
+
import { Scope as re } from "../../../../shared/data-access/dist/lib/scopes.js";
|
|
12
12
|
import { useOrganizationQuery as ie } from "../../../../shared/data-access/dist/lib/organization/useOrganizationQuery.js";
|
|
13
13
|
import { useAllOrganizationRolesQuery as ae } from "../../../../shared/data-access/dist/lib/role/useAllOrganizationRolesQuery.js";
|
|
14
14
|
import { useAllOrganizationUsersQuery as oe } from "../../../../shared/data-access/dist/lib/user/useAllOrganizationUsersQuery.js";
|
|
15
15
|
import "../../../../shared/data-access/dist/index.js";
|
|
16
16
|
import "../../../../shared/ui/dist/index.js";
|
|
17
17
|
import { useAnalyticsTrack as se } from "../../../../shared/feature/dist/lib/analytics/hooks.js";
|
|
18
|
-
import {
|
|
18
|
+
import { useRefetchWidget as ce, useWidgetConfig as le, useWidgetError as ue, useWidgetLoading as de } from "../../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
|
|
19
19
|
import "../../../../shared/feature/dist/index.js";
|
|
20
|
-
import { filterRolesForOrganization as
|
|
21
|
-
import { filterUsersForOrganization as
|
|
22
|
-
import { DEFAULT_FEATURE_LABELS as
|
|
20
|
+
import { filterRolesForOrganization as fe } from "../../../../../shared/util-validation/dist/index6.js";
|
|
21
|
+
import { filterUsersForOrganization as pe } from "../../../../../shared/util-validation/dist/index7.js";
|
|
22
|
+
import { DEFAULT_FEATURE_LABELS as me } from "./labels.js";
|
|
23
23
|
import { LinkedAccountsWidgetAnalyticsEvent as i } from "./analytics/events.js";
|
|
24
|
-
import { EMPTY_CONNECT_FORM as
|
|
25
|
-
import { getLinkedAccountsPermissions as
|
|
26
|
-
import { toAccountRows as
|
|
27
|
-
import { fromApiAccountHolderType as
|
|
28
|
-
import { useConnectExternalBankAccountMutation as
|
|
29
|
-
import { useExternalBankAccountsQuery as
|
|
30
|
-
import { useGrantExternalBankAccountAccessMutation as
|
|
31
|
-
import { useLinkExternalBankAccountMutation as
|
|
32
|
-
import { useUnlinkExternalBankAccountMutation as
|
|
33
|
-
import { useUpdateExternalBankAccountMutation as
|
|
34
|
-
import { useValidateExternalBankAccountMutation as
|
|
24
|
+
import { EMPTY_CONNECT_FORM as he, EMPTY_EDIT_FORM as ge, EMPTY_VERIFY_FORM as _e, isConnectStep1Valid as ve, isRoutingNumberValid as ye, isVerifyAmountInRange as be, isVerifyFormValid as xe, parseVerifyAmountToMinorUnits as Se, sanitizeRoutingNumberInput as Ce, toEditForm as we, toUpdateBody as Te } from "./forms.js";
|
|
25
|
+
import { getLinkedAccountsPermissions as Ee } from "./permissions.js";
|
|
26
|
+
import { toAccountRows as De } from "./rows.js";
|
|
27
|
+
import { fromApiAccountHolderType as Oe, toApiAccountHolderType as ke, toSummaryTypeLabel as Ae, toTextParts as a } from "./summary.js";
|
|
28
|
+
import { useConnectExternalBankAccountMutation as je } from "../../../data-access/dist/index3.js";
|
|
29
|
+
import { useExternalBankAccountsQuery as Me } from "../../../data-access/dist/index4.js";
|
|
30
|
+
import { useGrantExternalBankAccountAccessMutation as Ne } from "../../../data-access/dist/index5.js";
|
|
31
|
+
import { useLinkExternalBankAccountMutation as Pe } from "../../../data-access/dist/index6.js";
|
|
32
|
+
import { useUnlinkExternalBankAccountMutation as Fe } from "../../../data-access/dist/index9.js";
|
|
33
|
+
import { useUpdateExternalBankAccountMutation as Ie } from "../../../data-access/dist/index10.js";
|
|
34
|
+
import { useValidateExternalBankAccountMutation as Le } from "../../../data-access/dist/index11.js";
|
|
35
35
|
import "../../../data-access/dist/index.js";
|
|
36
|
-
import { useAdminEligibleUserIds as
|
|
37
|
-
import { toAccessRows as
|
|
38
|
-
import { DEFAULT_LABELS as
|
|
36
|
+
import { useAdminEligibleUserIds as Re } from "./useAdminEligibleUserIds.js";
|
|
37
|
+
import { toAccessRows as ze, toOrganizationRoleOptions as Be, toTeamMembers as Ve } from "./teamMembers.js";
|
|
38
|
+
import { DEFAULT_LABELS as He } from "../../../ui/dist/index13.js";
|
|
39
39
|
import "../../../ui/dist/index.js";
|
|
40
|
-
import { useCallback as
|
|
41
|
-
import { useControllableState as
|
|
40
|
+
import { useCallback as Ue, useEffect as o, useMemo as s, useState as c } from "react";
|
|
41
|
+
import { useControllableState as We } from "@radix-ui/react-use-controllable-state";
|
|
42
42
|
// ../../libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/lib/useLinkedAccountsWidget.js
|
|
43
|
-
function
|
|
43
|
+
function Ge(e) {
|
|
44
44
|
let t = e;
|
|
45
45
|
return typeof e == "object" && !!e && "verificationStatus" in e && t.verificationStatus === "VERIFIED";
|
|
46
46
|
}
|
|
47
47
|
var l = "tesouro.linkedAccounts.locallySentMicroDepositAccountIds.v1";
|
|
48
|
-
function
|
|
48
|
+
function Ke() {
|
|
49
49
|
if (typeof window > "u") return /* @__PURE__ */ new Set();
|
|
50
50
|
try {
|
|
51
51
|
let e = window.sessionStorage.getItem(l), t = e ? JSON.parse(e) : [];
|
|
52
|
-
return new Set(Array.isArray(t) ? t.filter(
|
|
52
|
+
return new Set(Array.isArray(t) ? t.filter(qe) : []);
|
|
53
53
|
} catch {
|
|
54
54
|
return /* @__PURE__ */ new Set();
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
|
-
function
|
|
57
|
+
function qe(e) {
|
|
58
58
|
return typeof e == "string";
|
|
59
59
|
}
|
|
60
|
-
function
|
|
60
|
+
function Je(e) {
|
|
61
61
|
if (typeof window < "u") try {
|
|
62
62
|
window.sessionStorage.setItem(l, JSON.stringify([...e]));
|
|
63
63
|
} catch {}
|
|
64
64
|
}
|
|
65
|
-
function
|
|
65
|
+
function Ye(e, t) {
|
|
66
66
|
let n = new Set(e).add(t);
|
|
67
|
-
return
|
|
67
|
+
return Je(n), n;
|
|
68
68
|
}
|
|
69
|
-
var
|
|
70
|
-
function
|
|
71
|
-
let
|
|
72
|
-
...
|
|
73
|
-
...
|
|
74
|
-
},
|
|
75
|
-
...
|
|
69
|
+
var Xe = re.ExternalBankAccountWriteOrg;
|
|
70
|
+
function u({ labels: re, featureLabels: l, isLinkAccountOpen: qe, onLinkAccountOpenChange: Je }) {
|
|
71
|
+
let u = {
|
|
72
|
+
...He,
|
|
73
|
+
...re
|
|
74
|
+
}, d = {
|
|
75
|
+
...me,
|
|
76
76
|
...l
|
|
77
|
-
},
|
|
78
|
-
prop:
|
|
77
|
+
}, f = se(), { organizationId: p, widgetToken: Ze, initResponse: m } = le(), Qe = de(), { organizationStatus: $e } = ne(), h = te($e), g = !!ue(), et = ce(), _ = !!(p && Ze), tt = _ || !!Ze && $e === ee.Rotating, v = s(() => Ee(m?.scopes), [m?.scopes]), y = tt && v.canRead && !!m, [b, nt] = c(), [rt, it] = We({
|
|
78
|
+
prop: qe,
|
|
79
79
|
defaultProp: !1,
|
|
80
|
-
onChange:
|
|
80
|
+
onChange: Je,
|
|
81
81
|
caller: "LinkedAccountsWidget"
|
|
82
|
-
}),
|
|
82
|
+
}), at = _ && v.canWrite, x = rt && at, [S, C] = c(1), [w, ot] = c([]), [T, st] = c(), [ct, E] = c(), [D, lt] = c(Ke), [ut, O] = c(!1), [dt, k] = c(!1), [ft, pt] = c(!1), [mt, A] = c(!1), [ht, gt] = c(!1), [j, M] = c(), [N, P] = c(), [F, _t] = c(he), [vt, yt] = c(!1), [bt, xt] = c(ge), [I, St] = c(_e);
|
|
83
83
|
o(() => {
|
|
84
|
-
|
|
85
|
-
}, [
|
|
86
|
-
let
|
|
84
|
+
f(i.Mounted);
|
|
85
|
+
}, [f]);
|
|
86
|
+
let L = Me({
|
|
87
87
|
limit: 100,
|
|
88
|
-
enabled:
|
|
89
|
-
}), z =
|
|
90
|
-
...
|
|
91
|
-
nameOnAccount:
|
|
88
|
+
enabled: y
|
|
89
|
+
}), R = je(), z = Ne(), B = Ie(), V = Fe(), H = Pe(), U = Le(), W = x && S >= 2, G = oe({ enabled: W }), K = ae({ enabled: W }), Ct = ie({ enabled: x && v.canReadOrganization }).data?.legalName ?? "", q = s(() => vt ? F : {
|
|
90
|
+
...F,
|
|
91
|
+
nameOnAccount: Ct
|
|
92
92
|
}, [
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
]), { userIds:
|
|
97
|
-
enabled:
|
|
98
|
-
permissionKey:
|
|
99
|
-
organizationId:
|
|
100
|
-
}),
|
|
101
|
-
let e =
|
|
102
|
-
organizationId:
|
|
103
|
-
organizationTypes:
|
|
104
|
-
}) : e, n =
|
|
105
|
-
return
|
|
93
|
+
vt,
|
|
94
|
+
F,
|
|
95
|
+
Ct
|
|
96
|
+
]), { userIds: wt, isResolving: Tt, isError: Et, refetch: Dt } = Re({
|
|
97
|
+
enabled: W,
|
|
98
|
+
permissionKey: Xe,
|
|
99
|
+
organizationId: p
|
|
100
|
+
}), J = s(() => {
|
|
101
|
+
let e = K.data?.data ?? [], t = p ? fe(e, {
|
|
102
|
+
organizationId: p,
|
|
103
|
+
organizationTypes: m?.organizationTypes ?? []
|
|
104
|
+
}) : e, n = pe(G.data?.data ?? [], p);
|
|
105
|
+
return Ve(n, Be(t), wt);
|
|
106
106
|
}, [
|
|
107
|
-
|
|
108
|
-
q.data?.data,
|
|
107
|
+
wt,
|
|
109
108
|
K.data?.data,
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
109
|
+
G.data?.data,
|
|
110
|
+
p,
|
|
111
|
+
m?.organizationTypes
|
|
112
|
+
]), Ot = G.isError && G.isFetching, Y = G.isLoading || G.isFetchingNextPage || !!G.hasNextPage || Ot || K.isResolving || Tt, kt = G.isError && !Ot || Et, At = !Y && !kt, jt = () => {
|
|
113
|
+
G.isError && G.refetch(), Et && Dt(), K.isError && K.refetch();
|
|
114
|
+
}, X = y ? L.data?.data ?? [] : [], Z = s(() => X.map((e) => e.verificationStatus === "UNVERIFIED" && D.has(e.id) ? {
|
|
113
115
|
...e,
|
|
114
116
|
verificationStatus: "VERIFICATION_SENT"
|
|
115
|
-
} : e), [X,
|
|
116
|
-
|
|
117
|
+
} : e), [X, D]), Mt = [.../* @__PURE__ */ new Set([...J.filter((e) => e.locked).map((e) => e.id), ...w])], Nt = Ue((e) => {
|
|
118
|
+
R.reset(), z.reset(), H.reset(), e.nameOnAccount !== q.nameOnAccount && yt(!0), _t({
|
|
117
119
|
...e,
|
|
118
|
-
routingNumber:
|
|
120
|
+
routingNumber: Ce(e.routingNumber)
|
|
119
121
|
});
|
|
120
122
|
}, [
|
|
121
|
-
|
|
123
|
+
q.nameOnAccount,
|
|
124
|
+
R,
|
|
122
125
|
z,
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
B.mutate({
|
|
126
|
+
H
|
|
127
|
+
]), Pt = () => {
|
|
128
|
+
C(3), n(t);
|
|
129
|
+
}, Ft = (e) => {
|
|
130
|
+
v.canMicroDeposit ? (E("connect"), H.mutate({ path: { id: e } }, { onSuccess: () => {
|
|
131
|
+
E(void 0), lt((t) => Ye(t, e)), f(i.AccountLinked, { accountId: e }), Pt();
|
|
132
|
+
} })) : Pt();
|
|
133
|
+
}, It = (e) => {
|
|
134
|
+
z.mutate({
|
|
133
135
|
path: { id: e },
|
|
134
|
-
body: { userIds:
|
|
135
|
-
}, { onSuccess: () =>
|
|
136
|
-
},
|
|
137
|
-
if (
|
|
138
|
-
if (
|
|
139
|
-
if (!
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
136
|
+
body: { userIds: Mt }
|
|
137
|
+
}, { onSuccess: () => Ft(e) });
|
|
138
|
+
}, Lt = () => {
|
|
139
|
+
if (_ && v.canWrite) {
|
|
140
|
+
if (S === 1) {
|
|
141
|
+
if (!ve(q)) {
|
|
142
|
+
gt(!0);
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
C(2);
|
|
146
|
+
} else S === 2 && (At ? T ? It(T.id) : R.mutate({ body: {
|
|
147
|
+
nickname: q.nickname.trim(),
|
|
148
|
+
accountNumber: q.accountNumber.trim(),
|
|
149
|
+
routingNumber: q.routingNumber.trim(),
|
|
150
|
+
nameOnAccount: q.nameOnAccount.trim(),
|
|
151
|
+
type: q.type,
|
|
152
|
+
accountHolderType: ke(q.accountHolderType)
|
|
148
153
|
} }, { onSuccess: (e) => {
|
|
149
|
-
|
|
150
|
-
} }));
|
|
154
|
+
f(i.AccountConnected, { accountId: e?.id }), st(e), e?.id && It(e.id);
|
|
155
|
+
} }) : Y || jt());
|
|
151
156
|
}
|
|
152
|
-
},
|
|
153
|
-
|
|
154
|
-
},
|
|
155
|
-
|
|
156
|
-
}, [
|
|
157
|
-
|
|
158
|
-
let { reset:
|
|
157
|
+
}, Rt = () => {
|
|
158
|
+
S === 2 && C(1);
|
|
159
|
+
}, zt = (e, t) => {
|
|
160
|
+
J.find((t) => t.id === e)?.locked || ot((n) => t ? [.../* @__PURE__ */ new Set([...n, e])] : n.filter((t) => t !== e));
|
|
161
|
+
}, [Bt, Vt] = c(x);
|
|
162
|
+
x !== Bt && (Vt(x), x && (C(1), gt(!1), _t(he), yt(!1), ot([]), st(void 0), E(void 0)));
|
|
163
|
+
let { reset: Ht } = R, { reset: Ut } = z, { reset: Wt } = H;
|
|
159
164
|
o(() => {
|
|
160
|
-
|
|
165
|
+
x && (Ht(), Ut(), Wt());
|
|
161
166
|
}, [
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
167
|
+
x,
|
|
168
|
+
Ht,
|
|
169
|
+
Ut,
|
|
170
|
+
Wt
|
|
166
171
|
]);
|
|
167
|
-
let
|
|
168
|
-
(!e ||
|
|
169
|
-
},
|
|
170
|
-
if (!
|
|
172
|
+
let Gt = (e) => {
|
|
173
|
+
(!e || at) && it(e);
|
|
174
|
+
}, Kt = (e) => {
|
|
175
|
+
if (!_ || !v.canWrite) return;
|
|
171
176
|
let t = X.find((t) => t.id === e);
|
|
172
|
-
|
|
173
|
-
},
|
|
174
|
-
e && !
|
|
175
|
-
},
|
|
176
|
-
if (!
|
|
177
|
-
let t = X.find((e) => e.id ===
|
|
178
|
-
Object.keys(n).length !== 0 &&
|
|
179
|
-
path: { id:
|
|
177
|
+
nt(e), xt(we(t)), O(!0);
|
|
178
|
+
}, qt = (e) => {
|
|
179
|
+
e && !_ || e && !v.canWrite || O(e);
|
|
180
|
+
}, Jt = () => {
|
|
181
|
+
if (!_ || !v.canWrite || !b) return;
|
|
182
|
+
let t = X.find((e) => e.id === b), n = Te(bt, t);
|
|
183
|
+
Object.keys(n).length !== 0 && B.mutate({
|
|
184
|
+
path: { id: b },
|
|
180
185
|
body: n
|
|
181
186
|
}, { onSuccess: () => {
|
|
182
|
-
|
|
187
|
+
f(i.AccountUpdated, { accountId: b }), e.success(d.editSuccessToast), O(!1);
|
|
183
188
|
} });
|
|
184
|
-
},
|
|
185
|
-
|
|
186
|
-
},
|
|
187
|
-
e && !
|
|
188
|
-
},
|
|
189
|
-
|
|
190
|
-
},
|
|
191
|
-
if (!
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
189
|
+
}, Yt = (e) => {
|
|
190
|
+
_ && v.canWrite && (nt(e), St(_e), A(!1), pt(!1), U.reset(), k(!0));
|
|
191
|
+
}, Xt = (e) => {
|
|
192
|
+
e && !_ || e && !v.canWrite || k(e);
|
|
193
|
+
}, Zt = (e) => {
|
|
194
|
+
U.reset(), A(!1), St(e);
|
|
195
|
+
}, Qt = () => {
|
|
196
|
+
if (!_ || !v.canWrite || !b) return;
|
|
197
|
+
if (!xe(I)) {
|
|
198
|
+
pt(!0);
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
let t = Se(I.firstAmount), r = Se(I.secondAmount);
|
|
202
|
+
t !== null && r !== null && (A(!1), U.mutate({
|
|
203
|
+
path: { id: b },
|
|
195
204
|
body: {
|
|
196
|
-
firstAmount:
|
|
197
|
-
secondAmount:
|
|
205
|
+
firstAmount: t,
|
|
206
|
+
secondAmount: r
|
|
198
207
|
}
|
|
199
|
-
}, { onSuccess: (
|
|
200
|
-
|
|
208
|
+
}, { onSuccess: (t) => {
|
|
209
|
+
Ge(t) ? (f(i.AccountVerified, { accountId: b }), n("tesouro-new-external-bank-account-linked-success"), e.success(d.verifySuccessToast), k(!1)) : A(!0);
|
|
201
210
|
} }));
|
|
202
|
-
},
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
},
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
211
|
+
}, $t = (e) => {
|
|
212
|
+
_ && v.canMicroDeposit && (H.reset(), P(e));
|
|
213
|
+
}, en = (e) => {
|
|
214
|
+
e || P(void 0);
|
|
215
|
+
}, tn = () => {
|
|
216
|
+
if (!_ || !v.canMicroDeposit || !N) return;
|
|
217
|
+
let t = N;
|
|
218
|
+
E("row"), H.mutate({ path: { id: t } }, { onSuccess: () => {
|
|
219
|
+
E(void 0), lt((e) => Ye(e, t)), f(i.AccountLinked, { accountId: t }), e.success(d.sendDepositsSuccessToast), P(void 0);
|
|
220
|
+
} });
|
|
221
|
+
}, nn = (e) => {
|
|
222
|
+
_ && v.canWrite && (V.reset(), M(e));
|
|
223
|
+
}, rn = (e) => {
|
|
224
|
+
e || M(void 0);
|
|
225
|
+
}, an = () => {
|
|
226
|
+
if (!_ || !v.canWrite || !j) return;
|
|
227
|
+
let t = j;
|
|
228
|
+
V.mutate({ path: { id: t } }, { onSuccess: () => {
|
|
229
|
+
f(i.AccountUnlinked, { accountId: t }), e.success(d.unlinkSuccessToast), M(void 0);
|
|
215
230
|
} });
|
|
216
|
-
},
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
231
|
+
}, on = R.isPending || z.isPending || B.isPending || U.isPending || V.isPending || H.isPending, sn = v.canWrite, cn = !_ || on, ln = !_ && h, Q = !_ && !h, [un, dn] = c(Q);
|
|
232
|
+
Q !== un && (dn(Q), Q && (O(!1), k(!1), M(void 0), P(void 0)));
|
|
233
|
+
let $ = H.isError && ct === "connect", fn = ze(J, {
|
|
234
|
+
selectedUserIds: w,
|
|
235
|
+
disabled: cn || !sn,
|
|
236
|
+
fallbackTooltip: u.teamMemberAccessTooltip,
|
|
237
|
+
onUserToggle: zt
|
|
238
|
+
}), pn = J.filter((e) => e.locked).length + w.length, mn = T ? ((e) => {
|
|
222
239
|
let t = e.accountNumber.slice(-4), n = {
|
|
223
240
|
type: {
|
|
224
|
-
text:
|
|
241
|
+
text: Ae(e.accountHolderType ? Oe(e.accountHolderType) : q.accountHolderType, e.type ?? q.type, d),
|
|
225
242
|
emphasized: !1
|
|
226
243
|
},
|
|
227
244
|
last4: {
|
|
@@ -229,88 +246,95 @@ function p({ labels: r, featureLabels: l, isLinkAccountOpen: u, onLinkAccountOpe
|
|
|
229
246
|
emphasized: !0
|
|
230
247
|
}
|
|
231
248
|
};
|
|
232
|
-
return
|
|
249
|
+
return D.has(e.id) ? {
|
|
233
250
|
variant: "deposits-sent",
|
|
234
|
-
description: a(
|
|
251
|
+
description: a(d.summaryDescription, n),
|
|
235
252
|
nextSteps: [{
|
|
236
253
|
key: "check-bank",
|
|
237
|
-
title:
|
|
238
|
-
description: a(
|
|
254
|
+
title: d.summaryCheckBankTitle.replaceAll("{last4}", t),
|
|
255
|
+
description: a(d.summaryCheckBankDescription, n)
|
|
239
256
|
}, {
|
|
240
257
|
key: "verify",
|
|
241
|
-
title:
|
|
242
|
-
description: a(
|
|
258
|
+
title: d.summaryVerifyTitle,
|
|
259
|
+
description: a(d.summaryVerifyDescription, n)
|
|
243
260
|
}]
|
|
244
261
|
} : {
|
|
245
262
|
variant: "account-added",
|
|
246
|
-
description: a(
|
|
263
|
+
description: a(d.summaryAccountAddedDescription, n),
|
|
247
264
|
nextSteps: []
|
|
248
265
|
};
|
|
249
|
-
})(
|
|
250
|
-
labels:
|
|
251
|
-
onEditSelect:
|
|
252
|
-
onVerifySelect:
|
|
253
|
-
|
|
254
|
-
onUnlinkSelect:
|
|
255
|
-
}),
|
|
256
|
-
if (!
|
|
257
|
-
let e =
|
|
258
|
-
return
|
|
266
|
+
})(T) : void 0, hn = De(Z, d, v, {
|
|
267
|
+
labels: u,
|
|
268
|
+
onEditSelect: Kt,
|
|
269
|
+
onVerifySelect: Yt,
|
|
270
|
+
onSendDepositsSelect: $t,
|
|
271
|
+
onUnlinkSelect: nn
|
|
272
|
+
}), gn = s(() => {
|
|
273
|
+
if (!R.isError && !z.isError && !$) return;
|
|
274
|
+
let e = R.error ?? z.error ?? ($ ? H.error : void 0);
|
|
275
|
+
return r(e) ?? u.connectErrorTitle;
|
|
259
276
|
}, [
|
|
277
|
+
R.error,
|
|
278
|
+
R.isError,
|
|
260
279
|
z.error,
|
|
261
280
|
z.isError,
|
|
262
|
-
B.error,
|
|
263
|
-
B.isError,
|
|
264
281
|
$,
|
|
265
|
-
|
|
266
|
-
|
|
282
|
+
H.error,
|
|
283
|
+
u.connectErrorTitle
|
|
267
284
|
]);
|
|
268
285
|
return {
|
|
269
|
-
rows:
|
|
270
|
-
isLoading: !
|
|
271
|
-
isError:
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
verifyAccountName: Z.find((e) => e.id ===
|
|
277
|
-
verifyAccountNumber: Z.find((e) => e.id ===
|
|
278
|
-
isUnlinkOpen: !!
|
|
279
|
-
unlinkAccountNumber: Z.find((e) => e.id ===
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
286
|
+
rows: hn,
|
|
287
|
+
isLoading: !g && (h && !L.data || Qe && !m || y && L.isLoading),
|
|
288
|
+
isError: g || y && L.isError,
|
|
289
|
+
onRetry: g ? et : () => void L.refetch(),
|
|
290
|
+
isConnectOpen: x,
|
|
291
|
+
isEditOpen: ut,
|
|
292
|
+
isVerifyOpen: dt,
|
|
293
|
+
verifyAccountName: Z.find((e) => e.id === b)?.nickname,
|
|
294
|
+
verifyAccountNumber: Z.find((e) => e.id === b)?.accountNumber,
|
|
295
|
+
isUnlinkOpen: !!j,
|
|
296
|
+
unlinkAccountNumber: Z.find((e) => e.id === j)?.accountNumber,
|
|
297
|
+
isSendDepositsOpen: !!N,
|
|
298
|
+
sendDepositsAccountNumber: Z.find((e) => e.id === N)?.accountNumber,
|
|
299
|
+
connectStep: S,
|
|
300
|
+
accessRows: fn,
|
|
301
|
+
accessGrantedCount: pn,
|
|
302
|
+
connectSummary: mn,
|
|
303
|
+
isTeamMembersLoading: Y,
|
|
304
|
+
isTeamMembersError: kt,
|
|
305
|
+
onTeamMembersRetry: jt,
|
|
306
|
+
isConnectRequiredErrorVisible: ht,
|
|
307
|
+
isConnectRoutingNumberInvalid: q.routingNumber.trim() !== "" && !ye(q.routingNumber),
|
|
308
|
+
connectErrorMessage: gn,
|
|
309
|
+
isVerifyFirstAmountInvalid: I.firstAmount.trim() !== "" && !be(I.firstAmount),
|
|
310
|
+
isVerifySecondAmountInvalid: I.secondAmount.trim() !== "" && !be(I.secondAmount),
|
|
311
|
+
isVerifyRequiredErrorVisible: ft,
|
|
312
|
+
isActionDisabled: cn,
|
|
313
|
+
isAuthPending: ln,
|
|
314
|
+
canConnect: sn,
|
|
315
|
+
isSubmitting: on,
|
|
316
|
+
isConnectError: R.isError || z.isError || $,
|
|
317
|
+
isEditError: B.isError,
|
|
318
|
+
isUnlinkError: V.isError,
|
|
319
|
+
isSendDepositsError: H.isError && ct === "row",
|
|
320
|
+
isVerifyError: U.isError || mt,
|
|
321
|
+
connectForm: q,
|
|
322
|
+
editForm: bt,
|
|
323
|
+
verifyForm: I,
|
|
324
|
+
onConnectOpenChange: Gt,
|
|
325
|
+
onEditOpenChange: qt,
|
|
326
|
+
onVerifyOpenChange: Xt,
|
|
327
|
+
onUnlinkOpenChange: rn,
|
|
328
|
+
onSendDepositsOpenChange: en,
|
|
329
|
+
onConnectFormChange: Nt,
|
|
330
|
+
onEditFormChange: xt,
|
|
331
|
+
onVerifyFormChange: Zt,
|
|
332
|
+
onConnectNext: Lt,
|
|
333
|
+
onConnectBack: Rt,
|
|
334
|
+
onEditSubmit: Jt,
|
|
335
|
+
onVerifySubmit: Qt,
|
|
336
|
+
onUnlinkConfirm: an,
|
|
337
|
+
onSendDepositsConfirm: tn
|
|
314
338
|
};
|
|
315
339
|
}
|
|
316
|
-
export { l as LOCALLY_SENT_MICRO_DEPOSIT_ACCOUNT_IDS_STORAGE_KEY,
|
|
340
|
+
export { l as LOCALLY_SENT_MICRO_DEPOSIT_ACCOUNT_IDS_STORAGE_KEY, u as useLinkedAccountsWidget };
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
// ../../libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/mocks/labels.js
|
|
2
2
|
var e = {
|
|
3
3
|
blurbs: {
|
|
4
|
-
populated: "Five external accounts: verified, unverified, deposits sent, failed, and inactive.
|
|
5
|
-
empty: "The organization has linked no external accounts.
|
|
4
|
+
populated: "Five external accounts: verified, unverified, deposits sent, failed, and inactive. Verify on the unverified account sends micro-deposits; Verify on the one with deposits sent takes any two amounts from $0.01 to $0.99. The failed account asks you to check its numbers. The ⋯ menu has Edit and Unlink. Link account runs the whole flow; use routing number 123456780.",
|
|
5
|
+
empty: "The organization has linked no external accounts. The empty state offers Link account.",
|
|
6
6
|
loading: "The accounts read is held open, so the list skeleton stays on screen.",
|
|
7
|
-
error: "The accounts read fails with a 500. The widget says
|
|
8
|
-
"control-hidden": "The same accounts, read by a session without external_bank_account:write:org. There is no
|
|
7
|
+
error: "The accounts read fails with a 500. The widget says it couldn't load linked accounts and offers Try again.",
|
|
8
|
+
"control-hidden": "The same accounts, read by a session without external_bank_account:write:org. There is no Link account or ⋯ menu, and only the unverified account offers Verify, to send deposits, because that has its own scope."
|
|
9
9
|
},
|
|
10
10
|
scenarios: { "no-micro-deposits": {
|
|
11
11
|
label: "No micro-deposit scope",
|
|
12
|
-
blurb: "The session can write but lacks external_bank_account:micro_deposit:org.
|
|
12
|
+
blurb: "The session can write but lacks external_bank_account:micro_deposit:org. The unverified account offers no Verify, since that would send deposits, while the one with deposits sent still does. Link account finishes without sending deposits, so the new account stays unverified."
|
|
13
13
|
} }
|
|
14
14
|
};
|
|
15
15
|
export { e as LINKED_ACCOUNTS_LABELS };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { DEFAULT_LABELS as e } from "./
|
|
2
|
-
import { LinkedAccountsWidgetUi as t } from "./
|
|
1
|
+
import { DEFAULT_LABELS as e } from "./index13.js";
|
|
2
|
+
import { LinkedAccountsWidgetUi as t } from "./index14.js";
|
|
3
3
|
export { e as DEFAULT_LABELS, t as LinkedAccountsWidgetUi };
|