@endora-commerce/admin-shell 0.0.0-stage → 0.100.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/LICENSE +21 -0
- package/README.md +49 -2
- package/dist/AdminRoot.d.ts +45 -0
- package/dist/AdminRoot.d.ts.map +1 -0
- package/dist/AdminRoot.js +39 -0
- package/dist/AdminRoot.js.map +1 -0
- package/dist/App.d.ts +42 -0
- package/dist/App.d.ts.map +1 -0
- package/dist/App.js +94 -0
- package/dist/App.js.map +1 -0
- package/dist/components/AppShell.d.ts +5 -0
- package/dist/components/AppShell.d.ts.map +1 -0
- package/dist/components/AppShell.js +1259 -0
- package/dist/components/AppShell.js.map +1 -0
- package/dist/components/BrandLogo.d.ts +21 -0
- package/dist/components/BrandLogo.d.ts.map +1 -0
- package/dist/components/BrandLogo.js +21 -0
- package/dist/components/BrandLogo.js.map +1 -0
- package/dist/components/FederatedSignIn.d.ts +42 -0
- package/dist/components/FederatedSignIn.d.ts.map +1 -0
- package/dist/components/FederatedSignIn.js +56 -0
- package/dist/components/FederatedSignIn.js.map +1 -0
- package/dist/components/FileDropzone.d.ts +17 -0
- package/dist/components/FileDropzone.d.ts.map +1 -0
- package/dist/components/FileDropzone.js +17 -0
- package/dist/components/FileDropzone.js.map +1 -0
- package/dist/components/IdleLogout.d.ts +2 -0
- package/dist/components/IdleLogout.d.ts.map +1 -0
- package/dist/components/IdleLogout.js +90 -0
- package/dist/components/IdleLogout.js.map +1 -0
- package/dist/components/ImpersonationBanner.d.ts +13 -0
- package/dist/components/ImpersonationBanner.d.ts.map +1 -0
- package/dist/components/ImpersonationBanner.js +10 -0
- package/dist/components/ImpersonationBanner.js.map +1 -0
- package/dist/components/LanguagePicker.d.ts +3 -0
- package/dist/components/LanguagePicker.d.ts.map +1 -0
- package/dist/components/LanguagePicker.js +127 -0
- package/dist/components/LanguagePicker.js.map +1 -0
- package/dist/components/LoginPage.d.ts +11 -0
- package/dist/components/LoginPage.d.ts.map +1 -0
- package/dist/components/LoginPage.js +44 -0
- package/dist/components/LoginPage.js.map +1 -0
- package/dist/components/PaginationFooter.d.ts +18 -0
- package/dist/components/PaginationFooter.d.ts.map +1 -0
- package/dist/components/PaginationFooter.js +17 -0
- package/dist/components/PaginationFooter.js.map +1 -0
- package/dist/components/ResponsiveTable.d.ts +18 -0
- package/dist/components/ResponsiveTable.d.ts.map +1 -0
- package/dist/components/ResponsiveTable.js +17 -0
- package/dist/components/ResponsiveTable.js.map +1 -0
- package/dist/components/RowActionMenu.d.ts +18 -0
- package/dist/components/RowActionMenu.d.ts.map +1 -0
- package/dist/components/RowActionMenu.js +17 -0
- package/dist/components/RowActionMenu.js.map +1 -0
- package/dist/components/SpeechToTextButton.d.ts +14 -0
- package/dist/components/SpeechToTextButton.d.ts.map +1 -0
- package/dist/components/SpeechToTextButton.js +19 -0
- package/dist/components/SpeechToTextButton.js.map +1 -0
- package/dist/components/StickyFormActions.d.ts +18 -0
- package/dist/components/StickyFormActions.d.ts.map +1 -0
- package/dist/components/StickyFormActions.js +17 -0
- package/dist/components/StickyFormActions.js.map +1 -0
- package/dist/components/TouchReorderButtons.d.ts +18 -0
- package/dist/components/TouchReorderButtons.d.ts.map +1 -0
- package/dist/components/TouchReorderButtons.js +17 -0
- package/dist/components/TouchReorderButtons.js.map +1 -0
- package/dist/components/admin-user-picker/AdminUserPicker.d.ts +18 -0
- package/dist/components/admin-user-picker/AdminUserPicker.d.ts.map +1 -0
- package/dist/components/admin-user-picker/AdminUserPicker.js +17 -0
- package/dist/components/admin-user-picker/AdminUserPicker.js.map +1 -0
- package/dist/components/asset-picker/AssetFieldPicker.d.ts +21 -0
- package/dist/components/asset-picker/AssetFieldPicker.d.ts.map +1 -0
- package/dist/components/asset-picker/AssetFieldPicker.js +20 -0
- package/dist/components/asset-picker/AssetFieldPicker.js.map +1 -0
- package/dist/components/category-picker/CategorySelect.d.ts +18 -0
- package/dist/components/category-picker/CategorySelect.d.ts.map +1 -0
- package/dist/components/category-picker/CategorySelect.js +17 -0
- package/dist/components/category-picker/CategorySelect.js.map +1 -0
- package/dist/components/category-tree-picker/CategoryTreePicker.d.ts +18 -0
- package/dist/components/category-tree-picker/CategoryTreePicker.d.ts.map +1 -0
- package/dist/components/category-tree-picker/CategoryTreePicker.js +17 -0
- package/dist/components/category-tree-picker/CategoryTreePicker.js.map +1 -0
- package/dist/components/category-tree-picker/category-tree-utils.d.ts +18 -0
- package/dist/components/category-tree-picker/category-tree-utils.d.ts.map +1 -0
- package/dist/components/category-tree-picker/category-tree-utils.js +17 -0
- package/dist/components/category-tree-picker/category-tree-utils.js.map +1 -0
- package/dist/components/category-tree-picker/index.d.ts +18 -0
- package/dist/components/category-tree-picker/index.d.ts.map +1 -0
- package/dist/components/category-tree-picker/index.js +17 -0
- package/dist/components/category-tree-picker/index.js.map +1 -0
- package/dist/components/charts/echart.d.ts +18 -0
- package/dist/components/charts/echart.d.ts.map +1 -0
- package/dist/components/charts/echart.js +17 -0
- package/dist/components/charts/echart.js.map +1 -0
- package/dist/components/cms-picker/CmsBlockPicker.d.ts +19 -0
- package/dist/components/cms-picker/CmsBlockPicker.d.ts.map +1 -0
- package/dist/components/cms-picker/CmsBlockPicker.js +18 -0
- package/dist/components/cms-picker/CmsBlockPicker.js.map +1 -0
- package/dist/components/cms-picker/CmsPagePicker.d.ts +19 -0
- package/dist/components/cms-picker/CmsPagePicker.d.ts.map +1 -0
- package/dist/components/cms-picker/CmsPagePicker.js +18 -0
- package/dist/components/cms-picker/CmsPagePicker.js.map +1 -0
- package/dist/components/country-select/index.d.ts +18 -0
- package/dist/components/country-select/index.d.ts.map +1 -0
- package/dist/components/country-select/index.js +17 -0
- package/dist/components/country-select/index.js.map +1 -0
- package/dist/components/customer-group-picker/CustomerGroupPicker.d.ts +18 -0
- package/dist/components/customer-group-picker/CustomerGroupPicker.d.ts.map +1 -0
- package/dist/components/customer-group-picker/CustomerGroupPicker.js +17 -0
- package/dist/components/customer-group-picker/CustomerGroupPicker.js.map +1 -0
- package/dist/components/customer-picker/CustomerPicker.d.ts +18 -0
- package/dist/components/customer-picker/CustomerPicker.d.ts.map +1 -0
- package/dist/components/customer-picker/CustomerPicker.js +17 -0
- package/dist/components/customer-picker/CustomerPicker.js.map +1 -0
- package/dist/components/hooks/useFocusTrap.d.ts +17 -0
- package/dist/components/hooks/useFocusTrap.d.ts.map +1 -0
- package/dist/components/hooks/useFocusTrap.js +17 -0
- package/dist/components/hooks/useFocusTrap.js.map +1 -0
- package/dist/components/hooks/useSpeechToText.d.ts +15 -0
- package/dist/components/hooks/useSpeechToText.d.ts.map +1 -0
- package/dist/components/hooks/useSpeechToText.js +63 -0
- package/dist/components/hooks/useSpeechToText.js.map +1 -0
- package/dist/components/hooks/useViewportTier.d.ts +18 -0
- package/dist/components/hooks/useViewportTier.d.ts.map +1 -0
- package/dist/components/hooks/useViewportTier.js +17 -0
- package/dist/components/hooks/useViewportTier.js.map +1 -0
- package/dist/components/notifications/NotificationBell.d.ts +13 -0
- package/dist/components/notifications/NotificationBell.d.ts.map +1 -0
- package/dist/components/notifications/NotificationBell.js +154 -0
- package/dist/components/notifications/NotificationBell.js.map +1 -0
- package/dist/components/notifications/index.d.ts +3 -0
- package/dist/components/notifications/index.d.ts.map +1 -0
- package/dist/components/notifications/index.js +3 -0
- package/dist/components/notifications/index.js.map +1 -0
- package/dist/components/notifications/useAdminNotifications.d.ts +41 -0
- package/dist/components/notifications/useAdminNotifications.d.ts.map +1 -0
- package/dist/components/notifications/useAdminNotifications.js +86 -0
- package/dist/components/notifications/useAdminNotifications.js.map +1 -0
- package/dist/components/organization-picker/OrganizationPicker.d.ts +19 -0
- package/dist/components/organization-picker/OrganizationPicker.d.ts.map +1 -0
- package/dist/components/organization-picker/OrganizationPicker.js +18 -0
- package/dist/components/organization-picker/OrganizationPicker.js.map +1 -0
- package/dist/components/organization-picker/OrganizationPickerMulti.d.ts +19 -0
- package/dist/components/organization-picker/OrganizationPickerMulti.d.ts.map +1 -0
- package/dist/components/organization-picker/OrganizationPickerMulti.js +18 -0
- package/dist/components/organization-picker/OrganizationPickerMulti.js.map +1 -0
- package/dist/components/organization-picker/OrganizationStatusBadge.d.ts +19 -0
- package/dist/components/organization-picker/OrganizationStatusBadge.d.ts.map +1 -0
- package/dist/components/organization-picker/OrganizationStatusBadge.js +18 -0
- package/dist/components/organization-picker/OrganizationStatusBadge.js.map +1 -0
- package/dist/components/organization-picker/index.d.ts +19 -0
- package/dist/components/organization-picker/index.d.ts.map +1 -0
- package/dist/components/organization-picker/index.js +18 -0
- package/dist/components/organization-picker/index.js.map +1 -0
- package/dist/components/organization-picker/useOrganizationsQuery.d.ts +19 -0
- package/dist/components/organization-picker/useOrganizationsQuery.d.ts.map +1 -0
- package/dist/components/organization-picker/useOrganizationsQuery.js +18 -0
- package/dist/components/organization-picker/useOrganizationsQuery.js.map +1 -0
- package/dist/components/payment-method-availability/MethodAvailabilityCell.d.ts +17 -0
- package/dist/components/payment-method-availability/MethodAvailabilityCell.d.ts.map +1 -0
- package/dist/components/payment-method-availability/MethodAvailabilityCell.js +17 -0
- package/dist/components/payment-method-availability/MethodAvailabilityCell.js.map +1 -0
- package/dist/components/prompt-actions/PromptModePanel.d.ts +24 -0
- package/dist/components/prompt-actions/PromptModePanel.d.ts.map +1 -0
- package/dist/components/prompt-actions/PromptModePanel.js +115 -0
- package/dist/components/prompt-actions/PromptModePanel.js.map +1 -0
- package/dist/components/prompt-actions/PromptPlanPreview.d.ts +20 -0
- package/dist/components/prompt-actions/PromptPlanPreview.d.ts.map +1 -0
- package/dist/components/prompt-actions/PromptPlanPreview.js +12 -0
- package/dist/components/prompt-actions/PromptPlanPreview.js.map +1 -0
- package/dist/components/reorder/ReorderAnnouncer.d.ts +18 -0
- package/dist/components/reorder/ReorderAnnouncer.d.ts.map +1 -0
- package/dist/components/reorder/ReorderAnnouncer.js +17 -0
- package/dist/components/reorder/ReorderAnnouncer.js.map +1 -0
- package/dist/components/reorder/useReorderList.d.ts +18 -0
- package/dist/components/reorder/useReorderList.d.ts.map +1 -0
- package/dist/components/reorder/useReorderList.js +17 -0
- package/dist/components/reorder/useReorderList.js.map +1 -0
- package/dist/components/rule-builder/RuleBuilder.d.ts +18 -0
- package/dist/components/rule-builder/RuleBuilder.d.ts.map +1 -0
- package/dist/components/rule-builder/RuleBuilder.js +17 -0
- package/dist/components/rule-builder/RuleBuilder.js.map +1 -0
- package/dist/components/sales-channel-picker/SalesChannelPicker.d.ts +19 -0
- package/dist/components/sales-channel-picker/SalesChannelPicker.d.ts.map +1 -0
- package/dist/components/sales-channel-picker/SalesChannelPicker.js +18 -0
- package/dist/components/sales-channel-picker/SalesChannelPicker.js.map +1 -0
- package/dist/components/scope-notice/ScopeNotice.d.ts +18 -0
- package/dist/components/scope-notice/ScopeNotice.d.ts.map +1 -0
- package/dist/components/scope-notice/ScopeNotice.js +17 -0
- package/dist/components/scope-notice/ScopeNotice.js.map +1 -0
- package/dist/components/ui/alert.d.ts +18 -0
- package/dist/components/ui/alert.d.ts.map +1 -0
- package/dist/components/ui/alert.js +17 -0
- package/dist/components/ui/alert.js.map +1 -0
- package/dist/components/ui/badge.d.ts +18 -0
- package/dist/components/ui/badge.d.ts.map +1 -0
- package/dist/components/ui/badge.js +17 -0
- package/dist/components/ui/badge.js.map +1 -0
- package/dist/components/ui/button.d.ts +18 -0
- package/dist/components/ui/button.d.ts.map +1 -0
- package/dist/components/ui/button.js +17 -0
- package/dist/components/ui/button.js.map +1 -0
- package/dist/components/ui/card.d.ts +17 -0
- package/dist/components/ui/card.d.ts.map +1 -0
- package/dist/components/ui/card.js +17 -0
- package/dist/components/ui/card.js.map +1 -0
- package/dist/components/ui/checkbox.d.ts +17 -0
- package/dist/components/ui/checkbox.d.ts.map +1 -0
- package/dist/components/ui/checkbox.js +17 -0
- package/dist/components/ui/checkbox.js.map +1 -0
- package/dist/components/ui/collapsible.d.ts +5 -0
- package/dist/components/ui/collapsible.d.ts.map +1 -0
- package/dist/components/ui/collapsible.js +5 -0
- package/dist/components/ui/collapsible.js.map +1 -0
- package/dist/components/ui/color-picker.d.ts +17 -0
- package/dist/components/ui/color-picker.d.ts.map +1 -0
- package/dist/components/ui/color-picker.js +17 -0
- package/dist/components/ui/color-picker.js.map +1 -0
- package/dist/components/ui/combobox.d.ts +18 -0
- package/dist/components/ui/combobox.d.ts.map +1 -0
- package/dist/components/ui/combobox.js +17 -0
- package/dist/components/ui/combobox.js.map +1 -0
- package/dist/components/ui/input.d.ts +17 -0
- package/dist/components/ui/input.d.ts.map +1 -0
- package/dist/components/ui/input.js +17 -0
- package/dist/components/ui/input.js.map +1 -0
- package/dist/components/ui/label.d.ts +17 -0
- package/dist/components/ui/label.d.ts.map +1 -0
- package/dist/components/ui/label.js +17 -0
- package/dist/components/ui/label.js.map +1 -0
- package/dist/components/ui/multi-select.d.ts +18 -0
- package/dist/components/ui/multi-select.d.ts.map +1 -0
- package/dist/components/ui/multi-select.js +17 -0
- package/dist/components/ui/multi-select.js.map +1 -0
- package/dist/components/ui/page-header.d.ts +18 -0
- package/dist/components/ui/page-header.d.ts.map +1 -0
- package/dist/components/ui/page-header.js +17 -0
- package/dist/components/ui/page-header.js.map +1 -0
- package/dist/components/ui/route-tabs.d.ts +18 -0
- package/dist/components/ui/route-tabs.d.ts.map +1 -0
- package/dist/components/ui/route-tabs.js +17 -0
- package/dist/components/ui/route-tabs.js.map +1 -0
- package/dist/components/ui/save-button-group.d.ts +18 -0
- package/dist/components/ui/save-button-group.d.ts.map +1 -0
- package/dist/components/ui/save-button-group.js +17 -0
- package/dist/components/ui/save-button-group.js.map +1 -0
- package/dist/components/ui/select.d.ts +17 -0
- package/dist/components/ui/select.d.ts.map +1 -0
- package/dist/components/ui/select.js +17 -0
- package/dist/components/ui/select.js.map +1 -0
- package/dist/components/ui/separator.d.ts +17 -0
- package/dist/components/ui/separator.d.ts.map +1 -0
- package/dist/components/ui/separator.js +17 -0
- package/dist/components/ui/separator.js.map +1 -0
- package/dist/components/ui/table.d.ts +17 -0
- package/dist/components/ui/table.d.ts.map +1 -0
- package/dist/components/ui/table.js +17 -0
- package/dist/components/ui/table.js.map +1 -0
- package/dist/components/ui/textarea.d.ts +17 -0
- package/dist/components/ui/textarea.d.ts.map +1 -0
- package/dist/components/ui/textarea.js +17 -0
- package/dist/components/ui/textarea.js.map +1 -0
- package/dist/i18n/TranslationProvider.d.ts +18 -0
- package/dist/i18n/TranslationProvider.d.ts.map +1 -0
- package/dist/i18n/TranslationProvider.js +17 -0
- package/dist/i18n/TranslationProvider.js.map +1 -0
- package/dist/i18n/app-language-context.d.ts +18 -0
- package/dist/i18n/app-language-context.d.ts.map +1 -0
- package/dist/i18n/app-language-context.js +17 -0
- package/dist/i18n/app-language-context.js.map +1 -0
- package/dist/i18n/interpolate.d.ts +17 -0
- package/dist/i18n/interpolate.d.ts.map +1 -0
- package/dist/i18n/interpolate.js +17 -0
- package/dist/i18n/interpolate.js.map +1 -0
- package/dist/i18n/language-storage.d.ts +17 -0
- package/dist/i18n/language-storage.d.ts.map +1 -0
- package/dist/i18n/language-storage.js +17 -0
- package/dist/i18n/language-storage.js.map +1 -0
- package/dist/i18n/preauth-login-copy.d.ts +36 -0
- package/dist/i18n/preauth-login-copy.d.ts.map +1 -0
- package/dist/i18n/preauth-login-copy.js +36 -0
- package/dist/i18n/preauth-login-copy.js.map +1 -0
- package/dist/i18n/resolver.d.ts +18 -0
- package/dist/i18n/resolver.d.ts.map +1 -0
- package/dist/i18n/resolver.js +17 -0
- package/dist/i18n/resolver.js.map +1 -0
- package/dist/i18n/types.d.ts +17 -0
- package/dist/i18n/types.d.ts.map +1 -0
- package/dist/i18n/types.js +2 -0
- package/dist/i18n/types.js.map +1 -0
- package/dist/i18n/useTranslation.d.ts +17 -0
- package/dist/i18n/useTranslation.d.ts.map +1 -0
- package/dist/i18n/useTranslation.js +17 -0
- package/dist/i18n/useTranslation.js.map +1 -0
- package/dist/index.d.ts +55 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +51 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/admin-actions/AdminActionsProvider.d.ts +29 -0
- package/dist/lib/admin-actions/AdminActionsProvider.d.ts.map +1 -0
- package/dist/lib/admin-actions/AdminActionsProvider.js +51 -0
- package/dist/lib/admin-actions/AdminActionsProvider.js.map +1 -0
- package/dist/lib/admin-actions/api.d.ts +10 -0
- package/dist/lib/admin-actions/api.d.ts.map +1 -0
- package/dist/lib/admin-actions/api.js +13 -0
- package/dist/lib/admin-actions/api.js.map +1 -0
- package/dist/lib/admin-actions/icon-map.d.ts +17 -0
- package/dist/lib/admin-actions/icon-map.d.ts.map +1 -0
- package/dist/lib/admin-actions/icon-map.js +17 -0
- package/dist/lib/admin-actions/icon-map.js.map +1 -0
- package/dist/lib/admin-actions/useAdminActions.d.ts +17 -0
- package/dist/lib/admin-actions/useAdminActions.d.ts.map +1 -0
- package/dist/lib/admin-actions/useAdminActions.js +34 -0
- package/dist/lib/admin-actions/useAdminActions.js.map +1 -0
- package/dist/lib/api-client.d.ts +17 -0
- package/dist/lib/api-client.d.ts.map +1 -0
- package/dist/lib/api-client.js +17 -0
- package/dist/lib/api-client.js.map +1 -0
- package/dist/lib/auth.d.ts +18 -0
- package/dist/lib/auth.d.ts.map +1 -0
- package/dist/lib/auth.js +17 -0
- package/dist/lib/auth.js.map +1 -0
- package/dist/lib/federated-sign-in/api.d.ts +4 -0
- package/dist/lib/federated-sign-in/api.d.ts.map +1 -0
- package/dist/lib/federated-sign-in/api.js +38 -0
- package/dist/lib/federated-sign-in/api.js.map +1 -0
- package/dist/lib/federated-sign-in/index.d.ts +4 -0
- package/dist/lib/federated-sign-in/index.d.ts.map +1 -0
- package/dist/lib/federated-sign-in/index.js +4 -0
- package/dist/lib/federated-sign-in/index.js.map +1 -0
- package/dist/lib/federated-sign-in/resolve.d.ts +47 -0
- package/dist/lib/federated-sign-in/resolve.d.ts.map +1 -0
- package/dist/lib/federated-sign-in/resolve.js +24 -0
- package/dist/lib/federated-sign-in/resolve.js.map +1 -0
- package/dist/lib/federated-sign-in/useFederatedSignIn.d.ts +15 -0
- package/dist/lib/federated-sign-in/useFederatedSignIn.d.ts.map +1 -0
- package/dist/lib/federated-sign-in/useFederatedSignIn.js +37 -0
- package/dist/lib/federated-sign-in/useFederatedSignIn.js.map +1 -0
- package/dist/lib/format.d.ts +17 -0
- package/dist/lib/format.d.ts.map +1 -0
- package/dist/lib/format.js +17 -0
- package/dist/lib/format.js.map +1 -0
- package/dist/lib/module-presence/index.d.ts +19 -0
- package/dist/lib/module-presence/index.d.ts.map +1 -0
- package/dist/lib/module-presence/index.js +18 -0
- package/dist/lib/module-presence/index.js.map +1 -0
- package/dist/lib/module-registry/index.d.ts +84 -0
- package/dist/lib/module-registry/index.d.ts.map +1 -0
- package/dist/lib/module-registry/index.js +104 -0
- package/dist/lib/module-registry/index.js.map +1 -0
- package/dist/lib/money.d.ts +17 -0
- package/dist/lib/money.d.ts.map +1 -0
- package/dist/lib/money.js +17 -0
- package/dist/lib/money.js.map +1 -0
- package/dist/lib/prompt-actions/api.d.ts +10 -0
- package/dist/lib/prompt-actions/api.d.ts.map +1 -0
- package/dist/lib/prompt-actions/api.js +41 -0
- package/dist/lib/prompt-actions/api.js.map +1 -0
- package/dist/lib/prompt-actions/usePromptRequest.d.ts +26 -0
- package/dist/lib/prompt-actions/usePromptRequest.d.ts.map +1 -0
- package/dist/lib/prompt-actions/usePromptRequest.js +113 -0
- package/dist/lib/prompt-actions/usePromptRequest.js.map +1 -0
- package/dist/lib/surface-visibility.d.ts +15 -0
- package/dist/lib/surface-visibility.d.ts.map +1 -0
- package/dist/lib/surface-visibility.js +14 -0
- package/dist/lib/surface-visibility.js.map +1 -0
- package/dist/lib/text-normalization.d.ts +17 -0
- package/dist/lib/text-normalization.d.ts.map +1 -0
- package/dist/lib/text-normalization.js +17 -0
- package/dist/lib/text-normalization.js.map +1 -0
- package/dist/lib/use-page-size-preference.d.ts +16 -0
- package/dist/lib/use-page-size-preference.d.ts.map +1 -0
- package/dist/lib/use-page-size-preference.js +15 -0
- package/dist/lib/use-page-size-preference.js.map +1 -0
- package/dist/lib/use-unsaved-changes-prompt.d.ts +17 -0
- package/dist/lib/use-unsaved-changes-prompt.d.ts.map +1 -0
- package/dist/lib/use-unsaved-changes-prompt.js +17 -0
- package/dist/lib/use-unsaved-changes-prompt.js.map +1 -0
- package/dist/lib/utils.d.ts +17 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/lib/utils.js +17 -0
- package/dist/lib/utils.js.map +1 -0
- package/dist/lib/uuid.d.ts +17 -0
- package/dist/lib/uuid.d.ts.map +1 -0
- package/dist/lib/uuid.js +17 -0
- package/dist/lib/uuid.js.map +1 -0
- package/dist/modules/home/HomePage.d.ts +3 -0
- package/dist/modules/home/HomePage.d.ts.map +1 -0
- package/dist/modules/home/HomePage.js +137 -0
- package/dist/modules/home/HomePage.js.map +1 -0
- package/dist/modules/home/RecentActivityCard.d.ts +3 -0
- package/dist/modules/home/RecentActivityCard.d.ts.map +1 -0
- package/dist/modules/home/RecentActivityCard.js +94 -0
- package/dist/modules/home/RecentActivityCard.js.map +1 -0
- package/dist/modules/home/activity-render.d.ts +69 -0
- package/dist/modules/home/activity-render.d.ts.map +1 -0
- package/dist/modules/home/activity-render.js +53 -0
- package/dist/modules/home/activity-render.js.map +1 -0
- package/dist/modules/home/useRecentActivity.d.ts +41 -0
- package/dist/modules/home/useRecentActivity.d.ts.map +1 -0
- package/dist/modules/home/useRecentActivity.js +57 -0
- package/dist/modules/home/useRecentActivity.js.map +1 -0
- package/dist/modules/platform/ModuleActivationControl.d.ts +28 -0
- package/dist/modules/platform/ModuleActivationControl.d.ts.map +1 -0
- package/dist/modules/platform/ModuleActivationControl.js +88 -0
- package/dist/modules/platform/ModuleActivationControl.js.map +1 -0
- package/dist/modules/platform/ModulesPage.d.ts +76 -0
- package/dist/modules/platform/ModulesPage.d.ts.map +1 -0
- package/dist/modules/platform/ModulesPage.js +175 -0
- package/dist/modules/platform/ModulesPage.js.map +1 -0
- package/dist/modules/platform/RecentActivityVisibilityControl.d.ts +38 -0
- package/dist/modules/platform/RecentActivityVisibilityControl.d.ts.map +1 -0
- package/dist/modules/platform/RecentActivityVisibilityControl.js +26 -0
- package/dist/modules/platform/RecentActivityVisibilityControl.js.map +1 -0
- package/dist/modules/platform/api.d.ts +27 -0
- package/dist/modules/platform/api.d.ts.map +1 -0
- package/dist/modules/platform/api.js +33 -0
- package/dist/modules/platform/api.js.map +1 -0
- package/dist/modules/profile/ProfilePage.d.ts +11 -0
- package/dist/modules/profile/ProfilePage.d.ts.map +1 -0
- package/dist/modules/profile/ProfilePage.js +140 -0
- package/dist/modules/profile/ProfilePage.js.map +1 -0
- package/dist/registerSw.d.ts +7 -0
- package/dist/registerSw.d.ts.map +1 -0
- package/dist/registerSw.js +20 -0
- package/dist/registerSw.js.map +1 -0
- package/package.json +74 -3
- package/tailwind.css +14 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-unsaved-changes-prompt.js","sourceRoot":"","sources":["../../src/lib/use-unsaved-changes-prompt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Re-export shim — this file's implementation now lives in
|
|
3
|
+
* `@endora-commerce/admin-kit/lib` (feature 091, Phase 1b).
|
|
4
|
+
*
|
|
5
|
+
* The design system moved into the package so that a module package's `./admin` layer
|
|
6
|
+
* can reach it by a bare specifier through an `exports` map (FR-008): `@/` is a Vite and
|
|
7
|
+
* `tsc` alias that an installed package cannot resolve. Every existing `@/…` specifier in
|
|
8
|
+
* this application arrives here and is forwarded, so nothing outside had to be rewritten
|
|
9
|
+
* — the shape feature 080 used for the platform relocation.
|
|
10
|
+
*
|
|
11
|
+
* **The forwarding is the identity, not a copy.** These names are the package's own
|
|
12
|
+
* bindings; `admin/test/kit/admin-kit-shims.test.ts` asserts reference equality across
|
|
13
|
+
* the seam, because a second React context or a second `z.enum` passes every structural
|
|
14
|
+
* comparison and still breaks at runtime.
|
|
15
|
+
*/
|
|
16
|
+
export { cn } from '@endora-commerce/admin-kit/lib';
|
|
17
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/lib/utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Re-export shim — this file's implementation now lives in
|
|
3
|
+
* `@endora-commerce/admin-kit/lib` (feature 091, Phase 1b).
|
|
4
|
+
*
|
|
5
|
+
* The design system moved into the package so that a module package's `./admin` layer
|
|
6
|
+
* can reach it by a bare specifier through an `exports` map (FR-008): `@/` is a Vite and
|
|
7
|
+
* `tsc` alias that an installed package cannot resolve. Every existing `@/…` specifier in
|
|
8
|
+
* this application arrives here and is forwarded, so nothing outside had to be rewritten
|
|
9
|
+
* — the shape feature 080 used for the platform relocation.
|
|
10
|
+
*
|
|
11
|
+
* **The forwarding is the identity, not a copy.** These names are the package's own
|
|
12
|
+
* bindings; `admin/test/kit/admin-kit-shims.test.ts` asserts reference equality across
|
|
13
|
+
* the seam, because a second React context or a second `z.enum` passes every structural
|
|
14
|
+
* comparison and still breaks at runtime.
|
|
15
|
+
*/
|
|
16
|
+
export { cn } from '@endora-commerce/admin-kit/lib';
|
|
17
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/lib/utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Re-export shim — this file's implementation now lives in
|
|
3
|
+
* `@endora-commerce/admin-kit/lib` (feature 091, Phase 1b).
|
|
4
|
+
*
|
|
5
|
+
* The design system moved into the package so that a module package's `./admin` layer
|
|
6
|
+
* can reach it by a bare specifier through an `exports` map (FR-008): `@/` is a Vite and
|
|
7
|
+
* `tsc` alias that an installed package cannot resolve. Every existing `@/…` specifier in
|
|
8
|
+
* this application arrives here and is forwarded, so nothing outside had to be rewritten
|
|
9
|
+
* — the shape feature 080 used for the platform relocation.
|
|
10
|
+
*
|
|
11
|
+
* **The forwarding is the identity, not a copy.** These names are the package's own
|
|
12
|
+
* bindings; `admin/test/kit/admin-kit-shims.test.ts` asserts reference equality across
|
|
13
|
+
* the seam, because a second React context or a second `z.enum` passes every structural
|
|
14
|
+
* comparison and still breaks at runtime.
|
|
15
|
+
*/
|
|
16
|
+
export { randomUUID } from '@endora-commerce/admin-kit/lib';
|
|
17
|
+
//# sourceMappingURL=uuid.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uuid.d.ts","sourceRoot":"","sources":["../../src/lib/uuid.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC"}
|
package/dist/lib/uuid.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Re-export shim — this file's implementation now lives in
|
|
3
|
+
* `@endora-commerce/admin-kit/lib` (feature 091, Phase 1b).
|
|
4
|
+
*
|
|
5
|
+
* The design system moved into the package so that a module package's `./admin` layer
|
|
6
|
+
* can reach it by a bare specifier through an `exports` map (FR-008): `@/` is a Vite and
|
|
7
|
+
* `tsc` alias that an installed package cannot resolve. Every existing `@/…` specifier in
|
|
8
|
+
* this application arrives here and is forwarded, so nothing outside had to be rewritten
|
|
9
|
+
* — the shape feature 080 used for the platform relocation.
|
|
10
|
+
*
|
|
11
|
+
* **The forwarding is the identity, not a copy.** These names are the package's own
|
|
12
|
+
* bindings; `admin/test/kit/admin-kit-shims.test.ts` asserts reference equality across
|
|
13
|
+
* the seam, because a second React context or a second `z.enum` passes every structural
|
|
14
|
+
* comparison and still breaks at runtime.
|
|
15
|
+
*/
|
|
16
|
+
export { randomUUID } from '@endora-commerce/admin-kit/lib';
|
|
17
|
+
//# sourceMappingURL=uuid.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uuid.js","sourceRoot":"","sources":["../../src/lib/uuid.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HomePage.d.ts","sourceRoot":"","sources":["../../../src/modules/home/HomePage.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAqF5D,wBAAgB,QAAQ,IAAI,SAAS,CA6NpC"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
import { Link, useNavigate } from 'react-router-dom';
|
|
4
|
+
import { CircleDollarSign, FileText, Plus, Upload } from 'lucide-react';
|
|
5
|
+
import { ApiError, apiClient } from '../../lib/api-client.js';
|
|
6
|
+
import { useAuth } from '../../lib/auth.js';
|
|
7
|
+
import { useSurfaceVisibility } from '../../lib/surface-visibility.js';
|
|
8
|
+
import { useTranslation } from '../../i18n/useTranslation.js';
|
|
9
|
+
import { RecentActivityCard } from './RecentActivityCard.js';
|
|
10
|
+
const INITIAL_KPIS = [
|
|
11
|
+
{ labelKey: 'home.kpi.activeProducts', value: '—', to: '/catalog/products?status=active', requiredPermission: 'catalog:read', module: 'catalog' },
|
|
12
|
+
{ labelKey: 'home.kpi.pendingQuotes', value: '—', tone: 'warn', to: '/quote-requests?status=Pending&scope=all', requiredPermission: 'rfqs:handle', module: 'quote_requests' },
|
|
13
|
+
{ labelKey: 'home.kpi.openOrders', value: '—', to: '/orders?status=new', requiredPermission: 'orders:read', module: 'orders' },
|
|
14
|
+
// `orders:read` is not a copy of the tile above it: the inventory endpoints
|
|
15
|
+
// really are gated by it (`inventory/routes.admin.ts:103`).
|
|
16
|
+
{ labelKey: 'home.kpi.outOfStock', value: '—', tone: 'danger', to: '/inventory?stock=out', requiredPermission: 'orders:read', module: 'inventory' },
|
|
17
|
+
];
|
|
18
|
+
const QUICK_ACTIONS = [
|
|
19
|
+
{ labelKey: 'home.quickActions.newProduct', icon: Plus, to: '/catalog/products/new', requiredPermission: 'catalog:write', module: 'catalog' },
|
|
20
|
+
{ labelKey: 'home.quickActions.editPricing', icon: CircleDollarSign, to: '/price-lists', requiredPermission: 'price_lists:read', module: 'price_lists' },
|
|
21
|
+
{ labelKey: 'home.quickActions.importInventory', icon: Upload, to: '/import-export', requiredPermission: 'catalog:write', module: 'import_export' },
|
|
22
|
+
{ labelKey: 'home.quickActions.convertQuote', icon: FileText, to: '/quote-requests', requiredPermission: 'rfqs:handle', module: 'quote_requests' },
|
|
23
|
+
];
|
|
24
|
+
/**
|
|
25
|
+
* The stock-alerts card is `inventory`'s whole contribution to the dashboard,
|
|
26
|
+
* and its feed (`/api/v1/admin/inventory/low-stock`) is gated by `orders:read`
|
|
27
|
+
* like the rest of that module's reads.
|
|
28
|
+
*/
|
|
29
|
+
const STOCK_ALERTS_SURFACE = {
|
|
30
|
+
module: 'inventory',
|
|
31
|
+
requiredPermission: 'orders:read',
|
|
32
|
+
};
|
|
33
|
+
export function HomePage() {
|
|
34
|
+
const t = useTranslation('core');
|
|
35
|
+
const { me } = useAuth();
|
|
36
|
+
const isVisible = useSurfaceVisibility();
|
|
37
|
+
const navigate = useNavigate();
|
|
38
|
+
const firstName = me?.adminUser.firstName?.trim() || t('home.defaultName');
|
|
39
|
+
const [kpis, setKpis] = useState(INITIAL_KPIS);
|
|
40
|
+
const [stockAlerts, setStockAlerts] = useState([]);
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
let cancelled = false;
|
|
43
|
+
void (async () => {
|
|
44
|
+
const next = INITIAL_KPIS.map((k) => ({ ...k }));
|
|
45
|
+
// Best-effort KPI fetches. Each one is independent — if any
|
|
46
|
+
// endpoint isn't wired or returns 4xx/5xx, we leave a "—".
|
|
47
|
+
//
|
|
48
|
+
// Feature 073: a tile whose module is absent is not rendered, so its
|
|
49
|
+
// fetch is skipped too. Firing it anyway would spend a request per page
|
|
50
|
+
// load to collect a 503 for a number nobody will see.
|
|
51
|
+
//
|
|
52
|
+
// Issue #230 widens that from module presence to the whole visibility
|
|
53
|
+
// predicate: the same argument holds verbatim for a 403, and the fetch
|
|
54
|
+
// and the tile now answer to one rule rather than two.
|
|
55
|
+
const forSurface = (surface, fetcher) => (isVisible(surface) ? fetcher() : Promise.resolve());
|
|
56
|
+
await Promise.all([
|
|
57
|
+
// The list endpoint paginates server-side; ask for one row so the
|
|
58
|
+
// network payload is tiny and read the live `counts.active` field
|
|
59
|
+
// (which the endpoint computes across the full product set).
|
|
60
|
+
forSurface(INITIAL_KPIS[0], () => fetchKpi('/api/v1/admin/catalog/products?pageSize=1', (data) => {
|
|
61
|
+
const counts = data.counts;
|
|
62
|
+
if (counts?.active !== undefined) {
|
|
63
|
+
next[0].value = String(counts.active);
|
|
64
|
+
}
|
|
65
|
+
})),
|
|
66
|
+
// Count only Pending requests (matching this KPI's drill-down link).
|
|
67
|
+
// `submitted` is not a valid RFQ status, so the backend rejected the
|
|
68
|
+
// filter and returned every request — Canceled/Approved/etc. included.
|
|
69
|
+
// A platform admin owns no per-user assignments, so scope the count to
|
|
70
|
+
// "all" for them (parity with the list's default Visibility filter);
|
|
71
|
+
// otherwise the tile would read 0 even with pending requests waiting.
|
|
72
|
+
forSurface(INITIAL_KPIS[1], () => fetchKpi(`/api/v1/admin/quote-requests?status=Pending${me?.role?.code === 'platform_admin' ? '&assignmentScope=all' : ''}`, (data) => {
|
|
73
|
+
const arr = data.data ?? [];
|
|
74
|
+
next[1].value = String(arr.length);
|
|
75
|
+
})),
|
|
76
|
+
forSurface(INITIAL_KPIS[2], () => fetchKpi('/api/v1/admin/orders?status=new', (data) => {
|
|
77
|
+
const arr = data.data ?? [];
|
|
78
|
+
next[2].value = String(arr.length);
|
|
79
|
+
})),
|
|
80
|
+
forSurface(INITIAL_KPIS[3], () => fetchKpi('/api/v1/admin/inventory', (data) => {
|
|
81
|
+
const k = data.data;
|
|
82
|
+
if (k?.outOfStockCount !== undefined) {
|
|
83
|
+
next[3].value = String(k.outOfStockCount);
|
|
84
|
+
}
|
|
85
|
+
})),
|
|
86
|
+
forSurface(STOCK_ALERTS_SURFACE, () => fetchKpi('/api/v1/admin/inventory/low-stock', (data) => {
|
|
87
|
+
const items = data.items ?? [];
|
|
88
|
+
if (!cancelled) {
|
|
89
|
+
setStockAlerts(items.slice(0, 5).map((i) => ({
|
|
90
|
+
productId: i.productId,
|
|
91
|
+
sku: i.productSku,
|
|
92
|
+
name: i.productName,
|
|
93
|
+
qty: i.cumulativeOnHand,
|
|
94
|
+
threshold: i.lowStockThreshold,
|
|
95
|
+
})));
|
|
96
|
+
}
|
|
97
|
+
})),
|
|
98
|
+
]);
|
|
99
|
+
if (!cancelled)
|
|
100
|
+
setKpis(next);
|
|
101
|
+
})();
|
|
102
|
+
return () => {
|
|
103
|
+
cancelled = true;
|
|
104
|
+
};
|
|
105
|
+
// One fetch pass per mount, as before. `isVisible` is deliberately not a
|
|
106
|
+
// dependency: re-running on its identity would refire every KPI request the
|
|
107
|
+
// moment module presence or the permission set re-resolves, and the tiles
|
|
108
|
+
// are a page-load snapshot, not a live feed.
|
|
109
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
110
|
+
}, []);
|
|
111
|
+
return (_jsxs("div", { className: "b2b-page b2b-page--wide", children: [_jsx("div", { className: "b2b-page-head", children: _jsxs("div", { className: "b2b-grow", children: [_jsxs("div", { className: "b2b-page-head__title", children: [t('home.welcomeBack'), ", ", _jsx("span", { style: { color: 'var(--fg-muted)', fontWeight: 500 }, children: firstName })] }), _jsx("div", { className: "b2b-page-head__sub", children: t('home.subtitle') })] }) }), _jsx("div", { className: "b2b-row b2b-kpi-grid", style: { gap: 16, marginBottom: 20 }, children: kpis.filter(isVisible).map((k) => (_jsx(Stat, { label: t(k.labelKey), value: k.value, to: k.to, ...(k.tone !== undefined ? { tone: k.tone } : {}) }, k.labelKey))) }), _jsxs("div", { className: "b2b-home-dashboard-grid", style: { display: 'grid', gridTemplateColumns: 'minmax(0, 2fr) minmax(0, 1fr)', gap: 16 }, children: [_jsx(RecentActivityCard, {}), _jsxs("div", { className: "b2b-col", style: { gap: 16 }, children: [QUICK_ACTIONS.some(isVisible) && (_jsxs("div", { className: "b2b-card", children: [_jsx("div", { className: "b2b-card__head", children: _jsx("div", { className: "b2b-card__title", children: t('home.quickActions.title') }) }), _jsx("div", { className: "b2b-card__body", children: _jsx("div", { className: "b2b-col", style: { gap: 8 }, children: QUICK_ACTIONS.filter(isVisible).map((action) => {
|
|
112
|
+
const Icon = action.icon;
|
|
113
|
+
return (_jsxs("button", { type: "button", className: "b2b-btn b2b-btn--default", style: { justifyContent: 'flex-start' }, onClick: () => { navigate(action.to); }, children: [_jsx(Icon, { size: 14 }), " ", t(action.labelKey)] }, action.to));
|
|
114
|
+
}) }) })] })), isVisible(STOCK_ALERTS_SURFACE) && (_jsxs("div", { className: "b2b-card", children: [_jsxs("div", { className: "b2b-card__head", children: [_jsxs("div", { children: [_jsx("div", { className: "b2b-card__title", children: t('home.stockAlerts.title') }), _jsx("div", { className: "b2b-card__sub", children: t('home.stockAlerts.subtitle') })] }), _jsx(Link, { to: "/inventory/low-stock", className: "b2b-btn b2b-btn--ghost b2b-btn--sm", children: t('home.stockAlerts.seeAll') })] }), _jsx("div", { className: "b2b-card__body b2b-card__body--flush", children: stockAlerts.length === 0 ? (_jsx("div", { className: "b2b-help", style: { padding: 16 }, children: t('home.stockAlerts.empty') })) : (_jsx("div", { className: "b2b-minilist", style: { padding: 4 }, children: stockAlerts.map((alert) => (_jsxs(Link, { to: `/catalog/products/${alert.productId}`, className: "b2b-minirow", style: { textDecoration: 'none', color: 'inherit' }, children: [_jsx("div", { className: "b2b-thumb", style: {
|
|
115
|
+
width: 28,
|
|
116
|
+
height: 28,
|
|
117
|
+
background: 'linear-gradient(135deg, #94a3b8cc, #94a3b888)',
|
|
118
|
+
} }), _jsxs("div", { style: { flex: 1, minWidth: 0 }, children: [_jsx("div", { style: { fontSize: 12, fontWeight: 500 }, children: alert.name }), _jsx("div", { className: "b2b-mono b2b-muted", style: { fontSize: 10 }, children: alert.sku })] }), _jsx("span", { className: alert.qty === 0 ? 'b2b-badge b2b-badge--danger' : 'b2b-badge b2b-badge--warn', children: alert.qty === 0 ? t('home.stockAlerts.out') : t('home.stockAlerts.left', { qty: alert.qty }) })] }, alert.productId))) })) })] }))] })] })] }));
|
|
119
|
+
}
|
|
120
|
+
function Stat({ label, value, tone, to, }) {
|
|
121
|
+
const color = tone === 'danger' ? 'var(--danger)' : tone === 'warn' ? 'var(--warn)' : 'var(--fg)';
|
|
122
|
+
return (_jsxs(Link, { to: to, className: "b2b-card b2b-card--clickable", style: { flex: 1, padding: 16, textDecoration: 'none', color: 'inherit' }, children: [_jsx("div", { className: "b2b-muted", style: { fontSize: 11, textTransform: 'uppercase', letterSpacing: '0.06em' }, children: label }), _jsx("div", { style: { fontSize: 26, fontWeight: 600, marginTop: 4, color }, children: value })] }));
|
|
123
|
+
}
|
|
124
|
+
async function fetchKpi(path, set) {
|
|
125
|
+
try {
|
|
126
|
+
const data = await apiClient.get(path);
|
|
127
|
+
set(data);
|
|
128
|
+
}
|
|
129
|
+
catch (err) {
|
|
130
|
+
if (!(err instanceof ApiError)) {
|
|
131
|
+
// eslint-disable-next-line no-console
|
|
132
|
+
console.warn(`KPI fetch ${path} failed`, err);
|
|
133
|
+
}
|
|
134
|
+
/* swallow — leave the placeholder */
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
//# sourceMappingURL=HomePage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HomePage.js","sourceRoot":"","sources":["../../../src/modules/home/HomePage.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAmB,MAAM,cAAc,CAAC;AACzF,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAqB,MAAM,iCAAiC,CAAC;AAC1F,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AA+B7D,MAAM,YAAY,GAAU;IAC1B,EAAE,QAAQ,EAAE,yBAAyB,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,EAAE,iCAAiC,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,EAAE,SAAS,EAAE;IACjJ,EAAE,QAAQ,EAAE,wBAAwB,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,0CAA0C,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,EAAE,gBAAgB,EAAE;IAC7K,EAAE,QAAQ,EAAE,qBAAqB,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,EAAE,QAAQ,EAAE;IAC9H,4EAA4E;IAC5E,4DAA4D;IAC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AK,KAAK,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,UAAU,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,EAAE,KAAK,EAAE,YAAG,KAAK,GAAO,IAC5E,CACR,CAAC;AACJ,CAAC;AAED,KAAK,UAAU,QAAQ,CAAC,IAAY,EAAE,GAA4B;IAChE,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,MAAM,SAAS,CAAC,GAAG,CAAU,IAAI,CAAC,CAAC;QAChD,GAAG,CAAC,IAAI,CAAC,CAAC;IACZ,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,CAAC,GAAG,YAAY,QAAQ,CAAC,EAAE,CAAC;YAC/B,sCAAsC;YACtC,OAAO,CAAC,IAAI,CAAC,aAAa,IAAI,SAAS,EAAE,GAAG,CAAC,CAAC;QAChD,CAAC;QACD,qCAAqC;IACvC,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RecentActivityCard.d.ts","sourceRoot":"","sources":["../../../src/modules/home/RecentActivityCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AA6BvC,wBAAgB,kBAAkB,IAAI,SAAS,CAsD9C"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Link } from 'react-router-dom';
|
|
3
|
+
import { useTranslation } from '../../i18n/useTranslation.js';
|
|
4
|
+
import { useTranslationContext } from '../../i18n/TranslationProvider.js';
|
|
5
|
+
import { useRecentActivity, } from './useRecentActivity.js';
|
|
6
|
+
import { formatRelative, renderActivity } from './activity-render.js';
|
|
7
|
+
/**
|
|
8
|
+
* Feature 024 — Recent Activity card on the admin home dashboard.
|
|
9
|
+
*
|
|
10
|
+
* Reads the curated `/api/v1/admin/audit-log/recent-activity` feed via
|
|
11
|
+
* `useRecentActivity()` and renders one row per audit entry with:
|
|
12
|
+
* - the action's icon + a localized verb, both declared by the module that
|
|
13
|
+
* owns the action and carried on the row (feature 080, T042j / D-163.1) —
|
|
14
|
+
* the verb is resolved in that module's own i18n namespace, which is what
|
|
15
|
+
* lets a packaged module's activity render in the operator's language
|
|
16
|
+
* - the resolved actor display name (with optional "(as customer)")
|
|
17
|
+
* - the resolved target display name + click-through link
|
|
18
|
+
* - a relative timestamp pill
|
|
19
|
+
*
|
|
20
|
+
* Handles four surface states: loading skeleton, empty, error+retry,
|
|
21
|
+
* forbidden (renders nothing — FR-031).
|
|
22
|
+
*/
|
|
23
|
+
const ROW_PLACEHOLDER_COUNT = 4;
|
|
24
|
+
export function RecentActivityCard() {
|
|
25
|
+
const t = useTranslation('core');
|
|
26
|
+
// The verb key belongs to the declaring module's namespace, not to `core`, so
|
|
27
|
+
// the row needs the scope-taking `t` as well as the card's own.
|
|
28
|
+
const { t: translateIn } = useTranslationContext();
|
|
29
|
+
const { status, items, refetch } = useRecentActivity();
|
|
30
|
+
// FR-031 — admins without `audit_log:read` see no card at all.
|
|
31
|
+
if (status === 'forbidden')
|
|
32
|
+
return null;
|
|
33
|
+
return (_jsxs("div", { className: "b2b-card", "data-testid": "recent-activity-card", children: [_jsxs("div", { className: "b2b-card__head", children: [_jsxs("div", { children: [_jsx("div", { className: "b2b-card__title", children: t('home.recentActivity.title') }), _jsx("div", { className: "b2b-card__sub", children: t('home.recentActivity.subtitle') })] }), _jsx(Link, { to: "/audit-log", className: "b2b-btn b2b-btn--ghost b2b-btn--sm", children: t('home.activity.viewAll') })] }), _jsxs("div", { className: "b2b-card__body b2b-card__body--flush", children: [status === 'loading' && _jsx(LoadingSkeleton, {}), status === 'error' && (_jsxs("div", { className: "b2b-help", style: { padding: 16, display: 'flex', justifyContent: 'space-between', alignItems: 'center', gap: 12 }, role: "alert", children: [_jsx("span", { children: t('home.activity.error') }), _jsx("button", { type: "button", className: "b2b-btn b2b-btn--default b2b-btn--sm", onClick: refetch, children: t('home.activity.retry') })] })), status === 'ready' && items.length === 0 && (_jsx("div", { className: "b2b-help", style: { padding: 16 }, children: t('home.activity.empty') })), status === 'ready' && items.length > 0 && (_jsx("div", { className: "b2b-minilist", style: { padding: 4 }, children: items.map((row) => (_jsx(ActivityRow, { row: row, t: t, translateIn: translateIn }, row.id))) }))] })] }));
|
|
34
|
+
}
|
|
35
|
+
function ActivityRow({ row, t, translateIn, }) {
|
|
36
|
+
const rendering = renderActivity(row);
|
|
37
|
+
const Icon = rendering.icon;
|
|
38
|
+
const verb = translateIn(rendering.scope, rendering.verbKey);
|
|
39
|
+
const time = formatRelative(row.actedAt);
|
|
40
|
+
const timeLabel = t(time.key, time.params);
|
|
41
|
+
// Feature 024 / US3 — a small native tooltip for bulk-summary rows so
|
|
42
|
+
// the admin can see counts on hover without rendering raw JSON.
|
|
43
|
+
// Composed as human-readable "key: value" pairs.
|
|
44
|
+
const summaryTooltip = row.summary
|
|
45
|
+
? Object.entries(row.summary)
|
|
46
|
+
.filter(([, v]) => v !== null && v !== undefined)
|
|
47
|
+
.map(([k, v]) => `${k}: ${String(v)}`)
|
|
48
|
+
.join(' · ')
|
|
49
|
+
: undefined;
|
|
50
|
+
// Compose the visible row text in two pieces so the actor stays
|
|
51
|
+
// visually distinct from the verb + target without forcing the i18n
|
|
52
|
+
// bundle to carry HTML.
|
|
53
|
+
const inner = (_jsxs(_Fragment, { children: [_jsx("div", { style: {
|
|
54
|
+
width: 28,
|
|
55
|
+
height: 28,
|
|
56
|
+
borderRadius: '50%',
|
|
57
|
+
background: 'var(--surface-sunken)',
|
|
58
|
+
display: 'grid',
|
|
59
|
+
placeItems: 'center',
|
|
60
|
+
color: 'var(--fg-muted)',
|
|
61
|
+
flexShrink: 0,
|
|
62
|
+
}, children: _jsx(Icon, { size: 13 }) }), _jsxs("div", { style: { flex: 1, minWidth: 0, fontSize: 13 }, children: [_jsx("b", { children: row.actorDisplayName }), " ", verb, ' ', _jsx("span", { className: "b2b-mono", children: row.targetDisplayName })] }), _jsx("span", { className: "b2b-muted", style: { fontSize: 11, flexShrink: 0 }, children: timeLabel })] }));
|
|
63
|
+
if (row.targetUrl) {
|
|
64
|
+
return (_jsx(Link, { to: row.targetUrl, className: "b2b-minirow", style: { textDecoration: 'none', color: 'inherit' }, "data-testid": "recent-activity-row", ...(summaryTooltip ? { title: summaryTooltip } : {}), children: inner }));
|
|
65
|
+
}
|
|
66
|
+
return (_jsx("div", { className: "b2b-minirow", style: { opacity: 0.7, cursor: 'default' }, "data-testid": "recent-activity-row", "data-disabled": "true", ...(summaryTooltip ? { title: summaryTooltip } : {}), children: inner }));
|
|
67
|
+
}
|
|
68
|
+
function LoadingSkeleton() {
|
|
69
|
+
return (_jsx("div", { className: "b2b-minilist", style: { padding: 4 }, "data-testid": "recent-activity-loading", children: Array.from({ length: ROW_PLACEHOLDER_COUNT }).map((_, idx) => (_jsxs("div", { className: "b2b-minirow", style: { opacity: 0.6 }, children: [_jsx("div", { style: {
|
|
70
|
+
width: 28,
|
|
71
|
+
height: 28,
|
|
72
|
+
borderRadius: '50%',
|
|
73
|
+
background: 'var(--surface-sunken)',
|
|
74
|
+
flexShrink: 0,
|
|
75
|
+
} }), _jsxs("div", { style: { flex: 1 }, children: [_jsx("div", { style: {
|
|
76
|
+
height: 10,
|
|
77
|
+
width: '70%',
|
|
78
|
+
background: 'var(--surface-sunken)',
|
|
79
|
+
borderRadius: 4,
|
|
80
|
+
} }), _jsx("div", { style: {
|
|
81
|
+
height: 8,
|
|
82
|
+
width: '40%',
|
|
83
|
+
background: 'var(--surface-sunken)',
|
|
84
|
+
borderRadius: 4,
|
|
85
|
+
marginTop: 6,
|
|
86
|
+
} })] }), _jsx("span", { style: {
|
|
87
|
+
width: 36,
|
|
88
|
+
height: 10,
|
|
89
|
+
background: 'var(--surface-sunken)',
|
|
90
|
+
borderRadius: 4,
|
|
91
|
+
flexShrink: 0,
|
|
92
|
+
} })] }, idx))) }));
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=RecentActivityCard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RecentActivityCard.js","sourceRoot":"","sources":["../../../src/modules/home/RecentActivityCard.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,EACL,iBAAiB,GAElB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtE;;;;;;;;;;;;;;;GAeG;AAEH,MAAM,qBAAqB,GAAG,CAAC,CAAC;AAEhC,MAAM,UAAU,kBAAkB;IAChC,MAAM,CAAC,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;IACjC,8EAA8E;IAC9E,gEAAgE;IAChE,MAAM,EAAE,CAAC,EAAE,WAAW,EAAE,GAAG,qBAAqB,EAAE,CAAC;IACnD,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,iBAAiB,EAAE,CAAC;IAEvD,+DAA+D;IAC/D,IAAI,MAAM,KAAK,WAAW;QAAE,OAAO,IAAI,CAAC;IAExC,OAAO,CACL,eAAK,SAAS,EAAC,UAAU,iBAAa,sBAAsB,aAC1D,eAAK,SAAS,EAAC,gBAAgB,aAC7B,0BACE,cAAK,SAAS,EAAC,iBAAiB,YAAE,CAAC,CAAC,2BAA2B,CAAC,GAAO,EACvE,cAAK,SAAS,EAAC,eAAe,YAAE,CAAC,CAAC,8BAA8B,CAAC,GAAO,IACpE,EACN,KAAC,IAAI,IAAC,EAAE,EAAC,YAAY,EAAC,SAAS,EAAC,oCAAoC,YACjE,CAAC,CAAC,uBAAuB,CAAC,GACtB,IACH,EACN,eAAK,SAAS,EAAC,sCAAsC,aAClD,MAAM,KAAK,SAAS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AU,EAAE,CAAC;qBACd,GACD,EACF,eAAK,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,aACrB,cACE,KAAK,EAAE;gCACL,MAAM,EAAE,EAAE;gCACV,KAAK,EAAE,KAAK;gCACZ,UAAU,EAAE,uBAAuB;gCACnC,YAAY,EAAE,CAAC;6BAChB,GACD,EACF,cACE,KAAK,EAAE;gCACL,MAAM,EAAE,CAAC;gCACT,KAAK,EAAE,KAAK;gCACZ,UAAU,EAAE,uBAAuB;gCACnC,YAAY,EAAE,CAAC;gCACf,SAAS,EAAE,CAAC;6BACb,GACD,IACE,EACN,eACE,KAAK,EAAE;wBACL,KAAK,EAAE,EAAE;wBACT,MAAM,EAAE,EAAE;wBACV,UAAU,EAAE,uBAAuB;wBACnC,YAAY,EAAE,CAAC;wBACf,UAAU,EAAE,CAAC;qBACd,GACD,KArCM,GAAG,CAsCP,CACP,CAAC,GACE,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { LucideIcon } from 'lucide-react';
|
|
2
|
+
/**
|
|
3
|
+
* Feature 024, rewritten by feature 080's T042j (D-163.1).
|
|
4
|
+
*
|
|
5
|
+
* **This file used to be one of the four hand-maintained action tables.**
|
|
6
|
+
* `ACTIVITY_RENDERING` was a 22-entry map from an audit token to a lucide
|
|
7
|
+
* import and an i18n key under the `core` scope, and it was the fourth copy of
|
|
8
|
+
* a list the server kept three of. Two consequences, both measured rather than
|
|
9
|
+
* predicted:
|
|
10
|
+
*
|
|
11
|
+
* - `prompt_action.execute` was in the server's allow-list and its prefix map
|
|
12
|
+
* and absent from here, so every prompt-assistant row on the dashboard drew
|
|
13
|
+
* the unknown-verb fallback — for as long as feature 043 had shipped;
|
|
14
|
+
* - a module the SPA was not built with could not be in it at all, so a
|
|
15
|
+
* packaged module's row was unrenderable even once the server learned to
|
|
16
|
+
* return it.
|
|
17
|
+
*
|
|
18
|
+
* The rendering now travels **on the item**: the server reads the declaring
|
|
19
|
+
* module's `recentActivity` manifest export and puts its `icon` and its
|
|
20
|
+
* module-namespace-relative `labelKey` on every row. So the icon comes from the
|
|
21
|
+
* one `icon-map.ts` this app already has — a closed allowlist a package cannot
|
|
22
|
+
* escape — and the verb is resolved in the declaring module's own i18n
|
|
23
|
+
* namespace, which is where a package ships its translations.
|
|
24
|
+
*
|
|
25
|
+
* There is nothing left here to add an entry to, which is the point.
|
|
26
|
+
*/
|
|
27
|
+
export interface ActivityRendering {
|
|
28
|
+
icon: LucideIcon;
|
|
29
|
+
/** Scope for the verb lookup: the declaring module's i18n namespace. */
|
|
30
|
+
scope: string;
|
|
31
|
+
/** Key within that scope, e.g. `activity.verb.product.create`. */
|
|
32
|
+
verbKey: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The one rendering this app still owns: a row whose declaration it could not
|
|
36
|
+
* read.
|
|
37
|
+
*
|
|
38
|
+
* It is reachable only across a version skew — a server that stopped declaring
|
|
39
|
+
* a token between the fetch and the render — and it is kept because a card that
|
|
40
|
+
* throws on one unknown row is worse than one that says less about it. The verb
|
|
41
|
+
* is `core`'s, because there is no module to ask.
|
|
42
|
+
*/
|
|
43
|
+
export declare const UNKNOWN_RENDERING: ActivityRendering;
|
|
44
|
+
/** What the server said to render for this row. */
|
|
45
|
+
export interface ActivityRenderingSource {
|
|
46
|
+
module: string;
|
|
47
|
+
icon: string;
|
|
48
|
+
labelKey: string;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Resolve the icon + the (scope, key) pair for one row.
|
|
52
|
+
*
|
|
53
|
+
* `resolveIcon` already falls back to a generic glyph for a name this build
|
|
54
|
+
* does not know, so an icon is never a reason to drop a row. A missing
|
|
55
|
+
* `labelKey` or `module` is: without either there is nothing to look the verb
|
|
56
|
+
* up under, and the placeholder the i18n resolver would render
|
|
57
|
+
* (`.` + an empty key) is worse than the honest fallback.
|
|
58
|
+
*/
|
|
59
|
+
export declare function renderActivity(row: ActivityRenderingSource): ActivityRendering;
|
|
60
|
+
/**
|
|
61
|
+
* Pure formatter — relative-time pill for an ISO 8601 timestamp.
|
|
62
|
+
* Returns the i18n key + interpolation params for the caller's `t(...)`.
|
|
63
|
+
* Separated from the component so it is unit-testable without a DOM.
|
|
64
|
+
*/
|
|
65
|
+
export declare function formatRelative(actedAtIso: string, now?: number): {
|
|
66
|
+
key: string;
|
|
67
|
+
params?: Record<string, string | number>;
|
|
68
|
+
};
|
|
69
|
+
//# sourceMappingURL=activity-render.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"activity-render.d.ts","sourceRoot":"","sources":["../../../src/modules/home/activity-render.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG/C;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,UAAU,CAAC;IACjB,wEAAwE;IACxE,KAAK,EAAE,MAAM,CAAC;IACd,kEAAkE;IAClE,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,iBAAiB,EAAE,iBAI/B,CAAC;AAEF,mDAAmD;AACnD,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,uBAAuB,GAAG,iBAAiB,CAG9E;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,SAAa,GAAG;IACpE,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;CAC1C,CAYA"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { resolveIcon } from '../../lib/admin-actions/icon-map.js';
|
|
2
|
+
/**
|
|
3
|
+
* The one rendering this app still owns: a row whose declaration it could not
|
|
4
|
+
* read.
|
|
5
|
+
*
|
|
6
|
+
* It is reachable only across a version skew — a server that stopped declaring
|
|
7
|
+
* a token between the fetch and the render — and it is kept because a card that
|
|
8
|
+
* throws on one unknown row is worse than one that says less about it. The verb
|
|
9
|
+
* is `core`'s, because there is no module to ask.
|
|
10
|
+
*/
|
|
11
|
+
export const UNKNOWN_RENDERING = {
|
|
12
|
+
icon: resolveIcon('Activity'),
|
|
13
|
+
scope: 'core',
|
|
14
|
+
verbKey: 'home.activity.verb.unknown',
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Resolve the icon + the (scope, key) pair for one row.
|
|
18
|
+
*
|
|
19
|
+
* `resolveIcon` already falls back to a generic glyph for a name this build
|
|
20
|
+
* does not know, so an icon is never a reason to drop a row. A missing
|
|
21
|
+
* `labelKey` or `module` is: without either there is nothing to look the verb
|
|
22
|
+
* up under, and the placeholder the i18n resolver would render
|
|
23
|
+
* (`.` + an empty key) is worse than the honest fallback.
|
|
24
|
+
*/
|
|
25
|
+
export function renderActivity(row) {
|
|
26
|
+
if (!row.labelKey || !row.module)
|
|
27
|
+
return UNKNOWN_RENDERING;
|
|
28
|
+
return { icon: resolveIcon(row.icon), scope: row.module, verbKey: row.labelKey };
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Pure formatter — relative-time pill for an ISO 8601 timestamp.
|
|
32
|
+
* Returns the i18n key + interpolation params for the caller's `t(...)`.
|
|
33
|
+
* Separated from the component so it is unit-testable without a DOM.
|
|
34
|
+
*/
|
|
35
|
+
export function formatRelative(actedAtIso, now = Date.now()) {
|
|
36
|
+
const acted = Date.parse(actedAtIso);
|
|
37
|
+
if (!Number.isFinite(acted))
|
|
38
|
+
return { key: 'home.activity.time.justNow' };
|
|
39
|
+
const deltaMs = Math.max(0, now - acted);
|
|
40
|
+
if (deltaMs < 60_000)
|
|
41
|
+
return { key: 'home.activity.time.justNow' };
|
|
42
|
+
const minutes = Math.floor(deltaMs / 60_000);
|
|
43
|
+
if (minutes < 60)
|
|
44
|
+
return { key: 'home.activity.time.minutesAgo', params: { count: minutes } };
|
|
45
|
+
const hours = Math.floor(minutes / 60);
|
|
46
|
+
if (hours < 24)
|
|
47
|
+
return { key: 'home.activity.time.hoursAgo', params: { count: hours } };
|
|
48
|
+
const days = Math.floor(hours / 24);
|
|
49
|
+
if (days === 1)
|
|
50
|
+
return { key: 'home.activity.time.yesterday' };
|
|
51
|
+
return { key: 'home.activity.time.daysAgo', params: { count: days } };
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=activity-render.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"activity-render.js","sourceRoot":"","sources":["../../../src/modules/home/activity-render.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAoClE;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAsB;IAClD,IAAI,EAAE,WAAW,CAAC,UAAU,CAAC;IAC7B,KAAK,EAAE,MAAM;IACb,OAAO,EAAE,4BAA4B;CACtC,CAAC;AASF;;;;;;;;GAQG;AACH,MAAM,UAAU,cAAc,CAAC,GAA4B;IACzD,IAAI,CAAC,GAAG,CAAC,QAAQ,IAAI,CAAC,GAAG,CAAC,MAAM;QAAE,OAAO,iBAAiB,CAAC;IAC3D,OAAO,EAAE,IAAI,EAAE,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,EAAE,GAAG,CAAC,QAAQ,EAAE,CAAC;AACnF,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,UAAkB,EAAE,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE;IAIjE,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IACrC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,EAAE,GAAG,EAAE,4BAA4B,EAAE,CAAC;IAC1E,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,GAAG,KAAK,CAAC,CAAC;IACzC,IAAI,OAAO,GAAG,MAAM;QAAE,OAAO,EAAE,GAAG,EAAE,4BAA4B,EAAE,CAAC;IACnE,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC,CAAC;IAC7C,IAAI,OAAO,GAAG,EAAE;QAAE,OAAO,EAAE,GAAG,EAAE,+BAA+B,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,CAAC;IAC9F,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,EAAE,CAAC,CAAC;IACvC,IAAI,KAAK,GAAG,EAAE;QAAE,OAAO,EAAE,GAAG,EAAE,6BAA6B,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC;IACxF,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,EAAE,CAAC,CAAC;IACpC,IAAI,IAAI,KAAK,CAAC;QAAE,OAAO,EAAE,GAAG,EAAE,8BAA8B,EAAE,CAAC;IAC/D,OAAO,EAAE,GAAG,EAAE,4BAA4B,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC;AACxE,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Feature 024 — admin-side hook that fetches the dashboard's curated
|
|
3
|
+
* Recent Activity feed and keeps it fresh.
|
|
4
|
+
*
|
|
5
|
+
* Mirrors the existing HomePage KPI-fetch pattern (no @tanstack/react-query
|
|
6
|
+
* dep in this app — Constitution Principle IV). Refreshes on mount, on
|
|
7
|
+
* tab refocus, and on a 30-second foreground interval — exactly what
|
|
8
|
+
* spec FR-027 / FR-028 require.
|
|
9
|
+
*/
|
|
10
|
+
export interface RecentActivityItem {
|
|
11
|
+
id: string;
|
|
12
|
+
actedAt: string;
|
|
13
|
+
action: string;
|
|
14
|
+
/**
|
|
15
|
+
* The module that declared this action token.
|
|
16
|
+
*
|
|
17
|
+
* A plain string since feature 080's T042j: it was a union of three core
|
|
18
|
+
* module ids, one of four hand-maintained tables D-163.1 retired, and a
|
|
19
|
+
* closed union is exactly why a packaged module's row could not appear on
|
|
20
|
+
* this card. It doubles as the i18n scope the verb is resolved in.
|
|
21
|
+
*/
|
|
22
|
+
module: string;
|
|
23
|
+
/** Icon name from the platform's closed allowlist; see `icon-map.ts`. */
|
|
24
|
+
icon: string;
|
|
25
|
+
/** Verb key, relative to `module`'s i18n namespace. */
|
|
26
|
+
labelKey: string;
|
|
27
|
+
actorDisplayName: string;
|
|
28
|
+
actorKind: 'admin' | 'system';
|
|
29
|
+
targetType: string;
|
|
30
|
+
targetId: string;
|
|
31
|
+
targetDisplayName: string;
|
|
32
|
+
targetUrl: string | null;
|
|
33
|
+
summary: Record<string, unknown> | null;
|
|
34
|
+
}
|
|
35
|
+
export interface UseRecentActivityState {
|
|
36
|
+
status: 'loading' | 'ready' | 'error' | 'forbidden';
|
|
37
|
+
items: RecentActivityItem[];
|
|
38
|
+
refetch: () => void;
|
|
39
|
+
}
|
|
40
|
+
export declare function useRecentActivity(limit?: number): UseRecentActivityState;
|
|
41
|
+
//# sourceMappingURL=useRecentActivity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useRecentActivity.d.ts","sourceRoot":"","sources":["../../../src/modules/home/useRecentActivity.ts"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AAEH,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf;;;;;;;OAOG;IACH,MAAM,EAAE,MAAM,CAAC;IACf,yEAAyE;IACzE,IAAI,EAAE,MAAM,CAAC;IACb,uDAAuD;IACvD,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,EAAE,MAAM,CAAC;IACzB,SAAS,EAAE,OAAO,GAAG,QAAQ,CAAC;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;CACzC;AAOD,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,SAAS,GAAG,OAAO,GAAG,OAAO,GAAG,WAAW,CAAC;IACpD,KAAK,EAAE,kBAAkB,EAAE,CAAC;IAC5B,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAID,wBAAgB,iBAAiB,CAAC,KAAK,SAAI,GAAG,sBAAsB,CAqDnE"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
|
+
import { ApiError, apiClient } from '../../lib/api-client.js';
|
|
3
|
+
const REFRESH_INTERVAL_MS = 30_000;
|
|
4
|
+
export function useRecentActivity(limit = 8) {
|
|
5
|
+
const [items, setItems] = useState([]);
|
|
6
|
+
const [status, setStatus] = useState('loading');
|
|
7
|
+
// Tracks whether the first response has landed so subsequent silent
|
|
8
|
+
// background refreshes don't blink the loading skeleton in the user's face.
|
|
9
|
+
const hasLoadedRef = useRef(false);
|
|
10
|
+
const fetchOnce = useCallback(async () => {
|
|
11
|
+
try {
|
|
12
|
+
const res = await apiClient.get(`/api/v1/admin/audit-log/recent-activity?limit=${limit}`);
|
|
13
|
+
setItems(res.data);
|
|
14
|
+
setStatus('ready');
|
|
15
|
+
hasLoadedRef.current = true;
|
|
16
|
+
}
|
|
17
|
+
catch (err) {
|
|
18
|
+
if (err instanceof ApiError && (err.status === 401 || err.status === 403)) {
|
|
19
|
+
setStatus('forbidden');
|
|
20
|
+
hasLoadedRef.current = true;
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
// Only escalate to the visible error state when the user has not
|
|
24
|
+
// already seen a successful render. Background-refresh errors keep
|
|
25
|
+
// the previous rows on screen.
|
|
26
|
+
if (!hasLoadedRef.current)
|
|
27
|
+
setStatus('error');
|
|
28
|
+
}
|
|
29
|
+
}, [limit]);
|
|
30
|
+
const refetch = useCallback(() => {
|
|
31
|
+
void fetchOnce();
|
|
32
|
+
}, [fetchOnce]);
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
let cancelled = false;
|
|
35
|
+
const tick = async () => {
|
|
36
|
+
if (!cancelled)
|
|
37
|
+
await fetchOnce();
|
|
38
|
+
};
|
|
39
|
+
void tick();
|
|
40
|
+
const intervalId = window.setInterval(() => {
|
|
41
|
+
if (document.visibilityState === 'visible')
|
|
42
|
+
void tick();
|
|
43
|
+
}, REFRESH_INTERVAL_MS);
|
|
44
|
+
const onVisibility = () => {
|
|
45
|
+
if (document.visibilityState === 'visible')
|
|
46
|
+
void tick();
|
|
47
|
+
};
|
|
48
|
+
document.addEventListener('visibilitychange', onVisibility);
|
|
49
|
+
return () => {
|
|
50
|
+
cancelled = true;
|
|
51
|
+
window.clearInterval(intervalId);
|
|
52
|
+
document.removeEventListener('visibilitychange', onVisibility);
|
|
53
|
+
};
|
|
54
|
+
}, [fetchOnce]);
|
|
55
|
+
return { status, items, refetch };
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=useRecentActivity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useRecentActivity.js","sourceRoot":"","sources":["../../../src/modules/home/useRecentActivity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,SAAS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