@tesouro/embedded-components-react 0.3.49 → 0.3.51
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 +8 -2
- package/dist/index.js +2 -2
- package/dist/lib/BillPayWidget.js +1 -1
- package/dist/lib/LinkedAccountsWidget.js +1 -1
- package/dist/libs/shared/util-validation/dist/{index22.js → index23.js} +1 -1
- package/dist/libs/shared/util-validation/dist/index7.js +6 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index.js +11 -10
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index10.js +39 -30
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index11.js +26 -311
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index12.js +325 -12
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index13.js +13 -26
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index14.js +20 -40
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index15.js +75 -24
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index16.js +36 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index5.js +80 -68
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index6.js +86 -73
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index7.js +77 -14
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index8.js +18 -63
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index9.js +50 -29
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js +22 -18
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index10.js +82 -30
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index11.js +7 -42
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index12.js +15 -159
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index13.js +23 -33
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index14.js +66 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index15.js +2 -50
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index16.js +3 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index17.js +5 -14
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index18.js +3 -14
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index19.js +31 -63
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index2.js +23 -18
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index20.js +37 -24
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index21.js +161 -61
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index22.js +29 -130
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index23.js +1 -25
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index24.js +47 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index25.js +4 -41
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index26.js +12 -55
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index27.js +13 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index28.js +63 -72
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index29.js +26 -49
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index3.js +23 -23
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index30.js +62 -93
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index31.js +133 -34
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index32.js +20 -163
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index33.js +4 -77
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index34.js +39 -21
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index35.js +5 -210
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index36.js +70 -211
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index37.js +47 -103
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index38.js +92 -12
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index39.js +34 -47
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index4.js +59 -62
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index40.js +163 -29
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index41.js +67 -181
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index42.js +20 -32
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index43.js +203 -94
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index44.js +214 -15
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index45.js +98 -312
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index46.js +16 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index47.js +49 -31
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index48.js +29 -80
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index49.js +183 -156
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index5.js +9 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index50.js +38 -3
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index51.js +102 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index52.js +18 -44
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index53.js +343 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index54.js +4 -8
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index55.js +30 -8
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index56.js +79 -88
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index57.js +179 -3
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index58.js +3 -9
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index59.js +2 -20
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index6.js +4 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index60.js +38 -51
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index61.js +0 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index62.js +6 -126
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index63.js +9 -9
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index64.js +92 -44
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index65.js +3 -23
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index66.js +123 -26
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index67.js +7 -82
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index68.js +8 -48
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index69.js +45 -250
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index7.js +69 -5
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index70.js +21 -113
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index71.js +27 -208
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index72.js +86 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index73.js +47 -5
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index74.js +244 -106
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index75.js +115 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index76.js +201 -16
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index77.js +4 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index78.js +8 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index79.js +115 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index8.js +44 -5
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index80.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index81.js +25 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index9.js +94 -3
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index.js +19 -19
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index18.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index50.js +28 -28
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index59.js +1 -3
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index60.js +6 -16
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index73.js +119 -16
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index74.js +24 -111
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index75.js +89 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index76.js +2 -7
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index77.js +5 -28
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index78.js +30 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index79.js +2 -7
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index80.js +5 -32
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index81.js +34 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index82.js +2 -12
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index83.js +10 -104
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index84.js +105 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index85.js +2 -17
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index86.js +15 -123
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index87.js +125 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index88.js +2 -18
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index89.js +14 -6
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index90.js +7 -167
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index91.js +170 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index92.js +2 -14
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index93.js +11 -105
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index94.js +108 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index95.js +2 -10
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index96.js +8 -45
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index97.js +47 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index98.js +2 -0
- package/dist/libs/tesouro-embedded-components-react/create-card-widget/feature/dist/index8.js +95 -94
- package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/index.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/index10.js +45 -0
- package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/index7.js +18 -55
- package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/index8.js +46 -265
- package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/index9.js +273 -34
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/feature/dist/lib/useApproverOptions.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +23 -23
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +87 -71
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/team-widget/feature/dist/index11.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/linked-accounts-widget/feature/dist/index8.js
CHANGED
|
@@ -1,274 +1,55 @@
|
|
|
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 { useAllOrganizationRolesQuery as t } from "../../../shared/data-access/dist/lib/role/useAllOrganizationRolesQuery.js";
|
|
7
|
-
import { useAllOrganizationUsersQuery as n } from "../../../shared/data-access/dist/lib/user/useAllOrganizationUsersQuery.js";
|
|
8
|
-
import "../../../shared/ui/dist/index.js";
|
|
9
|
-
import { useAnalyticsTrack as ee } from "../../../shared/feature/dist/lib/analytics/hooks.js";
|
|
10
|
-
import { getInitials as te } from "../../../shared/util/dist/lib/getInitials.js";
|
|
11
|
-
import { TESOURO_NEW_EXTERNAL_BANK_ACCOUNT_LINKED_SUCCESS_EVENT as ne, emitWidgetDomEvent as r } from "../../../shared/util/dist/lib/widgetDomEvents.js";
|
|
12
|
-
import { extractApiErrorMessage as re } from "../../../shared/util/dist/lib/apiErrors.js";
|
|
13
|
-
import { useWidgetConfig as ie, useWidgetError as ae, useWidgetLoading as oe } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
|
|
14
|
-
import "../../../shared/feature/dist/index.js";
|
|
15
|
-
import { filterRolesForOrganization as se } from "../../../../shared/util-validation/dist/index6.js";
|
|
16
|
-
import { DEFAULT_FEATURE_LABELS as ce } from "./index4.js";
|
|
17
|
-
import { LinkedAccountsWidgetAnalyticsEvent as i } from "./index2.js";
|
|
18
|
-
import { EMPTY_CONNECT_FORM as a, EMPTY_EDIT_FORM as le, EMPTY_VERIFY_FORM as o, isConnectStep1Valid as s, isRoutingNumberValid as ue, isVerifyAmountInRange as c, isVerifyFormValid as l, parseVerifyAmountToMinorUnits as de, sanitizeRoutingNumberInput as fe, toEditForm as pe, toUpdateBody as me } from "./index3.js";
|
|
19
|
-
import { getLinkedAccountsPermissions as he } from "./index5.js";
|
|
20
|
-
import { toAccountRows as ge } from "./index6.js";
|
|
21
|
-
import { toAccessRows as _e, toOrganizationRoleOptions as ve, toTeamMembers as ye } from "./index7.js";
|
|
22
|
-
import { DEFAULT_LABELS as be } from "../../ui/dist/index15.js";
|
|
23
|
-
import "../../ui/dist/index.js";
|
|
24
|
-
import { useConnectExternalBankAccountMutation as xe } from "../../data-access/dist/index3.js";
|
|
25
|
-
import { useExternalBankAccountsQuery as Se } from "../../data-access/dist/index4.js";
|
|
26
|
-
import { useGrantExternalBankAccountAccessMutation as Ce } from "../../data-access/dist/index5.js";
|
|
27
|
-
import { useLinkExternalBankAccountMutation as we } from "../../data-access/dist/index6.js";
|
|
28
|
-
import { useUnlinkExternalBankAccountMutation as Te } from "../../data-access/dist/index9.js";
|
|
29
|
-
import { useUpdateExternalBankAccountMutation as Ee } from "../../data-access/dist/index10.js";
|
|
30
|
-
import { useValidateExternalBankAccountMutation as De } from "../../data-access/dist/index11.js";
|
|
31
|
-
import "../../data-access/dist/index.js";
|
|
32
|
-
import { useCallback as Oe, useEffect as ke, useMemo as u, useState as d } from "react";
|
|
33
1
|
//#region ../../libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/index8.js
|
|
34
|
-
function
|
|
35
|
-
|
|
36
|
-
|
|
2
|
+
function e(e) {
|
|
3
|
+
return e.filter((e) => {
|
|
4
|
+
let t = e.status?.toUpperCase() ?? "";
|
|
5
|
+
return !!e.key.trim() && (t === "ACTIVE" || t === "");
|
|
6
|
+
}).map((e) => ({
|
|
7
|
+
key: e.key.trim(),
|
|
8
|
+
name: e.name,
|
|
9
|
+
description: e.description?.trim() || e.name
|
|
10
|
+
}));
|
|
37
11
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
if (
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
return /* @__PURE__ */ new Set();
|
|
46
|
-
}
|
|
12
|
+
function t(e, t) {
|
|
13
|
+
let n = t?.trim() ?? "";
|
|
14
|
+
if (!n) return;
|
|
15
|
+
let r = n.toLowerCase(), i = e.find((e) => e.key.toLowerCase() === r);
|
|
16
|
+
if (i) return i.key;
|
|
17
|
+
let a = e.find((e) => e.name.toLowerCase() === r);
|
|
18
|
+
if (a) return a.key;
|
|
47
19
|
}
|
|
48
|
-
function
|
|
49
|
-
|
|
20
|
+
function n(e, n) {
|
|
21
|
+
let r = t(e, n);
|
|
22
|
+
if (r) return e.find((e) => e.key.toLowerCase() === r.toLowerCase())?.name;
|
|
50
23
|
}
|
|
51
|
-
function
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
} catch {}
|
|
24
|
+
function r(e, n) {
|
|
25
|
+
let r = t(e, n);
|
|
26
|
+
if (r) return e.find((e) => e.key.toLowerCase() === r.toLowerCase())?.description;
|
|
55
27
|
}
|
|
56
|
-
function
|
|
57
|
-
|
|
58
|
-
return m(n), n;
|
|
28
|
+
function i(e) {
|
|
29
|
+
return e.trim() ? e.split("_").filter(Boolean).map((e) => e.length <= 3 && e === e.toUpperCase() ? e.toUpperCase() : e.charAt(0).toUpperCase() + e.slice(1).toLowerCase()).join(" ") : "";
|
|
59
30
|
}
|
|
60
|
-
function
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
...ce,
|
|
66
|
-
...p
|
|
67
|
-
}, _ = ee(), { organizationId: v, widgetToken: Me, initResponse: y } = ie(), Ne = oe(), b = !!ae(), x = !!(v && Me), S = u(() => he(y?.scopes), [y?.scopes]), C = x && S.canRead && !!y, [w, T] = d(), [E, Pe] = d(!1), [D, O] = d(1), [k, A] = d([]), [j, M] = d(), [Fe, N] = d(), [Ie, Le] = d(je), [Re, P] = d(!1), [ze, Be] = d(!1), [Ve, F] = d(!1), [He, I] = d(!1), [L, R] = d(), [z, Ue] = d(a), [We, Ge] = d(le), [B, Ke] = d(o);
|
|
68
|
-
ke(() => {
|
|
69
|
-
_(i.Mounted);
|
|
70
|
-
}, [_]);
|
|
71
|
-
let V = Se({
|
|
72
|
-
limit: 100,
|
|
73
|
-
enabled: C
|
|
74
|
-
}), H = xe(), U = Ce(), W = Ee(), G = Te(), K = we(), q = De(), qe = E && D >= 2, J = n({ enabled: qe }), Y = t({ enabled: qe }), X = u(() => {
|
|
75
|
-
let e = Y.data?.data ?? [], t = v ? se(e, {
|
|
76
|
-
organizationId: v,
|
|
77
|
-
organizationTypes: y?.organizationTypes ?? []
|
|
78
|
-
}) : e;
|
|
79
|
-
return ye(J.data?.data ?? [], ve(t));
|
|
80
|
-
}, [
|
|
81
|
-
Y.data?.data,
|
|
82
|
-
J.data?.data,
|
|
83
|
-
v,
|
|
84
|
-
y?.organizationTypes
|
|
85
|
-
]), Je = J.isLoading || J.isFetchingNextPage || !!J.hasNextPage || Y.isResolving, Ye = !Je && !J.isError, Z = C ? V.data?.data ?? [] : [], Q = u(() => Z.map((e) => e.verificationStatus === "UNVERIFIED" && Ie.has(e.id) ? {
|
|
86
|
-
...e,
|
|
87
|
-
verificationStatus: "VERIFICATION_SENT"
|
|
88
|
-
} : e), [Z, Ie]), Xe = [.../* @__PURE__ */ new Set([...X.filter((e) => e.locked).map((e) => e.id), ...k])], Ze = Oe((e) => {
|
|
89
|
-
H.reset(), U.reset(), K.reset(), Ue({
|
|
90
|
-
...e,
|
|
91
|
-
routingNumber: fe(e.routingNumber)
|
|
92
|
-
});
|
|
93
|
-
}, [
|
|
94
|
-
H,
|
|
95
|
-
U,
|
|
96
|
-
K
|
|
97
|
-
]), Qe = () => {
|
|
98
|
-
O(3), r(ne);
|
|
99
|
-
}, $e = (e) => {
|
|
100
|
-
if (!S.canMicroDeposit) {
|
|
101
|
-
Qe();
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
|
-
N("connect"), K.mutate({ path: { id: e } }, { onSuccess: () => {
|
|
105
|
-
N(void 0), Le((t) => h(t, e)), _(i.AccountLinked, { accountId: e }), Qe();
|
|
106
|
-
} });
|
|
107
|
-
}, et = (e) => {
|
|
108
|
-
U.mutate({
|
|
109
|
-
path: { id: e },
|
|
110
|
-
body: { userIds: Xe }
|
|
111
|
-
}, { onSuccess: () => $e(e) });
|
|
112
|
-
}, tt = () => {
|
|
113
|
-
if (x && S.canWrite) {
|
|
114
|
-
if (D === 1) {
|
|
115
|
-
if (!s(z)) return;
|
|
116
|
-
O(2);
|
|
117
|
-
return;
|
|
118
|
-
}
|
|
119
|
-
if (D === 2 && Ye) {
|
|
120
|
-
if (j) {
|
|
121
|
-
et(j.id);
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
H.mutate({ body: {
|
|
125
|
-
nickname: z.nickname.trim(),
|
|
126
|
-
accountNumber: z.accountNumber.trim(),
|
|
127
|
-
routingNumber: z.routingNumber.trim(),
|
|
128
|
-
nameOnAccount: z.nickname.trim(),
|
|
129
|
-
type: z.type
|
|
130
|
-
} }, { onSuccess: (e) => {
|
|
131
|
-
_(i.AccountConnected, { accountId: e?.id }), M(e), e?.id && et(e.id);
|
|
132
|
-
} });
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
}, nt = () => {
|
|
136
|
-
D === 2 && O(1);
|
|
137
|
-
}, rt = (e, t) => {
|
|
138
|
-
X.find((t) => t.id === e)?.locked || A((n) => t ? [.../* @__PURE__ */ new Set([...n, e])] : n.filter((t) => t !== e));
|
|
139
|
-
}, it = (e) => {
|
|
140
|
-
e && !x || e && !S.canWrite || (e && (O(1), Ue(a), A([]), M(void 0), N(void 0), H.reset(), U.reset(), K.reset()), Pe(e));
|
|
141
|
-
}, at = (e) => {
|
|
142
|
-
if (!x || !S.canWrite) return;
|
|
143
|
-
let t = Z.find((t) => t.id === e);
|
|
144
|
-
T(e), Ge(pe(t)), P(!0);
|
|
145
|
-
}, ot = (e) => {
|
|
146
|
-
e && !x || e && !S.canWrite || P(e);
|
|
147
|
-
}, st = () => {
|
|
148
|
-
if (!x || !S.canWrite || !w) return;
|
|
149
|
-
let t = Z.find((e) => e.id === w), n = me(We, t);
|
|
150
|
-
Object.keys(n).length !== 0 && W.mutate({
|
|
151
|
-
path: { id: w },
|
|
152
|
-
body: n
|
|
153
|
-
}, { onSuccess: () => {
|
|
154
|
-
_(i.AccountUpdated, { accountId: w }), e.success(g.editSuccessToast), P(!1);
|
|
155
|
-
} });
|
|
156
|
-
}, ct = (e) => {
|
|
157
|
-
x && S.canWrite && (T(e), Ke(o), I(!1), F(!1), Be(!0));
|
|
158
|
-
}, lt = (e) => {
|
|
159
|
-
e && !x || e && !S.canWrite || (e || (I(!1), F(!1)), Be(e));
|
|
160
|
-
}, ut = (e) => {
|
|
161
|
-
q.reset(), I(!1), Ke(e);
|
|
162
|
-
}, dt = () => {
|
|
163
|
-
if (!x || !S.canWrite || !w || !l(B)) return;
|
|
164
|
-
let e = de(B.firstAmount), t = de(B.secondAmount);
|
|
165
|
-
e !== null && t !== null && (I(!1), q.mutate({
|
|
166
|
-
path: { id: w },
|
|
167
|
-
body: {
|
|
168
|
-
firstAmount: e,
|
|
169
|
-
secondAmount: t
|
|
170
|
-
}
|
|
171
|
-
}, { onSuccess: (e) => {
|
|
172
|
-
if (!Ae(e)) {
|
|
173
|
-
I(!0);
|
|
174
|
-
return;
|
|
175
|
-
}
|
|
176
|
-
_(i.AccountVerified, { accountId: w }), r("tesouro-new-external-bank-account-linked-success"), F(!0);
|
|
177
|
-
} }));
|
|
178
|
-
}, ft = (e) => {
|
|
179
|
-
x && S.canMicroDeposit && (N("row"), K.mutate({ path: { id: e } }, { onSuccess: () => {
|
|
180
|
-
N(void 0), Le((t) => h(t, e)), _(i.AccountLinked, { accountId: e });
|
|
181
|
-
} }));
|
|
182
|
-
}, pt = (e) => {
|
|
183
|
-
x && S.canWrite && R(e);
|
|
184
|
-
}, mt = (e) => {
|
|
185
|
-
e || R(void 0);
|
|
186
|
-
}, ht = () => {
|
|
187
|
-
if (!x || !S.canWrite || !L) return;
|
|
188
|
-
let t = L;
|
|
189
|
-
G.mutate({ path: { id: t } }, { onSuccess: () => {
|
|
190
|
-
_(i.AccountUnlinked, { accountId: t }), e.success(g.unlinkSuccessToast), R(void 0);
|
|
191
|
-
} });
|
|
192
|
-
}, gt = H.isPending || U.isPending || W.isPending || q.isPending || G.isPending || K.isPending, _t = S.canWrite, vt = !x || gt, $ = K.isError && Fe === "connect", yt = _e(X, {
|
|
193
|
-
selectedUserIds: k,
|
|
194
|
-
disabled: vt || !_t,
|
|
195
|
-
fallbackTooltip: m.teamMemberAccessTooltip,
|
|
196
|
-
onUserToggle: rt
|
|
197
|
-
}), bt = X.filter((e) => e.locked).length + k.length, xt = X.filter((e) => e.locked || k.includes(e.id)), St = j ? {
|
|
198
|
-
nickname: j.nickname || z.nickname.trim(),
|
|
199
|
-
maskedAccountNumber: j.accountNumber,
|
|
200
|
-
users: xt.map((e) => ({
|
|
201
|
-
key: e.id,
|
|
202
|
-
initials: te(e.name),
|
|
31
|
+
function a(e, a, o) {
|
|
32
|
+
return e.map((e) => {
|
|
33
|
+
let s = e.role ?? "", c = t(a, s) || s.trim(), l = n(a, s) || i(c), u = r(a, s) ?? "";
|
|
34
|
+
return {
|
|
35
|
+
id: e.id,
|
|
203
36
|
name: e.name,
|
|
204
|
-
role:
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
U.isError,
|
|
221
|
-
$,
|
|
222
|
-
K.error,
|
|
223
|
-
m.actionErrorTitle
|
|
224
|
-
]);
|
|
225
|
-
return {
|
|
226
|
-
rows: Ct,
|
|
227
|
-
isLoading: !b && (!x || Ne && !y || C && V.isLoading),
|
|
228
|
-
isError: b || C && V.isError,
|
|
229
|
-
isConnectOpen: E,
|
|
230
|
-
isEditOpen: Re,
|
|
231
|
-
isVerifyOpen: ze,
|
|
232
|
-
isVerifySuccess: Ve,
|
|
233
|
-
verifyAccountName: Q.find((e) => e.id === w)?.nickname,
|
|
234
|
-
verifyAccountNumber: Q.find((e) => e.id === w)?.accountNumber,
|
|
235
|
-
isUnlinkOpen: !!L,
|
|
236
|
-
unlinkAccountNumber: Q.find((e) => e.id === L)?.accountNumber,
|
|
237
|
-
connectStep: D,
|
|
238
|
-
accessRows: yt,
|
|
239
|
-
accessGrantedCount: bt,
|
|
240
|
-
connectSummary: St,
|
|
241
|
-
isTeamMembersLoading: Je,
|
|
242
|
-
isTeamMembersError: J.isError,
|
|
243
|
-
isConnectNextDisabled: D === 1 ? !s(z) : D === 2 && !Ye,
|
|
244
|
-
isConnectRoutingNumberInvalid: z.routingNumber.trim() !== "" && !ue(z.routingNumber),
|
|
245
|
-
connectErrorMessage: wt,
|
|
246
|
-
isVerifyFirstAmountInvalid: B.firstAmount.trim() !== "" && !c(B.firstAmount),
|
|
247
|
-
isVerifySecondAmountInvalid: B.secondAmount.trim() !== "" && !c(B.secondAmount),
|
|
248
|
-
isVerifySubmitDisabled: !l(B),
|
|
249
|
-
isActionDisabled: vt,
|
|
250
|
-
canConnect: _t,
|
|
251
|
-
isSubmitting: gt,
|
|
252
|
-
isActionError: K.isError || G.isError || H.isError || U.isError || W.isError || q.isError || He,
|
|
253
|
-
isConnectError: H.isError || U.isError || $,
|
|
254
|
-
isEditError: W.isError,
|
|
255
|
-
isVerifyError: q.isError || He,
|
|
256
|
-
connectForm: z,
|
|
257
|
-
editForm: We,
|
|
258
|
-
verifyForm: B,
|
|
259
|
-
onConnectOpenChange: it,
|
|
260
|
-
onEditOpenChange: ot,
|
|
261
|
-
onVerifyOpenChange: lt,
|
|
262
|
-
onUnlinkOpenChange: mt,
|
|
263
|
-
onConnectFormChange: Ze,
|
|
264
|
-
onEditFormChange: Ge,
|
|
265
|
-
onVerifyFormChange: ut,
|
|
266
|
-
onConnectNext: tt,
|
|
267
|
-
onConnectBack: nt,
|
|
268
|
-
onEditSubmit: st,
|
|
269
|
-
onVerifySubmit: dt,
|
|
270
|
-
onUnlinkConfirm: ht
|
|
271
|
-
};
|
|
37
|
+
role: l,
|
|
38
|
+
roleDescription: u,
|
|
39
|
+
locked: o.has(e.id)
|
|
40
|
+
};
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
function o(e, { selectedUserIds: t, disabled: n, fallbackTooltip: r, onUserToggle: i }) {
|
|
44
|
+
return e.map((e) => ({
|
|
45
|
+
key: e.id,
|
|
46
|
+
name: e.name,
|
|
47
|
+
role: e.role,
|
|
48
|
+
roleTooltip: e.roleDescription || r,
|
|
49
|
+
checked: e.locked || t.includes(e.id),
|
|
50
|
+
disabled: n || e.locked,
|
|
51
|
+
onToggle: (t) => i(e.id, t)
|
|
52
|
+
}));
|
|
272
53
|
}
|
|
273
54
|
//#endregion
|
|
274
|
-
export {
|
|
55
|
+
export { r as resolveOrganizationRoleDescription, n as resolveOrganizationRoleDisplayName, t as resolveOrganizationRoleKey, o as toAccessRows, e as toOrganizationRoleOptions, a as toTeamMembers };
|
package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/index9.js
CHANGED
|
@@ -2,44 +2,283 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
|
-
import {
|
|
5
|
+
import { toast as e } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
6
|
+
import { Scope as t } from "../../../shared/data-access/dist/lib/scopes.js";
|
|
7
|
+
import { useAllOrganizationRolesQuery as n } from "../../../shared/data-access/dist/lib/role/useAllOrganizationRolesQuery.js";
|
|
8
|
+
import { useAllOrganizationUsersQuery as ee } from "../../../shared/data-access/dist/lib/user/useAllOrganizationUsersQuery.js";
|
|
9
|
+
import "../../../shared/data-access/dist/index.js";
|
|
6
10
|
import "../../../shared/ui/dist/index.js";
|
|
7
|
-
import {
|
|
11
|
+
import { useAnalyticsTrack as te } from "../../../shared/feature/dist/lib/analytics/hooks.js";
|
|
12
|
+
import { getInitials as ne } from "../../../shared/util/dist/lib/getInitials.js";
|
|
13
|
+
import { TESOURO_NEW_EXTERNAL_BANK_ACCOUNT_LINKED_SUCCESS_EVENT as re, emitWidgetDomEvent as r } from "../../../shared/util/dist/lib/widgetDomEvents.js";
|
|
14
|
+
import { extractApiErrorMessage as ie } from "../../../shared/util/dist/lib/apiErrors.js";
|
|
15
|
+
import { useWidgetConfig as ae, useWidgetError as oe, useWidgetLoading as se } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
|
|
8
16
|
import "../../../shared/feature/dist/index.js";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
17
|
+
import { filterRolesForOrganization as ce } from "../../../../shared/util-validation/dist/index6.js";
|
|
18
|
+
import { filterUsersForOrganization as le } from "../../../../shared/util-validation/dist/index7.js";
|
|
19
|
+
import { DEFAULT_FEATURE_LABELS as ue } from "./index4.js";
|
|
20
|
+
import { LinkedAccountsWidgetAnalyticsEvent as i } from "./index2.js";
|
|
21
|
+
import { EMPTY_CONNECT_FORM as de, EMPTY_EDIT_FORM as fe, EMPTY_VERIFY_FORM as pe, isConnectStep1Valid as me, isRoutingNumberValid as he, isVerifyAmountInRange as ge, isVerifyFormValid as a, parseVerifyAmountToMinorUnits as o, sanitizeRoutingNumberInput as _e, toEditForm as ve, toUpdateBody as ye } from "./index3.js";
|
|
22
|
+
import { getLinkedAccountsPermissions as be } from "./index5.js";
|
|
23
|
+
import { toAccountRows as xe } from "./index6.js";
|
|
24
|
+
import { useConnectExternalBankAccountMutation as Se } from "../../data-access/dist/index3.js";
|
|
25
|
+
import { useExternalBankAccountsQuery as Ce } from "../../data-access/dist/index4.js";
|
|
26
|
+
import { useGrantExternalBankAccountAccessMutation as we } from "../../data-access/dist/index5.js";
|
|
27
|
+
import { useLinkExternalBankAccountMutation as Te } from "../../data-access/dist/index6.js";
|
|
28
|
+
import { useUnlinkExternalBankAccountMutation as Ee } from "../../data-access/dist/index9.js";
|
|
29
|
+
import { useUpdateExternalBankAccountMutation as De } from "../../data-access/dist/index10.js";
|
|
30
|
+
import { useValidateExternalBankAccountMutation as Oe } from "../../data-access/dist/index11.js";
|
|
31
|
+
import "../../data-access/dist/index.js";
|
|
32
|
+
import { useAdminEligibleUserIds as ke } from "./index7.js";
|
|
33
|
+
import { toAccessRows as Ae, toOrganizationRoleOptions as je, toTeamMembers as Me } from "./index8.js";
|
|
34
|
+
import { DEFAULT_LABELS as Ne } from "../../ui/dist/index15.js";
|
|
11
35
|
import "../../ui/dist/index.js";
|
|
12
|
-
import {
|
|
13
|
-
import { Fragment as a, jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
36
|
+
import { useCallback as Pe, useEffect as Fe, useMemo as s, useState as c } from "react";
|
|
14
37
|
//#region ../../libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/index9.js
|
|
15
|
-
function
|
|
16
|
-
let
|
|
17
|
-
|
|
18
|
-
featureLabels: n
|
|
19
|
-
});
|
|
20
|
-
return /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ o(e, {}), /* @__PURE__ */ o(r, {
|
|
21
|
-
labels: t,
|
|
22
|
-
...c
|
|
23
|
-
})] });
|
|
38
|
+
function Ie(e) {
|
|
39
|
+
let t = e;
|
|
40
|
+
return typeof e == "object" && !!e && "verificationStatus" in e && t.verificationStatus === "VERIFIED";
|
|
24
41
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
var l = "tesouro.linkedAccounts.locallySentMicroDepositAccountIds.v1";
|
|
43
|
+
function Le() {
|
|
44
|
+
if (typeof window > "u") return /* @__PURE__ */ new Set();
|
|
45
|
+
try {
|
|
46
|
+
let e = window.sessionStorage.getItem(l), t = e ? JSON.parse(e) : [];
|
|
47
|
+
return new Set(Array.isArray(t) ? t.filter(u) : []);
|
|
48
|
+
} catch {
|
|
49
|
+
return /* @__PURE__ */ new Set();
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function u(e) {
|
|
53
|
+
return typeof e == "string";
|
|
54
|
+
}
|
|
55
|
+
function d(e) {
|
|
56
|
+
if (!(typeof window > "u")) try {
|
|
57
|
+
window.sessionStorage.setItem(l, JSON.stringify([...e]));
|
|
58
|
+
} catch {}
|
|
59
|
+
}
|
|
60
|
+
function f(e, t) {
|
|
61
|
+
let n = new Set(e).add(t);
|
|
62
|
+
return d(n), n;
|
|
63
|
+
}
|
|
64
|
+
var Re = t.ExternalBankAccountWriteOrg;
|
|
65
|
+
function p({ labels: t, featureLabels: l }) {
|
|
66
|
+
let u = {
|
|
67
|
+
...Ne,
|
|
68
|
+
...t
|
|
69
|
+
}, d = {
|
|
70
|
+
...ue,
|
|
71
|
+
...l
|
|
72
|
+
}, p = te(), { organizationId: m, widgetToken: ze, initResponse: h } = ae(), Be = se(), g = !!oe(), _ = !!(m && ze), v = s(() => be(h?.scopes), [h?.scopes]), y = _ && v.canRead && !!h, [b, Ve] = c(), [He, Ue] = c(!1), [x, S] = c(1), [C, w] = c([]), [T, E] = c(), [We, D] = c(), [O, Ge] = c(Le), [Ke, k] = c(!1), [qe, Je] = c(!1), [Ye, A] = c(!1), [Xe, j] = c(!1), [M, N] = c(), [P, F] = c(de), [I, L] = c(fe), [R, z] = c(pe);
|
|
73
|
+
Fe(() => {
|
|
74
|
+
p(i.Mounted);
|
|
75
|
+
}, [p]);
|
|
76
|
+
let B = Ce({
|
|
77
|
+
limit: 100,
|
|
78
|
+
enabled: y
|
|
79
|
+
}), V = Se(), H = we(), U = De(), W = Ee(), G = Te(), K = Oe(), q = He && x >= 2, J = ee({ enabled: q }), Y = n({ enabled: q }), { userIds: Ze, isResolving: Qe, isError: $e } = ke({
|
|
80
|
+
enabled: q,
|
|
81
|
+
permissionKey: Re,
|
|
82
|
+
organizationId: m
|
|
83
|
+
}), X = s(() => {
|
|
84
|
+
let e = Y.data?.data ?? [], t = m ? ce(e, {
|
|
85
|
+
organizationId: m,
|
|
86
|
+
organizationTypes: h?.organizationTypes ?? []
|
|
87
|
+
}) : e, n = le(J.data?.data ?? [], m);
|
|
88
|
+
return Me(n, je(t), Ze);
|
|
89
|
+
}, [
|
|
90
|
+
Ze,
|
|
91
|
+
Y.data?.data,
|
|
92
|
+
J.data?.data,
|
|
93
|
+
m,
|
|
94
|
+
h?.organizationTypes
|
|
95
|
+
]), et = J.isLoading || J.isFetchingNextPage || !!J.hasNextPage || Y.isResolving || Qe, tt = !et && !J.isError && !$e, Z = y ? B.data?.data ?? [] : [], Q = s(() => Z.map((e) => e.verificationStatus === "UNVERIFIED" && O.has(e.id) ? {
|
|
96
|
+
...e,
|
|
97
|
+
verificationStatus: "VERIFICATION_SENT"
|
|
98
|
+
} : e), [Z, O]), nt = [.../* @__PURE__ */ new Set([...X.filter((e) => e.locked).map((e) => e.id), ...C])], rt = Pe((e) => {
|
|
99
|
+
V.reset(), H.reset(), G.reset(), F({
|
|
100
|
+
...e,
|
|
101
|
+
routingNumber: _e(e.routingNumber)
|
|
102
|
+
});
|
|
103
|
+
}, [
|
|
104
|
+
V,
|
|
105
|
+
H,
|
|
106
|
+
G
|
|
107
|
+
]), it = () => {
|
|
108
|
+
S(3), r(re);
|
|
109
|
+
}, at = (e) => {
|
|
110
|
+
if (!v.canMicroDeposit) {
|
|
111
|
+
it();
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
D("connect"), G.mutate({ path: { id: e } }, { onSuccess: () => {
|
|
115
|
+
D(void 0), Ge((t) => f(t, e)), p(i.AccountLinked, { accountId: e }), it();
|
|
116
|
+
} });
|
|
117
|
+
}, ot = (e) => {
|
|
118
|
+
H.mutate({
|
|
119
|
+
path: { id: e },
|
|
120
|
+
body: { userIds: nt }
|
|
121
|
+
}, { onSuccess: () => at(e) });
|
|
122
|
+
}, st = () => {
|
|
123
|
+
if (_ && v.canWrite) {
|
|
124
|
+
if (x === 1) {
|
|
125
|
+
if (!me(P)) return;
|
|
126
|
+
S(2);
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
if (x === 2 && tt) {
|
|
130
|
+
if (T) {
|
|
131
|
+
ot(T.id);
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
V.mutate({ body: {
|
|
135
|
+
nickname: P.nickname.trim(),
|
|
136
|
+
accountNumber: P.accountNumber.trim(),
|
|
137
|
+
routingNumber: P.routingNumber.trim(),
|
|
138
|
+
nameOnAccount: P.nickname.trim(),
|
|
139
|
+
type: P.type
|
|
140
|
+
} }, { onSuccess: (e) => {
|
|
141
|
+
p(i.AccountConnected, { accountId: e?.id }), E(e), e?.id && ot(e.id);
|
|
142
|
+
} });
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}, ct = () => {
|
|
146
|
+
x === 2 && S(1);
|
|
147
|
+
}, lt = (e, t) => {
|
|
148
|
+
X.find((t) => t.id === e)?.locked || w((n) => t ? [.../* @__PURE__ */ new Set([...n, e])] : n.filter((t) => t !== e));
|
|
149
|
+
}, ut = (e) => {
|
|
150
|
+
e && !_ || e && !v.canWrite || (e && (S(1), F(de), w([]), E(void 0), D(void 0), V.reset(), H.reset(), G.reset()), Ue(e));
|
|
151
|
+
}, dt = (e) => {
|
|
152
|
+
if (!_ || !v.canWrite) return;
|
|
153
|
+
let t = Z.find((t) => t.id === e);
|
|
154
|
+
Ve(e), L(ve(t)), k(!0);
|
|
155
|
+
}, ft = (e) => {
|
|
156
|
+
e && !_ || e && !v.canWrite || k(e);
|
|
157
|
+
}, pt = () => {
|
|
158
|
+
if (!_ || !v.canWrite || !b) return;
|
|
159
|
+
let t = Z.find((e) => e.id === b), n = ye(I, t);
|
|
160
|
+
Object.keys(n).length !== 0 && U.mutate({
|
|
161
|
+
path: { id: b },
|
|
162
|
+
body: n
|
|
163
|
+
}, { onSuccess: () => {
|
|
164
|
+
p(i.AccountUpdated, { accountId: b }), e.success(d.editSuccessToast), k(!1);
|
|
165
|
+
} });
|
|
166
|
+
}, mt = (e) => {
|
|
167
|
+
_ && v.canWrite && (Ve(e), z(pe), j(!1), A(!1), Je(!0));
|
|
168
|
+
}, ht = (e) => {
|
|
169
|
+
e && !_ || e && !v.canWrite || (e || (j(!1), A(!1)), Je(e));
|
|
170
|
+
}, gt = (e) => {
|
|
171
|
+
K.reset(), j(!1), z(e);
|
|
172
|
+
}, _t = () => {
|
|
173
|
+
if (!_ || !v.canWrite || !b || !a(R)) return;
|
|
174
|
+
let e = o(R.firstAmount), t = o(R.secondAmount);
|
|
175
|
+
e !== null && t !== null && (j(!1), K.mutate({
|
|
176
|
+
path: { id: b },
|
|
177
|
+
body: {
|
|
178
|
+
firstAmount: e,
|
|
179
|
+
secondAmount: t
|
|
180
|
+
}
|
|
181
|
+
}, { onSuccess: (e) => {
|
|
182
|
+
if (!Ie(e)) {
|
|
183
|
+
j(!0);
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
p(i.AccountVerified, { accountId: b }), r("tesouro-new-external-bank-account-linked-success"), A(!0);
|
|
187
|
+
} }));
|
|
188
|
+
}, vt = (e) => {
|
|
189
|
+
_ && v.canMicroDeposit && (D("row"), G.mutate({ path: { id: e } }, { onSuccess: () => {
|
|
190
|
+
D(void 0), Ge((t) => f(t, e)), p(i.AccountLinked, { accountId: e });
|
|
191
|
+
} }));
|
|
192
|
+
}, yt = (e) => {
|
|
193
|
+
_ && v.canWrite && N(e);
|
|
194
|
+
}, bt = (e) => {
|
|
195
|
+
e || N(void 0);
|
|
196
|
+
}, xt = () => {
|
|
197
|
+
if (!_ || !v.canWrite || !M) return;
|
|
198
|
+
let t = M;
|
|
199
|
+
W.mutate({ path: { id: t } }, { onSuccess: () => {
|
|
200
|
+
p(i.AccountUnlinked, { accountId: t }), e.success(d.unlinkSuccessToast), N(void 0);
|
|
201
|
+
} });
|
|
202
|
+
}, St = V.isPending || H.isPending || U.isPending || K.isPending || W.isPending || G.isPending, Ct = v.canWrite, wt = !_ || St, $ = G.isError && We === "connect", Tt = Ae(X, {
|
|
203
|
+
selectedUserIds: C,
|
|
204
|
+
disabled: wt || !Ct,
|
|
205
|
+
fallbackTooltip: u.teamMemberAccessTooltip,
|
|
206
|
+
onUserToggle: lt
|
|
207
|
+
}), Et = X.filter((e) => e.locked).length + C.length, Dt = X.filter((e) => e.locked || C.includes(e.id)), Ot = T ? {
|
|
208
|
+
nickname: T.nickname || P.nickname.trim(),
|
|
209
|
+
maskedAccountNumber: T.accountNumber,
|
|
210
|
+
users: Dt.map((e) => ({
|
|
211
|
+
key: e.id,
|
|
212
|
+
initials: ne(e.name),
|
|
213
|
+
name: e.name,
|
|
214
|
+
role: e.role
|
|
215
|
+
}))
|
|
216
|
+
} : void 0, kt = xe(Q, d, v, {
|
|
217
|
+
labels: u,
|
|
218
|
+
onEditSelect: dt,
|
|
219
|
+
onVerifySelect: mt,
|
|
220
|
+
onLinkSelect: vt,
|
|
221
|
+
onUnlinkSelect: yt
|
|
222
|
+
}), At = s(() => {
|
|
223
|
+
if (!V.isError && !H.isError && !$) return;
|
|
224
|
+
let e = V.error ?? H.error ?? ($ ? G.error : void 0);
|
|
225
|
+
return ie(e) ?? u.actionErrorTitle;
|
|
226
|
+
}, [
|
|
227
|
+
V.error,
|
|
228
|
+
V.isError,
|
|
229
|
+
H.error,
|
|
230
|
+
H.isError,
|
|
231
|
+
$,
|
|
232
|
+
G.error,
|
|
233
|
+
u.actionErrorTitle
|
|
234
|
+
]);
|
|
235
|
+
return {
|
|
236
|
+
rows: kt,
|
|
237
|
+
isLoading: !g && (!_ || Be && !h || y && B.isLoading),
|
|
238
|
+
isError: g || y && B.isError,
|
|
239
|
+
isConnectOpen: He,
|
|
240
|
+
isEditOpen: Ke,
|
|
241
|
+
isVerifyOpen: qe,
|
|
242
|
+
isVerifySuccess: Ye,
|
|
243
|
+
verifyAccountName: Q.find((e) => e.id === b)?.nickname,
|
|
244
|
+
verifyAccountNumber: Q.find((e) => e.id === b)?.accountNumber,
|
|
245
|
+
isUnlinkOpen: !!M,
|
|
246
|
+
unlinkAccountNumber: Q.find((e) => e.id === M)?.accountNumber,
|
|
247
|
+
connectStep: x,
|
|
248
|
+
accessRows: Tt,
|
|
249
|
+
accessGrantedCount: Et,
|
|
250
|
+
connectSummary: Ot,
|
|
251
|
+
isTeamMembersLoading: et,
|
|
252
|
+
isTeamMembersError: J.isError || $e,
|
|
253
|
+
isConnectNextDisabled: x === 1 ? !me(P) : x === 2 && !tt,
|
|
254
|
+
isConnectRoutingNumberInvalid: P.routingNumber.trim() !== "" && !he(P.routingNumber),
|
|
255
|
+
connectErrorMessage: At,
|
|
256
|
+
isVerifyFirstAmountInvalid: R.firstAmount.trim() !== "" && !ge(R.firstAmount),
|
|
257
|
+
isVerifySecondAmountInvalid: R.secondAmount.trim() !== "" && !ge(R.secondAmount),
|
|
258
|
+
isVerifySubmitDisabled: !a(R),
|
|
259
|
+
isActionDisabled: wt,
|
|
260
|
+
canConnect: Ct,
|
|
261
|
+
isSubmitting: St,
|
|
262
|
+
isActionError: G.isError || W.isError || V.isError || H.isError || U.isError || K.isError || Xe,
|
|
263
|
+
isConnectError: V.isError || H.isError || $,
|
|
264
|
+
isEditError: U.isError,
|
|
265
|
+
isVerifyError: K.isError || Xe,
|
|
266
|
+
connectForm: P,
|
|
267
|
+
editForm: I,
|
|
268
|
+
verifyForm: R,
|
|
269
|
+
onConnectOpenChange: ut,
|
|
270
|
+
onEditOpenChange: ft,
|
|
271
|
+
onVerifyOpenChange: ht,
|
|
272
|
+
onUnlinkOpenChange: bt,
|
|
273
|
+
onConnectFormChange: rt,
|
|
274
|
+
onEditFormChange: L,
|
|
275
|
+
onVerifyFormChange: gt,
|
|
276
|
+
onConnectNext: st,
|
|
277
|
+
onConnectBack: ct,
|
|
278
|
+
onEditSubmit: pt,
|
|
279
|
+
onVerifySubmit: _t,
|
|
280
|
+
onUnlinkConfirm: xt
|
|
281
|
+
};
|
|
43
282
|
}
|
|
44
283
|
//#endregion
|
|
45
|
-
export {
|
|
284
|
+
export { p as useLinkedAccountsWidget };
|
|
@@ -6,7 +6,7 @@ import { useAllOrganizationRolesQuery as e } from "../../../../data-access/dist/
|
|
|
6
6
|
import { useRolePermissionsQueries as t } from "../../../../data-access/dist/lib/role/useRolePermissionsQueries.js";
|
|
7
7
|
import { useAllOrganizationUsersQuery as n } from "../../../../data-access/dist/lib/user/useAllOrganizationUsersQuery.js";
|
|
8
8
|
import "../../../../data-access/dist/index.js";
|
|
9
|
-
import { sortRolesBySortOrdinal as r } from "../../../../../../shared/util-validation/dist/
|
|
9
|
+
import { sortRolesBySortOrdinal as r } from "../../../../../../shared/util-validation/dist/index23.js";
|
|
10
10
|
import { useCallback as i, useMemo as a } from "react";
|
|
11
11
|
//#region ../../libs/tesouro-embedded-components-react/shared/approval-policy/feature/dist/lib/useApproverOptions.js
|
|
12
12
|
function o(e) {
|