@moh-sso/users 1.5.1 → 1.7.0

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.
Files changed (28) hide show
  1. package/README.md +7 -2
  2. package/dist/_types/apps/rbac/src/api/health-context.api.d.ts +99 -99
  3. package/dist/_types/apps/rbac/src/api/identity-sync.api.d.ts +2884 -0
  4. package/dist/_types/apps/rbac/src/api/index.d.ts +1 -0
  5. package/dist/_types/apps/rbac/src/api/rbac.api.d.ts +385 -385
  6. package/dist/_types/apps/rbac/src/types/identity-sync.types.d.ts +109 -0
  7. package/dist/_types/apps/rbac/src/types/index.d.ts +1 -0
  8. package/dist/_types/apps/rbac/src/types/rbac.types.d.ts +2 -0
  9. package/dist/_types/apps/users/src/api/users.api.d.ts +77 -77
  10. package/dist/_types/apps/users/src/components/UserFilters.d.ts +2 -1
  11. package/dist/_types/packages/api/src/api/baseApi.d.ts +1 -1
  12. package/dist/_types/packages/auth/src/api/auth.api.d.ts +21 -21
  13. package/dist/_types/packages/auth/src/api/health-context.api.d.ts +19 -19
  14. package/dist/_types/packages/auth/src/auth/auth.selectors.d.ts +22 -22
  15. package/dist/_types/packages/state/src/clients/clients.selectors.d.ts +17 -17
  16. package/dist/_types/packages/state/src/index.d.ts +2 -2
  17. package/dist/api.js +1 -1
  18. package/dist/assets/root.component-C62grxQn.js +1619 -0
  19. package/dist/assets/root.component-C62grxQn.js.map +1 -0
  20. package/dist/assets/users-BOKiZZ2J.css +1 -0
  21. package/dist/index.js +2 -2
  22. package/dist/routes.js +1 -1
  23. package/dist/single-spa.js +2 -2
  24. package/dist/types.js +1 -1
  25. package/package.json +8 -8
  26. package/dist/assets/root.component-CJ07SxRg.js +0 -1477
  27. package/dist/assets/root.component-CJ07SxRg.js.map +0 -1
  28. package/dist/assets/users-D7Pe7bza.css +0 -1
@@ -0,0 +1,1619 @@
1
+ import { jsx as r, jsxs as u, Fragment as Re } from "react/jsx-runtime";
2
+ import { InlineLoading as k, Stack as $, Button as A, Tile as z, MultiSelect as J, Tag as Z, Form as Ue, FormGroup as oe, TextInput as V, Checkbox as X, Dropdown as ie, OverflowMenu as Ae, OverflowMenuItem as j, ButtonSet as _e, DataTable as Le, Table as Pe, TableHead as Me, TableRow as le, TableSelectAll as we, TableHeader as xe, TableBody as Ee, TableSelectRow as Ge, TableCell as de } from "@carbon/react";
3
+ import { useState as T, useEffect as ee, useMemo as w } from "react";
4
+ import { useSelector as he } from "react-redux";
5
+ import { selectUser as ge } from "@moh-sso/auth";
6
+ import { useToast as te, FormInlineAlert as fe, useModal as Se, useHeaderPanel as Ne, DataTableShell as ke, TableStatusTag as De, RowActionsCell as He, DataTablePagination as Oe, ErrorState as Qe } from "@moh-sso/ui";
7
+ import { baseApi as se } from "@moh-sso/api";
8
+ import { u as Fe, i as Be, e as ze, g as Ve, f as je } from "./users.api-DoE9CD9k.js";
9
+ const n = "/admin/rbac", Ke = se.injectEndpoints({
10
+ endpoints: (s) => ({
11
+ registerRbacSystem: s.mutation({
12
+ query: (e) => ({ url: `${n}/systems`, method: "POST", body: e }),
13
+ transformResponse: (e) => e.data,
14
+ invalidatesTags: [{ type: "RbacSystem", id: "LIST" }]
15
+ }),
16
+ listRbacSystems: s.query({
17
+ query: () => `${n}/systems`,
18
+ transformResponse: (e) => e.data,
19
+ providesTags: [{ type: "RbacSystem", id: "LIST" }]
20
+ }),
21
+ getRbacSystem: s.query({
22
+ query: (e) => `${n}/systems/${encodeURIComponent(e)}`,
23
+ transformResponse: (e) => e.data,
24
+ providesTags: (e, t, a) => [{ type: "RbacSystem", id: a }]
25
+ }),
26
+ updateRbacSystem: s.mutation({
27
+ query: ({ clientId: e, data: t }) => ({
28
+ url: `${n}/systems/${encodeURIComponent(e)}`,
29
+ method: "PUT",
30
+ body: t
31
+ }),
32
+ transformResponse: (e) => e.data,
33
+ invalidatesTags: (e, t, { clientId: a }) => t ? [] : [{ type: "RbacSystem", id: "LIST" }, { type: "RbacSystem", id: a }, "Auth"]
34
+ }),
35
+ transitionRbacSystem: s.mutation({
36
+ query: ({ clientId: e, ...t }) => ({
37
+ url: `${n}/systems/${encodeURIComponent(e)}/lifecycle`,
38
+ method: "POST",
39
+ body: t
40
+ }),
41
+ transformResponse: (e) => e.data,
42
+ invalidatesTags: (e, t, { clientId: a }) => [
43
+ { type: "RbacSystem", id: "LIST" },
44
+ { type: "RbacSystem", id: a },
45
+ { type: "RbacAudit", id: "LIST" },
46
+ ...t ? [] : ["Auth"]
47
+ ]
48
+ }),
49
+ listRbacPermissions: s.query({
50
+ query: () => `${n}/permissions`,
51
+ transformResponse: (e) => e.data,
52
+ providesTags: [{ type: "RbacPermission", id: "LIST" }]
53
+ }),
54
+ updateRbacPermissionMetadata: s.mutation({
55
+ query: ({ permissionKey: e, data: t }) => ({
56
+ url: `${n}/permissions/${encodeURIComponent(e)}`,
57
+ method: "PUT",
58
+ body: t
59
+ }),
60
+ transformResponse: (e) => e.data,
61
+ invalidatesTags: [{ type: "RbacPermission", id: "LIST" }]
62
+ }),
63
+ listSystemRoles: s.query({
64
+ query: (e) => `${n}/systems/${encodeURIComponent(e)}/roles`,
65
+ transformResponse: (e) => e.data,
66
+ providesTags: (e, t, a) => [{ type: "RbacSystem", id: a }]
67
+ }),
68
+ createSystemRole: s.mutation(
69
+ {
70
+ query: ({ clientId: e, data: t }) => ({
71
+ url: `${n}/systems/${encodeURIComponent(e)}/roles`,
72
+ method: "POST",
73
+ body: t
74
+ }),
75
+ transformResponse: (e) => e.data,
76
+ invalidatesTags: (e, t, { clientId: a }) => [{ type: "RbacSystem", id: a }]
77
+ }
78
+ ),
79
+ updateSystemRole: s.mutation({
80
+ query: ({ roleId: e, data: t }) => ({
81
+ url: `${n}/roles/${encodeURIComponent(e)}`,
82
+ method: "PUT",
83
+ body: t
84
+ }),
85
+ transformResponse: (e) => e.data,
86
+ invalidatesTags: (e, t, { clientId: a }) => [{ type: "RbacSystem", id: a }]
87
+ }),
88
+ deleteSystemRole: s.mutation({
89
+ query: ({ roleId: e }) => ({
90
+ url: `${n}/roles/${encodeURIComponent(e)}`,
91
+ method: "DELETE"
92
+ }),
93
+ invalidatesTags: (e, t, { clientId: a }) => [{ type: "RbacSystem", id: a }]
94
+ }),
95
+ getRoleUsage: s.query({
96
+ query: (e) => `${n}/roles/${encodeURIComponent(e)}/usage`,
97
+ transformResponse: (e) => e.data
98
+ }),
99
+ copyRolePermissions: s.mutation({
100
+ query: ({ roleId: e, data: t }) => ({
101
+ url: `${n}/roles/${encodeURIComponent(e)}/copy-permissions`,
102
+ method: "POST",
103
+ body: t
104
+ }),
105
+ transformResponse: (e) => e.data,
106
+ invalidatesTags: (e, t, { clientId: a }) => [{ type: "RbacSystem", id: a }]
107
+ }),
108
+ assignSystemRolePermission: s.mutation({
109
+ query: ({ roleId: e, data: t }) => ({
110
+ url: `${n}/roles/${encodeURIComponent(e)}/permissions`,
111
+ method: "POST",
112
+ body: t
113
+ }),
114
+ invalidatesTags: (e, t, { clientId: a }) => [{ type: "RbacSystem", id: a }]
115
+ }),
116
+ removeSystemRolePermission: s.mutation({
117
+ query: ({ roleId: e, permissionKey: t }) => ({
118
+ url: `${n}/roles/${encodeURIComponent(e)}/permissions/${encodeURIComponent(t)}`,
119
+ method: "DELETE"
120
+ }),
121
+ invalidatesTags: (e, t, { clientId: a }) => [{ type: "RbacSystem", id: a }]
122
+ }),
123
+ listRealmRolePermissions: s.query({
124
+ query: () => `${n}/realm-roles`,
125
+ transformResponse: (e) => e.data,
126
+ providesTags: [{ type: "RbacRealmRole", id: "LIST" }]
127
+ }),
128
+ listRbacGroups: s.query({
129
+ query: () => `${n}/groups`,
130
+ transformResponse: (e) => e.data,
131
+ providesTags: [{ type: "RbacGroup", id: "LIST" }]
132
+ }),
133
+ getRbacGroup: s.query({
134
+ query: (e) => `${n}/groups/${encodeURIComponent(e)}`,
135
+ transformResponse: (e) => e.data,
136
+ providesTags: (e, t, a) => [{ type: "RbacGroup", id: a }]
137
+ }),
138
+ listRbacGroupMembers: s.query({
139
+ query: (e) => `${n}/groups/${encodeURIComponent(e)}/members`,
140
+ transformResponse: (e) => e.data,
141
+ providesTags: (e, t, a) => [{ type: "RbacGroup", id: `${a}:members` }]
142
+ }),
143
+ upsertRbacGroup: s.mutation({
144
+ query: (e) => ({
145
+ url: `${n}/groups`,
146
+ method: "POST",
147
+ body: e
148
+ }),
149
+ transformResponse: (e) => e.data,
150
+ invalidatesTags: [
151
+ { type: "RbacGroup", id: "LIST" },
152
+ { type: "RbacAudit", id: "LIST" }
153
+ ]
154
+ }),
155
+ addRbacGroupMember: s.mutation({
156
+ query: ({ groupId: e, data: t }) => ({
157
+ url: `${n}/groups/${encodeURIComponent(e)}/members`,
158
+ method: "POST",
159
+ body: t
160
+ }),
161
+ transformResponse: (e) => e.data,
162
+ invalidatesTags: (e, t, { groupId: a, data: l }) => [
163
+ { type: "RbacGroup", id: a },
164
+ { type: "RbacGroup", id: `${a}:members` },
165
+ { type: "RbacGroup", id: "LIST" },
166
+ { type: "RbacAudit", id: "LIST" },
167
+ { type: "User", id: l.userId }
168
+ ]
169
+ }),
170
+ removeRbacGroupMember: s.mutation({
171
+ query: ({ groupId: e, userId: t }) => ({
172
+ url: `${n}/groups/${encodeURIComponent(e)}/members/${encodeURIComponent(t)}`,
173
+ method: "DELETE"
174
+ }),
175
+ transformResponse: (e) => e.data,
176
+ invalidatesTags: (e, t, { groupId: a, userId: l }) => [
177
+ { type: "RbacGroup", id: a },
178
+ { type: "RbacGroup", id: `${a}:members` },
179
+ { type: "RbacGroup", id: "LIST" },
180
+ { type: "RbacAudit", id: "LIST" },
181
+ { type: "User", id: l }
182
+ ]
183
+ }),
184
+ syncRbacGroupMembers: s.mutation({
185
+ query: (e) => ({
186
+ url: `${n}/groups/${encodeURIComponent(e)}/sync-members`,
187
+ method: "POST"
188
+ }),
189
+ transformResponse: (e) => e.data,
190
+ invalidatesTags: (e, t, a) => [
191
+ { type: "RbacGroup", id: a },
192
+ { type: "RbacGroup", id: `${a}:members` },
193
+ { type: "RbacGroup", id: "LIST" },
194
+ { type: "RbacAudit", id: "LIST" }
195
+ ]
196
+ }),
197
+ replaceRbacGroupMembers: s.mutation({
198
+ query: ({ groupId: e, data: t }) => ({
199
+ url: `${n}/groups/${encodeURIComponent(e)}/members`,
200
+ method: "PUT",
201
+ body: t
202
+ }),
203
+ invalidatesTags: (e, t, { groupId: a }) => [
204
+ { type: "RbacGroup", id: a },
205
+ { type: "RbacGroup", id: "LIST" },
206
+ { type: "RbacAudit", id: "LIST" }
207
+ ]
208
+ }),
209
+ assignGroupPermission: s.mutation(
210
+ {
211
+ query: ({ groupId: e, data: t }) => ({
212
+ url: `${n}/groups/${encodeURIComponent(e)}/permissions`,
213
+ method: "POST",
214
+ body: t
215
+ }),
216
+ invalidatesTags: (e, t, { groupId: a }) => [
217
+ { type: "RbacGroup", id: a },
218
+ { type: "RbacGroup", id: "LIST" }
219
+ ]
220
+ }
221
+ ),
222
+ removeGroupPermission: s.mutation({
223
+ query: ({ groupId: e, permissionKey: t }) => ({
224
+ url: `${n}/groups/${encodeURIComponent(e)}/permissions/${encodeURIComponent(t)}`,
225
+ method: "DELETE"
226
+ }),
227
+ invalidatesTags: (e, t, { groupId: a }) => [
228
+ { type: "RbacGroup", id: a },
229
+ { type: "RbacGroup", id: "LIST" }
230
+ ]
231
+ }),
232
+ assignGroupRealmRole: s.mutation({
233
+ query: ({ groupId: e, data: t }) => ({
234
+ url: `${n}/groups/${encodeURIComponent(e)}/realm-roles`,
235
+ method: "POST",
236
+ body: t
237
+ }),
238
+ invalidatesTags: (e, t, { groupId: a }) => [
239
+ { type: "RbacGroup", id: a },
240
+ { type: "RbacGroup", id: "LIST" }
241
+ ]
242
+ }),
243
+ removeGroupRealmRole: s.mutation({
244
+ query: ({ groupId: e, realmRole: t }) => ({
245
+ url: `${n}/groups/${encodeURIComponent(e)}/realm-roles/${encodeURIComponent(t)}`,
246
+ method: "DELETE"
247
+ }),
248
+ invalidatesTags: (e, t, { groupId: a }) => [
249
+ { type: "RbacGroup", id: a },
250
+ { type: "RbacGroup", id: "LIST" }
251
+ ]
252
+ }),
253
+ assignGroupSystemRole: s.mutation({
254
+ query: ({ groupId: e, data: t }) => ({
255
+ url: `${n}/groups/${encodeURIComponent(e)}/system-roles`,
256
+ method: "POST",
257
+ body: t
258
+ }),
259
+ invalidatesTags: (e, t, { groupId: a }) => [
260
+ { type: "RbacGroup", id: a },
261
+ { type: "RbacGroup", id: "LIST" }
262
+ ]
263
+ }),
264
+ removeGroupSystemRole: s.mutation({
265
+ query: ({ groupId: e, clientId: t, roleName: a }) => ({
266
+ url: `${n}/groups/${encodeURIComponent(e)}/system-roles/${encodeURIComponent(t)}/${encodeURIComponent(a)}`,
267
+ method: "DELETE"
268
+ }),
269
+ invalidatesTags: (e, t, { groupId: a }) => [
270
+ { type: "RbacGroup", id: a },
271
+ { type: "RbacGroup", id: "LIST" }
272
+ ]
273
+ }),
274
+ getRealmRoleUsage: s.query({
275
+ query: (e) => `${n}/realm-roles/${encodeURIComponent(e)}/usage`,
276
+ transformResponse: (e) => e.data
277
+ }),
278
+ assignRealmRolePermission: s.mutation({
279
+ query: ({ realmRole: e, data: t }) => ({
280
+ url: `${n}/realm-roles/${encodeURIComponent(e)}/permissions`,
281
+ method: "POST",
282
+ body: t
283
+ }),
284
+ invalidatesTags: [{ type: "RbacRealmRole", id: "LIST" }]
285
+ }),
286
+ removeRealmRolePermission: s.mutation(
287
+ {
288
+ query: ({ realmRole: e, permissionKey: t }) => ({
289
+ url: `${n}/realm-roles/${encodeURIComponent(e)}/permissions/${encodeURIComponent(t)}`,
290
+ method: "DELETE"
291
+ }),
292
+ invalidatesTags: [{ type: "RbacRealmRole", id: "LIST" }]
293
+ }
294
+ ),
295
+ addSystemAccessRole: s.mutation({
296
+ query: ({ clientId: e, data: t }) => ({
297
+ url: `${n}/systems/${encodeURIComponent(e)}/access-roles`,
298
+ method: "POST",
299
+ body: t
300
+ }),
301
+ invalidatesTags: (e, t, { clientId: a }) => t ? [] : [{ type: "RbacSystem", id: a }, "Auth"]
302
+ }),
303
+ removeSystemAccessRole: s.mutation({
304
+ query: ({ clientId: e, roleName: t, force: a }) => ({
305
+ url: `${n}/systems/${encodeURIComponent(e)}/access-roles/${encodeURIComponent(t)}${a ? "?force=true" : ""}`,
306
+ method: "DELETE"
307
+ }),
308
+ invalidatesTags: (e, t, { clientId: a }) => t ? [] : [{ type: "RbacSystem", id: a }, "Auth"]
309
+ }),
310
+ getRbacDrift: s.query({
311
+ query: () => `${n}/drift`,
312
+ transformResponse: (e) => e.data,
313
+ providesTags: [{ type: "RbacSystem", id: "DRIFT" }]
314
+ }),
315
+ previewRbacRealmExportDrift: s.mutation({
316
+ query: (e) => ({
317
+ url: `${n}/drift/realm-export`,
318
+ method: "POST",
319
+ body: e
320
+ }),
321
+ transformResponse: (e) => e.data
322
+ }),
323
+ previewRbacSync: s.mutation({
324
+ query: (e) => ({
325
+ url: `${n}/sync/preview`,
326
+ method: "POST",
327
+ body: e
328
+ }),
329
+ transformResponse: (e) => e.data
330
+ }),
331
+ applyRbacSync: s.mutation({
332
+ query: (e) => ({
333
+ url: `${n}/sync/apply`,
334
+ method: "POST",
335
+ body: e
336
+ }),
337
+ transformResponse: (e) => e.data,
338
+ invalidatesTags: [
339
+ { type: "RbacSystem", id: "LIST" },
340
+ { type: "RbacSystem", id: "DRIFT" },
341
+ { type: "RbacRealmRole", id: "LIST" }
342
+ ]
343
+ }),
344
+ getRbacEffectiveAccess: s.query({
345
+ query: ({ userId: e = "lookup", username: t, email: a }) => {
346
+ const l = new URLSearchParams();
347
+ t && l.set("username", t), a && l.set("email", a);
348
+ const d = l.toString();
349
+ return `${n}/effective-access/users/${encodeURIComponent(e)}${d ? `?${d}` : ""}`;
350
+ },
351
+ transformResponse: (e) => e.data
352
+ }),
353
+ getAssignableUserAccess: s.query({
354
+ query: () => `${n}/user-access/assignable`,
355
+ transformResponse: (e) => e.data,
356
+ providesTags: [{ type: "RbacSystem", id: "USER_ACCESS_ASSIGNABLE" }]
357
+ }),
358
+ getUserAccessProfile: s.query({
359
+ query: (e) => `${n}/user-access/users/${encodeURIComponent(e)}`,
360
+ transformResponse: (e) => e.data,
361
+ providesTags: (e, t, a) => [
362
+ { type: "RbacSystem", id: "USER_ACCESS_ASSIGNABLE" },
363
+ { type: "User", id: a },
364
+ { type: "UserClientRole", id: `LIST-${a}` }
365
+ ]
366
+ }),
367
+ updateUserAccess: s.mutation({
368
+ query: ({ userId: e, data: t }) => ({
369
+ url: `${n}/user-access/users/${encodeURIComponent(e)}`,
370
+ method: "PUT",
371
+ body: t
372
+ }),
373
+ transformResponse: (e) => e.data,
374
+ invalidatesTags: (e, t, { userId: a }) => [
375
+ { type: "User", id: a },
376
+ { type: "User", id: "LIST" },
377
+ { type: "UserClientRole", id: `LIST-${a}` },
378
+ { type: "RbacAudit", id: "LIST" }
379
+ ]
380
+ }),
381
+ previewRbacChange: s.mutation({
382
+ query: (e) => ({ url: `${n}/changes/preview`, method: "POST", body: e }),
383
+ transformResponse: (e) => e.data
384
+ }),
385
+ exportRbacSeed: s.query({
386
+ query: () => `${n}/export`,
387
+ transformResponse: (e) => e.data
388
+ }),
389
+ previewRbacImport: s.mutation({
390
+ query: (e) => ({ url: `${n}/import/preview`, method: "POST", body: e }),
391
+ transformResponse: (e) => e.data
392
+ }),
393
+ applyRbacImport: s.mutation({
394
+ query: (e) => ({ url: `${n}/import/apply`, method: "POST", body: e }),
395
+ transformResponse: (e) => e.data,
396
+ invalidatesTags: [{ type: "RbacSystem", id: "LIST" }]
397
+ }),
398
+ listRbacAuditEvents: s.query({
399
+ query: (e) => {
400
+ const t = new URLSearchParams();
401
+ e?.actor && t.set("actor", e.actor), e?.systemClientId && t.set("systemClientId", e.systemClientId), e?.roleName && t.set("roleName", e.roleName), e?.permissionKey && t.set("permissionKey", e.permissionKey), e?.action && t.set("action", e.action), e?.from && t.set("from", e.from), e?.to && t.set("to", e.to), e?.limit && t.set("limit", String(e.limit));
402
+ const a = t.toString();
403
+ return `${n}/audit${a ? `?${a}` : ""}`;
404
+ },
405
+ transformResponse: (e) => e.data,
406
+ providesTags: [{ type: "RbacAudit", id: "LIST" }]
407
+ }),
408
+ listRbacRoleTemplates: s.query({
409
+ query: () => `${n}/role-templates`,
410
+ transformResponse: (e) => e.data
411
+ }),
412
+ createRoleFromTemplate: s.mutation({
413
+ query: ({ clientId: e, data: t }) => ({
414
+ url: `${n}/systems/${encodeURIComponent(e)}/roles/from-template`,
415
+ method: "POST",
416
+ body: t
417
+ }),
418
+ transformResponse: (e) => e.data,
419
+ invalidatesTags: (e, t, { clientId: a }) => [{ type: "RbacSystem", id: a }]
420
+ }),
421
+ bulkAssignPermission: s.mutation({
422
+ query: (e) => ({ url: `${n}/bulk/assign-permission`, method: "POST", body: e }),
423
+ invalidatesTags: [{ type: "RbacSystem", id: "LIST" }]
424
+ }),
425
+ bulkRemovePermission: s.mutation({
426
+ query: (e) => ({ url: `${n}/bulk/remove-permission`, method: "POST", body: e }),
427
+ invalidatesTags: [{ type: "RbacSystem", id: "LIST" }]
428
+ }),
429
+ listAccessRequests: s.query({
430
+ query: () => `${n}/access-requests`,
431
+ transformResponse: (e) => e.data,
432
+ providesTags: [{ type: "RbacAccessRequest", id: "LIST" }]
433
+ }),
434
+ createAccessRequest: s.mutation({
435
+ query: (e) => ({ url: "/access-requests", method: "POST", body: e }),
436
+ transformResponse: (e) => e.data,
437
+ invalidatesTags: [{ type: "RbacAccessRequest", id: "LIST" }]
438
+ }),
439
+ decideAccessRequest: s.mutation({
440
+ query: ({ id: e, decision: t, data: a }) => ({
441
+ url: `${n}/access-requests/${encodeURIComponent(e)}/${t}`,
442
+ method: "POST",
443
+ body: a ?? {}
444
+ }),
445
+ transformResponse: (e) => e.data,
446
+ invalidatesTags: [
447
+ { type: "RbacAccessRequest", id: "LIST" },
448
+ { type: "RbacAudit", id: "LIST" }
449
+ ]
450
+ }),
451
+ listChangeRequests: s.query({
452
+ query: () => `${n}/change-requests`,
453
+ transformResponse: (e) => e.data,
454
+ providesTags: [{ type: "RbacChangeRequest", id: "LIST" }]
455
+ }),
456
+ createChangeRequest: s.mutation({
457
+ query: (e) => ({ url: `${n}/change-requests`, method: "POST", body: e }),
458
+ transformResponse: (e) => e.data,
459
+ invalidatesTags: [{ type: "RbacChangeRequest", id: "LIST" }]
460
+ }),
461
+ decideChangeRequest: s.mutation({
462
+ query: ({ id: e, decision: t, data: a }) => ({
463
+ url: `${n}/change-requests/${encodeURIComponent(e)}/${t}`,
464
+ method: "POST",
465
+ body: a ?? {}
466
+ }),
467
+ transformResponse: (e) => e.data,
468
+ invalidatesTags: [
469
+ { type: "RbacChangeRequest", id: "LIST" },
470
+ { type: "RbacAudit", id: "LIST" }
471
+ ]
472
+ }),
473
+ simulateRbacAccess: s.mutation({
474
+ query: (e) => ({ url: `${n}/simulate`, method: "POST", body: e }),
475
+ transformResponse: (e) => e.data
476
+ })
477
+ })
478
+ }), {
479
+ useApplyRbacSyncMutation: Ct,
480
+ useApplyRbacImportMutation: It,
481
+ useAddSystemAccessRoleMutation: qt,
482
+ useAddRbacGroupMemberMutation: Ut,
483
+ useAssignGroupPermissionMutation: At,
484
+ useAssignGroupRealmRoleMutation: _t,
485
+ useAssignGroupSystemRoleMutation: Lt,
486
+ useAssignRealmRolePermissionMutation: Pt,
487
+ useAssignSystemRolePermissionMutation: Mt,
488
+ useBulkAssignPermissionMutation: wt,
489
+ useBulkRemovePermissionMutation: xt,
490
+ useCopyRolePermissionsMutation: Et,
491
+ useCreateAccessRequestMutation: Gt,
492
+ useCreateChangeRequestMutation: Nt,
493
+ useCreateRoleFromTemplateMutation: kt,
494
+ useCreateSystemRoleMutation: Dt,
495
+ useDecideAccessRequestMutation: Ht,
496
+ useDecideChangeRequestMutation: Ot,
497
+ useDeleteSystemRoleMutation: Qt,
498
+ useExportRbacSeedQuery: Ft,
499
+ useGetRbacDriftQuery: Bt,
500
+ useGetRbacEffectiveAccessQuery: zt,
501
+ useGetRbacGroupQuery: Vt,
502
+ useGetAssignableUserAccessQuery: We,
503
+ useGetUserAccessProfileQuery: Ye,
504
+ useGetRealmRoleUsageQuery: jt,
505
+ useGetRoleUsageQuery: Kt,
506
+ useListAccessRequestsQuery: Wt,
507
+ useListChangeRequestsQuery: Yt,
508
+ useListRbacAuditEventsQuery: Jt,
509
+ useGetRbacSystemQuery: Xt,
510
+ useListRbacPermissionsQuery: Zt,
511
+ useListRbacGroupMembersQuery: es,
512
+ useListRbacGroupsQuery: ts,
513
+ useListRbacRoleTemplatesQuery: ss,
514
+ useListRbacSystemsQuery: as,
515
+ useListRealmRolePermissionsQuery: rs,
516
+ useListSystemRolesQuery: ns,
517
+ usePreviewRbacChangeMutation: os,
518
+ usePreviewRbacImportMutation: is,
519
+ usePreviewRbacRealmExportDriftMutation: ls,
520
+ usePreviewRbacSyncMutation: ds,
521
+ useRemoveGroupPermissionMutation: cs,
522
+ useRemoveRbacGroupMemberMutation: us,
523
+ useRemoveGroupRealmRoleMutation: ms,
524
+ useRemoveGroupSystemRoleMutation: ps,
525
+ useRemoveRealmRolePermissionMutation: ys,
526
+ useRemoveSystemAccessRoleMutation: Rs,
527
+ useRemoveSystemRolePermissionMutation: hs,
528
+ useSimulateRbacAccessMutation: gs,
529
+ useSyncRbacGroupMembersMutation: fs,
530
+ useUpdateUserAccessMutation: Je,
531
+ useUpdateRbacPermissionMetadataMutation: Ss,
532
+ useUpdateRbacSystemMutation: bs,
533
+ useRegisterRbacSystemMutation: Ts,
534
+ useTransitionRbacSystemMutation: vs,
535
+ useUpdateSystemRoleMutation: $s,
536
+ useUpsertRbacGroupMutation: Cs,
537
+ useReplaceRbacGroupMembersMutation: Is
538
+ } = Ke, P = "/admin/health-contexts", Xe = se.injectEndpoints({
539
+ endpoints: (s) => ({
540
+ listHealthContexts: s.query({
541
+ query: (e) => {
542
+ const t = new URLSearchParams();
543
+ e?.includeDisabled && t.set("includeDisabled", "true"), e?.type && t.set("type", e.type);
544
+ const a = t.toString();
545
+ return `${P}${a ? `?${a}` : ""}`;
546
+ },
547
+ transformResponse: (e) => e.data,
548
+ providesTags: [{ type: "HealthContext", id: "LIST" }]
549
+ }),
550
+ createHealthContext: s.mutation({
551
+ query: (e) => ({ url: P, method: "POST", body: e }),
552
+ transformResponse: (e) => e.data,
553
+ invalidatesTags: [{ type: "HealthContext", id: "LIST" }]
554
+ }),
555
+ updateHealthContext: s.mutation({
556
+ query: ({ contextId: e, body: t }) => ({
557
+ url: `${P}/${encodeURIComponent(e)}`,
558
+ method: "PUT",
559
+ body: t
560
+ }),
561
+ transformResponse: (e) => e.data,
562
+ invalidatesTags: (e, t, { contextId: a }) => [
563
+ { type: "HealthContext", id: "LIST" },
564
+ { type: "HealthContext", id: a }
565
+ ]
566
+ }),
567
+ deleteHealthContext: s.mutation({
568
+ query: (e) => ({
569
+ url: `${P}/${encodeURIComponent(e)}`,
570
+ method: "DELETE"
571
+ }),
572
+ invalidatesTags: [{ type: "HealthContext", id: "LIST" }]
573
+ }),
574
+ listHealthContextAliases: s.query({
575
+ query: (e) => `${P}/${encodeURIComponent(e)}/aliases`,
576
+ transformResponse: (e) => e.data,
577
+ providesTags: (e, t, a) => [
578
+ { type: "HealthContext", id: `${a}:aliases` }
579
+ ]
580
+ }),
581
+ upsertHealthContextAlias: s.mutation({
582
+ query: ({ contextId: e, ...t }) => ({
583
+ url: `${P}/${encodeURIComponent(e)}/aliases`,
584
+ method: "PUT",
585
+ body: t
586
+ }),
587
+ transformResponse: (e) => e.data,
588
+ invalidatesTags: (e, t, { contextId: a }) => [
589
+ { type: "HealthContext", id: `${a}:aliases` }
590
+ ]
591
+ }),
592
+ deleteHealthContextAlias: s.mutation({
593
+ query: ({ contextId: e, aliasId: t }) => ({
594
+ url: `${P}/${encodeURIComponent(e)}/aliases/${encodeURIComponent(t)}`,
595
+ method: "DELETE"
596
+ }),
597
+ invalidatesTags: (e, t, { contextId: a }) => [
598
+ { type: "HealthContext", id: `${a}:aliases` }
599
+ ]
600
+ }),
601
+ listUserHealthContexts: s.query({
602
+ query: (e) => `/admin/users/${encodeURIComponent(e)}/health-contexts`,
603
+ transformResponse: (e) => e.data,
604
+ providesTags: (e, t, a) => [
605
+ { type: "HealthContext", id: `user:${a}` }
606
+ ]
607
+ }),
608
+ replaceUserHealthContexts: s.mutation({
609
+ query: ({ targetId: e, assignments: t }) => ({
610
+ url: `/admin/users/${encodeURIComponent(e)}/health-contexts`,
611
+ method: "PUT",
612
+ body: { assignments: t }
613
+ }),
614
+ invalidatesTags: (e, t, { targetId: a }) => [
615
+ { type: "HealthContext", id: `user:${a}` }
616
+ ]
617
+ }),
618
+ listGroupHealthContexts: s.query({
619
+ query: (e) => `/admin/rbac/groups/${encodeURIComponent(e)}/health-contexts`,
620
+ transformResponse: (e) => e.data,
621
+ providesTags: (e, t, a) => [
622
+ { type: "HealthContext", id: `group:${a}` }
623
+ ]
624
+ }),
625
+ replaceGroupHealthContexts: s.mutation({
626
+ query: ({ targetId: e, assignments: t }) => ({
627
+ url: `/admin/rbac/groups/${encodeURIComponent(e)}/health-contexts`,
628
+ method: "PUT",
629
+ body: { assignments: t }
630
+ }),
631
+ invalidatesTags: (e, t, { targetId: a }) => [
632
+ { type: "HealthContext", id: `group:${a}` }
633
+ ]
634
+ }),
635
+ getHealthContextDrift: s.query({
636
+ query: () => `${P}/drift`,
637
+ transformResponse: (e) => e.data,
638
+ providesTags: [{ type: "HealthContext", id: "DRIFT" }]
639
+ }),
640
+ previewHealthContextSync: s.mutation({
641
+ query: (e) => ({
642
+ url: `${P}/sync/preview`,
643
+ method: "POST",
644
+ body: e
645
+ }),
646
+ transformResponse: (e) => e.data
647
+ }),
648
+ applyHealthContextSync: s.mutation({
649
+ query: (e) => ({
650
+ url: `${P}/sync/apply`,
651
+ method: "POST",
652
+ body: e
653
+ }),
654
+ transformResponse: (e) => e.data,
655
+ invalidatesTags: [
656
+ { type: "HealthContext", id: "DRIFT" },
657
+ { type: "HealthContext", id: "LIST" }
658
+ ]
659
+ })
660
+ })
661
+ }), {
662
+ useApplyHealthContextSyncMutation: qs,
663
+ useCreateHealthContextMutation: Us,
664
+ useDeleteHealthContextAliasMutation: As,
665
+ useDeleteHealthContextMutation: _s,
666
+ useListGroupHealthContextsQuery: Ls,
667
+ useGetHealthContextDriftQuery: Ps,
668
+ useListHealthContextAliasesQuery: Ms,
669
+ useListHealthContextsQuery: ws,
670
+ useListUserHealthContextsQuery: xs,
671
+ useReplaceGroupHealthContextsMutation: Es,
672
+ useReplaceUserHealthContextsMutation: Gs,
673
+ usePreviewHealthContextSyncMutation: Ns,
674
+ useUpdateHealthContextMutation: ks,
675
+ useUpsertHealthContextAliasMutation: Ds
676
+ } = Xe, W = (s) => `/admin/platform/applications/${encodeURIComponent(s)}/identities`, U = (s) => `/admin/platform/applications/${encodeURIComponent(s)}/identity-sync`, Ze = se.injectEndpoints({
677
+ endpoints: (s) => ({
678
+ getIdentitySyncIntegration: s.query({
679
+ query: (e) => U(e),
680
+ transformResponse: (e) => e.data,
681
+ providesTags: (e, t, a) => [{ type: "IdentitySync", id: `integration:${a}` }]
682
+ }),
683
+ saveIdentitySyncIntegration: s.mutation({
684
+ query: ({ clientId: e, data: t }) => ({ url: U(e), method: "PUT", body: t }),
685
+ transformResponse: (e) => e.data,
686
+ invalidatesTags: (e, t, { clientId: a }) => [
687
+ { type: "IdentitySync", id: `integration:${a}` }
688
+ ]
689
+ }),
690
+ listServiceIdentities: s.query({
691
+ query: (e) => W(e),
692
+ transformResponse: (e) => e.data.identities,
693
+ providesTags: (e, t, a) => [{ type: "IdentitySync", id: `identities:${a}` }]
694
+ }),
695
+ resolveServiceAccount: s.mutation({
696
+ query: ({ clientId: e, oauthClientId: t }) => ({
697
+ url: `${W(e)}/${encodeURIComponent(t)}/service-account`,
698
+ method: "GET"
699
+ }),
700
+ transformResponse: (e) => e.data
701
+ }),
702
+ saveServiceIdentity: s.mutation({
703
+ query: ({ clientId: e, oauthClientId: t, data: a }) => ({
704
+ url: `${W(e)}/${encodeURIComponent(t)}`,
705
+ method: "PUT",
706
+ body: a
707
+ }),
708
+ transformResponse: (e) => e.data,
709
+ invalidatesTags: (e, t, { clientId: a }) => [
710
+ { type: "IdentitySync", id: `identities:${a}` }
711
+ ]
712
+ }),
713
+ describeIdentitySync: s.mutation({
714
+ query: (e) => ({ url: `${U(e)}/describe`, method: "GET" }),
715
+ transformResponse: (e) => e.data
716
+ }),
717
+ listIdentitySyncRuns: s.query({
718
+ query: (e) => `${U(e)}/runs`,
719
+ transformResponse: (e) => e.data,
720
+ providesTags: (e, t, a) => [{ type: "IdentitySync", id: `runs:${a}` }]
721
+ }),
722
+ startIdentitySyncRun: s.mutation({
723
+ query: (e) => ({ url: `${U(e)}/runs`, method: "POST" }),
724
+ transformResponse: (e) => e.data,
725
+ invalidatesTags: (e, t, a) => [{ type: "IdentitySync", id: `runs:${a}` }]
726
+ }),
727
+ getIdentitySyncRun: s.query({
728
+ query: ({ clientId: e, runId: t }) => `${U(e)}/runs/${encodeURIComponent(t)}`,
729
+ transformResponse: (e) => e.data,
730
+ providesTags: (e, t, { runId: a }) => [{ type: "IdentitySync", id: `run:${a}` }]
731
+ }),
732
+ decideIdentitySyncRows: s.mutation({
733
+ query: ({ clientId: e, runId: t, decision: a, accountIds: l, note: d }) => ({
734
+ url: `${U(e)}/runs/${encodeURIComponent(t)}/decisions`,
735
+ method: "POST",
736
+ body: { decision: a, accountIds: l, note: d }
737
+ }),
738
+ transformResponse: (e) => e.data,
739
+ invalidatesTags: (e, t, { runId: a }) => [{ type: "IdentitySync", id: `run:${a}` }]
740
+ }),
741
+ applyIdentitySyncRun: s.mutation({
742
+ query: ({ clientId: e, runId: t, resume: a }) => ({
743
+ url: `${U(e)}/runs/${encodeURIComponent(t)}/apply`,
744
+ method: "POST",
745
+ body: { resume: a }
746
+ }),
747
+ transformResponse: (e) => e.data,
748
+ invalidatesTags: (e, t, { clientId: a, runId: l }) => [
749
+ { type: "IdentitySync", id: `runs:${a}` },
750
+ { type: "IdentitySync", id: `run:${l}` }
751
+ ]
752
+ }),
753
+ listIdentitySyncRevocations: s.query({
754
+ query: ({ clientId: e, all: t }) => `${U(e)}/revocations?all=${t ? "true" : "false"}`,
755
+ transformResponse: (e) => e.data,
756
+ providesTags: (e, t, { clientId: a }) => [
757
+ { type: "IdentitySync", id: `revocations:${a}` }
758
+ ]
759
+ }),
760
+ resumeIdentitySyncRevocations: s.mutation({
761
+ query: (e) => ({ url: `${U(e)}/revocations/resume`, method: "POST" }),
762
+ transformResponse: (e) => e.data,
763
+ invalidatesTags: (e, t, a) => [
764
+ { type: "IdentitySync", id: `revocations:${a}` }
765
+ ]
766
+ }),
767
+ restoreIdentitySyncRevocation: s.mutation({
768
+ query: ({ clientId: e, subject: t, reason: a }) => ({
769
+ url: `${U(e)}/revocations/restore`,
770
+ method: "POST",
771
+ body: { subject: t, reason: a }
772
+ }),
773
+ transformResponse: (e) => e.data,
774
+ invalidatesTags: (e, t, { clientId: a }) => [
775
+ { type: "IdentitySync", id: `revocations:${a}` }
776
+ ]
777
+ })
778
+ })
779
+ }), {
780
+ useGetIdentitySyncIntegrationQuery: Hs,
781
+ useSaveIdentitySyncIntegrationMutation: Os,
782
+ useDescribeIdentitySyncMutation: Qs,
783
+ useListServiceIdentitiesQuery: Fs,
784
+ useResolveServiceAccountMutation: Bs,
785
+ useSaveServiceIdentityMutation: zs,
786
+ useListIdentitySyncRunsQuery: Vs,
787
+ useStartIdentitySyncRunMutation: js,
788
+ useGetIdentitySyncRunQuery: Ks,
789
+ useDecideIdentitySyncRowsMutation: Ws,
790
+ useApplyIdentitySyncRunMutation: Ys,
791
+ useListIdentitySyncRevocationsQuery: Js,
792
+ useResumeIdentitySyncRevocationsMutation: Xs,
793
+ useRestoreIdentitySyncRevocationMutation: Zs
794
+ } = Ze;
795
+ function et({ userId: s }) {
796
+ const e = te(), { data: t, isLoading: a, isFetching: l, isError: d, error: c, refetch: f } = Ye(s), [S, { isLoading: g }] = Je(), [m, x] = T([]), [C, E] = T({});
797
+ ee(() => {
798
+ t && (x(t.directAccess?.realmRoles ?? t.effectiveAccess.realmRoles ?? []), E(t.directAccess?.clientRoles ?? t.effectiveAccess.clientRoles ?? {}));
799
+ }, [t]);
800
+ const I = w(
801
+ () => (t?.assignable.realmRoles ?? []).map((o) => ({
802
+ id: o.name,
803
+ text: o.displayName || o.name
804
+ })),
805
+ [t?.assignable.realmRoles]
806
+ ), G = w(
807
+ () => tt(t?.effectiveAccess.permissions ?? []),
808
+ [t?.effectiveAccess.permissions]
809
+ ), _ = w(
810
+ () => (t?.effectiveAccess.grantSources ?? []).filter(
811
+ (o) => o.grantedByType.startsWith("group")
812
+ ),
813
+ [t?.effectiveAccess.grantSources]
814
+ ), N = w(() => st(_), [_]), M = (o, h) => {
815
+ E((L) => ({
816
+ ...L,
817
+ [o.clientId]: h
818
+ }));
819
+ }, D = async () => {
820
+ try {
821
+ await S({
822
+ userId: s,
823
+ data: {
824
+ realmRoles: m,
825
+ clientRoles: C
826
+ }
827
+ }).unwrap(), e.success("Access updated", "User roles and effective permissions were updated.");
828
+ } catch (o) {
829
+ e.error("Access update failed", ue(o, "Unable to update user access."));
830
+ }
831
+ };
832
+ return a ? /* @__PURE__ */ r(k, { description: "Loading user access..." }) : d || !t ? /* @__PURE__ */ u($, { gap: 4, children: [
833
+ /* @__PURE__ */ r(
834
+ fe,
835
+ {
836
+ title: "Unable to load user access",
837
+ subtitle: ue(c, "Check RBAC configuration and try again.")
838
+ }
839
+ ),
840
+ /* @__PURE__ */ r(A, { kind: "secondary", size: "sm", onClick: () => f(), children: "Retry" })
841
+ ] }) : /* @__PURE__ */ u($, { gap: 5, children: [
842
+ l && /* @__PURE__ */ r(k, { description: "Refreshing access profile..." }),
843
+ /* @__PURE__ */ r(z, { children: /* @__PURE__ */ u($, { gap: 4, children: [
844
+ /* @__PURE__ */ r("strong", { children: "Realm roles" }),
845
+ /* @__PURE__ */ r("small", { children: "These are direct user realm roles. Group-derived roles are shown as inherited access below." }),
846
+ /* @__PURE__ */ r(
847
+ J,
848
+ {
849
+ id: `user-${s}-realm-roles`,
850
+ titleText: "Realm roles",
851
+ label: "Select realm roles",
852
+ items: I,
853
+ itemToString: (o) => o?.text ?? "",
854
+ selectedItems: I.filter((o) => m.includes(o.id)),
855
+ onChange: ({ selectedItems: o }) => {
856
+ x((o ?? []).map((h) => h.id));
857
+ }
858
+ }
859
+ )
860
+ ] }) }),
861
+ /* @__PURE__ */ r(z, { children: /* @__PURE__ */ u($, { gap: 5, children: [
862
+ /* @__PURE__ */ r("strong", { children: "System roles and app access" }),
863
+ /* @__PURE__ */ r("small", { children: "These are direct user system roles. Group-derived system roles are read-only in the inherited access section." }),
864
+ t.assignable.systems.map((o) => {
865
+ const h = o.roles.map((i) => ({
866
+ id: i.name,
867
+ text: i.displayName || i.name
868
+ })), L = C[o.clientId] ?? [];
869
+ return /* @__PURE__ */ u($, { gap: 3, children: [
870
+ /* @__PURE__ */ u("div", { children: [
871
+ /* @__PURE__ */ r("strong", { children: o.displayName || o.clientId }),
872
+ /* @__PURE__ */ r("div", { children: /* @__PURE__ */ r("small", { children: o.clientId }) })
873
+ ] }),
874
+ /* @__PURE__ */ r(
875
+ J,
876
+ {
877
+ id: `user-${s}-${o.clientId}-roles`,
878
+ titleText: "System roles",
879
+ label: "Select system roles",
880
+ items: h,
881
+ itemToString: (i) => i?.text ?? "",
882
+ selectedItems: h.filter((i) => L.includes(i.id)),
883
+ onChange: ({ selectedItems: i }) => {
884
+ M(
885
+ o,
886
+ (i ?? []).map((b) => b.id)
887
+ );
888
+ }
889
+ }
890
+ ),
891
+ o.accessRoles.length > 0 && /* @__PURE__ */ u("div", { children: [
892
+ /* @__PURE__ */ r("small", { children: "App access roles" }),
893
+ /* @__PURE__ */ r(ce, { values: o.accessRoles, type: "cyan" })
894
+ ] })
895
+ ] }, o.clientId);
896
+ })
897
+ ] }) }),
898
+ /* @__PURE__ */ r(z, { children: /* @__PURE__ */ u($, { gap: 4, children: [
899
+ /* @__PURE__ */ r("strong", { children: "Groups and inherited access" }),
900
+ t.effectiveAccess.groups && t.effectiveAccess.groups.length > 0 ? /* @__PURE__ */ r("div", { className: "user-access-group-list", children: t.effectiveAccess.groups.map((o) => /* @__PURE__ */ u("div", { className: "user-access-group", children: [
901
+ /* @__PURE__ */ u("div", { children: [
902
+ /* @__PURE__ */ r("strong", { children: o.displayName || o.name || o.path }),
903
+ /* @__PURE__ */ r("div", { children: /* @__PURE__ */ r("small", { children: o.path }) })
904
+ ] }),
905
+ /* @__PURE__ */ r(Z, { size: "sm", type: "purple", children: "Inherited" }),
906
+ /* @__PURE__ */ u("small", { children: [
907
+ "Inherited from group ",
908
+ o.displayName || o.name || o.path,
909
+ ". Edit the group or Keycloak membership to change this access."
910
+ ] }),
911
+ /* @__PURE__ */ r(at, { sources: N[o.id] ?? [] })
912
+ ] }, o.id || o.path)) }) : /* @__PURE__ */ r("small", { children: "No Keycloak groups are synced for this user." })
913
+ ] }) }),
914
+ /* @__PURE__ */ r(z, { children: /* @__PURE__ */ u($, { gap: 4, children: [
915
+ /* @__PURE__ */ r("strong", { children: "Effective permissions" }),
916
+ Object.entries(G).map(([o, h]) => /* @__PURE__ */ u("div", { children: [
917
+ /* @__PURE__ */ r("small", { children: o }),
918
+ /* @__PURE__ */ r(ce, { values: h.map((L) => L.key), type: "green" })
919
+ ] }, o)),
920
+ t.effectiveAccess.permissions.length === 0 && /* @__PURE__ */ r("small", { children: "No permissions resolved for this user." })
921
+ ] }) }),
922
+ /* @__PURE__ */ r(A, { kind: "primary", disabled: g, onClick: D, children: g ? "Saving access..." : "Save access" })
923
+ ] });
924
+ }
925
+ function tt(s) {
926
+ return s.reduce((e, t) => {
927
+ const a = t.category || t.key.split(":")[0] || "other";
928
+ return e[a] = [...e[a] ?? [], t], e;
929
+ }, {});
930
+ }
931
+ function ce({ values: s, type: e }) {
932
+ return /* @__PURE__ */ r("div", { className: "user-access-tag-list", children: s.map((t) => /* @__PURE__ */ r(Z, { size: "sm", type: e, children: t }, t)) });
933
+ }
934
+ function st(s) {
935
+ return s.reduce((e, t) => {
936
+ const a = t.groupId || "unknown";
937
+ return e[a] = [...e[a] ?? [], t], e;
938
+ }, {});
939
+ }
940
+ function at({ sources: s }) {
941
+ return s.length === 0 ? /* @__PURE__ */ r("small", { children: "Groups synced, but no group-derived permissions are mapped yet." }) : /* @__PURE__ */ r("div", { className: "user-access-inherited-list", children: s.map((e) => /* @__PURE__ */ u(
942
+ Z,
943
+ {
944
+ size: "sm",
945
+ type: "purple",
946
+ children: [
947
+ e.permissionKey,
948
+ e.role ? ` via ${e.role}` : "",
949
+ e.systemName || e.systemClientId ? ` (${e.systemName || e.systemClientId})` : ""
950
+ ]
951
+ },
952
+ `${e.grantedByType}-${e.permissionKey}-${e.role}-${e.systemClientId ?? ""}`
953
+ )) });
954
+ }
955
+ function ue(s, e) {
956
+ if (!s || typeof s != "object")
957
+ return e;
958
+ const t = s;
959
+ return typeof t.data?.message == "string" ? t.data.message : typeof t.data?.error?.message == "string" ? t.data.error.message : typeof t.error == "string" ? t.error : e;
960
+ }
961
+ const me = (s) => ({
962
+ username: s?.username ?? "",
963
+ email: s?.email ?? "",
964
+ firstName: s?.firstName ?? "",
965
+ lastName: s?.lastName ?? "",
966
+ realmRoles: s?.realmRoles ?? [],
967
+ enabled: s?.enabled ?? s?.isActive ?? !0,
968
+ emailVerified: s?.emailVerified ?? !0
969
+ });
970
+ function rt({ mode: s, initialUser: e, onSuccess: t }) {
971
+ const a = he(ge), l = s === "edit" && e?.id === a?.id, d = te(), [c, f] = T(() => me(e)), [S, g] = T(null), [m, { isLoading: x }] = Fe(), [C, { isLoading: E }] = Be(), { data: I, isLoading: G } = We(), _ = x || E, N = w(
972
+ () => (I?.realmRoles ?? []).map((i) => ({
973
+ id: i.name,
974
+ text: i.displayName || i.name
975
+ })),
976
+ [I?.realmRoles]
977
+ );
978
+ ee(() => {
979
+ f(me(e)), g(null);
980
+ }, [e, s]);
981
+ const M = (i) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(i), D = () => ({
982
+ email: c.email.trim().toLowerCase(),
983
+ firstName: c.firstName.trim(),
984
+ lastName: c.lastName.trim(),
985
+ realmRoles: c.realmRoles,
986
+ enabled: c.enabled,
987
+ emailVerified: c.emailVerified
988
+ }), o = w(() => !(!c.username.trim() || !c.firstName.trim() || !c.lastName.trim() || !M(c.email)), [c]), h = (i, b) => {
989
+ f((Q) => ({ ...Q, [i]: b }));
990
+ }, L = async () => {
991
+ if (!(!o || _)) {
992
+ g(null);
993
+ try {
994
+ s === "create" ? (await m({
995
+ username: c.username.trim().toLowerCase(),
996
+ ...D()
997
+ }).unwrap(), d.success("User created", `User "${c.username}" was created successfully`)) : e?.id && (await C({
998
+ id: e.id,
999
+ data: D()
1000
+ }).unwrap(), d.success("User updated", `Changes to "${c.username}" were saved`)), t?.();
1001
+ } catch (i) {
1002
+ const b = nt(i) ?? (s === "create" ? "Failed to create user" : "Failed to update user");
1003
+ g(b), d.error("Operation failed", "Please review the form and try again");
1004
+ }
1005
+ }
1006
+ };
1007
+ return /* @__PURE__ */ r(Ue, { children: /* @__PURE__ */ u($, { gap: 6, children: [
1008
+ S && /* @__PURE__ */ r(fe, { title: "Unable to save user", subtitle: S }),
1009
+ /* @__PURE__ */ r(oe, { legendText: "User details", children: /* @__PURE__ */ u($, { gap: 4, children: [
1010
+ /* @__PURE__ */ r(
1011
+ V,
1012
+ {
1013
+ id: "username",
1014
+ labelText: "Username",
1015
+ required: !0,
1016
+ disabled: s === "edit",
1017
+ helperText: s === "edit" ? "Username cannot be changed" : void 0,
1018
+ value: c.username,
1019
+ onChange: (i) => {
1020
+ h("username", i.target.value.toLowerCase());
1021
+ }
1022
+ }
1023
+ ),
1024
+ /* @__PURE__ */ r(
1025
+ V,
1026
+ {
1027
+ id: "email",
1028
+ labelText: "Email",
1029
+ type: "email",
1030
+ required: !0,
1031
+ value: c.email,
1032
+ invalid: !!c.email && !M(c.email),
1033
+ invalidText: "Enter a valid email address",
1034
+ onChange: (i) => {
1035
+ h("email", i.target.value);
1036
+ }
1037
+ }
1038
+ ),
1039
+ /* @__PURE__ */ r(
1040
+ V,
1041
+ {
1042
+ id: "firstName",
1043
+ labelText: "First name",
1044
+ required: !0,
1045
+ value: c.firstName,
1046
+ onChange: (i) => {
1047
+ h("firstName", i.target.value);
1048
+ }
1049
+ }
1050
+ ),
1051
+ /* @__PURE__ */ r(
1052
+ V,
1053
+ {
1054
+ id: "lastName",
1055
+ labelText: "Last name",
1056
+ required: !0,
1057
+ value: c.lastName,
1058
+ onChange: (i) => {
1059
+ h("lastName", i.target.value);
1060
+ }
1061
+ }
1062
+ )
1063
+ ] }) }),
1064
+ /* @__PURE__ */ r(oe, { legendText: "Access control", children: /* @__PURE__ */ u($, { gap: 4, children: [
1065
+ /* @__PURE__ */ r(
1066
+ J,
1067
+ {
1068
+ id: "realmRoles",
1069
+ titleText: "Realm roles",
1070
+ label: G ? "Loading realm roles..." : "Realm roles",
1071
+ items: N,
1072
+ itemToString: (i) => i?.text ?? "",
1073
+ selectedItems: N.filter((i) => c.realmRoles.includes(i.id)),
1074
+ disabled: G,
1075
+ onChange: ({ selectedItems: i }) => {
1076
+ h(
1077
+ "realmRoles",
1078
+ (i ?? []).map((b) => b.id)
1079
+ );
1080
+ }
1081
+ }
1082
+ ),
1083
+ /* @__PURE__ */ r(
1084
+ X,
1085
+ {
1086
+ id: "enabled",
1087
+ labelText: "User enabled",
1088
+ disabled: l,
1089
+ checked: c.enabled,
1090
+ onChange: (i, { checked: b }) => {
1091
+ h("enabled", b);
1092
+ }
1093
+ }
1094
+ ),
1095
+ /* @__PURE__ */ r(
1096
+ X,
1097
+ {
1098
+ id: "emailVerified",
1099
+ labelText: "Email verified",
1100
+ checked: c.emailVerified,
1101
+ onChange: (i, { checked: b }) => {
1102
+ h("emailVerified", b);
1103
+ }
1104
+ }
1105
+ )
1106
+ ] }) }),
1107
+ /* @__PURE__ */ r($, { orientation: "horizontal", gap: 3, children: /* @__PURE__ */ r(A, { kind: "primary", disabled: !o || _, onClick: L, children: _ ? /* @__PURE__ */ r(
1108
+ k,
1109
+ {
1110
+ description: s === "create" ? "Creating user…" : "Saving changes…"
1111
+ }
1112
+ ) : s === "create" ? "Create user" : "Save changes" }) })
1113
+ ] }) });
1114
+ }
1115
+ function nt(s) {
1116
+ if (!s || typeof s != "object")
1117
+ return;
1118
+ const e = s;
1119
+ if (typeof e.data?.message == "string")
1120
+ return e.data.message;
1121
+ if (typeof e.data?.error?.message == "string")
1122
+ return e.data.error.message;
1123
+ if (typeof e.error == "string")
1124
+ return e.error;
1125
+ }
1126
+ function ot({ username: s, enabled: e, onConfirm: t, onCancel: a }) {
1127
+ const [l, d] = T(!1);
1128
+ async function c() {
1129
+ try {
1130
+ d(!0), await t();
1131
+ } finally {
1132
+ d(!1);
1133
+ }
1134
+ }
1135
+ return /* @__PURE__ */ u("div", { className: "user-confirm-modal", children: [
1136
+ /* @__PURE__ */ u("p", { children: [
1137
+ "Are you sure you want to ",
1138
+ /* @__PURE__ */ r("strong", { children: e ? "disable" : "enable" }),
1139
+ " the user",
1140
+ " ",
1141
+ /* @__PURE__ */ r("strong", { children: s }),
1142
+ "?"
1143
+ ] }),
1144
+ /* @__PURE__ */ r("p", { className: "user-confirm-modal__description", children: e ? "The user will no longer be able to log in." : "The user will regain access to the platform." }),
1145
+ l && /* @__PURE__ */ r(k, { description: e ? "Disabling user…" : "Enabling user…" }),
1146
+ /* @__PURE__ */ u("div", { className: "user-confirm-modal__actions", children: [
1147
+ /* @__PURE__ */ r(A, { kind: "secondary", onClick: a, disabled: l, children: "Cancel" }),
1148
+ /* @__PURE__ */ r(A, { kind: e ? "danger" : "primary", onClick: c, disabled: l, children: e ? "Disable user" : "Enable user" })
1149
+ ] })
1150
+ ] });
1151
+ }
1152
+ function it() {
1153
+ const { openModal: s, closeModal: e } = Se();
1154
+ function t({ username: a, enabled: l, onConfirm: d }) {
1155
+ s({
1156
+ title: l ? "Disable user" : "Enable user",
1157
+ size: "sm",
1158
+ content: /* @__PURE__ */ r(
1159
+ ot,
1160
+ {
1161
+ username: a,
1162
+ enabled: l,
1163
+ onConfirm: async () => {
1164
+ await d(), e();
1165
+ },
1166
+ onCancel: e
1167
+ }
1168
+ ),
1169
+ onClose: e
1170
+ });
1171
+ }
1172
+ return { openEnableUserModal: t };
1173
+ }
1174
+ function lt({
1175
+ username: s,
1176
+ email: e,
1177
+ onConfirm: t,
1178
+ onCancel: a
1179
+ }) {
1180
+ const [l, d] = T(!1);
1181
+ async function c() {
1182
+ try {
1183
+ d(!0), await t();
1184
+ } finally {
1185
+ d(!1);
1186
+ }
1187
+ }
1188
+ return /* @__PURE__ */ u("div", { className: "user-confirm-modal", children: [
1189
+ /* @__PURE__ */ u("p", { children: [
1190
+ "This will initiate a password reset for ",
1191
+ /* @__PURE__ */ r("strong", { children: s }),
1192
+ "."
1193
+ ] }),
1194
+ /* @__PURE__ */ r("p", { className: "user-confirm-modal__description", children: e ? `A password reset email will be sent to ${e}.` : "The user will be required to set a new password on next login." }),
1195
+ l && /* @__PURE__ */ r(k, { description: "Sending password reset…" }),
1196
+ /* @__PURE__ */ u("div", { className: "user-confirm-modal__actions", children: [
1197
+ /* @__PURE__ */ r(A, { kind: "secondary", onClick: a, disabled: l, children: "Cancel" }),
1198
+ /* @__PURE__ */ r(A, { kind: "danger", onClick: c, disabled: l, children: "Reset password" })
1199
+ ] })
1200
+ ] });
1201
+ }
1202
+ function dt() {
1203
+ const { openModal: s, closeModal: e } = Se();
1204
+ function t({ username: a, email: l, onConfirm: d }) {
1205
+ s({
1206
+ title: "Reset password",
1207
+ size: "sm",
1208
+ content: /* @__PURE__ */ r(
1209
+ lt,
1210
+ {
1211
+ username: a,
1212
+ email: l,
1213
+ onConfirm: async () => {
1214
+ await d(), e();
1215
+ },
1216
+ onCancel: e
1217
+ }
1218
+ ),
1219
+ onClose: e
1220
+ });
1221
+ }
1222
+ return { openResetPasswordModal: t };
1223
+ }
1224
+ const pe = [
1225
+ { id: "all", label: "All" },
1226
+ { id: "active", label: "Active" },
1227
+ { id: "disabled", label: "Disabled" }
1228
+ ];
1229
+ function ct({
1230
+ onReset: s,
1231
+ status: e,
1232
+ roles: t,
1233
+ selectedRole: a,
1234
+ neverLoggedIn: l,
1235
+ hasActiveFilters: d = !0,
1236
+ onStatusChange: c,
1237
+ onRoleChange: f,
1238
+ onToggleNeverLoggedIn: S
1239
+ }) {
1240
+ const g = t.map((m) => ({
1241
+ id: m,
1242
+ label: m === "all" ? "All" : m
1243
+ }));
1244
+ return /* @__PURE__ */ u($, { orientation: "horizontal", gap: 5, className: "user-filters", children: [
1245
+ /* @__PURE__ */ r(
1246
+ ie,
1247
+ {
1248
+ id: "user-status-filter",
1249
+ label: "Status",
1250
+ titleText: "Status",
1251
+ items: pe,
1252
+ selectedItem: pe.find((m) => m.id === e) ?? null,
1253
+ itemToString: (m) => m?.label ?? "",
1254
+ className: "user-filters__field--status",
1255
+ onChange: ({ selectedItem: m }) => {
1256
+ m && c(m.id);
1257
+ }
1258
+ }
1259
+ ),
1260
+ /* @__PURE__ */ r(
1261
+ ie,
1262
+ {
1263
+ id: "user-role-filter",
1264
+ label: "Role",
1265
+ titleText: "Role",
1266
+ items: g,
1267
+ selectedItem: g.find((m) => m.id === a) ?? null,
1268
+ itemToString: (m) => m?.label ?? "",
1269
+ className: "user-filters__field--role",
1270
+ onChange: ({ selectedItem: m }) => {
1271
+ m && f(m.id);
1272
+ }
1273
+ }
1274
+ ),
1275
+ /* @__PURE__ */ r("div", { className: "user-filters__field--checkbox", children: /* @__PURE__ */ r(
1276
+ X,
1277
+ {
1278
+ id: "user-never-logged-in-filter",
1279
+ labelText: "Never logged in",
1280
+ checked: l,
1281
+ onChange: () => S()
1282
+ }
1283
+ ) }),
1284
+ /* @__PURE__ */ r(A, { kind: "ghost", size: "md", disabled: !d, onClick: s, children: "Clear filters" })
1285
+ ] });
1286
+ }
1287
+ function ut({
1288
+ user: s,
1289
+ isCurrentUser: e = !1,
1290
+ onEdit: t,
1291
+ onManageRoles: a,
1292
+ onToggleStatus: l,
1293
+ onResetPassword: d
1294
+ }) {
1295
+ return /* @__PURE__ */ u(Ae, { size: "sm", flipped: !0, onClick: (f) => {
1296
+ f.stopPropagation();
1297
+ }, children: [
1298
+ /* @__PURE__ */ r(j, { itemText: "Edit user", hasDivider: !0, onClick: t }),
1299
+ /* @__PURE__ */ r(j, { itemText: "Manage roles", hasDivider: !0, onClick: a }),
1300
+ /* @__PURE__ */ r(
1301
+ j,
1302
+ {
1303
+ itemText: e ? "Cannot disable your own account" : s.isActive ? "Disable user" : "Enable user",
1304
+ disabled: e,
1305
+ isDelete: s.isActive,
1306
+ onClick: l
1307
+ }
1308
+ ),
1309
+ /* @__PURE__ */ r(j, { itemText: "Reset password", hasDivider: !0, onClick: d })
1310
+ ] });
1311
+ }
1312
+ function mt({
1313
+ users: s,
1314
+ currentUserId: e,
1315
+ loadingAction: t,
1316
+ onEnable: a,
1317
+ onDisable: l
1318
+ }) {
1319
+ if (s.length === 0) return null;
1320
+ const d = s.every((g) => g.isActive), c = s.every((g) => !g.isActive), f = t !== null, S = s.some((g) => g.id === e);
1321
+ return /* @__PURE__ */ u(Re, { children: [
1322
+ /* @__PURE__ */ u(_e, { className: "user-bulk-actions", children: [
1323
+ /* @__PURE__ */ r(A, { kind: "secondary", disabled: d || f, onClick: a, children: t === "enable" ? /* @__PURE__ */ r(k, { description: "Enabling…" }) : `Enable (${s.length})` }),
1324
+ /* @__PURE__ */ r(
1325
+ A,
1326
+ {
1327
+ kind: "danger",
1328
+ disabled: c || f || S,
1329
+ onClick: l,
1330
+ children: t === "disable" ? /* @__PURE__ */ r(k, { description: "Disabling…" }) : `Disable (${s.length})`
1331
+ }
1332
+ )
1333
+ ] }),
1334
+ S && /* @__PURE__ */ r("p", { children: "Deselect your account to disable other users. You cannot disable your own account." })
1335
+ ] });
1336
+ }
1337
+ const pt = [
1338
+ { key: "username", header: "Username" },
1339
+ { key: "email", header: "Email" },
1340
+ { key: "status", header: "Status" },
1341
+ { key: "verified", header: "Email verified" },
1342
+ { key: "lastLogin", header: "Last login" },
1343
+ { key: "actions", header: "" },
1344
+ { key: "raw", header: "" }
1345
+ ], ye = {
1346
+ email: "users-table__col--hide-sm",
1347
+ verified: "users-table__col--hide-md",
1348
+ lastLogin: "users-table__col--hide-md"
1349
+ };
1350
+ function yt() {
1351
+ const s = he(ge), { openPanel: e, closePanel: t } = Ne(), { openEnableUserModal: a } = it(), { openResetPasswordModal: l } = dt(), d = te(), [c, f] = T(null), [S, g] = T(""), [m, x] = T("all"), [C, E] = T("all"), [I, G] = T(!1), [_, N] = T(1), [M, D] = T(10), { data: o = [], isLoading: h, isError: L, error: i, refetch: b } = ze(), [Q] = Ve(), [be] = je();
1352
+ ee(() => {
1353
+ N(1);
1354
+ }, [m, C, I, S]);
1355
+ const Te = w(() => {
1356
+ const p = /* @__PURE__ */ new Set();
1357
+ return o.forEach((v) => {
1358
+ v.realmRoles?.forEach((H) => p.add(H));
1359
+ }), ["all", ...Array.from(p)];
1360
+ }, [o]), B = w(() => {
1361
+ const p = S.trim().toLowerCase();
1362
+ return o.filter((v) => {
1363
+ if (p && ![v.username, v.email, v.firstName, v.lastName].some(
1364
+ (K) => K?.toLowerCase().includes(p)
1365
+ ))
1366
+ return !1;
1367
+ const H = v.enabled ?? v.isActive ?? !1;
1368
+ return !(m === "active" && !H || m === "disabled" && H || I && v.lastLoginAt || C !== "all" && !v.realmRoles?.includes(C));
1369
+ });
1370
+ }, [o, m, C, I, S]), ve = w(() => {
1371
+ const p = (_ - 1) * M;
1372
+ return B.slice(p, p + M);
1373
+ }, [B, _, M]).map((p) => ({
1374
+ id: p.id,
1375
+ username: p.username,
1376
+ email: p.email ?? "—",
1377
+ status: p.enabled ?? p.isActive ? "Active" : "Disabled",
1378
+ verified: p.emailVerified ? "Verified" : "Not verified",
1379
+ lastLogin: p.lastLoginAt ? new Date(p.lastLoginAt).toLocaleString() : "Never",
1380
+ actions: "",
1381
+ raw: p
1382
+ })), ae = () => {
1383
+ g(""), x("all"), E("all"), G(!1);
1384
+ }, re = S.trim() !== "" || m !== "all" || C !== "all" || I;
1385
+ return /* @__PURE__ */ r(
1386
+ ke,
1387
+ {
1388
+ title: "Users",
1389
+ description: "Manage users, roles, and access to applications.",
1390
+ rows: ve,
1391
+ headers: pt,
1392
+ getRowId: (p) => p.id,
1393
+ isLoading: h,
1394
+ loadingDescription: "Loading users…",
1395
+ tableState: L ? /* @__PURE__ */ r(
1396
+ Qe,
1397
+ {
1398
+ title: "Failed to load users",
1399
+ description: Y(i, "Failed to load users"),
1400
+ primaryAction: { label: "Retry", onClick: b }
1401
+ }
1402
+ ) : void 0,
1403
+ searchValue: S,
1404
+ onSearch: g,
1405
+ searchPlaceholder: "Search users by name or email",
1406
+ resultsDescription: !h && !L ? `${B.length} of ${o.length} users` : void 0,
1407
+ emptyActions: o.length > 0 && re ? /* @__PURE__ */ r(A, { kind: "ghost", onClick: ae, children: "Clear filters" }) : void 0,
1408
+ emptyTitle: o.length === 0 ? "No users yet" : "No matching users",
1409
+ emptyDescription: o.length === 0 ? "Users will appear here once they are created or synced." : "No users match the current search or filters.",
1410
+ filters: /* @__PURE__ */ r(
1411
+ ct,
1412
+ {
1413
+ onReset: ae,
1414
+ status: m,
1415
+ roles: Te,
1416
+ selectedRole: C,
1417
+ neverLoggedIn: I,
1418
+ hasActiveFilters: re,
1419
+ onStatusChange: x,
1420
+ onRoleChange: E,
1421
+ onToggleNeverLoggedIn: () => {
1422
+ G((p) => !p);
1423
+ }
1424
+ }
1425
+ ),
1426
+ children: ({ rows: p, headers: v }) => /* @__PURE__ */ r(Le, { rows: p, headers: v, children: ({ rows: H, headers: K, getHeaderProps: $e, getRowProps: Ce, getSelectionProps: ne, selectedRows: Ie }) => {
1427
+ const O = Ie.map(
1428
+ (R) => R.cells.find((y) => y.info.header === "raw")?.value
1429
+ );
1430
+ return /* @__PURE__ */ u(Re, { children: [
1431
+ /* @__PURE__ */ r(
1432
+ mt,
1433
+ {
1434
+ users: O,
1435
+ currentUserId: s?.id,
1436
+ loadingAction: c,
1437
+ onEnable: async () => {
1438
+ try {
1439
+ f("enable"), await Promise.all(
1440
+ O.map((R) => Q({ id: R.id, enabled: !0 }).unwrap())
1441
+ ), d.success({
1442
+ title: "Users enabled",
1443
+ subtitle: `${O.length} user(s) enabled.`
1444
+ });
1445
+ } catch {
1446
+ d.error({
1447
+ title: "Enable failed",
1448
+ subtitle: "Some users could not be enabled."
1449
+ });
1450
+ } finally {
1451
+ f(null);
1452
+ }
1453
+ },
1454
+ onDisable: async () => {
1455
+ if (O.some((R) => R.id === s?.id)) {
1456
+ d.error({
1457
+ title: "Cannot disable your own account",
1458
+ subtitle: "Deselect your account before disabling other users."
1459
+ });
1460
+ return;
1461
+ }
1462
+ try {
1463
+ f("disable"), await Promise.all(
1464
+ O.map((R) => Q({ id: R.id, enabled: !1 }).unwrap())
1465
+ ), d.warning({
1466
+ title: "Users disabled",
1467
+ subtitle: `${O.length} user(s) disabled.`
1468
+ });
1469
+ } catch {
1470
+ d.error({
1471
+ title: "Disable failed",
1472
+ subtitle: "Some users could not be disabled."
1473
+ });
1474
+ } finally {
1475
+ f(null);
1476
+ }
1477
+ }
1478
+ }
1479
+ ),
1480
+ /* @__PURE__ */ u(Pe, { children: [
1481
+ /* @__PURE__ */ r(Me, { children: /* @__PURE__ */ u(le, { children: [
1482
+ /* @__PURE__ */ r(we, { ...ne() }),
1483
+ K.filter((R) => R.key !== "raw").map((R) => /* @__PURE__ */ r(
1484
+ xe,
1485
+ {
1486
+ ...$e({ header: R }),
1487
+ className: ye[R.key],
1488
+ children: R.header
1489
+ }
1490
+ ))
1491
+ ] }) }),
1492
+ /* @__PURE__ */ r(Ee, { children: H.map((R) => {
1493
+ const y = R.cells.find((q) => q.info.header === "raw")?.value;
1494
+ return /* @__PURE__ */ u(le, { ...Ce({ row: R }), children: [
1495
+ /* @__PURE__ */ r(Ge, { ...ne({ row: R }) }),
1496
+ R.cells.map((q) => q.info.header === "raw" ? null : q.info.header === "status" ? /* @__PURE__ */ r(de, { children: /* @__PURE__ */ r(De, { status: String(q.value) }) }, q.id) : q.info.header === "actions" ? /* @__PURE__ */ r(He, { children: /* @__PURE__ */ r(
1497
+ ut,
1498
+ {
1499
+ user: y,
1500
+ isCurrentUser: y.id === s?.id,
1501
+ onEdit: () => {
1502
+ e({
1503
+ title: "Edit user",
1504
+ content: /* @__PURE__ */ r(
1505
+ rt,
1506
+ {
1507
+ mode: "edit",
1508
+ initialUser: y,
1509
+ onSuccess: t
1510
+ },
1511
+ `edit-user-${y.id}`
1512
+ ),
1513
+ size: "md"
1514
+ });
1515
+ },
1516
+ onManageRoles: () => {
1517
+ e({
1518
+ title: `Roles: ${y.username}`,
1519
+ size: "lg",
1520
+ content: /* @__PURE__ */ r(
1521
+ et,
1522
+ {
1523
+ userId: y.id
1524
+ },
1525
+ `user-access-${y.id}`
1526
+ )
1527
+ });
1528
+ },
1529
+ onToggleStatus: () => {
1530
+ const F = y.enabled ?? y.isActive ?? !1;
1531
+ a({
1532
+ username: y.username,
1533
+ enabled: F,
1534
+ onConfirm: async () => {
1535
+ try {
1536
+ await Q({
1537
+ id: y.id,
1538
+ enabled: !F
1539
+ }).unwrap(), d.success({
1540
+ title: "User updated",
1541
+ subtitle: `${y.username} ${F ? "disabled" : "enabled"}.`
1542
+ });
1543
+ } catch (qe) {
1544
+ d.error({
1545
+ title: "Update failed",
1546
+ subtitle: Y(
1547
+ qe,
1548
+ `Failed to update ${y.username}.`
1549
+ )
1550
+ });
1551
+ }
1552
+ }
1553
+ });
1554
+ },
1555
+ onResetPassword: () => {
1556
+ l({
1557
+ username: y.username,
1558
+ email: y.email,
1559
+ onConfirm: async () => {
1560
+ try {
1561
+ await be(y.id).unwrap(), d.success({
1562
+ title: "Password reset sent",
1563
+ subtitle: y.email ? `Reset email sent to ${y.email}.` : `Password reset started for ${y.username}.`
1564
+ });
1565
+ } catch (F) {
1566
+ d.error({
1567
+ title: "Password reset failed",
1568
+ subtitle: Y(
1569
+ F,
1570
+ `Failed to reset password for ${y.username}.`
1571
+ )
1572
+ });
1573
+ }
1574
+ }
1575
+ });
1576
+ }
1577
+ }
1578
+ ) }, q.id) : /* @__PURE__ */ r(
1579
+ de,
1580
+ {
1581
+ className: ye[q.info.header],
1582
+ children: q.value
1583
+ },
1584
+ q.id
1585
+ ))
1586
+ ] });
1587
+ }) })
1588
+ ] }),
1589
+ /* @__PURE__ */ r(
1590
+ Oe,
1591
+ {
1592
+ page: _,
1593
+ pageSize: M,
1594
+ totalItems: B.length,
1595
+ onChange: ({ page: R, pageSize: y }) => {
1596
+ N(R), D(y);
1597
+ }
1598
+ }
1599
+ )
1600
+ ] });
1601
+ } })
1602
+ }
1603
+ );
1604
+ }
1605
+ function Y(s, e) {
1606
+ if (!s || typeof s != "object")
1607
+ return e;
1608
+ const t = s;
1609
+ return typeof t.data?.message == "string" ? t.data.message : typeof t.data?.error?.message == "string" ? t.data.error.message : typeof t.error == "string" ? t.error : e;
1610
+ }
1611
+ function ea(s) {
1612
+ return /* @__PURE__ */ r("div", { className: "moh-microfrontend-root", children: /* @__PURE__ */ r(yt, {}) });
1613
+ }
1614
+ export {
1615
+ rt as U,
1616
+ yt as a,
1617
+ ea as b
1618
+ };
1619
+ //# sourceMappingURL=root.component-C62grxQn.js.map