@alepha/ui 0.28.0 → 0.29.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.
- package/README.md +31 -2
- package/dist/components/account/account-connections.d.ts.map +1 -1
- package/dist/components/account/account-connections.js +4 -1
- package/dist/components/account/account-connections.js.map +1 -1
- package/dist/components/account/account-delete-dialog.d.ts.map +1 -1
- package/dist/components/account/account-delete-dialog.js +12 -15
- package/dist/components/account/account-delete-dialog.js.map +1 -1
- package/dist/components/account/account-keys.d.ts.map +1 -1
- package/dist/components/account/account-keys.js +22 -28
- package/dist/components/account/account-keys.js.map +1 -1
- package/dist/components/account/account-mfa-dialog.js +1 -4
- package/dist/components/account/account-mfa-dialog.js.map +1 -1
- package/dist/components/account/account-password-dialog.d.ts.map +1 -1
- package/dist/components/account/account-password-dialog.js +11 -14
- package/dist/components/account/account-password-dialog.js.map +1 -1
- package/dist/components/account/account-profile.js +3 -2
- package/dist/components/account/account-profile.js.map +1 -1
- package/dist/components/account/account-router-options.d.ts +38 -0
- package/dist/components/account/account-router-options.d.ts.map +1 -1
- package/dist/components/account/account-router-options.js.map +1 -1
- package/dist/components/account/account-router-page.d.ts +11 -1
- package/dist/components/account/account-router-page.d.ts.map +1 -1
- package/dist/components/account/account-router-page.js +11 -1
- package/dist/components/account/account-router-page.js.map +1 -1
- package/dist/components/account/account-router.d.ts +11 -0
- package/dist/components/account/account-router.d.ts.map +1 -1
- package/dist/components/account/account-router.js +16 -5
- package/dist/components/account/account-router.js.map +1 -1
- package/dist/components/admin/admin-audits.d.ts.map +1 -1
- package/dist/components/admin/admin-audits.js +91 -34
- package/dist/components/admin/admin-audits.js.map +1 -1
- package/dist/components/admin/admin-files.d.ts.map +1 -1
- package/dist/components/admin/admin-files.js +6 -17
- package/dist/components/admin/admin-files.js.map +1 -1
- package/dist/components/admin/admin-jobs-executions-panel.d.ts.map +1 -1
- package/dist/components/admin/admin-jobs-executions-panel.js +39 -8
- package/dist/components/admin/admin-jobs-executions-panel.js.map +1 -1
- package/dist/components/admin/admin-jobs-payload-dialog.d.ts +19 -0
- package/dist/components/admin/admin-jobs-payload-dialog.d.ts.map +1 -0
- package/dist/components/admin/admin-jobs-payload-dialog.js +33 -0
- package/dist/components/admin/admin-jobs-payload-dialog.js.map +1 -0
- package/dist/components/admin/admin-keys.d.ts.map +1 -1
- package/dist/components/admin/admin-keys.js +5 -4
- package/dist/components/admin/admin-keys.js.map +1 -1
- package/dist/components/admin/admin-notifications-channel-label.d.ts +14 -0
- package/dist/components/admin/admin-notifications-channel-label.d.ts.map +1 -0
- package/dist/components/admin/admin-notifications-channel-label.js +26 -0
- package/dist/components/admin/admin-notifications-channel-label.js.map +1 -0
- package/dist/components/admin/admin-notifications-preview-body.d.ts.map +1 -1
- package/dist/components/admin/admin-notifications-preview-body.js +23 -13
- package/dist/components/admin/admin-notifications-preview-body.js.map +1 -1
- package/dist/components/admin/admin-notifications.d.ts.map +1 -1
- package/dist/components/admin/admin-notifications.js +11 -12
- package/dist/components/admin/admin-notifications.js.map +1 -1
- package/dist/components/admin/admin-payments.d.ts.map +1 -1
- package/dist/components/admin/admin-payments.js +9 -7
- package/dist/components/admin/admin-payments.js.map +1 -1
- package/dist/components/admin/admin-router-options.d.ts +12 -0
- package/dist/components/admin/admin-router-options.d.ts.map +1 -1
- package/dist/components/admin/admin-router-options.js.map +1 -1
- package/dist/components/admin/admin-router.d.ts +5 -8
- package/dist/components/admin/admin-router.d.ts.map +1 -1
- package/dist/components/admin/admin-router.js +6 -29
- package/dist/components/admin/admin-router.js.map +1 -1
- package/dist/components/admin/admin-sessions.d.ts.map +1 -1
- package/dist/components/admin/admin-sessions.js +9 -7
- package/dist/components/admin/admin-sessions.js.map +1 -1
- package/dist/components/admin/admin-user-detail-audits-tab.d.ts.map +1 -1
- package/dist/components/admin/admin-user-detail-audits-tab.js +5 -4
- package/dist/components/admin/admin-user-detail-audits-tab.js.map +1 -1
- package/dist/components/admin/admin-user-detail-sessions-tab.d.ts.map +1 -1
- package/dist/components/admin/admin-user-detail-sessions-tab.js +7 -5
- package/dist/components/admin/admin-user-detail-sessions-tab.js.map +1 -1
- package/dist/components/admin/admin-user-detail.js +3 -2
- package/dist/components/admin/admin-user-detail.js.map +1 -1
- package/dist/components/admin/admin-users-roles-picker.d.ts.map +1 -1
- package/dist/components/admin/admin-users-roles-picker.js.map +1 -1
- package/dist/components/admin/admin-users.d.ts.map +1 -1
- package/dist/components/admin/admin-users.js +6 -4
- package/dist/components/admin/admin-users.js.map +1 -1
- package/dist/components/admin/analytics/AnalyticsChartBars.js +2 -1
- package/dist/components/admin/analytics/AnalyticsChartBars.js.map +1 -1
- package/dist/components/admin/parameter-history-item.d.ts.map +1 -1
- package/dist/components/admin/parameter-history-item.js +3 -2
- package/dist/components/admin/parameter-history-item.js.map +1 -1
- package/dist/components/alepha-table/alepha-table-bulk-menu.js +2 -1
- package/dist/components/alepha-table/alepha-table-bulk-menu.js.map +1 -1
- package/dist/components/alepha-table/alepha-table-filter-dialog.d.ts +60 -0
- package/dist/components/alepha-table/alepha-table-filter-dialog.d.ts.map +1 -0
- package/dist/components/alepha-table/alepha-table-filter-dialog.js +88 -0
- package/dist/components/alepha-table/alepha-table-filter-dialog.js.map +1 -0
- package/dist/components/alepha-table/alepha-table-filter-menu.d.ts +35 -0
- package/dist/components/alepha-table/alepha-table-filter-menu.d.ts.map +1 -0
- package/dist/components/alepha-table/alepha-table-filter-menu.js +54 -0
- package/dist/components/alepha-table/alepha-table-filter-menu.js.map +1 -0
- package/dist/components/alepha-table/alepha-table.d.ts +188 -3
- package/dist/components/alepha-table/alepha-table.d.ts.map +1 -1
- package/dist/components/alepha-table/alepha-table.js +551 -162
- package/dist/components/alepha-table/alepha-table.js.map +1 -1
- package/dist/components/alepha-table/query-filters.d.ts +73 -0
- package/dist/components/alepha-table/query-filters.d.ts.map +1 -0
- package/dist/components/alepha-table/query-filters.js +118 -0
- package/dist/components/alepha-table/query-filters.js.map +1 -0
- package/dist/components/app-actions/app-actions.d.ts +21 -0
- package/dist/components/app-actions/app-actions.d.ts.map +1 -1
- package/dist/components/app-actions/app-actions.js +11 -5
- package/dist/components/app-actions/app-actions.js.map +1 -1
- package/dist/components/app-shell/app-shell.d.ts +45 -0
- package/dist/components/app-shell/app-shell.d.ts.map +1 -1
- package/dist/components/app-shell/app-shell.js +119 -16
- package/dist/components/app-shell/app-shell.js.map +1 -1
- package/dist/components/auth/auth-register.js +31 -30
- package/dist/components/auth/auth-register.js.map +1 -1
- package/dist/components/auto-form/auto-form.d.ts.map +1 -1
- package/dist/components/auto-form/auto-form.js +68 -30
- package/dist/components/auto-form/auto-form.js.map +1 -1
- package/dist/components/button-dark/button-dark.d.ts.map +1 -1
- package/dist/components/button-dark/button-dark.js +39 -8
- package/dist/components/button-dark/button-dark.js.map +1 -1
- package/dist/components/button-inbox/button-inbox.d.ts +66 -0
- package/dist/components/button-inbox/button-inbox.d.ts.map +1 -0
- package/dist/components/button-inbox/button-inbox.js +167 -0
- package/dist/components/button-inbox/button-inbox.js.map +1 -0
- package/dist/components/button-inbox/inbox-unread-atom.d.ts +22 -0
- package/dist/components/button-inbox/inbox-unread-atom.d.ts.map +1 -0
- package/dist/components/button-inbox/inbox-unread-atom.js +29 -0
- package/dist/components/button-inbox/inbox-unread-atom.js.map +1 -0
- package/dist/components/button-theme/button-theme.d.ts +4 -3
- package/dist/components/button-theme/button-theme.d.ts.map +1 -1
- package/dist/components/button-theme/button-theme.js +8 -25
- package/dist/components/button-theme/button-theme.js.map +1 -1
- package/dist/components/button-user/button-user.d.ts +19 -0
- package/dist/components/button-user/button-user.d.ts.map +1 -1
- package/dist/components/button-user/button-user.js +1 -1
- package/dist/components/button-user/button-user.js.map +1 -1
- package/dist/components/control/control.d.ts +51 -0
- package/dist/components/control/control.d.ts.map +1 -1
- package/dist/components/control/control.js +49 -5
- package/dist/components/control/control.js.map +1 -1
- package/dist/components/control-array/control-array.js +2 -1
- package/dist/components/control-array/control-array.js.map +1 -1
- package/dist/components/control-date/control-date.d.ts +27 -0
- package/dist/components/control-date/control-date.d.ts.map +1 -1
- package/dist/components/control-date/control-date.js +15 -19
- package/dist/components/control-date/control-date.js.map +1 -1
- package/dist/components/control-date/date-only.d.ts +18 -0
- package/dist/components/control-date/date-only.d.ts.map +1 -0
- package/dist/components/control-date/date-only.js +29 -0
- package/dist/components/control-date/date-only.js.map +1 -0
- package/dist/components/control-date-range/control-date-range.d.ts +56 -0
- package/dist/components/control-date-range/control-date-range.d.ts.map +1 -0
- package/dist/components/control-date-range/control-date-range.js +148 -0
- package/dist/components/control-date-range/control-date-range.js.map +1 -0
- package/dist/components/control-object/control-object.js +2 -1
- package/dist/components/control-object/control-object.js.map +1 -1
- package/dist/components/control-select/control-select.d.ts.map +1 -1
- package/dist/components/control-select/control-select.js +177 -37
- package/dist/components/control-select/control-select.js.map +1 -1
- package/dist/components/control-upload/control-upload.d.ts.map +1 -1
- package/dist/components/control-upload/control-upload.js +1 -11
- package/dist/components/control-upload/control-upload.js.map +1 -1
- package/dist/components/detail/detail-aside.d.ts.map +1 -1
- package/dist/components/detail/detail-aside.js +4 -3
- package/dist/components/detail/detail-aside.js.map +1 -1
- package/dist/components/file-image/file-image.js +2 -1
- package/dist/components/file-image/file-image.js.map +1 -1
- package/dist/components/markdown-view/SpoilerSpan.d.ts +28 -0
- package/dist/components/markdown-view/SpoilerSpan.d.ts.map +1 -0
- package/dist/components/markdown-view/SpoilerSpan.js +53 -0
- package/dist/components/markdown-view/SpoilerSpan.js.map +1 -0
- package/dist/components/markdown-view/diagram/layoutSequence.js +13 -23
- package/dist/components/markdown-view/diagram/layoutSequence.js.map +1 -1
- package/dist/components/markdown-view/diagram/textMetrics.js +2 -2
- package/dist/components/markdown-view/diagram/textMetrics.js.map +1 -1
- package/dist/components/markdown-view/markdown-view.css +44 -0
- package/dist/components/markdown-view/markdown-view.d.ts +12 -0
- package/dist/components/markdown-view/markdown-view.d.ts.map +1 -1
- package/dist/components/markdown-view/markdown-view.js +22 -1
- package/dist/components/markdown-view/markdown-view.js.map +1 -1
- package/dist/components/markdown-view/remarkSpoiler.d.ts +17 -0
- package/dist/components/markdown-view/remarkSpoiler.d.ts.map +1 -0
- package/dist/components/markdown-view/remarkSpoiler.js +117 -0
- package/dist/components/markdown-view/remarkSpoiler.js.map +1 -0
- package/dist/components/permission-matrix/permission-matrix-group-rows.d.ts +34 -0
- package/dist/components/permission-matrix/permission-matrix-group-rows.d.ts.map +1 -0
- package/dist/components/permission-matrix/permission-matrix-group-rows.js +109 -0
- package/dist/components/permission-matrix/permission-matrix-group-rows.js.map +1 -0
- package/dist/components/permission-matrix/permission-matrix.d.ts +145 -0
- package/dist/components/permission-matrix/permission-matrix.d.ts.map +1 -0
- package/dist/components/permission-matrix/permission-matrix.js +113 -0
- package/dist/components/permission-matrix/permission-matrix.js.map +1 -0
- package/dist/components/plate-layout/plate-layout.d.ts +5 -0
- package/dist/components/plate-layout/plate-layout.d.ts.map +1 -1
- package/dist/components/plate-layout/plate-layout.js +2 -1
- package/dist/components/plate-layout/plate-layout.js.map +1 -1
- package/dist/components/plate-layout/plate-tab-bar.d.ts +10 -0
- package/dist/components/plate-layout/plate-tab-bar.d.ts.map +1 -1
- package/dist/components/plate-layout/plate-tab-bar.js +1 -1
- package/dist/components/plate-layout/plate-tab-bar.js.map +1 -1
- package/dist/components/settings/settings-nav.js +2 -1
- package/dist/components/settings/settings-nav.js.map +1 -1
- package/dist/components/time-ago/time-ago.d.ts +57 -0
- package/dist/components/time-ago/time-ago.d.ts.map +1 -0
- package/dist/components/time-ago/time-ago.js +60 -0
- package/dist/components/time-ago/time-ago.js.map +1 -0
- package/dist/components/tree-view/tree-model.d.ts +128 -0
- package/dist/components/tree-view/tree-model.d.ts.map +1 -0
- package/dist/components/tree-view/tree-model.js +226 -0
- package/dist/components/tree-view/tree-model.js.map +1 -0
- package/dist/components/tree-view/tree-view-rename-input.d.ts +31 -0
- package/dist/components/tree-view/tree-view-rename-input.d.ts.map +1 -0
- package/dist/components/tree-view/tree-view-rename-input.js +68 -0
- package/dist/components/tree-view/tree-view-rename-input.js.map +1 -0
- package/dist/components/tree-view/tree-view-resizer.d.ts +38 -0
- package/dist/components/tree-view/tree-view-resizer.d.ts.map +1 -0
- package/dist/components/tree-view/tree-view-resizer.js +73 -0
- package/dist/components/tree-view/tree-view-resizer.js.map +1 -0
- package/dist/components/tree-view/tree-view-row.d.ts +177 -0
- package/dist/components/tree-view/tree-view-row.d.ts.map +1 -0
- package/dist/components/tree-view/tree-view-row.js +241 -0
- package/dist/components/tree-view/tree-view-row.js.map +1 -0
- package/dist/components/tree-view/tree-view.d.ts +186 -0
- package/dist/components/tree-view/tree-view.d.ts.map +1 -0
- package/dist/components/tree-view/tree-view.js +112 -0
- package/dist/components/tree-view/tree-view.js.map +1 -0
- package/dist/components/tree-view/use-tree-state.d.ts +79 -0
- package/dist/components/tree-view/use-tree-state.d.ts.map +1 -0
- package/dist/components/tree-view/use-tree-state.js +93 -0
- package/dist/components/tree-view/use-tree-state.js.map +1 -0
- package/dist/components/ui/button.d.ts.map +1 -1
- package/dist/components/ui/button.js +1 -1
- package/dist/components/ui/button.js.map +1 -1
- package/dist/components/ui/dropdown-menu.js.map +1 -1
- package/dist/components/ui/select.d.ts +7 -0
- package/dist/components/ui/select.d.ts.map +1 -1
- package/dist/components/ui/select.js +7 -0
- package/dist/components/ui/select.js.map +1 -1
- package/dist/components/ui/sidebar.js +1 -1
- package/dist/components/ui/sidebar.js.map +1 -1
- package/dist/components/ui/table.js.map +1 -1
- package/dist/components/ui/tooltip.js.map +1 -1
- package/dist/lib/i18n-fr.d.ts.map +1 -1
- package/dist/lib/i18n-fr.js +31 -47
- package/dist/lib/i18n-fr.js.map +1 -1
- package/dist/lib/utils.d.ts +22 -2
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +29 -5
- package/dist/lib/utils.js.map +1 -1
- package/dist/styles.css +255 -0
- package/package.json +13 -14
- package/src/components/account/__tests__/account-router.spec.ts +95 -0
- package/src/components/account/account-connections.tsx +14 -1
- package/src/components/account/account-delete-dialog.tsx +3 -2
- package/src/components/account/account-keys.tsx +11 -4
- package/src/components/account/account-mfa-dialog.tsx +1 -1
- package/src/components/account/account-password-dialog.tsx +3 -2
- package/src/components/account/account-profile.tsx +1 -1
- package/src/components/account/account-router-options.tsx +45 -0
- package/src/components/account/account-router-page.tsx +11 -1
- package/src/components/account/account-router.tsx +23 -6
- package/src/components/admin/__tests__/admin-jobs-payload-dialog.browser.spec.tsx +68 -0
- package/src/components/admin/__tests__/admin-notifications-preview-body.browser.spec.tsx +20 -4
- package/src/components/admin/__tests__/admin-status-labels.browser.spec.tsx +0 -31
- package/src/components/admin/admin-audits.tsx +99 -5
- package/src/components/admin/admin-files.tsx +7 -16
- package/src/components/admin/admin-jobs-executions-panel.tsx +152 -114
- package/src/components/admin/admin-jobs-payload-dialog.tsx +57 -0
- package/src/components/admin/admin-keys.tsx +7 -4
- package/src/components/admin/admin-notifications-channel-label.ts +18 -0
- package/src/components/admin/admin-notifications-preview-body.tsx +7 -2
- package/src/components/admin/admin-notifications.tsx +19 -8
- package/src/components/admin/admin-payments.tsx +7 -4
- package/src/components/admin/admin-router-options.tsx +12 -0
- package/src/components/admin/admin-router.tsx +5 -27
- package/src/components/admin/admin-sessions.tsx +10 -6
- package/src/components/admin/admin-user-detail-audits-tab.tsx +7 -4
- package/src/components/admin/admin-user-detail-sessions-tab.tsx +7 -4
- package/src/components/admin/admin-users-roles-picker.tsx +4 -0
- package/src/components/admin/admin-users.tsx +6 -3
- package/src/components/admin/parameter-history-item.tsx +4 -2
- package/src/components/alepha-table/__tests__/alepha-table-default-hidden.browser.spec.tsx +108 -0
- package/src/components/alepha-table/__tests__/alepha-table-empty-state.browser.spec.tsx +233 -0
- package/src/components/alepha-table/__tests__/alepha-table-persist-facets.browser.spec.tsx +177 -0
- package/src/components/alepha-table/__tests__/alepha-table-persisted-filters.browser.spec.tsx +182 -0
- package/src/components/alepha-table/__tests__/alepha-table-query-seed.browser.spec.tsx +170 -0
- package/src/components/alepha-table/__tests__/alepha-table-row-action-checked.browser.spec.tsx +210 -0
- package/src/components/alepha-table/__tests__/alepha-table-row-action-group.browser.spec.tsx +202 -0
- package/src/components/alepha-table/__tests__/alepha-table-scope.browser.spec.tsx +161 -0
- package/src/components/alepha-table/__tests__/alepha-table-share-filters.browser.spec.tsx +309 -0
- package/src/components/alepha-table/__tests__/query-filters.spec.ts +212 -0
- package/src/components/alepha-table/alepha-table-filter-dialog.tsx +162 -0
- package/src/components/alepha-table/alepha-table-filter-menu.tsx +77 -0
- package/src/components/alepha-table/alepha-table.tsx +1113 -207
- package/src/components/alepha-table/query-filters.ts +159 -0
- package/src/components/app-actions/app-actions.tsx +32 -3
- package/src/components/app-shell/__tests__/sidebar-nav-accordion.browser.spec.tsx +163 -0
- package/src/components/app-shell/app-shell.tsx +255 -12
- package/src/components/auto-form/__tests__/auto-form-settings-card.browser.spec.tsx +1 -1
- package/src/components/auto-form/auto-form.tsx +98 -30
- package/src/components/button-dark/button-dark.tsx +47 -8
- package/src/components/button-inbox/__tests__/button-inbox.browser.spec.tsx +247 -0
- package/src/components/button-inbox/button-inbox.tsx +303 -0
- package/src/components/button-inbox/inbox-unread-atom.ts +27 -0
- package/src/components/button-theme/button-theme.tsx +16 -29
- package/src/components/button-user/__tests__/button-user-avatar.browser.spec.tsx +88 -0
- package/src/components/button-user/button-user.tsx +24 -1
- package/src/components/control/__tests__/control-date-range.browser.spec.tsx +177 -0
- package/src/components/control/control.tsx +119 -12
- package/src/components/control-date/control-date.tsx +117 -22
- package/src/components/control-date/date-only.ts +26 -0
- package/src/components/control-date-range/control-date-range.tsx +250 -0
- package/src/components/control-select/__tests__/control-select-clear-label.browser.spec.tsx +129 -15
- package/src/components/control-select/__tests__/control-select-deselect.browser.spec.tsx +27 -6
- package/src/components/control-select/__tests__/control-select-multi.browser.spec.tsx +204 -1
- package/src/components/control-select/__tests__/control-select-size-minimal.browser.spec.tsx +77 -1
- package/src/components/control-select/control-select.tsx +317 -83
- package/src/components/control-upload/control-upload.tsx +1 -10
- package/src/components/detail/detail-aside.tsx +30 -6
- package/src/components/markdown-view/SpoilerSpan.tsx +66 -0
- package/src/components/markdown-view/__tests__/markdown-view-spoiler.browser.spec.tsx +165 -0
- package/src/components/markdown-view/diagram/textMetrics.spec.ts +1 -1
- package/src/components/markdown-view/diagram/textMetrics.ts +2 -2
- package/src/components/markdown-view/markdown-view.css +44 -0
- package/src/components/markdown-view/markdown-view.tsx +37 -1
- package/src/components/markdown-view/remarkSpoiler.ts +150 -0
- package/src/components/permission-matrix/__tests__/permission-matrix.browser.spec.tsx +237 -0
- package/src/components/permission-matrix/permission-matrix-group-rows.tsx +240 -0
- package/src/components/permission-matrix/permission-matrix.tsx +286 -0
- package/src/components/plate-layout/__tests__/plate-layout.browser.spec.tsx +22 -0
- package/src/components/plate-layout/plate-layout.tsx +6 -0
- package/src/components/plate-layout/plate-tab-bar.tsx +27 -1
- package/src/components/time-ago/time-ago.browser.spec.tsx +110 -0
- package/src/components/time-ago/time-ago.tsx +80 -0
- package/src/components/tree-view/__tests__/tree-model.spec.ts +441 -0
- package/src/components/tree-view/__tests__/tree-view-drag.browser.spec.tsx +295 -0
- package/src/components/tree-view/__tests__/tree-view-rename.browser.spec.tsx +278 -0
- package/src/components/tree-view/__tests__/tree-view-resizer.browser.spec.tsx +112 -0
- package/src/components/tree-view/__tests__/tree-view.browser.spec.tsx +260 -0
- package/src/components/tree-view/__tests__/use-tree-state.browser.spec.tsx +238 -0
- package/src/components/tree-view/tree-model.ts +369 -0
- package/src/components/tree-view/tree-view-rename-input.tsx +95 -0
- package/src/components/tree-view/tree-view-resizer.tsx +83 -0
- package/src/components/tree-view/tree-view-row.tsx +414 -0
- package/src/components/tree-view/tree-view.tsx +300 -0
- package/src/components/tree-view/use-tree-state.ts +184 -0
- package/src/components/ui/button.tsx +79 -1
- package/src/components/ui/dropdown-menu.tsx +1 -1
- package/src/components/ui/select.tsx +7 -0
- package/src/components/ui/table.tsx +1 -1
- package/src/components/ui/tooltip.tsx +1 -1
- package/src/lib/i18n-fr.ts +34 -51
- package/src/lib/utils.ts +32 -4
- package/src/styles.css +255 -0
- package/dist/components/admin/admin-workflows-execution-sheet.d.ts +0 -11
- package/dist/components/admin/admin-workflows-execution-sheet.d.ts.map +0 -1
- package/dist/components/admin/admin-workflows-execution-sheet.js +0 -190
- package/dist/components/admin/admin-workflows-execution-sheet.js.map +0 -1
- package/dist/components/admin/admin-workflows-executions-panel.d.ts +0 -9
- package/dist/components/admin/admin-workflows-executions-panel.d.ts.map +0 -1
- package/dist/components/admin/admin-workflows-executions-panel.js +0 -121
- package/dist/components/admin/admin-workflows-executions-panel.js.map +0 -1
- package/dist/components/admin/admin-workflows-status-badge.d.ts +0 -12
- package/dist/components/admin/admin-workflows-status-badge.d.ts.map +0 -1
- package/dist/components/admin/admin-workflows-status-badge.js +0 -30
- package/dist/components/admin/admin-workflows-status-badge.js.map +0 -1
- package/dist/components/admin/admin-workflows-status-labels.d.ts +0 -19
- package/dist/components/admin/admin-workflows-status-labels.d.ts.map +0 -1
- package/dist/components/admin/admin-workflows-status-labels.js +0 -48
- package/dist/components/admin/admin-workflows-status-labels.js.map +0 -1
- package/dist/components/admin/admin-workflows.d.ts +0 -4
- package/dist/components/admin/admin-workflows.d.ts.map +0 -1
- package/dist/components/admin/admin-workflows.js +0 -145
- package/dist/components/admin/admin-workflows.js.map +0 -1
- package/src/components/admin/admin-workflows-execution-sheet.tsx +0 -285
- package/src/components/admin/admin-workflows-executions-panel.tsx +0 -169
- package/src/components/admin/admin-workflows-status-badge.tsx +0 -41
- package/src/components/admin/admin-workflows-status-labels.ts +0 -51
- package/src/components/admin/admin-workflows.tsx +0 -209
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin-router.js","names":[],"sources":["../../../src/components/admin/admin-router.tsx"],"sourcesContent":["import type { AdminDashboardCard } from \"@alepha/ui/components/admin/admin-dashboard-card\";\nimport { AdminDashboardCountCard } from \"@alepha/ui/components/admin/admin-dashboard-count-card\";\nimport { $pageNav } from \"@alepha/ui/components/nav-shell/nav-page\";\nimport { $store, z } from \"alepha\";\nimport type { AdminAnalyticsController } from \"alepha/api/analytics\";\nimport type { AdminAuditController } from \"alepha/api/audits\";\nimport type { FileController } from \"alepha/api/files\";\nimport type { AdminJobController } from \"alepha/api/jobs\";\nimport type { AdminApiKeyController } from \"alepha/api/keys\";\nimport type { AdminNotificationController } from \"alepha/api/notifications\";\nimport type { AdminParameterController } from \"alepha/api/parameters\";\nimport type { AdminPaymentController } from \"alepha/api/payments\";\nimport type {\n AdminSessionController,\n AdminUserController,\n} from \"alepha/api/users\";\nimport type { AdminWorkflowController } from \"alepha/api/workflows\";\nimport { Translate } from \"alepha/react/i18n\";\nimport { $client } from \"alepha/server/links\";\nimport {\n Bell,\n ChartLine,\n CreditCard,\n Files,\n KeyRound,\n LayoutDashboard,\n ShieldAlert,\n ShieldCheck,\n SlidersHorizontal,\n Timer,\n UsersIcon,\n Workflow,\n} from \"lucide-react\";\nimport { createElement } from \"react\";\n\nimport { adminRouterOptionsAtom } from \"./admin-router-options.tsx\";\n\n/**\n * The whole `/admin` surface — twelve pages and their shell — mounted and wired.\n *\n * ⚠️ **Nav icons are `createElement(Icon)`, never `<Icon />`. Do not \"fix\"\n * them back to JSX.** This module is evaluated *eagerly* in the server graph:\n * `main.server.ts` → `$module` → `alepha.inject(AdminRouter)` runs these class\n * fields at import time, unlike every page below, which is behind `lazy()`.\n * `alepha db migrations create` imports that graph in a child process under\n * `tsx`, and `tsx` applies a single tsconfig resolved from the **cwd** — the\n * app root. A file outside that tsconfig's `include` (which this one is, being\n * in a sibling workspace) gets esbuild's defaults instead, and the default JSX\n * transform is the *classic* one. The emitted `React.createElement` then fails\n * with `ReferenceError: React is not defined`, breaking migration generation\n * for the whole app — with a stack that points here and explains none of this.\n *\n * ```ts\n * import { AdminRouter } from \"@alepha/ui/components/admin/admin-router\";\n *\n * export const MyWeb = $module({\n * name: \"my.web\",\n * services: [MyRouter, AuthRouter, AdminRouter],\n * });\n * ```\n *\n * ### Every page is mounted; none is conditionally registered\n *\n * A page whose permission the signed-in admin does not hold hides itself, and\n * so does a page whose module is not registered — but through two separate\n * gates, not one. Each `$pageNav` here declares `permission`, and its `can`\n * calls a typed `$client` action, and the entry is hidden when either fails.\n *\n * `permission` alone cannot cover \"the module is not registered\": `$pageNav`\n * wires it into `use: [$secure({ permissions })]` on the page itself, and\n * `$secure` registers that permission into `SecurityProvider` eagerly, at\n * definition time — so the permission exists whether or not any controller\n * backing the page does, and an admin holding the `*` wildcard is granted it\n * regardless. `can` closes that gap with an action instead of a permission:\n * `this.userApi.findUsers.can()` is `LinkProvider.can(\"findUsers\")` against\n * `/api/_links`, a registry built from the actions the server actually\n * registered, so an action nothing declared never appears there for anyone\n * to be granted. The action is read off a `$client<AdminUserController>()`\n * field, so a rename on the controller is a compile error here rather than a\n * silently dead sidebar entry — the failure mode a plain string name would\n * have.\n *\n * This is why there is no `pages: [...]` allowlist. A second gate on top of\n * two that already work goes stale: an application that later turns on\n * `features.audits` would still not see the Audits page until someone\n * remembered to edit the list.\n *\n * ### Extending the shell\n *\n * {@link $pageAdmin} (`@alepha/ui/components/admin/admin-router-page`) is the\n * way to add a page to this shell — the one-call form an application, or a\n * satellite package such as `@alepha/commerce/admin`, whose pages\n * deliberately live outside this design system so it never depends on a\n * domain, reaches for:\n *\n * ```tsx\n * class ShopAdminRouter {\n * products = $pageAdmin({\n * path: \"/products\",\n * nav: { label: \"Catalogue\", group: \"Commerce\", order: 100 },\n * lazy: () => import(\"./AdminProducts.tsx\"),\n * });\n * }\n * ```\n *\n * See `$pageAdmin`'s own JSDoc for the rules this composition must follow —\n * the `AdminRouter` registration it triggers, the `order` / `nav.group`\n * contract, and gating with `can` rather than `permission` alone.\n *\n * `layout` stays public as the seam underneath: `$pageAdmin` is exactly\n * `$inject(AdminRouter)` plus `parent: this.admin.layout`, done for you. An\n * application that wants that composition without going through `$pageAdmin`\n * — for instance to control itself whether and when `AdminRouter` gets\n * registered, rather than as an unconditional side effect of a field\n * initializer — injects `AdminRouter` and sets `parent: this.admin.layout`\n * directly, the same way `$pageAdmin` does internally.\n *\n * ### Labels are catalogue keys, not text\n *\n * Every `nav` here carries a `labelKey` (and a `groupKey` where it has a\n * group) beside its English `label`. A class field is evaluated once, at\n * construction, outside React - so a label written as `tr(...)` would be\n * frozen in whatever language happened to be active then, which is why the\n * whole admin chrome stayed English inside a French application while the\n * pages under it were translated.\n *\n * The keys are resolved by `navLabel` / `navGroupLabel`, which the sidebar,\n * the breadcrumbs and the palette all call from inside a component, so a\n * language switch re-labels the shell with no reload. `label` stays the\n * English text and becomes the `tr` default, so an application that registers\n * no catalogue sees exactly what it saw before.\n *\n * A page added here without a `labelKey` is untranslatable, and\n * `admin-router.spec.ts` fails for it.\n *\n * ### Group order is a contract\n *\n * The built-in pages are parked in a reserved high band: `Identity`\n * (1000-1003) and `System` (1010-1016). Everything below 1000 belongs to the\n * application, so a page declaring its own group at the conventional\n * `order: 100` sorts **above** the built-ins without having to ask — an\n * application's own domain outranks Users and Jobs. `useNavEntries` sorts\n * groups by their smallest member, so only an `order` of 1000 or more sinks a\n * page in among them.\n *\n * ### These thirteen route names are claimed globally\n *\n * `dashboard`, `users`, `userDetail`, `sessions`, `keys`, `jobs`,\n * `notifications`, `audits`, `files`, `parameters`, `payments`, `analytics`\n * and `workflows` each carry an explicit `name:` so a future rename of the\n * field itself (done for readability, without touching the string) never\n * silently changes the public route name — the same reason `AuthRouter`'s\n * pages all carry one too.\n *\n * Route names live in one process-wide namespace, and a duplicate does not\n * throw: `ReactPageProvider.page()` returns the first match. An adopter that\n * registers its own page named `files` (or any of the other twelve) either\n * shadows this one or is shadowed by it, silently, depending on mount order.\n * Treat these thirteen names as reserved when hanging pages off `layout`.\n *\n * ### It needs `<DialogProvider>` and `<Toaster />` above it\n *\n * Several admin pages call `useDialog()`, which throws without a provider,\n * and raise toasts. `AppShell` mounts both; a standalone mount, or `AppShell`\n * with `embedded`, has to supply them. `AccountRouter`'s JSDoc explains why\n * the shells deliberately do not mount them themselves.\n */\nexport class AdminRouter {\n protected readonly options = $store(adminRouterOptionsAtom);\n\n protected readonly userApi = $client<AdminUserController>();\n protected readonly sessionApi = $client<AdminSessionController>();\n protected readonly apiKeyApi = $client<AdminApiKeyController>();\n protected readonly jobApi = $client<AdminJobController>();\n protected readonly notificationApi = $client<AdminNotificationController>();\n protected readonly auditApi = $client<AdminAuditController>();\n protected readonly fileApi = $client<FileController>();\n protected readonly parameterApi = $client<AdminParameterController>();\n protected readonly paymentApi = $client<AdminPaymentController>();\n protected readonly analyticsApi = $client<AdminAnalyticsController>();\n protected readonly workflowApi = $client<AdminWorkflowController>();\n\n /**\n * Anchors the shell and the first breadcrumb. Not itself a nav entry — a\n * shell root is excluded from its own sidebar.\n *\n * Named `admin` because `NavShell root=\"admin\"` and `Spotlight root=\"admin\"`\n * both resolve the subtree by this name.\n *\n * No index redirect: {@link dashboard} sits at `path: \"/\"`, so a bare\n * `/admin` resolves to it directly — the same arrangement `AccountRouter`\n * uses for `/account`. This used to throw a `Redirection` to an\n * `indexPath` option because the shell had no index child and something had\n * to choose a first page; the dashboard is that page, so both the hop and\n * the option are gone. An application that wants different content at\n * `/admin` contributes `dashboardCards` rather than redirecting away from\n * it.\n */\n layout = $pageNav({\n name: \"admin\",\n path: \"/admin\",\n permission: \"admin:ui\",\n nav: { label: \"Admin\", labelKey: \"admin.nav.admin\" },\n lazy: () => import(\"./admin-layout.tsx\"),\n });\n\n /**\n * The landing page: `/admin` itself, and the only ungrouped entry.\n *\n * No `nav.group` plus `order: 0` puts it above every group without a\n * special case: `useNavEntries` keys groups by `nav.group ?? \"\"` and sorts\n * them by their smallest member, so the ungrouped bucket leads at 0 while\n * the built-ins sit at 1000+ and an application's own group conventionally\n * at 100.\n *\n * It declares no `permission` and no `can`. Reaching it already means\n * passing the layout's `admin:ui`, and it renders only the cards that pass\n * their own gate — so an administrator with nothing to see gets the empty\n * state rather than a locked door.\n */\n dashboard = $pageNav({\n parent: this.layout,\n path: \"/\",\n name: \"dashboard\",\n head: { title: \"Dashboard\" },\n nav: {\n label: \"Dashboard\",\n labelKey: \"admin.nav.dashboard\",\n icon: createElement(LayoutDashboard),\n order: 0,\n },\n lazy: () => import(\"./admin-dashboard.tsx\"),\n props: () => ({ cards: this.dashboardCards() }),\n });\n\n /**\n * Exactly one built-in card, then the application's.\n *\n * One is deliberate. The framework's job here is the contract, not the\n * content: `users` exists to show what a card looks like — gated on an\n * action so it disappears with its module, parked in the reserved 1000\n * band so an application's own cards lead — and nothing more. A dashboard\n * of framework tiles would decide what every admin's landing page says,\n * which is the application's call, and it would be the wrong call for most\n * of them: Sessions and Jobs are plumbing, not headlines.\n *\n * An application says what matters by contributing\n * `AdminRouterOptions.dashboardCards`; see `apps/examples/shop`, which adds\n * its catalogue and orders and so leads with them.\n */\n protected dashboardCards(): AdminDashboardCard[] {\n return [\n {\n id: \"users\",\n order: 1000,\n can: () => this.userApi.findUsers.can(),\n render: () =>\n createElement(AdminDashboardCountCard, {\n // `render` runs inside `AdminDashboard`'s render but not inside a\n // hook-safe position, so the label is an element that looks the\n // key up itself rather than a `tr` call here. Same key as the nav\n // entry: it is the same word on the same subject.\n label: createElement(Translate, {\n k: \"admin.nav.users\",\n fallback: \"Users\",\n }),\n href: \"/admin/users\",\n icon: createElement(UsersIcon, { className: \"size-4\" }),\n load: async () =>\n (await this.userApi.findUsers({ query: { size: 1 } })).page\n .totalElements ?? 0,\n }),\n },\n ...(this.options.dashboardCards ?? []),\n ];\n }\n\n users = $pageNav({\n parent: this.layout,\n path: \"/users\",\n name: \"users\",\n head: { title: \"Users\" },\n permission: \"admin:user:read\",\n can: () => this.userApi.findUsers.can(),\n nav: {\n label: \"Users\",\n labelKey: \"admin.nav.users\",\n icon: createElement(UsersIcon),\n group: \"Identity\",\n groupKey: \"admin.nav.group.identity\",\n order: 1000,\n },\n lazy: () => import(\"./admin-users.tsx\"),\n props: () => this.options.pages?.users ?? {},\n });\n\n /**\n * `nav.hidden` - a secured route that is not a sidebar entry, but still a\n * breadcrumb. It carries a `nav` only so the crumb has a `labelKey`: without\n * one the label falls back to `head.title`, which is a plain string\n * evaluated here and so permanently English.\n */\n userDetail = $pageNav({\n parent: this.layout,\n path: \"/users/:userId\",\n name: \"userDetail\",\n head: { title: \"User\" },\n nav: { hidden: true, label: \"User\", labelKey: \"admin.nav.userDetail\" },\n permission: \"admin:user:read\",\n can: () => this.userApi.getUser.can(),\n schema: {\n params: z.object({\n userId: z.uuid(),\n }),\n },\n lazy: () => import(\"./admin-user-detail.tsx\"),\n props: () => this.options.pages?.userDetail ?? {},\n });\n\n sessions = $pageNav({\n parent: this.layout,\n path: \"/sessions\",\n name: \"sessions\",\n head: { title: \"Sessions\" },\n permission: \"admin:session:read\",\n can: () => this.sessionApi.findSessions.can(),\n nav: {\n label: \"Sessions\",\n labelKey: \"admin.nav.sessions\",\n icon: createElement(ShieldCheck),\n group: \"Identity\",\n groupKey: \"admin.nav.group.identity\",\n order: 1001,\n },\n lazy: () => import(\"./admin-sessions.tsx\"),\n });\n\n keys = $pageNav({\n parent: this.layout,\n path: \"/keys\",\n name: \"keys\",\n head: { title: \"API keys\" },\n permission: \"admin:api-key:read\",\n can: () => this.apiKeyApi.findApiKeys.can(),\n nav: {\n label: \"API keys\",\n labelKey: \"admin.nav.keys\",\n icon: createElement(KeyRound),\n group: \"Identity\",\n groupKey: \"admin.nav.group.identity\",\n order: 1003,\n keywords: [\"tokens\", \"credentials\"],\n },\n lazy: () => import(\"./admin-keys.tsx\"),\n });\n\n jobs = $pageNav({\n parent: this.layout,\n path: \"/jobs\",\n name: \"jobs\",\n head: { title: \"Jobs\" },\n permission: \"admin:job:read\",\n can: () => this.jobApi.listJobs.can(),\n nav: {\n label: \"Jobs\",\n labelKey: \"admin.nav.jobs\",\n icon: createElement(Timer),\n group: \"System\",\n groupKey: \"admin.nav.group.system\",\n order: 1010,\n },\n lazy: () => import(\"./admin-jobs.tsx\"),\n });\n\n notifications = $pageNav({\n parent: this.layout,\n path: \"/notifications\",\n name: \"notifications\",\n head: { title: \"Notifications\" },\n permission: \"admin:notification:read\",\n can: () => this.notificationApi.findNotifications.can(),\n nav: {\n label: \"Notifications\",\n labelKey: \"admin.nav.notifications\",\n icon: createElement(Bell),\n group: \"System\",\n groupKey: \"admin.nav.group.system\",\n order: 1011,\n },\n lazy: () => import(\"./admin-notifications.tsx\"),\n });\n\n audits = $pageNav({\n parent: this.layout,\n path: \"/audits\",\n name: \"audits\",\n head: { title: \"Audit log\" },\n permission: \"admin:audit:read\",\n can: () => this.auditApi.findAudits.can(),\n nav: {\n label: \"Audit log\",\n labelKey: \"admin.nav.audits\",\n icon: createElement(ShieldAlert),\n group: \"Identity\",\n groupKey: \"admin.nav.group.identity\",\n order: 1002,\n },\n lazy: () => import(\"./admin-audits.tsx\"),\n });\n\n files = $pageNav({\n parent: this.layout,\n path: \"/files\",\n name: \"files\",\n head: { title: \"Files\" },\n permission: \"admin:file:read\",\n can: () => this.fileApi.findFiles.can(),\n nav: {\n label: \"Files\",\n labelKey: \"admin.nav.files\",\n icon: createElement(Files),\n group: \"System\",\n groupKey: \"admin.nav.group.system\",\n order: 1012,\n },\n lazy: () => import(\"./admin-files.tsx\"),\n });\n\n parameters = $pageNav({\n parent: this.layout,\n path: \"/parameters\",\n name: \"parameters\",\n head: { title: \"Parameters\" },\n permission: \"admin:parameter:read\",\n can: () => this.parameterApi.getParameterTree.can(),\n nav: {\n label: \"Parameters\",\n labelKey: \"admin.nav.parameters\",\n icon: createElement(SlidersHorizontal),\n group: \"System\",\n groupKey: \"admin.nav.group.system\",\n order: 1015,\n keywords: [\"settings\", \"config\", \"configuration\"],\n },\n lazy: () => import(\"./admin-parameters.tsx\"),\n props: () => this.options.pages?.parameters ?? {},\n });\n\n /**\n * Both permissions are required, matching `AdminPaymentController`, which\n * gates every read with `[\"admin:payment:read\", \"payments:read\"]` — and\n * `$pageNav` treats an array as AND, the same way `$secure` does.\n */\n payments = $pageNav({\n parent: this.layout,\n path: \"/payments\",\n name: \"payments\",\n head: { title: \"Payments\" },\n permission: [\"admin:payment:read\", \"payments:read\"],\n can: () => this.paymentApi.listIntents.can(),\n nav: {\n label: \"Payments\",\n labelKey: \"admin.nav.payments\",\n icon: createElement(CreditCard),\n group: \"System\",\n groupKey: \"admin.nav.group.system\",\n order: 1013,\n },\n lazy: () => import(\"./admin-payments.tsx\"),\n });\n\n analytics = $pageNav({\n parent: this.layout,\n path: \"/analytics\",\n name: \"analytics\",\n head: { title: \"Analytics\" },\n permission: \"admin:analytics:read\",\n can: () => this.analyticsApi.listDatasets.can(),\n nav: {\n label: \"Analytics\",\n labelKey: \"admin.nav.analytics\",\n icon: createElement(ChartLine),\n group: \"System\",\n groupKey: \"admin.nav.group.system\",\n order: 1016,\n },\n lazy: () => import(\"./admin-analytics.tsx\"),\n });\n\n workflows = $pageNav({\n parent: this.layout,\n path: \"/workflows\",\n name: \"workflows\",\n head: { title: \"Workflows\" },\n permission: \"admin:workflow:read\",\n can: () => this.workflowApi.getWorkflowRegistry.can(),\n nav: {\n label: \"Workflows\",\n labelKey: \"admin.nav.workflows\",\n icon: createElement(Workflow),\n group: \"System\",\n groupKey: \"admin.nav.group.system\",\n order: 1014,\n keywords: [\"saga\", \"steps\", \"executions\"],\n },\n lazy: () => import(\"./admin-workflows.tsx\"),\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuKA,IAAa,cAAb,MAAyB;CACvB,UAA6B,OAAO,sBAAsB;CAE1D,UAA6B,QAA6B;CAC1D,aAAgC,QAAgC;CAChE,YAA+B,QAA+B;CAC9D,SAA4B,QAA4B;CACxD,kBAAqC,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AAe;EAClD,WAAW,KAAK,WAAW,YAAY,IAAI;EAC3C,KAAK;GACH,OAAO;GACP,UAAU;GACV,MAAM,cAAc,UAAU;GAC9B,OAAO;GACP,UAAU;GACV,OAAO;EACT;EACA,YAAY,OAAO;CACrB,CAAC;CAED,YAAY,SAAS;EACnB,QAAQ,KAAK;EACb,MAAM;EACN,MAAM;EACN,MAAM,EAAE,OAAO,YAAY;EAC3B,YAAY;EACZ,WAAW,KAAK,aAAa,aAAa,IAAI;EAC9C,KAAK;GACH,OAAO;GACP,UAAU;GACV,MAAM,cAAc,SAAS;GAC7B,OAAO;GACP,UAAU;GACV,OAAO;EACT;EACA,YAAY,OAAO;CACrB,CAAC;CAED,YAAY,SAAS;EACnB,QAAQ,KAAK;EACb,MAAM;EACN,MAAM;EACN,MAAM,EAAE,OAAO,YAAY;EAC3B,YAAY;EACZ,WAAW,KAAK,YAAY,oBAAoB,IAAI;EACpD,KAAK;GACH,OAAO;GACP,UAAU;GACV,MAAM,cAAc,QAAQ;GAC5B,OAAO;GACP,UAAU;GACV,OAAO;GACP,UAAU;IAAC;IAAQ;IAAS;GAAY;EAC1C;EACA,YAAY,OAAO;CACrB,CAAC;AACH"}
|
|
1
|
+
{"version":3,"file":"admin-router.js","names":[],"sources":["../../../src/components/admin/admin-router.tsx"],"sourcesContent":["import type { AdminDashboardCard } from \"@alepha/ui/components/admin/admin-dashboard-card\";\nimport { AdminDashboardCountCard } from \"@alepha/ui/components/admin/admin-dashboard-count-card\";\nimport { $pageNav } from \"@alepha/ui/components/nav-shell/nav-page\";\nimport { $store, z } from \"alepha\";\nimport type { AdminAnalyticsController } from \"alepha/api/analytics\";\nimport type { AdminAuditController } from \"alepha/api/audits\";\nimport type { FileController } from \"alepha/api/files\";\nimport type { AdminJobController } from \"alepha/api/jobs\";\nimport type { AdminApiKeyController } from \"alepha/api/keys\";\nimport type { AdminNotificationController } from \"alepha/api/notifications\";\nimport type { AdminParameterController } from \"alepha/api/parameters\";\nimport type { AdminPaymentController } from \"alepha/api/payments\";\nimport type {\n AdminSessionController,\n AdminUserController,\n} from \"alepha/api/users\";\nimport { Translate } from \"alepha/react/i18n\";\nimport { $client } from \"alepha/server/links\";\nimport {\n Bell,\n ChartLine,\n CreditCard,\n Files,\n KeyRound,\n LayoutDashboard,\n ShieldAlert,\n ShieldCheck,\n SlidersHorizontal,\n Timer,\n UsersIcon,\n} from \"lucide-react\";\nimport { createElement } from \"react\";\n\nimport { adminRouterOptionsAtom } from \"./admin-router-options.tsx\";\n\n/**\n * The whole `/admin` surface — twelve pages and their shell — mounted and wired.\n *\n * ⚠️ **Nav icons are `createElement(Icon)`, never `<Icon />`. Do not \"fix\"\n * them back to JSX.** This module is evaluated *eagerly* in the server graph:\n * `main.server.ts` → `$module` → `alepha.inject(AdminRouter)` runs these class\n * fields at import time, unlike every page below, which is behind `lazy()`.\n * `alepha db migrations create` imports that graph in a child process under\n * `tsx`, and `tsx` applies a single tsconfig resolved from the **cwd** — the\n * app root. A file outside that tsconfig's `include` (which this one is, being\n * in a sibling workspace) gets esbuild's defaults instead, and the default JSX\n * transform is the *classic* one. The emitted `React.createElement` then fails\n * with `ReferenceError: React is not defined`, breaking migration generation\n * for the whole app — with a stack that points here and explains none of this.\n *\n * ```ts\n * import { AdminRouter } from \"@alepha/ui/components/admin/admin-router\";\n *\n * export const MyWeb = $module({\n * name: \"my.web\",\n * services: [MyRouter, AuthRouter, AdminRouter],\n * });\n * ```\n *\n * ### Every page is mounted; none is conditionally registered\n *\n * A page whose permission the signed-in admin does not hold hides itself, and\n * so does a page whose module is not registered — but through two separate\n * gates, not one. Each `$pageNav` here declares `permission`, and its `can`\n * calls a typed `$client` action, and the entry is hidden when either fails.\n *\n * `permission` alone cannot cover \"the module is not registered\": `$pageNav`\n * wires it into `use: [$secure({ permissions })]` on the page itself, and\n * `$secure` registers that permission into `SecurityProvider` eagerly, at\n * definition time — so the permission exists whether or not any controller\n * backing the page does, and an admin holding the `*` wildcard is granted it\n * regardless. `can` closes that gap with an action instead of a permission:\n * `this.userApi.findUsers.can()` is `LinkProvider.can(\"findUsers\")` against\n * `/api/_links`, a registry built from the actions the server actually\n * registered, so an action nothing declared never appears there for anyone\n * to be granted. The action is read off a `$client<AdminUserController>()`\n * field, so a rename on the controller is a compile error here rather than a\n * silently dead sidebar entry — the failure mode a plain string name would\n * have.\n *\n * This is why there is no `pages: [...]` allowlist. A second gate on top of\n * two that already work goes stale: an application that later turns on\n * `features.audits` would still not see the Audits page until someone\n * remembered to edit the list.\n *\n * ### Extending the shell\n *\n * {@link $pageAdmin} (`@alepha/ui/components/admin/admin-router-page`) is the\n * way to add a page to this shell — the one-call form an application, or a\n * satellite package such as `@alepha/commerce/admin`, whose pages\n * deliberately live outside this design system so it never depends on a\n * domain, reaches for:\n *\n * ```tsx\n * class ShopAdminRouter {\n * products = $pageAdmin({\n * path: \"/products\",\n * nav: { label: \"Catalogue\", group: \"Commerce\", order: 100 },\n * lazy: () => import(\"./AdminProducts.tsx\"),\n * });\n * }\n * ```\n *\n * See `$pageAdmin`'s own JSDoc for the rules this composition must follow —\n * the `AdminRouter` registration it triggers, the `order` / `nav.group`\n * contract, and gating with `can` rather than `permission` alone.\n *\n * `layout` stays public as the seam underneath: `$pageAdmin` is exactly\n * `$inject(AdminRouter)` plus `parent: this.admin.layout`, done for you. An\n * application that wants that composition without going through `$pageAdmin`\n * — for instance to control itself whether and when `AdminRouter` gets\n * registered, rather than as an unconditional side effect of a field\n * initializer — injects `AdminRouter` and sets `parent: this.admin.layout`\n * directly, the same way `$pageAdmin` does internally.\n *\n * ### Labels are catalogue keys, not text\n *\n * Every `nav` here carries a `labelKey` (and a `groupKey` where it has a\n * group) beside its English `label`. A class field is evaluated once, at\n * construction, outside React - so a label written as `tr(...)` would be\n * frozen in whatever language happened to be active then, which is why the\n * whole admin chrome stayed English inside a French application while the\n * pages under it were translated.\n *\n * The keys are resolved by `navLabel` / `navGroupLabel`, which the sidebar,\n * the breadcrumbs and the palette all call from inside a component, so a\n * language switch re-labels the shell with no reload. `label` stays the\n * English text and becomes the `tr` default, so an application that registers\n * no catalogue sees exactly what it saw before.\n *\n * A page added here without a `labelKey` is untranslatable, and\n * `admin-router.spec.ts` fails for it.\n *\n * ### Group order is a contract\n *\n * The built-in pages are parked in a reserved high band: `Identity`\n * (1000-1003) and `System` (1010-1016). Everything below 1000 belongs to the\n * application, so a page declaring its own group at the conventional\n * `order: 100` sorts **above** the built-ins without having to ask — an\n * application's own domain outranks Users and Jobs. `useNavEntries` sorts\n * groups by their smallest member, so only an `order` of 1000 or more sinks a\n * page in among them.\n *\n * ### These twelve route names are claimed globally\n *\n * `dashboard`, `users`, `userDetail`, `sessions`, `keys`, `jobs`,\n * `notifications`, `audits`, `files`, `parameters`, `payments` and\n * `analytics` each carry an explicit `name:` so a future rename of the\n * field itself (done for readability, without touching the string) never\n * silently changes the public route name — the same reason `AuthRouter`'s\n * pages all carry one too.\n *\n * Route names live in one process-wide namespace, and a duplicate does not\n * throw: `ReactPageProvider.page()` returns the first match. An adopter that\n * registers its own page named `files` (or any of the other eleven) either\n * shadows this one or is shadowed by it, silently, depending on mount order.\n * Treat these twelve names as reserved when hanging pages off `layout`.\n *\n * ### It needs `<DialogProvider>` and `<Toaster />` above it\n *\n * Several admin pages call `useDialog()`, which throws without a provider,\n * and raise toasts. `AppShell` mounts both; a standalone mount, or `AppShell`\n * with `embedded`, has to supply them. `AccountRouter`'s JSDoc explains why\n * the shells deliberately do not mount them themselves.\n */\nexport class AdminRouter {\n protected readonly options = $store(adminRouterOptionsAtom);\n\n protected readonly userApi = $client<AdminUserController>();\n protected readonly sessionApi = $client<AdminSessionController>();\n protected readonly apiKeyApi = $client<AdminApiKeyController>();\n protected readonly jobApi = $client<AdminJobController>();\n protected readonly notificationApi = $client<AdminNotificationController>();\n protected readonly auditApi = $client<AdminAuditController>();\n protected readonly fileApi = $client<FileController>();\n protected readonly parameterApi = $client<AdminParameterController>();\n protected readonly paymentApi = $client<AdminPaymentController>();\n protected readonly analyticsApi = $client<AdminAnalyticsController>();\n\n /**\n * Anchors the shell and the first breadcrumb. Not itself a nav entry — a\n * shell root is excluded from its own sidebar.\n *\n * Named `admin` because `NavShell root=\"admin\"` and `Spotlight root=\"admin\"`\n * both resolve the subtree by this name.\n *\n * No index redirect: {@link dashboard} sits at `path: \"/\"`, so a bare\n * `/admin` resolves to it directly — the same arrangement `AccountRouter`\n * uses for `/account`. This used to throw a `Redirection` to an\n * `indexPath` option because the shell had no index child and something had\n * to choose a first page; the dashboard is that page, so both the hop and\n * the option are gone. An application that wants different content at\n * `/admin` contributes `dashboardCards` rather than redirecting away from\n * it.\n */\n layout = $pageNav({\n name: \"admin\",\n path: \"/admin\",\n permission: \"admin:ui\",\n nav: { label: \"Admin\", labelKey: \"admin.nav.admin\" },\n lazy: () => import(\"./admin-layout.tsx\"),\n });\n\n /**\n * The landing page: `/admin` itself, and the only ungrouped entry.\n *\n * No `nav.group` plus `order: 0` puts it above every group without a\n * special case: `useNavEntries` keys groups by `nav.group ?? \"\"` and sorts\n * them by their smallest member, so the ungrouped bucket leads at 0 while\n * the built-ins sit at 1000+ and an application's own group conventionally\n * at 100.\n *\n * It declares no `permission` and no `can`. Reaching it already means\n * passing the layout's `admin:ui`, and it renders only the cards that pass\n * their own gate — so an administrator with nothing to see gets the empty\n * state rather than a locked door.\n */\n dashboard = $pageNav({\n parent: this.layout,\n path: \"/\",\n name: \"dashboard\",\n head: { title: \"Dashboard\" },\n nav: {\n label: \"Dashboard\",\n labelKey: \"admin.nav.dashboard\",\n icon: createElement(LayoutDashboard),\n order: 0,\n },\n lazy: () => import(\"./admin-dashboard.tsx\"),\n props: () => ({ cards: this.dashboardCards() }),\n });\n\n /**\n * Exactly one built-in card, then the application's.\n *\n * One is deliberate. The framework's job here is the contract, not the\n * content: `users` exists to show what a card looks like — gated on an\n * action so it disappears with its module, parked in the reserved 1000\n * band so an application's own cards lead — and nothing more. A dashboard\n * of framework tiles would decide what every admin's landing page says,\n * which is the application's call, and it would be the wrong call for most\n * of them: Sessions and Jobs are plumbing, not headlines.\n *\n * An application says what matters by contributing\n * `AdminRouterOptions.dashboardCards`; see `apps/examples/shop`, which adds\n * its catalogue and orders and so leads with them.\n */\n protected dashboardCards(): AdminDashboardCard[] {\n return [\n {\n id: \"users\",\n order: 1000,\n can: () => this.userApi.findUsers.can(),\n render: () =>\n createElement(AdminDashboardCountCard, {\n // `render` runs inside `AdminDashboard`'s render but not inside a\n // hook-safe position, so the label is an element that looks the\n // key up itself rather than a `tr` call here. Same key as the nav\n // entry: it is the same word on the same subject.\n label: createElement(Translate, {\n k: \"admin.nav.users\",\n fallback: \"Users\",\n }),\n href: \"/admin/users\",\n icon: createElement(UsersIcon, { className: \"size-4\" }),\n load: async () =>\n (await this.userApi.findUsers({ query: { size: 1 } })).page\n .totalElements ?? 0,\n }),\n },\n ...(this.options.dashboardCards ?? []),\n ];\n }\n\n users = $pageNav({\n parent: this.layout,\n path: \"/users\",\n name: \"users\",\n head: { title: \"Users\" },\n permission: \"admin:user:read\",\n can: () => this.userApi.findUsers.can(),\n nav: {\n label: \"Users\",\n labelKey: \"admin.nav.users\",\n icon: createElement(UsersIcon),\n group: \"Identity\",\n groupKey: \"admin.nav.group.identity\",\n order: 1000,\n },\n lazy: () => import(\"./admin-users.tsx\"),\n props: () => this.options.pages?.users ?? {},\n });\n\n /**\n * `nav.hidden` - a secured route that is not a sidebar entry, but still a\n * breadcrumb. It carries a `nav` only so the crumb has a `labelKey`: without\n * one the label falls back to `head.title`, which is a plain string\n * evaluated here and so permanently English.\n */\n userDetail = $pageNav({\n parent: this.layout,\n path: \"/users/:userId\",\n name: \"userDetail\",\n head: { title: \"User\" },\n nav: { hidden: true, label: \"User\", labelKey: \"admin.nav.userDetail\" },\n permission: \"admin:user:read\",\n can: () => this.userApi.getUser.can(),\n schema: {\n params: z.object({\n userId: z.uuid(),\n }),\n },\n lazy: () => import(\"./admin-user-detail.tsx\"),\n props: () => this.options.pages?.userDetail ?? {},\n });\n\n sessions = $pageNav({\n parent: this.layout,\n path: \"/sessions\",\n name: \"sessions\",\n head: { title: \"Sessions\" },\n permission: \"admin:session:read\",\n can: () => this.sessionApi.findSessions.can(),\n nav: {\n label: \"Sessions\",\n labelKey: \"admin.nav.sessions\",\n icon: createElement(ShieldCheck),\n group: \"Identity\",\n groupKey: \"admin.nav.group.identity\",\n order: 1001,\n },\n lazy: () => import(\"./admin-sessions.tsx\"),\n });\n\n keys = $pageNav({\n parent: this.layout,\n path: \"/keys\",\n name: \"keys\",\n head: { title: \"API keys\" },\n permission: \"admin:api-key:read\",\n can: () => this.apiKeyApi.findApiKeys.can(),\n nav: {\n label: \"API keys\",\n labelKey: \"admin.nav.keys\",\n icon: createElement(KeyRound),\n group: \"Identity\",\n groupKey: \"admin.nav.group.identity\",\n order: 1003,\n keywords: [\"tokens\", \"credentials\"],\n },\n lazy: () => import(\"./admin-keys.tsx\"),\n });\n\n jobs = $pageNav({\n parent: this.layout,\n path: \"/jobs\",\n name: \"jobs\",\n head: { title: \"Jobs\" },\n permission: \"admin:job:read\",\n can: () => this.jobApi.listJobs.can(),\n nav: {\n label: \"Jobs\",\n labelKey: \"admin.nav.jobs\",\n icon: createElement(Timer),\n group: \"System\",\n groupKey: \"admin.nav.group.system\",\n order: 1010,\n },\n lazy: () => import(\"./admin-jobs.tsx\"),\n });\n\n notifications = $pageNav({\n parent: this.layout,\n path: \"/notifications\",\n name: \"notifications\",\n head: { title: \"Notifications\" },\n permission: \"admin:notification:read\",\n can: () => this.notificationApi.findNotifications.can(),\n nav: {\n label: \"Notifications\",\n labelKey: \"admin.nav.notifications\",\n icon: createElement(Bell),\n group: \"System\",\n groupKey: \"admin.nav.group.system\",\n order: 1011,\n },\n lazy: () => import(\"./admin-notifications.tsx\"),\n });\n\n audits = $pageNav({\n parent: this.layout,\n path: \"/audits\",\n name: \"audits\",\n head: { title: \"Audit log\" },\n permission: \"admin:audit:read\",\n can: () => this.auditApi.findAudits.can(),\n nav: {\n label: \"Audit log\",\n labelKey: \"admin.nav.audits\",\n icon: createElement(ShieldAlert),\n group: \"Identity\",\n groupKey: \"admin.nav.group.identity\",\n order: 1002,\n },\n lazy: () => import(\"./admin-audits.tsx\"),\n });\n\n files = $pageNav({\n parent: this.layout,\n path: \"/files\",\n name: \"files\",\n head: { title: \"Files\" },\n permission: \"admin:file:read\",\n can: () => this.fileApi.findFiles.can(),\n nav: {\n label: \"Files\",\n labelKey: \"admin.nav.files\",\n icon: createElement(Files),\n group: \"System\",\n groupKey: \"admin.nav.group.system\",\n order: 1012,\n },\n lazy: () => import(\"./admin-files.tsx\"),\n });\n\n parameters = $pageNav({\n parent: this.layout,\n path: \"/parameters\",\n name: \"parameters\",\n head: { title: \"Parameters\" },\n permission: \"admin:parameter:read\",\n can: () => this.parameterApi.getParameterTree.can(),\n nav: {\n label: \"Parameters\",\n labelKey: \"admin.nav.parameters\",\n icon: createElement(SlidersHorizontal),\n group: \"System\",\n groupKey: \"admin.nav.group.system\",\n order: 1015,\n keywords: [\"settings\", \"config\", \"configuration\"],\n },\n lazy: () => import(\"./admin-parameters.tsx\"),\n props: () => this.options.pages?.parameters ?? {},\n });\n\n /**\n * Both permissions are required, matching `AdminPaymentController`, which\n * gates every read with `[\"admin:payment:read\", \"payments:read\"]` — and\n * `$pageNav` treats an array as AND, the same way `$secure` does.\n */\n payments = $pageNav({\n parent: this.layout,\n path: \"/payments\",\n name: \"payments\",\n head: { title: \"Payments\" },\n permission: [\"admin:payment:read\", \"payments:read\"],\n can: () => this.paymentApi.listIntents.can(),\n nav: {\n label: \"Payments\",\n labelKey: \"admin.nav.payments\",\n icon: createElement(CreditCard),\n group: \"System\",\n groupKey: \"admin.nav.group.system\",\n order: 1013,\n },\n lazy: () => import(\"./admin-payments.tsx\"),\n });\n\n analytics = $pageNav({\n parent: this.layout,\n path: \"/analytics\",\n name: \"analytics\",\n head: { title: \"Analytics\" },\n permission: \"admin:analytics:read\",\n can: () => this.analyticsApi.listDatasets.can(),\n nav: {\n label: \"Analytics\",\n labelKey: \"admin.nav.analytics\",\n icon: createElement(ChartLine),\n group: \"System\",\n groupKey: \"admin.nav.group.system\",\n order: 1016,\n },\n lazy: () => import(\"./admin-analytics.tsx\"),\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqKA,IAAa,cAAb,MAAyB;CACvB,UAA6B,OAAO,sBAAsB;CAE1D,UAA6B,QAA6B;CAC1D,aAAgC,QAAgC;CAChE,YAA+B,QAA+B;CAC9D,SAA4B,QAA4B;CACxD,kBAAqC,QAAqC;CAC1E,WAA8B,QAA8B;CAC5D,UAA6B,QAAwB;CACrD,eAAkC,QAAkC;CACpE,aAAgC,QAAgC;CAChE,eAAkC,QAAkC;;;;;;;;;;;;;;;;;CAkBpE,SAAS,SAAS;EAChB,MAAM;EACN,MAAM;EACN,YAAY;EACZ,KAAK;GAAE,OAAO;GAAS,UAAU;EAAkB;EACnD,YAAY,OAAO;CACrB,CAAC;;;;;;;;;;;;;;;CAgBD,YAAY,SAAS;EACnB,QAAQ,KAAK;EACb,MAAM;EACN,MAAM;EACN,MAAM,EAAE,OAAO,YAAY;EAC3B,KAAK;GACH,OAAO;GACP,UAAU;GACV,MAAM,cAAc,eAAe;GACnC,OAAO;EACT;EACA,YAAY,OAAO;EACnB,cAAc,EAAE,OAAO,KAAK,eAAe,EAAE;CAC/C,CAAC;;;;;;;;;;;;;;;;CAiBD,iBAAiD;EAC/C,OAAO,CACL;GACE,IAAI;GACJ,OAAO;GACP,WAAW,KAAK,QAAQ,UAAU,IAAI;GACtC,cACE,cAAc,yBAAyB;IAKrC,OAAO,cAAc,WAAW;KAC9B,GAAG;KACH,UAAU;IACZ,CAAC;IACD,MAAM;IACN,MAAM,cAAc,WAAW,EAAE,WAAW,SAAS,CA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ACpB,QAAQ,KAAK;EACb,MAAM;EACN,MAAM;EACN,MAAM,EAAE,OAAO,aAAa;EAC5B,YAAY;EACZ,WAAW,KAAK,aAAa,iBAAiB,IAAI;EAClD,KAAK;GACH,OAAO;GACP,UAAU;GACV,MAAM,cAAc,iBAAiB;GACrC,OAAO;GACP,UAAU;GACV,OAAO;GACP,UAAU;IAAC;IAAY;IAAU;GAAe;EAClD;EACA,YAAY,OAAO;EACnB,aAAa,KAAK,QAAQ,OAAO,cAAc,CAAC;CAClD,CAAC;;;;;;CAOD,WAAW,SAAS;EAClB,QAAQ,KAAK;EACb,MAAM;EACN,MAAM;EACN,MAAM,EAAE,OAAO,WAAW;EAC1B,YAAY,CAAC,sBAAsB,eAAe;EAClD,WAAW,KAAK,WAAW,YAAY,IAAI;EAC3C,KAAK;GACH,OAAO;GACP,UAAU;GACV,MAAM,cAAc,UAAU;GAC9B,OAAO;GACP,UAAU;GACV,OAAO;EACT;EACA,YAAY,OAAO;CACrB,CAAC;CAED,YAAY,SAAS;EACnB,QAAQ,KAAK;EACb,MAAM;EACN,MAAM;EACN,MAAM,EAAE,OAAO,YAAY;EAC3B,YAAY;EACZ,WAAW,KAAK,aAAa,aAAa,IAAI;EAC9C,KAAK;GACH,OAAO;GACP,UAAU;GACV,MAAM,cAAc,SAAS;GAC7B,OAAO;GACP,UAAU;GACV,OAAO;EACT;EACA,YAAY,OAAO;CACrB,CAAC;AACH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin-sessions.d.ts","sourceRoot":"","sources":["../../../src/components/admin/admin-sessions.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"admin-sessions.d.ts","sourceRoot":"","sources":["../../../src/components/admin/admin-sessions.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AA4D/B,eAAO,MAAM,aAAa,yBAuRzB,CAAC;eAEa,aAAa"}
|
|
@@ -2,6 +2,7 @@ import { useDialog } from "../use-dialog/use-dialog.js";
|
|
|
2
2
|
import { useToast } from "../use-toast/use-toast.js";
|
|
3
3
|
import { Control } from "../control/control.js";
|
|
4
4
|
import { AlephaTable } from "../alepha-table/alepha-table.js";
|
|
5
|
+
import TimeAgo from "../time-ago/time-ago.js";
|
|
5
6
|
import { AdminPage } from "./admin-page.js";
|
|
6
7
|
import { AdminUserCell } from "./admin-user-cell.js";
|
|
7
8
|
import { useConfirmedAction } from "./use-confirmed-action.js";
|
|
@@ -210,18 +211,19 @@ const AdminSessions = () => {
|
|
|
210
211
|
label: tr("admin.sessions.colDevice", { default: "Device" }),
|
|
211
212
|
cell: (s) => {
|
|
212
213
|
const ua = s.userAgent;
|
|
214
|
+
const text = (ua ? [ua.browser, ua.os].filter((part) => part && part !== "Unknown").join(" • ") : "") || "—";
|
|
213
215
|
return /* @__PURE__ */ jsx("span", {
|
|
214
216
|
className: "text-muted-foreground line-clamp-1 text-xs",
|
|
215
|
-
children:
|
|
217
|
+
children: text
|
|
216
218
|
});
|
|
217
219
|
}
|
|
218
220
|
},
|
|
219
221
|
createdAt: {
|
|
220
222
|
label: tr("admin.sessions.colStarted", { default: "Started" }),
|
|
221
223
|
sortable: true,
|
|
222
|
-
cell: (s) => /* @__PURE__ */ jsx(
|
|
223
|
-
|
|
224
|
-
|
|
224
|
+
cell: (s) => /* @__PURE__ */ jsx(TimeAgo, {
|
|
225
|
+
value: s.createdAt,
|
|
226
|
+
className: "text-muted-foreground text-xs"
|
|
225
227
|
})
|
|
226
228
|
},
|
|
227
229
|
lastUsedAt: {
|
|
@@ -234,9 +236,9 @@ const AdminSessions = () => {
|
|
|
234
236
|
},
|
|
235
237
|
expiresAt: {
|
|
236
238
|
label: tr("admin.sessions.colExpires", { default: "Expires" }),
|
|
237
|
-
cell: (s) => /* @__PURE__ */ jsx(
|
|
238
|
-
|
|
239
|
-
|
|
239
|
+
cell: (s) => /* @__PURE__ */ jsx(TimeAgo, {
|
|
240
|
+
value: s.expiresAt,
|
|
241
|
+
className: "text-muted-foreground text-xs"
|
|
240
242
|
})
|
|
241
243
|
}
|
|
242
244
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin-sessions.js","names":[],"sources":["../../../src/components/admin/admin-sessions.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport { AdminPage } from \"@alepha/ui/components/admin/admin-page\";\nimport { AdminUserCell } from \"@alepha/ui/components/admin/admin-user-cell\";\nimport { useConfirmedAction } from \"@alepha/ui/components/admin/use-confirmed-action\";\nimport { AlephaTable } from \"@alepha/ui/components/alepha-table/alepha-table\";\nimport { Control } from \"@alepha/ui/components/control/control\";\nimport { useDialog } from \"@alepha/ui/components/use-dialog/use-dialog\";\nimport { useToast } from \"@alepha/ui/components/use-toast/use-toast\";\nimport { z } from \"alepha\";\nimport type { AdminSessionController, SessionResource } from \"alepha/api/users\";\nimport { useAction, useClient } from \"alepha/react\";\nimport { useI18n } from \"alepha/react/i18n\";\nimport { CircleDot, Clock, Globe, LogOut, Search } from \"lucide-react\";\nimport { useCallback, useEffect, useState } from \"react\";\n\n/**\n * The filter bar this page rendered empty until #1319.\n *\n * Shape copied from `admin-users` and `admin-audits` rather than invented: a\n * search box first in a fixed-width box, then `clearable` selects with an\n * icon and a `clearLabel` naming the unfiltered state. Free-form strings\n * rather than enums, for the reason `admin-users` gives - an unknown value\n * left in persisted state falls back to \"all\" instead of throwing on schema\n * validation.\n */\nconst filtersSchema = z.object({\n search: z.string().optional(),\n country: z.string().optional(),\n status: z.string().optional(),\n lastUsed: z.string().optional(),\n});\n\n/**\n * Windows offered for \"last used\", in hours, because a session's whole life\n * is usually measured in them.\n *\n * ⚠️ A literal `labelKey`, never `admin.sessions.lastUsed${hours}`.\n * `i18n-fr.spec.ts` extracts keys by reading them out of the source, so an\n * interpolated one is invisible to it in both directions: the French\n * catalogue would report the translations as unused extras while the\n * component silently fell back to English. This is the declarative form that\n * check already understands, and the reason it understands it.\n *\n * That regex reads comments too, so this one avoids writing an example key.\n */\nconst LAST_USED_WINDOWS = [\n { hours: \"1\", labelKey: \"admin.sessions.lastUsed1\", fallback: \"Last hour\" },\n { hours: \"24\", labelKey: \"admin.sessions.lastUsed24\", fallback: \"Last day\" },\n {\n hours: \"168\",\n labelKey: \"admin.sessions.lastUsed168\",\n fallback: \"Last week\",\n },\n] as const;\n\nexport const AdminSessions = () => {\n const client = useClient<AdminSessionController>();\n const toast = useToast();\n const dialog = useDialog();\n const { l, tr } = useI18n();\n\n // Same shape as the audit log's action facet: the values come from the\n // rows, so the control offers the countries this instance has actually seen\n // rather than all 249. Failure costs the facet, not the page.\n const [countries, setCountries] = useState<string[]>([]);\n\n useEffect(() => {\n let alive = true;\n client\n .getSessionCountries()\n .then((rows) => {\n if (alive) setCountries(rows);\n })\n .catch(() => {});\n return () => {\n alive = false;\n };\n }, [client]);\n\n const fetcher = useCallback(\n async (params: {\n page: number;\n size: number;\n sort?: string;\n filters?: Record<string, any>;\n }) => {\n const { filters, ...page } = params;\n return client.findSessions({\n query: {\n ...page,\n search: filters?.search || undefined,\n country: filters?.country || undefined,\n status: (filters?.status as \"active\" | \"expired\") || undefined,\n lastUsedWithinHours: filters?.lastUsed\n ? Number(filters.lastUsed)\n : undefined,\n },\n });\n },\n [client],\n );\n\n const revoke = useConfirmedAction<[SessionResource, () => void]>(\n {\n confirm: {\n title: tr(\"admin.sessions.revokeTitle\", { default: \"Revoke session\" }),\n description: tr(\"admin.sessions.revokeConfirm\", {\n default: \"The user will be signed out from this session.\",\n }),\n destructive: true,\n },\n handler: async (s, refresh) => {\n await client.deleteSession({ params: { id: s.id } });\n refresh();\n },\n success: tr(\"admin.sessions.revoked\", { default: \"Session revoked\" }),\n },\n [client, tr],\n );\n\n const bulkRevoke = useAction<\n [SessionResource[], { clearSelection: () => void; refresh: () => void }]\n >(\n {\n handler: async (items, ctx) => {\n if (items.length === 0) return;\n const ok = await dialog.confirm({\n title: tr(\"admin.sessions.bulkRevokeTitle\", {\n default: \"Revoke sessions\",\n }),\n description: tr(\"admin.sessions.bulkRevokeConfirm\", {\n default: `Revoke ${items.length} session(s)? Affected users will be signed out.`,\n args: [String(items.length)],\n }),\n destructive: true,\n });\n if (!ok) return;\n const res = await client.deleteSessions({\n body: { ids: items.map((s) => s.id) },\n });\n toast.success(\n tr(\"admin.sessions.bulkRevoked\", {\n default: `${res.deleted.length} session(s) revoked`,\n args: [String(res.deleted.length)],\n }),\n );\n ctx.clearSelection();\n ctx.refresh();\n },\n },\n [client, dialog, toast, tr],\n );\n\n return (\n <AdminPage>\n <AlephaTable<SessionResource>\n className=\"min-h-0 flex-1\"\n persistenceKey=\"admin.sessions\"\n fetch={fetcher}\n filters={{\n schema: filtersSchema,\n render: (form) => (\n <div className=\"flex items-center gap-2\">\n <div className=\"w-72\">\n <Control\n input={form.input.search}\n label=\"\"\n icon={Search}\n placeholder={String(\n tr(\"admin.sessions.searchPlaceholder\", {\n default: \"Email, username or IP…\",\n }),\n )}\n inputProps={{\n \"aria-label\": String(\n tr(\"admin.sessions.search\", {\n default: \"Search sessions\",\n }),\n ),\n }}\n />\n </div>\n <Control\n input={form.input.status}\n label=\"\"\n clearable\n icon={CircleDot}\n clearLabel={String(\n tr(\"admin.sessions.statusAll\", { default: \"All sessions\" }),\n )}\n triggerClassName=\"w-40\"\n items={[\n {\n value: \"active\",\n label: String(\n tr(\"admin.sessions.statusActive\", { default: \"Active\" }),\n ),\n },\n {\n value: \"expired\",\n label: String(\n tr(\"admin.sessions.statusExpired\", {\n default: \"Expired\",\n }),\n ),\n },\n ]}\n />\n <Control\n input={form.input.country}\n label=\"\"\n clearable\n icon={Globe}\n clearLabel={String(\n tr(\"admin.sessions.countryAll\", {\n default: \"All countries\",\n }),\n )}\n triggerClassName=\"w-40\"\n items={countries.map((code) => ({\n value: code,\n label: code,\n }))}\n />\n <Control\n input={form.input.lastUsed}\n label=\"\"\n clearable\n icon={Clock}\n clearLabel={String(\n tr(\"admin.sessions.lastUsedAny\", { default: \"Any time\" }),\n )}\n triggerClassName=\"w-44\"\n items={LAST_USED_WINDOWS.map((window) => ({\n value: window.hours,\n label: String(\n tr(window.labelKey, { default: window.fallback }),\n ),\n }))}\n />\n </div>\n ),\n }}\n bulkActions={[\n {\n label: tr(\"admin.sessions.bulkRevoke\", {\n default: \"Revoke selected\",\n }),\n icon: LogOut,\n destructive: true,\n onClick: (items, ctx) => bulkRevoke.run(items, ctx),\n },\n ]}\n columns={{\n user: {\n label: tr(\"admin.sessions.colUser\", { default: \"User\" }),\n cell: (s) => <AdminUserCell userId={s.userId} user={s.user} />,\n },\n ip: {\n label: tr(\"admin.sessions.colIp\", { default: \"IP\" }),\n cell: (s) => (\n <span className=\"flex items-center gap-1.5\">\n <code className=\"text-xs\">{s.ip ?? \"—\"}</code>\n {s.country ? (\n <span className=\"text-muted-foreground text-xs uppercase\">\n {s.country}\n </span>\n ) : null}\n </span>\n ),\n },\n userAgent: {\n label: tr(\"admin.sessions.colDevice\", { default: \"Device\" }),\n cell: (s) => {\n const ua = s.userAgent;\n // \"Unknown\" is what the parser reports for a client it could\n // not place (an API caller, an OAuth or MCP agent). Printing it\n // twice tells an admin less than the placeholder this column\n // already uses for a session carrying no agent at all.\n const text =\n (ua\n ? [ua.browser, ua.os]\n .filter((part) => part && part !== \"Unknown\")\n .join(\" • \")\n : \"\") || \"—\";\n return (\n <span className=\"text-muted-foreground line-clamp-1 text-xs\">\n {text}\n </span>\n );\n },\n },\n createdAt: {\n label: tr(\"admin.sessions.colStarted\", { default: \"Started\" }),\n sortable: true,\n cell: (s) => (\n <span className=\"text-muted-foreground text-xs\">\n {String(l(s.createdAt, { date: \"fromNow\" }))}\n </span>\n ),\n },\n lastUsedAt: {\n label: tr(\"admin.sessions.colLastUsed\", { default: \"Last used\" }),\n sortable: true,\n cell: (s) => (\n <span className=\"text-muted-foreground text-xs\">\n {s.lastUsedAt\n ? String(l(s.lastUsedAt, { date: \"fromNow\" }))\n : tr(\"admin.sessions.lastUsedNever\", { default: \"Never\" })}\n </span>\n ),\n },\n expiresAt: {\n label: tr(\"admin.sessions.colExpires\", { default: \"Expires\" }),\n cell: (s) => (\n <span className=\"text-muted-foreground text-xs\">\n {String(l(s.expiresAt, { date: \"fromNow\" }))}\n </span>\n ),\n },\n }}\n rowActions={(s) => [\n {\n label: tr(\"admin.sessions.revoke\", { default: \"Revoke\" }),\n icon: LogOut,\n destructive: true,\n onClick: (_s, { refresh }) => revoke.run(s, refresh),\n },\n ]}\n />\n </AdminPage>\n );\n};\n\nexport default AdminSessions;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA4BA,MAAM,gBAAgB,EAAE,OAAO;CAC7B,QAAQ,EAAE,OAAO,CAAC,CAAC,SAAS;CAC5B,SAAS,EAAE,OAAO,CAAC,CAAC,SAAS;CAC7B,QAAQ,EAAE,OAAO,CAAC,CAAC,SAAS;CAC5B,UAAU,EAAE,OAAO,CAAC,CAAC,SAAS;AAChC,CAAC;;;;;;;;;;;;;;AAeD,MAAM,oBAAoB;CACxB;EAAE,OAAO;EAAK,UAAU;EAA4B,UAAU;CAAY;CAC1E;EAAE,OAAO;EAAM,UAAU;EAA6B,UAAU;CAAW;CAC3E;EACE,OAAO;EACP,UAAU;EACV,UAAU;CACZ;AACF;AAEA,MAAa,sBAAsB;CACjC,MAAM,SAAS,UAAkC;CACjD,MAAM,QAAQ,SAAS;CACvB,MAAM,SAAS,UAAU;CACzB,MAAM,EAAE,GAAG,OAAO,QAAQ;CAK1B,MAAM,CAAC,WAAW,gBAAgB,SAAmB,CAAC,CAAC;CAEvD,gBAAgB;EACd,IAAI,QAAQ;EACZ,OACG,oBAAoB,CAAC,CACrB,MAAM,SAAS;GACd,IAAI,OAAO,aAAa,IAAI;EAC9B,CAAC,CAAC,CACD,YAAY,CAAC,CAAC;EACjB,aAAa;GACX,QAAQ;EACV;CACF,GAAG,CAAC,MAAM,CAAC;CAEX,MAAM,UAAU,YACd,OAAO,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C;IAChE,UAAU;IACV,OAAO,MACL,oBAAC,QAAD;KAAM,WAAU;KACb,UAAA,EAAE,aACC,OAAO,EAAE,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC,CAAC,IAC3C,GAAG,gCAAgC,EAAE,SAAS,QAAQ,CAAC;IACvD,CAAA;GAEV;GACA,WAAW;IACT,OAAO,GAAG,6BAA6B,EAAE,SAAS,UAAU,CAAC;IAC7D,OAAO,MACL,oBAAC,QAAD;KAAM,WAAU;KACb,UAAA,OAAO,EAAE,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC,CAAC;IACvC,CAAA;GAEV;EACF;EACA,aAAa,MAAM,CACjB;GACE,OAAO,GAAG,yBAAyB,EAAE,SAAS,SAAS,CAAC;GACxD,MAAM;GACN,aAAa;GACb,UAAU,IAAI,EAAE,cAAc,OAAO,IAAI,GAAG,OAAO;EACrD,CACF;CACD,CAAA,EACQ,CAAA;AAEf"}
|
|
1
|
+
{"version":3,"file":"admin-sessions.js","names":[],"sources":["../../../src/components/admin/admin-sessions.tsx"],"sourcesContent":["import * as React from \"react\";\n\nimport TimeAgo from \"../time-ago/time-ago.tsx\";\n\nvoid React;\n\nimport { AdminPage } from \"@alepha/ui/components/admin/admin-page\";\nimport { AdminUserCell } from \"@alepha/ui/components/admin/admin-user-cell\";\nimport { useConfirmedAction } from \"@alepha/ui/components/admin/use-confirmed-action\";\nimport { AlephaTable } from \"@alepha/ui/components/alepha-table/alepha-table\";\nimport { Control } from \"@alepha/ui/components/control/control\";\nimport { useDialog } from \"@alepha/ui/components/use-dialog/use-dialog\";\nimport { useToast } from \"@alepha/ui/components/use-toast/use-toast\";\nimport { z } from \"alepha\";\nimport type { AdminSessionController, SessionResource } from \"alepha/api/users\";\nimport { useAction, useClient } from \"alepha/react\";\nimport { useI18n } from \"alepha/react/i18n\";\nimport { CircleDot, Clock, Globe, LogOut, Search } from \"lucide-react\";\nimport { useCallback, useEffect, useState } from \"react\";\n\n/**\n * The filter bar this page rendered empty until #1319.\n *\n * Shape copied from `admin-users` and `admin-audits` rather than invented: a\n * search box first in a fixed-width box, then `clearable` selects with an\n * icon and a `clearLabel` naming the unfiltered state. Free-form strings\n * rather than enums, for the reason `admin-users` gives - an unknown value\n * left in persisted state falls back to \"all\" instead of throwing on schema\n * validation.\n */\nconst filtersSchema = z.object({\n search: z.string().optional(),\n country: z.string().optional(),\n status: z.string().optional(),\n lastUsed: z.string().optional(),\n});\n\n/**\n * Windows offered for \"last used\", in hours, because a session's whole life\n * is usually measured in them.\n *\n * ⚠️ A literal `labelKey`, never `admin.sessions.lastUsed${hours}`.\n * `i18n-fr.spec.ts` extracts keys by reading them out of the source, so an\n * interpolated one is invisible to it in both directions: the French\n * catalogue would report the translations as unused extras while the\n * component silently fell back to English. This is the declarative form that\n * check already understands, and the reason it understands it.\n *\n * That regex reads comments too, so this one avoids writing an example key.\n */\nconst LAST_USED_WINDOWS = [\n { hours: \"1\", labelKey: \"admin.sessions.lastUsed1\", fallback: \"Last hour\" },\n { hours: \"24\", labelKey: \"admin.sessions.lastUsed24\", fallback: \"Last day\" },\n {\n hours: \"168\",\n labelKey: \"admin.sessions.lastUsed168\",\n fallback: \"Last week\",\n },\n] as const;\n\nexport const AdminSessions = () => {\n const client = useClient<AdminSessionController>();\n const toast = useToast();\n const dialog = useDialog();\n const { l, tr } = useI18n();\n\n // Same shape as the audit log's action facet: the values come from the\n // rows, so the control offers the countries this instance has actually seen\n // rather than all 249. Failure costs the facet, not the page.\n const [countries, setCountries] = useState<string[]>([]);\n\n useEffect(() => {\n let alive = true;\n client\n .getSessionCountries()\n .then((rows) => {\n if (alive) setCountries(rows);\n })\n .catch(() => {});\n return () => {\n alive = false;\n };\n }, [client]);\n\n const fetcher = useCallback(\n async (params: {\n page: number;\n size: number;\n sort?: string;\n filters?: Record<string, any>;\n }) => {\n const { filters, ...page } = params;\n return client.findSessions({\n query: {\n ...page,\n search: filters?.search || undefined,\n country: filters?.country || undefined,\n status: (filters?.status as \"active\" | \"expired\") || undefined,\n lastUsedWithinHours: filters?.lastUsed\n ? Number(filters.lastUsed)\n : undefined,\n },\n });\n },\n [client],\n );\n\n const revoke = useConfirmedAction<[SessionResource, () => void]>(\n {\n confirm: {\n title: tr(\"admin.sessions.revokeTitle\", { default: \"Revoke session\" }),\n description: tr(\"admin.sessions.revokeConfirm\", {\n default: \"The user will be signed out from this session.\",\n }),\n destructive: true,\n },\n handler: async (s, refresh) => {\n await client.deleteSession({ params: { id: s.id } });\n refresh();\n },\n success: tr(\"admin.sessions.revoked\", { default: \"Session revoked\" }),\n },\n [client, tr],\n );\n\n const bulkRevoke = useAction<\n [SessionResource[], { clearSelection: () => void; refresh: () => void }]\n >(\n {\n handler: async (items, ctx) => {\n if (items.length === 0) return;\n const ok = await dialog.confirm({\n title: tr(\"admin.sessions.bulkRevokeTitle\", {\n default: \"Revoke sessions\",\n }),\n description: tr(\"admin.sessions.bulkRevokeConfirm\", {\n default: `Revoke ${items.length} session(s)? Affected users will be signed out.`,\n args: [String(items.length)],\n }),\n destructive: true,\n });\n if (!ok) return;\n const res = await client.deleteSessions({\n body: { ids: items.map((s) => s.id) },\n });\n toast.success(\n tr(\"admin.sessions.bulkRevoked\", {\n default: `${res.deleted.length} session(s) revoked`,\n args: [String(res.deleted.length)],\n }),\n );\n ctx.clearSelection();\n ctx.refresh();\n },\n },\n [client, dialog, toast, tr],\n );\n\n return (\n <AdminPage>\n <AlephaTable<SessionResource>\n className=\"min-h-0 flex-1\"\n persistenceKey=\"admin.sessions\"\n fetch={fetcher}\n filters={{\n schema: filtersSchema,\n render: (form) => (\n <div className=\"flex items-center gap-2\">\n <div className=\"w-72\">\n <Control\n input={form.input.search}\n label=\"\"\n icon={Search}\n placeholder={String(\n tr(\"admin.sessions.searchPlaceholder\", {\n default: \"Email, username or IP…\",\n }),\n )}\n inputProps={{\n \"aria-label\": String(\n tr(\"admin.sessions.search\", {\n default: \"Search sessions\",\n }),\n ),\n }}\n />\n </div>\n <Control\n input={form.input.status}\n label=\"\"\n clearable\n icon={CircleDot}\n clearLabel={String(\n tr(\"admin.sessions.statusAll\", { default: \"All sessions\" }),\n )}\n triggerClassName=\"w-40\"\n items={[\n {\n value: \"active\",\n label: String(\n tr(\"admin.sessions.statusActive\", { default: \"Active\" }),\n ),\n },\n {\n value: \"expired\",\n label: String(\n tr(\"admin.sessions.statusExpired\", {\n default: \"Expired\",\n }),\n ),\n },\n ]}\n />\n <Control\n input={form.input.country}\n label=\"\"\n clearable\n icon={Globe}\n clearLabel={String(\n tr(\"admin.sessions.countryAll\", {\n default: \"All countries\",\n }),\n )}\n triggerClassName=\"w-40\"\n items={countries.map((code) => ({\n value: code,\n label: code,\n }))}\n />\n <Control\n input={form.input.lastUsed}\n label=\"\"\n clearable\n icon={Clock}\n clearLabel={String(\n tr(\"admin.sessions.lastUsedAny\", { default: \"Any time\" }),\n )}\n triggerClassName=\"w-44\"\n items={LAST_USED_WINDOWS.map((window) => ({\n value: window.hours,\n label: String(\n tr(window.labelKey, { default: window.fallback }),\n ),\n }))}\n />\n </div>\n ),\n }}\n bulkActions={[\n {\n label: tr(\"admin.sessions.bulkRevoke\", {\n default: \"Revoke selected\",\n }),\n icon: LogOut,\n destructive: true,\n onClick: (items, ctx) => bulkRevoke.run(items, ctx),\n },\n ]}\n columns={{\n user: {\n label: tr(\"admin.sessions.colUser\", { default: \"User\" }),\n cell: (s) => <AdminUserCell userId={s.userId} user={s.user} />,\n },\n ip: {\n label: tr(\"admin.sessions.colIp\", { default: \"IP\" }),\n cell: (s) => (\n <span className=\"flex items-center gap-1.5\">\n <code className=\"text-xs\">{s.ip ?? \"—\"}</code>\n {s.country ? (\n <span className=\"text-muted-foreground text-xs uppercase\">\n {s.country}\n </span>\n ) : null}\n </span>\n ),\n },\n userAgent: {\n label: tr(\"admin.sessions.colDevice\", { default: \"Device\" }),\n cell: (s) => {\n const ua = s.userAgent;\n // \"Unknown\" is what the parser reports for a client it could\n // not place (an API caller, an OAuth or MCP agent). Printing it\n // twice tells an admin less than the placeholder this column\n // already uses for a session carrying no agent at all.\n const text =\n (ua\n ? [ua.browser, ua.os]\n .filter((part) => part && part !== \"Unknown\")\n .join(\" • \")\n : \"\") || \"—\";\n return (\n <span className=\"text-muted-foreground line-clamp-1 text-xs\">\n {text}\n </span>\n );\n },\n },\n createdAt: {\n label: tr(\"admin.sessions.colStarted\", { default: \"Started\" }),\n sortable: true,\n cell: (s) => (\n <TimeAgo\n value={s.createdAt}\n className=\"text-muted-foreground text-xs\"\n />\n ),\n },\n lastUsedAt: {\n label: tr(\"admin.sessions.colLastUsed\", { default: \"Last used\" }),\n sortable: true,\n cell: (s) => (\n <span className=\"text-muted-foreground text-xs\">\n {s.lastUsedAt\n ? String(l(s.lastUsedAt, { date: \"fromNow\" }))\n : tr(\"admin.sessions.lastUsedNever\", { default: \"Never\" })}\n </span>\n ),\n },\n expiresAt: {\n label: tr(\"admin.sessions.colExpires\", { default: \"Expires\" }),\n cell: (s) => (\n <TimeAgo\n value={s.expiresAt}\n className=\"text-muted-foreground text-xs\"\n />\n ),\n },\n }}\n rowActions={(s) => [\n {\n label: tr(\"admin.sessions.revoke\", { default: \"Revoke\" }),\n icon: LogOut,\n destructive: true,\n onClick: (_s, { refresh }) => revoke.run(s, refresh),\n },\n ]}\n />\n </AdminPage>\n );\n};\n\nexport default AdminSessions;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,MAAM,gBAAgB,EAAE,OAAO;CAC7B,QAAQ,EAAE,OAAO,CAAC,CAAC,SAAS;CAC5B,SAAS,EAAE,OAAO,CAAC,CAAC,SAAS;CAC7B,QAAQ,EAAE,OAAO,CAAC,CAAC,SAAS;CAC5B,UAAU,EAAE,OAAO,CAAC,CAAC,SAAS;AAChC,CAAC;;;;;;;;;;;;;;AAeD,MAAM,oBAAoB;CACxB;EAAE,OAAO;EAAK,UAAU;EAA4B,UAAU;CAAY;CAC1E;EAAE,OAAO;EAAM,UAAU;EAA6B,UAAU;CAAW;CAC3E;EACE,O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AAM,KAAK,EAAE;KAKb,MAAM,QACH,KACG,CAAC,GAAG,SAAS,GAAG,EAAE,CAAC,CAChB,QAAQ,SAAS,QAAQ,SAAS,SAAS,CAAC,CAC5C,KAAK,KAAK,IACb,OAAO;KACb,OACE,oBAAC,QAAD;MAAM,WAAU;MACb,UAAA;KACG,CAAA;IAEV;GACF;GACA,WAAW;IACT,OAAO,GAAG,6BAA6B,EAAE,SAAS,UAAU,CAAC;IAC7D,UAAU;IACV,OAAO,MACL,oBAAC,SAAD;KACE,OAAO,EAAE;KACT,WAAU;IACX,CAAA;GAEL;GACA,YAAY;IACV,OAAO,GAAG,8BAA8B,EAAE,SAAS,YAAY,CAAC;IAChE,UAAU;IACV,OAAO,MACL,oBAAC,QAAD;KAAM,WAAU;KACb,UAAA,EAAE,aACC,OAAO,EAAE,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC,CAAC,IAC3C,GAAG,gCAAgC,EAAE,SAAS,QAAQ,CAAC;IACvD,CAAA;GAEV;GACA,WAAW;IACT,OAAO,GAAG,6BAA6B,EAAE,SAAS,UAAU,CAAC;IAC7D,OAAO,MACL,oBAAC,SAAD;KACE,OAAO,EAAE;KACT,WAAU;IACX,CAAA;GAEL;EACF;EACA,aAAa,MAAM,CACjB;GACE,OAAO,GAAG,yBAAyB,EAAE,SAAS,SAAS,CAAC;GACxD,MAAM;GACN,aAAa;GACb,UAAU,IAAI,EAAE,cAAc,OAAO,IAAI,GAAG,OAAO;EACrD,CACF;CACD,CAAA,EACQ,CAAA;AAEf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin-user-detail-audits-tab.d.ts","sourceRoot":"","sources":["../../../src/components/admin/admin-user-detail-audits-tab.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"admin-user-detail-audits-tab.d.ts","sourceRoot":"","sources":["../../../src/components/admin/admin-user-detail-audits-tab.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,OAAO,EAEL,KAAK,YAAY,EAClB,MAAM,iDAAiD,CAAC;AAEzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD,MAAM,WAAW,6BAA6B;IAC5C;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,YAAY,CAAC,WAAW,CAAC,CAAC;CAClC;AAED;;GAEG;AACH,eAAO,MAAM,wBAAwB,UAC5B,6BAA6B,sBA6DrC,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Badge } from "../ui/badge.js";
|
|
2
2
|
import { AlephaTable } from "../alepha-table/alepha-table.js";
|
|
3
|
+
import TimeAgo from "../time-ago/time-ago.js";
|
|
3
4
|
import "react";
|
|
4
5
|
import { jsx } from "react/jsx-runtime";
|
|
5
6
|
import { useI18n } from "alepha/react/i18n";
|
|
@@ -8,7 +9,7 @@ import { useI18n } from "alepha/react/i18n";
|
|
|
8
9
|
* Audit tab: read-only trail of actions recorded against the user.
|
|
9
10
|
*/
|
|
10
11
|
const AdminUserDetailAuditsTab = (props) => {
|
|
11
|
-
const { tr
|
|
12
|
+
const { tr } = useI18n();
|
|
12
13
|
return /* @__PURE__ */ jsx("div", {
|
|
13
14
|
className: "flex min-h-0 flex-1 flex-col overflow-hidden p-6",
|
|
14
15
|
children: /* @__PURE__ */ jsx(AlephaTable, {
|
|
@@ -19,9 +20,9 @@ const AdminUserDetailAuditsTab = (props) => {
|
|
|
19
20
|
createdAt: {
|
|
20
21
|
label: tr("admin.userDetail.colWhen", { default: "When" }),
|
|
21
22
|
sortable: true,
|
|
22
|
-
cell: (a) => /* @__PURE__ */ jsx(
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
cell: (a) => /* @__PURE__ */ jsx(TimeAgo, {
|
|
24
|
+
value: a.createdAt,
|
|
25
|
+
className: "text-muted-foreground text-xs"
|
|
25
26
|
})
|
|
26
27
|
},
|
|
27
28
|
action: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin-user-detail-audits-tab.js","names":[],"sources":["../../../src/components/admin/admin-user-detail-audits-tab.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport {\n AlephaTable,\n type TableFetcher,\n} from \"@alepha/ui/components/alepha-table/alepha-table\";\nimport { Badge } from \"@alepha/ui/components/ui/badge\";\nimport type { AuditEntity } from \"alepha/api/audits\";\nimport { useI18n } from \"alepha/react/i18n\";\n\nexport interface AdminUserDetailAuditsTabProps {\n /**\n * Scopes the table's persisted column/sort state to this user.\n */\n userId: string;\n fetch: TableFetcher<AuditEntity>;\n}\n\n/**\n * Audit tab: read-only trail of actions recorded against the user.\n */\nexport const AdminUserDetailAuditsTab = (\n props: AdminUserDetailAuditsTabProps,\n) => {\n const { tr
|
|
1
|
+
{"version":3,"file":"admin-user-detail-audits-tab.js","names":[],"sources":["../../../src/components/admin/admin-user-detail-audits-tab.tsx"],"sourcesContent":["import * as React from \"react\";\n\nimport TimeAgo from \"../time-ago/time-ago.tsx\";\n\nvoid React;\n\nimport {\n AlephaTable,\n type TableFetcher,\n} from \"@alepha/ui/components/alepha-table/alepha-table\";\nimport { Badge } from \"@alepha/ui/components/ui/badge\";\nimport type { AuditEntity } from \"alepha/api/audits\";\nimport { useI18n } from \"alepha/react/i18n\";\n\nexport interface AdminUserDetailAuditsTabProps {\n /**\n * Scopes the table's persisted column/sort state to this user.\n */\n userId: string;\n fetch: TableFetcher<AuditEntity>;\n}\n\n/**\n * Audit tab: read-only trail of actions recorded against the user.\n */\nexport const AdminUserDetailAuditsTab = (\n props: AdminUserDetailAuditsTabProps,\n) => {\n const { tr } = useI18n();\n\n return (\n <div className=\"flex min-h-0 flex-1 flex-col overflow-hidden p-6\">\n <AlephaTable<AuditEntity>\n className=\"min-h-0 flex-1\"\n persistenceKey={`admin.userDetail.${props.userId}.audits`}\n fetch={props.fetch}\n columns={{\n createdAt: {\n label: tr(\"admin.userDetail.colWhen\", {\n default: \"When\",\n }),\n sortable: true,\n cell: (a) => (\n <TimeAgo\n value={a.createdAt}\n className=\"text-muted-foreground text-xs\"\n />\n ),\n },\n action: {\n label: tr(\"admin.userDetail.colAction\", {\n default: \"Action\",\n }),\n cell: (a) => (\n <code className=\"text-xs font-medium\">{a.action}</code>\n ),\n },\n resource: {\n label: tr(\"admin.userDetail.colResource\", {\n default: \"Resource\",\n }),\n cell: (a) => (\n <span className=\"font-mono text-xs\">\n {a.resourceType\n ? `${a.resourceType}:${a.resourceId ?? \"—\"}`\n : \"—\"}\n </span>\n ),\n },\n status: {\n label: tr(\"admin.userDetail.colAuditStatus\", {\n default: \"Status\",\n }),\n cell: (a) => (\n <Badge variant={a.success ? \"default\" : \"destructive\"}>\n {a.success\n ? tr(\"admin.userDetail.ok\", { default: \"OK\" })\n : tr(\"admin.userDetail.failed\", {\n default: \"Failed\",\n })}\n </Badge>\n ),\n },\n }}\n />\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;AAyBA,MAAa,4BACX,UACG;CACH,MAAM,EAAE,OAAO,QAAQ;CAEvB,OACE,oBAAC,OAAD;EAAK,WAAU;EACb,UAAA,oBAAC,aAAD;GACE,WAAU;GACV,gBAAgB,oBAAoB,MAAM,OAAO;GACjD,OAAO,MAAM;GACb,SAAS;IACP,WAAW;KACT,OAAO,GAAG,4BAA4B,EACpC,SAAS,OACX,CAAC;KACD,UAAU;KACV,OAAO,MACL,oBAAC,SAAD;MACE,OAAO,EAAE;MACT,WAAU;KACX,CAAA;IAEL;IACA,QAAQ;KACN,OAAO,GAAG,8BAA8B,EACtC,SAAS,SACX,CAAC;KACD,OAAO,MACL,oBAAC,QAAD;MAAM,WAAU;MAAuB,UAAA,EAAE;KAAa,CAAA;IAE1D;IACA,UAAU;KACR,OAAO,GAAG,gCAAgC,EACxC,SAAS,WACX,CAAC;KACD,OAAO,MACL,oBAAC,QAAD;MAAM,WAAU;MACb,UAAA,EAAE,eACC,GAAG,EAAE,aAAa,GAAG,EAAE,cAAc,QACrC;KACA,CAAA;IAEV;IACA,QAAQ;KACN,OAAO,GAAG,mCAAmC,EAC3C,SAAS,SACX,CAAC;KACD,OAAO,MACL,oBAAC,OAAD;MAAO,SAAS,EAAE,UAAU,YAAY;MACrC,UAAA,EAAE,UACC,GAAG,uBAAuB,EAAE,SAAS,KAAK,CAAC,IAC3C,GAAG,2BAA2B,EAC5B,SAAS,SACX,CAAC;KACA,CAAA;IAEX;GACF;EACD,CAAA;CACE,CAAA;AAET"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin-user-detail-sessions-tab.d.ts","sourceRoot":"","sources":["../../../src/components/admin/admin-user-detail-sessions-tab.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"admin-user-detail-sessions-tab.d.ts","sourceRoot":"","sources":["../../../src/components/admin/admin-user-detail-sessions-tab.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,OAAO,EAEL,KAAK,YAAY,EAClB,MAAM,iDAAiD,CAAC;AACzD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAIpD,MAAM,WAAW,+BAA+B;IAC9C;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,YAAY,CAAC,eAAe,CAAC,CAAC;IACrC,aAAa,EAAE,eAAe,CAAC,CAAC,eAAe,EAAE,MAAM,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC;IACpE,kBAAkB,EAAE,eAAe,CACjC;QAAC,eAAe,EAAE;QAAE;YAAE,OAAO,EAAE,MAAM,IAAI,CAAC;YAAC,cAAc,EAAE,MAAM,IAAI,CAAA;SAAE;KAAC,EACxE,IAAI,CACL,CAAC;CACH;AAED;;;GAGG;AACH,eAAO,MAAM,0BAA0B,UAC9B,+BAA+B,sBAwEvC,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AlephaTable } from "../alepha-table/alepha-table.js";
|
|
2
|
+
import TimeAgo from "../time-ago/time-ago.js";
|
|
2
3
|
import "react";
|
|
3
4
|
import { jsx } from "react/jsx-runtime";
|
|
4
5
|
import { LogOut } from "lucide-react";
|
|
@@ -9,7 +10,7 @@ import { useI18n } from "alepha/react/i18n";
|
|
|
9
10
|
* bulk.
|
|
10
11
|
*/
|
|
11
12
|
const AdminUserDetailSessionsTab = (props) => {
|
|
12
|
-
const { tr
|
|
13
|
+
const { tr } = useI18n();
|
|
13
14
|
return /* @__PURE__ */ jsx("div", {
|
|
14
15
|
className: "flex min-h-0 flex-1 flex-col overflow-hidden p-6",
|
|
15
16
|
children: /* @__PURE__ */ jsx(AlephaTable, {
|
|
@@ -34,18 +35,19 @@ const AdminUserDetailSessionsTab = (props) => {
|
|
|
34
35
|
label: tr("admin.userDetail.colDevice", { default: "Device" }),
|
|
35
36
|
cell: (s) => {
|
|
36
37
|
const ua = s.userAgent;
|
|
38
|
+
const text = (ua ? [ua.browser, ua.os].filter((part) => part && part !== "Unknown").join(" • ") : "") || "—";
|
|
37
39
|
return /* @__PURE__ */ jsx("span", {
|
|
38
40
|
className: "text-muted-foreground line-clamp-1 text-xs",
|
|
39
|
-
children:
|
|
41
|
+
children: text
|
|
40
42
|
});
|
|
41
43
|
}
|
|
42
44
|
},
|
|
43
45
|
createdAt: {
|
|
44
46
|
label: tr("admin.userDetail.colStarted", { default: "Started" }),
|
|
45
47
|
sortable: true,
|
|
46
|
-
cell: (s) => /* @__PURE__ */ jsx(
|
|
47
|
-
|
|
48
|
-
|
|
48
|
+
cell: (s) => /* @__PURE__ */ jsx(TimeAgo, {
|
|
49
|
+
value: s.createdAt,
|
|
50
|
+
className: "text-muted-foreground text-xs"
|
|
49
51
|
})
|
|
50
52
|
}
|
|
51
53
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin-user-detail-sessions-tab.js","names":[],"sources":["../../../src/components/admin/admin-user-detail-sessions-tab.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport {\n AlephaTable,\n type TableFetcher,\n} from \"@alepha/ui/components/alepha-table/alepha-table\";\nimport type { SessionResource } from \"alepha/api/users\";\nimport type { UseActionReturn } from \"alepha/react\";\nimport { useI18n } from \"alepha/react/i18n\";\nimport { LogOut } from \"lucide-react\";\n\nexport interface AdminUserDetailSessionsTabProps {\n /**\n * Scopes the table's persisted column/sort state to this user.\n */\n userId: string;\n fetch: TableFetcher<SessionResource>;\n revokeSession: UseActionReturn<[SessionResource, () => void], void>;\n bulkRevokeSessions: UseActionReturn<\n [SessionResource[], { refresh: () => void; clearSelection: () => void }],\n void\n >;\n}\n\n/**\n * Sessions tab: active sessions for the user, revocable one at a time or in\n * bulk.\n */\nexport const AdminUserDetailSessionsTab = (\n props: AdminUserDetailSessionsTabProps,\n) => {\n const { tr
|
|
1
|
+
{"version":3,"file":"admin-user-detail-sessions-tab.js","names":[],"sources":["../../../src/components/admin/admin-user-detail-sessions-tab.tsx"],"sourcesContent":["import * as React from \"react\";\n\nimport TimeAgo from \"../time-ago/time-ago.tsx\";\n\nvoid React;\n\nimport {\n AlephaTable,\n type TableFetcher,\n} from \"@alepha/ui/components/alepha-table/alepha-table\";\nimport type { SessionResource } from \"alepha/api/users\";\nimport type { UseActionReturn } from \"alepha/react\";\nimport { useI18n } from \"alepha/react/i18n\";\nimport { LogOut } from \"lucide-react\";\n\nexport interface AdminUserDetailSessionsTabProps {\n /**\n * Scopes the table's persisted column/sort state to this user.\n */\n userId: string;\n fetch: TableFetcher<SessionResource>;\n revokeSession: UseActionReturn<[SessionResource, () => void], void>;\n bulkRevokeSessions: UseActionReturn<\n [SessionResource[], { refresh: () => void; clearSelection: () => void }],\n void\n >;\n}\n\n/**\n * Sessions tab: active sessions for the user, revocable one at a time or in\n * bulk.\n */\nexport const AdminUserDetailSessionsTab = (\n props: AdminUserDetailSessionsTabProps,\n) => {\n const { tr } = useI18n();\n\n return (\n <div className=\"flex min-h-0 flex-1 flex-col overflow-hidden p-6\">\n <AlephaTable<SessionResource>\n className=\"min-h-0 flex-1\"\n persistenceKey={`admin.userDetail.${props.userId}.sessions`}\n fetch={props.fetch}\n bulkActions={[\n {\n label: tr(\"admin.userDetail.revokeSelected\", {\n default: \"Revoke selected\",\n }),\n icon: LogOut,\n destructive: true,\n onClick: (items, ctx) => props.bulkRevokeSessions.run(items, ctx),\n },\n ]}\n columns={{\n ip: {\n label: tr(\"admin.userDetail.colIp\", { default: \"IP\" }),\n cell: (s) => <code className=\"text-xs\">{s.ip ?? \"—\"}</code>,\n },\n userAgent: {\n label: tr(\"admin.userDetail.colDevice\", {\n default: \"Device\",\n }),\n cell: (s) => {\n const ua = s.userAgent;\n // \"Unknown\" is what the parser reports for a client it could\n // not place (an API caller, an OAuth or MCP agent). Printing it\n // twice tells an admin less than the placeholder this column\n // already uses for a session carrying no agent at all.\n const text =\n (ua\n ? [ua.browser, ua.os]\n .filter((part) => part && part !== \"Unknown\")\n .join(\" • \")\n : \"\") || \"—\";\n return (\n <span className=\"text-muted-foreground line-clamp-1 text-xs\">\n {text}\n </span>\n );\n },\n },\n createdAt: {\n label: tr(\"admin.userDetail.colStarted\", {\n default: \"Started\",\n }),\n sortable: true,\n cell: (s) => (\n <TimeAgo\n value={s.createdAt}\n className=\"text-muted-foreground text-xs\"\n />\n ),\n },\n }}\n rowActions={(s) => [\n {\n label: tr(\"admin.userDetail.revoke\", { default: \"Revoke\" }),\n icon: LogOut,\n destructive: true,\n onClick: (_s, ctx) => props.revokeSession.run(s, ctx.refresh),\n },\n ]}\n />\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;AAgCA,MAAa,8BACX,UACG;CACH,MAAM,EAAE,OAAO,QAAQ;CAEvB,OACE,oBAAC,OAAD;EAAK,WAAU;EACb,UAAA,oBAAC,aAAD;GACE,WAAU;GACV,gBAAgB,oBAAoB,MAAM,OAAO;GACjD,OAAO,MAAM;GACb,aAAa,CACX;IACE,OAAO,GAAG,mCAAmC,EAC3C,SAAS,kBACX,CAAC;IACD,MAAM;IACN,aAAa;IACb,UAAU,OAAO,QAAQ,MAAM,mBAAmB,IAAI,OAAO,GAAG;GAClE,CACF;GACA,SAAS;IACP,IAAI;KACF,OAAO,GAAG,0BAA0B,EAAE,SAAS,KAAK,CAAC;KACrD,OAAO,MAAM,oBAAC,QAAD;MAAM,WAAU;MAAW,UAAA,EAAE,MAAM;KAAU,CAAA;IAC5D;IACA,WAAW;KACT,OAAO,GAAG,8BAA8B,EACtC,SAAS,SACX,CAAC;KACD,OAAO,MAAM;MACX,MAAM,KAAK,EAAE;MAKb,MAAM,QACH,KACG,CAAC,GAAG,SAAS,GAAG,EAAE,CAAC,CAChB,QAAQ,SAAS,QAAQ,SAAS,SAAS,CAAC,CAC5C,KAAK,KAAK,IACb,OAAO;MACb,OACE,oBAAC,QAAD;OAAM,WAAU;OACb,UAAA;MACG,CAAA;KAEV;IACF;IACA,WAAW;KACT,OAAO,GAAG,+BAA+B,EACvC,SAAS,UACX,CAAC;KACD,UAAU;KACV,OAAO,MACL,oBAAC,SAAD;MACE,OAAO,EAAE;MACT,WAAU;KACX,CAAA;IAEL;GACF;GACA,aAAa,MAAM,CACjB;IACE,OAAO,GAAG,2BAA2B,EAAE,SAAS,SAAS,CAAC;IAC1D,MAAM;IACN,aAAa;IACb,UAAU,IAAI,QAAQ,MAAM,cAAc,IAAI,GAAG,IAAI,OAAO;GAC9D,CACF;EACD,CAAA;CACE,CAAA;AAET"}
|
|
@@ -97,10 +97,11 @@ const AdminUserDetail = (props) => {
|
|
|
97
97
|
props.userRealmName
|
|
98
98
|
]);
|
|
99
99
|
const identities = identitiesQuery.data?.content ?? [];
|
|
100
|
-
const
|
|
100
|
+
const realmQuery = useQuery({
|
|
101
101
|
handler: ({ signal }) => realmClient.getRealmConfig({ query: { realmName: props.userRealmName } }, { request: { signal } }),
|
|
102
102
|
onError: () => {}
|
|
103
|
-
}, [realmClient, props.userRealmName])
|
|
103
|
+
}, [realmClient, props.userRealmName]);
|
|
104
|
+
const policy = profilePolicy(realmQuery.data?.settings, user);
|
|
104
105
|
const issueMessage = (issue) => {
|
|
105
106
|
if (issue.field === "username") return issue.reason === "required" ? tr("admin.userDetail.usernameRequired", { default: "Username is required" }) : tr("admin.userDetail.usernameCannotBeCleared", { default: "Username cannot be removed once set" });
|
|
106
107
|
return issue.reason === "required" ? tr("admin.userDetail.emailRequired", { default: "Email is required" }) : tr("admin.userDetail.emailCannotBeCleared", { default: "Email cannot be removed once set" });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin-user-detail.js","names":[],"sources":["../../../src/components/admin/admin-user-detail.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport { AdminUserAvatarControl } from \"@alepha/ui/components/admin/admin-user-avatar-control\";\nimport { AdminUserDetailAuditsTab } from \"@alepha/ui/components/admin/admin-user-detail-audits-tab\";\nimport { AdminUserDetailIdentityAside } from \"@alepha/ui/components/admin/admin-user-detail-identity-aside\";\nimport { AdminUserDetailOverviewTab } from \"@alepha/ui/components/admin/admin-user-detail-overview-tab\";\nimport { AdminUserDetailPasswordDialog } from \"@alepha/ui/components/admin/admin-user-detail-password-dialog\";\nimport { AdminUserDetailSecurityTab } from \"@alepha/ui/components/admin/admin-user-detail-security-tab\";\nimport { AdminUserDetailSessionsTab } from \"@alepha/ui/components/admin/admin-user-detail-sessions-tab\";\nimport {\n DetailLayout,\n type DetailTab,\n} from \"@alepha/ui/components/detail/detail-layout\";\nimport { useDetailTab } from \"@alepha/ui/components/detail/use-detail-tab\";\nimport { Button } from \"@alepha/ui/components/ui/button\";\nimport { useDialog } from \"@alepha/ui/components/use-dialog/use-dialog\";\nimport { useToast } from \"@alepha/ui/components/use-toast/use-toast\";\nimport { AlephaError } from \"alepha\";\nimport type { AdminAuditController } from \"alepha/api/audits\";\nimport type {\n AdminIdentityController,\n AdminSessionController,\n AdminUserController,\n IdentityResource,\n RealmController,\n SessionResource,\n} from \"alepha/api/users\";\nimport { useAction, useClient, useQuery } from \"alepha/react\";\nimport { useAuth } from \"alepha/react/auth\";\nimport { FormValidationError, useForm, useFormState } from \"alepha/react/form\";\nimport { useI18n } from \"alepha/react/i18n\";\nimport { useRouter, useRouterState } from \"alepha/react/router\";\nimport { HttpError } from \"alepha/server\";\nimport {\n History,\n Monitor,\n ShieldCheck,\n Trash2,\n User,\n UserCheck,\n UserX,\n} from \"lucide-react\";\nimport { useCallback, useState } from \"react\";\n\nimport { PROVIDER_LABELS } from \"../auth/provider-labels.ts\";\nimport { passwordSchema } from \"./admin-user-detail-password-schema.ts\";\nimport {\n type ProfileIssue,\n profileIssues,\n profilePolicy,\n profileUpdateBody,\n} from \"./admin-user-detail-profile-policy.ts\";\nimport {\n type ProfileForm,\n profileSchema,\n} from \"./admin-user-detail-profile-schema.ts\";\n\nexport interface AdminUserDetailProps {\n /**\n * Realm name to scope all admin queries. Defaults to the configured\n * user realm.\n */\n userRealmName?: string;\n /**\n * Path to the users list page, for the \"Back\" link. Defaults to\n * `/admin/users`.\n */\n backPath?: string;\n}\n\ntype TabKey = \"overview\" | \"security\" | \"sessions\" | \"audits\";\n\n/**\n * Resolves the id param for this page, preferring `:userId` (the param name\n * `AdminRouter`'s own route declares) and falling back to `:id` (the name\n * this component read exclusively before `AdminRouter` existed).\n *\n * The fallback exists for `~/git/club/apps/platform`, which vendors\n * `@alepha/ui` and declares its own user-detail route as `/users/:id` against\n * this same component. Without it, that application's next upgrade of\n * `@alepha/ui` would resolve `userId` to `undefined`, fall through to the\n * empty string, and load `AdminUserDetail` with no id at all instead of\n * failing to build.\n */\nexport const resolveUserDetailId = (params: {\n userId?: string;\n id?: string;\n}): string => String(params.userId ?? params.id ?? \"\");\n\n/**\n * Composition root for the admin user detail page.\n *\n * Owns the data (queries, forms, mutations) and the shell — top bar, tab\n * selection, identity aside. Each tab body lives in its own file beside this\n * one; they render what they are given and hold no fetching of their own.\n */\nexport const AdminUserDetail = (props: AdminUserDetailProps) => {\n const router = useRouter();\n const routerState = useRouterState();\n const userId = resolveUserDetailId(routerState.params);\n const userClient = useClient<AdminUserController>();\n const sessionClient = useClient<AdminSessionController>();\n const identityClient = useClient<AdminIdentityController>();\n const auditClient = useClient<AdminAuditController>();\n const realmClient = useClient<RealmController>();\n const { tr } = useI18n();\n const toast = useToast();\n const { user: currentUser } = useAuth();\n const dialog = useDialog();\n\n const [passwordOpen, setPasswordOpen] = useState(false);\n const [tab, setTab] = useDetailTab<TabKey>(\"overview\");\n\n const isSelf = currentUser?.id === userId;\n const backPath = props.backPath ?? \"/admin/users\";\n\n // -- Load user, roles, identities -----------------------------------------\n // All three are read-only fetches via useQuery: each runs on mount, re-runs\n // when realm/id change, aborts on unmount via the passed signal, and exposes\n // refetch() — so the mutations below just call the relevant refetch()\n // instead of bumping a manual reload key.\n\n // ⚠️ Every query keyed on `userId` is gated on it being non-empty.\n //\n // `resolveUserDetailId` falls back to `\"\"` on purpose, so a vendored\n // consumer declaring `/users/:id` keeps working — but the fallback used to\n // be dispatched anyway. `useRouterState` is a GLOBAL store, so navigating\n // away re-renders this component with the next route's params before it\n // unmounts: `userId` becomes `\"\"`, the dep changes, and the query re-runs\n // with it. The batch then posts `params: { id: \"\" }` and the server answers\n // `Invalid GUID at /id` — blight #358, seven hits, and #118 before it on\n // the previous bundle.\n //\n // Skipping the request is also what makes the fallback fail VISIBLY: with\n // nothing in flight, `loading` is false and `user` is undefined, so the\n // `notFound` branch below renders instead of a 400 nobody sees.\n const hasUserId = userId !== \"\";\n\n const userQuery = useQuery(\n {\n enabled: hasUserId,\n handler: ({ signal }) =>\n userClient.getUser(\n {\n params: { id: userId },\n query: { userRealmName: props.userRealmName },\n },\n { request: { signal } },\n ),\n onError: (err) => {\n toast.error(\n tr(\"admin.userDetail.loadError\", { default: \"Failed to load user\" }),\n );\n console.error(err);\n },\n },\n [userClient, userId, props.userRealmName],\n );\n const user = userQuery.data;\n\n const rolesQuery = useQuery(\n {\n handler: ({ signal }) =>\n userClient.findRoles(\n { query: { userRealmName: props.userRealmName } },\n { request: { signal } },\n ),\n // Role metadata is non-blocking — swallow errors so the page still loads.\n onError: () => {},\n },\n [userClient, props.userRealmName],\n );\n const availableRoles = rolesQuery.data ?? [];\n\n const identitiesQuery = useQuery(\n {\n // Same gate: this one sends `userId` as a filter, so an empty one asks\n // for every identity in the realm rather than failing.\n enabled: hasUserId,\n handler: ({ signal }) =>\n identityClient.findIdentities(\n { query: { userId, size: 100, userRealmName: props.userRealmName } },\n { request: { signal } },\n ),\n // Identities may fail if the controller isn't mounted — non-blocking.\n onError: () => {},\n },\n [identityClient, userId, props.userRealmName],\n );\n const identities = identitiesQuery.data?.content ?? [];\n\n const realmQuery = useQuery(\n {\n // The realm config query param is `realmName`; the admin endpoints\n // spell the same thing `userRealmName`.\n handler: ({ signal }) =>\n realmClient.getRealmConfig(\n { query: { realmName: props.userRealmName } },\n { request: { signal } },\n ),\n // Realm settings only shape which profile fields are offered — a\n // failure must not block the page. `profilePolicy` degrades to\n // \"everything optional\" without them.\n onError: () => {},\n },\n [realmClient, props.userRealmName],\n );\n\n // What the realm collects decides what this form offers and demands.\n // Hardcoding \"email is required\" here made every save fail — a role change\n // included — on a realm that signs users in by username alone.\n const policy = profilePolicy(realmQuery.data?.settings, user);\n\n // -- Profile form ---------------------------------------------------------\n\n const issueMessage = (issue: ProfileIssue): string => {\n if (issue.field === \"username\") {\n return issue.reason === \"required\"\n ? tr(\"admin.userDetail.usernameRequired\", {\n default: \"Username is required\",\n })\n : tr(\"admin.userDetail.usernameCannotBeCleared\", {\n default: \"Username cannot be removed once set\",\n });\n }\n return issue.reason === \"required\"\n ? tr(\"admin.userDetail.emailRequired\", {\n default: \"Email is required\",\n })\n : tr(\"admin.userDetail.emailCannotBeCleared\", {\n default: \"Email cannot be removed once set\",\n });\n };\n\n const form = useForm({\n schema: profileSchema,\n initialValues: {\n username: user?.username ?? \"\",\n email: user?.email ?? \"\",\n firstName: user?.firstName ?? \"\",\n lastName: user?.lastName ?? \"\",\n emailVerified: user?.emailVerified ?? false,\n roles: user?.roles ?? [],\n },\n handler: async (values: ProfileForm) => {\n // Field guards live in the handler, not in the schema, so useForm's\n // initial decode doesn't crash on the empty mount.\n const issue = profileIssues(values, policy, user)[0];\n if (issue) {\n throw new FormValidationError({\n message: issueMessage(issue),\n path: `/${issue.field}`,\n });\n }\n\n const body = profileUpdateBody(values, policy, user);\n\n try {\n await userClient.updateUser({\n params: { id: userId },\n query: { userRealmName: props.userRealmName },\n body,\n });\n toast.success(\n tr(\"admin.userDetail.saved\", { default: \"Profile saved\" }),\n );\n await userQuery.refetch();\n } catch (err) {\n // Throw, never toast. `ActionErrorToaster`, which `AppShell` mounts,\n // already turns an unhandled action error into exactly one toast, and\n // it reads `error.message` - the very string this used to pass to\n // `toast.error` for an `HttpError`. So a refused duplicate email\n // arrived twice, as two identical stacked toasts.\n //\n // What is left here is the other half of the job: making sure the\n // error carries a sentence worth showing. An `HttpError` already does\n // (it is the server's own wording, and \"Email already exists\" is\n // exactly what the operator needs to read), so it travels as-is.\n // Anything else is transport or a bug, whose message - \"Failed to\n // fetch\" - says nothing about this form, so it gets replaced.\n //\n // Same division of labour as the auth forms in this package: the\n // handler throws, the toaster shows.\n throw err instanceof HttpError\n ? err\n : new AlephaError(\n tr(\"admin.userDetail.saveError\", {\n default: \"Failed to save profile\",\n }),\n { cause: err },\n );\n }\n },\n });\n\n // No `useEffect` re-seeding the form from `userQuery.data` here: the same\n // object is already `useForm`'s `initialValues` above, and `useForm` re-seeds\n // itself when it changes - keeping the fields the user has edited, which the\n // hand-rolled effect could not do. It re-seeded wholesale, so anything typed\n // between pressing Save and the refetch landing was overwritten by data that\n // predates it.\n\n // -- Set password ---------------------------------------------------------\n\n const passwordForm = useForm({\n schema: passwordSchema,\n handler: async ({ password }) => {\n await userClient.setUserPassword({\n params: { id: userId },\n query: { userRealmName: props.userRealmName },\n body: { password },\n });\n toast.success(\n tr(\"admin.userDetail.passwordSet\", {\n default: \"Password updated\",\n }),\n );\n passwordForm.input.password.set?.(\"\");\n setPasswordOpen(false);\n },\n });\n const { loading: passwordSubmitting } = useFormState(passwordForm, [\n \"loading\",\n ]);\n\n // -- Enable/disable -------------------------------------------------------\n\n const toggleEnabled = useAction(\n {\n handler: async () => {\n if (!user || isSelf) return;\n const enable = !user.enabled;\n const label =\n user.email ||\n user.username ||\n tr(\"admin.userDetail.thisUser\", {\n default: \"this user\",\n });\n const ok = await dialog.confirm({\n title: enable\n ? tr(\"admin.userDetail.enableTitle\", { default: \"Enable user\" })\n : tr(\"admin.userDetail.disableTitle\", { default: \"Disable user\" }),\n description: enable\n ? tr(\"admin.userDetail.enableConfirm\", {\n default: `Enable ${label}?`,\n args: [String(label)],\n })\n : tr(\"admin.userDetail.disableConfirm\", {\n default: `Disable ${label}? They will no longer be able to sign in.`,\n args: [String(label)],\n }),\n destructive: !enable,\n });\n if (!ok) return;\n await userClient.updateUser({\n params: { id: userId },\n query: { userRealmName: props.userRealmName },\n body: { enabled: enable },\n });\n await userQuery.refetch();\n toast.success(\n enable\n ? tr(\"admin.userDetail.enabled\", { default: \"User enabled\" })\n : tr(\"admin.userDetail.disabled\", { default: \"User disabled\" }),\n );\n },\n },\n [user, isSelf],\n );\n\n // -- Delete ---------------------------------------------------------------\n\n const deleteUser = useAction(\n {\n handler: async () => {\n if (!user || isSelf) return;\n const label =\n user.email ||\n user.username ||\n tr(\"admin.userDetail.thisUser\", {\n default: \"this user\",\n });\n const ok = await dialog.confirm({\n title: tr(\"admin.userDetail.deleteTitle\", { default: \"Delete user\" }),\n description: tr(\"admin.userDetail.deleteConfirm\", {\n default: `Permanently delete ${label}? This action cannot be undone.`,\n args: [String(label)],\n }),\n destructive: true,\n confirmLabel: String(\n tr(\"admin.userDetail.deleteCta\", { default: \"Delete\" }),\n ),\n });\n if (!ok) return;\n await userClient.deleteUser({\n params: { id: userId },\n query: { userRealmName: props.userRealmName },\n });\n toast.success(\n tr(\"admin.userDetail.deleted\", { default: \"User deleted\" }),\n );\n await router.push(backPath);\n },\n },\n [user, isSelf],\n );\n\n // -- Remove social auth ---------------------------------------------------\n\n const removeIdentity = useAction<[IdentityResource]>(\n {\n handler: async (identity) => {\n const provider =\n PROVIDER_LABELS[identity.provider] ?? identity.provider;\n const ok = await dialog.confirm({\n title: tr(\"admin.userDetail.removeIdentityTitle\", {\n default: \"Remove connection\",\n }),\n description: tr(\"admin.userDetail.removeIdentityConfirm\", {\n default: `Remove the ${provider} connection? The user will no longer be able to sign in with it.`,\n args: [provider],\n }),\n destructive: true,\n });\n if (!ok) return;\n await identityClient.deleteIdentity({\n params: { id: identity.id },\n query: { userRealmName: props.userRealmName },\n });\n toast.success(\n tr(\"admin.userDetail.identityRemoved\", {\n default: \"Connection removed\",\n }),\n );\n await identitiesQuery.refetch();\n },\n },\n [props.userRealmName],\n );\n\n // -- Clear the second factor ----------------------------------------------\n\n /*\n * Same endpoint as `removeIdentity`: a TOTP enrollment is an identity row,\n * and `admin:identity:delete` already means \"can take away a way into this\n * account\". What differs is what the operator is told: this does not remove\n * a sign-in method, it removes the check that sits after one, so the wording\n * of `removeIdentity` would be actively wrong here.\n *\n * It is also the single action an attacker holding an admin session wants\n * most, which is why it confirms rather than firing on one click.\n */\n const clearTotp = useAction<[IdentityResource]>(\n {\n handler: async (identity) => {\n // Named, the same way `toggleEnabled` and `remove` name theirs. An\n // admin can have several user pages open, and this is the one action\n // whose confirmation must leave no doubt about whose account it is.\n const label =\n user?.email ||\n user?.username ||\n tr(\"admin.userDetail.thisUser\", { default: \"this user\" });\n const ok = await dialog.confirm({\n title: tr(\"admin.userDetail.clearTotpTitle\", {\n default: \"Clear second factor\",\n }),\n description: tr(\"admin.userDetail.clearTotpConfirm\", {\n default: `${label} will sign in with their password alone until they enroll an authenticator app again. Do this only when they have lost both the device and their recovery codes.`,\n args: [String(label)],\n }),\n destructive: true,\n });\n if (!ok) return;\n await identityClient.deleteIdentity({\n params: { id: identity.id },\n query: { userRealmName: props.userRealmName },\n });\n toast.success(\n tr(\"admin.userDetail.totpCleared\", {\n default: \"Second factor cleared\",\n }),\n );\n await identitiesQuery.refetch();\n },\n },\n [props.userRealmName],\n );\n\n // -- Sessions / audits fetchers -------------------------------------------\n\n const sessionsFetcher = useCallback(\n (params: { page: number; size: number; sort?: string }) =>\n sessionClient.findSessions({\n query: { ...params, userId, userRealmName: props.userRealmName },\n }),\n [sessionClient, userId, props.userRealmName],\n );\n\n const auditsFetcher = useCallback(\n (params: { page: number; size: number; sort?: string }) =>\n auditClient.findByUser({ params: { userId }, query: params }),\n [auditClient, userId],\n );\n\n const revokeSession = useAction<[SessionResource, () => void]>(\n {\n handler: async (s, refresh) => {\n const ok = await dialog.confirm({\n title: tr(\"admin.userDetail.revokeTitle\", {\n default: \"Revoke session\",\n }),\n description: tr(\"admin.userDetail.revokeConfirm\", {\n default:\n \"Revoke this session? The user will be signed out on the matching device.\",\n }),\n destructive: true,\n });\n if (!ok) return;\n await sessionClient.deleteSession({\n params: { id: s.id },\n query: { userRealmName: props.userRealmName },\n });\n refresh();\n },\n },\n [props.userRealmName],\n );\n\n const bulkRevokeSessions = useAction<\n [SessionResource[], { refresh: () => void; clearSelection: () => void }]\n >(\n {\n handler: async (items, ctx) => {\n const ok = await dialog.confirm({\n title: tr(\"admin.userDetail.bulkRevokeTitle\", {\n default: \"Revoke sessions\",\n }),\n description: tr(\"admin.userDetail.bulkRevokeConfirm\", {\n default: `Revoke ${items.length} sessions?`,\n args: [String(items.length)],\n }),\n destructive: true,\n });\n if (!ok) return;\n await sessionClient.deleteSessions({\n query: { userRealmName: props.userRealmName },\n body: { ids: items.map((s) => s.id) },\n });\n ctx.clearSelection();\n ctx.refresh();\n },\n },\n [props.userRealmName],\n );\n\n // -- Render ---------------------------------------------------------------\n\n // A `credentials` identity means a password is set. Password sign-in lives\n // in its own card; the social providers are everything else.\n const hasPassword = identities.some((id) => id.provider === \"credentials\");\n const socialIdentities = identities.filter(\n (id) => id.provider !== \"credentials\",\n );\n\n const tabs: DetailTab[] = [\n {\n value: \"overview\",\n icon: User,\n label: tr(\"admin.userDetail.tabOverview\", { default: \"Overview\" }),\n },\n {\n value: \"security\",\n icon: ShieldCheck,\n label: tr(\"admin.userDetail.tabSecurity\", { default: \"Security\" }),\n },\n {\n value: \"sessions\",\n icon: Monitor,\n label: tr(\"admin.userDetail.tabSessions\", { default: \"Sessions\" }),\n },\n {\n value: \"audits\",\n icon: History,\n label: tr(\"admin.userDetail.tabAudits\", { default: \"Audit log\" }),\n },\n ];\n\n return (\n <>\n <DetailLayout\n loading={userQuery.loading && !user}\n notFound={\n user\n ? undefined\n : {\n message: String(\n tr(\"admin.userDetail.notFound\", {\n default: \"User not found.\",\n }),\n ),\n backLabel: String(\n tr(\"admin.userDetail.back\", { default: \"Back to users\" }),\n ),\n onBack: () => void router.push(backPath),\n }\n }\n aside={\n user ? (\n <div className=\"flex flex-col gap-3\">\n <AdminUserDetailIdentityAside user={user} />\n {/* Under the aside rather than inside it: `DetailAside` renders\n rows of facts, and this is an action on the picture above\n it. It hides itself when the realm has avatars off - the\n endpoint is unregistered there, so `can()` is false. */}\n <AdminUserAvatarControl\n user={user}\n onChanged={() => void userQuery.refetch()}\n />\n </div>\n ) : null\n }\n tabs={tabs}\n tab={tab}\n onTabChange={(v) => setTab(v as TabKey)}\n actions={\n <>\n <Button\n variant=\"outline\"\n size=\"lg\"\n loading={toggleEnabled.loading}\n disabled={isSelf}\n onClick={() => toggleEnabled.run()}\n >\n {user?.enabled ? (\n <>\n <UserX className=\"size-4\" />\n {tr(\"admin.userDetail.disable\", { default: \"Disable\" })}\n </>\n ) : (\n <>\n <UserCheck className=\"size-4\" />\n {tr(\"admin.userDetail.enable\", { default: \"Enable\" })}\n </>\n )}\n </Button>\n <Button\n variant=\"destructive\"\n size=\"lg\"\n loading={deleteUser.loading}\n disabled={isSelf}\n onClick={() => deleteUser.run()}\n >\n <Trash2 className=\"size-4\" />\n {tr(\"admin.userDetail.delete\", { default: \"Delete user\" })}\n </Button>\n </>\n }\n >\n {tab === \"overview\" && (\n <AdminUserDetailOverviewTab\n form={form}\n availableRoles={availableRoles}\n policy={policy}\n />\n )}\n\n {tab === \"security\" && (\n <AdminUserDetailSecurityTab\n hasPassword={hasPassword}\n socialIdentities={socialIdentities}\n removeIdentity={removeIdentity}\n clearTotp={clearTotp}\n onChangePassword={() => setPasswordOpen(true)}\n />\n )}\n\n {tab === \"sessions\" && (\n <AdminUserDetailSessionsTab\n userId={userId}\n fetch={sessionsFetcher}\n revokeSession={revokeSession}\n bulkRevokeSessions={bulkRevokeSessions}\n />\n )}\n\n {tab === \"audits\" && (\n <AdminUserDetailAuditsTab userId={userId} fetch={auditsFetcher} />\n )}\n </DetailLayout>\n\n <AdminUserDetailPasswordDialog\n open={passwordOpen}\n onOpenChange={setPasswordOpen}\n form={passwordForm}\n submitting={passwordSubmitting}\n />\n </>\n );\n};\n\nexport default AdminUserDetail;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsFA,MAAa,uBAAuB,WAGtB,OAAO,OAAO,UAAU,OAAO,MAAM,EAAE;;;;;;;;AASrD,MAAa,mBAAmB,UAAgC;CAC9D,MAAM,SAAS,UAAU;CACzB,MAAM,cAAc,eAAe;CACnC,MAAM,SAAS,oBAAoB,YAAY,MAAM;CACrD,MAAM,aAAa,UAA+B;CAClD,MAAM,gBAAgB,UAAkC;CACxD,MAAM,iBAAiB,UAAmC;CAC1D,MAAM,cAAc,UAAgC;CACpD,MAAM,cAAc,UAA2B;CAC/C,MAAM,EAAE,OAAO,QAAQ;CACvB,MAAM,QAAQ,SAAS;CACvB,MAAM,EAAE,MAAM,gBAAgB,QAAQ;CACtC,MAAM,SAAS,UAAU;CAEzB,MAAM,CAAC,cAAc,mBAAmB,SAAS,KAAK;CACtD,MAAM,CAAC,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src/components/admin/admin-user-detail.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport { AdminUserAvatarControl } from \"@alepha/ui/components/admin/admin-user-avatar-control\";\nimport { AdminUserDetailAuditsTab } from \"@alepha/ui/components/admin/admin-user-detail-audits-tab\";\nimport { AdminUserDetailIdentityAside } from \"@alepha/ui/components/admin/admin-user-detail-identity-aside\";\nimport { AdminUserDetailOverviewTab } from \"@alepha/ui/components/admin/admin-user-detail-overview-tab\";\nimport { AdminUserDetailPasswordDialog } from \"@alepha/ui/components/admin/admin-user-detail-password-dialog\";\nimport { AdminUserDetailSecurityTab } from \"@alepha/ui/components/admin/admin-user-detail-security-tab\";\nimport { AdminUserDetailSessionsTab } from \"@alepha/ui/components/admin/admin-user-detail-sessions-tab\";\nimport {\n DetailLayout,\n type DetailTab,\n} from \"@alepha/ui/components/detail/detail-layout\";\nimport { useDetailTab } from \"@alepha/ui/components/detail/use-detail-tab\";\nimport { Button } from \"@alepha/ui/components/ui/button\";\nimport { useDialog } from \"@alepha/ui/components/use-dialog/use-dialog\";\nimport { useToast } from \"@alepha/ui/components/use-toast/use-toast\";\nimport { AlephaError } from \"alepha\";\nimport type { AdminAuditController } from \"alepha/api/audits\";\nimport type {\n AdminIdentityController,\n AdminSessionController,\n AdminUserController,\n IdentityResource,\n RealmController,\n SessionResource,\n} from \"alepha/api/users\";\nimport { useAction, useClient, useQuery } from \"alepha/react\";\nimport { useAuth } from \"alepha/react/auth\";\nimport { FormValidationError, useForm, useFormState } from \"alepha/react/form\";\nimport { useI18n } from \"alepha/react/i18n\";\nimport { useRouter, useRouterState } from \"alepha/react/router\";\nimport { HttpError } from \"alepha/server\";\nimport {\n History,\n Monitor,\n ShieldCheck,\n Trash2,\n User,\n UserCheck,\n UserX,\n} from \"lucide-react\";\nimport { useCallback, useState } from \"react\";\n\nimport { PROVIDER_LABELS } from \"../auth/provider-labels.ts\";\nimport { passwordSchema } from \"./admin-user-detail-password-schema.ts\";\nimport {\n type ProfileIssue,\n profileIssues,\n profilePolicy,\n profileUpdateBody,\n} from \"./admin-user-detail-profile-policy.ts\";\nimport {\n type ProfileForm,\n profileSchema,\n} from \"./admin-user-detail-profile-schema.ts\";\n\nexport interface AdminUserDetailProps {\n /**\n * Realm name to scope all admin queries. Defaults to the configured\n * user realm.\n */\n userRealmName?: string;\n /**\n * Path to the users list page, for the \"Back\" link. Defaults to\n * `/admin/users`.\n */\n backPath?: string;\n}\n\ntype TabKey = \"overview\" | \"security\" | \"sessions\" | \"audits\";\n\n/**\n * Resolves the id param for this page, preferring `:userId` (the param name\n * `AdminRouter`'s own route declares) and falling back to `:id` (the name\n * this component read exclusively before `AdminRouter` existed).\n *\n * The fallback exists for `~/git/club/apps/platform`, which vendors\n * `@alepha/ui` and declares its own user-detail route as `/users/:id` against\n * this same component. Without it, that application's next upgrade of\n * `@alepha/ui` would resolve `userId` to `undefined`, fall through to the\n * empty string, and load `AdminUserDetail` with no id at all instead of\n * failing to build.\n */\nexport const resolveUserDetailId = (params: {\n userId?: string;\n id?: string;\n}): string => String(params.userId ?? params.id ?? \"\");\n\n/**\n * Composition root for the admin user detail page.\n *\n * Owns the data (queries, forms, mutations) and the shell — top bar, tab\n * selection, identity aside. Each tab body lives in its own file beside this\n * one; they render what they are given and hold no fetching of their own.\n */\nexport const AdminUserDetail = (props: AdminUserDetailProps) => {\n const router = useRouter();\n const routerState = useRouterState();\n const userId = resolveUserDetailId(routerState.params);\n const userClient = useClient<AdminUserController>();\n const sessionClient = useClient<AdminSessionController>();\n const identityClient = useClient<AdminIdentityController>();\n const auditClient = useClient<AdminAuditController>();\n const realmClient = useClient<RealmController>();\n const { tr } = useI18n();\n const toast = useToast();\n const { user: currentUser } = useAuth();\n const dialog = useDialog();\n\n const [passwordOpen, setPasswordOpen] = useState(false);\n const [tab, setTab] = useDetailTab<TabKey>(\"overview\");\n\n const isSelf = currentUser?.id === userId;\n const backPath = props.backPath ?? \"/admin/users\";\n\n // -- Load user, roles, identities -----------------------------------------\n // All three are read-only fetches via useQuery: each runs on mount, re-runs\n // when realm/id change, aborts on unmount via the passed signal, and exposes\n // refetch() — so the mutations below just call the relevant refetch()\n // instead of bumping a manual reload key.\n\n // ⚠️ Every query keyed on `userId` is gated on it being non-empty.\n //\n // `resolveUserDetailId` falls back to `\"\"` on purpose, so a vendored\n // consumer declaring `/users/:id` keeps working — but the fallback used to\n // be dispatched anyway. `useRouterState` is a GLOBAL store, so navigating\n // away re-renders this component with the next route's params before it\n // unmounts: `userId` becomes `\"\"`, the dep changes, and the query re-runs\n // with it. The batch then posts `params: { id: \"\" }` and the server answers\n // `Invalid GUID at /id` — blight #358, seven hits, and #118 before it on\n // the previous bundle.\n //\n // Skipping the request is also what makes the fallback fail VISIBLY: with\n // nothing in flight, `loading` is false and `user` is undefined, so the\n // `notFound` branch below renders instead of a 400 nobody sees.\n const hasUserId = userId !== \"\";\n\n const userQuery = useQuery(\n {\n enabled: hasUserId,\n handler: ({ signal }) =>\n userClient.getUser(\n {\n params: { id: userId },\n query: { userRealmName: props.userRealmName },\n },\n { request: { signal } },\n ),\n onError: (err) => {\n toast.error(\n tr(\"admin.userDetail.loadError\", { default: \"Failed to load user\" }),\n );\n console.error(err);\n },\n },\n [userClient, userId, props.userRealmName],\n );\n const user = userQuery.data;\n\n const rolesQuery = useQuery(\n {\n handler: ({ signal }) =>\n userClient.findRoles(\n { query: { userRealmName: props.userRealmName } },\n { request: { signal } },\n ),\n // Role metadata is non-blocking — swallow errors so the page still loads.\n onError: () => {},\n },\n [userClient, props.userRealmName],\n );\n const availableRoles = rolesQuery.data ?? [];\n\n const identitiesQuery = useQuery(\n {\n // Same gate: this one sends `userId` as a filter, so an empty one asks\n // for every identity in the realm rather than failing.\n enabled: hasUserId,\n handler: ({ signal }) =>\n identityClient.findIdentities(\n { query: { userId, size: 100, userRealmName: props.userRealmName } },\n { request: { signal } },\n ),\n // Identities may fail if the controller isn't mounted — non-blocking.\n onError: () => {},\n },\n [identityClient, userId, props.userRealmName],\n );\n const identities = identitiesQuery.data?.content ?? [];\n\n const realmQuery = useQuery(\n {\n // The realm config query param is `realmName`; the admin endpoints\n // spell the same thing `userRealmName`.\n handler: ({ signal }) =>\n realmClient.getRealmConfig(\n { query: { realmName: props.userRealmName } },\n { request: { signal } },\n ),\n // Realm settings only shape which profile fields are offered — a\n // failure must not block the page. `profilePolicy` degrades to\n // \"everything optional\" without them.\n onError: () => {},\n },\n [realmClient, props.userRealmName],\n );\n\n // What the realm collects decides what this form offers and demands.\n // Hardcoding \"email is required\" here made every save fail — a role change\n // included — on a realm that signs users in by username alone.\n const policy = profilePolicy(realmQuery.data?.settings, user);\n\n // -- Profile form ---------------------------------------------------------\n\n const issueMessage = (issue: ProfileIssue): string => {\n if (issue.field === \"username\") {\n return issue.reason === \"required\"\n ? tr(\"admin.userDetail.usernameRequired\", {\n default: \"Username is required\",\n })\n : tr(\"admin.userDetail.usernameCannotBeCleared\", {\n default: \"Username cannot be removed once set\",\n });\n }\n return issue.reason === \"required\"\n ? tr(\"admin.userDetail.emailRequired\", {\n default: \"Email is required\",\n })\n : tr(\"admin.userDetail.emailCannotBeCleared\", {\n default: \"Email cannot be removed once set\",\n });\n };\n\n const form = useForm({\n schema: profileSchema,\n initialValues: {\n username: user?.username ?? \"\",\n email: user?.email ?? \"\",\n firstName: user?.firstName ?? \"\",\n lastName: user?.lastName ?? \"\",\n emailVerified: user?.emailVerified ?? false,\n roles: user?.roles ?? [],\n },\n handler: async (values: ProfileForm) => {\n // Field guards live in the handler, not in the schema, so useForm's\n // initial decode doesn't crash on the empty mount.\n const issue = profileIssues(values, policy, user)[0];\n if (issue) {\n throw new FormValidationError({\n message: issueMessage(issue),\n path: `/${issue.field}`,\n });\n }\n\n const body = profileUpdateBody(values, policy, user);\n\n try {\n await userClient.updateUser({\n params: { id: userId },\n query: { userRealmName: props.userRealmName },\n body,\n });\n toast.success(\n tr(\"admin.userDetail.saved\", { default: \"Profile saved\" }),\n );\n await userQuery.refetch();\n } catch (err) {\n // Throw, never toast. `ActionErrorToaster`, which `AppShell` mounts,\n // already turns an unhandled action error into exactly one toast, and\n // it reads `error.message` - the very string this used to pass to\n // `toast.error` for an `HttpError`. So a refused duplicate email\n // arrived twice, as two identical stacked toasts.\n //\n // What is left here is the other half of the job: making sure the\n // error carries a sentence worth showing. An `HttpError` already does\n // (it is the server's own wording, and \"Email already exists\" is\n // exactly what the operator needs to read), so it travels as-is.\n // Anything else is transport or a bug, whose message - \"Failed to\n // fetch\" - says nothing about this form, so it gets replaced.\n //\n // Same division of labour as the auth forms in this package: the\n // handler throws, the toaster shows.\n throw err instanceof HttpError\n ? err\n : new AlephaError(\n tr(\"admin.userDetail.saveError\", {\n default: \"Failed to save profile\",\n }),\n { cause: err },\n );\n }\n },\n });\n\n // No `useEffect` re-seeding the form from `userQuery.data` here: the same\n // object is already `useForm`'s `initialValues` above, and `useForm` re-seeds\n // itself when it changes - keeping the fields the user has edited, which the\n // hand-rolled effect could not do. It re-seeded wholesale, so anything typed\n // between pressing Save and the refetch landing was overwritten by data that\n // predates it.\n\n // -- Set password ---------------------------------------------------------\n\n const passwordForm = useForm({\n schema: passwordSchema,\n handler: async ({ password }) => {\n await userClient.setUserPassword({\n params: { id: userId },\n query: { userRealmName: props.userRealmName },\n body: { password },\n });\n toast.success(\n tr(\"admin.userDetail.passwordSet\", {\n default: \"Password updated\",\n }),\n );\n passwordForm.input.password.set?.(\"\");\n setPasswordOpen(false);\n },\n });\n const { loading: passwordSubmitting } = useFormState(passwordForm, [\n \"loading\",\n ]);\n\n // -- Enable/disable -------------------------------------------------------\n\n const toggleEnabled = useAction(\n {\n handler: async () => {\n if (!user || isSelf) return;\n const enable = !user.enabled;\n const label =\n user.email ||\n user.username ||\n tr(\"admin.userDetail.thisUser\", {\n default: \"this user\",\n });\n const ok = await dialog.confirm({\n title: enable\n ? tr(\"admin.userDetail.enableTitle\", { default: \"Enable user\" })\n : tr(\"admin.userDetail.disableTitle\", { default: \"Disable user\" }),\n description: enable\n ? tr(\"admin.userDetail.enableConfirm\", {\n default: `Enable ${label}?`,\n args: [String(label)],\n })\n : tr(\"admin.userDetail.disableConfirm\", {\n default: `Disable ${label}? They will no longer be able to sign in.`,\n args: [String(label)],\n }),\n destructive: !enable,\n });\n if (!ok) return;\n await userClient.updateUser({\n params: { id: userId },\n query: { userRealmName: props.userRealmName },\n body: { enabled: enable },\n });\n await userQuery.refetch();\n toast.success(\n enable\n ? tr(\"admin.userDetail.enabled\", { default: \"User enabled\" })\n : tr(\"admin.userDetail.disabled\", { default: \"User disabled\" }),\n );\n },\n },\n [user, isSelf],\n );\n\n // -- Delete ---------------------------------------------------------------\n\n const deleteUser = useAction(\n {\n handler: async () => {\n if (!user || isSelf) return;\n const label =\n user.email ||\n user.username ||\n tr(\"admin.userDetail.thisUser\", {\n default: \"this user\",\n });\n const ok = await dialog.confirm({\n title: tr(\"admin.userDetail.deleteTitle\", { default: \"Delete user\" }),\n description: tr(\"admin.userDetail.deleteConfirm\", {\n default: `Permanently delete ${label}? This action cannot be undone.`,\n args: [String(label)],\n }),\n destructive: true,\n confirmLabel: String(\n tr(\"admin.userDetail.deleteCta\", { default: \"Delete\" }),\n ),\n });\n if (!ok) return;\n await userClient.deleteUser({\n params: { id: userId },\n query: { userRealmName: props.userRealmName },\n });\n toast.success(\n tr(\"admin.userDetail.deleted\", { default: \"User deleted\" }),\n );\n await router.push(backPath);\n },\n },\n [user, isSelf],\n );\n\n // -- Remove social auth ---------------------------------------------------\n\n const removeIdentity = useAction<[IdentityResource]>(\n {\n handler: async (identity) => {\n const provider =\n PROVIDER_LABELS[identity.provider] ?? identity.provider;\n const ok = await dialog.confirm({\n title: tr(\"admin.userDetail.removeIdentityTitle\", {\n default: \"Remove connection\",\n }),\n description: tr(\"admin.userDetail.removeIdentityConfirm\", {\n default: `Remove the ${provider} connection? The user will no longer be able to sign in with it.`,\n args: [provider],\n }),\n destructive: true,\n });\n if (!ok) return;\n await identityClient.deleteIdentity({\n params: { id: identity.id },\n query: { userRealmName: props.userRealmName },\n });\n toast.success(\n tr(\"admin.userDetail.identityRemoved\", {\n default: \"Connection removed\",\n }),\n );\n await identitiesQuery.refetch();\n },\n },\n [props.userRealmName],\n );\n\n // -- Clear the second factor ----------------------------------------------\n\n /*\n * Same endpoint as `removeIdentity`: a TOTP enrollment is an identity row,\n * and `admin:identity:delete` already means \"can take away a way into this\n * account\". What differs is what the operator is told: this does not remove\n * a sign-in method, it removes the check that sits after one, so the wording\n * of `removeIdentity` would be actively wrong here.\n *\n * It is also the single action an attacker holding an admin session wants\n * most, which is why it confirms rather than firing on one click.\n */\n const clearTotp = useAction<[IdentityResource]>(\n {\n handler: async (identity) => {\n // Named, the same way `toggleEnabled` and `remove` name theirs. An\n // admin can have several user pages open, and this is the one action\n // whose confirmation must leave no doubt about whose account it is.\n const label =\n user?.email ||\n user?.username ||\n tr(\"admin.userDetail.thisUser\", { default: \"this user\" });\n const ok = await dialog.confirm({\n title: tr(\"admin.userDetail.clearTotpTitle\", {\n default: \"Clear second factor\",\n }),\n description: tr(\"admin.userDetail.clearTotpConfirm\", {\n default: `${label} will sign in with their password alone until they enroll an authenticator app again. Do this only when they have lost both the device and their recovery codes.`,\n args: [String(label)],\n }),\n destructive: true,\n });\n if (!ok) return;\n await identityClient.deleteIdentity({\n params: { id: identity.id },\n query: { userRealmName: props.userRealmName },\n });\n toast.success(\n tr(\"admin.userDetail.totpCleared\", {\n default: \"Second factor cleared\",\n }),\n );\n await identitiesQuery.refetch();\n },\n },\n [props.userRealmName],\n );\n\n // -- Sessions / audits fetchers -------------------------------------------\n\n const sessionsFetcher = useCallback(\n (params: { page: number; size: number; sort?: string }) =>\n sessionClient.findSessions({\n query: { ...params, userId, userRealmName: props.userRealmName },\n }),\n [sessionClient, userId, props.userRealmName],\n );\n\n const auditsFetcher = useCallback(\n (params: { page: number; size: number; sort?: string }) =>\n auditClient.findByUser({ params: { userId }, query: params }),\n [auditClient, userId],\n );\n\n const revokeSession = useAction<[SessionResource, () => void]>(\n {\n handler: async (s, refresh) => {\n const ok = await dialog.confirm({\n title: tr(\"admin.userDetail.revokeTitle\", {\n default: \"Revoke session\",\n }),\n description: tr(\"admin.userDetail.revokeConfirm\", {\n default:\n \"Revoke this session? The user will be signed out on the matching device.\",\n }),\n destructive: true,\n });\n if (!ok) return;\n await sessionClient.deleteSession({\n params: { id: s.id },\n query: { userRealmName: props.userRealmName },\n });\n refresh();\n },\n },\n [props.userRealmName],\n );\n\n const bulkRevokeSessions = useAction<\n [SessionResource[], { refresh: () => void; clearSelection: () => void }]\n >(\n {\n handler: async (items, ctx) => {\n const ok = await dialog.confirm({\n title: tr(\"admin.userDetail.bulkRevokeTitle\", {\n default: \"Revoke sessions\",\n }),\n description: tr(\"admin.userDetail.bulkRevokeConfirm\", {\n default: `Revoke ${items.length} sessions?`,\n args: [String(items.length)],\n }),\n destructive: true,\n });\n if (!ok) return;\n await sessionClient.deleteSessions({\n query: { userRealmName: props.userRealmName },\n body: { ids: items.map((s) => s.id) },\n });\n ctx.clearSelection();\n ctx.refresh();\n },\n },\n [props.userRealmName],\n );\n\n // -- Render ---------------------------------------------------------------\n\n // A `credentials` identity means a password is set. Password sign-in lives\n // in its own card; the social providers are everything else.\n const hasPassword = identities.some((id) => id.provider === \"credentials\");\n const socialIdentities = identities.filter(\n (id) => id.provider !== \"credentials\",\n );\n\n const tabs: DetailTab[] = [\n {\n value: \"overview\",\n icon: User,\n label: tr(\"admin.userDetail.tabOverview\", { default: \"Overview\" }),\n },\n {\n value: \"security\",\n icon: ShieldCheck,\n label: tr(\"admin.userDetail.tabSecurity\", { default: \"Security\" }),\n },\n {\n value: \"sessions\",\n icon: Monitor,\n label: tr(\"admin.userDetail.tabSessions\", { default: \"Sessions\" }),\n },\n {\n value: \"audits\",\n icon: History,\n label: tr(\"admin.userDetail.tabAudits\", { default: \"Audit log\" }),\n },\n ];\n\n return (\n <>\n <DetailLayout\n loading={userQuery.loading && !user}\n notFound={\n user\n ? undefined\n : {\n message: String(\n tr(\"admin.userDetail.notFound\", {\n default: \"User not found.\",\n }),\n ),\n backLabel: String(\n tr(\"admin.userDetail.back\", { default: \"Back to users\" }),\n ),\n onBack: () => void router.push(backPath),\n }\n }\n aside={\n user ? (\n <div className=\"flex flex-col gap-3\">\n <AdminUserDetailIdentityAside user={user} />\n {/* Under the aside rather than inside it: `DetailAside` renders\n rows of facts, and this is an action on the picture above\n it. It hides itself when the realm has avatars off - the\n endpoint is unregistered there, so `can()` is false. */}\n <AdminUserAvatarControl\n user={user}\n onChanged={() => void userQuery.refetch()}\n />\n </div>\n ) : null\n }\n tabs={tabs}\n tab={tab}\n onTabChange={(v) => setTab(v as TabKey)}\n actions={\n <>\n <Button\n variant=\"outline\"\n size=\"lg\"\n loading={toggleEnabled.loading}\n disabled={isSelf}\n onClick={() => toggleEnabled.run()}\n >\n {user?.enabled ? (\n <>\n <UserX className=\"size-4\" />\n {tr(\"admin.userDetail.disable\", { default: \"Disable\" })}\n </>\n ) : (\n <>\n <UserCheck className=\"size-4\" />\n {tr(\"admin.userDetail.enable\", { default: \"Enable\" })}\n </>\n )}\n </Button>\n <Button\n variant=\"destructive\"\n size=\"lg\"\n loading={deleteUser.loading}\n disabled={isSelf}\n onClick={() => deleteUser.run()}\n >\n <Trash2 className=\"size-4\" />\n {tr(\"admin.userDetail.delete\", { default: \"Delete user\" })}\n </Button>\n </>\n }\n >\n {tab === \"overview\" && (\n <AdminUserDetailOverviewTab\n form={form}\n availableRoles={availableRoles}\n policy={policy}\n />\n )}\n\n {tab === \"security\" && (\n <AdminUserDetailSecurityTab\n hasPassword={hasPassword}\n socialIdentities={socialIdentities}\n removeIdentity={removeIdentity}\n clearTotp={clearTotp}\n onChangePassword={() => setPasswordOpen(true)}\n />\n )}\n\n {tab === \"sessions\" && (\n <AdminUserDetailSessionsTab\n userId={userId}\n fetch={sessionsFetcher}\n revokeSession={revokeSession}\n bulkRevokeSessions={bulkRevokeSessions}\n />\n )}\n\n {tab === \"audits\" && (\n <AdminUserDetailAuditsTab userId={userId} fetch={auditsFetcher} />\n )}\n </DetailLayout>\n\n <AdminUserDetailPasswordDialog\n open={passwordOpen}\n onOpenChange={setPasswordOpen}\n form={passwordForm}\n submitting={passwordSubmitting}\n />\n </>\n );\n};\n\nexport default AdminUserDetail;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsFA,MAAa,uBAAuB,WAGtB,OAAO,OAAO,UAAU,OAAO,MAAM,EAAE;;;;;;;;AASrD,MAAa,mBAAmB,UAAgC;CAC9D,MAAM,SAAS,UAAU;CACzB,MAAM,cAAc,eAAe;CACnC,MAAM,SAAS,oBAAoB,YAAY,MAAM;CACrD,MAAM,aAAa,UAA+B;CAClD,MAAM,gBAAgB,UAAkC;CACxD,MAAM,iBAAiB,UAAmC;CAC1D,MAAM,cAAc,UAAgC;CACpD,MAAM,cAAc,UAA2B;CAC/C,MAAM,EAAE,OAAO,QAAQ;CACvB,MAAM,QAAQ,SAAS;CACvB,MAAM,EAAE,MAAM,gBAAgB,QAAQ;CACtC,MAAM,SAAS,UAAU;CAEzB,MAAM,CAAC,cAAc,mBAAmB,SAAS,KAAK;CACtD,MAAM,CAAC,KAAK,UAAU,aAAqB,UAAU;CAErD,MAAM,SAAS,aAAa,OAAO;CACnC,MAAM,WAAW,MAAM,YAAY;CAsBnC,MAAM,YAAY,WAAW;CAE7B,MAAM,YAAY,SAChB;EACE,SAAS;EACT,UAAU,EAAE,aACV,WAAW,QACT;GACE,QAAQ,EAAE,IAAI,OAAO;GACrB,OAAO,EAAE,eAAe,MAAM,cAAc;EAC9C,GACA,EAAE,SAAS,EAAE,OAAO,EAAE,CACxB;EACF,UAAU,QAAQ;GAChB,MAAM,MACJ,GAAG,8BAA8B,EAAE,SAAS,sBAAsB,CAAC,CACrE;GACA,QAAQ,MAAM,GAAG;EACnB;CACF,GACA;EAAC;EAAY;EAAQ,MAAM;CAAa,CAC1C;CACA,MAAM,OAAO,UAAU;CAcvB,MAAM,iBAZ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SAAS,CAAC,CACpD,EAAA,CAAA;EAEE,CAAA,GACR,qBAAC,QAAD;GACE,SAAQ;GACR,MAAK;GACL,SAAS,WAAW;GACpB,UAAU;GACV,eAAe,WAAW,IAAI;GALhC,UAAA,CAOE,oBAAC,QAAD,EAAQ,WAAU,SAAU,CAAA,GAC3B,GAAG,2BAA2B,EAAE,SAAS,cAAc,CAAC,CACnD;EACR,CAAA,CAAA,EAAA,CAAA;EAlEN,UAAA;GAqEG,QAAQ,cACP,oBAAC,4BAAD;IACQ;IACU;IACR;GACT,CAAA;GAGF,QAAQ,cACP,oBAAC,4BAAD;IACe;IACK;IACF;IACL;IACX,wBAAwB,gBAAgB,IAAI;GAC7C,CAAA;GAGF,QAAQ,cACP,oBAAC,4BAAD;IACU;IACR,OAAO;IACQ;IACK;GACrB,CAAA;GAGF,QAAQ,YACP,oBAAC,0BAAD;IAAkC;IAAQ,OAAO;GAAgB,CAAA;EAEvD;CAEd,CAAA,GAAA,oBAAC,+BAAD;EACE,MAAM;EACN,cAAc;EACd,MAAM;EACN,YAAY;CACb,CAAA,CACD,EAAA,CAAA;AAEN"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin-users-roles-picker.d.ts","sourceRoot":"","sources":["../../../src/components/admin/admin-users-roles-picker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAU/B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAGnD,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,0BAA0B;IACzC,IAAI,EAAE,UAAU,CAAC;IACjB;;;OAGG;IACH,cAAc,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC;IACxC;;;;OAIG;IACH,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7C,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,eAAO,MAAM,qBAAqB,UAAW,0BAA0B,
|
|
1
|
+
{"version":3,"file":"admin-users-roles-picker.d.ts","sourceRoot":"","sources":["../../../src/components/admin/admin-users-roles-picker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAU/B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAGnD,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,0BAA0B;IACzC,IAAI,EAAE,UAAU,CAAC;IACjB;;;OAGG;IACH,cAAc,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC;IACxC;;;;OAIG;IACH,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7C,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,eAAO,MAAM,qBAAqB,UAAW,0BAA0B,sBAiGtE,CAAC"}
|