@tesouro/embedded-components-react 0.4.24 → 0.4.25

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.
@@ -4,195 +4,209 @@
4
4
  "use client";
5
5
  import { useAllBankAccountsQuery as e } from "../../../shared/data-access/dist/lib/bank-account/useAllBankAccountsQuery.js";
6
6
  import { useAllExternalBankAccountsQuery as t } from "../../../shared/data-access/dist/lib/external-bank-account/useAllExternalBankAccountsQuery.js";
7
+ import { useRolePermissionsQueries as n } from "../../../shared/data-access/dist/lib/role/useRolePermissionsQueries.js";
8
+ import { useAllOrganizationUsersQuery as r } from "../../../shared/data-access/dist/lib/user/useAllOrganizationUsersQuery.js";
7
9
  import "../../../shared/data-access/dist/index.js";
8
- import { useAnalyticsTrack as n } from "../../../shared/feature/dist/lib/analytics/hooks.js";
10
+ import { useAnalyticsTrack as i } from "../../../shared/feature/dist/lib/analytics/hooks.js";
9
11
  import "../../../shared/feature/dist/index.js";
10
- import { TeamWidgetAnalyticsEvent as r } from "./index2.js";
11
- import { useManageBankAccountAccessMutation as i } from "../../data-access/dist/index9.js";
12
- import { useUserBankAccountAccessQuery as a } from "../../data-access/dist/index10.js";
13
- import { useAllTeamMembersQuery as o } from "../../data-access/dist/index14.js";
14
- import { useUpdateTeamMemberMutation as s } from "../../data-access/dist/index15.js";
15
- import { useAllDepartmentsQuery as c } from "../../data-access/dist/index17.js";
16
- import { useAllLocationsQuery as l } from "../../data-access/dist/index21.js";
12
+ import { TeamWidgetAnalyticsEvent as ee } from "./index2.js";
13
+ import { useManageBankAccountAccessMutation as a } from "../../data-access/dist/index9.js";
14
+ import { useUserBankAccountAccessQuery as o } from "../../data-access/dist/index10.js";
15
+ import { useAllTeamMembersQuery as te } from "../../data-access/dist/index14.js";
16
+ import { useUpdateTeamMemberMutation as ne } from "../../data-access/dist/index15.js";
17
+ import { useAllDepartmentsQuery as re } from "../../data-access/dist/index17.js";
18
+ import { useAllLocationsQuery as ie } from "../../data-access/dist/index21.js";
17
19
  import "../../data-access/dist/index.js";
18
- import { isMemberActionable as ee, resolveMemberRoleId as te, toNamedSelectOptions as ne, toReportingManagerOptions as re, toRoleCardOptions as ie } from "./index11.js";
19
- import { isAdminRoleKey as u, isEmployeeRoleKey as ae, resolveRoleKeyById as oe, toAccountAccessInputs as se, toAccountAccessOptions as ce } from "./index7.js";
20
- import { useCallback as le, useEffect as ue, useMemo as d, useState as f } from "react";
20
+ import { isMemberActionable as ae, isMemberInvited as oe, resolveMemberRoleId as se, toNamedSelectOptions as ce, toReportingManagerOptions as le, toRoleCardOptions as ue } from "./index11.js";
21
+ import { ACCOUNT_ACCESS_ADMIN_PERMISSION_KEY as de, ACCOUNT_ACCESS_VISIBILITY_PERMISSION_KEYS as fe, isAdminPermissionSet as pe, isEmployeePermissionSet as me, toAccountAccessInputs as he, toAccountAccessOptions as ge } from "./index7.js";
22
+ import { useCallback as _e, useEffect as ve, useMemo as s, useState as c } from "react";
21
23
  //#region ../../libs/tesouro-embedded-components-react/team-widget/feature/dist/index15.js
22
- var de = {
24
+ var ye = {
23
25
  name: "",
24
26
  role: "",
25
27
  department: "",
26
28
  location: "",
27
29
  reportingManager: ""
28
30
  };
29
- function fe({ member: e, organizationId: t, canEditAnyProfile: n, canEditOrgProfile: r, currentUserId: i }) {
31
+ function be({ member: e, organizationId: t, canEditAnyProfile: n, canEditOrgProfile: r, currentUserId: i }) {
30
32
  return i && e.id === i ? !1 : n ? !0 : r && !!t && e.organizationId === t;
31
33
  }
32
- function pe({ member: e, organizationId: t, canEditRole: n, currentUserId: r }) {
34
+ function xe({ member: e, organizationId: t, canEditRole: n, currentUserId: r }) {
33
35
  return r && e.id === r ? !1 : n && !!t && e.organizationId === t;
34
36
  }
35
- function me({ canEditAnyProfile: me, canEditOrgProfile: he, organizationId: p, currentUserId: m, canEditRole: ge, canReadDirectory: _e, canManageAccountAccess: ve, canReadInternalAccounts: h, canReadExternalAccounts: g, members: ye, roles: _, roleCatalog: be = [], featureLabels: v }) {
36
- let xe = n(), [y, b] = f(), [x, Se] = f(de), [Ce, we] = f({}), [S, C] = f([]), [Te, w] = f(!1), [T, E] = f([]), D = s(), O = i(), k = !!y && _e, A = c({ enabled: k }), j = l({ enabled: k }), M = o({
37
+ function Se({ canEditAnyProfile: Se, canEditOrgProfile: Ce, organizationId: l, currentUserId: u, canEditRole: we, canReadDirectory: Te, canManageAccountAccess: Ee, canReadInternalAccounts: d, canReadExternalAccounts: f, members: De, roles: p, allRoles: Oe = p, roleCatalog: ke = [], featureLabels: m }) {
38
+ let Ae = i(), [h, g] = c(), [_, je] = c(ye), [Me, v] = c({}), [Ne, y] = c([]), [Pe, b] = c(!1), [x, S] = c([]), C = ne(), w = a(), T = !!h && Te, E = re({ enabled: T }), D = ie({ enabled: T }), O = te({
37
39
  Status: "ACTIVE",
38
- enabled: k
39
- }), Ee = y ? ye.find((e) => e.id === y.memberId) : void 0, N = ee(Ee) ? Ee : void 0, De = !!y && !N;
40
- ue(() => {
41
- De && b(void 0);
42
- }, [De]);
43
- let Oe = N?.id, P = !!N && ve && !(m && Oe === m), F = u(N?.role ?? ""), ke = ae(N?.role ?? ""), I = P, L = e({ enabled: I && h }), R = t({ enabled: I && g }), Ae = !h || !!L.data && !L.hasNextPage && !L.isFetchingNextPage, je = !g || !!R.data && !R.hasNextPage && !R.isFetchingNextPage, z = I && Ae && je, Me = I && (h && L.isError || g && R.isError), B = d(() => ce(h ? L.data?.data ?? [] : [], g ? R.data?.data ?? [] : [], {
44
- checking: v.accountTypeChecking,
45
- savings: v.accountTypeSavings
40
+ enabled: T
41
+ }), Fe = h ? De.find((e) => e.id === h.memberId) : void 0, k = ae(Fe) ? Fe : void 0, Ie = !!h && !k;
42
+ ve(() => {
43
+ Ie && g(void 0);
44
+ }, [Ie]);
45
+ let A = k?.id, j = !!k && Ee && !(u && A === u), M = oe(k), N = se(Oe, h?.baselineRoleKey) ?? "", Le = s(() => {
46
+ let e = p.map((e) => e.id);
47
+ return N && !e.includes(N) ? [...e, N] : e;
48
+ }, [p, N]), P = n({
49
+ roleIds: Le,
50
+ enabled: !!h?.canEditRole || j && M
51
+ }), F = r({
52
+ enabled: j && !M,
53
+ permissions: [de]
54
+ }), I = r({
55
+ enabled: j && !M,
56
+ permissions: [...fe]
57
+ }), L = j && (M ? P.resolvingRoleIds.has(N) : F.isResolving || I.isResolving), R = j && (M ? !P.resolvingRoleIds.has(N) && !P.byRoleId.has(N) : F.isError || I.isError), z = !!(A && !L && !R && (M ? pe(P.byRoleId.get(N)) : (F.data?.data ?? []).some((e) => e.id === A))), Re = !!(A && !L && !R && (M ? me(P.byRoleId.get(N)) : !(I.data?.data ?? []).some((e) => e.id === A))), B = j, V = e({ enabled: B && d }), H = t({ enabled: B && f }), ze = !d || !!V.data && !V.hasNextPage && !V.isFetchingNextPage, Be = !f || !!H.data && !H.hasNextPage && !H.isFetchingNextPage, Ve = B && ze && Be && !L, He = B && (d && V.isError || f && H.isError || R), U = s(() => ge(d ? V.data?.data ?? [] : [], f ? H.data?.data ?? [] : [], {
58
+ checking: m.accountTypeChecking,
59
+ savings: m.accountTypeSavings
46
60
  }), [
47
- h,
48
- g,
49
- L.data?.data,
50
- R.data?.data,
51
- v.accountTypeChecking,
52
- v.accountTypeSavings
53
- ]), Ne = d(() => [...B.descriptors.values()].map((e) => ({
61
+ d,
62
+ f,
63
+ V.data?.data,
64
+ H.data?.data,
65
+ m.accountTypeChecking,
66
+ m.accountTypeSavings
67
+ ]), Ue = s(() => [...U.descriptors.values()].map((e) => ({
54
68
  bankAccountId: e.bankAccountId,
55
69
  source: e.source
56
- })), [B.descriptors]), V = a({
57
- userId: Oe,
58
- accounts: Ne,
59
- enabled: P && !F && z
60
- }), Pe = Ne.length === 0 || V.isComplete, H = d(() => F ? B.allAccountIds : [...V.accessibleAccountIds], [
61
- F,
62
- B.allAccountIds,
63
- V.accessibleAccountIds
64
- ]), U = P && (Me || !F && V.isError), W = P && !U && (!z || !F && !Pe), Fe = P && !Te && z && (F || Pe);
65
- ue(() => {
66
- Fe && (C(H), E(H), w(!0));
67
- }, [Fe, H]);
68
- let G = oe(_, x.role), K = G ? u(G) : F, q = G ? ae(G) : ke, Ie = P ? K ? "admin" : q ? "employee" : "picker" : "hidden", Le = d(() => B.options.map((e) => ({
70
+ })), [U.descriptors]), W = o({
71
+ userId: A,
72
+ accounts: Ue,
73
+ enabled: j && !z && Ve
74
+ }), We = Ue.length === 0 || W.isComplete, Ge = s(() => z ? U.allAccountIds : [...W.accessibleAccountIds], [
75
+ z,
76
+ U.allAccountIds,
77
+ W.accessibleAccountIds
78
+ ]), G = j && (He || !z && W.isError), Ke = j && !G && (!Ve || !z && !We), qe = j && !Pe && Ve && (z || We);
79
+ ve(() => {
80
+ qe && (y(Ge), S(Ge), b(!0));
81
+ }, [qe, Ge]);
82
+ let K = _.role !== N && p.some((e) => e.id === _.role), Je = K && P.resolvingRoleIds.has(_.role), Ye = K && (Je || !P.byRoleId.has(_.role)), Xe = Ye && !Je, q = K ? pe(P.byRoleId.get(_.role)) : z, J = K ? me(P.byRoleId.get(_.role)) : Re, Ze = j ? q ? "admin" : J ? "employee" : "picker" : "hidden", Qe = s(() => U.options.map((e) => ({
69
83
  ...e,
70
- checked: K ? !0 : !q && S.includes(e.value)
84
+ checked: q ? !0 : !J && Ne.includes(e.value)
71
85
  })), [
72
- B.options,
73
- K,
86
+ U.options,
74
87
  q,
75
- S
76
- ]), Re = le((e, t) => {
77
- C((n) => t ? n.includes(e) ? n : [...n, e] : n.filter((t) => t !== e));
78
- }, []), J = K ? B.allAccountIds : q ? [] : S, ze = d(() => new Set(T), [T]), Be = d(() => new Set(J), [J]), Ve = d(() => J.filter((e) => !ze.has(e)), [J, ze]), He = d(() => T.filter((e) => !Be.has(e)), [T, Be]), Ue = P && Te && (Ve.length > 0 || He.length > 0), We = (e) => {
79
- let t = ye.find((t) => t.id === e);
88
+ J,
89
+ Ne
90
+ ]), $e = _e((e, t) => {
91
+ y((n) => t ? n.includes(e) ? n : [...n, e] : n.filter((t) => t !== e));
92
+ }, []), Y = q ? U.allAccountIds : J ? [] : Ne, et = s(() => new Set(x), [x]), tt = s(() => new Set(Y), [Y]), nt = s(() => Y.filter((e) => !et.has(e)), [Y, et]), rt = s(() => x.filter((e) => !tt.has(e)), [x, tt]), it = j && Pe && (nt.length > 0 || rt.length > 0), at = (e) => {
93
+ let t = De.find((t) => t.id === e);
80
94
  if (!t) return;
81
- let n = fe({
95
+ let n = be({
82
96
  member: t,
83
- organizationId: p,
84
- canEditAnyProfile: me,
85
- canEditOrgProfile: he,
86
- currentUserId: m
87
- }), r = pe({
97
+ organizationId: l,
98
+ canEditAnyProfile: Se,
99
+ canEditOrgProfile: Ce,
100
+ currentUserId: u
101
+ }), r = xe({
88
102
  member: t,
89
- organizationId: p,
90
- canEditRole: ge,
91
- currentUserId: m
92
- }), i = ve && t.id !== m;
103
+ organizationId: l,
104
+ canEditRole: we,
105
+ currentUserId: u
106
+ }), i = Ee && t.id !== u;
93
107
  if (!n && !r && !i) return;
94
- let a = t.name, o = te(_, t.role) ?? "", s = t.department?.id ?? "", c = t.location?.id ?? "", l = t.reportingManagerUserId ?? "";
95
- Se({
96
- name: a,
108
+ let ee = t.name, a = t.role ?? "", o = se(Oe, a) ?? "", te = t.department?.id ?? "", ne = t.location?.id ?? "", re = t.reportingManagerUserId ?? "";
109
+ je({
110
+ name: ee,
97
111
  role: o,
98
- department: s,
99
- location: c,
100
- reportingManager: l
101
- }), we({}), D.reset(), O.reset(), C([]), E([]), w(!1), b({
112
+ department: te,
113
+ location: ne,
114
+ reportingManager: re
115
+ }), v({}), C.reset(), w.reset(), y([]), S([]), b(!1), g({
102
116
  memberId: e,
103
117
  canEditProfile: n,
104
118
  canEditRole: r,
105
- baselineName: a,
106
- baselineRoleId: o,
107
- baselineDepartmentId: s,
108
- baselineLocationId: c,
109
- baselineReportingManagerId: l
119
+ baselineName: ee,
120
+ baselineRoleKey: a,
121
+ baselineDepartmentId: te,
122
+ baselineLocationId: ne,
123
+ baselineReportingManagerId: re
110
124
  });
111
- }, Ge = (e) => {
112
- e || (b(void 0), C([]), E([]), w(!1));
113
- }, Y = x.name.trim(), X = y?.canEditProfile ?? !1, Z = y?.canEditRole ?? !1, Ke = y?.baselineName ?? "", Q = y?.baselineRoleId ?? "", qe = y?.baselineDepartmentId ?? "", Je = y?.baselineLocationId ?? "", Ye = y?.baselineReportingManagerId ?? "", Xe = X && x.reportingManager !== Ye, Ze = Z && x.department !== qe, Qe = Z && x.location !== Je, $e = N ? X && Y !== Ke || Z && x.role !== Q || Xe || Ze || Qe || Ue : !1, et = Z && x.role !== Q && _.some((e) => e.id === x.role) && (u(G) || ae(G)) && !P, tt = () => {
114
- if (et || P && (W || U) || !N || !X && !Z && !P) return;
115
- if (X && !Y) {
116
- we({ name: v.nameRequiredError });
125
+ }, ot = (e) => {
126
+ e || (g(void 0), y([]), S([]), b(!1));
127
+ }, X = _.name.trim(), Z = h?.canEditProfile ?? !1, Q = h?.canEditRole ?? !1, st = h?.baselineName ?? "", ct = h?.baselineDepartmentId ?? "", lt = h?.baselineLocationId ?? "", ut = h?.baselineReportingManagerId ?? "", dt = Z && _.reportingManager !== ut, ft = Q && _.department !== ct, pt = Q && _.location !== lt, mt = k ? Z && X !== st || Q && _.role !== N || dt || ft || pt || it : !1, ht = Q && K && (q || J) && !j, gt = () => {
128
+ if (ht || Ye || j && (Ke || G) || !k || !Z && !Q && !j) return;
129
+ if (Z && !X) {
130
+ v({ name: m.nameRequiredError });
117
131
  return;
118
132
  }
119
- we({});
133
+ v({});
120
134
  let e = {};
121
- X && Y !== Ke && (e.name = Y), Xe && (e.reportingManagerUserId = x.reportingManager || null);
122
- let t = Z && _.some((e) => e.id === x.role) ? x.role : void 0, n = t && t !== Q ? {
135
+ Z && X !== st && (e.name = X), dt && (e.reportingManagerUserId = _.reportingManager || null);
136
+ let t = Q && p.some((e) => e.id === _.role) ? _.role : void 0, n = t && t !== N ? {
123
137
  addRoleId: t,
124
- removeRoleId: Q || void 0
125
- } : void 0, i = Ze ? {
126
- removeId: qe || void 0,
127
- addId: x.department || void 0
128
- } : void 0, a = Qe ? {
129
- removeId: Je || void 0,
130
- addId: x.location || void 0
131
- } : void 0, o = Object.keys(e).length > 0 || !!n || !!i || !!a;
132
- if (!o && !Ue) return;
133
- let s = N.id;
138
+ removeRoleId: N || void 0
139
+ } : void 0, r = ft ? {
140
+ removeId: ct || void 0,
141
+ addId: _.department || void 0
142
+ } : void 0, i = pt ? {
143
+ removeId: lt || void 0,
144
+ addId: _.location || void 0
145
+ } : void 0, a = Object.keys(e).length > 0 || !!n || !!r || !!i;
146
+ if (!a && !it) return;
147
+ let o = k.id;
134
148
  (async () => {
135
149
  try {
136
- He.length > 0 && await O.mutateAsync({
137
- userIds: [s],
150
+ rt.length > 0 && await w.mutateAsync({
151
+ userIds: [o],
138
152
  grant: [],
139
- revoke: se(He, B.descriptors)
140
- }), o && await D.mutateAsync({
141
- path: { id: s },
153
+ revoke: he(rt, U.descriptors)
154
+ }), a && await C.mutateAsync({
155
+ path: { id: o },
142
156
  body: e,
143
157
  roleChange: n,
144
- departmentChange: i,
145
- locationChange: a
146
- }), Ve.length > 0 && await O.mutateAsync({
147
- userIds: [s],
148
- grant: se(Ve, B.descriptors),
158
+ departmentChange: r,
159
+ locationChange: i
160
+ }), nt.length > 0 && await w.mutateAsync({
161
+ userIds: [o],
162
+ grant: he(nt, U.descriptors),
149
163
  revoke: []
150
- }), xe(r.MemberUpdated, { memberId: s }), b(void 0), C([]), E([]), w(!1);
164
+ }), Ae(ee.MemberUpdated, { memberId: o }), g(void 0), y([]), S([]), b(!1);
151
165
  } catch (e) {
152
166
  console.error("Failed to update team member:", e);
153
167
  }
154
168
  })();
155
- }, nt = d(() => A.isComplete ? ne(A.data?.data ?? []) : [], [A.isComplete, A.data?.data]), rt = d(() => j.isComplete ? ne(j.data?.data ?? []) : [], [j.isComplete, j.data?.data]), it = d(() => M.isComplete ? re((M.data?.data ?? []).filter((e) => e.id !== y?.memberId), be, v, p) : [], [
156
- M.isComplete,
157
- M.data?.data,
158
- y?.memberId,
159
- be,
160
- v,
161
- p
162
- ]), at = k && !A.isComplete && !A.isError, ot = k && !j.isComplete && !j.isError, st = k && !M.isComplete && !M.isError, ct = k && A.isError, lt = k && j.isError, ut = k && M.isError, $ = D.isPending || O.isPending;
169
+ }, _t = s(() => E.isComplete ? ce(E.data?.data ?? []) : [], [E.isComplete, E.data?.data]), vt = s(() => D.isComplete ? ce(D.data?.data ?? []) : [], [D.isComplete, D.data?.data]), yt = s(() => O.isComplete ? le((O.data?.data ?? []).filter((e) => e.id !== h?.memberId), ke, m, l) : [], [
170
+ O.isComplete,
171
+ O.data?.data,
172
+ h?.memberId,
173
+ ke,
174
+ m,
175
+ l
176
+ ]), bt = T && !E.isComplete && !E.isError, xt = T && !D.isComplete && !D.isError, St = T && !O.isComplete && !O.isError, Ct = T && E.isError, wt = T && D.isError, Tt = T && O.isError, $ = C.isPending || w.isPending;
163
177
  return {
164
- isEditOpen: !!N,
165
- editMemberName: N?.name ?? "",
166
- editMemberEmail: N?.email ?? "",
167
- editForm: x,
168
- editErrors: Ce,
178
+ isEditOpen: !!k,
179
+ editMemberName: k?.name ?? "",
180
+ editMemberEmail: k?.email ?? "",
181
+ editForm: _,
182
+ editErrors: Me,
169
183
  isSavingEdit: $,
170
- isEditNameDisabled: !X || $,
171
- isEditRoleDisabled: !Z || $,
172
- isEditGroupDisabled: !Z || $,
173
- isEditReportingManagerDisabled: !X || $,
174
- isEditSaveDisabled: !$e || $ || et || P && (W || U),
175
- editErrorMessage: et ? v.roleNeedsAccountAccessError : D.isError || O.isError ? v.editFailedError : void 0,
176
- roleOptions: ie(_),
177
- departmentOptions: nt,
178
- locationOptions: rt,
179
- reportingManagerOptions: it,
180
- departmentsLoading: at,
181
- locationsLoading: ot,
182
- reportingManagersLoading: st,
183
- departmentsError: ct,
184
- locationsError: lt,
185
- reportingManagersError: ut,
186
- accountAccessMode: Ie,
187
- accountAccessRows: Le,
188
- onAccountAccessToggle: Re,
189
- isAccountAccessLoading: W,
190
- accountAccessErrorMessage: U ? v.loadAccessFailedError : void 0,
191
- openMemberEdit: We,
192
- onEditOpenChange: Ge,
193
- onEditFormChange: Se,
194
- onEditSubmit: tt
184
+ isEditNameDisabled: !Z || $,
185
+ isEditRoleDisabled: !Q || $,
186
+ isEditGroupDisabled: !Q || $,
187
+ isEditReportingManagerDisabled: !Z || $,
188
+ isEditSaveDisabled: !mt || $ || ht || Ye || j && (Ke || G),
189
+ editErrorMessage: Xe ? m.rolePermissionsUnavailableError : ht ? m.roleNeedsAccountAccessError : C.isError || w.isError ? m.editFailedError : void 0,
190
+ roleOptions: ue(p),
191
+ departmentOptions: _t,
192
+ locationOptions: vt,
193
+ reportingManagerOptions: yt,
194
+ departmentsLoading: bt,
195
+ locationsLoading: xt,
196
+ reportingManagersLoading: St,
197
+ departmentsError: Ct,
198
+ locationsError: wt,
199
+ reportingManagersError: Tt,
200
+ accountAccessMode: Ze,
201
+ accountAccessRows: Qe,
202
+ onAccountAccessToggle: $e,
203
+ isAccountAccessLoading: Ke,
204
+ accountAccessErrorMessage: G ? m.loadAccessFailedError : void 0,
205
+ openMemberEdit: at,
206
+ onEditOpenChange: ot,
207
+ onEditFormChange: je,
208
+ onEditSubmit: gt
195
209
  };
196
210
  }
197
211
  //#endregion
198
- export { fe as canEditMemberProfile, pe as canEditMemberRole, me as useMemberEdit };
212
+ export { be as canEditMemberProfile, xe as canEditMemberRole, Se as useMemberEdit };
@@ -10,16 +10,13 @@ import { TeamWidgetAnalyticsEvent as n } from "./index2.js";
10
10
  import { useDeactivateTeamMemberMutation as r } from "../../data-access/dist/index4.js";
11
11
  import { useResendInviteMutation as i } from "../../data-access/dist/index8.js";
12
12
  import "../../data-access/dist/index.js";
13
- import { isMemberActionable as a } from "./index11.js";
14
- import { resolveAcceptInviteRedirectUri as o } from "./index8.js";
15
- import { useEffect as s, useState as c } from "react";
13
+ import { isMemberActionable as a, isMemberInvited as o } from "./index11.js";
14
+ import { resolveAcceptInviteRedirectUri as s } from "./index8.js";
15
+ import { useEffect as c, useState as l } from "react";
16
16
  //#region ../../libs/tesouro-embedded-components-react/team-widget/feature/dist/index16.js
17
- function l(e) {
18
- return (e?.status ?? "").trim().toUpperCase() === "INVITED";
19
- }
20
17
  function u({ members: e, canPerform: t, onOpen: n, isEligible: r }) {
21
- let [i, o] = c(), l = i ? e.find((e) => e.id === i) : void 0, u = l && a(l) && (r?.(l) ?? !0) ? l : void 0, d = !!i && !u;
22
- return s(() => {
18
+ let [i, o] = l(), s = i ? e.find((e) => e.id === i) : void 0, u = s && a(s) && (r?.(s) ?? !0) ? s : void 0, d = !!i && !u;
19
+ return c(() => {
23
20
  d && o(void 0);
24
21
  }, [d]), {
25
22
  member: u,
@@ -32,9 +29,9 @@ function u({ members: e, canPerform: t, onOpen: n, isEligible: r }) {
32
29
  close: () => o(void 0)
33
30
  };
34
31
  }
35
- function d({ canDeactivate: a, canResendInvite: s, members: c, featureLabels: d, acceptInviteRedirectUri: f }) {
32
+ function d({ canDeactivate: a, canResendInvite: c, members: l, featureLabels: d, acceptInviteRedirectUri: f }) {
36
33
  let p = t(), m = r(), h = i(), g = u({
37
- members: c,
34
+ members: l,
38
35
  canPerform: a,
39
36
  onOpen: () => m.reset()
40
37
  }), _ = () => {
@@ -44,10 +41,10 @@ function d({ canDeactivate: a, canResendInvite: s, members: c, featureLabels: d,
44
41
  p(n.MemberDeactivated, { memberId: e }), g.close();
45
42
  } });
46
43
  }, v = u({
47
- members: c,
48
- canPerform: s,
44
+ members: l,
45
+ canPerform: c,
49
46
  onOpen: () => h.reset(),
50
- isEligible: l
47
+ isEligible: o
51
48
  });
52
49
  return {
53
50
  isDeactivateOpen: !!g.member,
@@ -66,10 +63,10 @@ function d({ canDeactivate: a, canResendInvite: s, members: c, featureLabels: d,
66
63
  openResendConfirmation: v.open,
67
64
  onResendOpenChange: v.onOpenChange,
68
65
  onResendConfirm: () => {
69
- !s || !v.member || h.mutate({
66
+ !c || !v.member || h.mutate({
70
67
  name: v.member.name,
71
68
  email: v.member.email,
72
- redirectUri: o(f)
69
+ redirectUri: s(f)
73
70
  }, { onSuccess: () => {
74
71
  e.success(d.resendSuccessToast), v.close();
75
72
  } });