synapse-react-client 4.0.38 → 4.0.41
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/dist/SWC.index.d.ts +1 -0
- package/dist/SWC.index.d.ts.map +1 -1
- package/dist/SWC.index.js +2 -1
- package/dist/SWC.index.js.map +1 -1
- package/dist/aridhia-queries/useAridhiaQuery.d.ts +6 -2
- package/dist/aridhia-queries/useAridhiaQuery.d.ts.map +1 -1
- package/dist/aridhia-queries/useAridhiaQuery.js +3 -0
- package/dist/aridhia-queries/useAridhiaQuery.js.map +1 -1
- package/dist/components/AccessRequirement/ImposeRestrictionDialog/ImposeRestrictionDialog.d.ts +1 -0
- package/dist/components/AccessRequirement/ImposeRestrictionDialog/ImposeRestrictionDialog.d.ts.map +1 -1
- package/dist/components/AccessRequirement/ImposeRestrictionDialog/ImposeRestrictionDialog.js +12 -12
- package/dist/components/AccessRequirement/ImposeRestrictionDialog/ImposeRestrictionDialog.js.map +1 -1
- package/dist/components/Aridhia/AridhiaAccessStatus.d.ts +2 -1
- package/dist/components/Aridhia/AridhiaAccessStatus.d.ts.map +1 -1
- package/dist/components/Aridhia/AridhiaAccessStatus.js +57 -31
- package/dist/components/Aridhia/AridhiaAccessStatus.js.map +1 -1
- package/dist/components/Aridhia/AridhiaDarStatusPopover.d.ts +12 -0
- package/dist/components/Aridhia/AridhiaDarStatusPopover.d.ts.map +1 -0
- package/dist/components/Aridhia/AridhiaDarStatusPopover.js +56 -0
- package/dist/components/Aridhia/AridhiaDarStatusPopover.js.map +1 -0
- package/dist/components/Aridhia/DarWizard/AridhiaDarWizard.d.ts.map +1 -1
- package/dist/components/Aridhia/DarWizard/AridhiaDarWizard.js +38 -30
- package/dist/components/Aridhia/DarWizard/AridhiaDarWizard.js.map +1 -1
- package/dist/components/Aridhia/DarWizard/DarSubmittedPanel.js +15 -14
- package/dist/components/Aridhia/DarWizard/DarSubmittedPanel.js.map +1 -1
- package/dist/components/Aridhia/RdcaDapEligibilityDialog.d.ts +11 -0
- package/dist/components/Aridhia/RdcaDapEligibilityDialog.d.ts.map +1 -0
- package/dist/components/Aridhia/RdcaDapEligibilityDialog.js +37 -0
- package/dist/components/Aridhia/RdcaDapEligibilityDialog.js.map +1 -0
- package/dist/components/Aridhia/aridhiaAccessStatusUtils.js +2 -2
- package/dist/components/Aridhia/aridhiaAccessStatusUtils.js.map +1 -1
- package/dist/components/Aridhia/aridhiaFairPortalUrls.d.ts +10 -0
- package/dist/components/Aridhia/aridhiaFairPortalUrls.d.ts.map +1 -0
- package/dist/components/Aridhia/aridhiaFairPortalUrls.js +11 -0
- package/dist/components/Aridhia/aridhiaFairPortalUrls.js.map +1 -0
- package/dist/components/Aridhia/rdcaDapConstants.d.ts +3 -0
- package/dist/components/Aridhia/rdcaDapConstants.d.ts.map +1 -0
- package/dist/components/Aridhia/rdcaDapConstants.js +6 -0
- package/dist/components/Aridhia/rdcaDapConstants.js.map +1 -0
- package/dist/components/Authentication/Constants.d.ts +4 -0
- package/dist/components/Authentication/Constants.d.ts.map +1 -1
- package/dist/components/Authentication/Constants.js +5 -2
- package/dist/components/Authentication/Constants.js.map +1 -1
- package/dist/components/Authentication/RecoveryCodeGrid.d.ts.map +1 -1
- package/dist/components/Authentication/RecoveryCodeGrid.js +8 -1
- package/dist/components/Authentication/RecoveryCodeGrid.js.map +1 -1
- package/dist/components/Authentication/RegenerateBackupCodesWarning.js +4 -1
- package/dist/components/Authentication/RegenerateBackupCodesWarning.js.map +1 -1
- package/dist/components/Authentication/TOTPForm.d.ts.map +1 -1
- package/dist/components/Authentication/TOTPForm.js +20 -18
- package/dist/components/Authentication/TOTPForm.js.map +1 -1
- package/dist/components/Authentication/TwoFactorBackupCodes.d.ts.map +1 -1
- package/dist/components/Authentication/TwoFactorBackupCodes.js +41 -12
- package/dist/components/Authentication/TwoFactorBackupCodes.js.map +1 -1
- package/dist/components/Authentication/TwoFactorEnrollmentForm.d.ts.map +1 -1
- package/dist/components/Authentication/TwoFactorEnrollmentForm.js +74 -71
- package/dist/components/Authentication/TwoFactorEnrollmentForm.js.map +1 -1
- package/dist/components/DataExplorer/DataExplorer.css +1 -1
- package/dist/components/DataExplorer/DataExplorer.d.ts.map +1 -1
- package/dist/components/DataExplorer/DataExplorer.js +50 -50
- package/dist/components/DataExplorer/DataExplorer.js.map +1 -1
- package/dist/components/DataExplorer/DataExplorer.module.js +16 -16
- package/dist/components/DataExplorer/DataExplorer.module.js.map +1 -1
- package/dist/components/DataExplorer/DataExplorer.module.scss +29 -6
- package/dist/components/DataGrid/columns/DateTimeColumn.d.ts +16 -7
- package/dist/components/DataGrid/columns/DateTimeColumn.d.ts.map +1 -1
- package/dist/components/DataGrid/columns/DateTimeColumn.js +79 -57
- package/dist/components/DataGrid/columns/DateTimeColumn.js.map +1 -1
- package/dist/components/DataGrid/components/ReorderColumnsDialog.d.ts.map +1 -1
- package/dist/components/DataGrid/components/ReorderColumnsDialog.js +43 -46
- package/dist/components/DataGrid/components/ReorderColumnsDialog.js.map +1 -1
- package/dist/components/DataGrid/utils/columnFactory.d.ts.map +1 -1
- package/dist/components/DataGrid/utils/columnFactory.js +11 -8
- package/dist/components/DataGrid/utils/columnFactory.js.map +1 -1
- package/dist/components/DatePicker/DatePicker.d.ts +10 -0
- package/dist/components/DatePicker/DatePicker.d.ts.map +1 -0
- package/dist/components/DatePicker/DatePicker.js +18 -0
- package/dist/components/DatePicker/DatePicker.js.map +1 -0
- package/dist/components/EntityCitation/EntityCitation.d.ts.map +1 -1
- package/dist/components/EntityCitation/EntityCitation.js +8 -5
- package/dist/components/EntityCitation/EntityCitation.js.map +1 -1
- package/dist/components/FormTemplateEditor/ChoiceOptionsEditor.d.ts +11 -0
- package/dist/components/FormTemplateEditor/ChoiceOptionsEditor.d.ts.map +1 -0
- package/dist/components/FormTemplateEditor/ChoiceOptionsEditor.js +61 -0
- package/dist/components/FormTemplateEditor/ChoiceOptionsEditor.js.map +1 -0
- package/dist/components/FormTemplateEditor/FieldDefinitionDrawer.d.ts +33 -0
- package/dist/components/FormTemplateEditor/FieldDefinitionDrawer.d.ts.map +1 -0
- package/dist/components/FormTemplateEditor/FieldDefinitionDrawer.js +187 -0
- package/dist/components/FormTemplateEditor/FieldDefinitionDrawer.js.map +1 -0
- package/dist/components/FormTemplateEditor/FormTemplatePreview.d.ts +14 -0
- package/dist/components/FormTemplateEditor/FormTemplatePreview.d.ts.map +1 -0
- package/dist/components/FormTemplateEditor/FormTemplatePreview.js +83 -0
- package/dist/components/FormTemplateEditor/FormTemplatePreview.js.map +1 -0
- package/dist/components/FormTemplateEditor/JsonSchemaBodyEditor.d.ts +13 -0
- package/dist/components/FormTemplateEditor/JsonSchemaBodyEditor.d.ts.map +1 -0
- package/dist/components/FormTemplateEditor/JsonSchemaBodyEditor.js +33 -0
- package/dist/components/FormTemplateEditor/JsonSchemaBodyEditor.js.map +1 -0
- package/dist/components/FormTemplateEditor/formTemplateValidation.d.ts +32 -0
- package/dist/components/FormTemplateEditor/formTemplateValidation.d.ts.map +1 -0
- package/dist/components/FormTemplateEditor/formTemplateValidation.js +75 -0
- package/dist/components/FormTemplateEditor/formTemplateValidation.js.map +1 -0
- package/dist/components/FormTemplateEditor/schemaFieldUtils.d.ts +25 -0
- package/dist/components/FormTemplateEditor/schemaFieldUtils.d.ts.map +1 -0
- package/dist/components/FormTemplateEditor/schemaFieldUtils.js +66 -0
- package/dist/components/FormTemplateEditor/schemaFieldUtils.js.map +1 -0
- package/dist/components/FormTemplateEditor/useSaveFormTemplate.d.ts +28 -0
- package/dist/components/FormTemplateEditor/useSaveFormTemplate.d.ts.map +1 -0
- package/dist/components/FormTemplateEditor/useSaveFormTemplate.js +39 -0
- package/dist/components/FormTemplateEditor/useSaveFormTemplate.js.map +1 -0
- package/dist/components/FormTemplateEditor/utils.d.ts +21 -0
- package/dist/components/FormTemplateEditor/utils.d.ts.map +1 -0
- package/dist/components/FormTemplateEditor/utils.js +27 -0
- package/dist/components/FormTemplateEditor/utils.js.map +1 -0
- package/dist/components/HasAccess/AccessIcon.d.ts +3 -1
- package/dist/components/HasAccess/AccessIcon.d.ts.map +1 -1
- package/dist/components/HasAccess/AccessIcon.js +11 -1
- package/dist/components/HasAccess/AccessIcon.js.map +1 -1
- package/dist/components/JsonSchemaForm/CustomFormContext.d.ts +1 -1
- package/dist/components/JsonSchemaForm/CustomFormContext.d.ts.map +1 -1
- package/dist/components/JsonSchemaForm/JsonSchemaForm.css +1 -1
- package/dist/components/JsonSchemaForm/JsonSchemaForm.module.js +1 -1
- package/dist/components/JsonSchemaForm/JsonSchemaForm.module.js.map +1 -1
- package/dist/components/JsonSchemaForm/JsonSchemaForm.module.scss +6 -1
- package/dist/components/JsonSchemaForm/templates/RJSFInputLabel.d.ts.map +1 -1
- package/dist/components/JsonSchemaForm/templates/RJSFInputLabel.js +4 -0
- package/dist/components/JsonSchemaForm/templates/RJSFInputLabel.js.map +1 -1
- package/dist/components/PortalHomePageHeader/PortalHomePageHeader.d.ts +2 -1
- package/dist/components/PortalHomePageHeader/PortalHomePageHeader.d.ts.map +1 -1
- package/dist/components/PortalHomePageHeader/PortalHomePageHeader.js +81 -53
- package/dist/components/PortalHomePageHeader/PortalHomePageHeader.js.map +1 -1
- package/dist/components/ProjectInfo/ProjectInfo.d.ts.map +1 -1
- package/dist/components/ProjectInfo/ProjectInfo.js +3 -2
- package/dist/components/ProjectInfo/ProjectInfo.js.map +1 -1
- package/dist/components/QueryBuilder/FilterConditionRow.css +1 -0
- package/dist/components/QueryBuilder/FilterConditionRow.d.ts +8 -0
- package/dist/components/QueryBuilder/FilterConditionRow.d.ts.map +1 -0
- package/dist/components/QueryBuilder/FilterConditionRow.js +260 -0
- package/dist/components/QueryBuilder/FilterConditionRow.js.map +1 -0
- package/dist/components/QueryBuilder/FilterConditionRow.module.js +16 -0
- package/dist/components/QueryBuilder/FilterConditionRow.module.js.map +1 -0
- package/dist/components/QueryBuilder/FilterConditionRow.module.scss +101 -0
- package/dist/components/QueryBuilder/FilterGroupNode.css +1 -0
- package/dist/components/QueryBuilder/FilterGroupNode.d.ts +11 -0
- package/dist/components/QueryBuilder/FilterGroupNode.d.ts.map +1 -0
- package/dist/components/QueryBuilder/FilterGroupNode.js +134 -0
- package/dist/components/QueryBuilder/FilterGroupNode.js.map +1 -0
- package/dist/components/QueryBuilder/FilterGroupNode.module.js +16 -0
- package/dist/components/QueryBuilder/FilterGroupNode.module.js.map +1 -0
- package/dist/components/QueryBuilder/FilterGroupNode.module.scss +92 -0
- package/dist/components/QueryBuilder/QBDragHandle.d.ts +10 -0
- package/dist/components/QueryBuilder/QBDragHandle.d.ts.map +1 -0
- package/dist/components/QueryBuilder/QBDragHandle.js +22 -0
- package/dist/components/QueryBuilder/QBDragHandle.js.map +1 -0
- package/dist/components/QueryBuilder/QueryBuilderControls.css +1 -0
- package/dist/components/QueryBuilder/QueryBuilderControls.d.ts +21 -0
- package/dist/components/QueryBuilder/QueryBuilderControls.d.ts.map +1 -0
- package/dist/components/QueryBuilder/QueryBuilderControls.js +143 -0
- package/dist/components/QueryBuilder/QueryBuilderControls.js.map +1 -0
- package/dist/components/QueryBuilder/QueryBuilderControls.module.js +17 -0
- package/dist/components/QueryBuilder/QueryBuilderControls.module.js.map +1 -0
- package/dist/components/QueryBuilder/QueryBuilderControls.module.scss +79 -0
- package/dist/components/QueryBuilder/QueryBuilderInternalContext.d.ts +39 -0
- package/dist/components/QueryBuilder/QueryBuilderInternalContext.d.ts.map +1 -0
- package/dist/components/QueryBuilder/QueryBuilderInternalContext.js +19 -0
- package/dist/components/QueryBuilder/QueryBuilderInternalContext.js.map +1 -0
- package/dist/components/QueryBuilder/qbTreeToReadable.d.ts +14 -0
- package/dist/components/QueryBuilder/qbTreeToReadable.d.ts.map +1 -0
- package/dist/components/QueryBuilder/qbTreeToReadable.js +89 -0
- package/dist/components/QueryBuilder/qbTreeToReadable.js.map +1 -0
- package/dist/components/QueryBuilder/queryBuilderDnd.d.ts +27 -0
- package/dist/components/QueryBuilder/queryBuilderDnd.d.ts.map +1 -0
- package/dist/components/QueryBuilder/queryBuilderDnd.js +41 -0
- package/dist/components/QueryBuilder/queryBuilderDnd.js.map +1 -0
- package/dist/components/QueryBuilder/queryBuilderDrag.css +1 -0
- package/dist/components/QueryBuilder/queryBuilderDrag.module.js +8 -0
- package/dist/components/QueryBuilder/queryBuilderDrag.module.js.map +1 -0
- package/dist/components/QueryBuilder/queryBuilderDrag.module.scss +12 -0
- package/dist/components/QueryBuilder/queryBuilderId.d.ts +2 -0
- package/dist/components/QueryBuilder/queryBuilderId.d.ts.map +1 -0
- package/dist/components/QueryBuilder/queryBuilderId.js +9 -0
- package/dist/components/QueryBuilder/queryBuilderId.js.map +1 -0
- package/dist/components/QueryBuilder/queryBuilderMetadata.d.ts +24 -0
- package/dist/components/QueryBuilder/queryBuilderMetadata.d.ts.map +1 -0
- package/dist/components/QueryBuilder/queryBuilderMetadata.js +91 -0
- package/dist/components/QueryBuilder/queryBuilderMetadata.js.map +1 -0
- package/dist/components/QueryBuilder/queryBuilderOperations.d.ts +71 -0
- package/dist/components/QueryBuilder/queryBuilderOperations.d.ts.map +1 -0
- package/dist/components/QueryBuilder/queryBuilderOperations.js +203 -0
- package/dist/components/QueryBuilder/queryBuilderOperations.js.map +1 -0
- package/dist/components/QueryBuilder/queryBuilderTranslation.d.ts +3 -2
- package/dist/components/QueryBuilder/queryBuilderTranslation.d.ts.map +1 -1
- package/dist/components/QueryBuilder/queryBuilderTranslation.js +82 -84
- package/dist/components/QueryBuilder/queryBuilderTranslation.js.map +1 -1
- package/dist/components/QueryBuilder/useQBCombinedSql.d.ts +11 -0
- package/dist/components/QueryBuilder/useQBCombinedSql.d.ts.map +1 -0
- package/dist/components/QueryBuilder/useQBCombinedSql.js +29 -0
- package/dist/components/QueryBuilder/useQBCombinedSql.js.map +1 -0
- package/dist/components/QueryBuilder/useQBFacetSourceMetadata.d.ts +18 -0
- package/dist/components/QueryBuilder/useQBFacetSourceMetadata.d.ts.map +1 -0
- package/dist/components/QueryBuilder/useQBFacetSourceMetadata.js +27 -0
- package/dist/components/QueryBuilder/useQBFacetSourceMetadata.js.map +1 -0
- package/dist/components/QueryWrapperPlotNav/QueryWrapperPlotNav.d.ts +14 -1
- package/dist/components/QueryWrapperPlotNav/QueryWrapperPlotNav.d.ts.map +1 -1
- package/dist/components/QueryWrapperPlotNav/QueryWrapperPlotNav.js +183 -119
- package/dist/components/QueryWrapperPlotNav/QueryWrapperPlotNav.js.map +1 -1
- package/dist/components/RssFeedCards/RssFeedCards.d.ts +1 -0
- package/dist/components/RssFeedCards/RssFeedCards.d.ts.map +1 -1
- package/dist/components/RssFeedCards/RssFeedCards.js +11 -11
- package/dist/components/RssFeedCards/RssFeedCards.js.map +1 -1
- package/dist/components/SynapseChat/SynapseChat.d.ts +7 -1
- package/dist/components/SynapseChat/SynapseChat.d.ts.map +1 -1
- package/dist/components/SynapseChat/SynapseChat.js +76 -71
- package/dist/components/SynapseChat/SynapseChat.js.map +1 -1
- package/dist/components/SynapseChat/SynapsePortalChatDialog.d.ts +3 -1
- package/dist/components/SynapseChat/SynapsePortalChatDialog.d.ts.map +1 -1
- package/dist/components/SynapseChat/SynapsePortalChatDialog.js +24 -13
- package/dist/components/SynapseChat/SynapsePortalChatDialog.js.map +1 -1
- package/dist/components/SynapseChat/portalChatSessionStorage.d.ts +23 -0
- package/dist/components/SynapseChat/portalChatSessionStorage.d.ts.map +1 -0
- package/dist/components/SynapseChat/portalChatSessionStorage.js +29 -0
- package/dist/components/SynapseChat/portalChatSessionStorage.js.map +1 -0
- package/dist/components/SynapseTable/TopLevelControls/TopLevelControls.d.ts +6 -0
- package/dist/components/SynapseTable/TopLevelControls/TopLevelControls.d.ts.map +1 -1
- package/dist/components/SynapseTable/TopLevelControls/TopLevelControls.js +92 -79
- package/dist/components/SynapseTable/TopLevelControls/TopLevelControls.js.map +1 -1
- package/dist/components/dataaccess/UserAccessRequestHistory/InFlightEDucSignaturesTable.d.ts +3 -4
- package/dist/components/dataaccess/UserAccessRequestHistory/InFlightEDucSignaturesTable.d.ts.map +1 -1
- package/dist/components/dataaccess/UserAccessRequestHistory/InFlightEDucSignaturesTable.js +2 -2
- package/dist/components/dataaccess/UserAccessRequestHistory/InFlightEDucSignaturesTable.js.map +1 -1
- package/dist/components/dataaccess/UserAccessRequestHistory/UserAccessRequestHistoryPlace.js +1 -1
- package/dist/components/dataaccess/UserAccessRequestHistory/UserAccessRequestHistoryPlace.js.map +1 -1
- package/dist/components/entity/page/action_menu/EntityActionMenu.d.ts.map +1 -1
- package/dist/components/entity/page/action_menu/EntityActionMenu.js +9 -2
- package/dist/components/entity/page/action_menu/EntityActionMenu.js.map +1 -1
- package/dist/components/entity/page/title_bar/EntityPageTitleBar.d.ts +0 -1
- package/dist/components/entity/page/title_bar/EntityPageTitleBar.d.ts.map +1 -1
- package/dist/components/entity/page/title_bar/EntityPageTitleBar.js +36 -37
- package/dist/components/entity/page/title_bar/EntityPageTitleBar.js.map +1 -1
- package/dist/components/menu/ComplexMenu.js +1 -1
- package/dist/components/menu/ComplexMenu.js.map +1 -1
- package/dist/components/menu/DropdownMenu.d.ts.map +1 -1
- package/dist/components/menu/DropdownMenu.js +4 -0
- package/dist/components/menu/DropdownMenu.js.map +1 -1
- package/dist/components/styled/LeftRightPanel.d.ts.map +1 -1
- package/dist/components/styled/LeftRightPanel.js +19 -2
- package/dist/components/styled/LeftRightPanel.js.map +1 -1
- package/dist/features/entity/metadata-task/hooks/useMarkCurationTaskInProgress.d.ts +10 -0
- package/dist/features/entity/metadata-task/hooks/useMarkCurationTaskInProgress.d.ts.map +1 -0
- package/dist/features/entity/metadata-task/hooks/useMarkCurationTaskInProgress.js +20 -0
- package/dist/features/entity/metadata-task/hooks/useMarkCurationTaskInProgress.js.map +1 -0
- package/dist/features/entity/metadata-task/hooks/useOpenCuratorButton.d.ts.map +1 -1
- package/dist/features/entity/metadata-task/hooks/useOpenCuratorButton.js +29 -20
- package/dist/features/entity/metadata-task/hooks/useOpenCuratorButton.js.map +1 -1
- package/dist/mocks/accessRequirement/mockFormTemplates.d.ts +16 -0
- package/dist/mocks/accessRequirement/mockFormTemplates.d.ts.map +1 -0
- package/dist/mocks/accessRequirement/mockFormTemplates.js +63 -0
- package/dist/mocks/accessRequirement/mockFormTemplates.js.map +1 -0
- package/dist/mocks/accessRequirement/mockJsonSchemaAccessRequirements.d.ts +7 -0
- package/dist/mocks/accessRequirement/mockJsonSchemaAccessRequirements.d.ts.map +1 -0
- package/dist/mocks/accessRequirement/mockJsonSchemaAccessRequirements.js +47 -0
- package/dist/mocks/accessRequirement/mockJsonSchemaAccessRequirements.js.map +1 -0
- package/dist/mocks/accessRequirement/mockJsonSchemas.d.ts +27 -0
- package/dist/mocks/accessRequirement/mockJsonSchemas.d.ts.map +1 -0
- package/dist/mocks/accessRequirement/mockJsonSchemas.js +83 -0
- package/dist/mocks/accessRequirement/mockJsonSchemas.js.map +1 -0
- package/dist/mocks/msw/handlers/aridhiaHandlers.d.ts +18 -1
- package/dist/mocks/msw/handlers/aridhiaHandlers.d.ts.map +1 -1
- package/dist/mocks/msw/handlers/aridhiaHandlers.js +39 -33
- package/dist/mocks/msw/handlers/aridhiaHandlers.js.map +1 -1
- package/dist/mocks/msw/handlers/asyncJobHandlers.d.ts +41 -14
- package/dist/mocks/msw/handlers/asyncJobHandlers.d.ts.map +1 -1
- package/dist/mocks/msw/handlers/asyncJobHandlers.js +53 -44
- package/dist/mocks/msw/handlers/asyncJobHandlers.js.map +1 -1
- package/dist/mocks/msw/handlers/chatHandlers.d.ts.map +1 -1
- package/dist/mocks/msw/handlers/chatHandlers.js +19 -13
- package/dist/mocks/msw/handlers/chatHandlers.js.map +1 -1
- package/dist/mocks/msw/handlers/formTemplateHandlers.d.ts +5 -0
- package/dist/mocks/msw/handlers/formTemplateHandlers.d.ts.map +1 -0
- package/dist/mocks/msw/handlers/formTemplateHandlers.js +65 -0
- package/dist/mocks/msw/handlers/formTemplateHandlers.js.map +1 -0
- package/dist/mocks/msw/handlers/schemaHandlers.d.ts +2 -1
- package/dist/mocks/msw/handlers/schemaHandlers.d.ts.map +1 -1
- package/dist/mocks/msw/handlers/schemaHandlers.js +13 -7
- package/dist/mocks/msw/handlers/schemaHandlers.js.map +1 -1
- package/dist/mocks/msw/handlers/searchQueryHandlers.d.ts.map +1 -1
- package/dist/mocks/msw/handlers/searchQueryHandlers.js +24 -18
- package/dist/mocks/msw/handlers/searchQueryHandlers.js.map +1 -1
- package/dist/mocks/msw/handlers/tableQueryHandlers.d.ts.map +1 -1
- package/dist/mocks/msw/handlers/tableQueryHandlers.js +35 -16
- package/dist/mocks/msw/handlers/tableQueryHandlers.js.map +1 -1
- package/dist/mocks/msw/handlers.d.ts.map +1 -1
- package/dist/mocks/msw/handlers.js +49 -47
- package/dist/mocks/msw/handlers.js.map +1 -1
- package/dist/style/abstracts/_cssVariables.scss +7 -0
- package/dist/style/components/_query-wrapper-plot-nav.scss +9 -0
- package/dist/style/main.css +1 -1
- package/dist/synapse-queries/KeyFactory.d.ts +5 -1
- package/dist/synapse-queries/KeyFactory.d.ts.map +1 -1
- package/dist/synapse-queries/KeyFactory.js +14 -2
- package/dist/synapse-queries/KeyFactory.js.map +1 -1
- package/dist/synapse-queries/chat/useChat.d.ts.map +1 -1
- package/dist/synapse-queries/chat/useChat.js +2 -4
- package/dist/synapse-queries/chat/useChat.js.map +1 -1
- package/dist/synapse-queries/dataaccess/index.d.ts +1 -0
- package/dist/synapse-queries/dataaccess/index.d.ts.map +1 -1
- package/dist/synapse-queries/dataaccess/index.js +4 -3
- package/dist/synapse-queries/dataaccess/useFormTemplate.d.ts +41 -0
- package/dist/synapse-queries/dataaccess/useFormTemplate.d.ts.map +1 -0
- package/dist/synapse-queries/dataaccess/useFormTemplate.js +63 -0
- package/dist/synapse-queries/dataaccess/useFormTemplate.js.map +1 -0
- package/dist/synapse-queries/index.js +186 -180
- package/dist/synapse-queries/jsonschema/useCreateJsonSchema.d.ts +9 -0
- package/dist/synapse-queries/jsonschema/useCreateJsonSchema.d.ts.map +1 -0
- package/dist/synapse-queries/jsonschema/useCreateJsonSchema.js +22 -0
- package/dist/synapse-queries/jsonschema/useCreateJsonSchema.js.map +1 -0
- package/dist/testutils/ReactQueryMockUtils.js.map +1 -1
- package/dist/testutils/vitest.setup.js +18 -9
- package/dist/testutils/vitest.setup.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/utils/APIConstants.d.ts +1 -0
- package/dist/utils/APIConstants.d.ts.map +1 -1
- package/dist/utils/APIConstants.js +2 -2
- package/dist/utils/APIConstants.js.map +1 -1
- package/dist/utils/appendFinalQueryParamKey.d.ts.map +1 -1
- package/dist/utils/appendFinalQueryParamKey.js +4 -1
- package/dist/utils/appendFinalQueryParamKey.js.map +1 -1
- package/dist/utils/functions/ArrayUtils.d.ts +3 -0
- package/dist/utils/functions/ArrayUtils.d.ts.map +1 -1
- package/dist/utils/functions/ArrayUtils.js +7 -1
- package/dist/utils/functions/ArrayUtils.js.map +1 -1
- package/dist/utils/jsonschema/generateDataAccessSchema.d.ts +26 -0
- package/dist/utils/jsonschema/generateDataAccessSchema.d.ts.map +1 -0
- package/dist/utils/jsonschema/generateDataAccessSchema.js +28 -0
- package/dist/utils/jsonschema/generateDataAccessSchema.js.map +1 -0
- package/dist/utils/jsonschema/getType.d.ts.map +1 -1
- package/dist/utils/jsonschema/getType.js +4 -1
- package/dist/utils/jsonschema/getType.js.map +1 -1
- package/dist/utils/jsonschema/submissionContext.d.ts +86 -0
- package/dist/utils/jsonschema/submissionContext.d.ts.map +1 -0
- package/dist/utils/jsonschema/submissionContext.js +186 -0
- package/dist/utils/jsonschema/submissionContext.js.map +1 -0
- package/package.json +10 -8
- package/dist/components/AccessRequirement/AddConditionsForUseButton/AddConditionsForUseButton.d.ts +0 -6
- package/dist/components/AccessRequirement/AddConditionsForUseButton/AddConditionsForUseButton.d.ts.map +0 -1
- package/dist/components/AccessRequirement/AddConditionsForUseButton/AddConditionsForUseButton.js +0 -32
- package/dist/components/AccessRequirement/AddConditionsForUseButton/AddConditionsForUseButton.js.map +0 -1
- package/dist/components/entity/page/title_bar/TitleBarProperties.d.ts +0 -9
- package/dist/components/entity/page/title_bar/TitleBarProperties.d.ts.map +0 -1
- package/dist/components/entity/page/title_bar/TitleBarProperties.js +0 -24
- package/dist/components/entity/page/title_bar/TitleBarProperties.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SynapseChat.js","names":[],"sources":["../../../src/components/SynapseChat/SynapseChat.tsx"],"sourcesContent":["import { ChatState, useChatState } from '@/components/SynapseChat/useChatState'\nimport {\n useCreateAgentSession,\n useUpdateAgentSession,\n} from '@/synapse-queries/chat/useChat'\nimport { useSynapseContext } from '@/utils'\nimport {\n Alert,\n Box,\n Chip,\n List,\n ListItem,\n Stack,\n Typography,\n} from '@mui/material'\nimport {\n AgentSession,\n FileHandleAssociateType,\n GridAgentSessionContext,\n} from '@sage-bionetworks/synapse-client'\nimport { AgentAccessLevel } from '@sage-bionetworks/synapse-types'\nimport { useEffect, useRef, useState } from 'react'\nimport { SkeletonParagraph } from '../Skeleton'\nimport { displayToast } from '../ToastMessage'\nimport AccessLevelMenu from './AccessLevelMenu'\nimport { ChatAttachment } from './utils/types'\nimport { ChatInputArea } from './components/ChatInputArea/ChatInputArea'\nimport SynapseChatMessage from './SynapseChatMessage'\nimport { SmartToyTwoTone } from '@mui/icons-material'\nimport { UserCard } from '../UserCard/UserCard'\nimport { useApplicationSessionContext } from '@/utils/AppUtils'\nimport { ReactComponent as CurieAvatarHead } from '@/assets/illustrations/curie_avatar_head.svg'\n\nconst CURIE_GREETING = 'Hi! How can I help you today?'\n\nconst CURIE_ACCESS_LEVEL_SUFFIX: Record<AgentAccessLevel, string> = {\n [AgentAccessLevel.PUBLICLY_ACCESSIBLE]: ' and can only read public data.',\n [AgentAccessLevel.READ_YOUR_PRIVATE_DATA]:\n ' and can read your public and private data in Synapse on your behalf.',\n [AgentAccessLevel.WRITE_YOUR_PRIVATE_DATA]:\n ' and can read and write your public and private data in Synapse on your behalf.',\n}\n\nconst DEFAULT_AVATAR = (\n <Box\n sx={{\n p: '3px',\n borderRadius: '50%',\n borderStyle: 'solid',\n borderWidth: '1px',\n borderColor: 'grey.300',\n mt: '10px',\n height: '31px',\n }}\n >\n <SmartToyTwoTone sx={{ color: 'secondary.main' }} />\n </Box>\n)\n\nconst CURIE_AVATAR = (\n <Box\n sx={{\n mt: '10px',\n height: '30px',\n width: '30px',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n }}\n >\n <CurieAvatarHead />\n </Box>\n)\n\nexport type SynapseChatProps = {\n initialMessage?: string //optional initial message\n agentRegistrationId?: string // if provided, use this agent\n chatbotName?: string // optional name of this chatbot agent\n variant?: 'default' | 'curie'\n hideTitle?: boolean\n textboxPositionOffset?: string // when embedded in a form, the textbox (form) stuck to the bottom may need to be offset due to container padding (dialog content for example!)\n /* optional session context for the agent session */\n sessionContext?: GridAgentSessionContext\n /* The current session, if state is lifted out of this component */\n externalSession?: AgentSession\n /* A callback invoked to bootstrap the current session, if state is to be lifted out of this component */\n setExternalSession?: (s: AgentSession | undefined) => void\n /* The current chat history, if state is lifted out of this component */\n externalChatState?: ChatState\n // default access level for the agent session.\n defaultAgentAccessLevel?: AgentAccessLevel\n // Whether to show the access level menu for the agent session.\n showAccessLevelMenu?: boolean\n /**\n * Optional callback invoked once when a chat response is received from the server.\n * Use this for side effects such as navigation based on the response content.\n * Called in the mutation onSuccess handler so it runs exactly once per response.\n */\n onChatResponse?: (responseText: string) => void\n /** Optional list of prompt suggestions shown as clickable pills above the text input */\n suggestedPrompts?: string[]\n /** Optional custom avatar for the chatbot agent */\n agentAvatar?: React.ReactNode\n /**\n * Whether to allow the user to attach local files to their chat message.\n * @default false\n */\n allowAttachments?: boolean\n}\n\nexport function SynapseChat({\n initialMessage,\n agentRegistrationId,\n chatbotName = 'SynapseChat',\n variant = 'default',\n agentAvatar,\n hideTitle = false,\n textboxPositionOffset = '0px',\n sessionContext,\n externalSession,\n setExternalSession,\n externalChatState,\n showAccessLevelMenu = true,\n onChatResponse,\n suggestedPrompts,\n allowAttachments = false,\n}: SynapseChatProps) {\n const { accessToken } = useSynapseContext()\n const { userId } = useApplicationSessionContext()\n\n const baseDisclaimerText = chatbotName + ' can make mistakes'\n\n const resolvedAgentAvatar =\n agentAvatar ?? (variant === 'curie' ? CURIE_AVATAR : DEFAULT_AVATAR)\n\n const userAvatar = (\n <UserCard ownerId={userId} size=\"AVATAR\" avatarSize=\"MEDIUM\" />\n )\n const [localAgentSession, setLocalAgentSession] = useState<AgentSession>()\n const agentSession = externalSession ?? localAgentSession\n const setAgentSession = setExternalSession ?? setLocalAgentSession\n\n const { mutate: createAgentSession, error: createAgentSessionError } =\n useCreateAgentSession({\n onSuccess: newAgentSession => setAgentSession(newAgentSession),\n })\n\n const { mutate: updateAgentSession } = useUpdateAgentSession({\n onSuccess: updatedAgentSession => setAgentSession(updatedAgentSession),\n onError: err =>\n displayToast(\n `Unable to update the agent session: ${err.message}`,\n 'danger',\n ),\n })\n const [agentAccessLevel, setAgentAccessLevel] = useState<AgentAccessLevel>(\n sessionContext\n ? AgentAccessLevel.WRITE_YOUR_PRIVATE_DATA\n : AgentAccessLevel.PUBLICLY_ACCESSIBLE,\n )\n\n const internalChatState = useChatState(agentSession, onChatResponse)\n const chatState = externalChatState ?? internalChatState\n const { interactions, isAwaitingResponse, sendChat } = chatState\n\n const showGreeting = variant === 'curie' && interactions.length === 0\n\n const curieAccessLevelSuffix =\n variant === 'curie' ? CURIE_ACCESS_LEVEL_SUFFIX[agentAccessLevel] : ''\n const disclaimerText = baseDisclaimerText + curieAccessLevelSuffix\n\n // Only interactions added after this component instance mounted should play the entry\n // animation. Callers may lift state so history survives a `Dialog` closing, but the\n // `Dialog` unmounts its children, so every reopen would otherwise re-animate the whole\n // conversation.\n const presentAtMountRef = useRef<Set<string> | undefined>(undefined)\n if (presentAtMountRef.current === undefined) {\n presentAtMountRef.current = new Set(interactions.map(i => i.id))\n }\n const presentAtMount = presentAtMountRef.current\n\n // Keep track of the text that the user is currently typing into the textfield\n const [userChatTextfieldValue, setUserChatTextfieldValue] = useState('')\n const [initialMessageProcessed, setInitialMessageProcessed] = useState(false)\n\n // A copy of the attachments sent with the last interaction, so it can still show rich\n // (name/type) chips after ChatInputArea has cleared its own attachment state. This is passed to\n // the last interaction for its entire lifetime -- sent, then processing, then completed -- as a\n // fallback filename source, since the request body (FileHandleAssociation) never carries a\n // filename and the server-resolved filename (attachmentStatuses) only arrives once the job\n // completes. It's simply overwritten on the next send.\n const [lastSentAttachments, setLastSentAttachments] = useState<\n ChatAttachment[]\n >([])\n\n // Restore chat session history, if exists.\n // TODO: currently only a single page is restored. Add support for multiple pages (and detect the user scrolling up to restore the next page of results older)\n // const {\n // data: sessionHistoryInfiniteData,\n // } = //, hasNextPage: hasMoreSessionHistory, fetchNextPage: fetchNextSessionHistoryPage, isLoading: isSessionHistoryLoading } =\n // useGetAgentChatSessionHistoryInfinite(\n // {\n // sessionId: agentSession?.sessionId,\n // },\n // {\n // enabled: !!agentSession,\n // },\n // )\n\n // const sessionHistory = useMemo(\n // () =>\n // sessionHistoryInfiniteData?.pages\n // .flatMap(page => page.page)\n // /* Note: session history is ordered from most recent to least recent in each page, so reverse the order when restoring the chat interface */\n // .reverse() ?? [],\n // [sessionHistoryInfiniteData],\n // )\n\n useEffect(() => {\n // on mount, create a new agent session!\n if (createAgentSession && !agentSession) {\n createAgentSession({\n agentAccessLevel,\n agentRegistrationId,\n sessionContext,\n })\n }\n }, [\n createAgentSession,\n agentSession,\n accessToken,\n sessionContext,\n agentAccessLevel,\n agentRegistrationId,\n ])\n\n useEffect(() => {\n // on mount, resolve the initial message chat interaction (if set)\n if (agentSession && initialMessage && !initialMessageProcessed) {\n sendChat(initialMessage)\n setInitialMessageProcessed(true)\n }\n }, [agentSession, initialMessage, initialMessageProcessed, sendChat])\n\n const handleSend = (message: string, attachments: ChatAttachment[]) => {\n sendChat(\n message,\n attachments.length\n ? attachments.map(attachment => ({\n fileHandleId: attachment.fileHandleId,\n // The backend short-circuits the FileHandleAssociation auth check for a user's own\n // uploaded file handle, so associateObjectId/associateObjectType are not totally\n // accurate here. FileHandleAssociateType has no dedicated value for \"the uploader's\n // own bare file handle\", so this stubs associateObjectId to the fileHandleId itself\n // and the FileEntity associate type, which supports the short-circuit path.\n associateObjectId: attachment.fileHandleId,\n associateObjectType: FileHandleAssociateType.FileEntity,\n }))\n : undefined,\n )\n setUserChatTextfieldValue('')\n setLastSentAttachments(attachments)\n }\n\n if (createAgentSessionError) {\n return (\n <Alert severity={'error'} sx={{ my: 2 }}>\n {createAgentSessionError.reason}\n </Alert>\n )\n }\n\n return (\n <Box\n sx={{\n display: 'flex',\n flexDirection: 'column',\n justifyContent: variant === 'curie' ? 'flex-start' : 'space-between',\n gap: variant === 'curie' ? '20px' : '0',\n maxWidth: '1100px',\n mx: 'auto',\n height: '100%',\n }}\n >\n {!hideTitle && (\n <Typography\n variant=\"headline1\"\n sx={{\n p: '20px',\n borderBottom: '1px solid',\n borderColor: 'grey.300',\n position: 'sticky',\n top: '0px',\n backgroundColor: 'white',\n zIndex: 1,\n }}\n >\n {chatbotName}\n </Typography>\n )}\n {showAccessLevelMenu && variant !== 'curie' && (\n <AccessLevelMenu\n initAccessLevel={agentAccessLevel}\n onChange={newAccessLevel => {\n setAgentAccessLevel(newAccessLevel)\n updateAgentSession({\n agentAccessLevel: newAccessLevel,\n sessionId: agentSession!.sessionId!,\n })\n }}\n />\n )}\n {!agentSession && <SkeletonParagraph numRows={10} />}\n {agentSession && (\n <Box\n sx={{\n flexGrow: 1,\n overflowY: 'auto',\n mb: variant === 'curie' ? 0 : 2,\n }}\n >\n <List\n sx={{\n flex: 1,\n overflowY: 'auto',\n pt: '20px',\n ...(variant === 'curie' && { pt: 0, pb: 0, gap: '20px' }),\n display: 'flex',\n flexDirection: 'column',\n ...(showGreeting && {\n minHeight: '100%',\n justifyContent: 'flex-end',\n }),\n }}\n >\n {/* {sessionHistory &&\n sessionHistory.map((interaction, index) => {\n return (\n <SynapseChatInteraction\n key={index}\n userMessage={interaction.usersRequestText}\n chatResponseText={interaction.agentResponseText}\n />\n )\n })} */}\n {showGreeting && (\n <ListItem\n sx={{\n display: 'grid',\n gridTemplateColumns: '50px auto',\n columnGap: '16px',\n justifyItems: 'start',\n alignItems: 'start',\n p: 0,\n }}\n >\n {resolvedAgentAvatar}\n <Typography sx={{ justifySelf: 'start', mt: '14px' }}>\n {CURIE_GREETING}\n </Typography>\n </ListItem>\n )}\n {interactions.map((interaction, index) => {\n const isLast = index === interactions.length - 1\n return (\n <SynapseChatMessage\n agentAvatar={resolvedAgentAvatar}\n userAvatar={userAvatar}\n key={interaction.id}\n userMessage={interaction.userMessage}\n chatJobId={interaction.jobId}\n showLoadingIcon={variant !== 'curie'}\n onSendChat={sendChat}\n scrollIntoView={isLast}\n animateEntry={!presentAtMount.has(interaction.id)}\n isAwaitingResponse={isAwaitingResponse}\n pendingAttachments={\n // Only one interaction can be in flight at a time (the composer is disabled\n // while isAwaitingResponse), so lastSentAttachments always corresponds to\n // whichever interaction is last.\n isLast ? lastSentAttachments : undefined\n }\n />\n )\n })}\n </List>\n </Box>\n )}\n <Box\n sx={{\n position: 'sticky',\n bottom: variant === 'curie' ? '0px' : textboxPositionOffset,\n backgroundColor: 'white',\n }}\n >\n {suggestedPrompts &&\n suggestedPrompts.length > 0 &&\n interactions.length === 0 && (\n <Stack\n direction=\"row\"\n spacing={1}\n sx={{ pt: '8px', flexWrap: 'wrap', gap: 1 }}\n >\n {suggestedPrompts.map(prompt => (\n <Chip\n key={prompt}\n label={prompt}\n variant=\"outlined\"\n onClick={() => setUserChatTextfieldValue(prompt)}\n disabled={!agentSession}\n sx={{ cursor: 'pointer' }}\n />\n ))}\n </Stack>\n )}\n <Box sx={{ mt: '5px' }}>\n <ChatInputArea\n value={userChatTextfieldValue}\n onValueChange={setUserChatTextfieldValue}\n onSend={handleSend}\n placeholder={\n variant === 'curie' ? 'Ask anything' : `Message ${chatbotName}`\n }\n disabled={!agentSession || isAwaitingResponse}\n allowAttachments={allowAttachments}\n />\n </Box>\n </Box>\n <Typography variant=\"smallText1\" sx={{ pt: '8px', textAlign: 'center' }}>\n {disclaimerText}\n </Typography>\n </Box>\n )\n}\n\nexport default SynapseChat\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAiCA,IAAM,KAAiB,iCAEjB,KAA8D;EACjE,EAAiB,sBAAsB;EACvC,EAAiB,yBAChB;EACD,EAAiB,0BAChB;AACJ,GAEM,KACJ,kBAAC,GAAD;CACE,IAAI;EACF,GAAG;EACH,cAAc;EACd,aAAa;EACb,aAAa;EACb,aAAa;EACb,IAAI;EACJ,QAAQ;CACV;WAEA,kBAAC,GAAD,EAAiB,IAAI,EAAE,OAAO,iBAAiB,EAAI,CAAA;AAChD,CAAA,GAGD,IACJ,kBAAC,GAAD;CACE,IAAI;EACF,IAAI;EACJ,QAAQ;EACR,OAAO;EACP,SAAS;EACT,YAAY;EACZ,gBAAgB;CAClB;WAEA,kBAAC,GAAD,CAAkB,CAAA;AACf,CAAA;AAuCP,SAAgB,EAAY,EAC1B,mBACA,wBACA,iBAAc,eACd,aAAU,WACV,gBACA,eAAY,IACZ,2BAAwB,OACxB,mBACA,oBACA,uBACA,sBACA,yBAAsB,IACtB,mBACA,qBACA,sBAAmB,MACA;CACnB,IAAM,EAAE,mBAAgB,EAAkB,GACpC,EAAE,cAAW,EAA6B,GAE1C,IAAqB,IAAc,sBAEnC,IACJ,MAAgB,MAAY,UAAU,IAAe,KAEjD,IACJ,kBAAC,GAAD;EAAU,SAAS;EAAQ,MAAK;EAAS,YAAW;CAAU,CAAA,GAE1D,CAAC,GAAmB,MAAwB,EAAuB,GACnE,IAAe,KAAmB,GAClC,IAAkB,KAAsB,IAExC,EAAE,QAAQ,GAAoB,OAAO,MACzC,EAAsB,EACpB,YAAW,MAAmB,EAAgB,CAAe,EAC/D,CAAC,GAEG,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,gBAAgB;OAChB,cAAc,CAAC,GAAe,IAAI,EAAY,EAAE;OAC5B;OACpB,oBAIE,IAAS,KAAsB,KAAA;MAElC,GAdM,EAAY,EAclB;KAEL,CAAC,CACG;;GACH,CAAA;GAEP,kBAAC,GAAD;IACE,IAAI;KACF,UAAU;KACV,QAAQ,MAAY,UAAU,QAAQ;KACtC,iBAAiB;IACnB;cALF,CAOG,KACC,EAAiB,SAAS,KAC1B,EAAa,WAAW,KACtB,kBAAC,GAAD;KACE,WAAU;KACV,SAAS;KACT,IAAI;MAAE,IAAI;MAAO,UAAU;MAAQ,KAAK;KAAE;eAEzC,EAAiB,KAAI,MACpB,kBAAC,GAAD;MAEE,OAAO;MACP,SAAQ;MACR,eAAe,EAA0B,CAAM;MAC/C,UAAU,CAAC;MACX,IAAI,EAAE,QAAQ,UAAU;KACzB,GANM,CAMN,CACF;IACI,CAAA,GAEX,kBAAC,GAAD;KAAK,IAAI,EAAE,IAAI,MAAM;eACnB,kBAAC,IAAD;MACE,OAAO;MACP,eAAe;MACf,QAAQ;MACR,aACE,MAAY,UAAU,iBAAiB,WAAW;MAEpD,UAAU,CAAC,KAAgB;MACT;KACnB,CAAA;IACE,CAAA,CACF;;GACL,kBAAC,GAAD;IAAY,SAAQ;IAAa,IAAI;KAAE,IAAI;KAAO,WAAW;IAAS;cACnE;GACS,CAAA;EACT;;AAET"}
|
|
1
|
+
{"version":3,"file":"SynapseChat.js","names":[],"sources":["../../../src/components/SynapseChat/SynapseChat.tsx"],"sourcesContent":["import { ChatState, useChatState } from '@/components/SynapseChat/useChatState'\nimport {\n useCreateAgentSession,\n useUpdateAgentSession,\n} from '@/synapse-queries/chat/useChat'\nimport { useSynapseContext } from '@/utils'\nimport {\n Alert,\n Box,\n Chip,\n List,\n ListItem,\n Stack,\n Typography,\n} from '@mui/material'\nimport {\n AgentSession,\n FileHandleAssociateType,\n GridAgentSessionContext,\n} from '@sage-bionetworks/synapse-client'\nimport { AgentAccessLevel } from '@sage-bionetworks/synapse-types'\nimport { useEffect, useRef, useState } from 'react'\nimport { SkeletonParagraph } from '../Skeleton'\nimport { displayToast } from '../ToastMessage'\nimport AccessLevelMenu from './AccessLevelMenu'\nimport { ChatAttachment } from './utils/types'\nimport { ChatInputArea } from './components/ChatInputArea/ChatInputArea'\nimport SynapseChatMessage from './SynapseChatMessage'\nimport { SmartToyTwoTone } from '@mui/icons-material'\nimport { UserCard } from '../UserCard/UserCard'\nimport { useApplicationSessionContext } from '@/utils/AppUtils'\nimport { ReactComponent as CurieAvatarHead } from '@/assets/illustrations/curie_avatar_head.svg'\n\nconst CURIE_GREETING = 'Hi! How can I help you today?'\n\nconst CURIE_ACCESS_LEVEL_SUFFIX: Record<AgentAccessLevel, string> = {\n [AgentAccessLevel.PUBLICLY_ACCESSIBLE]: ' and can only read public data.',\n [AgentAccessLevel.READ_YOUR_PRIVATE_DATA]:\n ' and can read your public and private data in Synapse on your behalf.',\n [AgentAccessLevel.WRITE_YOUR_PRIVATE_DATA]:\n ' and can read and write your public and private data in Synapse on your behalf.',\n}\n\nconst DEFAULT_AVATAR = (\n <Box\n sx={{\n p: '3px',\n borderRadius: '50%',\n borderStyle: 'solid',\n borderWidth: '1px',\n borderColor: 'grey.300',\n mt: '10px',\n height: '31px',\n }}\n >\n <SmartToyTwoTone sx={{ color: 'secondary.main' }} />\n </Box>\n)\n\nconst CURIE_AVATAR = (\n <Box\n sx={{\n mt: '10px',\n height: '30px',\n width: '30px',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n }}\n >\n <CurieAvatarHead />\n </Box>\n)\n\nexport type SynapseChatProps = {\n initialMessage?: string //optional initial message\n agentRegistrationId?: string // if provided, use this agent\n chatbotName?: string // optional name of this chatbot agent\n variant?: 'default' | 'curie'\n hideTitle?: boolean\n textboxPositionOffset?: string // when embedded in a form, the textbox (form) stuck to the bottom may need to be offset due to container padding (dialog content for example!)\n /* optional session context for the agent session */\n sessionContext?: GridAgentSessionContext\n /* The current session, if state is lifted out of this component */\n externalSession?: AgentSession\n /* A callback invoked to bootstrap the current session, if state is to be lifted out of this component */\n setExternalSession?: (s: AgentSession | undefined) => void\n /* The current chat history, if state is lifted out of this component */\n externalChatState?: ChatState\n // default access level for the agent session.\n defaultAgentAccessLevel?: AgentAccessLevel\n // Whether to show the access level menu for the agent session.\n showAccessLevelMenu?: boolean\n /**\n * Optional callback invoked once when a chat response is received from the server.\n * Use this for side effects such as navigation based on the response content.\n * Called in the mutation onSuccess handler so it runs exactly once per response.\n */\n onChatResponse?: (responseText: string) => void\n /** Optional list of prompt suggestions shown as clickable pills above the text input */\n suggestedPrompts?: string[]\n /** Optional custom avatar for the chatbot agent */\n agentAvatar?: React.ReactNode\n /**\n * Whether to allow the user to attach local files to their chat message.\n * @default false\n */\n allowAttachments?: boolean\n /**\n * Invoked when creating the agent session fails because the current (anonymous) user is not\n * authorized to start a session with this agent. Callers should use this to prompt the user to\n * log in. When omitted, the session creation error is shown inline instead.\n */\n onSessionCreationUnauthenticated?: () => void\n}\n\nexport function SynapseChat({\n initialMessage,\n agentRegistrationId,\n chatbotName = 'SynapseChat',\n variant = 'default',\n agentAvatar,\n hideTitle = false,\n textboxPositionOffset = '0px',\n sessionContext,\n externalSession,\n setExternalSession,\n externalChatState,\n showAccessLevelMenu = true,\n onChatResponse,\n suggestedPrompts,\n allowAttachments = false,\n onSessionCreationUnauthenticated,\n}: SynapseChatProps) {\n const { accessToken, isAuthenticated } = useSynapseContext()\n const { userId } = useApplicationSessionContext()\n\n const baseDisclaimerText = chatbotName + ' can make mistakes'\n\n const resolvedAgentAvatar =\n agentAvatar ?? (variant === 'curie' ? CURIE_AVATAR : DEFAULT_AVATAR)\n\n const userAvatar = (\n <UserCard ownerId={userId} size=\"AVATAR\" avatarSize=\"MEDIUM\" />\n )\n const [localAgentSession, setLocalAgentSession] = useState<AgentSession>()\n const agentSession = externalSession ?? localAgentSession\n const setAgentSession = setExternalSession ?? setLocalAgentSession\n\n const { mutate: createAgentSession, error: createAgentSessionError } =\n useCreateAgentSession({\n onSuccess: newAgentSession => setAgentSession(newAgentSession),\n onError: err => {\n // A registration that the ACT has not opened to anonymous chat rejects an anonymous\n // session with a 401/403. Defer to the caller to prompt the user to log in.\n if (!isAuthenticated && (err.status === 401 || err.status === 403)) {\n onSessionCreationUnauthenticated?.()\n }\n },\n })\n\n const { mutate: updateAgentSession } = useUpdateAgentSession({\n onSuccess: updatedAgentSession => setAgentSession(updatedAgentSession),\n onError: err =>\n displayToast(\n `Unable to update the agent session: ${err.message}`,\n 'danger',\n ),\n })\n const [agentAccessLevel, setAgentAccessLevel] = useState<AgentAccessLevel>(\n sessionContext\n ? AgentAccessLevel.WRITE_YOUR_PRIVATE_DATA\n : AgentAccessLevel.PUBLICLY_ACCESSIBLE,\n )\n\n const internalChatState = useChatState(agentSession, onChatResponse)\n const chatState = externalChatState ?? internalChatState\n const { interactions, isAwaitingResponse, sendChat } = chatState\n\n const showGreeting = variant === 'curie' && interactions.length === 0\n\n const curieAccessLevelSuffix =\n variant === 'curie' ? CURIE_ACCESS_LEVEL_SUFFIX[agentAccessLevel] : ''\n const disclaimerText = baseDisclaimerText + curieAccessLevelSuffix\n\n // Only interactions added after this component instance mounted should play the entry\n // animation. Callers may lift state so history survives a `Dialog` closing, but the\n // `Dialog` unmounts its children, so every reopen would otherwise re-animate the whole\n // conversation.\n const presentAtMountRef = useRef<Set<string> | undefined>(undefined)\n if (presentAtMountRef.current === undefined) {\n presentAtMountRef.current = new Set(interactions.map(i => i.id))\n }\n const presentAtMount = presentAtMountRef.current\n\n // Keep track of the text that the user is currently typing into the textfield\n const [userChatTextfieldValue, setUserChatTextfieldValue] = useState('')\n const [initialMessageProcessed, setInitialMessageProcessed] = useState(false)\n\n // A copy of the attachments sent with the last interaction, so it can still show rich\n // (name/type) chips after ChatInputArea has cleared its own attachment state. This is passed to\n // the last interaction for its entire lifetime -- sent, then processing, then completed -- as a\n // fallback filename source, since the request body (FileHandleAssociation) never carries a\n // filename and the server-resolved filename (attachmentStatuses) only arrives once the job\n // completes. It's simply overwritten on the next send.\n const [lastSentAttachments, setLastSentAttachments] = useState<\n ChatAttachment[]\n >([])\n\n // Restore chat session history, if exists.\n // TODO: currently only a single page is restored. Add support for multiple pages (and detect the user scrolling up to restore the next page of results older)\n // const {\n // data: sessionHistoryInfiniteData,\n // } = //, hasNextPage: hasMoreSessionHistory, fetchNextPage: fetchNextSessionHistoryPage, isLoading: isSessionHistoryLoading } =\n // useGetAgentChatSessionHistoryInfinite(\n // {\n // sessionId: agentSession?.sessionId,\n // },\n // {\n // enabled: !!agentSession,\n // },\n // )\n\n // const sessionHistory = useMemo(\n // () =>\n // sessionHistoryInfiniteData?.pages\n // .flatMap(page => page.page)\n // /* Note: session history is ordered from most recent to least recent in each page, so reverse the order when restoring the chat interface */\n // .reverse() ?? [],\n // [sessionHistoryInfiniteData],\n // )\n\n useEffect(() => {\n // on mount, create a new agent session!\n if (createAgentSession && !agentSession) {\n createAgentSession({\n agentAccessLevel,\n agentRegistrationId,\n sessionContext,\n })\n }\n }, [\n createAgentSession,\n agentSession,\n accessToken,\n sessionContext,\n agentAccessLevel,\n agentRegistrationId,\n ])\n\n useEffect(() => {\n // on mount, resolve the initial message chat interaction (if set)\n if (agentSession && initialMessage && !initialMessageProcessed) {\n sendChat(initialMessage)\n setInitialMessageProcessed(true)\n }\n }, [agentSession, initialMessage, initialMessageProcessed, sendChat])\n\n const handleSend = (message: string, attachments: ChatAttachment[]) => {\n sendChat(\n message,\n attachments.length\n ? attachments.map(attachment => ({\n fileHandleId: attachment.fileHandleId,\n // The backend short-circuits the FileHandleAssociation auth check for a user's own\n // uploaded file handle, so associateObjectId/associateObjectType are not totally\n // accurate here. FileHandleAssociateType has no dedicated value for \"the uploader's\n // own bare file handle\", so this stubs associateObjectId to the fileHandleId itself\n // and the FileEntity associate type, which supports the short-circuit path.\n associateObjectId: attachment.fileHandleId,\n associateObjectType: FileHandleAssociateType.FileEntity,\n }))\n : undefined,\n )\n setUserChatTextfieldValue('')\n setLastSentAttachments(attachments)\n }\n\n if (createAgentSessionError) {\n // When an anonymous user can't start a session, the caller is redirecting them to log in, so\n // suppress the inline error in favor of that flow.\n const deferredToLogin =\n !isAuthenticated &&\n !!onSessionCreationUnauthenticated &&\n (createAgentSessionError.status === 401 ||\n createAgentSessionError.status === 403)\n if (!deferredToLogin) {\n return (\n <Alert severity={'error'} sx={{ my: 2 }}>\n {createAgentSessionError.reason}\n </Alert>\n )\n }\n }\n\n return (\n <Box\n sx={{\n display: 'flex',\n flexDirection: 'column',\n justifyContent: variant === 'curie' ? 'flex-start' : 'space-between',\n gap: variant === 'curie' ? '20px' : '0',\n maxWidth: '1100px',\n mx: 'auto',\n height: '100%',\n }}\n >\n {!hideTitle && (\n <Typography\n variant=\"headline1\"\n sx={{\n p: '20px',\n borderBottom: '1px solid',\n borderColor: 'grey.300',\n position: 'sticky',\n top: '0px',\n backgroundColor: 'white',\n zIndex: 1,\n }}\n >\n {chatbotName}\n </Typography>\n )}\n {showAccessLevelMenu && variant !== 'curie' && isAuthenticated && (\n <AccessLevelMenu\n initAccessLevel={agentAccessLevel}\n onChange={newAccessLevel => {\n setAgentAccessLevel(newAccessLevel)\n updateAgentSession({\n agentAccessLevel: newAccessLevel,\n sessionId: agentSession!.sessionId!,\n })\n }}\n />\n )}\n {!agentSession && <SkeletonParagraph numRows={10} />}\n {agentSession && (\n <Box\n sx={{\n flexGrow: 1,\n overflowY: 'auto',\n mb: variant === 'curie' ? 0 : 2,\n }}\n >\n <List\n sx={{\n flex: 1,\n overflowY: 'auto',\n pt: '20px',\n ...(variant === 'curie' && { pt: 0, pb: 0, gap: '20px' }),\n display: 'flex',\n flexDirection: 'column',\n ...(showGreeting && {\n minHeight: '100%',\n justifyContent: 'flex-end',\n }),\n }}\n >\n {/* {sessionHistory &&\n sessionHistory.map((interaction, index) => {\n return (\n <SynapseChatInteraction\n key={index}\n userMessage={interaction.usersRequestText}\n chatResponseText={interaction.agentResponseText}\n />\n )\n })} */}\n {showGreeting && (\n <ListItem\n sx={{\n display: 'grid',\n gridTemplateColumns: '50px auto',\n columnGap: '16px',\n justifyItems: 'start',\n alignItems: 'start',\n p: 0,\n }}\n >\n {resolvedAgentAvatar}\n <Typography sx={{ justifySelf: 'start', mt: '14px' }}>\n {CURIE_GREETING}\n </Typography>\n </ListItem>\n )}\n {interactions.map((interaction, index) => {\n const isLast = index === interactions.length - 1\n return (\n <SynapseChatMessage\n agentAvatar={resolvedAgentAvatar}\n userAvatar={userAvatar}\n key={interaction.id}\n userMessage={interaction.userMessage}\n chatJobId={interaction.jobId}\n showLoadingIcon={variant !== 'curie'}\n onSendChat={sendChat}\n scrollIntoView={isLast}\n animateEntry={!presentAtMount.has(interaction.id)}\n isAwaitingResponse={isAwaitingResponse}\n pendingAttachments={\n // Only one interaction can be in flight at a time (the composer is disabled\n // while isAwaitingResponse), so lastSentAttachments always corresponds to\n // whichever interaction is last.\n isLast ? lastSentAttachments : undefined\n }\n />\n )\n })}\n </List>\n </Box>\n )}\n <Box\n sx={{\n position: 'sticky',\n bottom: variant === 'curie' ? '0px' : textboxPositionOffset,\n backgroundColor: 'white',\n }}\n >\n {suggestedPrompts &&\n suggestedPrompts.length > 0 &&\n interactions.length === 0 && (\n <Stack\n direction=\"row\"\n spacing={1}\n sx={{ pt: '8px', flexWrap: 'wrap', gap: 1 }}\n >\n {suggestedPrompts.map(prompt => (\n <Chip\n key={prompt}\n label={prompt}\n variant=\"outlined\"\n onClick={() => setUserChatTextfieldValue(prompt)}\n disabled={!agentSession}\n sx={{ cursor: 'pointer' }}\n />\n ))}\n </Stack>\n )}\n <Box sx={{ mt: '5px' }}>\n <ChatInputArea\n value={userChatTextfieldValue}\n onValueChange={setUserChatTextfieldValue}\n onSend={handleSend}\n placeholder={\n variant === 'curie' ? 'Ask anything' : `Message ${chatbotName}`\n }\n disabled={!agentSession || isAwaitingResponse}\n allowAttachments={allowAttachments}\n />\n </Box>\n </Box>\n <Typography variant=\"smallText1\" sx={{ pt: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;OACvB,iBAAiB,MAAY;OAC7B,YAAY;OACZ,gBAAgB;OAChB,cAAc,CAAC,GAAe,IAAI,EAAY,EAAE;OAC5B;OACpB,oBAIE,IAAS,KAAsB,KAAA;MAElC,GAdM,EAAY,EAclB;KAEL,CAAC,CACG;;GACH,CAAA;GAEP,kBAAC,GAAD;IACE,IAAI;KACF,UAAU;KACV,QAAQ,MAAY,UAAU,QAAQ;KACtC,iBAAiB;IACnB;cALF,CAOG,KACC,EAAiB,SAAS,KAC1B,EAAa,WAAW,KACtB,kBAAC,GAAD;KACE,WAAU;KACV,SAAS;KACT,IAAI;MAAE,IAAI;MAAO,UAAU;MAAQ,KAAK;KAAE;eAEzC,EAAiB,KAAI,MACpB,kBAAC,GAAD;MAEE,OAAO;MACP,SAAQ;MACR,eAAe,EAA0B,CAAM;MAC/C,UAAU,CAAC;MACX,IAAI,EAAE,QAAQ,UAAU;KACzB,GANM,CAMN,CACF;IACI,CAAA,GAEX,kBAAC,GAAD;KAAK,IAAI,EAAE,IAAI,MAAM;eACnB,kBAAC,IAAD;MACE,OAAO;MACP,eAAe;MACf,QAAQ;MACR,aACE,MAAY,UAAU,iBAAiB,WAAW;MAEpD,UAAU,CAAC,KAAgB;MACT;KACnB,CAAA;IACE,CAAA,CACF;;GACL,kBAAC,GAAD;IAAY,SAAQ;IAAa,IAAI;KAAE,IAAI;KAAO,WAAW;IAAS;cACnE;GACS,CAAA;EACT;;AAET"}
|
|
@@ -5,7 +5,9 @@ export type SynapsePortalChatDialogProps = SynapseChatProps & {
|
|
|
5
5
|
};
|
|
6
6
|
/**
|
|
7
7
|
* A dialog that wraps SynapseChat with externally-controlled open/close state.
|
|
8
|
-
*
|
|
8
|
+
*
|
|
9
|
+
* Anonymous users are allowed to open the dialog: SynapseChat attempts to create a session, and if
|
|
10
|
+
* the agent is not open to anonymous chat, the user is redirected to log in.
|
|
9
11
|
*/
|
|
10
12
|
export declare function SynapsePortalChatDialog({ open, onClose, ...chatDialogProps }: SynapsePortalChatDialogProps): import("react/jsx-runtime").JSX.Element;
|
|
11
13
|
export default SynapsePortalChatDialog;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SynapsePortalChatDialog.d.ts","sourceRoot":"","sources":["../../../src/components/SynapseChat/SynapsePortalChatDialog.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SynapsePortalChatDialog.d.ts","sourceRoot":"","sources":["../../../src/components/SynapseChat/SynapsePortalChatDialog.tsx"],"names":[],"mappings":"AAIA,OAAoB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAE7D,MAAM,MAAM,4BAA4B,GAAG,gBAAgB,GAAG;IAC5D,IAAI,EAAE,OAAO,CAAA;IACb,OAAO,EAAE,MAAM,IAAI,CAAA;CACpB,CAAA;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,EACtC,IAAI,EACJ,OAAO,EACP,GAAG,eAAe,EACnB,EAAE,4BAA4B,2CAyB9B;AAED,eAAe,uBAAuB,CAAA"}
|
|
@@ -1,21 +1,32 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import t from "
|
|
3
|
-
import
|
|
1
|
+
import { storeRedirectURLForOneSageLoginAndGotoURL as e } from "../../utils/AppUtils/AppUtils.js";
|
|
2
|
+
import { useOneSageURL as t } from "../../utils/hooks/useOneSageURL.js";
|
|
3
|
+
import "../../utils/AppUtils/index.js";
|
|
4
|
+
import { SynapseChat as n } from "./SynapseChat.js";
|
|
5
|
+
import r from "../DraggableDialog/DraggableDialog.js";
|
|
6
|
+
import { persistPortalChatReopenIntent as i } from "./portalChatSessionStorage.js";
|
|
7
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
4
8
|
//#region src/components/SynapseChat/SynapsePortalChatDialog.tsx
|
|
5
|
-
function
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
function o({ open: o, onClose: s, ...c }) {
|
|
10
|
+
let l = t();
|
|
11
|
+
return /* @__PURE__ */ a(r, {
|
|
12
|
+
open: o,
|
|
13
|
+
onClose: s,
|
|
14
|
+
title: c.chatbotName || "SynapseChat",
|
|
15
|
+
variant: c.variant,
|
|
16
|
+
children: /* @__PURE__ */ a(n, {
|
|
12
17
|
hideTitle: !0,
|
|
13
18
|
textboxPositionOffset: "16px",
|
|
14
|
-
|
|
19
|
+
onSessionCreationUnauthenticated: () => {
|
|
20
|
+
i({
|
|
21
|
+
variant: c.variant,
|
|
22
|
+
initialMessage: c.initialMessage
|
|
23
|
+
}), e(l.toString());
|
|
24
|
+
},
|
|
25
|
+
...c
|
|
15
26
|
})
|
|
16
|
-
},
|
|
27
|
+
}, c.variant);
|
|
17
28
|
}
|
|
18
29
|
//#endregion
|
|
19
|
-
export {
|
|
30
|
+
export { o as SynapsePortalChatDialog, o as default };
|
|
20
31
|
|
|
21
32
|
//# sourceMappingURL=SynapsePortalChatDialog.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SynapsePortalChatDialog.js","names":[],"sources":["../../../src/components/SynapseChat/SynapsePortalChatDialog.tsx"],"sourcesContent":["import DraggableDialog from '../DraggableDialog/DraggableDialog'\nimport SynapseChat, { SynapseChatProps } from './SynapseChat'\n\nexport type SynapsePortalChatDialogProps = SynapseChatProps & {\n open: boolean\n onClose: () => void\n}\n\n/**\n * A dialog that wraps SynapseChat with externally-controlled open/close state.\n *
|
|
1
|
+
{"version":3,"file":"SynapsePortalChatDialog.js","names":[],"sources":["../../../src/components/SynapseChat/SynapsePortalChatDialog.tsx"],"sourcesContent":["import DraggableDialog from '../DraggableDialog/DraggableDialog'\nimport { storeRedirectURLForOneSageLoginAndGotoURL } from '@/utils/AppUtils'\nimport { useOneSageURL } from '@/utils/hooks/useOneSageURL'\nimport { persistPortalChatReopenIntent } from './portalChatSessionStorage'\nimport SynapseChat, { SynapseChatProps } from './SynapseChat'\n\nexport type SynapsePortalChatDialogProps = SynapseChatProps & {\n open: boolean\n onClose: () => void\n}\n\n/**\n * A dialog that wraps SynapseChat with externally-controlled open/close state.\n *\n * Anonymous users are allowed to open the dialog: SynapseChat attempts to create a session, and if\n * the agent is not open to anonymous chat, the user is redirected to log in.\n */\nexport function SynapsePortalChatDialog({\n open,\n onClose,\n ...chatDialogProps\n}: SynapsePortalChatDialogProps) {\n const oneSageUrl = useOneSageURL()\n return (\n <DraggableDialog\n key={chatDialogProps.variant}\n open={open}\n onClose={onClose}\n title={chatDialogProps.chatbotName || 'SynapseChat'}\n variant={chatDialogProps.variant}\n >\n <SynapseChat\n hideTitle={true}\n textboxPositionOffset=\"16px\"\n onSessionCreationUnauthenticated={() => {\n // Remember the chat was open so it can be reopened after the login round-trip.\n persistPortalChatReopenIntent({\n variant: chatDialogProps.variant,\n initialMessage: chatDialogProps.initialMessage,\n })\n storeRedirectURLForOneSageLoginAndGotoURL(oneSageUrl.toString())\n }}\n {...chatDialogProps}\n />\n </DraggableDialog>\n )\n}\n\nexport default SynapsePortalChatDialog\n"],"mappings":";;;;;;;;AAiBA,SAAgB,EAAwB,EACtC,SACA,YACA,GAAG,KAC4B;CAC/B,IAAM,IAAa,EAAc;CACjC,OACE,kBAAC,GAAD;EAEQ;EACG;EACT,OAAO,EAAgB,eAAe;EACtC,SAAS,EAAgB;YAEzB,kBAAC,GAAD;GACE,WAAW;GACX,uBAAsB;GACtB,wCAAwC;IAMtC,AAJA,EAA8B;KAC5B,SAAS,EAAgB;KACzB,gBAAgB,EAAgB;IAClC,CAAC,GACD,EAA0C,EAAW,SAAS,CAAC;GACjE;GACA,GAAI;EACL,CAAA;CACc,GAnBV,EAAgB,OAmBN;AAErB"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Persists, across an OAuth login round-trip, the intent to reopen the portal chat dialog.
|
|
3
|
+
*
|
|
4
|
+
* When an anonymous user opens the chat and is redirected to log in, the full-page navigation
|
|
5
|
+
* discards the dialog's open state. Storing the intent before the redirect lets the app reopen the
|
|
6
|
+
* dialog when the user returns authenticated.
|
|
7
|
+
*
|
|
8
|
+
* localStorage (not sessionStorage) is used because the login flow returns to the portal origin in a
|
|
9
|
+
* way that may not preserve the original tab's session (e.g. a fresh tab), and localStorage is shared
|
|
10
|
+
* across tabs of the same origin. The intent is consumed once and carries a short TTL so it can only
|
|
11
|
+
* reopen the chat as part of the immediate round-trip.
|
|
12
|
+
*/
|
|
13
|
+
export type PortalChatReopenIntent = {
|
|
14
|
+
variant?: 'default' | 'curie';
|
|
15
|
+
initialMessage?: string;
|
|
16
|
+
};
|
|
17
|
+
export declare function persistPortalChatReopenIntent(intent: PortalChatReopenIntent): void;
|
|
18
|
+
/**
|
|
19
|
+
* Returns the stored reopen intent and removes it, so a given intent is only ever acted on once.
|
|
20
|
+
* Intents older than the TTL are discarded.
|
|
21
|
+
*/
|
|
22
|
+
export declare function consumePortalChatReopenIntent(): PortalChatReopenIntent | undefined;
|
|
23
|
+
//# sourceMappingURL=portalChatSessionStorage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"portalChatSessionStorage.d.ts","sourceRoot":"","sources":["../../../src/components/SynapseChat/portalChatSessionStorage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,MAAM,MAAM,sBAAsB,GAAG;IACnC,OAAO,CAAC,EAAE,SAAS,GAAG,OAAO,CAAA;IAC7B,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB,CAAA;AAOD,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,sBAAsB,QAO3E;AAED;;;GAGG;AACH,wBAAgB,6BAA6B,IACzC,sBAAsB,GACtB,SAAS,CAkBZ"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
//#region src/components/SynapseChat/portalChatSessionStorage.ts
|
|
2
|
+
var e = "portalChat.reopenAfterLogin", t = 3600 * 1e3;
|
|
3
|
+
function n(t) {
|
|
4
|
+
try {
|
|
5
|
+
let n = {
|
|
6
|
+
...t,
|
|
7
|
+
savedAt: Date.now()
|
|
8
|
+
};
|
|
9
|
+
localStorage.setItem(e, JSON.stringify(n));
|
|
10
|
+
} catch {}
|
|
11
|
+
}
|
|
12
|
+
function r() {
|
|
13
|
+
try {
|
|
14
|
+
let n = localStorage.getItem(e);
|
|
15
|
+
if (!n) return;
|
|
16
|
+
localStorage.removeItem(e);
|
|
17
|
+
let r = JSON.parse(n);
|
|
18
|
+
return typeof r.savedAt != "number" || Date.now() - r.savedAt > t ? void 0 : {
|
|
19
|
+
variant: r.variant,
|
|
20
|
+
initialMessage: r.initialMessage
|
|
21
|
+
};
|
|
22
|
+
} catch {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
export { r as consumePortalChatReopenIntent, n as persistPortalChatReopenIntent };
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=portalChatSessionStorage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"portalChatSessionStorage.js","names":[],"sources":["../../../src/components/SynapseChat/portalChatSessionStorage.ts"],"sourcesContent":["/**\n * Persists, across an OAuth login round-trip, the intent to reopen the portal chat dialog.\n *\n * When an anonymous user opens the chat and is redirected to log in, the full-page navigation\n * discards the dialog's open state. Storing the intent before the redirect lets the app reopen the\n * dialog when the user returns authenticated.\n *\n * localStorage (not sessionStorage) is used because the login flow returns to the portal origin in a\n * way that may not preserve the original tab's session (e.g. a fresh tab), and localStorage is shared\n * across tabs of the same origin. The intent is consumed once and carries a short TTL so it can only\n * reopen the chat as part of the immediate round-trip.\n */\n\nexport type PortalChatReopenIntent = {\n variant?: 'default' | 'curie'\n initialMessage?: string\n}\n\nconst STORAGE_KEY = 'portalChat.reopenAfterLogin'\nconst MAX_AGE_MS = 60 * 60 * 1000 // 1 hour, generous enough to cover login (incl. 2FA)\n\ntype StoredIntent = PortalChatReopenIntent & { savedAt: number }\n\nexport function persistPortalChatReopenIntent(intent: PortalChatReopenIntent) {\n try {\n const stored: StoredIntent = { ...intent, savedAt: Date.now() }\n localStorage.setItem(STORAGE_KEY, JSON.stringify(stored))\n } catch {\n // Storage may be unavailable (e.g. private browsing); reopening is best-effort.\n }\n}\n\n/**\n * Returns the stored reopen intent and removes it, so a given intent is only ever acted on once.\n * Intents older than the TTL are discarded.\n */\nexport function consumePortalChatReopenIntent():\n | PortalChatReopenIntent\n | undefined {\n try {\n const raw = localStorage.getItem(STORAGE_KEY)\n if (!raw) {\n return undefined\n }\n localStorage.removeItem(STORAGE_KEY)\n const stored = JSON.parse(raw) as StoredIntent\n if (\n typeof stored.savedAt !== 'number' ||\n Date.now() - stored.savedAt > MAX_AGE_MS\n ) {\n return undefined\n }\n return { variant: stored.variant, initialMessage: stored.initialMessage }\n } catch {\n return undefined\n }\n}\n"],"mappings":";AAkBA,IAAM,IAAc,+BACd,IAAa,OAAU;AAI7B,SAAgB,EAA8B,GAAgC;CAC5E,IAAI;EACF,IAAM,IAAuB;GAAE,GAAG;GAAQ,SAAS,KAAK,IAAI;EAAE;EAC9D,aAAa,QAAQ,GAAa,KAAK,UAAU,CAAM,CAAC;CAC1D,QAAQ,CAER;AACF;AAMA,SAAgB,IAEF;CACZ,IAAI;EACF,IAAM,IAAM,aAAa,QAAQ,CAAW;EAC5C,IAAI,CAAC,GACH;EAEF,aAAa,WAAW,CAAW;EACnC,IAAM,IAAS,KAAK,MAAM,CAAG;EAO7B,OALE,OAAO,EAAO,WAAY,YAC1B,KAAK,IAAI,IAAI,EAAO,UAAU,IAE9B,SAEK;GAAE,SAAS,EAAO;GAAS,gBAAgB,EAAO;EAAe;CAC1E,QAAQ;EACN;CACF;AACF"}
|
|
@@ -12,6 +12,12 @@ export type TopLevelControlsProps = {
|
|
|
12
12
|
hideFacetFilterControl?: boolean;
|
|
13
13
|
hideQueryCount?: boolean;
|
|
14
14
|
hideSqlEditorControl?: boolean;
|
|
15
|
+
/** When true, shows a `Show / Hide Query Builder` toggle. */
|
|
16
|
+
showQueryBuilderControl?: boolean;
|
|
17
|
+
/** Current QB visibility, driven by the parent. Required when `showQueryBuilderControl` is true. */
|
|
18
|
+
showQueryBuilder?: boolean;
|
|
19
|
+
/** Callback invoked when the QB toggle is clicked. Required when `showQueryBuilderControl` is true. */
|
|
20
|
+
onToggleQueryBuilder?: () => void;
|
|
15
21
|
customControls?: CustomControl[];
|
|
16
22
|
showColumnSelection?: boolean;
|
|
17
23
|
cavaticaConnectAccountURL?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TopLevelControls.d.ts","sourceRoot":"","sources":["../../../../src/components/SynapseTable/TopLevelControls/TopLevelControls.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,GAAG,EAEJ,MAAM,iCAAiC,CAAA;AAGxC,OAAO,EAAE,SAAS,EAAY,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"TopLevelControls.d.ts","sourceRoot":"","sources":["../../../../src/components/SynapseTable/TopLevelControls/TopLevelControls.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,GAAG,EAEJ,MAAM,iCAAiC,CAAA;AAGxC,OAAO,EAAE,SAAS,EAAY,MAAM,OAAO,CAAA;AAmC3C,MAAM,MAAM,qBAAqB,GAAG;IAClC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,+FAA+F;IAC/F,6BAA6B,CAAC,EAAE,OAAO,CAAA;IACvC,qFAAqF;IACrF,+BAA+B,CAAC,EAAE,OAAO,CAAA;IACzC,yBAAyB,CAAC,EAAE,OAAO,CAAA;IACnC,sBAAsB,CAAC,EAAE,OAAO,CAAA;IAChC,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B,6DA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import "../../../utils/index.js";
|
|
5
5
|
import { useGetEntity as n } from "../../../synapse-queries/entity/useEntity.js";
|
|
6
6
|
import "../../../synapse-queries/index.js";
|
|
7
|
-
import
|
|
7
|
+
import r from "../../IconSvg/index.js";
|
|
8
8
|
import "../SynapseTableUtils.js";
|
|
9
|
-
import { useQueryContext as
|
|
9
|
+
import { useQueryContext as ee } from "../../QueryContext/QueryContext.js";
|
|
10
10
|
import "../../QueryContext/index.js";
|
|
11
|
-
import { useGetQueryMetadata as
|
|
12
|
-
import { useQueryVisualizationContext as
|
|
11
|
+
import { useGetQueryMetadata as te } from "../../QueryWrapper/useGetQueryMetadata.js";
|
|
12
|
+
import { useQueryVisualizationContext as ne } from "../../QueryVisualizationWrapper/QueryVisualizationContext.js";
|
|
13
13
|
import "../../QueryVisualizationWrapper/index.js";
|
|
14
|
-
import { isRowSelectionVisibleAtom as
|
|
15
|
-
import { SignInRequiredModal as
|
|
16
|
-
import
|
|
17
|
-
import { ElementWithTooltip as
|
|
18
|
-
import { getNumberOfResultsToInvokeAction as
|
|
19
|
-
import
|
|
20
|
-
import { CustomControlButton as
|
|
21
|
-
import { RowSelectionControls as
|
|
22
|
-
import { DownloadOptions as
|
|
23
|
-
import { ColumnSelection as
|
|
14
|
+
import { isRowSelectionVisibleAtom as re, useHasSelectedRowsAtomValue as i, useSelectedRowsAtomValue as a } from "../../QueryWrapper/TableRowSelectionState.js";
|
|
15
|
+
import { SignInRequiredModal as o } from "../../SignInRequiredModal/SignInRequiredModal.js";
|
|
16
|
+
import s from "../../MissingQueryResultsWarning/MissingQueryResultsWarning.js";
|
|
17
|
+
import { ElementWithTooltip as c } from "../../widgets/ElementWithTooltip.js";
|
|
18
|
+
import { getNumberOfResultsToInvokeAction as l, getNumberOfResultsToInvokeActionCopy as u } from "./TopLevelControlsUtils.js";
|
|
19
|
+
import d from "../export/ExportToAnalysisPlatformDialog.js";
|
|
20
|
+
import { CustomControlButton as f } from "../CustomControls/CustomControlButton.js";
|
|
21
|
+
import { RowSelectionControls as p } from "../RowSelection/RowSelectionControls.js";
|
|
22
|
+
import { DownloadOptions as m } from "../table-top/DownloadOptions.js";
|
|
23
|
+
import { ColumnSelection as h } from "../table-top/ColumnSelection.js";
|
|
24
24
|
import "../table-top/index.js";
|
|
25
|
-
import { useState as
|
|
26
|
-
import { cloneDeep as
|
|
27
|
-
import { Button as
|
|
28
|
-
import { Fragment as
|
|
29
|
-
import { useAtomValue as
|
|
25
|
+
import { useState as g } from "react";
|
|
26
|
+
import { cloneDeep as ie } from "lodash-es";
|
|
27
|
+
import { Button as _, Divider as ae, Tooltip as oe, Typography as se } from "@mui/material";
|
|
28
|
+
import { Fragment as v, jsx as y, jsxs as b } from "react/jsx-runtime";
|
|
29
|
+
import { useAtomValue as x } from "jotai";
|
|
30
30
|
//#region src/components/SynapseTable/TopLevelControls/TopLevelControls.tsx
|
|
31
|
-
var
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
31
|
+
var S = "SendToAnalysisPlatformTopLevelControlButton", C = {
|
|
32
|
+
ml: 2,
|
|
33
|
+
fontWeight: 400,
|
|
34
|
+
fontSize: "14px",
|
|
35
|
+
textDecoration: "none !important"
|
|
36
|
+
}, w = (w) => {
|
|
37
|
+
let [T, E] = g(!1), { isAuthenticated: D } = t(), { name: O, showColumnSelection: k = !1, hideDownload: A = !1, hideAddToDownloadListMenuItem: j, hideProgrammaticOptionsMenuItem: M, hideVisualizationsControl: N = !1, hideFacetFilterControl: P = !1, hideQueryCount: F = !1, hideSqlEditorControl: I = !0, showQueryBuilderControl: L = !1, showQueryBuilder: R = !1, onToggleQueryBuilder: z, customControls: B, cavaticaConnectAccountURL: V, remount: H } = w, { entityId: U, versionNumber: ce, getCurrentQueryRequest: W, hasResettableFilters: G } = ee(), { data: K } = n(U, ce), { data: q } = te(), J = x(re), Y = a(), X = i(), { setShowSearchBar: le, columnsToShowInTable: Z, setColumnsToShowInTable: ue, enabledExternalAnalysisPlatforms: de, setIsShowingExportToAnalysisPlatformModal: fe, unitDescription: pe, setShowDownloadConfirmation: me, showCopyToClipboard: he, hideSearchBarControl: ge, setShowPlots: _e, setShowSqlEditor: ve, showFacetFilter: Q, setShowFacetFilter: ye } = ne(), be = de.length > 0, [xe, $] = g(!1), Se = (e) => {
|
|
38
|
+
let t = ie(Z);
|
|
39
|
+
t.includes(e) ? t = t.filter((t) => t !== e) : t.push(e), ue(t);
|
|
40
|
+
}, Ce = l(X, Y, q?.queryCount), we = u(G, X, Y, q?.queryCount, pe), Te = !F && q?.queryCount !== void 0 ? `(${q.queryCount.toLocaleString()})` : null;
|
|
41
|
+
return /* @__PURE__ */ y("div", {
|
|
37
42
|
className: "TopLevelControls",
|
|
38
43
|
"data-testid": "TopLevelControls",
|
|
39
|
-
children: /* @__PURE__ */
|
|
44
|
+
children: /* @__PURE__ */ b("div", { children: [/* @__PURE__ */ b("div", {
|
|
40
45
|
className: "TopLevelControls__querycount",
|
|
41
|
-
children: [
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
46
|
+
children: [
|
|
47
|
+
O && /* @__PURE__ */ b(v, { children: [/* @__PURE__ */ b(se, {
|
|
48
|
+
variant: "sectionTitle",
|
|
49
|
+
role: "heading",
|
|
50
|
+
children: [
|
|
51
|
+
O,
|
|
52
|
+
" ",
|
|
53
|
+
Te
|
|
54
|
+
]
|
|
55
|
+
}), !F && K && /* @__PURE__ */ y(s, { entity: K })] }),
|
|
56
|
+
!P && /* @__PURE__ */ b(_, {
|
|
57
|
+
variant: "text",
|
|
58
|
+
onClick: () => ye((e) => !e),
|
|
59
|
+
startIcon: /* @__PURE__ */ y(r, {
|
|
60
|
+
icon: Q ? "close" : "filter",
|
|
61
|
+
wrap: !1
|
|
62
|
+
}),
|
|
63
|
+
sx: C,
|
|
64
|
+
children: [Q ? "Hide" : "Show", " filters"]
|
|
55
65
|
}),
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
66
|
+
L && z && /* @__PURE__ */ b(_, {
|
|
67
|
+
variant: "text",
|
|
68
|
+
onClick: z,
|
|
69
|
+
startIcon: /* @__PURE__ */ y(r, {
|
|
70
|
+
icon: R ? "close" : "filter",
|
|
71
|
+
wrap: !1
|
|
72
|
+
}),
|
|
73
|
+
sx: C,
|
|
74
|
+
children: [R ? "Hide" : "Show", " Query Builder"]
|
|
75
|
+
})
|
|
76
|
+
]
|
|
77
|
+
}), /* @__PURE__ */ b("div", {
|
|
65
78
|
className: "TopLevelControls__actions",
|
|
66
79
|
children: [
|
|
67
|
-
|
|
68
|
-
title: /* @__PURE__ */
|
|
80
|
+
be && /* @__PURE__ */ b(v, { children: [/* @__PURE__ */ y(oe, {
|
|
81
|
+
title: /* @__PURE__ */ b(v, { children: [
|
|
69
82
|
"This action will send a reference to",
|
|
70
83
|
" ",
|
|
71
84
|
X ? "each selected file" : "every file in the current table",
|
|
72
85
|
" ",
|
|
73
86
|
"to a chosen external analysis platform.",
|
|
74
87
|
" ",
|
|
75
|
-
!X && Q && /* @__PURE__ */
|
|
76
|
-
X && /* @__PURE__ */
|
|
88
|
+
!X && Q && /* @__PURE__ */ y(v, { children: "You can change what is sent by applying filters using the controls in the sidebar." }),
|
|
89
|
+
X && /* @__PURE__ */ y(v, { children: "You can change what is sent by selecting a different set of files." })
|
|
77
90
|
] }),
|
|
78
|
-
children: /* @__PURE__ */
|
|
91
|
+
children: /* @__PURE__ */ b(_, {
|
|
79
92
|
variant: "text",
|
|
80
|
-
disabled: !
|
|
81
|
-
onClick: () =>
|
|
82
|
-
id:
|
|
93
|
+
disabled: !Ce,
|
|
94
|
+
onClick: () => D ? fe(!0) : E(!0),
|
|
95
|
+
id: S,
|
|
83
96
|
children: [
|
|
84
97
|
"Send ",
|
|
85
|
-
|
|
98
|
+
we,
|
|
86
99
|
" to Analysis Platform"
|
|
87
100
|
]
|
|
88
101
|
})
|
|
89
|
-
}), /* @__PURE__ */
|
|
102
|
+
}), /* @__PURE__ */ y(ae, {
|
|
90
103
|
orientation: "vertical",
|
|
91
104
|
variant: "middle",
|
|
92
105
|
flexItem: !0
|
|
93
106
|
})] }),
|
|
94
|
-
|
|
95
|
-
onHide: () =>
|
|
107
|
+
T && /* @__PURE__ */ y(o, {
|
|
108
|
+
onHide: () => E(!1),
|
|
96
109
|
content: "You must be signed in to send results to an analysis platform."
|
|
97
110
|
}),
|
|
98
|
-
!
|
|
111
|
+
!ge && /* @__PURE__ */ y(c, {
|
|
99
112
|
tooltipText: "Show / Hide Search Bar",
|
|
100
|
-
callbackFn: () =>
|
|
113
|
+
callbackFn: () => le((e) => !e),
|
|
101
114
|
darkTheme: !0,
|
|
102
115
|
icon: "search"
|
|
103
116
|
}),
|
|
104
|
-
|
|
105
|
-
tooltipText:
|
|
117
|
+
he && /* @__PURE__ */ y(c, {
|
|
118
|
+
tooltipText: xe ? "Copied to clipboard" : "Copy this search to the clipboard",
|
|
106
119
|
callbackFn: () => {
|
|
107
120
|
e(window.location.href).then(() => {
|
|
108
121
|
$(!0), setTimeout(() => {
|
|
@@ -113,29 +126,29 @@ var E = "SendToAnalysisPlatformTopLevelControlButton", D = (D) => {
|
|
|
113
126
|
darkTheme: !0,
|
|
114
127
|
icon: "clipboard"
|
|
115
128
|
}),
|
|
116
|
-
!
|
|
129
|
+
!N && /* @__PURE__ */ y(c, {
|
|
117
130
|
tooltipText: "Show / Hide Visualizations",
|
|
118
|
-
callbackFn: () =>
|
|
131
|
+
callbackFn: () => _e((e) => !e),
|
|
119
132
|
darkTheme: !0,
|
|
120
133
|
icon: "chart"
|
|
121
134
|
}),
|
|
122
|
-
!
|
|
135
|
+
!A && /* @__PURE__ */ y(m, {
|
|
123
136
|
darkTheme: !0,
|
|
124
|
-
onDownloadFiles: () =>
|
|
125
|
-
hideAddToDownloadListMenuItem:
|
|
126
|
-
hideProgrammaticOptionsMenuItem:
|
|
137
|
+
onDownloadFiles: () => me(!0),
|
|
138
|
+
hideAddToDownloadListMenuItem: j,
|
|
139
|
+
hideProgrammaticOptionsMenuItem: M
|
|
127
140
|
}),
|
|
128
|
-
!
|
|
141
|
+
!I && /* @__PURE__ */ y(c, {
|
|
129
142
|
tooltipText: "Show / Hide the Advanced Query Editor",
|
|
130
|
-
callbackFn: () =>
|
|
143
|
+
callbackFn: () => ve((e) => !e),
|
|
131
144
|
darkTheme: !0,
|
|
132
145
|
icon: "sqleditor"
|
|
133
146
|
}),
|
|
134
|
-
J && /* @__PURE__ */
|
|
147
|
+
J && /* @__PURE__ */ y(p, {
|
|
135
148
|
customControls: B,
|
|
136
149
|
remount: H
|
|
137
150
|
}),
|
|
138
|
-
!J && B && B.length > 0 && /* @__PURE__ */
|
|
151
|
+
!J && B && B.length > 0 && /* @__PURE__ */ y(v, { children: B.map((e) => /* @__PURE__ */ y(f, {
|
|
139
152
|
variant: "text",
|
|
140
153
|
callbackData: {
|
|
141
154
|
tableId: U,
|
|
@@ -149,18 +162,18 @@ var E = "SendToAnalysisPlatformTopLevelControlButton", D = (D) => {
|
|
|
149
162
|
control: e,
|
|
150
163
|
startIcon: e.icon
|
|
151
164
|
}, e.buttonText)) }),
|
|
152
|
-
|
|
165
|
+
k && /* @__PURE__ */ y(h, {
|
|
153
166
|
headers: q?.selectColumns,
|
|
154
167
|
isColumnSelected: Z,
|
|
155
|
-
toggleColumnSelection:
|
|
168
|
+
toggleColumnSelection: Se,
|
|
156
169
|
darkTheme: !0
|
|
157
170
|
}),
|
|
158
|
-
/* @__PURE__ */
|
|
171
|
+
/* @__PURE__ */ y(d, { platformInstructionProps: { cavaticaConnectAccountURL: V } })
|
|
159
172
|
]
|
|
160
173
|
})] })
|
|
161
174
|
});
|
|
162
175
|
};
|
|
163
176
|
//#endregion
|
|
164
|
-
export {
|
|
177
|
+
export { w as default };
|
|
165
178
|
|
|
166
179
|
//# sourceMappingURL=TopLevelControls.js.map
|