@vertesia/ui 1.5.0-dev.20260714.072725Z → 1.5.0-dev.20260722.120446Z
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/lib/core/components/SidePanel.js +1 -1
- package/lib/core/components/SidePanel.js.map +1 -1
- package/lib/core/components/shadcn/button.d.ts +10 -3
- package/lib/core/components/shadcn/button.d.ts.map +1 -1
- package/lib/core/components/shadcn/button.js +41 -9
- package/lib/core/components/shadcn/button.js.map +1 -1
- package/lib/core/components/shadcn/modal/dialog.js +1 -1
- package/lib/core/components/shadcn/modal/dialog.js.map +1 -1
- package/lib/core/components/shadcn/theme/ThemeSwitcher.js +1 -1
- package/lib/core/components/shadcn/theme/ThemeSwitcher.js.map +1 -1
- package/lib/env/index.d.ts +19 -0
- package/lib/env/index.d.ts.map +1 -1
- package/lib/env/index.js +6 -0
- package/lib/env/index.js.map +1 -1
- package/lib/features/agent/chat/AgentChatPlaybackControls.d.ts.map +1 -1
- package/lib/features/agent/chat/AgentChatPlaybackControls.js +2 -2
- package/lib/features/agent/chat/AgentChatPlaybackControls.js.map +1 -1
- package/lib/features/agent/chat/AgentRequestInputOverlay.d.ts.map +1 -1
- package/lib/features/agent/chat/AgentRequestInputOverlay.js +2 -2
- package/lib/features/agent/chat/AgentRequestInputOverlay.js.map +1 -1
- package/lib/features/agent/chat/ArtifactsTab.d.ts.map +1 -1
- package/lib/features/agent/chat/ArtifactsTab.js +68 -11
- package/lib/features/agent/chat/ArtifactsTab.js.map +1 -1
- package/lib/features/agent/chat/ImageLightbox.d.ts.map +1 -1
- package/lib/features/agent/chat/ImageLightbox.js +1 -1
- package/lib/features/agent/chat/ImageLightbox.js.map +1 -1
- package/lib/features/agent/chat/ModernAgentConversation.js +52 -49
- package/lib/features/agent/chat/ModernAgentConversation.js.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/AllMessagesMixed.d.ts.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/AllMessagesMixed.js +5 -5
- package/lib/features/agent/chat/ModernAgentOutput/AllMessagesMixed.js.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/Header.d.ts.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/Header.js +4 -2
- package/lib/features/agent/chat/ModernAgentOutput/Header.js.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/MessageInput.d.ts.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/MessageInput.js +2 -2
- package/lib/features/agent/chat/ModernAgentOutput/MessageInput.js.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/MessageItem.d.ts.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/MessageItem.js +2 -1
- package/lib/features/agent/chat/ModernAgentOutput/MessageItem.js.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/requestInputMessages.d.ts +6 -0
- package/lib/features/agent/chat/ModernAgentOutput/requestInputMessages.d.ts.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/requestInputMessages.js +15 -1
- package/lib/features/agent/chat/ModernAgentOutput/requestInputMessages.js.map +1 -1
- package/lib/features/agent/chat/hooks/useArtifacts.d.ts +8 -1
- package/lib/features/agent/chat/hooks/useArtifacts.d.ts.map +1 -1
- package/lib/features/agent/chat/hooks/useArtifacts.js +28 -10
- package/lib/features/agent/chat/hooks/useArtifacts.js.map +1 -1
- package/lib/features/document-viewer/UniversalDocumentViewer.d.ts +73 -0
- package/lib/features/document-viewer/UniversalDocumentViewer.d.ts.map +1 -0
- package/lib/features/document-viewer/UniversalDocumentViewer.js +415 -0
- package/lib/features/document-viewer/UniversalDocumentViewer.js.map +1 -0
- package/lib/features/document-viewer/index.d.ts +2 -0
- package/lib/features/document-viewer/index.d.ts.map +1 -0
- package/lib/features/document-viewer/index.js +2 -0
- package/lib/features/document-viewer/index.js.map +1 -0
- package/lib/features/environment/SelectEnvironment.d.ts +28 -0
- package/lib/features/environment/SelectEnvironment.d.ts.map +1 -0
- package/lib/features/environment/SelectEnvironment.js +97 -0
- package/lib/features/environment/SelectEnvironment.js.map +1 -0
- package/lib/features/environment/index.d.ts +2 -0
- package/lib/features/environment/index.d.ts.map +1 -0
- package/lib/features/environment/index.js +2 -0
- package/lib/features/environment/index.js.map +1 -0
- package/lib/features/index.d.ts +3 -0
- package/lib/features/index.d.ts.map +1 -1
- package/lib/features/index.js +3 -0
- package/lib/features/index.js.map +1 -1
- package/lib/features/magic-pdf/AnnotatedImageSlider.js +12 -12
- package/lib/features/magic-pdf/AnnotatedImageSlider.js.map +1 -1
- package/lib/features/magic-pdf/DownloadPopover.d.ts.map +1 -1
- package/lib/features/magic-pdf/DownloadPopover.js +3 -17
- package/lib/features/magic-pdf/DownloadPopover.js.map +1 -1
- package/lib/features/magic-pdf/ExtractedContentView.js +2 -6
- package/lib/features/magic-pdf/ExtractedContentView.js.map +1 -1
- package/lib/features/magic-pdf/GroundedExtractionAssistantPanel.d.ts +25 -0
- package/lib/features/magic-pdf/GroundedExtractionAssistantPanel.d.ts.map +1 -0
- package/lib/features/magic-pdf/GroundedExtractionAssistantPanel.js +42 -0
- package/lib/features/magic-pdf/GroundedExtractionAssistantPanel.js.map +1 -0
- package/lib/features/magic-pdf/GroundedExtractionView.d.ts +27 -0
- package/lib/features/magic-pdf/GroundedExtractionView.d.ts.map +1 -0
- package/lib/features/magic-pdf/GroundedExtractionView.js +377 -0
- package/lib/features/magic-pdf/GroundedExtractionView.js.map +1 -0
- package/lib/features/magic-pdf/MagicPdfProvider.d.ts +0 -2
- package/lib/features/magic-pdf/MagicPdfProvider.d.ts.map +1 -1
- package/lib/features/magic-pdf/MagicPdfProvider.js +15 -42
- package/lib/features/magic-pdf/MagicPdfProvider.js.map +1 -1
- package/lib/features/magic-pdf/MagicPdfView.d.ts.map +1 -1
- package/lib/features/magic-pdf/MagicPdfView.js +2 -19
- package/lib/features/magic-pdf/MagicPdfView.js.map +1 -1
- package/lib/features/magic-pdf/index.d.ts +1 -0
- package/lib/features/magic-pdf/index.d.ts.map +1 -1
- package/lib/features/magic-pdf/index.js +1 -0
- package/lib/features/magic-pdf/index.js.map +1 -1
- package/lib/features/magic-pdf/types.d.ts +1 -1
- package/lib/features/magic-pdf/types.d.ts.map +1 -1
- package/lib/features/oauth/McpConnectionsButton.d.ts.map +1 -1
- package/lib/features/oauth/McpConnectionsButton.js +2 -2
- package/lib/features/oauth/McpConnectionsButton.js.map +1 -1
- package/lib/features/oauth/McpConnectionsDialog.d.ts.map +1 -1
- package/lib/features/oauth/McpConnectionsDialog.js +1 -1
- package/lib/features/oauth/McpConnectionsDialog.js.map +1 -1
- package/lib/features/oauth/RemoteMcpConnectionButton.d.ts.map +1 -1
- package/lib/features/oauth/RemoteMcpConnectionButton.js +1 -1
- package/lib/features/oauth/RemoteMcpConnectionButton.js.map +1 -1
- package/lib/features/pdf-viewer/PdfPageSlider.js +2 -2
- package/lib/features/pdf-viewer/PdfPageSlider.js.map +1 -1
- package/lib/features/pdf-viewer/SimplePdfViewer.d.ts.map +1 -1
- package/lib/features/pdf-viewer/SimplePdfViewer.js +3 -3
- package/lib/features/pdf-viewer/SimplePdfViewer.js.map +1 -1
- package/lib/features/permissions/UserPermissionsProvider.d.ts +2 -3
- package/lib/features/permissions/UserPermissionsProvider.d.ts.map +1 -1
- package/lib/features/permissions/UserPermissionsProvider.js +31 -38
- package/lib/features/permissions/UserPermissionsProvider.js.map +1 -1
- package/lib/features/store/objects/DocumentQuickFilter.d.ts.map +1 -1
- package/lib/features/store/objects/DocumentQuickFilter.js +5 -5
- package/lib/features/store/objects/DocumentQuickFilter.js.map +1 -1
- package/lib/features/store/objects/DocumentSearchResults.d.ts.map +1 -1
- package/lib/features/store/objects/DocumentSearchResults.js +2 -2
- package/lib/features/store/objects/DocumentSearchResults.js.map +1 -1
- package/lib/features/store/objects/components/ContentDispositionButton.d.ts.map +1 -1
- package/lib/features/store/objects/components/ContentDispositionButton.js +1 -1
- package/lib/features/store/objects/components/ContentDispositionButton.js.map +1 -1
- package/lib/features/store/objects/components/ContentOverview.d.ts.map +1 -1
- package/lib/features/store/objects/components/ContentOverview.js +148 -31
- package/lib/features/store/objects/components/ContentOverview.js.map +1 -1
- package/lib/features/store/objects/components/DocumentIcon.js +1 -1
- package/lib/features/store/objects/components/VectorSearchWidget.js +1 -1
- package/lib/features/store/objects/components/VectorSearchWidget.js.map +1 -1
- package/lib/features/store/objects/components/useContentPanelHooks.d.ts +1 -2
- package/lib/features/store/objects/components/useContentPanelHooks.d.ts.map +1 -1
- package/lib/features/store/objects/components/useContentPanelHooks.js +4 -8
- package/lib/features/store/objects/components/useContentPanelHooks.js.map +1 -1
- package/lib/features/store/objects/layout/renderers.d.ts.map +1 -1
- package/lib/features/store/objects/layout/renderers.js +2 -2
- package/lib/features/store/objects/layout/renderers.js.map +1 -1
- package/lib/features/store/objects/selection/SelectionActions.js +1 -1
- package/lib/features/store/objects/selection/SelectionActions.js.map +1 -1
- package/lib/features/store/types/ContentObjectTypesTable.d.ts.map +1 -1
- package/lib/features/store/types/ContentObjectTypesTable.js +4 -4
- package/lib/features/store/types/ContentObjectTypesTable.js.map +1 -1
- package/lib/features/store/types/IntakePolicyEditor.d.ts +15 -0
- package/lib/features/store/types/IntakePolicyEditor.d.ts.map +1 -0
- package/lib/features/store/types/IntakePolicyEditor.js +455 -0
- package/lib/features/store/types/IntakePolicyEditor.js.map +1 -0
- package/lib/features/store/types/IntakePolicyForm.d.ts +11 -0
- package/lib/features/store/types/IntakePolicyForm.d.ts.map +1 -0
- package/lib/features/store/types/IntakePolicyForm.js +91 -0
- package/lib/features/store/types/IntakePolicyForm.js.map +1 -0
- package/lib/features/store/types/SelectContentTypeModal.js +1 -1
- package/lib/features/store/types/SelectContentTypeModal.js.map +1 -1
- package/lib/features/store/types/index.d.ts +2 -0
- package/lib/features/store/types/index.d.ts.map +1 -1
- package/lib/features/store/types/index.js +2 -0
- package/lib/features/store/types/index.js.map +1 -1
- package/lib/features/store/types/intake-policy-editor.logic.d.ts +7 -0
- package/lib/features/store/types/intake-policy-editor.logic.d.ts.map +1 -0
- package/lib/features/store/types/intake-policy-editor.logic.js +60 -0
- package/lib/features/store/types/intake-policy-editor.logic.js.map +1 -0
- package/lib/features/store/types/typeCatalogCache.d.ts +5 -0
- package/lib/features/store/types/typeCatalogCache.d.ts.map +1 -0
- package/lib/features/store/types/typeCatalogCache.js +40 -0
- package/lib/features/store/types/typeCatalogCache.js.map +1 -0
- package/lib/features/user/UserInfo.js +7 -3
- package/lib/features/user/UserInfo.js.map +1 -1
- package/lib/features/views/ViewExperience.d.ts +20 -0
- package/lib/features/views/ViewExperience.d.ts.map +1 -0
- package/lib/features/views/ViewExperience.js +188 -0
- package/lib/features/views/ViewExperience.js.map +1 -0
- package/lib/features/views/ViewNavigation.d.ts +3 -0
- package/lib/features/views/ViewNavigation.d.ts.map +1 -0
- package/lib/features/views/ViewNavigation.js +36 -0
- package/lib/features/views/ViewNavigation.js.map +1 -0
- package/lib/features/views/ViewResults.d.ts +9 -0
- package/lib/features/views/ViewResults.d.ts.map +1 -0
- package/lib/features/views/ViewResults.js +229 -0
- package/lib/features/views/ViewResults.js.map +1 -0
- package/lib/features/views/ViewSearch.d.ts +3 -0
- package/lib/features/views/ViewSearch.d.ts.map +1 -0
- package/lib/features/views/ViewSearch.js +74 -0
- package/lib/features/views/ViewSearch.js.map +1 -0
- package/lib/features/views/index.d.ts +7 -0
- package/lib/features/views/index.d.ts.map +1 -0
- package/lib/features/views/index.js +7 -0
- package/lib/features/views/index.js.map +1 -0
- package/lib/features/views/types.d.ts +39 -0
- package/lib/features/views/types.d.ts.map +1 -0
- package/lib/features/views/types.js +2 -0
- package/lib/features/views/types.js.map +1 -0
- package/lib/features/views/viewState.d.ts +14 -0
- package/lib/features/views/viewState.d.ts.map +1 -0
- package/lib/features/views/viewState.js +117 -0
- package/lib/features/views/viewState.js.map +1 -0
- package/lib/i18n/locales/ar.json +18 -0
- package/lib/i18n/locales/de.json +14 -0
- package/lib/i18n/locales/en.json +246 -32
- package/lib/i18n/locales/es.json +15 -0
- package/lib/i18n/locales/fr.json +15 -0
- package/lib/i18n/locales/it.json +15 -0
- package/lib/i18n/locales/ja.json +13 -0
- package/lib/i18n/locales/ko.json +13 -0
- package/lib/i18n/locales/pt.json +15 -0
- package/lib/i18n/locales/ru.json +16 -0
- package/lib/i18n/locales/tr.json +14 -0
- package/lib/i18n/locales/zh-TW.json +13 -0
- package/lib/i18n/locales/zh.json +13 -0
- package/lib/router/HistoryNavigator.d.ts.map +1 -1
- package/lib/router/HistoryNavigator.js +27 -14
- package/lib/router/HistoryNavigator.js.map +1 -1
- package/lib/router/Nav.d.ts.map +1 -1
- package/lib/router/Nav.js +21 -6
- package/lib/router/Nav.js.map +1 -1
- package/lib/router/Router.d.ts.map +1 -1
- package/lib/router/Router.js +19 -4
- package/lib/router/Router.js.map +1 -1
- package/lib/router/path.d.ts +15 -0
- package/lib/router/path.d.ts.map +1 -1
- package/lib/router/path.js +43 -0
- package/lib/router/path.js.map +1 -1
- package/lib/session/UserSession.d.ts +6 -0
- package/lib/session/UserSession.d.ts.map +1 -1
- package/lib/session/UserSession.js +36 -12
- package/lib/session/UserSession.js.map +1 -1
- package/lib/session/UserSessionProvider.d.ts.map +1 -1
- package/lib/session/UserSessionProvider.js +111 -49
- package/lib/session/UserSessionProvider.js.map +1 -1
- package/lib/session/auth/composable.d.ts.map +1 -1
- package/lib/session/auth/composable.js +52 -3
- package/lib/session/auth/composable.js.map +1 -1
- package/lib/session/auth/domainRouting.d.ts +25 -0
- package/lib/session/auth/domainRouting.d.ts.map +1 -1
- package/lib/session/auth/domainRouting.js +36 -0
- package/lib/session/auth/domainRouting.js.map +1 -1
- package/lib/shell/login/SignInRestrictedEnvStep.d.ts +1 -1
- package/lib/shell/login/SignInRestrictedEnvStep.js +1 -1
- package/lib/shell/login/SigninScreen.js +9 -1
- package/lib/shell/login/SigninScreen.js.map +1 -1
- package/lib/shell/login/productionUrl.d.ts +0 -14
- package/lib/shell/login/productionUrl.d.ts.map +1 -1
- package/lib/shell/login/productionUrl.js +14 -5
- package/lib/shell/login/productionUrl.js.map +1 -1
- package/lib/vertesia-ui-core.js +4 -4
- package/lib/vertesia-ui-core.js.map +1 -1
- package/lib/vertesia-ui-env.js +1 -1
- package/lib/vertesia-ui-env.js.map +1 -1
- package/lib/vertesia-ui-features.js +35 -28
- package/lib/vertesia-ui-features.js.map +1 -1
- package/lib/vertesia-ui-i18n.js +15 -15
- package/lib/vertesia-ui-i18n.js.map +1 -1
- package/lib/vertesia-ui-router.js +1 -1
- package/lib/vertesia-ui-router.js.map +1 -1
- package/lib/vertesia-ui-session.js +1 -1
- package/lib/vertesia-ui-session.js.map +1 -1
- package/lib/vertesia-ui-shell.js +1 -1
- package/lib/vertesia-ui-shell.js.map +1 -1
- package/lib/vertesia-ui-widgets.js +7 -7
- package/lib/vertesia-ui-widgets.js.map +1 -1
- package/lib/widgets/form/Form.js +1 -1
- package/lib/widgets/form/Form.js.map +1 -1
- package/lib/widgets/json-view/JSONSwitcher.js +1 -1
- package/lib/widgets/json-view/JSONSwitcher.js.map +1 -1
- package/lib/widgets/json-view/JSONView.js +6 -6
- package/lib/widgets/json-view/JSONView.js.map +1 -1
- package/lib/widgets/monacoEditor/MonacoEditor.d.ts.map +1 -1
- package/lib/widgets/monacoEditor/MonacoEditor.js +29 -0
- package/lib/widgets/monacoEditor/MonacoEditor.js.map +1 -1
- package/lib/widgets/schema-editor/ManagedSchema.d.ts +8 -0
- package/lib/widgets/schema-editor/ManagedSchema.d.ts.map +1 -1
- package/lib/widgets/schema-editor/ManagedSchema.js +16 -0
- package/lib/widgets/schema-editor/ManagedSchema.js.map +1 -1
- package/lib/widgets/schema-editor/editor/EditableSchemaProperty.d.ts +2 -0
- package/lib/widgets/schema-editor/editor/EditableSchemaProperty.d.ts.map +1 -1
- package/lib/widgets/schema-editor/editor/EditableSchemaProperty.js +1 -0
- package/lib/widgets/schema-editor/editor/EditableSchemaProperty.js.map +1 -1
- package/lib/widgets/schema-editor/editor/PropertyViewer.d.ts.map +1 -1
- package/lib/widgets/schema-editor/editor/PropertyViewer.js +4 -1
- package/lib/widgets/schema-editor/editor/PropertyViewer.js.map +1 -1
- package/lib/widgets/schema-editor/editor/SchemaEditor.d.ts.map +1 -1
- package/lib/widgets/schema-editor/editor/SchemaEditor.js +22 -11
- package/lib/widgets/schema-editor/editor/SchemaEditor.js.map +1 -1
- package/llms.txt +70 -70
- package/package.json +33 -32
- package/src/__tests__/a11y.test.tsx +73 -0
- package/src/core/components/SidePanel.tsx +1 -1
- package/src/core/components/shadcn/button.tsx +67 -12
- package/src/core/components/shadcn/modal/dialog.tsx +1 -1
- package/src/core/components/shadcn/theme/ThemeSwitcher.tsx +1 -1
- package/src/env/index.ts +24 -0
- package/src/features/agent/chat/AgentChatPlaybackControls.tsx +0 -5
- package/src/features/agent/chat/AgentRequestInputOverlay.test.tsx +31 -0
- package/src/features/agent/chat/AgentRequestInputOverlay.tsx +6 -2
- package/src/features/agent/chat/ArtifactsTab.tsx +165 -21
- package/src/features/agent/chat/ImageLightbox.tsx +0 -1
- package/src/features/agent/chat/ModernAgentConversation.test.tsx +48 -0
- package/src/features/agent/chat/ModernAgentConversation.tsx +53 -51
- package/src/features/agent/chat/ModernAgentOutput/AllMessagesMixed.test.tsx +6 -1
- package/src/features/agent/chat/ModernAgentOutput/AllMessagesMixed.tsx +21 -15
- package/src/features/agent/chat/ModernAgentOutput/Header.tsx +3 -3
- package/src/features/agent/chat/ModernAgentOutput/MessageInput.tsx +0 -2
- package/src/features/agent/chat/ModernAgentOutput/MessageItem.tsx +4 -1
- package/src/features/agent/chat/ModernAgentOutput/requestInputMessages.test.ts +80 -0
- package/src/features/agent/chat/ModernAgentOutput/requestInputMessages.ts +21 -1
- package/src/features/agent/chat/hooks/useArtifacts.ts +44 -11
- package/src/features/document-viewer/UniversalDocumentViewer.test.tsx +123 -0
- package/src/features/document-viewer/UniversalDocumentViewer.tsx +746 -0
- package/src/features/document-viewer/index.ts +1 -0
- package/src/features/environment/SelectEnvironment.tsx +186 -0
- package/src/features/environment/index.ts +1 -0
- package/src/features/index.ts +3 -0
- package/src/features/magic-pdf/AnnotatedImageSlider.tsx +62 -66
- package/src/features/magic-pdf/DownloadPopover.tsx +5 -48
- package/src/features/magic-pdf/ExtractedContentView.tsx +2 -14
- package/src/features/magic-pdf/GroundedExtractionAssistantPanel.tsx +86 -0
- package/src/features/magic-pdf/GroundedExtractionView.test.tsx +65 -0
- package/src/features/magic-pdf/GroundedExtractionView.tsx +1055 -0
- package/src/features/magic-pdf/MagicPdfProvider.tsx +17 -47
- package/src/features/magic-pdf/MagicPdfView.tsx +3 -51
- package/src/features/magic-pdf/index.ts +1 -0
- package/src/features/magic-pdf/types.ts +1 -1
- package/src/features/oauth/McpConnectionsButton.tsx +0 -2
- package/src/features/oauth/McpConnectionsDialog.tsx +0 -1
- package/src/features/oauth/RemoteMcpConnectionButton.tsx +0 -1
- package/src/features/pdf-viewer/PdfPageSlider.tsx +5 -5
- package/src/features/pdf-viewer/SimplePdfViewer.tsx +11 -12
- package/src/features/permissions/UserPermissionsProvider.tsx +36 -39
- package/src/features/store/objects/DocumentQuickFilter.tsx +13 -15
- package/src/features/store/objects/DocumentSearchResults.tsx +3 -6
- package/src/features/store/objects/components/ContentDispositionButton.tsx +5 -1
- package/src/features/store/objects/components/ContentOverview.tsx +240 -67
- package/src/features/store/objects/components/DocumentIcon.tsx +1 -1
- package/src/features/store/objects/components/VectorSearchWidget.tsx +2 -2
- package/src/features/store/objects/components/useContentPanelHooks.ts +3 -15
- package/src/features/store/objects/layout/renderers.tsx +1 -2
- package/src/features/store/objects/selection/SelectionActions.tsx +1 -1
- package/src/features/store/types/ContentObjectTypesTable.tsx +12 -14
- package/src/features/store/types/IntakePolicyEditor.tsx +679 -0
- package/src/features/store/types/IntakePolicyForm.tsx +838 -0
- package/src/features/store/types/SelectContentTypeModal.tsx +2 -2
- package/src/features/store/types/index.ts +2 -0
- package/src/features/store/types/intake-policy-editor.logic.test.ts +109 -0
- package/src/features/store/types/intake-policy-editor.logic.ts +87 -0
- package/src/features/store/types/typeCatalogCache.ts +45 -0
- package/src/features/user/UserInfo.tsx +7 -7
- package/src/features/views/ViewExperience.test.tsx +273 -0
- package/src/features/views/ViewExperience.tsx +408 -0
- package/src/features/views/ViewNavigation.test.tsx +86 -0
- package/src/features/views/ViewNavigation.tsx +187 -0
- package/src/features/views/ViewResults.test.ts +82 -0
- package/src/features/views/ViewResults.tsx +609 -0
- package/src/features/views/ViewSearch.test.tsx +147 -0
- package/src/features/views/ViewSearch.tsx +205 -0
- package/src/features/views/index.ts +6 -0
- package/src/features/views/types.ts +57 -0
- package/src/features/views/viewState.test.ts +111 -0
- package/src/features/views/viewState.ts +132 -0
- package/src/i18n/locales/ar.json +18 -0
- package/src/i18n/locales/de.json +14 -0
- package/src/i18n/locales/en.json +965 -751
- package/src/i18n/locales/es.json +15 -0
- package/src/i18n/locales/fr.json +15 -0
- package/src/i18n/locales/it.json +15 -0
- package/src/i18n/locales/ja.json +13 -0
- package/src/i18n/locales/ko.json +13 -0
- package/src/i18n/locales/pt.json +15 -0
- package/src/i18n/locales/ru.json +16 -0
- package/src/i18n/locales/tr.json +14 -0
- package/src/i18n/locales/zh-TW.json +13 -0
- package/src/i18n/locales/zh.json +13 -0
- package/src/router/HistoryNavigator.test.ts +48 -0
- package/src/router/HistoryNavigator.ts +28 -14
- package/src/router/Nav.tsx +24 -8
- package/src/router/Router.tsx +18 -4
- package/src/router/path.test.ts +87 -0
- package/src/router/path.ts +38 -0
- package/src/session/UserSession.test.ts +39 -0
- package/src/session/UserSession.ts +37 -12
- package/src/session/UserSessionProvider.tsx +138 -62
- package/src/session/auth/composable.test.ts +111 -0
- package/src/session/auth/composable.ts +58 -3
- package/src/session/auth/domainRouting.test.ts +28 -1
- package/src/session/auth/domainRouting.ts +38 -0
- package/src/shell/login/SignInRestrictedEnvStep.tsx +1 -1
- package/src/shell/login/SigninScreen.tsx +9 -1
- package/src/shell/login/productionUrl.test.ts +8 -5
- package/src/shell/login/productionUrl.ts +15 -5
- package/src/widgets/form/Form.tsx +1 -1
- package/src/widgets/json-view/JSONSwitcher.tsx +2 -2
- package/src/widgets/json-view/JSONView.tsx +7 -7
- package/src/widgets/monacoEditor/MonacoEditor.tsx +29 -0
- package/src/widgets/schema-editor/ManagedSchema.ts +22 -0
- package/src/widgets/schema-editor/editor/EditableSchemaProperty.tsx +3 -0
- package/src/widgets/schema-editor/editor/PropertyViewer.tsx +14 -3
- package/src/widgets/schema-editor/editor/SchemaEditor.tsx +80 -29
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { cleanup, fireEvent, screen } from '@testing-library/react';
|
|
2
|
+
import { afterEach, describe, expect, it, vi } from 'vitest';
|
|
3
|
+
import { renderWithProviders } from '../../__tests__/test-utils.js';
|
|
4
|
+
import { DefaultViewSearch } from './ViewSearch.js';
|
|
5
|
+
|
|
6
|
+
describe('DefaultViewSearch', () => {
|
|
7
|
+
afterEach(() => {
|
|
8
|
+
cleanup();
|
|
9
|
+
vi.clearAllMocks();
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it('buckets structured fields and renders a typed range without browser completion', () => {
|
|
13
|
+
const onKeyTermsChange = vi.fn();
|
|
14
|
+
|
|
15
|
+
renderWithProviders(
|
|
16
|
+
<DefaultViewSearch
|
|
17
|
+
configuration={{
|
|
18
|
+
mode: 'deterministic',
|
|
19
|
+
placeholder: 'Find orders',
|
|
20
|
+
key_terms: [
|
|
21
|
+
{
|
|
22
|
+
id: 'purchase_order',
|
|
23
|
+
label: 'Purchase order',
|
|
24
|
+
field: 'properties.purchase_order',
|
|
25
|
+
type: 'keyword',
|
|
26
|
+
operator: 'term',
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
id: 'release_dates',
|
|
30
|
+
label: 'Release dates',
|
|
31
|
+
field: 'properties.release_date',
|
|
32
|
+
type: 'date',
|
|
33
|
+
operator: 'range',
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
}}
|
|
37
|
+
query=""
|
|
38
|
+
keyTerms={{ release_dates: ['2026-01-01..2026-01-31'] }}
|
|
39
|
+
isLoading={false}
|
|
40
|
+
onQueryChange={vi.fn()}
|
|
41
|
+
onKeyTermsChange={onKeyTermsChange}
|
|
42
|
+
onSubmit={vi.fn()}
|
|
43
|
+
/>,
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
expect(screen.getByText('Search fields')).not.toBeNull();
|
|
47
|
+
expect(screen.getByText('Ranges')).not.toBeNull();
|
|
48
|
+
|
|
49
|
+
const query = screen.getByPlaceholderText('Find orders') as HTMLInputElement;
|
|
50
|
+
const purchaseOrder = screen.getByLabelText('Purchase order') as HTMLInputElement;
|
|
51
|
+
const from = screen.getByLabelText('Release dates: From') as HTMLInputElement;
|
|
52
|
+
const to = screen.getByLabelText('Release dates: To') as HTMLInputElement;
|
|
53
|
+
|
|
54
|
+
expect(query.autocomplete).toBe('off');
|
|
55
|
+
expect(purchaseOrder.autocomplete).toBe('off');
|
|
56
|
+
expect(purchaseOrder.name).toBe('view-key-term-purchase_order');
|
|
57
|
+
expect(from.type).toBe('date');
|
|
58
|
+
expect(from.value).toBe('2026-01-01');
|
|
59
|
+
expect(to.value).toBe('2026-01-31');
|
|
60
|
+
|
|
61
|
+
fireEvent.change(from, { target: { value: '2026-01-05' } });
|
|
62
|
+
|
|
63
|
+
expect(onKeyTermsChange).toHaveBeenCalledWith('release_dates', ['2026-01-05..2026-01-31']);
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it('preserves unfinished spaces and separators while normalizing submitted key-term values', () => {
|
|
67
|
+
const onKeyTermsChange = vi.fn();
|
|
68
|
+
|
|
69
|
+
renderWithProviders(
|
|
70
|
+
<DefaultViewSearch
|
|
71
|
+
configuration={{
|
|
72
|
+
mode: 'deterministic',
|
|
73
|
+
key_terms: [
|
|
74
|
+
{
|
|
75
|
+
id: 'city',
|
|
76
|
+
label: 'City',
|
|
77
|
+
field: 'properties.city',
|
|
78
|
+
type: 'keyword',
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
id: 'customers',
|
|
82
|
+
label: 'Customers',
|
|
83
|
+
field: 'properties.customer',
|
|
84
|
+
type: 'keyword',
|
|
85
|
+
multiple: true,
|
|
86
|
+
},
|
|
87
|
+
],
|
|
88
|
+
}}
|
|
89
|
+
query=""
|
|
90
|
+
keyTerms={{}}
|
|
91
|
+
isLoading={false}
|
|
92
|
+
onQueryChange={vi.fn()}
|
|
93
|
+
onKeyTermsChange={onKeyTermsChange}
|
|
94
|
+
onSubmit={vi.fn()}
|
|
95
|
+
/>,
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
const city = screen.getByLabelText('City') as HTMLInputElement;
|
|
99
|
+
fireEvent.focus(city);
|
|
100
|
+
fireEvent.change(city, { target: { value: 'New York' } });
|
|
101
|
+
expect(city.value).toBe('New York');
|
|
102
|
+
expect(onKeyTermsChange).toHaveBeenCalledWith('city', ['New York']);
|
|
103
|
+
|
|
104
|
+
const customers = screen.getByLabelText('Customers') as HTMLInputElement;
|
|
105
|
+
fireEvent.focus(customers);
|
|
106
|
+
fireEvent.change(customers, { target: { value: 'Acme, ' } });
|
|
107
|
+
expect(customers.value).toBe('Acme, ');
|
|
108
|
+
expect(onKeyTermsChange).toHaveBeenCalledWith('customers', ['Acme']);
|
|
109
|
+
|
|
110
|
+
fireEvent.change(customers, { target: { value: 'Acme, Globex' } });
|
|
111
|
+
expect(customers.value).toBe('Acme, Globex');
|
|
112
|
+
expect(onKeyTermsChange).toHaveBeenCalledWith('customers', ['Acme', 'Globex']);
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
it('applies external key-term resets while preserving focused local formatting echoes', () => {
|
|
116
|
+
const onKeyTermsChange = vi.fn();
|
|
117
|
+
const props = {
|
|
118
|
+
configuration: {
|
|
119
|
+
mode: 'deterministic' as const,
|
|
120
|
+
key_terms: [
|
|
121
|
+
{
|
|
122
|
+
id: 'customers',
|
|
123
|
+
label: 'Customers',
|
|
124
|
+
field: 'properties.customer',
|
|
125
|
+
type: 'keyword' as const,
|
|
126
|
+
multiple: true,
|
|
127
|
+
},
|
|
128
|
+
],
|
|
129
|
+
},
|
|
130
|
+
query: '',
|
|
131
|
+
isLoading: false,
|
|
132
|
+
onQueryChange: vi.fn(),
|
|
133
|
+
onKeyTermsChange,
|
|
134
|
+
onSubmit: vi.fn(),
|
|
135
|
+
};
|
|
136
|
+
const { rerender } = renderWithProviders(<DefaultViewSearch {...props} keyTerms={{}} />);
|
|
137
|
+
const customers = screen.getByLabelText('Customers') as HTMLInputElement;
|
|
138
|
+
|
|
139
|
+
fireEvent.focus(customers);
|
|
140
|
+
fireEvent.change(customers, { target: { value: 'Acme, ' } });
|
|
141
|
+
rerender(<DefaultViewSearch {...props} keyTerms={{ customers: ['Acme'] }} />);
|
|
142
|
+
expect(customers.value).toBe('Acme, ');
|
|
143
|
+
|
|
144
|
+
rerender(<DefaultViewSearch {...props} keyTerms={{}} />);
|
|
145
|
+
expect(customers.value).toBe('');
|
|
146
|
+
});
|
|
147
|
+
});
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import { Button, FormItem, Input } from '@vertesia/ui/core';
|
|
2
|
+
import { useUITranslation } from '@vertesia/ui/i18n';
|
|
3
|
+
import { Search } from 'lucide-react';
|
|
4
|
+
import { useEffect, useId, useRef, useState } from 'react';
|
|
5
|
+
import type { ViewSearchRendererProps } from './types.js';
|
|
6
|
+
|
|
7
|
+
type ViewKeyTerm = NonNullable<ViewSearchRendererProps['configuration']['key_terms']>[number];
|
|
8
|
+
|
|
9
|
+
function keyTermInputType(type: string, multiple: boolean | undefined): 'text' | 'number' | 'date' {
|
|
10
|
+
if (multiple) return 'text';
|
|
11
|
+
if (type === 'number') return 'number';
|
|
12
|
+
if (type === 'date') return 'date';
|
|
13
|
+
return 'text';
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function rangeBounds(values: string[]): [string, string] {
|
|
17
|
+
const [from = '', to = ''] = (values[0] ?? '').split('..', 2);
|
|
18
|
+
return [from, to];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function rangeValues(from: string, to: string): string[] {
|
|
22
|
+
return from || to ? [`${from}..${to}`] : [];
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function serializeKeyTerm(values: string[], multiple: boolean | undefined): string {
|
|
26
|
+
return multiple ? values.join(', ') : (values[0] ?? '');
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function parseKeyTerm(value: string, multiple: boolean | undefined): string[] {
|
|
30
|
+
if (multiple) {
|
|
31
|
+
return value
|
|
32
|
+
.split(',')
|
|
33
|
+
.map((entry) => entry.trim())
|
|
34
|
+
.filter(Boolean);
|
|
35
|
+
}
|
|
36
|
+
return value.trim() ? [value.trim()] : [];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function KeyTermInput({
|
|
40
|
+
term,
|
|
41
|
+
values,
|
|
42
|
+
isLoading,
|
|
43
|
+
onChange,
|
|
44
|
+
}: {
|
|
45
|
+
term: ViewKeyTerm;
|
|
46
|
+
values: string[];
|
|
47
|
+
isLoading: boolean;
|
|
48
|
+
onChange: (values: string[]) => void;
|
|
49
|
+
}) {
|
|
50
|
+
const focused = useRef(false);
|
|
51
|
+
const lastEmittedValues = useRef<string | undefined>(undefined);
|
|
52
|
+
const [input, setInput] = useState(() => serializeKeyTerm(values, term.multiple));
|
|
53
|
+
const serializedValues = serializeKeyTerm(values, term.multiple);
|
|
54
|
+
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
const isLocalEcho = focused.current && lastEmittedValues.current === serializedValues;
|
|
57
|
+
if (!isLocalEcho) setInput(serializedValues);
|
|
58
|
+
lastEmittedValues.current = undefined;
|
|
59
|
+
}, [serializedValues]);
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<FormItem label={term.label}>
|
|
63
|
+
<Input
|
|
64
|
+
type={keyTermInputType(term.type, term.multiple)}
|
|
65
|
+
name={`view-key-term-${term.id}`}
|
|
66
|
+
autoComplete="off"
|
|
67
|
+
value={input}
|
|
68
|
+
onFocus={() => {
|
|
69
|
+
focused.current = true;
|
|
70
|
+
}}
|
|
71
|
+
onBlur={() => {
|
|
72
|
+
focused.current = false;
|
|
73
|
+
const normalized = parseKeyTerm(input, term.multiple);
|
|
74
|
+
setInput(serializeKeyTerm(normalized, term.multiple));
|
|
75
|
+
}}
|
|
76
|
+
onChange={(value) => {
|
|
77
|
+
setInput(value);
|
|
78
|
+
const parsed = parseKeyTerm(value, term.multiple);
|
|
79
|
+
lastEmittedValues.current = serializeKeyTerm(parsed, term.multiple);
|
|
80
|
+
onChange(parsed);
|
|
81
|
+
}}
|
|
82
|
+
placeholder={term.label}
|
|
83
|
+
disabled={isLoading}
|
|
84
|
+
/>
|
|
85
|
+
</FormItem>
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export function DefaultViewSearch({
|
|
90
|
+
configuration,
|
|
91
|
+
query,
|
|
92
|
+
keyTerms,
|
|
93
|
+
isLoading,
|
|
94
|
+
onQueryChange,
|
|
95
|
+
onKeyTermsChange,
|
|
96
|
+
onSubmit,
|
|
97
|
+
}: ViewSearchRendererProps) {
|
|
98
|
+
const { t } = useUITranslation();
|
|
99
|
+
const searchId = useId();
|
|
100
|
+
const fieldTerms = configuration.key_terms?.filter((term) => term.operator !== 'range') ?? [];
|
|
101
|
+
const rangeTerms = configuration.key_terms?.filter((term) => term.operator === 'range') ?? [];
|
|
102
|
+
|
|
103
|
+
const renderTerm = (term: ViewKeyTerm) => (
|
|
104
|
+
<KeyTermInput
|
|
105
|
+
key={term.id}
|
|
106
|
+
term={term}
|
|
107
|
+
values={keyTerms[term.id] ?? []}
|
|
108
|
+
isLoading={isLoading}
|
|
109
|
+
onChange={(values) => onKeyTermsChange(term.id, values)}
|
|
110
|
+
/>
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
const renderRange = (term: ViewKeyTerm) => {
|
|
114
|
+
const [from, to] = rangeBounds(keyTerms[term.id] ?? []);
|
|
115
|
+
const inputType = term.type === 'number' ? 'number' : term.type === 'date' ? 'date' : 'text';
|
|
116
|
+
return (
|
|
117
|
+
<fieldset key={term.id} className="min-w-0">
|
|
118
|
+
<legend className="mb-1 text-sm font-medium">{term.label}</legend>
|
|
119
|
+
<div className="grid grid-cols-2 gap-2">
|
|
120
|
+
<Input
|
|
121
|
+
type={inputType}
|
|
122
|
+
name={`view-key-term-${term.id}-from`}
|
|
123
|
+
autoComplete="off"
|
|
124
|
+
aria-label={`${term.label}: ${t('view.from')}`}
|
|
125
|
+
value={from}
|
|
126
|
+
onChange={(value) => onKeyTermsChange(term.id, rangeValues(value.trim(), to))}
|
|
127
|
+
placeholder={t('view.from')}
|
|
128
|
+
disabled={isLoading}
|
|
129
|
+
/>
|
|
130
|
+
<Input
|
|
131
|
+
type={inputType}
|
|
132
|
+
name={`view-key-term-${term.id}-to`}
|
|
133
|
+
autoComplete="off"
|
|
134
|
+
aria-label={`${term.label}: ${t('view.to')}`}
|
|
135
|
+
value={to}
|
|
136
|
+
onChange={(value) => onKeyTermsChange(term.id, rangeValues(from, value.trim()))}
|
|
137
|
+
placeholder={t('view.to')}
|
|
138
|
+
disabled={isLoading}
|
|
139
|
+
/>
|
|
140
|
+
</div>
|
|
141
|
+
</fieldset>
|
|
142
|
+
);
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
return (
|
|
146
|
+
<form
|
|
147
|
+
className="flex flex-col gap-3"
|
|
148
|
+
aria-label={t('layout.search')}
|
|
149
|
+
autoComplete="off"
|
|
150
|
+
onSubmit={(event) => {
|
|
151
|
+
event.preventDefault();
|
|
152
|
+
onSubmit();
|
|
153
|
+
}}
|
|
154
|
+
>
|
|
155
|
+
<div className="flex items-center gap-2">
|
|
156
|
+
<label htmlFor={searchId} className="sr-only">
|
|
157
|
+
{t('layout.search')}
|
|
158
|
+
</label>
|
|
159
|
+
<Input
|
|
160
|
+
id={searchId}
|
|
161
|
+
name="view-query"
|
|
162
|
+
autoComplete="off"
|
|
163
|
+
value={query}
|
|
164
|
+
onChange={onQueryChange}
|
|
165
|
+
placeholder={configuration.placeholder ?? t('store.searchPlaceholder')}
|
|
166
|
+
disabled={isLoading}
|
|
167
|
+
/>
|
|
168
|
+
<Button type="submit" disabled={isLoading} className="shrink-0">
|
|
169
|
+
<Search className="size-4" />
|
|
170
|
+
{isLoading ? t('store.searching') : t('store.search')}
|
|
171
|
+
</Button>
|
|
172
|
+
</div>
|
|
173
|
+
{configuration.key_terms && configuration.key_terms.length > 0 && (
|
|
174
|
+
<div className="grid gap-3 lg:grid-cols-2">
|
|
175
|
+
{fieldTerms.length > 0 && (
|
|
176
|
+
<fieldset
|
|
177
|
+
className={`rounded-md border border-mixer-muted/30 bg-mixer-muted/5 p-3 ${
|
|
178
|
+
rangeTerms.length === 0 ? 'lg:col-span-2' : ''
|
|
179
|
+
}`}
|
|
180
|
+
>
|
|
181
|
+
<legend className="px-1 text-xs font-medium text-muted">{t('view.searchFields')}</legend>
|
|
182
|
+
<div
|
|
183
|
+
className={`grid gap-3 sm:grid-cols-2 ${
|
|
184
|
+
rangeTerms.length === 0 ? 'lg:grid-cols-4' : ''
|
|
185
|
+
}`}
|
|
186
|
+
>
|
|
187
|
+
{fieldTerms.map(renderTerm)}
|
|
188
|
+
</div>
|
|
189
|
+
</fieldset>
|
|
190
|
+
)}
|
|
191
|
+
{rangeTerms.length > 0 && (
|
|
192
|
+
<fieldset
|
|
193
|
+
className={`rounded-md border border-mixer-muted/30 bg-mixer-muted/5 p-3 ${
|
|
194
|
+
fieldTerms.length === 0 ? 'lg:col-span-2' : ''
|
|
195
|
+
}`}
|
|
196
|
+
>
|
|
197
|
+
<legend className="px-1 text-xs font-medium text-muted">{t('view.ranges')}</legend>
|
|
198
|
+
<div className="grid gap-3 sm:grid-cols-2">{rangeTerms.map(renderRange)}</div>
|
|
199
|
+
</fieldset>
|
|
200
|
+
)}
|
|
201
|
+
</div>
|
|
202
|
+
)}
|
|
203
|
+
</form>
|
|
204
|
+
);
|
|
205
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ExecuteViewRequest,
|
|
3
|
+
ViewDisplayConfiguration,
|
|
4
|
+
ViewExecutionDefinition,
|
|
5
|
+
ViewExecutionResult,
|
|
6
|
+
ViewHit,
|
|
7
|
+
ViewNavigationItem,
|
|
8
|
+
ViewNavigationResult,
|
|
9
|
+
ViewResultMedia,
|
|
10
|
+
ViewSearchConfiguration,
|
|
11
|
+
} from '@vertesia/common';
|
|
12
|
+
import type { ComponentType } from 'react';
|
|
13
|
+
|
|
14
|
+
export interface ViewSearchRendererProps {
|
|
15
|
+
configuration: ViewSearchConfiguration;
|
|
16
|
+
query: string;
|
|
17
|
+
keyTerms: Record<string, string[]>;
|
|
18
|
+
isLoading: boolean;
|
|
19
|
+
onQueryChange: (query: string) => void;
|
|
20
|
+
onKeyTermsChange: (id: string, values: string[]) => void;
|
|
21
|
+
onSubmit: () => void;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface ViewNavigationRendererProps {
|
|
25
|
+
configuration: ViewNavigationItem;
|
|
26
|
+
result: ViewNavigationResult;
|
|
27
|
+
isLoading: boolean;
|
|
28
|
+
onChange: (values: string[]) => void;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface ViewResultsRendererProps {
|
|
32
|
+
configuration: ViewDisplayConfiguration;
|
|
33
|
+
definition: ViewExecutionDefinition;
|
|
34
|
+
request: ExecuteViewRequest;
|
|
35
|
+
result: ViewExecutionResult;
|
|
36
|
+
isLoading: boolean;
|
|
37
|
+
onSortChange?: (sort: string) => void;
|
|
38
|
+
onOpenHit?: (hit: ViewHit) => void;
|
|
39
|
+
resolveMedia?: ViewMediaResolver;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface ViewExperienceRenderers {
|
|
43
|
+
search?: Record<string, ComponentType<ViewSearchRendererProps>>;
|
|
44
|
+
navigation?: Record<string, ComponentType<ViewNavigationRendererProps>>;
|
|
45
|
+
results?: Record<string, ComponentType<ViewResultsRendererProps>>;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export type ViewExecutor = (request: ExecuteViewRequest) => Promise<ViewExecutionResult>;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Resolves media that is not already an HTTP URL, such as a signed content
|
|
52
|
+
* thumbnail. Embedded apps can provide their own resolver.
|
|
53
|
+
*/
|
|
54
|
+
export type ViewMediaResolver = (
|
|
55
|
+
hit: ViewHit,
|
|
56
|
+
media: ViewResultMedia,
|
|
57
|
+
) => string | undefined | Promise<string | undefined>;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import type { ViewExecutionResult } from '@vertesia/common';
|
|
2
|
+
import { describe, expect, it } from 'vitest';
|
|
3
|
+
import { canonicalizeViewState, parseViewState, resolveViewSort, serializeViewState } from './viewState.js';
|
|
4
|
+
|
|
5
|
+
describe('View URL state', () => {
|
|
6
|
+
it('parses repeated key terms and navigation values', () => {
|
|
7
|
+
expect(
|
|
8
|
+
parseViewState(
|
|
9
|
+
'?q=find+contracts&t.party=Acme&t.party=Globex&n.brand=Vertesia&display=cards&sort=updated&offset=20',
|
|
10
|
+
),
|
|
11
|
+
).toEqual({
|
|
12
|
+
query: 'find contracts',
|
|
13
|
+
key_terms: { party: ['Acme', 'Globex'] },
|
|
14
|
+
navigation: { brand: ['Vertesia'] },
|
|
15
|
+
display: 'cards',
|
|
16
|
+
sort: 'updated',
|
|
17
|
+
offset: 20,
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it('round trips View state and preserves unrelated host parameters', () => {
|
|
22
|
+
const hierarchyPath = 'h1:WyJGTCIsIk1pYW1pIl0';
|
|
23
|
+
const serialized = serializeViewState(
|
|
24
|
+
{
|
|
25
|
+
query: 'renewal rights',
|
|
26
|
+
key_terms: { party: ['Acme'], topic: ['renewal'] },
|
|
27
|
+
navigation: {
|
|
28
|
+
location: ['/Customers/Acme'],
|
|
29
|
+
brand: ['Contoso', 'Vertesia'],
|
|
30
|
+
geography: [hierarchyPath],
|
|
31
|
+
},
|
|
32
|
+
display: 'table',
|
|
33
|
+
},
|
|
34
|
+
'?account=account-1&project=project-1&q=stale&n.brand=stale',
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
expect(serialized).toContain('account=account-1');
|
|
38
|
+
expect(serialized).toContain('project=project-1');
|
|
39
|
+
expect(parseViewState(serialized)).toEqual({
|
|
40
|
+
query: 'renewal rights',
|
|
41
|
+
key_terms: { party: ['Acme'], topic: ['renewal'] },
|
|
42
|
+
navigation: {
|
|
43
|
+
brand: ['Contoso', 'Vertesia'],
|
|
44
|
+
geography: [hierarchyPath],
|
|
45
|
+
location: ['/Customers/Acme'],
|
|
46
|
+
},
|
|
47
|
+
display: 'table',
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it('drops malformed offsets and empty values', () => {
|
|
52
|
+
expect(parseViewState('?offset=-2&q=++&n.brand=&t.party=')).toEqual({});
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it('canonicalizes stale configuration IDs from the runtime response', () => {
|
|
56
|
+
expect(
|
|
57
|
+
canonicalizeViewState(
|
|
58
|
+
{
|
|
59
|
+
query: ' contracts ',
|
|
60
|
+
key_terms: { party: ['Acme'], retired: ['old'] },
|
|
61
|
+
navigation: { brand: ['stale'], retired: ['old'] },
|
|
62
|
+
display: 'retired',
|
|
63
|
+
sort: 'retired',
|
|
64
|
+
offset: 20,
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
view: 'document-lib',
|
|
68
|
+
revision: 2,
|
|
69
|
+
definition: {
|
|
70
|
+
name: 'Documents',
|
|
71
|
+
search: { key_terms: [{ id: 'party', label: 'Party', type: 'keyword' }] },
|
|
72
|
+
},
|
|
73
|
+
display: 'table',
|
|
74
|
+
sort: 'updated',
|
|
75
|
+
search: { requested_mode: 'agentic', applied_mode: 'query', warnings: [] },
|
|
76
|
+
hits: [],
|
|
77
|
+
total: 0,
|
|
78
|
+
navigation: {
|
|
79
|
+
brand: { id: 'brand', selected: ['Acme'], nodes: [] },
|
|
80
|
+
},
|
|
81
|
+
took: 5,
|
|
82
|
+
},
|
|
83
|
+
),
|
|
84
|
+
).toEqual({
|
|
85
|
+
query: 'contracts',
|
|
86
|
+
key_terms: { party: ['Acme'] },
|
|
87
|
+
navigation: { brand: ['Acme'] },
|
|
88
|
+
display: 'table',
|
|
89
|
+
sort: 'updated',
|
|
90
|
+
offset: 20,
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
it('does not relabel relevance-ranked query results with the browse default sort', () => {
|
|
95
|
+
const result = {
|
|
96
|
+
view: 'document-lib',
|
|
97
|
+
revision: 1,
|
|
98
|
+
definition: { name: 'Documents' },
|
|
99
|
+
search: { requested_mode: 'agentic', applied_mode: 'query', warnings: [] },
|
|
100
|
+
hits: [],
|
|
101
|
+
total: 0,
|
|
102
|
+
navigation: {},
|
|
103
|
+
took: 5,
|
|
104
|
+
} satisfies ViewExecutionResult;
|
|
105
|
+
|
|
106
|
+
expect(resolveViewSort({ query: 'garden hose' }, result, 'recent')).toBeUndefined();
|
|
107
|
+
expect(resolveViewSort({}, result, 'recent')).toBe('recent');
|
|
108
|
+
expect(resolveViewSort({ query: 'garden hose', sort: 'recent' }, result, 'recent')).toBe('recent');
|
|
109
|
+
expect(resolveViewSort({ query: 'orders over 1000' }, { ...result, sort: 'recent' }, 'recent')).toBe('recent');
|
|
110
|
+
});
|
|
111
|
+
});
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import type { ExecuteViewRequest, ViewExecutionResult } from '@vertesia/common';
|
|
2
|
+
|
|
3
|
+
const QUERY_PARAM = 'q';
|
|
4
|
+
const DISPLAY_PARAM = 'display';
|
|
5
|
+
const SORT_PARAM = 'sort';
|
|
6
|
+
const OFFSET_PARAM = 'offset';
|
|
7
|
+
const KEY_TERM_PREFIX = 't.';
|
|
8
|
+
const NAVIGATION_PREFIX = 'n.';
|
|
9
|
+
|
|
10
|
+
function nonNegativeInteger(value: string | null): number | undefined {
|
|
11
|
+
if (value === null || value.trim() === '') return undefined;
|
|
12
|
+
const parsed = Number(value);
|
|
13
|
+
return Number.isSafeInteger(parsed) && parsed >= 0 ? parsed : undefined;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function collectPrefixedValues(params: URLSearchParams, prefix: string): Record<string, string[]> | undefined {
|
|
17
|
+
const values: Record<string, string[]> = {};
|
|
18
|
+
for (const key of new Set(params.keys())) {
|
|
19
|
+
if (!key.startsWith(prefix) || key.length === prefix.length) continue;
|
|
20
|
+
const entries = params.getAll(key).filter((value) => value !== '');
|
|
21
|
+
if (entries.length > 0) values[key.slice(prefix.length)] = entries;
|
|
22
|
+
}
|
|
23
|
+
return Object.keys(values).length > 0 ? values : undefined;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** Parse the stable, shareable URL representation of a View execution request. */
|
|
27
|
+
export function parseViewState(search: string): ExecuteViewRequest {
|
|
28
|
+
const params = new URLSearchParams(search.startsWith('?') ? search.slice(1) : search);
|
|
29
|
+
const query = params.get(QUERY_PARAM)?.trim();
|
|
30
|
+
const display = params.get(DISPLAY_PARAM)?.trim();
|
|
31
|
+
const sort = params.get(SORT_PARAM)?.trim();
|
|
32
|
+
const offset = nonNegativeInteger(params.get(OFFSET_PARAM));
|
|
33
|
+
const key_terms = collectPrefixedValues(params, KEY_TERM_PREFIX);
|
|
34
|
+
const navigation = collectPrefixedValues(params, NAVIGATION_PREFIX);
|
|
35
|
+
|
|
36
|
+
return {
|
|
37
|
+
...(query ? { query } : {}),
|
|
38
|
+
...(key_terms ? { key_terms } : {}),
|
|
39
|
+
...(navigation ? { navigation } : {}),
|
|
40
|
+
...(display ? { display } : {}),
|
|
41
|
+
...(sort ? { sort } : {}),
|
|
42
|
+
...(offset ? { offset } : {}),
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function deleteManagedParams(params: URLSearchParams): void {
|
|
47
|
+
for (const key of [...params.keys()]) {
|
|
48
|
+
if (
|
|
49
|
+
key === QUERY_PARAM ||
|
|
50
|
+
key === DISPLAY_PARAM ||
|
|
51
|
+
key === SORT_PARAM ||
|
|
52
|
+
key === OFFSET_PARAM ||
|
|
53
|
+
key.startsWith(KEY_TERM_PREFIX) ||
|
|
54
|
+
key.startsWith(NAVIGATION_PREFIX)
|
|
55
|
+
) {
|
|
56
|
+
params.delete(key);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function appendRecord(params: URLSearchParams, prefix: string, values: Record<string, string[]> | undefined): void {
|
|
62
|
+
if (!values) return;
|
|
63
|
+
for (const [key, entries] of Object.entries(values).sort(([left], [right]) => left.localeCompare(right))) {
|
|
64
|
+
for (const value of entries) {
|
|
65
|
+
if (value !== '') params.append(`${prefix}${key}`, value);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** Serialize View state while preserving unrelated host parameters such as account/project selection. */
|
|
71
|
+
export function serializeViewState(request: ExecuteViewRequest, currentSearch = ''): string {
|
|
72
|
+
const params = new URLSearchParams(currentSearch.startsWith('?') ? currentSearch.slice(1) : currentSearch);
|
|
73
|
+
deleteManagedParams(params);
|
|
74
|
+
|
|
75
|
+
if (request.query?.trim()) params.set(QUERY_PARAM, request.query.trim());
|
|
76
|
+
if (request.display) params.set(DISPLAY_PARAM, request.display);
|
|
77
|
+
if (request.sort) params.set(SORT_PARAM, request.sort);
|
|
78
|
+
if (request.offset && request.offset > 0) params.set(OFFSET_PARAM, String(request.offset));
|
|
79
|
+
appendRecord(params, KEY_TERM_PREFIX, request.key_terms);
|
|
80
|
+
appendRecord(params, NAVIGATION_PREFIX, request.navigation);
|
|
81
|
+
|
|
82
|
+
const value = params.toString();
|
|
83
|
+
return value ? `?${value}` : '';
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function selectedRecord(result: ViewExecutionResult): Record<string, string[]> | undefined {
|
|
87
|
+
const selections = Object.fromEntries(
|
|
88
|
+
Object.entries(result.navigation)
|
|
89
|
+
.filter(([, navigation]) => navigation.selected.length > 0)
|
|
90
|
+
.map(([id, navigation]) => [id, navigation.selected]),
|
|
91
|
+
);
|
|
92
|
+
return Object.keys(selections).length > 0 ? selections : undefined;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/** Remove stale configuration IDs and apply the display/sort selected by the authoritative runtime. */
|
|
96
|
+
export function canonicalizeViewState(request: ExecuteViewRequest, result: ViewExecutionResult): ExecuteViewRequest {
|
|
97
|
+
const keyTermIds = new Set(result.definition.search?.key_terms?.map((term) => term.id) ?? []);
|
|
98
|
+
const key_terms = request.key_terms
|
|
99
|
+
? Object.fromEntries(
|
|
100
|
+
Object.entries(request.key_terms).filter(([id, values]) => keyTermIds.has(id) && values.length),
|
|
101
|
+
)
|
|
102
|
+
: undefined;
|
|
103
|
+
const navigation = selectedRecord(result);
|
|
104
|
+
|
|
105
|
+
return {
|
|
106
|
+
...(request.query?.trim() ? { query: request.query.trim() } : {}),
|
|
107
|
+
...(key_terms && Object.keys(key_terms).length > 0 ? { key_terms } : {}),
|
|
108
|
+
...(navigation ? { navigation } : {}),
|
|
109
|
+
...(result.display ? { display: result.display } : {}),
|
|
110
|
+
...(result.sort ? { sort: result.sort } : {}),
|
|
111
|
+
...(request.offset && request.offset > 0 ? { offset: request.offset } : {}),
|
|
112
|
+
...(request.limit ? { limit: request.limit } : {}),
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Resolve the sort the server actually applied. Natural-language queries with
|
|
118
|
+
* no returned sort use Elasticsearch relevance rather than the browse default.
|
|
119
|
+
*/
|
|
120
|
+
export function resolveViewSort(
|
|
121
|
+
request: ExecuteViewRequest,
|
|
122
|
+
result: ViewExecutionResult,
|
|
123
|
+
defaultSort: string | undefined,
|
|
124
|
+
): string | undefined {
|
|
125
|
+
return result.sort ?? request.sort ?? (request.query?.trim() ? undefined : defaultSort);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export function replaceViewStateInUrl(request: ExecuteViewRequest): void {
|
|
129
|
+
if (typeof window === 'undefined') return;
|
|
130
|
+
const search = serializeViewState(request, window.location.search);
|
|
131
|
+
window.history.replaceState(window.history.state || {}, '', `${window.location.pathname}${search}`);
|
|
132
|
+
}
|