@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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin-notifications-channel-label.js","names":[],"sources":["../../../src/components/admin/admin-notifications-channel-label.ts"],"sourcesContent":["/**\n * A channel name as a reader should see it: `email` becomes \"Email\",\n * `discord` becomes \"Discord\", `sms` becomes \"SMS\".\n *\n * The acronym list is the whole reason this is not a plain title-caser:\n * humanizing `sms` gives \"Sms\", which is what a filter dropdown offering\n * \"Email\" beside \"Sms\" looks like. Everything else gets the generic\n * treatment, which is right for a word and is the best a list that has never\n * heard of the plugin can do.\n *\n * Display only. The value sent to the API is always the raw channel name.\n */\nexport const notificationChannelLabel = (channel: string): string => {\n const known: Record<string, string> = { sms: \"SMS\", mqtt: \"MQTT\" };\n const raw = channel.trim();\n if (!raw) return channel;\n return known[raw.toLowerCase()] ?? raw.charAt(0).toUpperCase() + raw.slice(1);\n};\n"],"mappings":";;;;;;;;;;;;;AAYA,MAAa,4BAA4B,YAA4B;CACnE,MAAM,QAAgC;EAAE,KAAK;EAAO,MAAM;CAAO;CACjE,MAAM,MAAM,QAAQ,KAAK;CACzB,IAAI,CAAC,KAAK,OAAO;CACjB,OAAO,MAAM,IAAI,YAAY,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC,YAAY,IAAI,IAAI,MAAM,CAAC;AAC9E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin-notifications-preview-body.d.ts","sourceRoot":"","sources":["../../../src/components/admin/admin-notifications-preview-body.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AAG5E,MAAM,WAAW,kCAAkC;IACjD,OAAO,EAAE,2BAA2B,CAAC;CACtC;AAED;;;;;;GAMG;AACH,eAAO,MAAM,6BAA6B,UACjC,kCAAkC,
|
|
1
|
+
{"version":3,"file":"admin-notifications-preview-body.d.ts","sourceRoot":"","sources":["../../../src/components/admin/admin-notifications-preview-body.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AAG5E,MAAM,WAAW,kCAAkC;IACjD,OAAO,EAAE,2BAA2B,CAAC;CACtC;AAED;;;;;;GAMG;AACH,eAAO,MAAM,6BAA6B,UACjC,kCAAkC,gCA2F1C,CAAC"}
|
|
@@ -13,17 +13,27 @@ import { useI18n } from "alepha/react/i18n";
|
|
|
13
13
|
const AdminNotificationsPreviewBody = (props) => {
|
|
14
14
|
const { tr } = useI18n();
|
|
15
15
|
const preview = props.preview;
|
|
16
|
-
if (!preview.available)
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
16
|
+
if (!preview.available) {
|
|
17
|
+
/**
|
|
18
|
+
* Three separate sentences, deliberately. All three are normal, and an
|
|
19
|
+
* operator has to be able to tell retention (nothing to do) from a
|
|
20
|
+
* sensitive template (nothing will ever be shown) from a deleted
|
|
21
|
+
* template (someone changed the code). One shared "unavailable" would
|
|
22
|
+
* make all three look like a bug.
|
|
23
|
+
*/
|
|
24
|
+
const reasons = {
|
|
25
|
+
"outbox-purged": tr("admin.notifications.previewPurged", { default: "The job record holding this message's variables has passed its retention window, so it can no longer be rendered. The receipt is kept for longer." }),
|
|
26
|
+
sensitive: tr("admin.notifications.previewSensitive", { default: "This template is marked sensitive, so its rendered content is never shown in the admin." }),
|
|
27
|
+
"template-missing": tr("admin.notifications.previewTemplateMissing", { default: "The template that produced this message is no longer registered in the app, so there is nothing left to render it with." })
|
|
28
|
+
};
|
|
29
|
+
return /* @__PURE__ */ jsx("div", {
|
|
30
|
+
className: "px-4 pb-6",
|
|
31
|
+
children: /* @__PURE__ */ jsx("p", {
|
|
32
|
+
className: "text-muted-foreground text-sm",
|
|
33
|
+
children: reasons[preview.reason ?? ""] ?? tr("admin.notifications.previewUnavailable", { default: "This message cannot be previewed." })
|
|
34
|
+
})
|
|
35
|
+
});
|
|
36
|
+
}
|
|
27
37
|
return /* @__PURE__ */ jsxs("div", {
|
|
28
38
|
className: "flex min-h-0 flex-1 flex-col gap-4 px-4 pb-6",
|
|
29
39
|
children: [
|
|
@@ -50,10 +60,10 @@ const AdminNotificationsPreviewBody = (props) => {
|
|
|
50
60
|
}) : null,
|
|
51
61
|
preview.channel === "email" ? /* @__PURE__ */ jsx("div", {
|
|
52
62
|
className: "min-h-96 flex-1 overflow-hidden rounded border",
|
|
53
|
-
children: /* @__PURE__ */ jsx(EmailBodyFrame, { html: preview.
|
|
63
|
+
children: /* @__PURE__ */ jsx(EmailBodyFrame, { html: preview.body ?? "" })
|
|
54
64
|
}) : /* @__PURE__ */ jsx("div", {
|
|
55
65
|
className: "bg-muted rounded p-3 text-sm whitespace-pre-wrap",
|
|
56
|
-
children: preview.
|
|
66
|
+
children: preview.body
|
|
57
67
|
})
|
|
58
68
|
]
|
|
59
69
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin-notifications-preview-body.js","names":[],"sources":["../../../src/components/admin/admin-notifications-preview-body.tsx"],"sourcesContent":["import { EmailBodyFrame } from \"@alepha/ui/components/email-body-frame/email-body-frame\";\nimport { Badge } from \"@alepha/ui/components/ui/badge\";\nimport type { NotificationPreviewResource } from \"alepha/api/notifications\";\nimport { useI18n } from \"alepha/react/i18n\";\n\nexport interface AdminNotificationsPreviewBodyProps {\n preview: NotificationPreviewResource;\n}\n\n/**\n * What a preview looks like, given one already fetched.\n *\n * Split from the tab that fetches it so the interesting half - three\n * unavailable states that must not read alike - can be rendered in a test\n * without a container or a client.\n */\nexport const AdminNotificationsPreviewBody = (\n props: AdminNotificationsPreviewBodyProps,\n) => {\n const { tr } = useI18n();\n const preview = props.preview;\n\n if (!preview.available) {\n /**\n * Three separate sentences, deliberately. All three are normal, and an\n * operator has to be able to tell retention (nothing to do) from a\n * sensitive template (nothing will ever be shown) from a deleted\n * template (someone changed the code). One shared \"unavailable\" would\n * make all three look like a bug.\n */\n const reasons: Record<string, string> = {\n \"outbox-purged\": tr(\"admin.notifications.previewPurged\", {\n default:\n \"The job record holding this message's variables has passed its retention window, so it can no longer be rendered. The receipt is kept for longer.\",\n }),\n sensitive: tr(\"admin.notifications.previewSensitive\", {\n default:\n \"This template is marked sensitive, so its rendered content is never shown in the admin.\",\n }),\n \"template-missing\": tr(\"admin.notifications.previewTemplateMissing\", {\n default:\n \"The template that produced this message is no longer registered in the app, so there is nothing left to render it with.\",\n }),\n };\n\n return (\n <div className=\"px-4 pb-6\">\n <p className=\"text-muted-foreground text-sm\">\n {reasons[preview.reason ?? \"\"] ??\n tr(\"admin.notifications.previewUnavailable\", {\n default: \"This message cannot be previewed.\",\n })}\n </p>\n </div>\n );\n }\n\n return (\n <div className=\"flex min-h-0 flex-1 flex-col gap-4 px-4 pb-6\">\n <p className=\"text-muted-foreground text-xs\">\n {tr(\"admin.notifications.previewLive\", {\n default:\n \"Re-rendered from the template as it exists now. If the template changed since the send, this differs from what was delivered.\",\n })}\n </p>\n\n {preview.subject ? (\n <div>\n <div className=\"text-muted-foreground text-xs\">\n {tr(\"admin.notifications.detailSubject\", { default: \"Subject\" })}\n </div>\n <div className=\"text-sm\">{preview.subject}</div>\n </div>\n ) : null}\n\n {preview.attachments.length > 0 ? (\n <div className=\"flex flex-wrap items-center gap-2\">\n <span className=\"text-muted-foreground text-xs\">\n {tr(\"admin.notifications.previewAttachments\", {\n default: \"Attachments\",\n })}\n </span>\n {/* Names only. The bytes are never resolved for a preview, so a\n purged file cannot break the render. */}\n {preview.attachments.map((attachment) => (\n <Badge key={attachment} variant=\"secondary\">\n {attachment}\n </Badge>\n ))}\n </div>\n ) : null}\n\n {preview.channel === \"email\" ? (\n <div className=\"min-h-96 flex-1 overflow-hidden rounded border\">\n <EmailBodyFrame html={preview.
|
|
1
|
+
{"version":3,"file":"admin-notifications-preview-body.js","names":[],"sources":["../../../src/components/admin/admin-notifications-preview-body.tsx"],"sourcesContent":["import { EmailBodyFrame } from \"@alepha/ui/components/email-body-frame/email-body-frame\";\nimport { Badge } from \"@alepha/ui/components/ui/badge\";\nimport type { NotificationPreviewResource } from \"alepha/api/notifications\";\nimport { useI18n } from \"alepha/react/i18n\";\n\nexport interface AdminNotificationsPreviewBodyProps {\n preview: NotificationPreviewResource;\n}\n\n/**\n * What a preview looks like, given one already fetched.\n *\n * Split from the tab that fetches it so the interesting half - three\n * unavailable states that must not read alike - can be rendered in a test\n * without a container or a client.\n */\nexport const AdminNotificationsPreviewBody = (\n props: AdminNotificationsPreviewBodyProps,\n) => {\n const { tr } = useI18n();\n const preview = props.preview;\n\n if (!preview.available) {\n /**\n * Three separate sentences, deliberately. All three are normal, and an\n * operator has to be able to tell retention (nothing to do) from a\n * sensitive template (nothing will ever be shown) from a deleted\n * template (someone changed the code). One shared \"unavailable\" would\n * make all three look like a bug.\n */\n const reasons: Record<string, string> = {\n \"outbox-purged\": tr(\"admin.notifications.previewPurged\", {\n default:\n \"The job record holding this message's variables has passed its retention window, so it can no longer be rendered. The receipt is kept for longer.\",\n }),\n sensitive: tr(\"admin.notifications.previewSensitive\", {\n default:\n \"This template is marked sensitive, so its rendered content is never shown in the admin.\",\n }),\n \"template-missing\": tr(\"admin.notifications.previewTemplateMissing\", {\n default:\n \"The template that produced this message is no longer registered in the app, so there is nothing left to render it with.\",\n }),\n };\n\n return (\n <div className=\"px-4 pb-6\">\n <p className=\"text-muted-foreground text-sm\">\n {reasons[preview.reason ?? \"\"] ??\n tr(\"admin.notifications.previewUnavailable\", {\n default: \"This message cannot be previewed.\",\n })}\n </p>\n </div>\n );\n }\n\n return (\n <div className=\"flex min-h-0 flex-1 flex-col gap-4 px-4 pb-6\">\n <p className=\"text-muted-foreground text-xs\">\n {tr(\"admin.notifications.previewLive\", {\n default:\n \"Re-rendered from the template as it exists now. If the template changed since the send, this differs from what was delivered.\",\n })}\n </p>\n\n {preview.subject ? (\n <div>\n <div className=\"text-muted-foreground text-xs\">\n {tr(\"admin.notifications.detailSubject\", { default: \"Subject\" })}\n </div>\n <div className=\"text-sm\">{preview.subject}</div>\n </div>\n ) : null}\n\n {preview.attachments.length > 0 ? (\n <div className=\"flex flex-wrap items-center gap-2\">\n <span className=\"text-muted-foreground text-xs\">\n {tr(\"admin.notifications.previewAttachments\", {\n default: \"Attachments\",\n })}\n </span>\n {/* Names only. The bytes are never resolved for a preview, so a\n purged file cannot break the render. */}\n {preview.attachments.map((attachment) => (\n <Badge key={attachment} variant=\"secondary\">\n {attachment}\n </Badge>\n ))}\n </div>\n ) : null}\n\n {/* One flat body, and one question about it: is it HTML? Email is the\n only channel whose body is a document, so it is the only one that\n gets the sandboxed frame. Everything else - sms today, a chat sink\n tomorrow - is text and renders as text, with no per-channel branch\n to add. */}\n {preview.channel === \"email\" ? (\n <div className=\"min-h-96 flex-1 overflow-hidden rounded border\">\n <EmailBodyFrame html={preview.body ?? \"\"} />\n </div>\n ) : (\n <div className=\"bg-muted rounded p-3 text-sm whitespace-pre-wrap\">\n {preview.body}\n </div>\n )}\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;AAgBA,MAAa,iCACX,UACG;CACH,MAAM,EAAE,OAAO,QAAQ;CACvB,MAAM,UAAU,MAAM;CAEtB,IAAI,CAAC,QAAQ,WAAW;;;;;;;;EAQtB,MAAM,UAAkC;GACtC,iBAAiB,GAAG,qCAAqC,EACvD,SACE,oJACJ,CAAC;GACD,WAAW,GAAG,wCAAwC,EACpD,SACE,0FACJ,CAAC;GACD,oBAAoB,GAAG,8CAA8C,EACnE,SACE,0HACJ,CAAC;EACH;EAEA,OACE,oBAAC,OAAD;GAAK,WAAU;GACb,UAAA,oBAAC,KAAD;IAAG,WAAU;IACV,UAAA,QAAQ,QAAQ,UAAU,OACzB,GAAG,0CAA0C,EAC3C,SAAS,oCACX,CAAC;GACF,CAAA;EACA,CAAA;CAET;CAEA,OACE,qBAAC,OAAD;EAAK,WAAU;EAAf,UAAA;GACE,oBAAC,KAAD;IAAG,WAAU;IACV,UAAA,GAAG,mCAAmC,EACrC,SACE,gIACJ,CAAC;GACA,CAAA;GAEF,QAAQ,UACP,qBAAC,OAAD,EAAA,UAAA,CACE,oBAAC,OAAD;IAAK,WAAU;IACZ,UAAA,GAAG,qCAAqC,EAAE,SAAS,UAAU,CAAC;GAC5D,CAAA,GACL,oBAAC,OAAD;IAAK,WAAU;IAAW,UAAA,QAAQ;GAAa,CAAA,CAC5C,EAAA,CAAA,IACH;GAEH,QAAQ,YAAY,SAAS,IAC5B,qBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACE,oBAAC,QAAD;KAAM,WAAU;KACb,UAAA,GAAG,0CAA0C,EAC5C,SAAS,cACX,CAAC;IACG,CAAA,GAGL,QAAQ,YAAY,KAAK,eACxB,oBAAC,OAAD;KAAwB,SAAQ;KAC7B,UAAA;IACI,GAFK,UAEL,CACR,CACE;GACH,CAAA,IAAA;GAOH,QAAQ,YAAY,UACnB,oBAAC,OAAD;IAAK,WAAU;IACb,UAAA,oBAAC,gBAAD,EAAgB,MAAM,QAAQ,QAAQ,GAAK,CAAA;GACxC,CAAA,IAEL,oBAAC,OAAD;IAAK,WAAU;IACZ,UAAA,QAAQ;GACN,CAAA;EAEJ;;AAET"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin-notifications.d.ts","sourceRoot":"","sources":["../../../src/components/admin/admin-notifications.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"admin-notifications.d.ts","sourceRoot":"","sources":["../../../src/components/admin/admin-notifications.tsx"],"names":[],"mappings":"AAuCA;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,kBAAkB,mCAsc9B,CAAC;eAEa,kBAAkB"}
|
|
@@ -2,9 +2,11 @@ import { useToast } from "../use-toast/use-toast.js";
|
|
|
2
2
|
import { Control } from "../control/control.js";
|
|
3
3
|
import { Badge } from "../ui/badge.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";
|
|
9
|
+
import { notificationChannelLabel } from "./admin-notifications-channel-label.js";
|
|
8
10
|
import { useNotificationStatusLabels } from "./admin-notifications-status-labels.js";
|
|
9
11
|
import { NOTIFICATION_STATUSES } from "./admin-notifications-status-tones.js";
|
|
10
12
|
import { AdminNotificationsStatusBadge } from "./admin-notifications-status-badge.js";
|
|
@@ -35,7 +37,7 @@ const AdminNotifications = () => {
|
|
|
35
37
|
const userClient = useClient();
|
|
36
38
|
const toast = useToast();
|
|
37
39
|
const router = useRouter();
|
|
38
|
-
const {
|
|
40
|
+
const { tr } = useI18n();
|
|
39
41
|
const statusLabels = useNotificationStatusLabels();
|
|
40
42
|
const [selected, setSelected] = useState(null);
|
|
41
43
|
/**
|
|
@@ -163,7 +165,7 @@ const AdminNotifications = () => {
|
|
|
163
165
|
schema: z.object({
|
|
164
166
|
search: z.text().optional(),
|
|
165
167
|
status: z.enum(NOTIFICATION_STATUSES).optional(),
|
|
166
|
-
channel: z.
|
|
168
|
+
channel: z.text().optional(),
|
|
167
169
|
template: z.text().optional()
|
|
168
170
|
}),
|
|
169
171
|
render: (form) => /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
@@ -202,13 +204,10 @@ const AdminNotifications = () => {
|
|
|
202
204
|
icon: Radio,
|
|
203
205
|
clearLabel: tr("admin.notifications.allChannels", { default: "All channels" }),
|
|
204
206
|
triggerClassName: "w-full",
|
|
205
|
-
items: [{
|
|
206
|
-
label:
|
|
207
|
-
value:
|
|
208
|
-
},
|
|
209
|
-
label: "SMS",
|
|
210
|
-
value: "sms"
|
|
211
|
-
}],
|
|
207
|
+
items: [...new Set((templates ?? []).flatMap((t) => t.channels))].map((channel) => ({
|
|
208
|
+
label: notificationChannelLabel(channel),
|
|
209
|
+
value: channel
|
|
210
|
+
})),
|
|
212
211
|
inputProps: { "aria-label": tr("admin.notifications.colChannel", { default: "Channel" }) }
|
|
213
212
|
})
|
|
214
213
|
}),
|
|
@@ -276,9 +275,9 @@ const AdminNotifications = () => {
|
|
|
276
275
|
createdAt: {
|
|
277
276
|
label: tr("admin.notifications.colWhen", { default: "When" }),
|
|
278
277
|
sortable: true,
|
|
279
|
-
cell: (n) => /* @__PURE__ */ jsx(
|
|
280
|
-
|
|
281
|
-
|
|
278
|
+
cell: (n) => /* @__PURE__ */ jsx(TimeAgo, {
|
|
279
|
+
value: n.createdAt,
|
|
280
|
+
className: "text-muted-foreground text-xs"
|
|
282
281
|
})
|
|
283
282
|
},
|
|
284
283
|
contact: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin-notifications.js","names":[],"sources":["../../../src/components/admin/admin-notifications.tsx"],"sourcesContent":["import { AdminNotificationsDetail } from \"@alepha/ui/components/admin/admin-notifications-detail\";\nimport { AdminNotificationsStatusBadge } from \"@alepha/ui/components/admin/admin-notifications-status-badge\";\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 { Badge } from \"@alepha/ui/components/ui/badge\";\nimport { useToast } from \"@alepha/ui/components/use-toast/use-toast\";\nimport { z } from \"alepha\";\nimport type {\n AdminNotificationController,\n NotificationResource,\n NotificationTemplateResource,\n} from \"alepha/api/notifications\";\nimport type { AdminUserController } from \"alepha/api/users\";\nimport { useClient, useQuery } from \"alepha/react\";\nimport { useI18n } from \"alepha/react/i18n\";\nimport { useRouter } from \"alepha/react/router\";\nimport {\n Braces,\n CircleDot,\n FileText,\n Radio,\n Search,\n Send,\n Trash2,\n UserRound,\n} from \"lucide-react\";\nimport { useCallback, useState } from \"react\";\n\n// Relative, not through the `@alepha/ui/components/*` alias: that subpath\n// pattern maps to `.tsx`, so a plain `.ts` sibling only resolves this way.\nimport { useNotificationStatusLabels } from \"./admin-notifications-status-labels.ts\";\nimport { NOTIFICATION_STATUSES } from \"./admin-notifications-status-tones.ts\";\nimport { notificationTemplateLabel } from \"./admin-notifications-template-label.ts\";\n\n/**\n * What the app sent, what happened to it, and who it may not send to.\n *\n * ⚠️ **The list is the delivery receipts, not the job outbox.** Two tables\n * with two retention clocks cannot be paged as one. The consequence is that\n * notifications pushed before receipts existed have none and do not appear,\n * which the empty state says rather than hiding.\n *\n * No polling anywhere on this page: the table's own refresh is the way to\n * get fresh data. A polling effect keyed on an unstable object is what\n * burned 4k Worker invocations once already.\n */\nexport const AdminNotifications = () => {\n const client = useClient<AdminNotificationController>();\n const userClient = useClient<AdminUserController>();\n const toast = useToast();\n const router = useRouter();\n const { l, tr } = useI18n();\n const statusLabels = useNotificationStatusLabels();\n const [selected, setSelected] = useState<{ id: string; tab: string } | null>(\n null,\n );\n\n /**\n * Contacts resolved to user records, accumulated across pages.\n *\n * Keyed on the contact string because that is all a receipt carries: it\n * stores an email or a phone number and never a user id. Resolving happens\n * client-side because `api/notifications` may not import `api/users`.\n */\n const [usersByContact, setUsersByContact] = useState<\n Record<string, { id: string; email?: string; username?: string }>\n >({});\n\n /**\n * The catalogue this app can send, for the template and category filters.\n *\n * Falls back to an empty list on any failure, including a missing\n * permission: a filter that cannot offer its options should narrow to\n * nothing rather than break the page around it.\n */\n const { data: templates } = useQuery<NotificationTemplateResource[]>(\n {\n handler: ({ signal }) =>\n client.listNotificationTemplates.can()\n ? (client.listNotificationTemplates(\n {},\n { request: { signal } },\n ) as any)\n : Promise.resolve([]),\n onError: () => {},\n },\n [client],\n );\n\n /**\n * Resolve this page's email contacts to users, in ONE request.\n *\n * Per page and not per row: a 25-row page would otherwise be 25 requests.\n * Phone contacts are skipped outright, since they can never match an email\n * column. Every failure is swallowed: the column falls back to the raw\n * contact string, which is still the truth.\n */\n const resolveUsers = useCallback(\n (rows: NotificationResource[]) => {\n if (!userClient.findUsers.can()) return;\n const emails = [\n ...new Set(\n rows\n .filter((row) => row.type === \"email\" && row.contact)\n .map((row) => row.contact as string),\n ),\n ];\n if (emails.length === 0) return;\n\n userClient\n .findUsers({ query: { emails, size: Math.min(emails.length, 100) } })\n .then((page) => {\n setUsersByContact((previous) => ({\n ...previous,\n ...Object.fromEntries(\n page.content\n .filter((user) => user.email)\n .map((user) => [user.email as string, user]),\n ),\n }));\n })\n .catch(() => {});\n },\n [userClient],\n );\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 f = params.filters ?? {};\n const page = await client.findNotifications({\n query: {\n page: params.page,\n size: params.size,\n sort: params.sort,\n // Spread in, never assigned as undefined: the repository refuses an\n // undefined value in a where-filter.\n ...(f.search ? { search: f.search } : {}),\n ...(f.status ? { status: f.status } : {}),\n ...(f.channel ? { channel: f.channel } : {}),\n ...(f.template ? { template: f.template } : {}),\n } as any,\n });\n resolveUsers(page.content);\n return page;\n },\n [client, resolveUsers],\n );\n\n const bulkDelete = useConfirmedAction<\n [\n NotificationResource[],\n { clearSelection: () => void; refresh: () => void },\n ]\n >(\n {\n confirm: (items) => ({\n title: tr(\"admin.notifications.bulkDeleteTitle\", {\n default: \"Delete notifications\",\n }),\n description: tr(\"admin.notifications.bulkDeleteConfirm\", {\n default: `Delete ${items.length} notification record(s)? This cannot be undone.`,\n args: [String(items.length)],\n }),\n destructive: true,\n }),\n handler: async (items, ctx) => {\n if (items.length === 0) return;\n const res = await client.deleteNotifications({\n body: { ids: items.map((n) => n.id) },\n });\n toast.success(\n tr(\"admin.notifications.bulkDeleted\", {\n default: `${res.deleted.length} notification(s) deleted`,\n args: [String(res.deleted.length)],\n }),\n );\n ctx.clearSelection();\n ctx.refresh();\n },\n },\n [client, toast, tr],\n );\n\n const resend = useConfirmedAction<\n [NotificationResource, { refresh: () => void }]\n >(\n {\n confirm: (row) => ({\n title: tr(\"admin.notifications.resendTitle\", { default: \"Resend\" }),\n description: tr(\"admin.notifications.resendConfirm\", {\n default: `Send this notification to ${row.contact} again?`,\n args: [row.contact ?? \"\"],\n }),\n }),\n handler: async (row, ctx) => {\n await client.resendNotification({ params: { id: row.id } });\n // It goes back through the suppression gate, so \"queued\" is the\n // honest word: a suppressed contact will get a second `skipped`\n // receipt rather than a message.\n toast.success(\n tr(\"admin.notifications.resent\", {\n default: \"Queued. It passes the suppression gate again.\",\n }),\n );\n ctx.refresh();\n },\n },\n [client, toast, tr],\n );\n\n const remove = useConfirmedAction<\n [NotificationResource, { refresh: () => void }]\n >(\n {\n confirm: () => ({\n title: tr(\"admin.notifications.deleteTitle\", {\n default: \"Delete notification\",\n }),\n description: tr(\"admin.notifications.deleteConfirm\", {\n default: \"Delete this notification record? This cannot be undone.\",\n }),\n destructive: true,\n }),\n handler: async (row, ctx) => {\n await client.deleteNotification({ params: { id: row.id } });\n toast.success(\n tr(\"admin.notifications.deleted\", {\n default: \"Notification deleted\",\n }),\n );\n ctx.refresh();\n },\n },\n [client, toast, tr],\n );\n\n return (\n <AdminPage>\n <AlephaTable<NotificationResource>\n className=\"min-h-0 flex-1\"\n persistenceKey=\"admin.notifications\"\n fetch={fetcher}\n onRowClick={(n) => setSelected({ id: n.id, tab: \"details\" })}\n filters={{\n schema: z.object({\n search: z.text().optional(),\n status: z.enum(NOTIFICATION_STATUSES as [string]).optional(),\n channel: z.enum([\"email\", \"sms\"]).optional(),\n template: z.text().optional(),\n }),\n render: (form) => (\n <>\n <div className=\"w-52\">\n <Control\n input={form.input.search}\n label=\"\"\n icon={Search}\n placeholder={tr(\"admin.notifications.filterSearch\", {\n default: \"Recipient\",\n })}\n inputProps={{\n \"aria-label\": tr(\"admin.notifications.filterSearch\", {\n default: \"Recipient\",\n }),\n }}\n />\n </div>\n <div className=\"w-44\">\n <Control\n input={form.input.status}\n label=\"\"\n clearable\n icon={CircleDot}\n clearLabel={tr(\"admin.notifications.allStatuses\", {\n default: \"All statuses\",\n })}\n triggerClassName=\"w-full\"\n items={NOTIFICATION_STATUSES.map((status) => ({\n label: statusLabels[status],\n value: status,\n }))}\n inputProps={{\n \"aria-label\": tr(\"admin.notifications.colStatus\", {\n default: \"Status\",\n }),\n }}\n />\n </div>\n <div className=\"w-40\">\n <Control\n input={form.input.channel}\n label=\"\"\n clearable\n icon={Radio}\n clearLabel={tr(\"admin.notifications.allChannels\", {\n default: \"All channels\",\n })}\n triggerClassName=\"w-full\"\n items={[\n { label: \"Email\", value: \"email\" },\n { label: \"SMS\", value: \"sms\" },\n ]}\n inputProps={{\n \"aria-label\": tr(\"admin.notifications.colChannel\", {\n default: \"Channel\",\n }),\n }}\n />\n </div>\n {(templates ?? []).length > 0 && (\n <div className=\"w-52\">\n <Control\n input={form.input.template}\n label=\"\"\n clearable\n icon={FileText}\n clearLabel={tr(\"admin.notifications.allTemplates\", {\n default: \"All templates\",\n })}\n triggerClassName=\"w-full\"\n items={(templates ?? []).map((template) => ({\n label: notificationTemplateLabel(template.name),\n value: template.name,\n }))}\n inputProps={{\n \"aria-label\": tr(\"admin.notifications.colTemplate\", {\n default: \"Template\",\n }),\n }}\n />\n </div>\n )}\n </>\n ),\n }}\n rowActions={(row) => {\n const user = row.contact ? usersByContact[row.contact] : undefined;\n return [\n ...(client.resendNotification.can()\n ? [\n {\n label: tr(\"admin.notifications.resend\", {\n default: \"Resend\",\n }),\n icon: Send,\n // The original payload lives in the outbox, which is\n // purged long before the receipt. Offering a resend\n // that can only 404 reads as a broken button.\n disabled: (item: NotificationResource) =>\n item.outboxAvailable === false,\n onClick: (\n item: NotificationResource,\n ctx: { refresh: () => void },\n ) => resend.run(item, ctx),\n },\n ]\n : []),\n {\n label: tr(\"admin.notifications.rawData\", {\n default: \"Raw data\",\n }),\n icon: Braces,\n onClick: (item: NotificationResource) =>\n setSelected({ id: item.id, tab: \"raw\" }),\n },\n ...(user\n ? [\n {\n label: tr(\"admin.notifications.openUser\", {\n default: \"Open user\",\n }),\n icon: UserRound,\n onClick: () => router.push(`/admin/users/${user.id}`),\n },\n ]\n : []),\n ...(client.deleteNotification.can()\n ? [\n {\n label: tr(\"admin.notifications.delete\", {\n default: \"Delete\",\n }),\n icon: Trash2,\n destructive: true,\n onClick: (\n item: NotificationResource,\n ctx: { refresh: () => void },\n ) => remove.run(item, ctx),\n },\n ]\n : []),\n ];\n }}\n bulkActions={[\n {\n label: tr(\"admin.notifications.bulkDelete\", {\n default: \"Delete selected\",\n }),\n icon: Trash2,\n destructive: true,\n onClick: (items, ctx) => bulkDelete.run(items, ctx),\n },\n ]}\n columns={{\n status: {\n label: tr(\"admin.notifications.colStatus\", {\n default: \"Status\",\n }),\n // First, because it is the only column an operator scans\n // before deciding whether the row is interesting at all.\n className: \"pl-4\",\n sortable: true,\n cell: (n) => <AdminNotificationsStatusBadge status={n.status} />,\n },\n createdAt: {\n label: tr(\"admin.notifications.colWhen\", { default: \"When\" }),\n sortable: true,\n cell: (n) => (\n <span className=\"text-muted-foreground text-xs\">\n {String(l(n.createdAt, { date: \"fromNow\" }))}\n </span>\n ),\n },\n contact: {\n label: tr(\"admin.notifications.colRecipient\", {\n default: \"Recipient\",\n }),\n cell: (n) => {\n const user = n.contact ? usersByContact[n.contact] : undefined;\n // A contact that is not a user is normal, not a gap: a\n // notification can go to an address nobody signed up with.\n return user ? (\n <AdminUserCell\n userId={user.id}\n user={user}\n fallbackLabel={n.contact}\n />\n ) : (\n <span className=\"text-sm\">{n.contact ?? \"-\"}</span>\n );\n },\n },\n template: {\n label: tr(\"admin.notifications.colTemplate\", {\n default: \"Template\",\n }),\n sortable: true,\n cell: (n) => (\n // Humanized for reading, raw on hover: the raw name is the\n // identifier an operator greps the codebase for.\n <span className=\"text-sm\" title={n.template}>\n {n.template ? notificationTemplateLabel(n.template) : \"-\"}\n </span>\n ),\n },\n category: {\n label: tr(\"admin.notifications.colCategory\", {\n default: \"Category\",\n }),\n cell: (n) =>\n n.category ? (\n <Badge variant=\"secondary\">{n.category}</Badge>\n ) : (\n <span className=\"text-muted-foreground\">-</span>\n ),\n },\n type: {\n // The column KEY stays `type`: AlephaTable persists column\n // visibility under it, and renaming would silently drop every\n // operator's stored preference. Only the label moves, to match\n // what the detail sheet has always called it.\n label: tr(\"admin.notifications.colChannel\", {\n default: \"Channel\",\n }),\n cell: (n) => <Badge variant=\"secondary\">{n.type ?? \"-\"}</Badge>,\n },\n }}\n />\n\n <AdminNotificationsDetail\n notificationId={selected?.id ?? null}\n initialTab={selected?.tab}\n onClose={() => setSelected(null)}\n />\n </AdminPage>\n );\n};\n\nexport default AdminNotifications;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiDA,MAAa,2BAA2B;CACtC,MAAM,SAAS,UAAuC;CACtD,MAAM,aAAa,UAA+B;CAClD,MAAM,QAAQ,SAAS;CACvB,MAAM,SAAS,UAAU;CACzB,MAAM,EAAE,GAAG,OAAO,QAAQ;CAC1B,MAAM,eAAe,4BAA4B;CACjD,MAAM,CAAC,UAAU,eAAe,SAC9B,IACF;;;;;;;;CASA,MAAM,CAAC,gBAAgB,qBAAqB,SAE1C,CAAC,CAAC;;;;;;;;CASJ,MAAM,EAAE,MAAM,cAAc,SAC1B;EACE,UAAU,EAAE,aACV,OAAO,0BAA0B,IAAI,IAChC,OAAO,0BACN,CAAC,GACD,EAAE,SAAS,EAAE,OAAO,EAAE,CACxB,IACA,QAAQ,QAAQ,CAAC,CAAC;EACxB,eAAe,CAAC;CAClB,GACA,CAAC,MAAM,CACT;;;;;;;;;CAUA,MAAM,eAAe,aAClB,SAAiC;EAChC,IAAI,CAAC,WAAW,UAAU,IAAI,GAAG;EACjC,MAAM,SAAS,CACb,GAAG,IAAI,IACL,KACG,QAAQ,QAAQ,IAAI,SAAS,WAAW,IAAI,OAAO,CAAC,CACpD,KAAK,QAAQ,IAAI,OAAiB,CACvC,CACF;EACA,IAAI,OAAO,WAAW,GAAG;EAEzB,WACG,UAAU,EAAE,OAAO;GAAE;GAAQ,MAAM,KAAK,IAAI,OAAO,QAAQ,GAAG;EAAE,EAAE,CAAC,CAAC,CACpE,MAAM,SAAS;GACd,mBAAmB,cAAc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AAe,YAAY,IAAI;CAChC,CAAA,CACQ,EAAA,CAAA;AAEf"}
|
|
1
|
+
{"version":3,"file":"admin-notifications.js","names":[],"sources":["../../../src/components/admin/admin-notifications.tsx"],"sourcesContent":["import { AdminNotificationsDetail } from \"@alepha/ui/components/admin/admin-notifications-detail\";\nimport { AdminNotificationsStatusBadge } from \"@alepha/ui/components/admin/admin-notifications-status-badge\";\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 { Badge } from \"@alepha/ui/components/ui/badge\";\nimport { useToast } from \"@alepha/ui/components/use-toast/use-toast\";\nimport { z } from \"alepha\";\nimport type {\n AdminNotificationController,\n NotificationResource,\n NotificationTemplateResource,\n} from \"alepha/api/notifications\";\nimport type { AdminUserController } from \"alepha/api/users\";\nimport { useClient, useQuery } from \"alepha/react\";\nimport { useI18n } from \"alepha/react/i18n\";\nimport { useRouter } from \"alepha/react/router\";\nimport {\n Braces,\n CircleDot,\n FileText,\n Radio,\n Search,\n Send,\n Trash2,\n UserRound,\n} from \"lucide-react\";\nimport { useCallback, useState } from \"react\";\n\nimport TimeAgo from \"../time-ago/time-ago.tsx\";\nimport { notificationChannelLabel } from \"./admin-notifications-channel-label.ts\";\n// Relative, not through the `@alepha/ui/components/*` alias: that subpath\n// pattern maps to `.tsx`, so a plain `.ts` sibling only resolves this way.\nimport { useNotificationStatusLabels } from \"./admin-notifications-status-labels.ts\";\nimport { NOTIFICATION_STATUSES } from \"./admin-notifications-status-tones.ts\";\nimport { notificationTemplateLabel } from \"./admin-notifications-template-label.ts\";\n\n/**\n * What the app sent, what happened to it, and who it may not send to.\n *\n * ⚠️ **The list is the delivery receipts, not the job outbox.** Two tables\n * with two retention clocks cannot be paged as one. The consequence is that\n * notifications pushed before receipts existed have none and do not appear,\n * which the empty state says rather than hiding.\n *\n * No polling anywhere on this page: the table's own refresh is the way to\n * get fresh data. A polling effect keyed on an unstable object is what\n * burned 4k Worker invocations once already.\n */\nexport const AdminNotifications = () => {\n const client = useClient<AdminNotificationController>();\n const userClient = useClient<AdminUserController>();\n const toast = useToast();\n const router = useRouter();\n const { tr } = useI18n();\n const statusLabels = useNotificationStatusLabels();\n const [selected, setSelected] = useState<{ id: string; tab: string } | null>(\n null,\n );\n\n /**\n * Contacts resolved to user records, accumulated across pages.\n *\n * Keyed on the contact string because that is all a receipt carries: it\n * stores an email or a phone number and never a user id. Resolving happens\n * client-side because `api/notifications` may not import `api/users`.\n */\n const [usersByContact, setUsersByContact] = useState<\n Record<string, { id: string; email?: string; username?: string }>\n >({});\n\n /**\n * The catalogue this app can send, for the template and category filters.\n *\n * Falls back to an empty list on any failure, including a missing\n * permission: a filter that cannot offer its options should narrow to\n * nothing rather than break the page around it.\n */\n const { data: templates } = useQuery<NotificationTemplateResource[]>(\n {\n handler: ({ signal }) =>\n client.listNotificationTemplates.can()\n ? (client.listNotificationTemplates(\n {},\n { request: { signal } },\n ) as any)\n : Promise.resolve([]),\n onError: () => {},\n },\n [client],\n );\n\n /**\n * Resolve this page's email contacts to users, in ONE request.\n *\n * Per page and not per row: a 25-row page would otherwise be 25 requests.\n * Phone contacts are skipped outright, since they can never match an email\n * column. Every failure is swallowed: the column falls back to the raw\n * contact string, which is still the truth.\n */\n const resolveUsers = useCallback(\n (rows: NotificationResource[]) => {\n if (!userClient.findUsers.can()) return;\n const emails = [\n ...new Set(\n rows\n .filter((row) => row.type === \"email\" && row.contact)\n .map((row) => row.contact as string),\n ),\n ];\n if (emails.length === 0) return;\n\n userClient\n .findUsers({ query: { emails, size: Math.min(emails.length, 100) } })\n .then((page) => {\n setUsersByContact((previous) => ({\n ...previous,\n ...Object.fromEntries(\n page.content\n .filter((user) => user.email)\n .map((user) => [user.email as string, user]),\n ),\n }));\n })\n .catch(() => {});\n },\n [userClient],\n );\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 f = params.filters ?? {};\n const page = await client.findNotifications({\n query: {\n page: params.page,\n size: params.size,\n sort: params.sort,\n // Spread in, never assigned as undefined: the repository refuses an\n // undefined value in a where-filter.\n ...(f.search ? { search: f.search } : {}),\n ...(f.status ? { status: f.status } : {}),\n ...(f.channel ? { channel: f.channel } : {}),\n ...(f.template ? { template: f.template } : {}),\n } as any,\n });\n resolveUsers(page.content);\n return page;\n },\n [client, resolveUsers],\n );\n\n const bulkDelete = useConfirmedAction<\n [\n NotificationResource[],\n { clearSelection: () => void; refresh: () => void },\n ]\n >(\n {\n confirm: (items) => ({\n title: tr(\"admin.notifications.bulkDeleteTitle\", {\n default: \"Delete notifications\",\n }),\n description: tr(\"admin.notifications.bulkDeleteConfirm\", {\n default: `Delete ${items.length} notification record(s)? This cannot be undone.`,\n args: [String(items.length)],\n }),\n destructive: true,\n }),\n handler: async (items, ctx) => {\n if (items.length === 0) return;\n const res = await client.deleteNotifications({\n body: { ids: items.map((n) => n.id) },\n });\n toast.success(\n tr(\"admin.notifications.bulkDeleted\", {\n default: `${res.deleted.length} notification(s) deleted`,\n args: [String(res.deleted.length)],\n }),\n );\n ctx.clearSelection();\n ctx.refresh();\n },\n },\n [client, toast, tr],\n );\n\n const resend = useConfirmedAction<\n [NotificationResource, { refresh: () => void }]\n >(\n {\n confirm: (row) => ({\n title: tr(\"admin.notifications.resendTitle\", { default: \"Resend\" }),\n description: tr(\"admin.notifications.resendConfirm\", {\n default: `Send this notification to ${row.contact} again?`,\n args: [row.contact ?? \"\"],\n }),\n }),\n handler: async (row, ctx) => {\n await client.resendNotification({ params: { id: row.id } });\n // It goes back through the suppression gate, so \"queued\" is the\n // honest word: a suppressed contact will get a second `skipped`\n // receipt rather than a message.\n toast.success(\n tr(\"admin.notifications.resent\", {\n default: \"Queued. It passes the suppression gate again.\",\n }),\n );\n ctx.refresh();\n },\n },\n [client, toast, tr],\n );\n\n const remove = useConfirmedAction<\n [NotificationResource, { refresh: () => void }]\n >(\n {\n confirm: () => ({\n title: tr(\"admin.notifications.deleteTitle\", {\n default: \"Delete notification\",\n }),\n description: tr(\"admin.notifications.deleteConfirm\", {\n default: \"Delete this notification record? This cannot be undone.\",\n }),\n destructive: true,\n }),\n handler: async (row, ctx) => {\n await client.deleteNotification({ params: { id: row.id } });\n toast.success(\n tr(\"admin.notifications.deleted\", {\n default: \"Notification deleted\",\n }),\n );\n ctx.refresh();\n },\n },\n [client, toast, tr],\n );\n\n return (\n <AdminPage>\n <AlephaTable<NotificationResource>\n className=\"min-h-0 flex-1\"\n persistenceKey=\"admin.notifications\"\n fetch={fetcher}\n onRowClick={(n) => setSelected({ id: n.id, tab: \"details\" })}\n filters={{\n schema: z.object({\n search: z.text().optional(),\n status: z.enum(NOTIFICATION_STATUSES as [string]).optional(),\n // Open, like the column behind it. A closed enum here would\n // reject `?channel=discord` outright, so a plugin's channel\n // would be listed in the table and unfilterable.\n channel: z.text().optional(),\n template: z.text().optional(),\n }),\n render: (form) => (\n <>\n <div className=\"w-52\">\n <Control\n input={form.input.search}\n label=\"\"\n icon={Search}\n placeholder={tr(\"admin.notifications.filterSearch\", {\n default: \"Recipient\",\n })}\n inputProps={{\n \"aria-label\": tr(\"admin.notifications.filterSearch\", {\n default: \"Recipient\",\n }),\n }}\n />\n </div>\n <div className=\"w-44\">\n <Control\n input={form.input.status}\n label=\"\"\n clearable\n icon={CircleDot}\n clearLabel={tr(\"admin.notifications.allStatuses\", {\n default: \"All statuses\",\n })}\n triggerClassName=\"w-full\"\n items={NOTIFICATION_STATUSES.map((status) => ({\n label: statusLabels[status],\n value: status,\n }))}\n inputProps={{\n \"aria-label\": tr(\"admin.notifications.colStatus\", {\n default: \"Status\",\n }),\n }}\n />\n </div>\n <div className=\"w-40\">\n <Control\n input={form.input.channel}\n label=\"\"\n clearable\n icon={Radio}\n clearLabel={tr(\"admin.notifications.allChannels\", {\n default: \"All channels\",\n })}\n triggerClassName=\"w-full\"\n // Derived from the templates this app registers, which\n // already carry their own channel list. A hand-written\n // pair could only ever offer the two the framework ships.\n items={[\n ...new Set((templates ?? []).flatMap((t) => t.channels)),\n ].map((channel) => ({\n label: notificationChannelLabel(channel),\n value: channel,\n }))}\n inputProps={{\n \"aria-label\": tr(\"admin.notifications.colChannel\", {\n default: \"Channel\",\n }),\n }}\n />\n </div>\n {(templates ?? []).length > 0 && (\n <div className=\"w-52\">\n <Control\n input={form.input.template}\n label=\"\"\n clearable\n icon={FileText}\n clearLabel={tr(\"admin.notifications.allTemplates\", {\n default: \"All templates\",\n })}\n triggerClassName=\"w-full\"\n items={(templates ?? []).map((template) => ({\n label: notificationTemplateLabel(template.name),\n value: template.name,\n }))}\n inputProps={{\n \"aria-label\": tr(\"admin.notifications.colTemplate\", {\n default: \"Template\",\n }),\n }}\n />\n </div>\n )}\n </>\n ),\n }}\n rowActions={(row) => {\n const user = row.contact ? usersByContact[row.contact] : undefined;\n return [\n ...(client.resendNotification.can()\n ? [\n {\n label: tr(\"admin.notifications.resend\", {\n default: \"Resend\",\n }),\n icon: Send,\n // The original payload lives in the outbox, which is\n // purged long before the receipt. Offering a resend\n // that can only 404 reads as a broken button.\n disabled: (item: NotificationResource) =>\n item.outboxAvailable === false,\n onClick: (\n item: NotificationResource,\n ctx: { refresh: () => void },\n ) => resend.run(item, ctx),\n },\n ]\n : []),\n {\n label: tr(\"admin.notifications.rawData\", {\n default: \"Raw data\",\n }),\n icon: Braces,\n onClick: (item: NotificationResource) =>\n setSelected({ id: item.id, tab: \"raw\" }),\n },\n ...(user\n ? [\n {\n label: tr(\"admin.notifications.openUser\", {\n default: \"Open user\",\n }),\n icon: UserRound,\n onClick: () => router.push(`/admin/users/${user.id}`),\n },\n ]\n : []),\n ...(client.deleteNotification.can()\n ? [\n {\n label: tr(\"admin.notifications.delete\", {\n default: \"Delete\",\n }),\n icon: Trash2,\n destructive: true,\n onClick: (\n item: NotificationResource,\n ctx: { refresh: () => void },\n ) => remove.run(item, ctx),\n },\n ]\n : []),\n ];\n }}\n bulkActions={[\n {\n label: tr(\"admin.notifications.bulkDelete\", {\n default: \"Delete selected\",\n }),\n icon: Trash2,\n destructive: true,\n onClick: (items, ctx) => bulkDelete.run(items, ctx),\n },\n ]}\n columns={{\n status: {\n label: tr(\"admin.notifications.colStatus\", {\n default: \"Status\",\n }),\n // First, because it is the only column an operator scans\n // before deciding whether the row is interesting at all.\n className: \"pl-4\",\n sortable: true,\n cell: (n) => <AdminNotificationsStatusBadge status={n.status} />,\n },\n createdAt: {\n label: tr(\"admin.notifications.colWhen\", { default: \"When\" }),\n sortable: true,\n cell: (n) => (\n <TimeAgo\n value={n.createdAt}\n className=\"text-muted-foreground text-xs\"\n />\n ),\n },\n contact: {\n label: tr(\"admin.notifications.colRecipient\", {\n default: \"Recipient\",\n }),\n cell: (n) => {\n const user = n.contact ? usersByContact[n.contact] : undefined;\n // A contact that is not a user is normal, not a gap: a\n // notification can go to an address nobody signed up with.\n return user ? (\n <AdminUserCell\n userId={user.id}\n user={user}\n fallbackLabel={n.contact}\n />\n ) : (\n <span className=\"text-sm\">{n.contact ?? \"-\"}</span>\n );\n },\n },\n template: {\n label: tr(\"admin.notifications.colTemplate\", {\n default: \"Template\",\n }),\n sortable: true,\n cell: (n) => (\n // Humanized for reading, raw on hover: the raw name is the\n // identifier an operator greps the codebase for.\n <span className=\"text-sm\" title={n.template}>\n {n.template ? notificationTemplateLabel(n.template) : \"-\"}\n </span>\n ),\n },\n category: {\n label: tr(\"admin.notifications.colCategory\", {\n default: \"Category\",\n }),\n cell: (n) =>\n n.category ? (\n <Badge variant=\"secondary\">{n.category}</Badge>\n ) : (\n <span className=\"text-muted-foreground\">-</span>\n ),\n },\n type: {\n // The column KEY stays `type`: AlephaTable persists column\n // visibility under it, and renaming would silently drop every\n // operator's stored preference. Only the label moves, to match\n // what the detail sheet has always called it.\n label: tr(\"admin.notifications.colChannel\", {\n default: \"Channel\",\n }),\n cell: (n) => <Badge variant=\"secondary\">{n.type ?? \"-\"}</Badge>,\n },\n }}\n />\n\n <AdminNotificationsDetail\n notificationId={selected?.id ?? null}\n initialTab={selected?.tab}\n onClose={() => setSelected(null)}\n />\n </AdminPage>\n );\n};\n\nexport default AdminNotifications;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmDA,MAAa,2BAA2B;CACtC,MAAM,SAAS,UAAuC;CACtD,MAAM,aAAa,UAA+B;CAClD,MAAM,QAAQ,SAAS;CACvB,MAAM,SAAS,UAAU;CACzB,MAAM,EAAE,OAAO,QAAQ;CACvB,MAAM,eAAe,4BAA4B;CACjD,MAAM,CAAC,UAAU,eAAe,SAC9B,IACF;;;;;;;;CASA,MAAM,CAAC,gBAAgB,qBAAqB,SAE1C,CAAC,CAAC;;;;;;;;CASJ,MAAM,EAAE,MAAM,cAAc,SAC1B;EACE,UAAU,EAAE,aACV,OAAO,0BAA0B,IAAI,IAChC,OAAO,0BACN,CAAC,GACD,EAAE,SAAS,EAAE,OAAO,EAAE,CACxB,IACA,QAAQ,QAAQ,CAAC,CAAC;EACxB,eAAe,CAAC;CAClB,GACA,CAAC,MAAM,CACT;;;;;;;;;CAUA,MAAM,eAAe,aAClB,SAAiC;EAChC,IAAI,CAAC,WAAW,UAAU,IAAI,GAAG;EACjC,MAAM,SAAS,CACb,GAAG,IAAI,IACL,KACG,QAAQ,QAAQ,IAAI,SAAS,WAAW,IAAI,OAAO,CAAC,CACpD,KAAK,QAAQ,IAAI,OAAiB,CACvC,CACF;EACA,IAAI,OAAO,WAAW,GAAG;EAEzB,WACG,UAAU,EAAE,OAAO;GAAE;GAAQ,MAAM,KAAK,IAAI,OAAO,QAAQ,GAAG;EAAE,EAAE,CAAC,CAAC,CACpE,MAAM,SAAS;GACd,mBAAmB,cAAc;IAC/B,GAAG;IACH,GAAG,OAAO,YACR,KAAK,QACF,QAAQ,SAAS,K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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin-payments.d.ts","sourceRoot":"","sources":["../../../src/components/admin/admin-payments.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"admin-payments.d.ts","sourceRoot":"","sources":["../../../src/components/admin/admin-payments.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAyB/B,eAAO,MAAM,aAAa,yBAmEzB,CAAC;eAEa,aAAa"}
|
|
@@ -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 { AdminPage } from "./admin-page.js";
|
|
4
5
|
import { AdminUserCell } from "./admin-user-cell.js";
|
|
5
6
|
import { useCallback } from "react";
|
|
@@ -15,20 +16,21 @@ const formatAmount = (cents, currency = "USD") => {
|
|
|
15
16
|
};
|
|
16
17
|
const AdminPayments = () => {
|
|
17
18
|
const client = useClient();
|
|
18
|
-
const {
|
|
19
|
+
const { tr } = useI18n();
|
|
20
|
+
const fetcher = useCallback(async (params) => {
|
|
21
|
+
return client.listIntents({ query: params });
|
|
22
|
+
}, [client]);
|
|
19
23
|
return /* @__PURE__ */ jsx(AdminPage, { children: /* @__PURE__ */ jsx(AlephaTable, {
|
|
20
24
|
className: "min-h-0 flex-1",
|
|
21
25
|
persistenceKey: "admin.payments",
|
|
22
|
-
fetch:
|
|
23
|
-
return client.listIntents({ query: params });
|
|
24
|
-
}, [client]),
|
|
26
|
+
fetch: fetcher,
|
|
25
27
|
columns: {
|
|
26
28
|
createdAt: {
|
|
27
29
|
label: tr("admin.payments.colWhen", { default: "When" }),
|
|
28
30
|
sortable: true,
|
|
29
|
-
cell: (p) => /* @__PURE__ */ jsx(
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
cell: (p) => /* @__PURE__ */ jsx(TimeAgo, {
|
|
32
|
+
value: p.createdAt,
|
|
33
|
+
className: "text-muted-foreground text-xs"
|
|
32
34
|
})
|
|
33
35
|
},
|
|
34
36
|
amount: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin-payments.js","names":[],"sources":["../../../src/components/admin/admin-payments.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 { AlephaTable } from \"@alepha/ui/components/alepha-table/alepha-table\";\nimport { Badge } from \"@alepha/ui/components/ui/badge\";\nimport type {\n AdminPaymentController,\n IntentResource,\n} from \"alepha/api/payments\";\nimport { useClient } from \"alepha/react\";\nimport { useI18n } from \"alepha/react/i18n\";\nimport { useCallback } from \"react\";\n\nconst formatAmount = (cents: number, currency = \"USD\") => {\n return new Intl.NumberFormat(\"en-US\", {\n style: \"currency\",\n currency,\n }).format((cents ?? 0) / 100);\n};\n\nexport const AdminPayments = () => {\n const client = useClient<AdminPaymentController>();\n const {
|
|
1
|
+
{"version":3,"file":"admin-payments.js","names":[],"sources":["../../../src/components/admin/admin-payments.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 { AlephaTable } from \"@alepha/ui/components/alepha-table/alepha-table\";\nimport { Badge } from \"@alepha/ui/components/ui/badge\";\nimport type {\n AdminPaymentController,\n IntentResource,\n} from \"alepha/api/payments\";\nimport { useClient } from \"alepha/react\";\nimport { useI18n } from \"alepha/react/i18n\";\nimport { useCallback } from \"react\";\n\nconst formatAmount = (cents: number, currency = \"USD\") => {\n return new Intl.NumberFormat(\"en-US\", {\n style: \"currency\",\n currency,\n }).format((cents ?? 0) / 100);\n};\n\nexport const AdminPayments = () => {\n const client = useClient<AdminPaymentController>();\n const { tr } = useI18n();\n\n const fetcher = useCallback(\n async (params: { page: number; size: number; sort?: string }) => {\n return client.listIntents({ query: params });\n },\n [client],\n );\n\n return (\n <AdminPage>\n <AlephaTable<IntentResource>\n className=\"min-h-0 flex-1\"\n persistenceKey=\"admin.payments\"\n fetch={fetcher}\n columns={{\n createdAt: {\n label: tr(\"admin.payments.colWhen\", { default: \"When\" }),\n sortable: true,\n cell: (p) => (\n <TimeAgo\n value={p.createdAt}\n className=\"text-muted-foreground text-xs\"\n />\n ),\n },\n amount: {\n label: tr(\"admin.payments.colAmount\", { default: \"Amount\" }),\n align: \"right\",\n cell: (p) => (\n <span className=\"font-medium tabular-nums\">\n {formatAmount(p.amount, p.currency)}\n </span>\n ),\n },\n customer: {\n label: tr(\"admin.payments.colCustomer\", { default: \"Customer\" }),\n cell: (p) => <AdminUserCell userId={p.userId} user={p.user} />,\n },\n provider: {\n label: tr(\"admin.payments.colProvider\", { default: \"Provider\" }),\n cell: (p) => (\n <code className=\"text-xs\">{p.providerRef ?? \"—\"}</code>\n ),\n },\n status: {\n label: tr(\"admin.payments.colStatus\", { default: \"Status\" }),\n cell: (p) => {\n const s = p.status;\n const variant =\n s === \"captured\" || s === \"refunded\"\n ? \"default\"\n : s === \"failed\" ||\n s === \"cancelled\" ||\n s === \"expired\" ||\n s === \"voided\"\n ? \"destructive\"\n : \"outline\";\n return <Badge variant={variant}>{s}</Badge>;\n },\n },\n }}\n />\n </AdminPage>\n );\n};\n\nexport default AdminPayments;\n"],"mappings":";;;;;;;;;;AAkBA,MAAM,gBAAgB,OAAe,WAAW,UAAU;CACxD,OAAO,IAAI,KAAK,aAAa,SAAS;EACpC,OAAO;EACP;CACF,CAAC,CAAC,CAAC,QAAQ,SAAS,KAAK,GAAG;AAC9B;AAEA,MAAa,sBAAsB;CACjC,MAAM,SAAS,UAAkC;CACjD,MAAM,EAAE,OAAO,QAAQ;CAEvB,MAAM,UAAU,YACd,OAAO,WAA0D;EAC/D,OAAO,OAAO,YAAY,EAAE,OAAO,OAAO,CAAC;CAC7C,GACA,CAAC,MAAM,CACT;CAEA,OACE,oBAAC,WAAD,EAAA,UACE,oBAAC,aAAD;EACE,WAAU;EACV,gBAAe;EACf,OAAO;EACP,SAAS;GACP,WAAW;IACT,OAAO,GAAG,0BAA0B,EAAE,SAAS,OAAO,CAAC;IACvD,UAAU;IACV,OAAO,MACL,oBAAC,SAAD;KACE,OAAO,EAAE;KACT,WAAU;IACX,CAAA;GAEL;GACA,QAAQ;IACN,OAAO,GAAG,4BAA4B,EAAE,SAAS,SAAS,CAAC;IAC3D,OAAO;IACP,OAAO,MACL,oBAAC,QAAD;KAAM,WAAU;KACb,UAAA,aAAa,EAAE,QAAQ,EAAE,QAAQ;IAC9B,CAAA;GAEV;GACA,UAAU;IACR,OAAO,GAAG,8BAA8B,EAAE,SAAS,WAAW,CAAC;IAC/D,OAAO,MAAM,oBAAC,eAAD;KAAe,QAAQ,EAAE;KAAQ,MAAM,EAAE;IAAO,CAAA;GAC/D;GACA,UAAU;IACR,OAAO,GAAG,8BAA8B,EAAE,SAAS,WAAW,CAAC;IAC/D,OAAO,MACL,oBAAC,QAAD;KAAM,WAAU;KAAW,UAAA,EAAE,eAAe;IAAU,CAAA;GAE1D;GACA,QAAQ;IACN,OAAO,GAAG,4BAA4B,EAAE,SAAS,SAAS,CAAC;IAC3D,OAAO,MAAM;KACX,MAAM,IAAI,EAAE;KAUZ,OAAO,oBAAC,OAAD;MAAO,SARZ,MAAM,cAAc,MAAM,aACtB,YACA,MAAM,YACJ,MAAM,eACN,MAAM,aACN,MAAM,WACN,gBACA;MACyB,UAAA;KAAS,CAAA;IAC5C;GACF;EACF;CACD,CAAA,EACQ,CAAA;AAEf"}
|
|
@@ -101,6 +101,18 @@ export interface AdminRouterOptions {
|
|
|
101
101
|
* that name. This option exists for applications that mount their own auth
|
|
102
102
|
* routes under a different name instead of `AuthRouter`.
|
|
103
103
|
*
|
|
104
|
+
* ⚠️ **It answers one surface, not the router.** This is the button in the
|
|
105
|
+
* admin account menu; where the ROUTER sends somebody whose session expired
|
|
106
|
+
* on a guarded page is `loginRoutesAtom` (`alepha/react/router`), and the
|
|
107
|
+
* two are set separately on purpose. This option cannot serve both: it says
|
|
108
|
+
* which route, and the router's question is which route FOR WHICH PART OF
|
|
109
|
+
* THE APPLICATION - a prefix the admin shell does not know, since it is
|
|
110
|
+
* mounted at a path the application chose. The framework could not read it
|
|
111
|
+
* either way round, because it does not import this package.
|
|
112
|
+
*
|
|
113
|
+
* An application with two doors sets both, naming the same route here as
|
|
114
|
+
* its `/admin` prefix names there.
|
|
115
|
+
*
|
|
104
116
|
* @default "login"
|
|
105
117
|
*/
|
|
106
118
|
loginRouteName?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin-router-options.d.ts","sourceRoot":"","sources":["../../../src/components/admin/admin-router-options.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kDAAkD,CAAC;AAC3F,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2CAA2C,CAAC;AAE1E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEzD;;;;;;;;GAQG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAElB;;;;;;;OAOG;IACH,aAAa,CAAC,EAAE,SAAS,CAAC;IAE1B;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;;;;;;;;OAWG;IACH,WAAW,C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E;QACN,KAAK,CAAC,EAAE,eAAe,CAAC;QACxB,UAAU,CAAC,EAAE,oBAAoB,CAAC;QAClC,UAAU,CAAC,EAAE,oBAAoB,CAAC;KACnC,CAAC;CACH;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,sBAAsB,0HAKjC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin-router-options.js","names":[],"sources":["../../../src/components/admin/admin-router-options.tsx"],"sourcesContent":["import type { AdminDashboardCard } from \"@alepha/ui/components/admin/admin-dashboard-card\";\nimport type { NavGroup } from \"@alepha/ui/components/app-shell/app-shell\";\nimport { $atom, z } from \"alepha\";\nimport type { ReactNode } from \"react\";\n\nimport type { AdminParametersProps } from \"./admin-parameters.tsx\";\nimport type { AdminUserDetailProps } from \"./admin-user-detail.tsx\";\nimport type { AdminUsersProps } from \"./admin-users.tsx\";\n\n/**\n * Everything an application can change about `AdminRouter` without writing\n * its own.\n *\n * The seam is deliberately narrow: chrome slots plus the props of the three\n * pages that accept props. An application wanting different URLs, different\n * page composition or a different shell writes its own router — the same\n * trade `AuthRouter` documents.\n */\nexport interface AdminRouterOptions {\n /**\n * Sidebar header. Lore's back-arrow-plus-title and shop's Poinçon are both\n * just this.\n *\n * ⚠️ **It must handle the sidebar collapsing to an icon rail itself.**\n * `SidebarHeader` renders this node as given, at whatever width it asks for,\n * while the rail around it shrinks to about one icon — so a title with no\n * opinion about the collapsed state wraps, takes the header's height with\n * it, and overlaps the collapse toggle. Both apps have hit this.\n *\n * Tailwind exposes the state as a group data attribute, the same hook the\n * nav items use to drop their labels:\n *\n * ```tsx\n * brand: (\n * <div className=\"flex items-center gap-3 group-data-[collapsible=icon]:justify-center group-data-[collapsible=icon]:gap-0 group-data-[collapsible=icon]:px-0\">\n * <Mark className=\"shrink-0\" />\n * <span className=\"group-data-[collapsible=icon]:hidden\">My App</span>\n * </div>\n * )\n * ```\n *\n * Keep whatever reads as an icon, hide the words.\n */\n brand?: ReactNode;\n\n /**\n * Replaces the default language / dark-mode / account cluster entirely when\n * set. Supply the whole cluster, not an addition to it.\n *\n * The ⌘K search affordance is not part of the cluster and always renders:\n * the Spotlight state it opens lives inside the layout, where no\n * replacement cluster could reach it.\n */\n topbarActions?: ReactNode;\n\n /**\n * Extra class(es) merged onto the shell's root element.\n *\n * Exists for applications whose `/admin` lives inside a document they do\n * not fully own — a host page that paints fixed overlays over the viewport,\n * or hardcodes a theme class on `<html>` — and that need one stable hook to\n * fence the console off from that chrome. Styling inside the shell does not\n * go through this; components carry their own classes.\n */\n className?: string;\n\n /**\n * Set `false` to keep the shell from mounting `<ColorScheme />`.\n *\n * The shell mounts it because `/admin` is normally not a child of the\n * application's own layout, so nothing else would apply the dark-mode\n * atom's class to `<html>`. An application whose host document owns that\n * class itself — a hardcoded `<html class=\"dark\">`, a theme manager of its\n * own — turns this off so entering `/admin` cannot rewrite the document's\n * theme underneath the rest of the app.\n *\n * @default true\n */\n colorScheme?: boolean;\n\n /**\n * Nav groups appended after the route-derived ones, for entries that map to\n * no route. Forwarded to `NavShell`'s own `extraNav`.\n */\n extraNav?: NavGroup[];\n\n /**\n * Cards appended to the dashboard after the built-in ones.\n *\n * Each carries its own `can` gate, so a card is responsible for saying when\n * it should not render — the dashboard never guesses on a card's behalf.\n *\n * There is exactly one built-in card (Users, at `order` 1000), so a card\n * declaring no `order` leads and an application's dashboard is mostly its\n * own — which is the intended shape. The framework ships the contract, not\n * the content.\n */\n dashboardCards?: AdminDashboardCard[];\n\n /**\n * Route name the shell's \"leave admin\" affordance pushes.\n *\n * @default \"home\"\n */\n homeRouteName?: string;\n\n /**\n * Route name the shell's sign-in affordance pushes.\n *\n * `login` is the conventional name because `AuthRouter` mounts a page by\n * that name. This option exists for applications that mount their own auth\n * routes under a different name instead of `AuthRouter`.\n *\n * @default \"login\"\n */\n loginRouteName?: string;\n\n /**\n * Props forwarded to the three pages that accept them, keyed by page.\n *\n * Each entry reuses that component's own exported props interface rather\n * than restating its fields, so a prop added to `AdminUsers` is passable the\n * day it exists.\n */\n pages?: {\n users?: AdminUsersProps;\n userDetail?: AdminUserDetailProps;\n parameters?: AdminParametersProps;\n };\n}\n\n/**\n * Boot-time configuration for {@link AdminRouter}, following the\n * `linkOptionsAtom` / `oauthOptions` / `mcpStreamableHttpOptions` pattern:\n * the application calls `alepha.set(adminRouterOptionsAtom, { … })` once,\n * before start.\n *\n * The schema is a `z.custom` passthrough because the value carries React\n * nodes and component references, whose shape TypeScript already owns — the\n * exact case `z.custom`'s own documentation names. Nothing here crosses a\n * trust boundary: it is written by the application at boot and read only by\n * the admin shell.\n *\n * Being boot-configured also keeps it out of the SSR payload.\n * `StateManager.exportAtoms()` reads scope `\"current\"`, so it sees\n * request-scoped writes only and never an atom set on the app store — which\n * matters here, because a `ReactNode` would not survive JSON serialization.\n */\nexport const adminRouterOptionsAtom = $atom({\n name: \"alepha.ui.admin.router.options\",\n description: \"Chrome slots and per-page props for the admin router.\",\n schema: z.custom<AdminRouterOptions>(),\n default: {} satisfies AdminRouterOptions,\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"admin-router-options.js","names":[],"sources":["../../../src/components/admin/admin-router-options.tsx"],"sourcesContent":["import type { AdminDashboardCard } from \"@alepha/ui/components/admin/admin-dashboard-card\";\nimport type { NavGroup } from \"@alepha/ui/components/app-shell/app-shell\";\nimport { $atom, z } from \"alepha\";\nimport type { ReactNode } from \"react\";\n\nimport type { AdminParametersProps } from \"./admin-parameters.tsx\";\nimport type { AdminUserDetailProps } from \"./admin-user-detail.tsx\";\nimport type { AdminUsersProps } from \"./admin-users.tsx\";\n\n/**\n * Everything an application can change about `AdminRouter` without writing\n * its own.\n *\n * The seam is deliberately narrow: chrome slots plus the props of the three\n * pages that accept props. An application wanting different URLs, different\n * page composition or a different shell writes its own router — the same\n * trade `AuthRouter` documents.\n */\nexport interface AdminRouterOptions {\n /**\n * Sidebar header. Lore's back-arrow-plus-title and shop's Poinçon are both\n * just this.\n *\n * ⚠️ **It must handle the sidebar collapsing to an icon rail itself.**\n * `SidebarHeader` renders this node as given, at whatever width it asks for,\n * while the rail around it shrinks to about one icon — so a title with no\n * opinion about the collapsed state wraps, takes the header's height with\n * it, and overlaps the collapse toggle. Both apps have hit this.\n *\n * Tailwind exposes the state as a group data attribute, the same hook the\n * nav items use to drop their labels:\n *\n * ```tsx\n * brand: (\n * <div className=\"flex items-center gap-3 group-data-[collapsible=icon]:justify-center group-data-[collapsible=icon]:gap-0 group-data-[collapsible=icon]:px-0\">\n * <Mark className=\"shrink-0\" />\n * <span className=\"group-data-[collapsible=icon]:hidden\">My App</span>\n * </div>\n * )\n * ```\n *\n * Keep whatever reads as an icon, hide the words.\n */\n brand?: ReactNode;\n\n /**\n * Replaces the default language / dark-mode / account cluster entirely when\n * set. Supply the whole cluster, not an addition to it.\n *\n * The ⌘K search affordance is not part of the cluster and always renders:\n * the Spotlight state it opens lives inside the layout, where no\n * replacement cluster could reach it.\n */\n topbarActions?: ReactNode;\n\n /**\n * Extra class(es) merged onto the shell's root element.\n *\n * Exists for applications whose `/admin` lives inside a document they do\n * not fully own — a host page that paints fixed overlays over the viewport,\n * or hardcodes a theme class on `<html>` — and that need one stable hook to\n * fence the console off from that chrome. Styling inside the shell does not\n * go through this; components carry their own classes.\n */\n className?: string;\n\n /**\n * Set `false` to keep the shell from mounting `<ColorScheme />`.\n *\n * The shell mounts it because `/admin` is normally not a child of the\n * application's own layout, so nothing else would apply the dark-mode\n * atom's class to `<html>`. An application whose host document owns that\n * class itself — a hardcoded `<html class=\"dark\">`, a theme manager of its\n * own — turns this off so entering `/admin` cannot rewrite the document's\n * theme underneath the rest of the app.\n *\n * @default true\n */\n colorScheme?: boolean;\n\n /**\n * Nav groups appended after the route-derived ones, for entries that map to\n * no route. Forwarded to `NavShell`'s own `extraNav`.\n */\n extraNav?: NavGroup[];\n\n /**\n * Cards appended to the dashboard after the built-in ones.\n *\n * Each carries its own `can` gate, so a card is responsible for saying when\n * it should not render — the dashboard never guesses on a card's behalf.\n *\n * There is exactly one built-in card (Users, at `order` 1000), so a card\n * declaring no `order` leads and an application's dashboard is mostly its\n * own — which is the intended shape. The framework ships the contract, not\n * the content.\n */\n dashboardCards?: AdminDashboardCard[];\n\n /**\n * Route name the shell's \"leave admin\" affordance pushes.\n *\n * @default \"home\"\n */\n homeRouteName?: string;\n\n /**\n * Route name the shell's sign-in affordance pushes.\n *\n * `login` is the conventional name because `AuthRouter` mounts a page by\n * that name. This option exists for applications that mount their own auth\n * routes under a different name instead of `AuthRouter`.\n *\n * ⚠️ **It answers one surface, not the router.** This is the button in the\n * admin account menu; where the ROUTER sends somebody whose session expired\n * on a guarded page is `loginRoutesAtom` (`alepha/react/router`), and the\n * two are set separately on purpose. This option cannot serve both: it says\n * which route, and the router's question is which route FOR WHICH PART OF\n * THE APPLICATION - a prefix the admin shell does not know, since it is\n * mounted at a path the application chose. The framework could not read it\n * either way round, because it does not import this package.\n *\n * An application with two doors sets both, naming the same route here as\n * its `/admin` prefix names there.\n *\n * @default \"login\"\n */\n loginRouteName?: string;\n\n /**\n * Props forwarded to the three pages that accept them, keyed by page.\n *\n * Each entry reuses that component's own exported props interface rather\n * than restating its fields, so a prop added to `AdminUsers` is passable the\n * day it exists.\n */\n pages?: {\n users?: AdminUsersProps;\n userDetail?: AdminUserDetailProps;\n parameters?: AdminParametersProps;\n };\n}\n\n/**\n * Boot-time configuration for {@link AdminRouter}, following the\n * `linkOptionsAtom` / `oauthOptions` / `mcpStreamableHttpOptions` pattern:\n * the application calls `alepha.set(adminRouterOptionsAtom, { … })` once,\n * before start.\n *\n * The schema is a `z.custom` passthrough because the value carries React\n * nodes and component references, whose shape TypeScript already owns — the\n * exact case `z.custom`'s own documentation names. Nothing here crosses a\n * trust boundary: it is written by the application at boot and read only by\n * the admin shell.\n *\n * Being boot-configured also keeps it out of the SSR payload.\n * `StateManager.exportAtoms()` reads scope `\"current\"`, so it sees\n * request-scoped writes only and never an atom set on the app store — which\n * matters here, because a `ReactNode` would not survive JSON serialization.\n */\nexport const adminRouterOptionsAtom = $atom({\n name: \"alepha.ui.admin.router.options\",\n description: \"Chrome slots and per-page props for the admin router.\",\n schema: z.custom<AdminRouterOptions>(),\n default: {} satisfies AdminRouterOptions,\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAgKA,MAAa,yBAAyB,MAAM;CAC1C,MAAM;CACN,aAAa;CACb,QAAQ,EAAE,OAA2B;CACrC,SAAS,CAAC;AACZ,CAAC"}
|
|
@@ -8,7 +8,6 @@ import type { AdminNotificationController } from "alepha/api/notifications";
|
|
|
8
8
|
import type { AdminParameterController } from "alepha/api/parameters";
|
|
9
9
|
import type { AdminPaymentController } from "alepha/api/payments";
|
|
10
10
|
import type { AdminSessionController, AdminUserController } from "alepha/api/users";
|
|
11
|
-
import type { AdminWorkflowController } from "alepha/api/workflows";
|
|
12
11
|
/**
|
|
13
12
|
* The whole `/admin` surface — twelve pages and their shell — mounted and wired.
|
|
14
13
|
*
|
|
@@ -117,20 +116,20 @@ import type { AdminWorkflowController } from "alepha/api/workflows";
|
|
|
117
116
|
* groups by their smallest member, so only an `order` of 1000 or more sinks a
|
|
118
117
|
* page in among them.
|
|
119
118
|
*
|
|
120
|
-
* ### These
|
|
119
|
+
* ### These twelve route names are claimed globally
|
|
121
120
|
*
|
|
122
121
|
* `dashboard`, `users`, `userDetail`, `sessions`, `keys`, `jobs`,
|
|
123
|
-
* `notifications`, `audits`, `files`, `parameters`, `payments
|
|
124
|
-
*
|
|
122
|
+
* `notifications`, `audits`, `files`, `parameters`, `payments` and
|
|
123
|
+
* `analytics` each carry an explicit `name:` so a future rename of the
|
|
125
124
|
* field itself (done for readability, without touching the string) never
|
|
126
125
|
* silently changes the public route name — the same reason `AuthRouter`'s
|
|
127
126
|
* pages all carry one too.
|
|
128
127
|
*
|
|
129
128
|
* Route names live in one process-wide namespace, and a duplicate does not
|
|
130
129
|
* throw: `ReactPageProvider.page()` returns the first match. An adopter that
|
|
131
|
-
* registers its own page named `files` (or any of the other
|
|
130
|
+
* registers its own page named `files` (or any of the other eleven) either
|
|
132
131
|
* shadows this one or is shadowed by it, silently, depending on mount order.
|
|
133
|
-
* Treat these
|
|
132
|
+
* Treat these twelve names as reserved when hanging pages off `layout`.
|
|
134
133
|
*
|
|
135
134
|
* ### It needs `<DialogProvider>` and `<Toaster />` above it
|
|
136
135
|
*
|
|
@@ -151,7 +150,6 @@ export declare class AdminRouter {
|
|
|
151
150
|
protected readonly parameterApi: import("alepha/server/links").HttpVirtualClient<AdminParameterController>;
|
|
152
151
|
protected readonly paymentApi: import("alepha/server/links").HttpVirtualClient<AdminPaymentController>;
|
|
153
152
|
protected readonly analyticsApi: import("alepha/server/links").HttpVirtualClient<AdminAnalyticsController>;
|
|
154
|
-
protected readonly workflowApi: import("alepha/server/links").HttpVirtualClient<AdminWorkflowController>;
|
|
155
153
|
/**
|
|
156
154
|
* Anchors the shell and the first breadcrumb. Not itself a nav entry — a
|
|
157
155
|
* shell root is excluded from its own sidebar.
|
|
@@ -236,6 +234,5 @@ export declare class AdminRouter {
|
|
|
236
234
|
*/
|
|
237
235
|
payments: import("alepha/react/router").PagePrimitive<import("alepha/react/router").PageConfigSchema, any, any>;
|
|
238
236
|
analytics: import("alepha/react/router").PagePrimitive<import("alepha/react/router").PageConfigSchema, any, any>;
|
|
239
|
-
workflows: import("alepha/react/router").PagePrimitive<import("alepha/react/router").PageConfigSchema, any, any>;
|
|
240
237
|
}
|
|
241
238
|
//# sourceMappingURL=admin-router.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin-router.d.ts","sourceRoot":"","sources":["../../../src/components/admin/admin-router.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kDAAkD,CAAC;AAI3F,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,KAAK,EAAE,oBAAoB,EAAE,M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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiIG;AACH,qBAAa,WAAW;IACtB,SAAS,CAAC,QAAQ,CAAC,OAAO,oEAAkC;IAE5D,SAAS,CAAC,QAAQ,CAAC,OAAO,uEAAkC;IAC5D,SAAS,CAAC,QAAQ,CAAC,UAAU,0EAAqC;IAClE,SAAS,CAAC,QAAQ,CAAC,SAAS,yEAAoC;IAChE,SAAS,CAAC,QAAQ,CAAC,MAAM,sEAAiC;IAC1D,SAAS,CAAC,QAAQ,CAAC,eAAe,+EAA0C;IAC5E,SAAS,CAAC,QAAQ,CAAC,QAAQ,wEAAmC;IAC9D,SAAS,CAAC,QAAQ,CAAC,OAAO,kEAA6B;IACvD,SAAS,CAAC,QAAQ,CAAC,YAAY,4EAAuC;IACtE,SAAS,CAAC,QAAQ,CAAC,UAAU,0EAAqC;IAClE,SAAS,CAAC,QAAQ,CAAC,YAAY,4EAAuC;IAEtE;;;;;;;;;;;;;;;OAeG;IACH,MAAM,sJAMH;IAEH;;;;;;;;;;;;;OAaG;IACH,SAAS;;YAaN;IAEH;;;;;;;;;;;;;;OAcG;IACH,SAAS,CAAC,cAAc,IAAI,kBAAkB,EAAE,CAyB/C;IAED,KAAK;;;YAiBF;IAEH;;;;;OAKG;IACH,UAAU;;;;;;;YAeP;IAEH,QAAQ,wGAgBL;IAEH,IAAI,wGAiBD;IAEH,IAAI,wGAgBD;IAEH,aAAa,wGAgBV;IAEH,MAAM,wGAgBH;IAEH,KAAK,wGAgBF;IAEH,UAAU;;YAkBP;IAEH;;;;OAIG;IACH,QAAQ,wGAgBL;IAEH,SAAS,wGAgBN;CACJ"}
|
|
@@ -2,7 +2,7 @@ import { $pageNav } from "../nav-shell/nav-page.js";
|
|
|
2
2
|
import { AdminDashboardCountCard } from "./admin-dashboard-count-card.js";
|
|
3
3
|
import { adminRouterOptionsAtom } from "./admin-router-options.js";
|
|
4
4
|
import { createElement } from "react";
|
|
5
|
-
import { Bell, ChartLine, CreditCard, Files, KeyRound, LayoutDashboard, ShieldAlert, ShieldCheck, SlidersHorizontal, Timer, UsersIcon
|
|
5
|
+
import { Bell, ChartLine, CreditCard, Files, KeyRound, LayoutDashboard, ShieldAlert, ShieldCheck, SlidersHorizontal, Timer, UsersIcon } from "lucide-react";
|
|
6
6
|
import { $store, z } from "alepha";
|
|
7
7
|
import { Translate } from "alepha/react/i18n";
|
|
8
8
|
import { $client } from "alepha/server/links";
|
|
@@ -115,20 +115,20 @@ import { $client } from "alepha/server/links";
|
|
|
115
115
|
* groups by their smallest member, so only an `order` of 1000 or more sinks a
|
|
116
116
|
* page in among them.
|
|
117
117
|
*
|
|
118
|
-
* ### These
|
|
118
|
+
* ### These twelve route names are claimed globally
|
|
119
119
|
*
|
|
120
120
|
* `dashboard`, `users`, `userDetail`, `sessions`, `keys`, `jobs`,
|
|
121
|
-
* `notifications`, `audits`, `files`, `parameters`, `payments
|
|
122
|
-
*
|
|
121
|
+
* `notifications`, `audits`, `files`, `parameters`, `payments` and
|
|
122
|
+
* `analytics` each carry an explicit `name:` so a future rename of the
|
|
123
123
|
* field itself (done for readability, without touching the string) never
|
|
124
124
|
* silently changes the public route name — the same reason `AuthRouter`'s
|
|
125
125
|
* pages all carry one too.
|
|
126
126
|
*
|
|
127
127
|
* Route names live in one process-wide namespace, and a duplicate does not
|
|
128
128
|
* throw: `ReactPageProvider.page()` returns the first match. An adopter that
|
|
129
|
-
* registers its own page named `files` (or any of the other
|
|
129
|
+
* registers its own page named `files` (or any of the other eleven) either
|
|
130
130
|
* shadows this one or is shadowed by it, silently, depending on mount order.
|
|
131
|
-
* Treat these
|
|
131
|
+
* Treat these twelve names as reserved when hanging pages off `layout`.
|
|
132
132
|
*
|
|
133
133
|
* ### It needs `<DialogProvider>` and `<Toaster />` above it
|
|
134
134
|
*
|
|
@@ -149,7 +149,6 @@ var AdminRouter = class {
|
|
|
149
149
|
parameterApi = $client();
|
|
150
150
|
paymentApi = $client();
|
|
151
151
|
analyticsApi = $client();
|
|
152
|
-
workflowApi = $client();
|
|
153
152
|
/**
|
|
154
153
|
* Anchors the shell and the first breadcrumb. Not itself a nav entry — a
|
|
155
154
|
* shell root is excluded from its own sidebar.
|
|
@@ -440,28 +439,6 @@ var AdminRouter = class {
|
|
|
440
439
|
},
|
|
441
440
|
lazy: () => import("./admin-analytics.js")
|
|
442
441
|
});
|
|
443
|
-
workflows = $pageNav({
|
|
444
|
-
parent: this.layout,
|
|
445
|
-
path: "/workflows",
|
|
446
|
-
name: "workflows",
|
|
447
|
-
head: { title: "Workflows" },
|
|
448
|
-
permission: "admin:workflow:read",
|
|
449
|
-
can: () => this.workflowApi.getWorkflowRegistry.can(),
|
|
450
|
-
nav: {
|
|
451
|
-
label: "Workflows",
|
|
452
|
-
labelKey: "admin.nav.workflows",
|
|
453
|
-
icon: createElement(Workflow),
|
|
454
|
-
group: "System",
|
|
455
|
-
groupKey: "admin.nav.group.system",
|
|
456
|
-
order: 1014,
|
|
457
|
-
keywords: [
|
|
458
|
-
"saga",
|
|
459
|
-
"steps",
|
|
460
|
-
"executions"
|
|
461
|
-
]
|
|
462
|
-
},
|
|
463
|
-
lazy: () => import("./admin-workflows.js")
|
|
464
|
-
});
|
|
465
442
|
};
|
|
466
443
|
//#endregion
|
|
467
444
|
export { AdminRouter };
|