@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.
@@ -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, updateUser as a } from "../../../../shared/data-access/dist/lib/rest/sdk.gen.js";
6
- import { getDepartmentQueryKey as o, getLocationQueryKey as s } from "../../../../shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js";
7
- import { invalidateAllClients as c } from "../../../../shared/data-access/dist/lib/clientRegistry.js";
8
- import { useEmbedApi as l } from "../../../../shared/data-access/dist/lib/EmbedApiContext.js";
9
- import { organizationHeaders as u } from "../../../../shared/data-access/dist/lib/organizationHeaders.js";
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 d } from "./index2.js";
12
- import { accountAccessInvalidationKeyForSource as f } from "./index3.js";
13
- import { departmentsInvalidationKey as p } from "./index5.js";
14
- import { locationsInvalidationKey as m } from "./index6.js";
15
- import { useRef as h } from "react";
16
- import { useMutation as g } from "@tanstack/react-query";
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 _(e) {
18
+ function y(e) {
19
19
  return e.map((e) => `${e.source}:${e.bankAccountId}`).sort().join(",");
20
20
  }
21
- async function v({ client: e, organizationId: t, departmentIds: n, locationIds: r, grantedBankAccounts: i = [] }) {
22
- let a = u(t);
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
- c(d({
24
+ u(p({
25
25
  client: e,
26
26
  organizationId: t
27
27
  })),
28
- c(p({
28
+ u(h({
29
29
  client: e,
30
30
  organizationId: t
31
31
  })),
32
- c(m({
32
+ u(g({
33
33
  client: e,
34
34
  organizationId: t
35
35
  })),
36
- ...n.map((t) => c(o({
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) => c(s({
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) => c(f({
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 y() {
55
- let { client: o, organizationId: s } = l(), c = u(s), d = h(void 0);
56
- return g({ mutationFn: async ({ body: l, roleId: u, departmentId: f, locationId: p, bankAccountAccess: m = [] }) => {
57
- let h = d.current?.email === l.email ? d.current : void 0, g = /* @__PURE__ */ new Set(), y = /* @__PURE__ */ new Set(), b = [];
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 (!h) {
59
+ if (!x) {
60
60
  let { data: e } = await r({
61
- client: o,
62
- headers: c,
63
- body: l,
61
+ client: c,
62
+ headers: p,
63
+ body: d,
64
64
  throwOnError: !0
65
65
  });
66
- h = {
67
- email: l.email,
66
+ x = {
67
+ email: d.email,
68
68
  user: e,
69
- createdReportingManagerUserId: l.reportingManagerUserId ?? null
70
- }, d.current = h;
69
+ createdReportingManagerUserId: d.reportingManagerUserId ?? null
70
+ }, m.current = x;
71
71
  }
72
- let x = [h.user.id], S = l.reportingManagerUserId ?? null;
73
- if (h.createdReportingManagerUserId !== S && (await a({
74
- client: o,
75
- headers: c,
76
- path: { id: h.user.id },
77
- body: { reportingManagerUserId: S },
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
- }), h.createdReportingManagerUserId = S), h.assignedRoleId !== u && (h.assignedRoleId && (await n({
80
- client: o,
81
- headers: c,
82
- path: { roleId: h.assignedRoleId },
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: x
85
+ userIds: T
86
86
  },
87
87
  throwOnError: !0
88
- }), h.assignedRoleId = void 0), await n({
89
- client: o,
90
- headers: c,
91
- path: { roleId: u },
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: x
94
+ userIds: T
95
95
  },
96
96
  throwOnError: !0
97
- }), h.assignedRoleId = u), h.assignedDepartmentId !== (f || void 0)) {
98
- if (h.assignedDepartmentId) {
99
- let t = h.assignedDepartmentId;
97
+ }), x.assignedRoleId = f), x.assignedDepartmentId !== (h || void 0)) {
98
+ if (x.assignedDepartmentId) {
99
+ let t = x.assignedDepartmentId;
100
100
  await e({
101
- client: o,
102
- headers: c,
101
+ client: c,
102
+ headers: p,
103
103
  path: { departmentId: t },
104
104
  body: {
105
105
  type: "REMOVE",
106
- userIds: x
106
+ userIds: T
107
107
  },
108
108
  throwOnError: !0
109
- }), g.add(t), h.assignedDepartmentId = void 0;
109
+ }), S.add(t), x.assignedDepartmentId = void 0;
110
110
  }
111
- f && (await e({
112
- client: o,
113
- headers: c,
114
- path: { departmentId: f },
111
+ h && (await e({
112
+ client: c,
113
+ headers: p,
114
+ path: { departmentId: h },
115
115
  body: {
116
116
  type: "ASSIGN",
117
- userIds: x
117
+ userIds: T
118
118
  },
119
119
  throwOnError: !0
120
- }), g.add(f), h.assignedDepartmentId = f);
120
+ }), S.add(h), x.assignedDepartmentId = h);
121
121
  }
122
- if (h.assignedLocationId !== (p || void 0)) {
123
- if (h.assignedLocationId) {
124
- let e = h.assignedLocationId;
122
+ if (x.assignedLocationId !== (g || void 0)) {
123
+ if (x.assignedLocationId) {
124
+ let e = x.assignedLocationId;
125
125
  await t({
126
- client: o,
127
- headers: c,
126
+ client: c,
127
+ headers: p,
128
128
  path: { locationId: e },
129
129
  body: {
130
130
  type: "REMOVE",
131
- userIds: x
131
+ userIds: T
132
132
  },
133
133
  throwOnError: !0
134
- }), y.add(e), h.assignedLocationId = void 0;
134
+ }), C.add(e), x.assignedLocationId = void 0;
135
135
  }
136
- p && (await t({
137
- client: o,
138
- headers: c,
139
- path: { locationId: p },
136
+ g && (await t({
137
+ client: c,
138
+ headers: p,
139
+ path: { locationId: g },
140
140
  body: {
141
141
  type: "ASSIGN",
142
- userIds: x
142
+ userIds: T
143
143
  },
144
144
  throwOnError: !0
145
- }), y.add(p), h.assignedLocationId = p);
145
+ }), C.add(g), x.assignedLocationId = g);
146
146
  }
147
- let C = _(m);
148
- return m.length > 0 && h.grantedBankAccountAccessSignature !== C && (await i({
149
- client: o,
150
- headers: c,
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: x,
154
- bankAccounts: m
153
+ userIds: T,
154
+ bankAccounts: _
155
155
  },
156
156
  throwOnError: !0
157
- }), b.push(...m), h.grantedBankAccountAccessSignature = C), await v({
158
- client: o,
159
- organizationId: s,
160
- departmentIds: [...g],
161
- locationIds: [...y],
162
- grantedBankAccounts: b
163
- }), d.current = void 0, h.user;
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 h && await v({
166
- client: o,
167
- organizationId: s,
168
- departmentIds: [...g],
169
- locationIds: [...y],
170
- grantedBankAccounts: b
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 { y as useInviteUserMutation };
198
+ export { x as useInviteUserMutation };
@@ -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 { useAllBankAccountsQuery as t } from "../../../../shared/data-access/dist/lib/bank-account/useAllBankAccountsQuery.js";
7
- import { useAllExternalBankAccountsQuery as n } from "../../../../shared/data-access/dist/lib/external-bank-account/useAllExternalBankAccountsQuery.js";
8
- import { useRolePermissionsQueries as r } from "../../../../shared/data-access/dist/lib/role/useRolePermissionsQueries.js";
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 i } from "../../../../shared/feature/dist/lib/analytics/hooks.js";
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 a } from "../../data-access/dist/index7.js";
15
- import { useAllTeamMembersQuery as o } from "../../data-access/dist/index14.js";
16
- import { useAllDepartmentsQuery as s } from "../../data-access/dist/index17.js";
17
- import { useAllLocationsQuery as te } from "../../data-access/dist/index21.js";
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 c, toReportingManagerOptions as ne, toRoleCardOptions as re } from "./index11.js";
20
- import { isAccountsSectionVisibleForRole as ie, isAdminPermissionSet as ae, isEmployeePermissionSet as l, toAccountAccessInputs as oe, toAccountAccessOptions as se } from "./index7.js";
21
- import { resolveAcceptInviteRedirectUri as u } from "./index8.js";
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
- }, ce = /^\S+@\S+\.\S+$/;
33
- function m({ canInvite: m, canReadDirectory: h, canManageAccountAccess: g, canReadInternalAccounts: _, canReadExternalAccounts: v, roles: y, roleCatalog: b = [], organizationId: x, featureLabels: S, acceptInviteRedirectUri: le }) {
34
- let C = i(), [w, T] = f(!1), [E, D] = f(p), [ue, O] = f({}), k = a(), A = w && m && h, j = s({ enabled: A }), M = te({ enabled: A }), N = o({
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: A
37
- }), P = w && m && g, F = t({ enabled: P && _ }), I = n({ enabled: P && v }), L = w && m, R = d(() => y.map((e) => e.id), [y]), z = r({
38
- roleIds: R,
39
- enabled: L
40
- }), B = d(() => re(y), [y]), V = d(() => j.isComplete ? c(j.data?.data ?? []) : [], [j.isComplete, j.data?.data]), H = d(() => M.isComplete ? c(M.data?.data ?? []) : [], [M.isComplete, M.data?.data]), de = d(() => N.isComplete ? ne(N.data?.data ?? [], b, S, x) : [], [
41
- N.isComplete,
42
- N.data?.data,
43
- b,
44
- S,
45
- x
46
- ]), U = A && !j.isComplete && !j.isError, W = A && !M.isComplete && !M.isError, G = A && !N.isComplete && !N.isError, fe = A && j.isError, pe = A && M.isError, me = A && N.isError, he = !_ || !!F.data && !F.hasNextPage && !F.isFetchingNextPage, ge = !v || !!I.data && !I.hasNextPage && !I.isFetchingNextPage, K = !!E.role && z.resolvingRoleIds.has(E.role), q = L && !!E.role && (K || !z.byRoleId.has(E.role)) && !K, J = P && (_ && F.isError || v && I.isError || q), Y = P && !J && (!he || !ge || K), X = d(() => se(_ ? F.data?.data ?? [] : [], v ? I.data?.data ?? [] : [], {
47
- checking: S.accountTypeChecking,
48
- savings: S.accountTypeSavings
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
- v,
52
- F.data?.data,
53
- I.data?.data,
54
- S.accountTypeChecking,
55
- S.accountTypeSavings
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: w,
59
- inviteForm: E,
60
- inviteErrors: ue,
61
- isInviting: k.isPending,
62
- inviteErrorMessage: k.isError ? S.inviteFailedError : void 0,
63
- roleOptions: B,
64
- departmentOptions: V,
65
- locationOptions: H,
66
- reportingManagerOptions: de,
67
- accountAccessOptions: _e,
68
- departmentsLoading: U,
69
- locationsLoading: W,
70
- reportingManagersLoading: G,
71
- departmentsError: fe,
72
- locationsError: pe,
73
- reportingManagersError: me,
74
- accountAccessLoading: Y,
75
- accountAccessError: J,
76
- accountAccessMode: ye,
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 && (D(p), O({}), k.reset(), T(!0));
81
+ m && (T(p), E({}), D.reset(), C(!0));
79
82
  },
80
83
  closeInviteForm: () => {
81
- T(!1);
84
+ C(!1);
82
85
  },
83
- onInviteFormChange: D,
86
+ onInviteFormChange: T,
84
87
  onInviteSubmit: () => {
85
- if (!m || U || W || G || $ && (Y || J) || K) return;
86
- let t = {}, n = E.name.trim(), r = E.email.trim();
87
- n || (t.name = S.nameRequiredError), r ? ce.test(r) || (t.email = S.emailInvalidError) : t.email = S.emailRequiredError;
88
- let i = E.role;
89
- if (y.some((e) => e.id === i) ? q ? t.role = S.rolePermissionsUnavailableError : Q && !g && (t.role = S.roleNeedsAccountAccessError) : t.role = S.roleRequiredError, O(t), t.name || t.email || t.role) return;
90
- let a = $ ? Q ? X.allAccountIds : E.accountAccess : [], o = oe(a, X.descriptors);
91
- k.mutate({
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: E.reportingManager || null,
99
+ reportingManagerUserId: w.reportingManager || null,
97
100
  permissionIds: [],
98
- redirectUri: u(le)
101
+ redirectUri: ue(me)
99
102
  },
100
103
  roleId: i,
101
- departmentId: E.department || void 0,
102
- locationId: E.location || void 0,
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
- C(ee.MemberInvited, { memberId: t?.id }), e.success(S.inviteSuccessToast), T(!1);
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);