@object-ui/app-shell 6.2.3 → 7.0.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/CHANGELOG.md +948 -0
- package/README.md +292 -0
- package/dist/assistant/assistantBus.d.ts +72 -0
- package/dist/assistant/assistantBus.js +133 -0
- package/dist/chrome/CommandPalette.d.ts +1 -1
- package/dist/chrome/CommandPalette.js +26 -22
- package/dist/chrome/ConditionalAuthWrapper.d.ts +1 -1
- package/dist/chrome/ConsoleToaster.d.ts +1 -1
- package/dist/chrome/ConsoleToaster.js +3 -1
- package/dist/chrome/ErrorBoundary.d.ts +1 -1
- package/dist/chrome/KeyboardShortcutsDialog.d.ts +1 -1
- package/dist/chrome/KeyboardShortcutsDialog.js +16 -5
- package/dist/chrome/LoadingScreen.d.ts +1 -1
- package/dist/chrome/LoadingScreen.js +22 -26
- package/dist/chrome/RouteFader.d.ts +1 -1
- package/dist/chrome/ThemeProvider.d.ts +1 -1
- package/dist/components/ManagedByBadge.d.ts +1 -1
- package/dist/console/AppContent.d.ts +1 -1
- package/dist/console/AppContent.js +170 -37
- package/dist/console/ConsoleShell.d.ts +7 -7
- package/dist/console/ConsoleShell.js +32 -3
- package/dist/console/ai/AiChatPage.d.ts +88 -1
- package/dist/console/ai/AiChatPage.js +743 -66
- package/dist/console/ai/ConversationsSidebar.d.ts +26 -1
- package/dist/console/ai/ConversationsSidebar.js +149 -34
- package/dist/console/ai/LiveCanvas.d.ts +22 -0
- package/dist/console/ai/LiveCanvas.js +78 -0
- package/dist/console/ai/reconcileTurn.d.ts +8 -0
- package/dist/console/ai/reconcileTurn.js +20 -0
- package/dist/console/auth/AuthPageLayout.d.ts +1 -1
- package/dist/console/auth/ForgotPasswordPage.d.ts +1 -1
- package/dist/console/auth/LoginPage.d.ts +1 -1
- package/dist/console/auth/RegisterPage.d.ts +1 -1
- package/dist/console/auth/RegisterPage.js +23 -3
- package/dist/console/cloud-connection/CloudConnectionPanel.d.ts +1 -0
- package/dist/console/cloud-connection/CloudConnectionPanel.js +169 -0
- package/dist/console/home/AppCard.d.ts +1 -1
- package/dist/console/home/AppCard.js +6 -12
- package/dist/console/home/HomeAppsStrip.d.ts +8 -0
- package/dist/console/home/HomeAppsStrip.js +61 -0
- package/dist/console/home/HomeLayout.d.ts +1 -1
- package/dist/console/home/HomeLayout.js +3 -1
- package/dist/console/home/HomePage.d.ts +1 -2
- package/dist/console/home/HomePage.js +149 -21
- package/dist/console/home/HomeRail.d.ts +22 -0
- package/dist/console/home/HomeRail.js +62 -0
- package/dist/console/home/QuickActions.d.ts +1 -1
- package/dist/console/home/QuickActions.js +3 -11
- package/dist/console/home/RecentApps.d.ts +1 -1
- package/dist/console/home/RecentApps.js +2 -2
- package/dist/console/home/StarredApps.d.ts +1 -1
- package/dist/console/home/StarredApps.js +2 -2
- package/dist/console/marketplace/InstalledListWidget.d.ts +1 -0
- package/dist/console/marketplace/InstalledListWidget.js +93 -0
- package/dist/console/marketplace/MarkdownText.d.ts +1 -1
- package/dist/console/marketplace/MarketplaceAccessDenied.d.ts +1 -1
- package/dist/console/marketplace/MarketplaceInstalledPage.d.ts +8 -14
- package/dist/console/marketplace/MarketplaceInstalledPage.js +14 -66
- package/dist/console/marketplace/MarketplacePackagePage.d.ts +1 -1
- package/dist/console/marketplace/MarketplacePackagePage.js +249 -8
- package/dist/console/marketplace/MarketplacePage.d.ts +1 -1
- package/dist/console/marketplace/MarketplacePage.js +60 -3
- package/dist/console/marketplace/PackageIcon.d.ts +1 -1
- package/dist/console/marketplace/PluginDisclosure.d.ts +14 -0
- package/dist/console/marketplace/PluginDisclosure.js +38 -0
- package/dist/console/marketplace/marketplaceApi.d.ts +123 -0
- package/dist/console/marketplace/marketplaceApi.js +254 -1
- package/dist/console/organizations/CreateWorkspaceDialog.d.ts +1 -1
- package/dist/console/organizations/OrganizationsLayout.d.ts +1 -1
- package/dist/console/organizations/OrganizationsPage.d.ts +1 -1
- package/dist/console/organizations/manage/AcceptInvitationPage.d.ts +1 -1
- package/dist/console/organizations/manage/InvitationsPage.d.ts +1 -1
- package/dist/console/organizations/manage/InviteMemberDialog.d.ts +1 -1
- package/dist/console/organizations/manage/MembersPage.d.ts +1 -1
- package/dist/console/organizations/manage/OrganizationLayout.d.ts +1 -1
- package/dist/console/organizations/manage/SettingsPage.d.ts +1 -1
- package/dist/context/CommandPaletteProvider.d.ts +44 -0
- package/dist/context/CommandPaletteProvider.js +71 -0
- package/dist/context/FavoritesProvider.d.ts +1 -1
- package/dist/context/NavigationContext.d.ts +1 -1
- package/dist/context/RecentItemsProvider.d.ts +2 -2
- package/dist/context/UserStateAdapters.d.ts +1 -1
- package/dist/context/index.d.ts +2 -0
- package/dist/context/index.js +1 -0
- package/dist/hooks/index.d.ts +5 -2
- package/dist/hooks/index.js +4 -1
- package/dist/hooks/useActionModal.d.ts +53 -0
- package/dist/hooks/useActionModal.js +111 -0
- package/dist/hooks/useChatConversation.d.ts +107 -4
- package/dist/hooks/useChatConversation.js +253 -25
- package/dist/hooks/useConsoleActionRuntime.d.ts +70 -0
- package/dist/hooks/useConsoleActionRuntime.js +560 -0
- package/dist/hooks/useConversationList.js +61 -3
- package/dist/hooks/useHomeInbox.d.ts +13 -0
- package/dist/hooks/useHomeInbox.js +142 -0
- package/dist/hooks/useNavPins.js +17 -23
- package/dist/hooks/useNavigationSync.d.ts +33 -0
- package/dist/hooks/useNavigationSync.js +98 -12
- package/dist/hooks/useReconcileOnError.d.ts +40 -0
- package/dist/hooks/useReconcileOnError.js +37 -0
- package/dist/hooks/useRecordApprovals.d.ts +18 -19
- package/dist/hooks/useRecordApprovals.js +24 -40
- package/dist/hooks/useResponsiveSidebar.js +14 -5
- package/dist/hooks/useSettleSignal.d.ts +19 -0
- package/dist/hooks/useSettleSignal.js +20 -0
- package/dist/hooks/useTrackRouteAsRecent.js +35 -0
- package/dist/hooks/useUrlOverlay.d.ts +62 -0
- package/dist/hooks/useUrlOverlay.js +88 -0
- package/dist/index.d.ts +16 -7
- package/dist/index.js +12 -4
- package/dist/layout/ActivityFeed.d.ts +1 -1
- package/dist/layout/AppHeader.d.ts +3 -2
- package/dist/layout/AppHeader.js +237 -72
- package/dist/layout/AppSidebar.d.ts +2 -1
- package/dist/layout/AppSidebar.js +26 -46
- package/dist/layout/AppSwitcher.d.ts +2 -1
- package/dist/layout/AppSwitcher.js +9 -5
- package/dist/layout/AuthPageLayout.d.ts +1 -1
- package/dist/layout/ConnectionStatus.d.ts +1 -1
- package/dist/layout/ConnectionStatus.js +9 -6
- package/dist/layout/ConsoleChatbotFab.d.ts +19 -1
- package/dist/layout/ConsoleChatbotFab.js +16 -2
- package/dist/layout/ConsoleFloatingChatbot.d.ts +32 -2
- package/dist/layout/ConsoleFloatingChatbot.js +374 -41
- package/dist/layout/ConsoleLayout.d.ts +1 -1
- package/dist/layout/ConsoleLayout.js +27 -11
- package/dist/layout/ContextSelectors.d.ts +44 -0
- package/dist/layout/ContextSelectors.js +218 -0
- package/dist/layout/InboxPopover.d.ts +6 -1
- package/dist/layout/InboxPopover.js +25 -6
- package/dist/layout/LocaleSwitcher.d.ts +1 -1
- package/dist/layout/LocalizedSidebarTrigger.d.ts +2 -0
- package/dist/layout/LocalizedSidebarTrigger.js +15 -0
- package/dist/layout/MobileViewSwitcherContext.d.ts +1 -1
- package/dist/layout/ModeToggle.d.ts +1 -1
- package/dist/layout/PageHeader.d.ts +1 -1
- package/dist/layout/UnifiedSidebar.d.ts +2 -1
- package/dist/layout/UnifiedSidebar.js +116 -15
- package/dist/observability/index.d.ts +1 -0
- package/dist/observability/index.js +1 -0
- package/dist/observability/settleSignal.d.ts +64 -0
- package/dist/observability/settleSignal.js +131 -0
- package/dist/preview/DraftChangesPanel.d.ts +19 -0
- package/dist/preview/DraftChangesPanel.js +114 -0
- package/dist/preview/DraftPreviewBar.d.ts +8 -0
- package/dist/preview/DraftPreviewBar.js +86 -0
- package/dist/preview/PreviewDraftEmptyState.d.ts +16 -0
- package/dist/preview/PreviewDraftEmptyState.js +47 -0
- package/dist/preview/PreviewModeContext.d.ts +57 -0
- package/dist/preview/PreviewModeContext.js +99 -0
- package/dist/preview/UnpublishedAppBar.d.ts +8 -0
- package/dist/preview/UnpublishedAppBar.js +79 -0
- package/dist/preview/draftStatus.d.ts +20 -0
- package/dist/preview/draftStatus.js +27 -0
- package/dist/preview/usePublishAllDrafts.d.ts +18 -0
- package/dist/preview/usePublishAllDrafts.js +106 -0
- package/dist/providers/AdapterProvider.d.ts +1 -1
- package/dist/providers/AdapterProvider.js +6 -1
- package/dist/providers/ExpressionProvider.d.ts +1 -1
- package/dist/providers/MetadataProvider.d.ts +17 -2
- package/dist/providers/MetadataProvider.js +183 -12
- package/dist/runtime-config.d.ts +46 -2
- package/dist/runtime-config.js +39 -2
- package/dist/services/builtinComponents.js +68 -59
- package/dist/skeletons/SkeletonDashboard.d.ts +1 -1
- package/dist/skeletons/SkeletonDetail.d.ts +1 -1
- package/dist/skeletons/SkeletonGrid.d.ts +1 -1
- package/dist/utils/appRoute.d.ts +21 -0
- package/dist/utils/appRoute.js +25 -0
- package/dist/utils/deriveRelatedLists.d.ts +54 -0
- package/dist/utils/deriveRelatedLists.js +91 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/index.js +3 -0
- package/dist/utils/managedByEmptyState.d.ts +8 -1
- package/dist/utils/managedByEmptyState.js +13 -7
- package/dist/utils/preferLocal.d.ts +18 -0
- package/dist/utils/preferLocal.js +24 -0
- package/dist/views/ActionConfirmDialog.d.ts +1 -1
- package/dist/views/ActionConfirmDialog.js +3 -1
- package/dist/views/ActionParamDialog.d.ts +6 -1
- package/dist/views/ActionParamDialog.js +9 -3
- package/dist/views/ActionResultDialog.d.ts +13 -0
- package/dist/views/ActionResultDialog.js +134 -0
- package/dist/views/ComponentNavView.d.ts +14 -1
- package/dist/views/CreateViewDialog.d.ts +1 -1
- package/dist/views/DashboardConfigPanel.d.ts +28 -0
- package/dist/views/DashboardConfigPanel.js +81 -0
- package/dist/views/DashboardView.d.ts +4 -3
- package/dist/views/DashboardView.js +38 -239
- package/dist/views/FlowRunner.d.ts +59 -0
- package/dist/views/FlowRunner.js +153 -0
- package/dist/views/InterfaceListPage.d.ts +49 -0
- package/dist/views/InterfaceListPage.js +347 -0
- package/dist/views/MetadataInspector.d.ts +2 -2
- package/dist/views/ObjectView.d.ts +1 -1
- package/dist/views/ObjectView.js +209 -532
- package/dist/views/PageView.d.ts +8 -3
- package/dist/views/PageView.js +45 -32
- package/dist/views/RecordDetailView.d.ts +1 -1
- package/dist/views/RecordDetailView.js +363 -148
- package/dist/views/RecordFormPage.d.ts +1 -1
- package/dist/views/RecordFormPage.js +26 -1
- package/dist/views/ReportConfigPanel.d.ts +37 -0
- package/dist/views/ReportConfigPanel.js +85 -0
- package/dist/views/ReportView.d.ts +1 -1
- package/dist/views/ReportView.js +116 -7
- package/dist/views/RuntimeDraftBar.d.ts +30 -0
- package/dist/views/RuntimeDraftBar.js +112 -0
- package/dist/views/SearchResultsPage.d.ts +1 -1
- package/dist/views/SearchResultsPage.js +8 -18
- package/dist/views/ViewConfigPanel.d.ts +24 -17
- package/dist/views/ViewConfigPanel.js +121 -77
- package/dist/views/index.d.ts +1 -1
- package/dist/views/index.js +1 -1
- package/dist/views/metadata-admin/AuditPanel.d.ts +28 -0
- package/dist/views/metadata-admin/AuditPanel.js +79 -0
- package/dist/views/metadata-admin/DiagnosticsPage.d.ts +20 -0
- package/dist/views/metadata-admin/DiagnosticsPage.js +69 -0
- package/dist/views/metadata-admin/DirectoryPage.d.ts +16 -1
- package/dist/views/metadata-admin/DirectoryPage.js +113 -24
- package/dist/views/metadata-admin/DraftReviewPanel.d.ts +33 -0
- package/dist/views/metadata-admin/DraftReviewPanel.js +77 -0
- package/dist/views/metadata-admin/EmbeddedItemEditor.d.ts +17 -1
- package/dist/views/metadata-admin/EmbeddedItemEditor.js +15 -8
- package/dist/views/metadata-admin/JsonSourceEditor.d.ts +37 -0
- package/dist/views/metadata-admin/JsonSourceEditor.js +178 -0
- package/dist/views/metadata-admin/LayeredDiff.d.ts +39 -1
- package/dist/views/metadata-admin/LayeredDiff.js +171 -5
- package/dist/views/metadata-admin/MetadataDetailDrawer.d.ts +15 -1
- package/dist/views/metadata-admin/MetadataTypeActions.d.ts +48 -0
- package/dist/views/metadata-admin/MetadataTypeActions.js +165 -0
- package/dist/views/metadata-admin/PackagesPage.d.ts +18 -0
- package/dist/views/metadata-admin/PackagesPage.js +395 -0
- package/dist/views/metadata-admin/PageShell.d.ts +1 -1
- package/dist/views/metadata-admin/PageShell.js +9 -4
- package/dist/views/metadata-admin/PermissionMatrixEditor.d.ts +35 -1
- package/dist/views/metadata-admin/QuickFind.d.ts +21 -1
- package/dist/views/metadata-admin/QuickFind.js +6 -3
- package/dist/views/metadata-admin/RelatedPanel.d.ts +24 -1
- package/dist/views/metadata-admin/RelatedPanel.js +20 -18
- package/dist/views/metadata-admin/ResourceEditPage.d.ts +40 -1
- package/dist/views/metadata-admin/ResourceEditPage.js +1223 -60
- package/dist/views/metadata-admin/ResourceHistoryPage.d.ts +39 -1
- package/dist/views/metadata-admin/ResourceHistoryPage.js +66 -16
- package/dist/views/metadata-admin/ResourceListPage.d.ts +13 -1
- package/dist/views/metadata-admin/ResourceListPage.js +266 -30
- package/dist/views/metadata-admin/ResourceRouter.d.ts +23 -1
- package/dist/views/metadata-admin/SchemaForm.d.ts +34 -1
- package/dist/views/metadata-admin/SchemaForm.js +559 -49
- package/dist/views/metadata-admin/StudioHomePage.d.ts +22 -0
- package/dist/views/metadata-admin/StudioHomePage.js +213 -0
- package/dist/views/metadata-admin/anchors.js +237 -24
- package/dist/views/metadata-admin/clientValidation.d.ts +50 -0
- package/dist/views/metadata-admin/clientValidation.js +169 -0
- package/dist/views/metadata-admin/color-variant-field.d.ts +30 -0
- package/dist/views/metadata-admin/color-variant-field.js +38 -0
- package/dist/views/metadata-admin/createDerive.d.ts +75 -0
- package/dist/views/metadata-admin/createDerive.js +179 -0
- package/dist/views/metadata-admin/dashboard-schema.d.ts +12 -0
- package/dist/views/metadata-admin/dashboard-schema.js +80 -0
- package/dist/views/metadata-admin/datasource/DatasourceResourcePage.d.ts +35 -0
- package/dist/views/metadata-admin/datasource/DatasourceResourcePage.js +327 -0
- package/dist/views/metadata-admin/datasource/register.d.ts +1 -0
- package/dist/views/metadata-admin/datasource/register.js +24 -0
- package/dist/views/metadata-admin/default-inspector-registry.d.ts +49 -0
- package/dist/views/metadata-admin/default-inspector-registry.js +8 -0
- package/dist/views/metadata-admin/default-schemas.js +115 -10
- package/dist/views/metadata-admin/external/ExternalDatasourcePanel.d.ts +27 -0
- package/dist/views/metadata-admin/external/ExternalDatasourcePanel.js +69 -0
- package/dist/views/metadata-admin/external/ImportObjectDialog.d.ts +27 -0
- package/dist/views/metadata-admin/external/ImportObjectDialog.js +77 -0
- package/dist/views/metadata-admin/external/SchemaBrowser.d.ts +16 -0
- package/dist/views/metadata-admin/external/SchemaBrowser.js +74 -0
- package/dist/views/metadata-admin/external/ValidationPanel.d.ts +16 -0
- package/dist/views/metadata-admin/external/ValidationPanel.js +68 -0
- package/dist/views/metadata-admin/external/api.d.ts +100 -0
- package/dist/views/metadata-admin/external/api.js +124 -0
- package/dist/views/metadata-admin/i18n.d.ts +1 -0
- package/dist/views/metadata-admin/i18n.js +1166 -2
- package/dist/views/metadata-admin/index.d.ts +8 -5
- package/dist/views/metadata-admin/index.js +12 -2
- package/dist/views/metadata-admin/inspector-registry.d.ts +51 -0
- package/dist/views/metadata-admin/inspector-registry.js +11 -0
- package/dist/views/metadata-admin/inspectors/ActionDefaultInspector.d.ts +30 -0
- package/dist/views/metadata-admin/inspectors/ActionDefaultInspector.js +180 -0
- package/dist/views/metadata-admin/inspectors/AppNavInspector.d.ts +16 -0
- package/dist/views/metadata-admin/inspectors/AppNavInspector.js +110 -0
- package/dist/views/metadata-admin/inspectors/ConditionBuilder.d.ts +29 -0
- package/dist/views/metadata-admin/inspectors/ConditionBuilder.js +154 -0
- package/dist/views/metadata-admin/inspectors/DashboardDefaultInspector.d.ts +28 -0
- package/dist/views/metadata-admin/inspectors/DashboardDefaultInspector.js +110 -0
- package/dist/views/metadata-admin/inspectors/DashboardWidgetInspector.d.ts +18 -0
- package/dist/views/metadata-admin/inspectors/DashboardWidgetInspector.js +139 -0
- package/dist/views/metadata-admin/inspectors/DatasetDefaultInspector.d.ts +21 -0
- package/dist/views/metadata-admin/inspectors/DatasetDefaultInspector.js +107 -0
- package/dist/views/metadata-admin/inspectors/FlowEdgeInspector.d.ts +16 -0
- package/dist/views/metadata-admin/inspectors/FlowEdgeInspector.js +45 -0
- package/dist/views/metadata-admin/inspectors/FlowInspector.d.ts +12 -0
- package/dist/views/metadata-admin/inspectors/FlowInspector.js +9 -0
- package/dist/views/metadata-admin/inspectors/FlowKeyValueField.d.ts +30 -0
- package/dist/views/metadata-admin/inspectors/FlowKeyValueField.js +125 -0
- package/dist/views/metadata-admin/inspectors/FlowNodeConfigField.d.ts +18 -0
- package/dist/views/metadata-admin/inspectors/FlowNodeConfigField.js +40 -0
- package/dist/views/metadata-admin/inspectors/FlowNodeInspector.d.ts +14 -0
- package/dist/views/metadata-admin/inspectors/FlowNodeInspector.js +140 -0
- package/dist/views/metadata-admin/inspectors/FlowObjectListField.d.ts +26 -0
- package/dist/views/metadata-admin/inspectors/FlowObjectListField.js +105 -0
- package/dist/views/metadata-admin/inspectors/FlowReferenceField.d.ts +83 -0
- package/dist/views/metadata-admin/inspectors/FlowReferenceField.js +181 -0
- package/dist/views/metadata-admin/inspectors/FlowStringListField.d.ts +21 -0
- package/dist/views/metadata-admin/inspectors/FlowStringListField.js +60 -0
- package/dist/views/metadata-admin/inspectors/InspectorComboField.d.ts +40 -0
- package/dist/views/metadata-admin/inspectors/InspectorComboField.js +61 -0
- package/dist/views/metadata-admin/inspectors/ObjectDefaultInspector.d.ts +21 -0
- package/dist/views/metadata-admin/inspectors/ObjectDefaultInspector.js +54 -0
- package/dist/views/metadata-admin/inspectors/ObjectFieldInspector.d.ts +23 -0
- package/dist/views/metadata-admin/inspectors/ObjectFieldInspector.js +330 -0
- package/dist/views/metadata-admin/inspectors/PageBlockInspector.d.ts +48 -0
- package/dist/views/metadata-admin/inspectors/PageBlockInspector.js +332 -0
- package/dist/views/metadata-admin/inspectors/ReportDefaultInspector.d.ts +58 -0
- package/dist/views/metadata-admin/inspectors/ReportDefaultInspector.js +160 -0
- package/dist/views/metadata-admin/inspectors/ViewColumnInspector.d.ts +19 -0
- package/dist/views/metadata-admin/inspectors/ViewColumnInspector.js +144 -0
- package/dist/views/metadata-admin/inspectors/ViewInspector.d.ts +19 -0
- package/dist/views/metadata-admin/inspectors/ViewInspector.js +21 -0
- package/dist/views/metadata-admin/inspectors/ViewVariantInspector.d.ts +54 -0
- package/dist/views/metadata-admin/inspectors/ViewVariantInspector.js +191 -0
- package/dist/views/metadata-admin/inspectors/_shared.d.ts +124 -0
- package/dist/views/metadata-admin/inspectors/_shared.js +113 -0
- package/dist/views/metadata-admin/inspectors/expression-validate.d.ts +26 -0
- package/dist/views/metadata-admin/inspectors/expression-validate.js +66 -0
- package/dist/views/metadata-admin/inspectors/flow-node-config.d.ts +143 -0
- package/dist/views/metadata-admin/inspectors/flow-node-config.js +461 -0
- package/dist/views/metadata-admin/inspectors/index.d.ts +1 -0
- package/dist/views/metadata-admin/inspectors/index.js +45 -0
- package/dist/views/metadata-admin/inspectors/json-schema-to-fields.d.ts +40 -0
- package/dist/views/metadata-admin/inspectors/json-schema-to-fields.js +227 -0
- package/dist/views/metadata-admin/inspectors/useDatasetFields.d.ts +72 -0
- package/dist/views/metadata-admin/inspectors/useDatasetFields.js +0 -0
- package/dist/views/metadata-admin/mergeServerFields.d.ts +65 -0
- package/dist/views/metadata-admin/mergeServerFields.js +56 -0
- package/dist/views/metadata-admin/preview-registry.d.ts +55 -0
- package/dist/views/metadata-admin/previews/ActionPreview.d.ts +25 -0
- package/dist/views/metadata-admin/previews/ActionPreview.js +238 -0
- package/dist/views/metadata-admin/previews/AddWidgetPicker.d.ts +12 -0
- package/dist/views/metadata-admin/previews/AddWidgetPicker.js +56 -0
- package/dist/views/metadata-admin/previews/AgentPreview.d.ts +24 -0
- package/dist/views/metadata-admin/previews/AgentPreview.js +100 -0
- package/dist/views/metadata-admin/previews/AppNavCanvas.d.ts +31 -0
- package/dist/views/metadata-admin/previews/AppNavCanvas.js +260 -0
- package/dist/views/metadata-admin/previews/AppPreview.d.ts +16 -1
- package/dist/views/metadata-admin/previews/AppPreview.js +23 -14
- package/dist/views/metadata-admin/previews/BookPreview.d.ts +20 -0
- package/dist/views/metadata-admin/previews/BookPreview.js +132 -0
- package/dist/views/metadata-admin/previews/DashboardPreview.d.ts +16 -1
- package/dist/views/metadata-admin/previews/DashboardPreview.js +110 -8
- package/dist/views/metadata-admin/previews/DatasetPreview.d.ts +18 -0
- package/dist/views/metadata-admin/previews/DatasetPreview.js +89 -0
- package/dist/views/metadata-admin/previews/DatasourcePreview.d.ts +23 -0
- package/dist/views/metadata-admin/previews/DatasourcePreview.js +68 -0
- package/dist/views/metadata-admin/previews/EmailTemplatePreview.d.ts +14 -1
- package/dist/views/metadata-admin/previews/FieldStub.d.ts +30 -0
- package/dist/views/metadata-admin/previews/FieldStub.js +104 -0
- package/dist/views/metadata-admin/previews/FieldsListEditor.d.ts +50 -0
- package/dist/views/metadata-admin/previews/FieldsListEditor.js +97 -0
- package/dist/views/metadata-admin/previews/FlowCanvas.d.ts +43 -0
- package/dist/views/metadata-admin/previews/FlowCanvas.js +328 -0
- package/dist/views/metadata-admin/previews/FlowPreview.d.ts +20 -0
- package/dist/views/metadata-admin/previews/FlowPreview.js +92 -0
- package/dist/views/metadata-admin/previews/FlowRunsPanel.d.ts +46 -0
- package/dist/views/metadata-admin/previews/FlowRunsPanel.js +97 -0
- package/dist/views/metadata-admin/previews/FlowSimulatorPanel.d.ts +25 -0
- package/dist/views/metadata-admin/previews/FlowSimulatorPanel.js +170 -0
- package/dist/views/metadata-admin/previews/JobPreview.d.ts +28 -0
- package/dist/views/metadata-admin/previews/JobPreview.js +290 -0
- package/dist/views/metadata-admin/previews/ObjectFormCanvas.d.ts +30 -0
- package/dist/views/metadata-admin/previews/ObjectFormCanvas.js +547 -0
- package/dist/views/metadata-admin/previews/ObjectPreview.d.ts +14 -1
- package/dist/views/metadata-admin/previews/ObjectPreview.js +5 -30
- package/dist/views/metadata-admin/previews/OutlineStrip.d.ts +32 -0
- package/dist/views/metadata-admin/previews/OutlineStrip.js +8 -0
- package/dist/views/metadata-admin/previews/PageBlockCanvas.d.ts +49 -0
- package/dist/views/metadata-admin/previews/PageBlockCanvas.js +510 -0
- package/dist/views/metadata-admin/previews/PagePreview.d.ts +10 -1
- package/dist/views/metadata-admin/previews/PagePreview.js +90 -4
- package/dist/views/metadata-admin/previews/PermissionPreview.d.ts +27 -0
- package/dist/views/metadata-admin/previews/PermissionPreview.js +115 -0
- package/dist/views/metadata-admin/previews/PreviewShell.d.ts +29 -6
- package/dist/views/metadata-admin/previews/PreviewShell.js +16 -3
- package/dist/views/metadata-admin/previews/ReportPreview.d.ts +18 -1
- package/dist/views/metadata-admin/previews/ReportPreview.js +23 -15
- package/dist/views/metadata-admin/previews/RolePreview.d.ts +19 -0
- package/dist/views/metadata-admin/previews/RolePreview.js +14 -0
- package/dist/views/metadata-admin/previews/SkillPreview.d.ts +22 -0
- package/dist/views/metadata-admin/previews/SkillPreview.js +34 -0
- package/dist/views/metadata-admin/previews/ToolPreview.d.ts +25 -0
- package/dist/views/metadata-admin/previews/ToolPreview.js +122 -0
- package/dist/views/metadata-admin/previews/TranslationPreview.d.ts +25 -0
- package/dist/views/metadata-admin/previews/TranslationPreview.js +52 -0
- package/dist/views/metadata-admin/previews/ValidationPreview.d.ts +27 -0
- package/dist/views/metadata-admin/previews/ValidationPreview.js +110 -0
- package/dist/views/metadata-admin/previews/ViewColumnPanes.d.ts +62 -0
- package/dist/views/metadata-admin/previews/ViewColumnPanes.js +140 -0
- package/dist/views/metadata-admin/previews/ViewPreview.d.ts +23 -1
- package/dist/views/metadata-admin/previews/ViewPreview.js +101 -73
- package/dist/views/metadata-admin/previews/block-config.d.ts +82 -0
- package/dist/views/metadata-admin/previews/block-config.js +324 -0
- package/dist/views/metadata-admin/previews/block-types.d.ts +40 -0
- package/dist/views/metadata-admin/previews/block-types.js +110 -0
- package/dist/views/metadata-admin/previews/field-types.d.ts +53 -0
- package/dist/views/metadata-admin/previews/field-types.js +97 -0
- package/dist/views/metadata-admin/previews/flow-canvas-layout.d.ts +88 -0
- package/dist/views/metadata-admin/previews/flow-canvas-layout.js +190 -0
- package/dist/views/metadata-admin/previews/flow-canvas-parts.d.ts +88 -0
- package/dist/views/metadata-admin/previews/flow-canvas-parts.js +358 -0
- package/dist/views/metadata-admin/previews/form-preview.d.ts +24 -0
- package/dist/views/metadata-admin/previews/form-preview.js +29 -0
- package/dist/views/metadata-admin/previews/index.js +43 -0
- package/dist/views/metadata-admin/previews/object-fields-bridge.d.ts +66 -0
- package/dist/views/metadata-admin/previews/object-fields-bridge.js +171 -0
- package/dist/views/metadata-admin/previews/object-fields-io.d.ts +109 -0
- package/dist/views/metadata-admin/previews/object-fields-io.js +208 -0
- package/dist/views/metadata-admin/previews/simulator/flow-sim-types.d.ts +91 -0
- package/dist/views/metadata-admin/previews/simulator/flow-sim-types.js +2 -0
- package/dist/views/metadata-admin/previews/simulator/flow-sim-validate.d.ts +8 -0
- package/dist/views/metadata-admin/previews/simulator/flow-sim-validate.js +113 -0
- package/dist/views/metadata-admin/previews/simulator/flow-simulator.d.ts +44 -0
- package/dist/views/metadata-admin/previews/simulator/flow-simulator.js +316 -0
- package/dist/views/metadata-admin/previews/useDatasetCatalog.d.ts +47 -0
- package/dist/views/metadata-admin/previews/useDatasetCatalog.js +133 -0
- package/dist/views/metadata-admin/previews/useFlowNodePalette.d.ts +44 -0
- package/dist/views/metadata-admin/previews/useFlowNodePalette.js +124 -0
- package/dist/views/metadata-admin/previews/useMetaOptions.d.ts +8 -0
- package/dist/views/metadata-admin/previews/useMetaOptions.js +50 -0
- package/dist/views/metadata-admin/previews/useObjectFields.d.ts +23 -0
- package/dist/views/metadata-admin/previews/useObjectFields.js +79 -0
- package/dist/views/metadata-admin/previews/useObjectOptions.d.ts +8 -0
- package/dist/views/metadata-admin/previews/useObjectOptions.js +43 -0
- package/dist/views/metadata-admin/previews/view-column-io.d.ts +42 -0
- package/dist/views/metadata-admin/previews/view-column-io.js +73 -0
- package/dist/views/metadata-admin/previews/widget-types.d.ts +24 -0
- package/dist/views/metadata-admin/previews/widget-types.js +40 -0
- package/dist/views/metadata-admin/registry.d.ts +140 -19
- package/dist/views/metadata-admin/report-schema.d.ts +26 -0
- package/dist/views/metadata-admin/report-schema.js +121 -0
- package/dist/views/metadata-admin/useMetadata.d.ts +100 -2
- package/dist/views/metadata-admin/useMetadata.js +155 -4
- package/dist/views/metadata-admin/view-item-normalize.d.ts +20 -0
- package/dist/views/metadata-admin/view-item-normalize.js +68 -0
- package/dist/views/metadata-admin/view-schema.d.ts +16 -0
- package/dist/views/metadata-admin/view-schema.js +107 -0
- package/dist/views/metadata-admin/view-variant-model.d.ts +23 -0
- package/dist/views/metadata-admin/view-variant-model.js +64 -0
- package/dist/views/metadata-admin/widgets.d.ts +89 -1
- package/dist/views/metadata-admin/widgets.js +491 -17
- package/dist/views/runtime-metadata-persistence.d.ts +78 -0
- package/dist/views/runtime-metadata-persistence.js +89 -0
- package/dist/views/useOpenRecordList.d.ts +18 -0
- package/dist/views/useOpenRecordList.js +36 -0
- package/dist/views/userFilterUrlState.d.ts +15 -0
- package/dist/views/userFilterUrlState.js +53 -0
- package/dist/views/view-config-adapter.d.ts +38 -0
- package/dist/views/view-config-adapter.js +80 -0
- package/package.json +52 -34
- package/dist/views/DesignDrawer.d.ts +0 -28
- package/dist/views/DesignDrawer.js +0 -51
- package/dist/views/metadata-admin/DesignerEditorWrapper.d.ts +0 -68
- package/dist/views/metadata-admin/DesignerEditorWrapper.js +0 -158
|
@@ -0,0 +1,560 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* useConsoleActionRuntime — the reusable console "action runtime".
|
|
4
|
+
*
|
|
5
|
+
* ObjectView historically owned all the wiring needed to make schema-driven
|
|
6
|
+
* `action:button`s actually *do* something: confirm/param/result dialogs, an
|
|
7
|
+
* authenticated API caller, flow + server-action handlers, SPA navigation, and
|
|
8
|
+
* the paused screen-flow runner. SDUI pages (PageView) render the same
|
|
9
|
+
* `action:button` widgets but lacked that runtime, so their actions could not
|
|
10
|
+
* collect params, call authenticated APIs, show result dialogs, refresh, or
|
|
11
|
+
* navigate (#1605).
|
|
12
|
+
*
|
|
13
|
+
* This hook extracts that generic wiring so BOTH ObjectView and PageView can
|
|
14
|
+
* mount it. It owns the dialog state and handlers, and returns:
|
|
15
|
+
* - `actionProviderProps` — spread onto `<ActionProvider>`;
|
|
16
|
+
* - `dialogs` — the confirm/param/result/flow dialogs to render inside it;
|
|
17
|
+
* - the individual handlers (e.g. `confirmHandler`, `toastHandler`) so a
|
|
18
|
+
* caller like ObjectView can also feed them into `useObjectActions`.
|
|
19
|
+
*
|
|
20
|
+
* `objectName` is optional: pages run global (or action-scoped) actions, while
|
|
21
|
+
* ObjectView passes its current object so object-scoped actions resolve their
|
|
22
|
+
* target + param defaults.
|
|
23
|
+
*/
|
|
24
|
+
import { useCallback, useMemo, useRef, useState } from 'react';
|
|
25
|
+
import { useNavigate } from 'react-router-dom';
|
|
26
|
+
import { useAuth, createAuthenticatedFetch } from '@object-ui/auth';
|
|
27
|
+
import { useObjectLabel } from '@object-ui/i18n';
|
|
28
|
+
import { ActionProvider, useGlobalUndo } from '@object-ui/react';
|
|
29
|
+
import { toast } from 'sonner';
|
|
30
|
+
import { ActionConfirmDialog } from '../views/ActionConfirmDialog';
|
|
31
|
+
import { ActionParamDialog } from '../views/ActionParamDialog';
|
|
32
|
+
import { ActionResultDialog } from '../views/ActionResultDialog';
|
|
33
|
+
import { FlowRunner } from '../views/FlowRunner';
|
|
34
|
+
import { resolveActionParams } from '../utils/resolveActionParams';
|
|
35
|
+
const FALLBACK_USER = { id: 'current-user', name: 'Demo User', isPlatformAdmin: false };
|
|
36
|
+
export function useConsoleActionRuntime(opts) {
|
|
37
|
+
const { dataSource, objects, objectName, onRefresh } = opts;
|
|
38
|
+
const navigate = useNavigate();
|
|
39
|
+
const { user, activeOrganization } = useAuth();
|
|
40
|
+
const { fieldLabel, fieldOptionLabel, actionParamText, actionParamOptionLabel, actionDescription } = useObjectLabel();
|
|
41
|
+
const objectDef = useMemo(() => (objectName ? objects?.find((o) => o.name === objectName) : undefined), [objects, objectName]);
|
|
42
|
+
// Object name used for API paths / generic CRUD. Falls back to the action's
|
|
43
|
+
// own `objectName` (set per call below) or 'global'.
|
|
44
|
+
const objApiName = objectName || objectDef?.name;
|
|
45
|
+
const refresh = useCallback(() => { onRefresh?.(); }, [onRefresh]);
|
|
46
|
+
// Global undo/redo (Ctrl+Z / Ctrl+Shift+Z), backed by the dataSource. The
|
|
47
|
+
// success toast's "Undo" button calls `undoCtl.undo()` for `undoable` actions
|
|
48
|
+
// (the ActionRunner has already pushed the operation onto the UndoManager).
|
|
49
|
+
const undoCtl = useGlobalUndo({
|
|
50
|
+
dataSource,
|
|
51
|
+
onUndo: () => { refresh(); toast.success('Change undone'); },
|
|
52
|
+
});
|
|
53
|
+
// Promise-based confirm / param / result dialogs.
|
|
54
|
+
const [confirmState, setConfirmState] = useState({ open: false, message: '' });
|
|
55
|
+
const [paramState, setParamState] = useState({ open: false, params: [] });
|
|
56
|
+
const [resultDialogState, setResultDialogState] = useState({ open: false });
|
|
57
|
+
// A paused `screen`-node flow awaiting user input.
|
|
58
|
+
const [screenFlow, setScreenFlow] = useState(null);
|
|
59
|
+
// Guards against double-firing a server action (slow SSO handoff, etc.).
|
|
60
|
+
const serverActionInFlight = useRef(new Set());
|
|
61
|
+
const resultDialogHandler = useCallback((spec, data) => new Promise((resolve) => {
|
|
62
|
+
setResultDialogState({ open: true, spec, data, resolve });
|
|
63
|
+
}), []);
|
|
64
|
+
const confirmHandler = useCallback((message, options) => {
|
|
65
|
+
return new Promise((resolve) => {
|
|
66
|
+
setConfirmState({ open: true, message, options, resolve });
|
|
67
|
+
});
|
|
68
|
+
}, []);
|
|
69
|
+
const paramCollectionHandler = useCallback((params, action) => {
|
|
70
|
+
return new Promise((resolve) => {
|
|
71
|
+
// List_item actions stash the row record under params._rowRecord (see
|
|
72
|
+
// ObjectGrid → onRowAction). Pull it out so resolveActionParams can
|
|
73
|
+
// pre-fill `defaultFromRow` params from the row's current values.
|
|
74
|
+
const row = action?.params && !Array.isArray(action.params)
|
|
75
|
+
? action.params._rowRecord
|
|
76
|
+
: undefined;
|
|
77
|
+
const resolved = resolveActionParams(params, {
|
|
78
|
+
objectName: objectName || objectDef?.name || '',
|
|
79
|
+
objects: objects || [],
|
|
80
|
+
fieldLabel,
|
|
81
|
+
fieldOptionLabel,
|
|
82
|
+
row,
|
|
83
|
+
});
|
|
84
|
+
// Localize each param's label/placeholder/helpText via the
|
|
85
|
+
// `_actions.<action>.params.<param>.<attr>` convention.
|
|
86
|
+
const objForI18n = objectName || objectDef?.name;
|
|
87
|
+
const localized = resolved.map((p) => ({
|
|
88
|
+
...p,
|
|
89
|
+
label: actionParamText(objForI18n, action?.name, p.name, 'label', p.label) ?? p.label,
|
|
90
|
+
placeholder: actionParamText(objForI18n, action?.name, p.name, 'placeholder', p.placeholder) ?? p.placeholder,
|
|
91
|
+
helpText: actionParamText(objForI18n, action?.name, p.name, 'helpText', p.helpText) ?? p.helpText,
|
|
92
|
+
options: Array.isArray(p.options)
|
|
93
|
+
? p.options.map((o) => ({ ...o, label: actionParamOptionLabel(objForI18n, action?.name, p.name, o.value, o.label) }))
|
|
94
|
+
: p.options,
|
|
95
|
+
}));
|
|
96
|
+
setParamState({
|
|
97
|
+
open: true,
|
|
98
|
+
params: localized,
|
|
99
|
+
title: action?.label || action?.title,
|
|
100
|
+
description: actionDescription(objForI18n, action?.name, action?.description),
|
|
101
|
+
resolve,
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
}, [objectName, objectDef, objects, fieldLabel, fieldOptionLabel, actionParamText, actionParamOptionLabel]);
|
|
105
|
+
const currentUser = user
|
|
106
|
+
? { id: user.id, name: user.name, avatar: user.image, isPlatformAdmin: user?.isPlatformAdmin ?? false }
|
|
107
|
+
: FALLBACK_USER;
|
|
108
|
+
const toastHandler = useCallback((message, options) => {
|
|
109
|
+
if (options?.type === 'error') {
|
|
110
|
+
toast.error(message);
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
if (options?.undo) {
|
|
114
|
+
toast.success(message, {
|
|
115
|
+
duration: options.duration,
|
|
116
|
+
action: { label: options.undo.label || 'Undo', onClick: () => { void undoCtl.undo(); } },
|
|
117
|
+
});
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
toast.success(message, { duration: options?.duration });
|
|
121
|
+
}, [undoCtl]);
|
|
122
|
+
const navigateHandler = useCallback((url, options) => {
|
|
123
|
+
if (options?.external || options?.newTab) {
|
|
124
|
+
window.open(url, '_blank', 'noopener,noreferrer');
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
navigate(url);
|
|
128
|
+
}
|
|
129
|
+
}, [navigate]);
|
|
130
|
+
// Authenticated fetch for direct backend calls. Declared before apiHandler.
|
|
131
|
+
const authFetch = useMemo(() => createAuthenticatedFetch(), []);
|
|
132
|
+
const apiHandler = useCallback(async (action) => {
|
|
133
|
+
try {
|
|
134
|
+
const target = action.target || action.name;
|
|
135
|
+
const params = action.params || {};
|
|
136
|
+
// Absolute HTTP target — bypass dataSource and call the API directly
|
|
137
|
+
// through the authenticated fetch wrapper (Bearer + X-Tenant-ID +
|
|
138
|
+
// same-origin cookies). The canonical path for schema actions on
|
|
139
|
+
// managed-by tables and global page actions.
|
|
140
|
+
const targetStr = typeof target === 'string' ? target : '';
|
|
141
|
+
const isAbsolute = targetStr.startsWith('/') || /^https?:\/\//i.test(targetStr);
|
|
142
|
+
if (isAbsolute) {
|
|
143
|
+
const baseUrl = import.meta.env.VITE_SERVER_URL || '';
|
|
144
|
+
const rawParams = { ...params };
|
|
145
|
+
const rowRecord = rawParams._rowRecord;
|
|
146
|
+
delete rawParams._rowRecord;
|
|
147
|
+
// Interpolate `{field}` tokens in the target URL from the row record.
|
|
148
|
+
let resolvedTarget = targetStr;
|
|
149
|
+
if (rowRecord && /\{[a-z_][a-z0-9_]*\}/i.test(resolvedTarget)) {
|
|
150
|
+
resolvedTarget = resolvedTarget.replace(/\{([a-z_][a-z0-9_]*)\}/gi, (_, k) => {
|
|
151
|
+
const v = rowRecord[k];
|
|
152
|
+
return v == null ? '' : encodeURIComponent(String(v));
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
const url = resolvedTarget.startsWith('http') ? resolvedTarget : `${baseUrl}${resolvedTarget}`;
|
|
156
|
+
const wrap = action.bodyShape && typeof action.bodyShape === 'object' && action.bodyShape.wrap
|
|
157
|
+
? action.bodyShape.wrap
|
|
158
|
+
: undefined;
|
|
159
|
+
const body = wrap ? { [wrap]: rawParams } : { ...rawParams };
|
|
160
|
+
if (rowRecord && action.recordIdParam) {
|
|
161
|
+
const rowField = action.recordIdField || 'id';
|
|
162
|
+
const rowValue = rowRecord[rowField];
|
|
163
|
+
if (rowValue != null)
|
|
164
|
+
body[action.recordIdParam] = rowValue;
|
|
165
|
+
}
|
|
166
|
+
const isAuthOrgEndpoint = /\/api\/v1\/auth\//.test(resolvedTarget);
|
|
167
|
+
if (isAuthOrgEndpoint && !body.organizationId && activeOrganization?.id) {
|
|
168
|
+
body.organizationId = activeOrganization.id;
|
|
169
|
+
}
|
|
170
|
+
if (action.bodyExtra && typeof action.bodyExtra === 'object') {
|
|
171
|
+
Object.assign(body, action.bodyExtra);
|
|
172
|
+
}
|
|
173
|
+
const method = (action.method || 'POST').toUpperCase();
|
|
174
|
+
const init = {
|
|
175
|
+
method,
|
|
176
|
+
headers: { 'Content-Type': 'application/json' },
|
|
177
|
+
credentials: 'include',
|
|
178
|
+
};
|
|
179
|
+
if (method !== 'GET' && method !== 'DELETE') {
|
|
180
|
+
init.body = JSON.stringify(body);
|
|
181
|
+
}
|
|
182
|
+
const res = await authFetch(url, init);
|
|
183
|
+
if (!res.ok) {
|
|
184
|
+
let detail = `HTTP ${res.status}`;
|
|
185
|
+
try {
|
|
186
|
+
const j = await res.json();
|
|
187
|
+
detail = j?.error || j?.message || detail;
|
|
188
|
+
}
|
|
189
|
+
catch { /* response body not JSON */ }
|
|
190
|
+
return { success: false, error: detail };
|
|
191
|
+
}
|
|
192
|
+
const data = await res.json().catch(() => ({}));
|
|
193
|
+
if (action.refreshAfter !== false)
|
|
194
|
+
refresh();
|
|
195
|
+
return { success: true, data, reload: action.refreshAfter !== false };
|
|
196
|
+
}
|
|
197
|
+
// Generic list-level API handler: update/execute via dataSource. Only
|
|
198
|
+
// meaningful when an object context exists (ObjectView); pages without an
|
|
199
|
+
// object resolve their actions through the absolute path above.
|
|
200
|
+
const obj = action.objectName || objApiName;
|
|
201
|
+
// The row record is stashed under `_rowRecord` for list_item actions —
|
|
202
|
+
// separate it from the field values, and resolve the record id from it
|
|
203
|
+
// (the action's static params carry the field changes, not the id).
|
|
204
|
+
const rowRecord = params._rowRecord;
|
|
205
|
+
const fields = { ...params };
|
|
206
|
+
delete fields._rowRecord;
|
|
207
|
+
const recId = fields.recordId ?? rowRecord?.[action.recordIdField || 'id'];
|
|
208
|
+
delete fields.recordId;
|
|
209
|
+
// Constant body fields merged last (overrides user params), matching the
|
|
210
|
+
// absolute-HTTP branch and the spec's documented `bodyExtra` semantics.
|
|
211
|
+
// Without this a pure-confirmation action (confirmText, no params array)
|
|
212
|
+
// carries its mutation only in bodyExtra, leaving `fields` empty so the
|
|
213
|
+
// update below is skipped and nothing is persisted.
|
|
214
|
+
if (action.bodyExtra && typeof action.bodyExtra === 'object') {
|
|
215
|
+
Object.assign(fields, action.bodyExtra);
|
|
216
|
+
}
|
|
217
|
+
if (obj && typeof dataSource?.execute === 'function') {
|
|
218
|
+
await dataSource.execute(obj, target, fields);
|
|
219
|
+
}
|
|
220
|
+
else if (obj && recId && Object.keys(fields).length > 0 && typeof dataSource?.update === 'function') {
|
|
221
|
+
await dataSource.update(obj, recId, fields);
|
|
222
|
+
}
|
|
223
|
+
// Undoable single-record update: capture the prior values of the changed
|
|
224
|
+
// fields from the row record so the success toast can offer "Undo".
|
|
225
|
+
let undo;
|
|
226
|
+
if (action.undoable && obj && recId && rowRecord && Object.keys(fields).length > 0
|
|
227
|
+
&& typeof dataSource?.update === 'function') {
|
|
228
|
+
const undoData = {};
|
|
229
|
+
for (const k of Object.keys(fields))
|
|
230
|
+
undoData[k] = rowRecord[k] ?? null;
|
|
231
|
+
undo = {
|
|
232
|
+
id: `undo-${obj}-${recId}-${Date.now()}`,
|
|
233
|
+
type: 'update',
|
|
234
|
+
objectName: obj,
|
|
235
|
+
recordId: String(recId),
|
|
236
|
+
timestamp: Date.now(),
|
|
237
|
+
description: action.label || `Undo ${obj}`,
|
|
238
|
+
undoData,
|
|
239
|
+
redoData: { ...fields },
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
const shouldRefresh = action.refreshAfter !== false;
|
|
243
|
+
if (shouldRefresh)
|
|
244
|
+
refresh();
|
|
245
|
+
return { success: true, reload: shouldRefresh, undo };
|
|
246
|
+
}
|
|
247
|
+
catch (error) {
|
|
248
|
+
return { success: false, error: error.message };
|
|
249
|
+
}
|
|
250
|
+
}, [dataSource, objApiName, authFetch, activeOrganization, refresh]);
|
|
251
|
+
// Flow action handler — POST to /api/v1/automation/{name}/trigger.
|
|
252
|
+
// `context` is the shared ActionRunner context (registered handlers are
|
|
253
|
+
// invoked as `handler(action, runnerContext)`).
|
|
254
|
+
const flowHandler = useCallback(async (action, context) => {
|
|
255
|
+
const flowName = action.target || action.name;
|
|
256
|
+
if (!flowName) {
|
|
257
|
+
return { success: false, error: 'No flow target provided for flow action' };
|
|
258
|
+
}
|
|
259
|
+
try {
|
|
260
|
+
const baseUrl = import.meta.env.VITE_SERVER_URL || '';
|
|
261
|
+
const params = { ...(action.params || {}) };
|
|
262
|
+
const rowRecord = params._rowRecord;
|
|
263
|
+
delete params._rowRecord;
|
|
264
|
+
let recordId = params.recordId ?? rowRecord?.id;
|
|
265
|
+
// list_toolbar invocations carry no `_rowRecord` — fall back to the
|
|
266
|
+
// grid's checkbox selection, which ObjectGrid publishes into the runner
|
|
267
|
+
// context as `selectedRecords`. Flows take a single `recordId` input
|
|
268
|
+
// variable, so a multi-row selection is ambiguous: block with a message
|
|
269
|
+
// instead of triggering a run that fails at its first record-bound node.
|
|
270
|
+
if (recordId == null) {
|
|
271
|
+
const selected = Array.isArray(context?.selectedRecords) ? context.selectedRecords : [];
|
|
272
|
+
if (selected.length === 1) {
|
|
273
|
+
recordId = selected[0]?.id;
|
|
274
|
+
}
|
|
275
|
+
else if (selected.length > 1) {
|
|
276
|
+
return { success: false, error: 'This flow runs on a single record — select exactly one row.' };
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
if (recordId != null && params.recordId == null)
|
|
280
|
+
params.recordId = recordId;
|
|
281
|
+
const res = await authFetch(`${baseUrl}/api/v1/automation/${encodeURIComponent(flowName)}/trigger`, {
|
|
282
|
+
method: 'POST',
|
|
283
|
+
headers: { 'Content-Type': 'application/json' },
|
|
284
|
+
body: JSON.stringify({
|
|
285
|
+
recordId,
|
|
286
|
+
objectName: action.objectName || objApiName,
|
|
287
|
+
params,
|
|
288
|
+
}),
|
|
289
|
+
});
|
|
290
|
+
const json = await res.json().catch(() => null);
|
|
291
|
+
if (!res.ok || (json && json.success === false)) {
|
|
292
|
+
const errMsg = json?.error || `Flow "${flowName}" failed (HTTP ${res.status})`;
|
|
293
|
+
return { success: false, error: errMsg };
|
|
294
|
+
}
|
|
295
|
+
// Screen-flow runtime: paused at a `screen` node awaiting input — open
|
|
296
|
+
// the FlowRunner to render the form + resume. Refresh happens on complete.
|
|
297
|
+
const data = json?.data ?? {};
|
|
298
|
+
if (data.status === 'paused' && data.screen) {
|
|
299
|
+
setScreenFlow({ flowName, runId: data.runId, screen: data.screen });
|
|
300
|
+
// The action only OPENED the wizard — it hasn't completed. Suppress the
|
|
301
|
+
// action-level success toast; the flow-runner owns completion messaging.
|
|
302
|
+
return { success: true, silent: true };
|
|
303
|
+
}
|
|
304
|
+
const shouldRefresh = action.refreshAfter !== false;
|
|
305
|
+
if (shouldRefresh)
|
|
306
|
+
refresh();
|
|
307
|
+
return { success: true, data: json?.data, reload: shouldRefresh };
|
|
308
|
+
}
|
|
309
|
+
catch (error) {
|
|
310
|
+
return { success: false, error: error.message };
|
|
311
|
+
}
|
|
312
|
+
}, [authFetch, objApiName, refresh]);
|
|
313
|
+
// Server-side action handler — POST to /api/v1/actions/{object}/{action}.
|
|
314
|
+
// `context` is the shared ActionRunner context (registered handlers are
|
|
315
|
+
// invoked as `handler(action, runnerContext)`).
|
|
316
|
+
const serverActionHandler = useCallback(async (action, context) => {
|
|
317
|
+
const targetName = action.target || action.name;
|
|
318
|
+
if (!targetName) {
|
|
319
|
+
return { success: false, error: 'No action target provided' };
|
|
320
|
+
}
|
|
321
|
+
const params = (action.params && !Array.isArray(action.params))
|
|
322
|
+
? { ...action.params }
|
|
323
|
+
: {};
|
|
324
|
+
const _rowRecord = params._rowRecord;
|
|
325
|
+
delete params._rowRecord;
|
|
326
|
+
const recordIdField = action.recordIdField || 'id';
|
|
327
|
+
let resolvedRecordId = params.recordId ?? _rowRecord?.[recordIdField];
|
|
328
|
+
// Same list_toolbar fallback as flowHandler: no `_rowRecord` means the
|
|
329
|
+
// action came from the toolbar — resolve the recordId from the grid's
|
|
330
|
+
// checkbox selection (published as `selectedRecords`). Multi-select is
|
|
331
|
+
// ambiguous for a single-record action, so block with a message.
|
|
332
|
+
if (resolvedRecordId == null) {
|
|
333
|
+
const selected = Array.isArray(context?.selectedRecords) ? context.selectedRecords : [];
|
|
334
|
+
if (selected.length === 1) {
|
|
335
|
+
resolvedRecordId = selected[0]?.[recordIdField];
|
|
336
|
+
}
|
|
337
|
+
else if (selected.length > 1) {
|
|
338
|
+
// The runner's post-execution hook surfaces `error` as a toast.
|
|
339
|
+
return { success: false, error: 'This action runs on a single record — select exactly one row.' };
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
// Re-entrancy guard.
|
|
343
|
+
const inflightKey = `${targetName}:${resolvedRecordId ?? ''}`;
|
|
344
|
+
if (serverActionInFlight.current.has(inflightKey)) {
|
|
345
|
+
return { success: false, error: 'Action already in progress' };
|
|
346
|
+
}
|
|
347
|
+
serverActionInFlight.current.add(inflightKey);
|
|
348
|
+
// Popup-blocker workaround: pre-open about:blank synchronously before the
|
|
349
|
+
// await so the user-gesture context is preserved.
|
|
350
|
+
let preOpenedTab = null;
|
|
351
|
+
if (action.opensInNewTab) {
|
|
352
|
+
try {
|
|
353
|
+
preOpenedTab = window.open('about:blank', '_blank');
|
|
354
|
+
if (preOpenedTab) {
|
|
355
|
+
preOpenedTab.document.write('<!doctype html><meta charset="utf-8"><title>正在打开… Opening…</title><body style="margin:0;font-family:system-ui,sans-serif;display:flex;flex-direction:column;align-items:center;justify-content:center;height:100vh;gap:16px;color:#4b5563"><div style="width:28px;height:28px;border:3px solid #e5e7eb;border-top-color:#6366f1;border-radius:50%;animation:s .8s linear infinite"></div><div>正在为你打开环境…</div><style>@keyframes s{to{transform:rotate(360deg)}}</style></body>');
|
|
356
|
+
preOpenedTab.document.close();
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
catch {
|
|
360
|
+
preOpenedTab = null;
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
try {
|
|
364
|
+
const baseUrl = import.meta.env.VITE_SERVER_URL || '';
|
|
365
|
+
// ── Zero-roundtrip fast path ────────────────────────────────────────
|
|
366
|
+
// `newTabUrl` names a GET endpoint that performs ALL auth/authz itself
|
|
367
|
+
// (e.g. /sso-open re-runs every check the POST half would have done),
|
|
368
|
+
// so the POST round trip would add nothing but click latency. Drive the
|
|
369
|
+
// pre-opened tab there immediately — the spinner page stays painted
|
|
370
|
+
// until the (possibly slow) endpoint commits its redirect.
|
|
371
|
+
const newTabUrl = typeof action.newTabUrl === 'string' ? action.newTabUrl : '';
|
|
372
|
+
if (action.opensInNewTab && newTabUrl) {
|
|
373
|
+
if (resolvedRecordId == null) {
|
|
374
|
+
if (preOpenedTab) {
|
|
375
|
+
try {
|
|
376
|
+
preOpenedTab.close();
|
|
377
|
+
}
|
|
378
|
+
catch { /* ignore */ }
|
|
379
|
+
}
|
|
380
|
+
return { success: false, error: 'This action runs on a single record — no record id available.' };
|
|
381
|
+
}
|
|
382
|
+
// Absolute URL required: the pre-opened tab is an about:blank document,
|
|
383
|
+
// so a bare-relative href has no reliable resolution base.
|
|
384
|
+
const directUrl = `${baseUrl || window.location.origin}${newTabUrl.replace('{recordId}', encodeURIComponent(String(resolvedRecordId)))}`;
|
|
385
|
+
if (preOpenedTab) {
|
|
386
|
+
try {
|
|
387
|
+
preOpenedTab.location.href = directUrl;
|
|
388
|
+
}
|
|
389
|
+
catch {
|
|
390
|
+
try {
|
|
391
|
+
preOpenedTab.close();
|
|
392
|
+
}
|
|
393
|
+
catch { /* ignore */ }
|
|
394
|
+
window.location.href = directUrl;
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
else {
|
|
398
|
+
let popup = null;
|
|
399
|
+
try {
|
|
400
|
+
popup = window.open(directUrl, '_blank');
|
|
401
|
+
}
|
|
402
|
+
catch {
|
|
403
|
+
popup = null;
|
|
404
|
+
}
|
|
405
|
+
if (!popup) {
|
|
406
|
+
toast('浏览器拦截了弹窗 / Popup blocked', {
|
|
407
|
+
description: '点击在新标签页打开环境',
|
|
408
|
+
action: { label: '打开环境', onClick: () => { try {
|
|
409
|
+
window.open(directUrl, '_blank');
|
|
410
|
+
}
|
|
411
|
+
catch {
|
|
412
|
+
window.location.href = directUrl;
|
|
413
|
+
} } },
|
|
414
|
+
duration: 10000,
|
|
415
|
+
});
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
if (action.refreshAfter === true)
|
|
419
|
+
refresh();
|
|
420
|
+
return { success: true };
|
|
421
|
+
}
|
|
422
|
+
const obj = action.objectName || objApiName || 'global';
|
|
423
|
+
const res = await authFetch(`${baseUrl}/api/v1/actions/${encodeURIComponent(obj)}/${encodeURIComponent(targetName)}`, {
|
|
424
|
+
method: 'POST',
|
|
425
|
+
headers: { 'Content-Type': 'application/json' },
|
|
426
|
+
body: JSON.stringify({ recordId: resolvedRecordId, params }),
|
|
427
|
+
});
|
|
428
|
+
const json = await res.json().catch(() => null);
|
|
429
|
+
if (!res.ok || (json && json.success === false)) {
|
|
430
|
+
const errMsg = json?.error || `Action "${targetName}" failed (HTTP ${res.status})`;
|
|
431
|
+
if (preOpenedTab) {
|
|
432
|
+
try {
|
|
433
|
+
preOpenedTab.close();
|
|
434
|
+
}
|
|
435
|
+
catch { /* ignore */ }
|
|
436
|
+
}
|
|
437
|
+
toast.error(errMsg);
|
|
438
|
+
return { success: false, error: errMsg };
|
|
439
|
+
}
|
|
440
|
+
const shouldRefresh = action.refreshAfter !== false;
|
|
441
|
+
if (shouldRefresh)
|
|
442
|
+
refresh();
|
|
443
|
+
const data = json?.data;
|
|
444
|
+
const redirectUrl = (data && typeof data === 'object' && typeof data.redirectUrl === 'string')
|
|
445
|
+
? data.redirectUrl
|
|
446
|
+
: null;
|
|
447
|
+
if (redirectUrl) {
|
|
448
|
+
if (preOpenedTab) {
|
|
449
|
+
try {
|
|
450
|
+
preOpenedTab.location.href = redirectUrl;
|
|
451
|
+
}
|
|
452
|
+
catch {
|
|
453
|
+
try {
|
|
454
|
+
preOpenedTab.close();
|
|
455
|
+
}
|
|
456
|
+
catch { /* ignore */ }
|
|
457
|
+
window.location.href = redirectUrl;
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
else {
|
|
461
|
+
let popup = null;
|
|
462
|
+
try {
|
|
463
|
+
popup = window.open(redirectUrl, '_blank');
|
|
464
|
+
}
|
|
465
|
+
catch {
|
|
466
|
+
popup = null;
|
|
467
|
+
}
|
|
468
|
+
if (!popup) {
|
|
469
|
+
toast('浏览器拦截了弹窗 / Popup blocked', {
|
|
470
|
+
description: '点击在新标签页打开环境',
|
|
471
|
+
action: { label: '打开环境', onClick: () => { try {
|
|
472
|
+
window.open(redirectUrl, '_blank');
|
|
473
|
+
}
|
|
474
|
+
catch {
|
|
475
|
+
window.location.href = redirectUrl;
|
|
476
|
+
} } },
|
|
477
|
+
duration: 10000,
|
|
478
|
+
});
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
else if (preOpenedTab) {
|
|
483
|
+
try {
|
|
484
|
+
preOpenedTab.close();
|
|
485
|
+
}
|
|
486
|
+
catch { /* ignore */ }
|
|
487
|
+
}
|
|
488
|
+
return { success: true, data, reload: shouldRefresh };
|
|
489
|
+
}
|
|
490
|
+
catch (error) {
|
|
491
|
+
if (preOpenedTab) {
|
|
492
|
+
try {
|
|
493
|
+
preOpenedTab.close();
|
|
494
|
+
}
|
|
495
|
+
catch { /* ignore */ }
|
|
496
|
+
}
|
|
497
|
+
const msg = error.message;
|
|
498
|
+
toast.error(msg);
|
|
499
|
+
return { success: false, error: msg };
|
|
500
|
+
}
|
|
501
|
+
finally {
|
|
502
|
+
serverActionInFlight.current.delete(inflightKey);
|
|
503
|
+
}
|
|
504
|
+
}, [authFetch, objApiName, refresh]);
|
|
505
|
+
const actionProviderProps = useMemo(() => ({
|
|
506
|
+
context: {
|
|
507
|
+
...(objectName ? { objectName } : {}),
|
|
508
|
+
user: currentUser,
|
|
509
|
+
// Backend origin — lets `type: 'url'` actions issue full-page
|
|
510
|
+
// navigations to API endpoints across origins in dev.
|
|
511
|
+
apiBase: import.meta.env?.VITE_SERVER_URL || '',
|
|
512
|
+
activeOrganization: activeOrganization
|
|
513
|
+
? { id: activeOrganization.id, slug: activeOrganization.slug, name: activeOrganization.name }
|
|
514
|
+
: null,
|
|
515
|
+
},
|
|
516
|
+
onConfirm: confirmHandler,
|
|
517
|
+
onToast: toastHandler,
|
|
518
|
+
onNavigate: navigateHandler,
|
|
519
|
+
onParamCollection: paramCollectionHandler,
|
|
520
|
+
onResultDialog: resultDialogHandler,
|
|
521
|
+
handlers: { api: apiHandler, flow: flowHandler, script: serverActionHandler, modal: serverActionHandler },
|
|
522
|
+
}), [
|
|
523
|
+
objectName, currentUser, activeOrganization, confirmHandler, toastHandler,
|
|
524
|
+
navigateHandler, paramCollectionHandler, resultDialogHandler, apiHandler,
|
|
525
|
+
flowHandler, serverActionHandler,
|
|
526
|
+
]);
|
|
527
|
+
const dialogs = (_jsxs(_Fragment, { children: [_jsx(ActionConfirmDialog, { state: confirmState, onOpenChange: (open) => {
|
|
528
|
+
if (!open)
|
|
529
|
+
setConfirmState({ open: false, message: '' });
|
|
530
|
+
} }), _jsx(ActionParamDialog, { state: paramState, onOpenChange: (open) => {
|
|
531
|
+
if (!open)
|
|
532
|
+
setParamState({ open: false, params: [] });
|
|
533
|
+
} }), _jsx(ActionResultDialog, { state: resultDialogState, onAcknowledge: () => {
|
|
534
|
+
resultDialogState.resolve?.();
|
|
535
|
+
setResultDialogState({ open: false });
|
|
536
|
+
} }), _jsx(FlowRunner, { state: screenFlow, authFetch: authFetch, baseUrl: import.meta.env.VITE_SERVER_URL || '', dataSource: dataSource, objects: objects, onClose: () => setScreenFlow(null), onComplete: () => { setScreenFlow(null); refresh(); } })] }));
|
|
537
|
+
return {
|
|
538
|
+
confirmHandler,
|
|
539
|
+
toastHandler,
|
|
540
|
+
navigateHandler,
|
|
541
|
+
paramCollectionHandler,
|
|
542
|
+
resultDialogHandler,
|
|
543
|
+
apiHandler,
|
|
544
|
+
flowHandler,
|
|
545
|
+
serverActionHandler,
|
|
546
|
+
authFetch,
|
|
547
|
+
actionProviderProps,
|
|
548
|
+
dialogs,
|
|
549
|
+
};
|
|
550
|
+
}
|
|
551
|
+
/**
|
|
552
|
+
* ConsoleActionRuntimeProvider — convenience wrapper for callers (e.g. PageView)
|
|
553
|
+
* that only need to wrap a subtree in the console action runtime. ObjectView
|
|
554
|
+
* uses {@link useConsoleActionRuntime} directly because it also feeds the
|
|
555
|
+
* handlers into `useObjectActions`.
|
|
556
|
+
*/
|
|
557
|
+
export function ConsoleActionRuntimeProvider({ children, ...opts }) {
|
|
558
|
+
const runtime = useConsoleActionRuntime(opts);
|
|
559
|
+
return (_jsxs(ActionProvider, { ...runtime.actionProviderProps, children: [children, runtime.dialogs] }));
|
|
560
|
+
}
|
|
@@ -7,7 +7,18 @@
|
|
|
7
7
|
* `req.user.userId` server-side so we just forward credentials.
|
|
8
8
|
*/
|
|
9
9
|
import { useCallback, useEffect, useState } from 'react';
|
|
10
|
-
|
|
10
|
+
const PLACEHOLDER_TITLES = new Set([
|
|
11
|
+
'new chat',
|
|
12
|
+
'new conversation',
|
|
13
|
+
'untitled',
|
|
14
|
+
'新对话',
|
|
15
|
+
]);
|
|
16
|
+
function isPlaceholderTitle(title) {
|
|
17
|
+
const normalized = title?.trim().toLowerCase();
|
|
18
|
+
return !normalized || PLACEHOLDER_TITLES.has(normalized);
|
|
19
|
+
}
|
|
20
|
+
function extractPreview(row) {
|
|
21
|
+
const messages = row.messages;
|
|
11
22
|
if (!messages || messages.length === 0)
|
|
12
23
|
return undefined;
|
|
13
24
|
// Prefer the most recent user message, fall back to last message.
|
|
@@ -25,6 +36,18 @@ function extractPreview(messages) {
|
|
|
25
36
|
function stringifyContent(content) {
|
|
26
37
|
if (typeof content === 'string')
|
|
27
38
|
return content.slice(0, 140);
|
|
39
|
+
if (content &&
|
|
40
|
+
typeof content === 'object' &&
|
|
41
|
+
'text' in content &&
|
|
42
|
+
typeof content.text === 'string') {
|
|
43
|
+
return content.text.slice(0, 140);
|
|
44
|
+
}
|
|
45
|
+
if (content &&
|
|
46
|
+
typeof content === 'object' &&
|
|
47
|
+
'parts' in content &&
|
|
48
|
+
Array.isArray(content.parts)) {
|
|
49
|
+
return stringifyContent(content.parts);
|
|
50
|
+
}
|
|
28
51
|
if (Array.isArray(content)) {
|
|
29
52
|
const text = content
|
|
30
53
|
.map((p) => {
|
|
@@ -41,15 +64,27 @@ function stringifyContent(content) {
|
|
|
41
64
|
return undefined;
|
|
42
65
|
}
|
|
43
66
|
function normalize(row) {
|
|
67
|
+
const title = row.title?.trim();
|
|
68
|
+
const preview = extractPreview(row) ?? stringifyContent(row.preview);
|
|
44
69
|
return {
|
|
45
70
|
id: row.id,
|
|
46
|
-
title:
|
|
71
|
+
title: isPlaceholderTitle(title) ? undefined : title,
|
|
47
72
|
agentId: row.agentId,
|
|
48
73
|
createdAt: row.createdAt,
|
|
49
74
|
updatedAt: row.updatedAt,
|
|
50
|
-
preview
|
|
75
|
+
preview,
|
|
51
76
|
};
|
|
52
77
|
}
|
|
78
|
+
async function fetchConversationDetail(apiBase, id) {
|
|
79
|
+
const res = await fetch(`${apiBase}/conversations/${encodeURIComponent(id)}`, {
|
|
80
|
+
credentials: 'include',
|
|
81
|
+
});
|
|
82
|
+
if (!res.ok)
|
|
83
|
+
return undefined;
|
|
84
|
+
const body = (await res.json());
|
|
85
|
+
const row = 'conversation' in body && body.conversation ? body.conversation : body;
|
|
86
|
+
return normalize(row);
|
|
87
|
+
}
|
|
53
88
|
export function useConversationList(options) {
|
|
54
89
|
const { userId, apiBase, limit = 50, refreshKey } = options;
|
|
55
90
|
const [conversations, setConversations] = useState([]);
|
|
@@ -111,6 +146,29 @@ export function useConversationList(options) {
|
|
|
111
146
|
.map(normalize)
|
|
112
147
|
.sort((a, b) => (b.updatedAt ?? '').localeCompare(a.updatedAt ?? ''));
|
|
113
148
|
setConversations(sorted);
|
|
149
|
+
const needsPreview = sorted
|
|
150
|
+
.filter((row) => !row.title && !row.preview)
|
|
151
|
+
.slice(0, 20);
|
|
152
|
+
if (needsPreview.length > 0) {
|
|
153
|
+
const details = await Promise.all(needsPreview.map((row) => fetchConversationDetail(apiBase, row.id).catch(() => undefined)));
|
|
154
|
+
if (cancelled)
|
|
155
|
+
return;
|
|
156
|
+
const byId = new Map(details
|
|
157
|
+
.filter((row) => Boolean(row?.preview || row?.title))
|
|
158
|
+
.map((row) => [row.id, row]));
|
|
159
|
+
if (byId.size > 0) {
|
|
160
|
+
setConversations((current) => current.map((row) => {
|
|
161
|
+
const detail = byId.get(row.id);
|
|
162
|
+
if (!detail)
|
|
163
|
+
return row;
|
|
164
|
+
return {
|
|
165
|
+
...row,
|
|
166
|
+
title: row.title ?? detail.title,
|
|
167
|
+
preview: row.preview ?? detail.preview,
|
|
168
|
+
};
|
|
169
|
+
}));
|
|
170
|
+
}
|
|
171
|
+
}
|
|
114
172
|
}
|
|
115
173
|
catch (err) {
|
|
116
174
|
if (cancelled)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ActivityItem } from '../layout/ActivityFeed';
|
|
2
|
+
export interface HomeNotification {
|
|
3
|
+
id: string;
|
|
4
|
+
title: string;
|
|
5
|
+
actionUrl?: string;
|
|
6
|
+
createdAt?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface HomeInboxData {
|
|
9
|
+
pendingApprovalsCount: number;
|
|
10
|
+
notifications: HomeNotification[];
|
|
11
|
+
activities: ActivityItem[];
|
|
12
|
+
}
|
|
13
|
+
export declare function useHomeInbox(limit?: number): HomeInboxData;
|