@tesouro/embedded-components-react 0.5.185 → 0.5.187
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/libs/tesouro-embedded-components-react/settings-widget/team/data-access/dist/index7.js +116 -94
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/feature/dist/index12.js +76 -68
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/feature/dist/index17.js +181 -179
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/feature/dist/index3.js +2 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/feature/dist/index7.js +16 -12
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index8.js +66 -66
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +36 -35
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/debit-card/useAllDebitCardsQuery.js +54 -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/index9.js +5 -5
- package/package.json +1 -1
package/dist/libs/tesouro-embedded-components-react/settings-widget/team/data-access/dist/index7.js
CHANGED
|
@@ -2,48 +2,48 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
|
-
import { bulkUpdateDepartmentMembers as e, bulkUpdateLocationMembers as t, bulkUpdateRoleMembers as n, createUser as r, manageBankAccountAccess as i,
|
|
6
|
-
import { getDepartmentQueryKey as
|
|
7
|
-
import { invalidateAllClients as
|
|
8
|
-
import { useEmbedApi as
|
|
9
|
-
import { organizationHeaders as
|
|
5
|
+
import { bulkUpdateDepartmentMembers as e, bulkUpdateLocationMembers as t, bulkUpdateRoleMembers as n, createUser as r, manageBankAccountAccess as i, manageDebitCardAccess as a, updateUser as o } from "../../../../shared/data-access/dist/lib/rest/sdk.gen.js";
|
|
6
|
+
import { getDebitCardsQueryKey as s, getDepartmentQueryKey as c, getLocationQueryKey as l } from "../../../../shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js";
|
|
7
|
+
import { invalidateAllClients as u } from "../../../../shared/data-access/dist/lib/clientRegistry.js";
|
|
8
|
+
import { useEmbedApi as d } from "../../../../shared/data-access/dist/lib/EmbedApiContext.js";
|
|
9
|
+
import { organizationHeaders as f } from "../../../../shared/data-access/dist/lib/organizationHeaders.js";
|
|
10
10
|
import "../../../../shared/data-access/dist/index.js";
|
|
11
|
-
import { teamMembersInvalidationKey as
|
|
12
|
-
import { accountAccessInvalidationKeyForSource as
|
|
13
|
-
import { departmentsInvalidationKey as
|
|
14
|
-
import { locationsInvalidationKey as
|
|
15
|
-
import { useRef as
|
|
16
|
-
import { useMutation as
|
|
11
|
+
import { teamMembersInvalidationKey as p } from "./index2.js";
|
|
12
|
+
import { accountAccessInvalidationKeyForSource as m } from "./index3.js";
|
|
13
|
+
import { departmentsInvalidationKey as h } from "./index5.js";
|
|
14
|
+
import { locationsInvalidationKey as g } from "./index6.js";
|
|
15
|
+
import { useRef as _ } from "react";
|
|
16
|
+
import { useMutation as v } from "@tanstack/react-query";
|
|
17
17
|
//#region ../../libs/tesouro-embedded-components-react/settings-widget/team/data-access/dist/index7.js
|
|
18
|
-
function
|
|
18
|
+
function y(e) {
|
|
19
19
|
return e.map((e) => `${e.source}:${e.bankAccountId}`).sort().join(",");
|
|
20
20
|
}
|
|
21
|
-
async function
|
|
22
|
-
let a =
|
|
21
|
+
async function b({ client: e, organizationId: t, departmentIds: n, locationIds: r, grantedBankAccounts: i = [] }) {
|
|
22
|
+
let a = f(t);
|
|
23
23
|
await Promise.all([
|
|
24
|
-
|
|
24
|
+
u(p({
|
|
25
25
|
client: e,
|
|
26
26
|
organizationId: t
|
|
27
27
|
})),
|
|
28
|
-
|
|
28
|
+
u(h({
|
|
29
29
|
client: e,
|
|
30
30
|
organizationId: t
|
|
31
31
|
})),
|
|
32
|
-
|
|
32
|
+
u(g({
|
|
33
33
|
client: e,
|
|
34
34
|
organizationId: t
|
|
35
35
|
})),
|
|
36
|
-
...n.map((t) => c(
|
|
36
|
+
...n.map((t) => u(c({
|
|
37
37
|
client: e,
|
|
38
38
|
path: { departmentId: t },
|
|
39
39
|
headers: a
|
|
40
40
|
}))),
|
|
41
|
-
...r.map((t) =>
|
|
41
|
+
...r.map((t) => u(l({
|
|
42
42
|
client: e,
|
|
43
43
|
path: { locationId: t },
|
|
44
44
|
headers: a
|
|
45
45
|
}))),
|
|
46
|
-
...i.map((n) =>
|
|
46
|
+
...i.map((n) => u(m({
|
|
47
47
|
client: e,
|
|
48
48
|
organizationId: t,
|
|
49
49
|
bankAccountId: n.bankAccountId,
|
|
@@ -51,126 +51,148 @@ async function v({ client: e, organizationId: t, departmentIds: n, locationIds:
|
|
|
51
51
|
})))
|
|
52
52
|
]);
|
|
53
53
|
}
|
|
54
|
-
function
|
|
55
|
-
let { client:
|
|
56
|
-
return
|
|
57
|
-
let
|
|
54
|
+
function x() {
|
|
55
|
+
let { client: c, organizationId: l } = d(), p = f(l), m = _(void 0);
|
|
56
|
+
return v({ mutationFn: async ({ body: d, roleId: f, departmentId: h, locationId: g, bankAccountAccess: _ = [], debitCardIds: v = [] }) => {
|
|
57
|
+
let x = m.current?.email === d.email ? m.current : void 0, S = /* @__PURE__ */ new Set(), C = /* @__PURE__ */ new Set(), w = [];
|
|
58
58
|
try {
|
|
59
|
-
if (!
|
|
59
|
+
if (!x) {
|
|
60
60
|
let { data: e } = await r({
|
|
61
|
-
client:
|
|
62
|
-
headers:
|
|
63
|
-
body:
|
|
61
|
+
client: c,
|
|
62
|
+
headers: p,
|
|
63
|
+
body: d,
|
|
64
64
|
throwOnError: !0
|
|
65
65
|
});
|
|
66
|
-
|
|
67
|
-
email:
|
|
66
|
+
x = {
|
|
67
|
+
email: d.email,
|
|
68
68
|
user: e,
|
|
69
|
-
createdReportingManagerUserId:
|
|
70
|
-
},
|
|
69
|
+
createdReportingManagerUserId: d.reportingManagerUserId ?? null
|
|
70
|
+
}, m.current = x;
|
|
71
71
|
}
|
|
72
|
-
let
|
|
73
|
-
if (
|
|
74
|
-
client:
|
|
75
|
-
headers:
|
|
76
|
-
path: { id:
|
|
77
|
-
body: { reportingManagerUserId:
|
|
72
|
+
let T = [x.user.id], E = d.reportingManagerUserId ?? null;
|
|
73
|
+
if (x.createdReportingManagerUserId !== E && (await o({
|
|
74
|
+
client: c,
|
|
75
|
+
headers: p,
|
|
76
|
+
path: { id: x.user.id },
|
|
77
|
+
body: { reportingManagerUserId: E },
|
|
78
78
|
throwOnError: !0
|
|
79
|
-
}),
|
|
80
|
-
client:
|
|
81
|
-
headers:
|
|
82
|
-
path: { roleId:
|
|
79
|
+
}), x.createdReportingManagerUserId = E), x.assignedRoleId !== f && (x.assignedRoleId && (await n({
|
|
80
|
+
client: c,
|
|
81
|
+
headers: p,
|
|
82
|
+
path: { roleId: x.assignedRoleId },
|
|
83
83
|
body: {
|
|
84
84
|
type: "REMOVE",
|
|
85
|
-
userIds:
|
|
85
|
+
userIds: T
|
|
86
86
|
},
|
|
87
87
|
throwOnError: !0
|
|
88
|
-
}),
|
|
89
|
-
client:
|
|
90
|
-
headers:
|
|
91
|
-
path: { roleId:
|
|
88
|
+
}), x.assignedRoleId = void 0), await n({
|
|
89
|
+
client: c,
|
|
90
|
+
headers: p,
|
|
91
|
+
path: { roleId: f },
|
|
92
92
|
body: {
|
|
93
93
|
type: "ASSIGN",
|
|
94
|
-
userIds:
|
|
94
|
+
userIds: T
|
|
95
95
|
},
|
|
96
96
|
throwOnError: !0
|
|
97
|
-
}),
|
|
98
|
-
if (
|
|
99
|
-
let t =
|
|
97
|
+
}), x.assignedRoleId = f), x.assignedDepartmentId !== (h || void 0)) {
|
|
98
|
+
if (x.assignedDepartmentId) {
|
|
99
|
+
let t = x.assignedDepartmentId;
|
|
100
100
|
await e({
|
|
101
|
-
client:
|
|
102
|
-
headers:
|
|
101
|
+
client: c,
|
|
102
|
+
headers: p,
|
|
103
103
|
path: { departmentId: t },
|
|
104
104
|
body: {
|
|
105
105
|
type: "REMOVE",
|
|
106
|
-
userIds:
|
|
106
|
+
userIds: T
|
|
107
107
|
},
|
|
108
108
|
throwOnError: !0
|
|
109
|
-
}),
|
|
109
|
+
}), S.add(t), x.assignedDepartmentId = void 0;
|
|
110
110
|
}
|
|
111
|
-
|
|
112
|
-
client:
|
|
113
|
-
headers:
|
|
114
|
-
path: { departmentId:
|
|
111
|
+
h && (await e({
|
|
112
|
+
client: c,
|
|
113
|
+
headers: p,
|
|
114
|
+
path: { departmentId: h },
|
|
115
115
|
body: {
|
|
116
116
|
type: "ASSIGN",
|
|
117
|
-
userIds:
|
|
117
|
+
userIds: T
|
|
118
118
|
},
|
|
119
119
|
throwOnError: !0
|
|
120
|
-
}),
|
|
120
|
+
}), S.add(h), x.assignedDepartmentId = h);
|
|
121
121
|
}
|
|
122
|
-
if (
|
|
123
|
-
if (
|
|
124
|
-
let e =
|
|
122
|
+
if (x.assignedLocationId !== (g || void 0)) {
|
|
123
|
+
if (x.assignedLocationId) {
|
|
124
|
+
let e = x.assignedLocationId;
|
|
125
125
|
await t({
|
|
126
|
-
client:
|
|
127
|
-
headers:
|
|
126
|
+
client: c,
|
|
127
|
+
headers: p,
|
|
128
128
|
path: { locationId: e },
|
|
129
129
|
body: {
|
|
130
130
|
type: "REMOVE",
|
|
131
|
-
userIds:
|
|
131
|
+
userIds: T
|
|
132
132
|
},
|
|
133
133
|
throwOnError: !0
|
|
134
|
-
}),
|
|
134
|
+
}), C.add(e), x.assignedLocationId = void 0;
|
|
135
135
|
}
|
|
136
|
-
|
|
137
|
-
client:
|
|
138
|
-
headers:
|
|
139
|
-
path: { locationId:
|
|
136
|
+
g && (await t({
|
|
137
|
+
client: c,
|
|
138
|
+
headers: p,
|
|
139
|
+
path: { locationId: g },
|
|
140
140
|
body: {
|
|
141
141
|
type: "ASSIGN",
|
|
142
|
-
userIds:
|
|
142
|
+
userIds: T
|
|
143
143
|
},
|
|
144
144
|
throwOnError: !0
|
|
145
|
-
}),
|
|
145
|
+
}), C.add(g), x.assignedLocationId = g);
|
|
146
146
|
}
|
|
147
|
-
let
|
|
148
|
-
|
|
149
|
-
client:
|
|
150
|
-
headers:
|
|
147
|
+
let D = y(_);
|
|
148
|
+
_.length > 0 && x.grantedBankAccountAccessSignature !== D && (await i({
|
|
149
|
+
client: c,
|
|
150
|
+
headers: p,
|
|
151
151
|
body: {
|
|
152
152
|
type: "GRANT",
|
|
153
|
-
userIds:
|
|
154
|
-
bankAccounts:
|
|
153
|
+
userIds: T,
|
|
154
|
+
bankAccounts: _
|
|
155
155
|
},
|
|
156
156
|
throwOnError: !0
|
|
157
|
-
}),
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
157
|
+
}), w.push(..._), x.grantedBankAccountAccessSignature = D);
|
|
158
|
+
let O;
|
|
159
|
+
if (v.length > 0) try {
|
|
160
|
+
await a({
|
|
161
|
+
client: c,
|
|
162
|
+
headers: p,
|
|
163
|
+
body: {
|
|
164
|
+
type: "GRANT",
|
|
165
|
+
userIds: T,
|
|
166
|
+
debitCardIds: v
|
|
167
|
+
},
|
|
168
|
+
throwOnError: !0
|
|
169
|
+
}), await u(s({
|
|
170
|
+
client: c,
|
|
171
|
+
headers: p
|
|
172
|
+
}));
|
|
173
|
+
} catch (e) {
|
|
174
|
+
O = e ?? /* @__PURE__ */ Error("Card access failed");
|
|
175
|
+
}
|
|
176
|
+
return await b({
|
|
177
|
+
client: c,
|
|
178
|
+
organizationId: l,
|
|
179
|
+
departmentIds: [...S],
|
|
180
|
+
locationIds: [...C],
|
|
181
|
+
grantedBankAccounts: w
|
|
182
|
+
}), m.current = void 0, O === void 0 ? x.user : {
|
|
183
|
+
...x.user,
|
|
184
|
+
debitCardAccessError: O
|
|
185
|
+
};
|
|
164
186
|
} catch (e) {
|
|
165
|
-
throw
|
|
166
|
-
client:
|
|
167
|
-
organizationId:
|
|
168
|
-
departmentIds: [...
|
|
169
|
-
locationIds: [...
|
|
170
|
-
grantedBankAccounts:
|
|
187
|
+
throw x && await b({
|
|
188
|
+
client: c,
|
|
189
|
+
organizationId: l,
|
|
190
|
+
departmentIds: [...S],
|
|
191
|
+
locationIds: [...C],
|
|
192
|
+
grantedBankAccounts: w
|
|
171
193
|
}), e;
|
|
172
194
|
}
|
|
173
195
|
} });
|
|
174
196
|
}
|
|
175
197
|
//#endregion
|
|
176
|
-
export {
|
|
198
|
+
export { x as useInviteUserMutation };
|
package/dist/libs/tesouro-embedded-components-react/settings-widget/team/feature/dist/index12.js
CHANGED
|
@@ -3,22 +3,24 @@
|
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
5
|
import { toast as e } from "../../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
6
|
+
import { isAllPagesResolving as t } from "../../../../shared/data-access/dist/lib/allPages.js";
|
|
7
|
+
import { useAllBankAccountsQuery as n } from "../../../../shared/data-access/dist/lib/bank-account/useAllBankAccountsQuery.js";
|
|
8
|
+
import { useAllDebitCardsQuery as r } from "../../../../shared/data-access/dist/lib/debit-card/useAllDebitCardsQuery.js";
|
|
9
|
+
import { useAllExternalBankAccountsQuery as i } from "../../../../shared/data-access/dist/lib/external-bank-account/useAllExternalBankAccountsQuery.js";
|
|
10
|
+
import { useRolePermissionsQueries as a } from "../../../../shared/data-access/dist/lib/role/useRolePermissionsQueries.js";
|
|
9
11
|
import "../../../../shared/data-access/dist/index.js";
|
|
10
12
|
import "../../../../shared/ui/dist/index.js";
|
|
11
|
-
import { useAnalyticsTrack as
|
|
13
|
+
import { useAnalyticsTrack as o } from "../../../../shared/feature/dist/lib/analytics/hooks.js";
|
|
12
14
|
import "../../../../shared/feature/dist/index.js";
|
|
13
15
|
import { TeamWidgetAnalyticsEvent as ee } from "./index2.js";
|
|
14
|
-
import { useInviteUserMutation as
|
|
15
|
-
import { useAllTeamMembersQuery as
|
|
16
|
-
import { useAllDepartmentsQuery as
|
|
17
|
-
import { useAllLocationsQuery as
|
|
16
|
+
import { useInviteUserMutation as s } from "../../data-access/dist/index7.js";
|
|
17
|
+
import { useAllTeamMembersQuery as te } from "../../data-access/dist/index14.js";
|
|
18
|
+
import { useAllDepartmentsQuery as c } from "../../data-access/dist/index17.js";
|
|
19
|
+
import { useAllLocationsQuery as ne } from "../../data-access/dist/index21.js";
|
|
18
20
|
import "../../data-access/dist/index.js";
|
|
19
|
-
import { toNamedSelectOptions as
|
|
20
|
-
import { isAccountsSectionVisibleForRole as
|
|
21
|
-
import { resolveAcceptInviteRedirectUri as
|
|
21
|
+
import { toNamedSelectOptions as l, toReportingManagerOptions as re, toRoleCardOptions as ie } from "./index11.js";
|
|
22
|
+
import { isAccountsSectionVisibleForRole as ae, isAdminPermissionSet as oe, isDebitCardAdminPermissionSet as se, isEmployeePermissionSet as u, toAccountAccessInputs as ce, toAccountAccessOptions as le } from "./index7.js";
|
|
23
|
+
import { resolveAcceptInviteRedirectUri as ue } from "./index8.js";
|
|
22
24
|
import { useMemo as d, useState as f } from "react";
|
|
23
25
|
//#region ../../libs/tesouro-embedded-components-react/settings-widget/team/feature/dist/index12.js
|
|
24
26
|
var p = {
|
|
@@ -29,81 +31,87 @@ var p = {
|
|
|
29
31
|
reportingManager: "",
|
|
30
32
|
role: "",
|
|
31
33
|
accountAccess: []
|
|
32
|
-
},
|
|
33
|
-
function m({ canInvite: m, canReadDirectory:
|
|
34
|
-
let
|
|
34
|
+
}, de = /^\S+@\S+\.\S+$/;
|
|
35
|
+
function m({ canInvite: m, canReadDirectory: fe, canManageAccountAccess: h, canReadInternalAccounts: g, canReadExternalAccounts: _, canGrantDebitCardAccess: pe = !1, roles: v, roleCatalog: y = [], organizationId: b, featureLabels: x, acceptInviteRedirectUri: me }) {
|
|
36
|
+
let he = o(), [S, C] = f(!1), [w, T] = f(p), [ge, E] = f({}), D = s(), O = S && m && fe, k = c({ enabled: O }), A = ne({ enabled: O }), j = te({
|
|
35
37
|
Status: "ACTIVE",
|
|
36
|
-
enabled:
|
|
37
|
-
}),
|
|
38
|
-
roleIds:
|
|
39
|
-
enabled:
|
|
40
|
-
}),
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
]),
|
|
47
|
-
checking:
|
|
48
|
-
savings:
|
|
38
|
+
enabled: O
|
|
39
|
+
}), M = S && m && h, N = n({ enabled: M && g }), P = i({ enabled: M && _ }), F = S && m, I = d(() => v.map((e) => e.id), [v]), L = a({
|
|
40
|
+
roleIds: I,
|
|
41
|
+
enabled: F
|
|
42
|
+
}), R = S && m && pe, z = r({ enabled: R }), _e = d(() => ie(v), [v]), B = d(() => k.isComplete ? l(k.data?.data ?? []) : [], [k.isComplete, k.data?.data]), ve = d(() => A.isComplete ? l(A.data?.data ?? []) : [], [A.isComplete, A.data?.data]), ye = d(() => j.isComplete ? re(j.data?.data ?? [], y, x, b) : [], [
|
|
43
|
+
j.isComplete,
|
|
44
|
+
j.data?.data,
|
|
45
|
+
y,
|
|
46
|
+
x,
|
|
47
|
+
b
|
|
48
|
+
]), V = O && !k.isComplete && !k.isError, H = O && !A.isComplete && !A.isError, U = O && !j.isComplete && !j.isError, be = O && k.isError, xe = O && A.isError, Se = O && j.isError, Ce = !g || !!N.data && !N.hasNextPage && !N.isFetchingNextPage, we = !_ || !!P.data && !P.hasNextPage && !P.isFetchingNextPage, W = !!w.role && L.resolvingRoleIds.has(w.role), G = F && !!w.role && (W || !L.byRoleId.has(w.role)) && !W, K = M && (g && N.isError || _ && P.isError || G), q = M && !K && (!Ce || !we || W), J = d(() => le(g ? N.data?.data ?? [] : [], _ ? P.data?.data ?? [] : [], {
|
|
49
|
+
checking: x.accountTypeChecking,
|
|
50
|
+
savings: x.accountTypeSavings
|
|
49
51
|
}), [
|
|
52
|
+
g,
|
|
50
53
|
_,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
]), _e = X.options, Z = z.byRoleId.get(E.role), Q = ae(Z), $ = g && ie(!!E.role, l(Z)), ve = g && l(Z), ye = $ ? Q ? "admin" : "picker" : ve ? "employee" : "hidden";
|
|
54
|
+
N.data?.data,
|
|
55
|
+
P.data?.data,
|
|
56
|
+
x.accountTypeChecking,
|
|
57
|
+
x.accountTypeSavings
|
|
58
|
+
]), Te = J.options, Y = L.byRoleId.get(w.role), X = oe(Y), Z = R && se(Y), Q = Z && (t(z) || z.isFetching), Ee = Z && z.isError, $ = h && ae(!!w.role, u(Y)), De = h && u(Y), Oe = $ ? X ? "admin" : "picker" : De ? "employee" : "hidden";
|
|
57
59
|
return {
|
|
58
|
-
isInviteOpen:
|
|
59
|
-
inviteForm:
|
|
60
|
-
inviteErrors:
|
|
61
|
-
isInviting:
|
|
62
|
-
inviteErrorMessage:
|
|
63
|
-
roleOptions:
|
|
64
|
-
departmentOptions:
|
|
65
|
-
locationOptions:
|
|
66
|
-
reportingManagerOptions:
|
|
67
|
-
accountAccessOptions:
|
|
68
|
-
departmentsLoading:
|
|
69
|
-
locationsLoading:
|
|
70
|
-
reportingManagersLoading:
|
|
71
|
-
departmentsError:
|
|
72
|
-
locationsError:
|
|
73
|
-
reportingManagersError:
|
|
74
|
-
accountAccessLoading:
|
|
75
|
-
accountAccessError:
|
|
76
|
-
accountAccessMode:
|
|
60
|
+
isInviteOpen: S,
|
|
61
|
+
inviteForm: w,
|
|
62
|
+
inviteErrors: ge,
|
|
63
|
+
isInviting: D.isPending,
|
|
64
|
+
inviteErrorMessage: D.isError ? x.inviteFailedError : void 0,
|
|
65
|
+
roleOptions: _e,
|
|
66
|
+
departmentOptions: B,
|
|
67
|
+
locationOptions: ve,
|
|
68
|
+
reportingManagerOptions: ye,
|
|
69
|
+
accountAccessOptions: Te,
|
|
70
|
+
departmentsLoading: V,
|
|
71
|
+
locationsLoading: H,
|
|
72
|
+
reportingManagersLoading: U,
|
|
73
|
+
departmentsError: be,
|
|
74
|
+
locationsError: xe,
|
|
75
|
+
reportingManagersError: Se,
|
|
76
|
+
accountAccessLoading: q,
|
|
77
|
+
accountAccessError: K,
|
|
78
|
+
accountAccessMode: Oe,
|
|
79
|
+
isInviteSubmitBlocked: Q,
|
|
77
80
|
openInviteForm: () => {
|
|
78
|
-
m && (
|
|
81
|
+
m && (T(p), E({}), D.reset(), C(!0));
|
|
79
82
|
},
|
|
80
83
|
closeInviteForm: () => {
|
|
81
|
-
|
|
84
|
+
C(!1);
|
|
82
85
|
},
|
|
83
|
-
onInviteFormChange:
|
|
86
|
+
onInviteFormChange: T,
|
|
84
87
|
onInviteSubmit: () => {
|
|
85
|
-
if (!m ||
|
|
86
|
-
let t = {}, n =
|
|
87
|
-
n || (t.name =
|
|
88
|
-
let i =
|
|
89
|
-
if (
|
|
90
|
-
let a = $ ?
|
|
91
|
-
|
|
88
|
+
if (!m || V || H || U || $ && (q || K) || W || Q) return;
|
|
89
|
+
let t = {}, n = w.name.trim(), r = w.email.trim();
|
|
90
|
+
n || (t.name = x.nameRequiredError), r ? de.test(r) || (t.email = x.emailInvalidError) : t.email = x.emailRequiredError;
|
|
91
|
+
let i = w.role;
|
|
92
|
+
if (v.some((e) => e.id === i) ? G ? t.role = x.rolePermissionsUnavailableError : X && !h ? t.role = x.roleNeedsAccountAccessError : Ee && (t.role = x.debitCardsUnavailableError, z.refetch()) : t.role = x.roleRequiredError, E(t), t.name || t.email || t.role) return;
|
|
93
|
+
let a = $ ? X ? J.allAccountIds : w.accountAccess : [], o = ce(a, J.descriptors), s = Z ? (z.data?.data ?? []).map((e) => e.id) : [];
|
|
94
|
+
D.mutate({
|
|
92
95
|
body: {
|
|
93
96
|
name: n,
|
|
94
97
|
email: r,
|
|
95
98
|
status: "INVITED",
|
|
96
|
-
reportingManagerUserId:
|
|
99
|
+
reportingManagerUserId: w.reportingManager || null,
|
|
97
100
|
permissionIds: [],
|
|
98
|
-
redirectUri:
|
|
101
|
+
redirectUri: ue(me)
|
|
99
102
|
},
|
|
100
103
|
roleId: i,
|
|
101
|
-
departmentId:
|
|
102
|
-
locationId:
|
|
103
|
-
bankAccountAccess: o
|
|
104
|
+
departmentId: w.department || void 0,
|
|
105
|
+
locationId: w.location || void 0,
|
|
106
|
+
bankAccountAccess: o,
|
|
107
|
+
debitCardIds: s
|
|
104
108
|
}, {
|
|
105
109
|
onSuccess: (t) => {
|
|
106
|
-
|
|
110
|
+
if (he(ee.MemberInvited, { memberId: t?.id }), C(!1), t?.debitCardAccessError !== void 0) {
|
|
111
|
+
console.error("Failed to grant card access to invite:", t.debitCardAccessError), e.warning(x.inviteCardAccessWarningToast);
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
e.success(x.inviteSuccessToast);
|
|
107
115
|
},
|
|
108
116
|
onError: (e) => {
|
|
109
117
|
console.error("Failed to send team invite:", e);
|